Dependency management in golang
-
Upload
ramit-surana -
Category
Software
-
view
384 -
download
7
Transcript of Dependency management in golang
Ramit Surana @ramitsurana /in/ramitsurana
Dependency management in Golang
AgendaAbout Me
History
Dependencies
The Problem
Golist to the rescue
Gopkg
Gopm
Godep
Glide
GB
HistoryStarted as Go a "systems language"
The turning point for the project was the release of Go 1 in March 2012
This year Gophercon turns 3 years old.
DependenciesSome file that you are trying to install in order to run another file.
Whenever a class A uses another class or interface B, then A depends on B. In such a situation the class A is called the "dependant" and the class or interface B is called the "dependency".
The Problem
Golist cmd comes to the RescueGo list uses –f to use flags
$ go list -f '{{ .Imports }}' github.com/xxx/yyy
$ go list -f '{{ .Deps }}' github.com/xxx/yyy
$ list -f '{{ join .Imports "\n" }}' github.com/xxx/yyy
GopkgBuilt by Gustavo Niemeyer
Provides stable APIs for the Go language
Uses yaml package for building URL's
URL is cleaner and shorter
It redirects to the package documentation at godoc.org when opened with a browser
Gopkggopkg.in
GomBuilt by Yasuhiro Matsumoto.
Uses a Gomfile to create test enviornment and groups for the project
Could generate and use travis test by generating a travis-yml file.
Gomgithub.com/mattn/gom
Sample Gomfile
GvtSimple vendoring tool made for Go native vendoring
Made by Filo Sottile
No need to manually chase, copy or cleanup dependencies Gvt
github.com/FiloSottile/gvt
GopmBuilt by Jiahua Chen
Download packages by version,not git,hg,etc.
It has a registry using which you can fetch the package.
Gopm Registry
GodepMost used tool for Managing dependencies in Golang
Builds 2 directories vendor and
Exports all the dependencies to JSON file Godep
github.com/tools/godep
GlideIt supports tools likegit,bzr,hg,svn etc.
Manage and install dependencies on-demand
Dependencies for a project are listed in a glide.yaml file
It creates a glide.lock file containing the complete dependency tree pinned to specific versions.
How to use glide ?Installation
$ curl https://glide.sh/get | sh
Creating yaml file
$ glide create
Glide up
$ glide up
It creates the glide.lock file which locks the versions of the current state version of dependencies
GB
Proof of concept (PoC) replacement build tool
Basically project to help you start a workflow for your project
Workspace for all the Go code that is required to build your project.
No environment variables to set
Other Tools
Govendor
GPM (https://github.com/pote/gpm)
GVM (https://github.com/pote/gvp)
And many more ….
Got Questions ?
Thank You