Docs

Go

Gitpod supports Go right out of the box, but there are still ways to optimize your Go experience within Gitpod.

Examples

Before we start, here are some already gitpodified repositories to give you an idea of what to expect!

Name Open In Gitpod Button
go-swagger/go-swagger Open in Gitpod
gitpod-io/go-gin-app Open in Gitpod
gosh-terminal/gosh Open in Gitpod
gitpod-io/self-hosted Open in Gitpod

Workspace Configuration

VSCode Extensions

Name Description
Go Test Explorer Provides Test Explorer for Go which enables to run your tests at the click of a button!

To install Go Test Explorer for your repository, add the following to your .gitpod.yml

vscode:
  extensions:
    - premparihar.gotestexplorer@0.1.10:jvUM8akrQ67vQxfjaxCgCg==

Start-up tasks

Here is how to have your dependencies automatically fetched before you open your Gitpod workspace!

tasks:
  - init: go get -v -t -d ./...

A full example of a .gitpod.yml file might look like this

image: gitpod/workspace-full

tasks:
  - init: go get -v -t -d ./...

vscode:
  extensions:
    - premparihar.gotestexplorer@0.1.10:jvUM8akrQ67vQxfjaxCgCg==

Using the dep dependency manager in Gitpod

If your project uses the dep dependency manager then you need to add a .gitpod.Dockerfile to your project. A basic example that extends the default workspace image might be something like:

FROM gitpod/workspace-full

USER gitpod

RUN brew install dep

Also, don’t forget to reference the above Dockerfile in your .gitpod.yml configuration file, like so:

image:
  file: .gitpod.Dockerfile

tasks:
  - init: dep ensure

vscode:
  extensions:
    - premparihar.gotestexplorer@0.1.10:jvUM8akrQ67vQxfjaxCgCg==

External Resources