> This page is for SDKs, version Legacy.
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# Publishing as a Go module

> Learn how to publish your Fern-generated Go SDK to pkg.go.dev. Configure generators.yml and release versioned Go modules.

> **You're viewing the legacy SDK docs**
>
> These pages cover SDK generation configured with `generators.yml`. New projects use `sdk-config.yml`, so see [the Current version of this page](/learn/sdks/generators/go/publishing) for up-to-date guidance. To move an existing project, follow the [SDK Config migration guide](/learn/sdks/legacy/generators/migration-guides/sdk-config), which walks through `fern sdk migrate`, and review the [`sdk-config.yml` reference](/learn/sdks/reference/sdk-config).

> **Enterprise feature**
>
> This feature is available only for the [Enterprise plan](https://buildwithfern.com/pricing). To get started, reach out to [support@buildwithfern.com](mailto:support@buildwithfern.com).

Publish your public-facing Fern Go SDK to
[pkg.go.dev](https://pkg.go.dev/). To distribute the SDK internally instead,
generate to the local file system (optionally
[self-hosted](/learn/sdks/legacy/deep-dives/self-hosted)) and build a module source zip
with [`fern generate --package`](/learn/cli-api-reference/cli-reference/sdk-commands#package).

> **Info**
>
> This page assumes that you have:
>
> * An initialized `fern` folder, a GitHub repository for your Go SDK, and a Go generator group in `generators.yml`. See [Generating an SDK (Go)](/learn/sdks/legacy/generators/go/quickstart).

![Versioned package published on Pkgsite](/learn/_fern-img/7a3d5518064057b524561b3a039edcfbd77d41a31ec12ffbcd53a962255a20d3.webp)

## Requirements

Go SDKs are automatically published to [pkg.go.dev](https://pkg.go.dev/) when you push a semantic version tag to your repository and the repository meets the below requirements. No dedicated CI is needed.

Your repository must have:

* Public visibility
* An [approved license](https://pkg.go.dev/license-policy) such as [MIT](https://opensource.org/license/mit) or [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
* A valid module path in `go.mod`, which determines your publish URL. For example, `github.com/your-org/your-sdk` publishes to `https://pkg.go.dev/github.com/your-org/your-sdk`. If your module path includes a major version suffix like `/v2`, your SDK publishes to that versioned URL instead (`https://pkg.go.dev/github.com/your-org/your-sdk/v2`).

## Configure `generators.yml`

#### Configure \`output\` location

Go publishes via Git repositories, so remove the auto-generated
`output` and `config` properties. Instead, add the path to your
GitHub repository:

```yaml {6-7}
groups: 
  go-sdk:
    generators:
      - name: fern-go-sdk
        version: 1.70.7
        github:
          repository: devalog/company-go

```

## Publish to pkg.go.dev

At this point, you're ready to generate a release for your SDK.

#### Generate your release

Regenerate your SDK and publish it on pkg.go.dev:

```bash
fern generate --group go-sdk --version <version>
```

Local machine output will verify that the release is pushed to your
repository and tagged with the version you specified.

#### Verify on pkg.go.dev

Once the semantic version tag is pushed, pkg.go.dev will automatically index your package. Navigate to `https://pkg.go.dev/<go-module-path-in-go.mod>` to verify your SDK is published.

> **Tip**
>
> After releasing a new version, it may take a few minutes for pkg.go.dev
> to index and display the update. You can also check if the Go
> proxy has indexed your module at
> `https://proxy.golang.org/<go-module-path-in-go.mod>/@v/list`. pkg.go.dev
> indexing usually happens within 5-15 minutes of the proxy picking it up.
>
> For more information, see Go's documentation on [Adding a package](https://pkg.go.dev/about#adding-a-package).