Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • 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
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Working with AI
    • Heroku Inference
      • Inference API
      • Quick Start Guides
      • AI Models
      • Inference Essentials
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • 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
  • Integrating with Salesforce
  • Language Support
  • Go
  • Go Dependency Management
  • Go Dependencies via GB

Go Dependencies via GB

English — 日本語に切り替える

Last updated August 28, 2024

Table of Contents

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

gb is no longer maintained. gb support on Heroku is deprecated and will be removed on March 1, 2025. 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 Modules Go Dependencies via Glide

Information & Support

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

Language Reference

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

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices