Publishing as a Go module

Publish your public-facing Fern Go SDK to pkg.go.dev. After following the steps on this page, you’ll have a versioned package published on pkg.go.dev.

Versioned package published on Pkgsite

This page assumes that you have:

To successfully publish your SDK as a Go module, your repository must have:

Configure generators.yml

1

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:

1groups:
2 go-sdk:
3 generators:
4 - name: fernapi/fern-go-sdk
5 version: 1.7.0
6 github:
7 repository: devalog/company-go

Publish to pkg.go.dev

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

1

Generate your release

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

$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.

2

Publish on pkg.go.dev

Navigate to https://pkg.go.dev/github.com/<github-org>/<github-repo-name>/ and send a request to index your package. In a few minutes, your new release should be published to https://pkg.go.dev/!

After releasing a new version, it may take a few minutes for pkg.go.dev to index and display the update. You can also try checking to see if the Go proxy has indexed your module at https://proxy.golang.org/github.com/<github-org>/<github-repo-name>/@v/list. pkg.go.dev indexing usually happens within 5-15 min of the proxy picking it up.

For more information, see Go’s documentation on Adding a package.