Live data from Hacker News

Go has added Valgrind support

go-review.googlesource.com

151–157 of 157 posts

Re: Go has added Valgrind support

#151
post #150
post #149

Earlier quoted context omitted.

> Go was sold as a "systems language" for a long time Still is, but it was also made abundantly clear at the time that those systems were things like network servers specifically. It was even later noted that the team was somewhat surprised that people found uses elsewhere. I do recognize this confused the Rust crowd, who bizarrely think that sum types are known as enums, and think that systems are programs that run…

> I do recognize this confused the Rust crowd, who bizarrely think that sum types are known as enums, and think that systems are programs that run on raw hardware (think kernels, embedded software, etc.). But nobody else randomly redefines every word they come across. I was not a Rust developer in 2013 and I still had the same impression. I think that most C developers (which is what I was primarily at the time) woul…

> I think that most C developers (which is what I was primarily at the time) would interpret "systems language" to mean "loosely equivalent to C or C++"

And that would be a fair interpretation. Before Go, Rust, and the like arrived on the scene C and C++ were about the only languages you'd use to write said long-running programs. You could maybe also throw Java in there, but safe to say it was a pretty short list. Most everyone else was focused on scripting workloads there for the longest time. I might even suggest that Go was the very language that broke us out of that loop, ushering in the new era of systems languages.

> Funnily enough, Russ Cox himself said in 2014 that he "slightly regrets" calling Go a systems programming language because it leads to confusion[1].

Stands to reason. Nobody wants to introduce confusion (maybe Pike, who is a language purist). Alternative interpretations obviously exist. Still, it's not clear what else to call it unless we want to settle on Go being a scripting language. But I don't think either of us consider Go as being a scripting language, do we?

> I don't think of it is as being primarily a network server.

In hindsight, as was said. But we're talking about day one. No project has the full vision at the onset. Software is built up, piece by piece, with next steps determined as you go. There may have been some glimmer of understanding of needing to interface with the system at a low level that Go is not well suited for, but "oooh shiny networking abilities"...

> but is instead about what purpose it serves

Well, we know for certain that the only intended purpose for Go was network services. Obviously people have found other uses for it in the wild, but it was always made clear that it was built for a purpose. So, which languages do you think are more in line with building network services? Those that became famous because of Django and Rails, or those that became famous for Torvalds not wanting it in the Linux kernel?

Re: Go has added Valgrind support

#152
post #151
post #150

Earlier quoted context omitted.

> I do recognize this confused the Rust crowd, who bizarrely think that sum types are known as enums, and think that systems are programs that run on raw hardware (think kernels, embedded software, etc.). But nobody else randomly redefines every word they come across. I was not a Rust developer in 2013 and I still had the same impression. I think that most C developers (which is what I was primarily at the time) woul…

> I think that most C developers (which is what I was primarily at the time) would interpret "systems language" to mean "loosely equivalent to C or C++" And that would be a fair interpretation. Before Go, Rust, and the like arrived on the scene C and C++ were about the only languages you'd use to write said long-running programs. You could maybe also throw Java in there, but safe to say it was a pretty short list. Mo…

> Before Go, Rust, and the like arrived on the scene

I'm glad you now agree that Go and Rust have enough similarities to be grouped together in this discussion. ;)

> There may have been some glimmer of understanding of needing to interface with the system at a low level that Go is not well suited for, but "oooh shiny networking abilities"...

I mean, that's just not how Docker was developed at all. I was there (okay, maybe not at the very start but I was involved in the project when it was still very young).

The honest answer is that they didn't foresee how annoying it would be to deal with those things in Go, not that they didn't expect to have to do those things. For one thing, their internal version of Docker at dotCloud was written in Python and so they had a good idea of the kinds of things they will need to do in the rewrite. Lots of lessons were learned over the past decade, you can't just retroactively apply modern maxims like that (i.e., "well, obviously we now know that Go isn't good at X so when they started using it obviously they didn't really plan to use it for X" isn't particularly convincing, especially to people who actually lived through it).

(But none of this is particularly relevant to the original point IMHO.)

Re: Go has added Valgrind support

#153
post #152
post #151

Earlier quoted context omitted.

