by damagednoob · 4y ago · 0 comments
The decision to include it is perplexing when other language ecosystems have chosen to keep this kind of functionality out of the standard lib, e.g. requests in python[1]. To quote Kenneth Reitz: "...the standard library is where a library goes to die."
- https://docs.google.com/document/d/1N-12_6YBPpF9o4_Zys_E_ZQn...
- https://go.googlesource.com/proposal/+/master/design/draft-f...
One of the original proposals (https://docs.google.com/document/u/1/d/1zXR-TFL3BfnceEAWytV8...) further explains why, by apparently go-fuzz maintainers team (per issue 329[0] none of them seems in any way broken-hearted about the idea of deprecating go-fuzz eventually):
> go-fuzz suffers from several problems:
> - It breaks multiple times per Go release because it's tied to the way go build works, std lib package structure and dependencies, etc. It broke due to internal packages (multiple times), vendoring (multiple times), changed dependencies in std lib, etc.
> - It tries to do compiler work regarding coverage instrumentation without compiler help. This leads to build breakages on corner case code; poor performance; suboptimal quality of coverage instrumentation (missed edges).
> - Considerable difficulty in integrating it into other build systems and non-standard contexts as it uses source pre-processing.
> Goal of this proposal is to make fuzzing as easy to use as unit testing.
You mentioned requests - the Go net/http library is widely used, even though it's in the standard library. It didn't languish, it didn't die. The interfaces are also used in most 3rd party libraries and work well.
Moreover, Go's quality standard library is often cited as one of its main strengths.
Thus, the inclusion of fuzzing in the stdlib isn't surprising to me. Not saying the other way around would be bad. It's just not surprising, and I don't think it's a bad choice, looking at Go historically.
By contrast Go ships with a high quality standard HTTP library that has lasted a decade and no “requests” equivalent has risen up to challenge it.
Note also that Go’s testing situation in general is much nicer than many other languages precisely because things are baked into the standard library—no need to quibble over which test framework to use or to memorize each framework’s equivalent for “run tests that match this pattern” and so on.
Python should be a case study in the many ways not to build a language.
> By contrast Go ships with a high quality standard HTTP library that has lasted a decade and no “requests” equivalent has risen up to challenge it.
Yeah this also means that you need to update your compiler when there's a vulnerability instead of just a single point release in a library. This happens with some frequency.
The parent poster is right, in my opinion.
Has updating the Go compiler actually been an issue for you in the past? To me, with Go's stability, it's never been more disruptive than updating a library in practice, so I don't see much of a difference.
I've run into issues with several go version updates.
Off the top of my head, all of the following caused breakages:
1. go 1.4 making directories named 'internal' special and un-importable. Cross-package imports that used to work no longer would compile with a compiler error.
2. go 1.9 adding monotonic clock readings in a breaking way, i.e. this program changed output from 1.8 to 1.9: https://go.dev/play/p/Mi6cGCPd0rS (I know it looks contrived, but I'm not digging up the actual code that broke)
3. The change of the http.Server default to serving http2 instead of http/1.1 broke stuff. Of course it did. How can that possibly _not_ break stuff?
4. The changes in 'GO111MODULE' defaults broke many imports which had either malformed or incorrect go.mod files. This one was quite painful for the whole ecosystem.
5. go1.17 switched to silently truncating a lot of query strings. Of course that broke stuff, how could it not? https://go.dev/play/p/azODBvkb-zK
Those are all intentional breaking changes which were not fixed upstream (i.e. are "working as intended"). The unintentional breaking changes, from changing error messages to cause string-based error detection to fail (because so many stdlib errors aren't exported so you have to do string matching), to just plain dumb bugs in the stdlib.... those are vastly more common. Those usually do get fixed in point releases. Take a gander at those release notes, many of the issues highlighted in those changelogs come from pain people hit during upgrades.
I think the majority of go version upgrades have had some amount of pain, and most of them have been far more disruptive than updating a well-built library.
I would much rather update just my fuzz-testing library in a commit, and be confident that it's only used in tests so CI is good enough to validate it, than have to update that and my http package and my tls package and my os package all at once and have to look for bugs _everywhere_.
For one thing I update libraries all the time so it's a very fast, simple, well worn operation. Updating the compiler is a bit more of a chore and I'm going to worry a bit more about the impact (since it's global to all code vs local to one package).
For another, I would want to make sure I had tooling that could tell me "is this library in use by service X". I don't know Go's story there, but I would hope it's trivial to do so for a library but I suspect if it's part of the standard library that may be trickier. If not, nbd.
It's a bad smell to me, but if I were a Go developer it wouldn't break me.
Perhaps ironically, until this native fuzzing package, upgrading the compiler if you had fuzz tests would be one case where things would likely break.
Agreed that the Python stdlib is a disaster, but my point was that the OP contradicts himself by arguing that stability guarantees hold the standard library back while pointing to requests which itself hasn’t made many/any intrepid breaking changes or even sensible non-breaking changes a la async support. Note that “stability is bad” is the OP’s point of view and not mine.
> Tons of cases of "that shouldn't be in std" where libraries have quirky, locked in behaviors, or an entire major breaking release with decades of work to migrate has to be made to clean up the mistakes.
But the parent pointed to the requests library which is not in the stdlib. Note also that Go has been around for a decade and has needed no such major migration initiative.
> Yeah this also means that you need to update your compiler when there's a vulnerability instead of just a single point release in a library. This happens with some frequency.
The frequency is very low and updating the compiler is minimally risky due to Go’s strong compatibility guarantees (precisely the kind of stability the parent opposes). This is a much lesser problem than dependency management in Python (I have 15 years of experience in Python and 10 in Go).
I wasn't holding it up as exemplary. I was using it as an example to show how other language ecosystems have reasoned about what gets included in the stdlib. I can't think of another top20 language that ships fuzzing in the stdlib.
This is the main benefit. I've been using go-fuzz for years and compiler upgrades (especially any changes related to modules/GOROOT/GOPATH) was a pain because it always behaved slightly differently.
> It can also work with built-in Go types, in comparison to traditional fuzzing tools that just work with bytes.
This could have been done just as efficiently without upstream integration.
a) A lack of strong typing
b) A custom compiler toolchain
llvm already has instrumentation/ coverage support and generics make it easy to work with higher level constructs than bytes, although you generally do want to just work with bytes when fuzzing imo.
The language is weak, therefor the language has to add more and more batteries-included because extending it is purposefully difficult.
> [...]
> llvm already has instrumentation/ coverage support
I mean, that supports the idea of having fuzzing support in whatever core you have.
The Go toolchain actually supports emitting instrumentation for LLVM's libFuzzer with -gcflags=all=-d=libfuzzer.
> therefor the language has to add more
Okay, and so? If this ends up making fuzzing more popular and easy-to-use, I frankly don't care if it was added as a library or deeply integrated into the toolchain.
Sweet, that's a smart approach.
> Okay, and so? If this ends up making fuzzing more popular and easy-to-use, I frankly don't care if it was added as a library or deeply integrated into the toolchain.
I don't care either because I don't write Go, so just the fact that it's supported is nice for me since it encourages this in languages I do care about.
But if I were a go developer I might care a lot about how my language evolves, what's built in, what's a library, what the capabilities are, what tools I can integrate with, etc.
It sounds like they've done a pretty good job with regards to this implementation though, happy to see it.
Many Python devs use the OS packaged Python versions, while Go devs tend to use the latest release.
Integrating this in the stdlib means that more people will use basic fuzzing functionality. There's nothing preventing third party fuzzers from continuing to develop.
A great standard lib is one of the best things that can happen to a language. The advantages are huge when it comes to maintaining a project. It's just that it's really hard to create and maintain a standard lib properly.
The Go team makes once again a remarkable good job here. Other languages might not have the resources or expertice to extend and maintain the language and standard lib as well as they do.
Some people argue that there's something inherently bad having a great standard lib, which is of course not true. These arguements seems mainly an excuse for the thin standard lib of their favorite language ...