Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dependency management in golang

Ramit Surana
August 11, 2016
60

Dependency management in golang

Having trouble managing dependencies with golang ? Here's how to resolve those issues using some of the best tools built by the community for the community.

Ramit Surana

August 11, 2016
Tweet

Transcript

  1. 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.
  2. 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".
  3. 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
  4. 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
  5. 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
  6. 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
  7. Gopm Built by Jiahua Chen Download packages by version,not git,hg,etc.

    It has a registry using which you can fetch the package.
  8. 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
  9. 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.
  10. 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
  11. 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