Skip Navigation
Show nav
Heroku Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Dynos (app containers)
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Command Line
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery
    • Continuous Integration
  • Language Support
    • Node.js
    • Ruby
      • Rails Support
      • Working with Bundler
    • Python
      • Working with Django
      • Background Jobs in Python
    • Java
      • Working with Maven
      • Java Database Operations
      • Working with the Play Framework
      • Working with Spring Boot
      • Java Advanced Topics
    • PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
    • Heroku Redis
    • Apache Kafka on Heroku
    • Other Data Stores
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
    • Compliance
  • Heroku Enterprise
    • Private Spaces
      • Infrastructure Networking
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
    • Single Sign-on (SSO)
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Language Support
  • Go
  • Go Dependency Management
  • Go Dependencies via GB

Go Dependencies via GB

English — 日本語に切り替える

Last updated 23 June 2020

Table of Contents

  • Using gb
  • Adding dependencies
  • Listing vendored dependencies
  • Updating an existing dependency
  • Removing unused dependencies

gb is no longer supported by its maintainer and is being considered for depreciation. Heroku suggests using Go Modules instead. If you have a gb based application, please port it to Go modules ASAP.

This guide outlines how to fully utilize Heroku’s support for specifying dependencies for your Go application with gb.

gb is an alternative build tool for Go and operates on the concept of a project. A gb project is a workspace for all the Go code that is required to build your application. gb, like many other tools, vendors external project dependencies into a vendor/ directory. All of the projects source code, including the vendor/ directory should be checked into your git repository.

When pushing code that uses gb Heroku will use several of your application’s config variables to determine the go version (heroku config:set GOVERSION=go1.5) and any linker symbols / values.

If GOVERSION isn’t set the go version will default to the current, latest released go version supported by heroku.

Using gb

Install/update gb:

$ go get -u github.com/constabulary/gb/...

Unlike the normal go tooling, with gb your project does not, and should not, live in the $GOPATH. A gb project is any directory with a src/ sub directory.

The code for your project is put into packages. These packages reside in sub directories of src/. These packages follow the same rules as with the standard go tooling.

Adding dependencies

  1. gb vendor fetch <dep> the new dependency.
  2. Edit your application’s source code to import & use the new dependency.
  3. Commit the changes with git add -A .; git commit -m "Using <dependency>".

Listing vendored dependencies

$ gb vendor list
github.com/dustin/go-broadcast    https://github.com/dustin/go-broadcast    master 3bdf6d4a7164a50bc19d5f230e2981d87d2584f1
github.com/gin-gonic/gin          https://github.com/gin-gonic/gin          master 52fcc5dbf6e94df33ad313858fb94b713e9d1b4a
github.com/manucorporat/sse       https://github.com/manucorporat/sse       master fe6ea2c8e398672518ef204bf0fbd9af858d0e15
github.com/manucorporat/stats     https://github.com/manucorporat/stats     master 8f2d6ace262eba462e9beb552382c98be51d807b
github.com/mattn/go-colorable     https://github.com/mattn/go-colorable     master 3dac7b4f76f6e17fb39b768b89e3783d16e237fe
golang.org/x/net/context          https://go.googlesource.com/net/context   master 78e1654ef40b8b993e3355307740b1cac8f1db20
gopkg.in/bluesuncorp/validator.v5 https://gopkg.in/bluesuncorp/validator.v5 master d5acf1dac43705f8bfbb71d878e290e2bed3950b

Updating an existing dependency

  1. gb vendor update <dependency>.
  2. Inspect the changes with git diff (or similar).
  3. Commit the changes with git add -A vendor; git commit -m "Update <dependency>".

Removing unused dependencies

  1. gb vendor purge

Keep reading

  • Go Dependency Management

Feedback

Log in to submit feedback.

Go Dependencies via govendor Go Dependencies via Glide

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Podcasts
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing

Subscribe to our monthly newsletter

Your email address:

  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Heroku Podcasts
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Facebook
  • Instagram
  • Github
  • LinkedIn
  • YouTube
Heroku is acompany

 © Salesforce.com

  • heroku.com
  • Terms of Service
  • Privacy
  • Cookies