> I think that most C developers (which is what I was primarily at the time) would interpret "systems language" to mean "loosely equivalent to C or C++" And that would be a fair interpretation. Before Go, Rust, and the like arrived on the scene C and C++ were about the only languages you'd use to write said long-running programs. You could maybe also throw Java in there, but safe to say it was a pretty short list. Mo…

> Before Go, Rust, and the like arrived on the scene I'm glad you now agree that Go and Rust have enough similarities to be grouped together in this discussion. ;) > There may have been some glimmer of understanding of needing to interface with the system at a low level that Go is not well suited for, but "oooh shiny networking abilities"... I mean, that's just not how Docker was developed at all. I was there (okay,…

> I'm glad you now agree that Go and Rust have enough similarities to be grouped together in this discussion. ;)

I'm glad you finally got around to reading the thread. ;) They've been grouped on the same spectrum since the beginning. For example, "Go is most similar to Go, but on the spectrum is way closer to Python and Ruby than it is Rust."

> The honest answer is that they didn't foresee how annoying it would be to deal with those things in Go

I'm sure it was underestimated — developers tend to be optimistic — but certainly when the creators are explicitly telling you that it is a 'dynamically-typed' language intended for writing network services you're going to understand that you're in for a least a bit of a bumpy ride if you try use it for something that would traditionally have been written in C. No need to look back retroactively. Go was originally announced that way.

Regardless, what is curious, though, is that it wasn't recognized as annoying very quickly at the onset. This does suggest, like before, that work began in the places Go excels and once the other stuff came 'round the sunk costs starting sinking in. You were there, so feel free to tell us the whole story, but you'd think the ship would have been abandoned pretty quickly if the "hard parts" were where things started. It is not like the team didn't already give up on another language.

> (But none of this is particularly relevant to the original point IMHO.)

Or is it? I mean, if Go were just like Rust then wouldn't you say those annoying aspects of Docker wouldn't be annoying anymore? That was my read from earlier. But since Go is more like Python and Ruby...

Re: Go has added Valgrind support

#154
post #15

Earlier quoted context omitted.

If that were true it would also apply to C and C++. I have used Valgrind with Python + Boost C++ hybrid programs and it worked fine after spending an hour making a suppressions file.

> it worked fine after spending an hour making a suppressions file. So you are confirming the problem, but treating it as if ignoring it is the solution for all?

Is an hour a big deal if it's something you can use over and over and over for debug purposes going forward?

Re: Go has added Valgrind support

#155
post #99
post #11

Earlier quoted context omitted.

it's not hard. GC lets shit leak until it decided to clean it up... do you think they will enable Valgrind if there's no leaks?

valgrind finds sooooo many more problems than just memory leaks uninitialized memory, illegal writes, etc... There's a lot of good stuff that could be discovered.

not to mention cachegrind, callgrind and other things it bundles.

sorry, i guess when i say leaks i mean a bit more broad stuff :'). my own words are a bit leaky hah

still doesnt mean i am wrong. GC doesnt clean up memory when its released but when it wants to, effectively offering opportunities to get that data after a program dont need it anymore. until some point in time u can usually not specify, just hint at.

that in light of things like bad memory ordering between threads etc..can have nasty bugs... (raii has similar bugs but since its more determenistic you can program your way around lot of it more easily and reliably)

Re: Go has added Valgrind support

#156

I love Valgrind, but since my main development machine is an M3, I don’t get to use it nearly as much as I would like.

https://github.com/LouisBrunner/valgrind-macos

If any macOS experts could help with this port it would be most welcome.

Apple have been making big changes that keep breaking things and Valgrind has not kept up. Louis Brunner has done an amazing job more or less single handedly managed to keep the basic flow working.

Re: Go has added Valgrind support

#157
post #62

Not even a Go user, and yet this is one of the best things I have read today morning. Valgrind is possibly one of the most powerful tools I have in my belt!!

Would you mind to elaborate? I don't program in C but it sounds interesting.

C is the language that benefits the most from tools like Valgrind. It's just so easy in C to write code with memory faults.

Memcheck (the main tool) has shortcomings (very slow, does not detect all kinds of errors). Its strongest point is that it does not need an instrumented build. That can be particularly important if you have issues in 3rd party libraries that you can't build. Its other strong point is that it checks for both addressability and initialisedness at the same time.

My favourite feature is using GDB with Valgrind+vgdb. That allows you to see what memory is addressable and/or initialised from within GDB.

Post reply on HN