The Go modules wiki page is over 60 pages long so there is quite a bit of a learning curve to get it right the first time. When releasing the v2 version of the NATS server earlier this year, we adopted modules, renamed our repos, bump the major version of the project (including client libraries too) all at the same time. In this talk, one of the NATS maintainers will give a quick overview of everything that was impacted from the changes and how all problems were eventually solved.
6. @wallyqs
#Gopherpalooza
NATS Intro
● Created by Derek Collison in 2010 for CloudFoundry
● DNA: Simplicity, performance, security, and availability
● TCP/IP based with a very simple plain text protocol
| PUB | SUB | UNSUB | CONNECT | INFO | MSG | -ERR | +OK | PING | PONG |
14. @wallyqs
#Gopherpalooza
Modules made it into Go 1.11
● Solution for dependencies so far used by NATS projects
was vendoring with `gvt` but got retired
● Team was still on the fence of whether to use `dep`
18. @wallyqs
#Gopherpalooza
Original plan for NATS v2 release
● Adopt Go Modules to get a reproducible build
● Rename the server repos:
○ From: github.com/nats-io/gnatsd
○ To: github.com/nats-io/nats-server
● Rename the client repos:
○ From: github.com/nats-io/go-nats
○ To: github.com/nats-io/nats.go
● Bump client and server version to v2 (git tag)
20. @wallyqs
#Gopherpalooza
Original plan for NATS v2 release
● Adopt Go Modules to get a reproducible build
● Rename the server repos:
○ From: github.com/nats-io/gnatsd
○ To: github.com/nats-io/nats-server
● Rename the client repos:
○ From: github.com/nats-io/go-nats
○ To: github.com/nats-io/nats.go
● Bump client and server version to v2 (git tag)
✅
21. @wallyqs
#Gopherpalooza
NATS repo has changed often
● Past names of NATS repo:
github.com/apcera/nats
github.com/nats-io/nats
github.com/nats-io/go-nats
github.com/nats-io/nats.go (← current)
22. @wallyqs
#Gopherpalooza
Original plan for NATS v2 release
● Adopt Go Modules to get a reproducible build
● Rename the server repos:
○ From: github.com/nats-io/gnatsd
○ To: github.com/nats-io/nats-server
● Rename the client repos:
○ From: github.com/nats-io/go-nats
○ To: github.com/nats-io/nats.go
● Bump client and server version to v2 (git tag)
✅
✅
26. @wallyqs
#Gopherpalooza
Only v2 tag in the server
● Changing both client and server to v2 series turned out too
big of a change for the ecosystem 🤯
Missed this!
35. @wallyqs
#Gopherpalooza
What we should have done
● Carefully read the wiki entry about modules (60 pages!)
https://github.com/golang/go/wiki/Modules
● Thankfully more guides are appearing now:
https://blog.golang.org/v2-go-modules
36. @wallyqs
#Gopherpalooza
What we should have done
● Renaming a Go project is extremely difficult
https://github.com/golang/go/wiki/Resolving-Problems-
From-Modified-Module-Path
38. @wallyqs
#Gopherpalooza
What we should have done
● Make a careful plan, Kubernetes good example:
https://github.com/kubernetes/enhancements/blob/master/keps/sig-arch
itecture/2019-03-19-go-modules.md