2. Agenda
● Go vendoring and package management
● Introduce vgo
● vgo features
● vgo tutorial
3. How to write a Go application
1. We write code
2. We use other’s code
3. ow..
Reference: GopherCon 2017: Sam Boyer - The New Era of Go Package Management
8. Rise of vendoring tools:
● 2013: godep, gom, et. all - 2013
● 2014: glide, gopkg, et. all - 2014
● 2015: gb, govendor, et. all - 2015
● 2017: dep (official experiment)
Reference: GopherCon 2017: Sam Boyer - The New Era of Go Package Management
9. About Vendoring in Go
● 2015: Go 1.5 vendor/ added, default off
● 2016: Go 1.6 vendor/ on by default
● 2017: Go 1.7 vendor/ always on
Reference: GopherCon 2017: Sam Boyer - The New Era of Go Package Management
10. what is vgo
● Proposed Modification to "go" Tool.
● Provide versioned concept to go tools
● Target to ship on go 1.11, will be offcial on go 1.12
● vgo has lots of features….
11. vgo Features
● The Import Compatibility Rule
● Semantic Import Versioning
● Minimal Version Selection
● Allow run go command outside GOPATH
● Default download code in `vgo build`
● ...
12. 1. The Import Compatibility Rule
● 2017/06 github.com/kkdai/testGo
● 2017/08 github.com/kkdai/testGo
● 2017/12 github.com/kkdai/testGo.v2
Need backward-compatible
Breaking change
19. 4. Allow run go command outside GOPATH
Allow running the go command in file trees outside GOPATH, provided there is
a go.mod in the current directory or a parent directory.
That go.mod file defines the mapping from file system to import path as well
as the specific module versions used in the build.
P.S.
● Go 1.10 set default GOPATH
● vgo (1.12?) run go command outside GOPATH
20. 5. Default download without `go get`
● Original build process:
○ Write your own `main.go`
○ `go get` dependency module code
○ `go build`
● vgo build process:
○ Write your own `main.go`
○ `vgo build`
25. vgo tutorial (3)
● Check go.mod
● Question: How to define your version?
○ It support branch and tag
■ https://github.com/bketelsen/captainhook/blob/master/go.mod#L5:2
■ https://github.com/gorilla/mux/releases/tag/v1.6.0
33. 1. Go & Versioning from Russ Cox
2. Youtube: Building Predictability into Your Pipeline ::
Russ Cox; Jess Frazelle, Sam Boyer, Pete Garcin
3. GopherCon 2017: Sam Boyer - The New Era of Go
Package Management
4. Using vgo for Go Dependency Management
5. Repeatable Builds with vgo
Reference: