logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

goproxy-breaks-go.md (3808B)


  1. ---
  2. title: proxy.golang.org allows many Go packages to be silently broken
  3. date: 2021-08-06
  4. ---
  5. GOPROXY (or [proxy.golang.org][0]) is a service through which all "go get"
  6. commands (and other module downloads) are routed. It may speed up some
  7. operations by providing a cache, and it publishes checksums and an "index" of
  8. all Go packages; but this is done at the cost of sending details of all of your
  9. module downloads to Google and imposing extra steps when using Go packages from
  10. an intranet.
  11. [0]: https://proxy.golang.org
  12. This cache never expires, which can cause some problems: you can keep fetching a
  13. module from proxy.golang.org long after the upstream version has disappeared.
  14. The upstream author probably had a good reason for removing a version! Because I
  15. set `GOPROXY=direct` in my environment,[^1] which bypasses the proxy, I've been
  16. made aware of a great number of Go packages which have broken dependencies and
  17. are none the wiser. They generally can't reproduce the problem without
  18. `GOPROXY=direct`, which can make it a challenge to rouse up the enthusiasm for
  19. upstream to actually fix the issue. Caching modules forever can encourage
  20. bitrot.
  21. [^1]: Mainly for practical reasons, since it busts the cache when I need to fetch the latest version of a recently-updated module.
  22. Packages which have these issues cannot be built unless Google keeps the cache
  23. valid forever and can be trusted to treat the personal data associated with the
  24. request with respect. Furthermore, as soon as a debugging session finds its way
  25. to an absent module, you could be surprised to find that upstream is gone and
  26. that fetching or patching the code may be a challenge. This has created ticking
  27. time bombs throughout the Go ecosystem, which go undetected because GOPROXY
  28. hides the problem from developers.
  29. If you want to check if your packages are affected by this, just set
  30. `GOPROXY=direct` in your environment, blow away your local cache, and build your
  31. packages again. You might uncover an unpleasant surprise.
  32. It may be worth noting that I already have a poor opinion of the Go module
  33. mirror — it's been DDoS'ing my servers since February.[^2] [Since I
  34. reported this][2], the Go team has been very opaque and non-communicative, and
  35. none of their mitigations have had a meaningful improvement. Most of the traffic
  36. is redundant — many modules are downloaded over and over again in short
  37. time intervals. I have the option of blocking their traffic, of course, but that
  38. would also block all Go programmers from fetching modules from my service. I
  39. hope they adopt my recommendation of allowing admins to configure the crawl
  40. parameters via robots.txt.
  41. [2]: https://github.com/golang/go/issues/44577
  42. [^2]: I SSH'd into git.sr.ht just now and found 50 git clones from the Go module mirror in the last 30 seconds, which is about ⅓ of all of our git traffic.
  43. But, to be honest, the Go module mirror might not need to exist at all.
  44. <details>
  45. <summary>P.S. Do you have feedback on this post?</summary>
  46. <p>
  47. I said, in
  48. <a
  49. href="https://drewdevault.com/2021/04/26/Cryptocurrency-is-a-disaster.html"
  50. >Cryptocurrency is an abject disaster</a>, that I wanted to make my blog
  51. more constructive. As it necessarily required a critical tone, this post might
  52. have broken this promise. Taking extra care to avoid this, I made an effort to
  53. use measured, reasonable language, to address specific problems rather than
  54. making generalizations, and to avoid flamebait, and I sought second opinions
  55. on the article before publishing.
  56. <p>
  57. I would welcome your feedback on the results. Was this post constructive?
  58. Should I instead refrain from this kind of criticism in general? Do you have
  59. any other thoughts to share? Please <a
  60. href="mailto:sir@cmpwn.com"
  61. >email me</a> if so.
  62. </details>