Languages
Go
The Go SDK is distributed by git tag rather than a registry. Go modules resolve straight from a repository, so there is no account to connect.
Install
go get github.com/your-org/api-client-goOptions
| Option | Values | Default |
|---|---|---|
| Client style | functions, namespaced, class, class-namespaced | functions |
| Argument style | object, positional | object |
| Namespace | tags, path | tags |
| Doc comments | full, minimal | full |
| File header | omit, include | omit |
| Usage example | full, concise | full |
Go has no HTTP engine choice: the generated client uses the standard library.
Distribution
- Connect the GitHub App
Octri needs push access to tag releases.
- Set the Go repository
Set Repository for Go specifically. It usually differs from your other languages (
acme-go, notacme-node). - Release
Octri pushes the generated code and a semver tag.
go getresolves it from the tag.
The repository is the import path
This is the one decision in Go that you cannot walk back.
Go derives the module path from the repository URL and writes it into go.mod. github.com/acme/acme-go means users write:
import "github.com/acme/acme-go"Rename or move the repo and every consumer's import breaks, with no deprecation path and no redirect. Go module paths are permanent in a way npm names are not.
Pick the Go repo name deliberately, before the first tag.
Major versions
Go encodes major versions above v1 in the module path:
github.com/acme/acme-go v0 and v1
github.com/acme/acme-go/v2 v2 and upPublishing v2.0.0 means your users change their import line, not just their go.mod. That is the language's design, not Octri's, and it's worth staying on v1 while you can. See Versioning.
What callers write
package main
import (
"context"
"fmt"
"os"
acme "github.com/acme/acme-go"
)
func main() {
client := acme.New(os.Getenv("ACME_TOKEN"))
iter := client.Users.List(context.Background(), &acme.UserListParams{Limit: 100})
for iter.Next() {
fmt.Println(iter.Current().ID)
}
}