Dependency management in golang

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

Transcript of Dependency management in golang

Page 1: Dependency management in golang

Ramit Surana @ramitsurana /in/ramitsurana

Dependency management in Golang

Page 2: Dependency management in golang

AgendaAbout Me

History

Dependencies

The Problem

Golist to the rescue

Gopkg

Gopm

Godep

Glide

GB

Page 3: Dependency management in golang

About MeOpen Source Contributor

Gopher

[email protected]

Page 4: Dependency management in golang

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.

Page 5: Dependency management in golang

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

Page 6: Dependency management in golang

The Problem

Page 7: Dependency management in golang

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

Page 8: Dependency management in golang

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

Page 9: Dependency management in golang

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

Page 10: Dependency management in golang

Sample Gomfile

Page 11: Dependency management in golang

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

Page 12: Dependency management in golang

GopmBuilt by Jiahua Chen

Download packages by version,not git,hg,etc.

It has a registry using which you can fetch the package.

Page 13: Dependency management in golang

Gopm Registry

Page 14: Dependency management in golang

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

Page 15: Dependency management in golang

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.

Page 16: Dependency management in golang

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

Page 17: Dependency management in golang

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

Page 18: Dependency management in golang

Other Tools

Govendor

GPM (https://github.com/pote/gpm)

GVM (https://github.com/pote/gvp)

And many more ….

Page 19: Dependency management in golang

Got Questions ?

Page 20: Dependency management in golang

Thank You