Go


Overview

Go modules is the dependency management system for Go projects. It allows you to manage versioned dependencies and ensure reproducible builds.

JFrog Fly proxies Go modules from proxy.golang.org (the official Go module mirror). By configuring Fly, all your dependencies are cached and managed through Fly, providing faster downloads and unified dependency management.


Supported Clients

JFrog Fly supports Go modules with:

  • Go CLI (go get, go mod download) - The standard Go toolchain for managing dependencies

Download Module

With Fly App

Activate Go in your Fly App to configure your GOPROXY to use Fly. All modules from proxy.golang.org will be cached and managed through Fly:

go get <module-path>

Or download all dependencies:

go mod download

Manual Configuration

1. Generate an access token in Fly Token Management

2. Configure GOPROXY to route through Fly:

go env -w GOPROXY=https://<your-fly-username>:<your-fly-token>@<your-fly-subdomain>.jfrog.io/artifactory/api/go/go,direct

Note: The ,direct fallback ensures that if a module is not found in Fly, Go will attempt to fetch it directly from the source. This is the recommended configuration.

3. Download module:

go get <module-path>

All modules will be fetched from proxy.golang.org through Fly and cached for future use.


Download Modules with CI

To download Go modules with CI, update your GitHub Actions workflow to include the Fly action.

Simply type in your IDE the prompt: “Configure my workflows with Fly” and Fly MCP will configure your GitHub Actions workflow yml file, as follows:

1. Add permissions (top level, after on:):

permissions:
  contents: read
  id-token: write

2. Add Fly Action (after actions/setup-go, before go commands):

- name: JFrog Fly - Configure all your package managers to work with Fly registry
  uses: jfrog/fly-action@v1
  with:
    url: https://<your-fly-subdomain>.jfrog.io

GitHub Action Example

name: Build Go Application

on:
  push:
    branches: [main]

permissions:
  contents: read
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.21'

      - name: JFrog Fly - Configure all your package managers to work with Fly registry
        uses: jfrog/fly-action@v1
        with:
          url: https://<your-fly-subdomain>.jfrog.io

      - name: Download dependencies
        run: go mod download

      - name: Build
        run: go build -v ./...

      - name: Test
        run: go test -v ./...

Back to Package Types →