Publish Go SDKs generated in Postman
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.modmust match the repository URL (for example,module github.com/your-org/your-sdk).
Publish your Go SDK
To publish your SDK, do the following:
-
Push your SDK to a public Git repository.
-
Tag a release using semantic versioning.
-
The module is now available to any user using the following command:
-
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:
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.modto 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.