Go in Gitpod

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

Example Repositories

Here are a few Go example projects that are already automated with Gitpod:

Repository Description Try It
prometheus The Prometheus monitoring system and time series database Open in Gitpod
inlets Cloud Native Tunnel for APIs Open in Gitpod
go-swagger A simple yet powerful representation of your RESTful API Open in Gitpod
go-gin-app Gin example running in Gitpod Open in Gitpod
gosh-terminal A terminal implemented in Go where you can do anything Open in Gitpod

Workspace Configuration

VSCode Extensions

Name Description
Go Test Explorer Provides Test Explorer for Go which allows you 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

    - premparihar.gotestexplorer@0.1.10:jvUM8akrQ67vQxfjaxCgCg==

Start-up tasks

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

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

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

image: gitpod/workspace-full

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

    - 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:

  file: .gitpod.Dockerfile

  - init: dep ensure

    - premparihar.gotestexplorer@0.1.10:jvUM8akrQ67vQxfjaxCgCg==


Here is a quick clip on how to automatically configure debugging for Go!

Go debugging example

So, basically in this video we:

  1. First, open the Go file that we want to debug
  2. Then, go to the debug menu and select “Add Configuration…”
  3. Next, in the dropdown choose “Go launch file”
  4. Finally, start debugging your Go program!

You can also create the Go debug configuration file manually

To start debugging your Go application in Gitpod, please create a new directory called .theia/, and inside add a file called launch.json, finally, add the following to it:

  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  "version": "0.2.0",
  "configurations": [
      "name": "Launch file",
      "type": "go",
      "request": "launch",
      "mode": "debug",
      "program": "${file}"

Then, simply open the Go file you want to debug, open the Debug panel (in the left vertical toolbar, click the icon with the crossed-out-spider), and click the green “Run” button.

To see a basic repository with Go debugging enabled, please check out gitpod-io/Gitpod-Go-Debug:

Open in Gitpod

Further Reading