Publish Go SDKs generated in Postman

View as Markdown

This guide covers publishing generated Go SDKs. For information on automating Go SDK publishing, see Publish Go SDKs automatically.

Go modules are distributed through version control. Publishing your SDK makes it available using go get through the Go module proxy and pkg.go.dev.

Prerequisites

To publish your SDK, you need the following:

  • A public Git repository (for example, GitHub or GitLab).
  • The module path in go.mod must match the repository URL (for example, module github.com/your-org/your-sdk).

Publish your Go SDK

To publish your SDK, do the following:

  1. Push your SDK to a public Git repository.

  2. Tag a release using semantic versioning.

    $git tag v1.0.0
    $git push origin v1.0.0
  3. The module is now available to any user using the following command:

    $go get github.com/your-org/your-sdk@v1.0.0
  4. Verify the publication at https://pkg.go.dev/github.com/your-org/your-sdk. Documentation is generated automatically from exported Go doc comments.

Publish updates

To publish updates to your SDK, run the following:

$# Tag a new version
$git tag v1.0.1
$git push origin v1.0.1

Best practices for publishing Go SDKs

Use the following best practices when publishing your Go SDK:

  • Use semantic versioning with major version increments for breaking changes.
  • For v2 and later, update the module path in go.mod to include the major version suffix (for example, module github.com/your-org/your-sdk/v2).
  • Write Go doc comments on all exported types and functions. They become the SDK’s documentation on Go Packages.
  • Tag releases in Git rather than publishing snapshots.