Slide 1

Slide 1 text

Ramit Surana @ramitsurana /in/ramitsurana Dependency management in Golang

Slide 2

Slide 2 text

Agenda About Me History Dependencies The Problem Golist to the rescue Gopkg Gopm Godep Glide GB

Slide 3

Slide 3 text

About Me Open Source Contributor Gopher [email protected]

Slide 4

Slide 4 text

History Started 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.

Slide 5

Slide 5 text

Dependencies Some 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".

Slide 6

Slide 6 text

The Problem

Slide 7

Slide 7 text

Golist cmd comes to the Rescue Go 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

Slide 8

Slide 8 text

Gopkg Built 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 Gopkg gopkg.in

Slide 9

Slide 9 text

Gom Built 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. Gom github.com/mattn/gom

Slide 10

Slide 10 text

Sample Gomfile

Slide 11

Slide 11 text

Gvt Simple 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

Slide 12

Slide 12 text

Gopm Built by Jiahua Chen Download packages by version,not git,hg,etc. It has a registry using which you can fetch the package.

Slide 13

Slide 13 text

Gopm Registry

Slide 14

Slide 14 text

Godep Most used tool for Managing dependencies in Golang Builds 2 directories vendor and Exports all the dependencies to JSON file Godep github.com/tools/godep

Slide 15

Slide 15 text

Glide It 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.

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

Other Tools Govendor GPM (https://github.com/pote/gpm) GVM (https://github.com/pote/gvp) And many more ….

Slide 19

Slide 19 text

Got Questions ?

Slide 20

Slide 20 text

Thank You