P
Peter Bourgon
peter.bourgon.org · Personal blog · on HN since 2014
Peter Bourgon, a Go developer and author of Go kit, writes about Go best practices, observability, and dependency management.
What HN saysHN commenters list him among favorite blogs and discuss his Go posts on compatibility and dependencies, including advice against build tags for integration tests.
38HN people shared it
12linked it in comments
37stories submitted
1.7Kstory points
1 year agolast shared
2014people per year2026
Most-shared posts
- 1Go for Industrial Programming7 people · 21 points · first shared 2018 · discussion on HN
- 2Go best practices, six years in4 people · 714 points · first shared 2016 · 202 comments on HN
- 3Go: Best Practices for Production Enviroments4 people · 229 points · first shared 2014 · 44 comments on HN
- 4Observability: the hard parts3 people · 5 points · first shared 2018 · discussion on HN
- 5Observability Signals3 people · 2 points · first shared 2018 · discussion on HN
- 6A response about dep and vgo2 people · 149 points · first shared 2018 · 133 comments on HN
- 7Go kit: Go in the modern enterprise2 people · 142 points · first shared 2015 · 125 comments on HN
- 8A theory of modern Golang2 people · 132 points · first shared 2017 · 109 comments on HN
- 9OK Log2 people · 44 points · first shared 2017 · 6 comments on HN
- 10A case for microservices2 people · 18 points · first shared 2015 · 2 comments on HN
- 11What's appropriate to put in a Go Context?2 people · 16 points · first shared 2016 · discussion on HN
- 12Semantic Import Versioning is unsound2 people · 11 points · first shared 2020 · 1 comments on HN
- 13Metrics, tracing, and logging2 people · 4 points · first shared 2017 · discussion on HN
- 14Don't use build tags for integration tests2 people · 2 points · first shared 2021 · discussion on HN
- 15The nihilist and optimist programmers (2015)1 people · 114 points · first shared 2017 · 36 comments on HN
What HN people wrote when they linked it
heyts · 2017-01-30
This is fun. Here's mine:
- Brad fitzpatrick -- http://bradfitz.com/
- Julia Evans -- https://jvns.ca
- Raymond Hettinger -- https://rhettinger.wordpress.com/
- Rich Hickey -- https://changelog.com/posts/rich-hickeys-greatest-hits
- Peter Bourgon -- https://peter.bourgon.org/
- Rebecca Murphey -- https://rmurphey.com/
- Daniel Greenfield -- https://www.twoscoopspress.com/
sagichmal · 2014-05-07
> [go get] Only works for source code packages, not
> binary dependencies.
There's no such thing as a binary dependency in the Go ecosystem. (At least, not without stretching some definitions.) It's one of Go's greatest strengths, actually.
> There isn't a way to specific source code versions/tags
> in a portable way.
Well, the best practice is to vendor[0], and there are plenty of third-party tools like godep[1] that can manage it for you.
___
[0] http://peter.bourgon.org/go-in-production/#dependency-management
[1] https://github.com/tools/godep
twotwotwo · 2017-01-13
> I'm an engineer too
Yep! Point is, we all are, so we all have to worry about how things break in practice, not only about the theoretical model of compatibility.
And it turns out we break each others' code lots of ways, sometimes even just changing behavior without touching the API. If I had a tool that detected certain build-time problems and worked around others, I could still end up upgrading to a new version of a library that breaks my product. So we end up with vendoring and such where product maintainers sort it out, and probably will continue to need some humans in the loop as long as releases have bugs.
I do think there's plenty to do on the larger issue of compatibility even if not specifically focused on this particular build-time break. There are tools I'd love to see, e.g. to test my program with its deps updated and maybe even do something git-bisect-ish to find just where things went wrong. (Node has something along those lines named Greenkeeper.) Peter Bourgon's got a group working on Go package management, and there's been work done, both practical (e.g. the tools and practices at https://peter.bourgon.org/go-best-practices-2016/#dependency-managemen… and theoretical (https://research.swtch.com/version-sat). Useful progress and interesting stuff.
zalmoxes · 2016-09-28
I don't think it would be fair to say that the Go community optimizes for productivity over good software development practices. In fact, there's been a good push in the community lately to talk about application design and what it means for code to be good/not good.
* https://github.com/marcusolsson/gouk16-slides/blob/master/building-an-…
* https://peter.bourgon.org/go-best-practices-2016/
* http://dave.cheney.net/2016/08/20/solid-go-design
However, as a Go developer I'm finding that a lot of examples/tutorials and github projects are taking shortcuts when it comes to program design and how dependencies(loggers, config, db handlers) are being passed around.
https://peter.bourgon.org/go-best-practices-2016/#program-design
IMO it's a sign of Go still being a relatively new language. Despite the language existing for ~6 years now, we're only discovering some best practices today.
maxmcd · 2023-05-23
Please don't use build tags for integration tests: https://peter.bourgon.org/blog/2021/04/02/dont-use-build-tags-for-inte…
Along with the issues listed here you will run into issues with editors not building/linting your tests files because they have build tags that the editor is unaware of.
You can also put the environment variable in a TestMain[1] to cover an entire package of integration tests:
func TestMain(m *testing.M)
{
if os.Getenv("RUN_INTEGRATION_TESTS") == ""
{
fmt.Println("Skipping integration tests")
return
}
os.Exit(m.Run())
}
[1] https://pkg.go.dev/testing#hdr-Main
shorsher · 2020-08-31
Here's a question from someone who is recently out of school and somewhat new to Go. Is it OK to use Context for request-scoped values? i.e. passing data between middleware? I have started doing this, but is there a better alternative?
Peter Bourgon's blog post[0] about context made me think it is fine. After reading the comments here, I am not so sure. Especially since his post was roughly 4 years ago.
0: https://peter.bourgon.org/blog/2016/07/11/context.html
Hates_ · 2016-05-01
I'm assuming they are the ones listed here: https://peter.bourgon.org/talks/
percept · 2014-07-04
See the "Managing Dependencies" section, and comments:
https://www.digitalocean.com/company/blog/get-your-development-team-st…
Also:
http://peter.bourgon.org/go-in-production/#dependency-management
More discussion:
https://news.ycombinator.com/item?id=7971354
pflats · 2019-05-22
Go modules is exactly the reference case, but let me expand on that a smidge, because that was when this become crystal-clear to me.
There's one exchange in a blog post linked from the article[1] about dep/modules that I think is illustrative of the entire issue (double >> are quotes in the article from Google/go, single > are commentary from the linked blog author):
>>Although it was a successful experiment, Dep is not the right approach for the next decade of Go development. It has many very serious problems. A few:
>>Dep does not support using multiple major versions of a program in a single build. This alone is a complete showstopper. Go is meant for large-scale work, and in a large-scale program different parts will inevitably need different versions of some isolated dependency.
>Russ [a member of the Go team] has asserted this from day one, and has brought several examples out in evidence, but has simply not convinced the committee that it’s true. Calling it a serious problem, let alone a showstopper, is a significant overstatement. The strongest claim that can be made on this point is that it’s a matter of opinion.
That, to me, is that. Go is Google's language, and Google said that for them, not supporting multiple versions of a dependency was a showstopper. The community read that and saw it as a point for debate, and the author continues to try to debate it in the article.
And that's the issue! It was not a point for debate. Google was being forthright. Google…
mcguire · 2019-05-22
I don't know the real relationship between Google and Go, but Go is very much a product of its current core team, who are (AFAIK) all veterans of Bell Labs (Robert Griesemer?) and all have the same Bell Labs approach.
Bell Labs invented Not Invented Here syndrome. You can know this to be true because there is no way this group of people could have the syndrome so bad any other way. The other side of the coin is that they are very, very good. You can know that because they do a lot of interesting, novel work without obviously (or obviously without) having looked at any other research in that field.
Take for example, Chris's comment, "(The most clear and obvious illustration of this is what happened with Go modules, where one member of Google's Go core team discarded the entire system the outside Go community had been working on in favour of a relatively radically different model. See eg for one version of this history.)"
The second link there is to https://peter.bourgon.org/blog/2018/07/27/a-response-about-dep-and-vgo… From that: "[RSC and the dep-pies] discussed dep at the GopherCon contributor summit. Matt Farina says that [Russ Cox] said [he] could do better if [he] went off on [his] own and built something. ... The clear impression was that Russ wasn’t going to engage with the committee, the research [the committee] had prepared for him, or the prototype product of that research, dep — at least, not yet. The clear impression was that Russ had his own…
idop · 2018-03-12
My first resources were the Go website, specifically the following pages/articles: How to Write go Code [1], Effective Go [2] and Frequently Asked Questions [3].
I also read Alan Donovan and Brian Kerninghan's book "The Go Programming Language" [4]. So mostly these four, and of course simply writing code (along with the standard library documentation [5]).
Since then I've also gained a lot of info and insight from various articles and blogs, such as "Debugging Performance Issues in Go Programs" [6] from an Intel blog, various posts from Peter Bourgon's blog [7] and Dave Cheney's blog [8], both of which I highly recommend. Oh, and "The complete guide to Go net/http timeouts" from the Cloudflare blog [9] is also worth reading.
Previously I was mostly a Perl developer, but I also work(ed) a lot with JavaScript, and to a (much) less extent with Haskell, Racket and Nim.
[1] https://golang.org/doc/code.html
[2] https://golang.org/doc/effective_go.html
[3] https://golang.org/doc/faq
[4] http://www.gopl.io/
[5] https://golang.org/pkg/
[6] https://software.intel.com/en-us/blogs/2014/05/10/debugging-performanc…
[7] https://peter.bourgon.org/articles/
[8] https://dave.cheney.net/
[9] https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-time…
Artemis2 · 2018-10-17
Good addition! Here are some more:
https://ferd.ca
https://blog.filippo.io
https://lethain.com
http://movingpackets.net
https://www.integralist.co.uk
https://peter.bourgon.org/blog
https://engineering.linkedin.com/blog
https://begriffs.com
https://mijailovic.net
http://tatiyants.com
http://blog.pentestbegins.com (seems down right now?)
https://kalzumeus.com/archive
http://blog.stephenwolfram.com
https://paragonie.com/blog
https://www.filfre.net
https://brandur.org/articles
http://archagon.net
https://eklitzke.org
I guess I could go on forever…