Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GTG30: Introduction vgo

1,480 views

Published on

vgo: An experimental go tools with version concept is under proposal and will include in go 1.12.

Published in: Software
  • Be the first to comment

  • Be the first to like this

GTG30: Introduction vgo

  1. 1. GTG (Golang Taipei Gathering): 30 Introduction vgo Evan Lin
  2. 2. Agenda ● Go vendoring and package management ● Introduce vgo ● vgo features ● vgo tutorial
  3. 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
  4. 4. Need other’s code? `go get github.com/xxxx/xxx`
  5. 5. If you are lucky….
  6. 6. But...
  7. 7. Vendoring control ...
  8. 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. 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. 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. 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. 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
  13. 13. 2. Semantic Import Versioning
  14. 14. 3. Minimal Version Selection Minimal version selection allows modules to specify only minimum requirements for their dependency modules.
  15. 15. When you want the update your software? ● For security concern? ● Faster? Stronger?
  16. 16. Update your vendor code ..
  17. 17. Update your vendor code until you need it
  18. 18. Update your vendor code untill you *REALLY* need it
  19. 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. 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`
  21. 21. vgo tutorial
  22. 22. vgo can run go command outside GOPATH..
  23. 23. vgo tutorial (1): ● Install vgo ○ go get -u golang.org/x/vgo ● example code (download here)
  24. 24. vgo tutorial (2) ● Create go.mod ○ touch go.mod ● Build your code
  25. 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
  26. 26. vgo tutorial (4) ● List all modules
  27. 27. vgo tutorial (5) ● List all availible version on rsc.io/quote (vgo list)
  28. 28. vgo tutorial (6) - Upgrade ● List all module and it latest version
  29. 29. vgo tutorial (7) - Upgrade ● Upgrade to latest module
  30. 30. vgo tutorial (8) - run test on latest module ● Try to test latest modules
  31. 31. vgo tutorial (9) - Downgrading ● Use `vgo get` to downgrading specific version
  32. 32. vgo tutorial (10) - Excluding ● Excluding specific version
  33. 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:
  34. 34. Youtube: Building Predictability into Your Pipeline :: Russ Cox; Jess Frazelle, Sam Boyer, Pete Garcin

×