Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.
- Go 1.21+
- Docker (only required to run wire tests; see Wire Tests)
Install the project dependencies:
go mod tidyBuild the project:
go build ./...Run the test suite:
go test ./...If this SDK includes a wiremock/ directory, the test suite contains wire tests that exercise the client against a WireMock server. The go test command above expects WIREMOCK_URL to point at a running WireMock instance.
Start WireMock, run the tests, then tear it down:
docker compose -f wiremock/docker-compose.test.yml up -d
export WIREMOCK_URL=http://localhost:$(docker compose -f wiremock/docker-compose.test.yml port wiremock 8080 | cut -d: -f2)
go test ./...
docker compose -f wiremock/docker-compose.test.yml downThe compose file maps WireMock's container port 8080 to a random host port, which is why WIREMOCK_URL is derived from docker compose ... port rather than hardcoded.
Format code:
gofmt -w .Or equivalently:
go fmt ./...Run the Go vet tool to catch common mistakes:
go vet ./...Important: Most files in this SDK are automatically generated by Fern from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
The following directories contain generated code:
- Most Go files in the project
If you need to customize the SDK, you have two options:
For custom code that should persist across SDK regenerations:
- Create a
.fernignorefile in the project root - Add file patterns for files you want to preserve (similar to
.gitignoresyntax) - Add your custom code to those files
Files listed in .fernignore will not be overwritten when the SDK is regenerated.
For more information, see the Fern documentation on custom code.
If you want to change how code is generated for all users of this SDK:
- The Go SDK generator lives in the Fern repository
- Generator code is located at
generators/go-v2/ - Follow the Fern contributing guidelines
- Submit a pull request with your changes to the generator
This approach is best for:
- Bug fixes in generated code
- New features that would benefit all users
- Improvements to code generation patterns
- Create a new branch for your changes
- Make your modifications
- Run tests to ensure nothing breaks:
go test ./... - Format your code:
gofmt -w . - Vet your code:
go vet ./... - Build the project:
go build ./... - Commit your changes with a clear commit message
- Push your branch and create a pull request
Write clear, descriptive commit messages that explain what changed and why.
This project uses gofmt for code formatting. Run gofmt -w . before committing to ensure your code meets the project's style guidelines.
If you have questions or run into issues:
- Check the Fern documentation
- Search existing GitHub issues
- Open a new issue if your question hasn't been addressed
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.