Skip to content

Development and Contributing

Igor Sazonov edited this page Aug 9, 2026 · 1 revision

Contributions should preserve the library's focus on small, typed, context-aware UTA integrations. The repository asks contributors to branch from main, add or update tests for behavior changes, run the project checks, document exported endpoint methods with the exact Bitget API URL, and update the endpoint coverage map when a new endpoint is added. 1

Local setup

Clone the repository and run the Go test suite:

git clone https://github.com/tigusigalpa/bitget-go.git
cd bitget-go
go test ./...

The module declares Go 1.21 as its minimum version. 2

Available Make targets

Command Effect
make test Run go test ./....
make test-verbose Run the test suite with verbose output.
make test-coverage Run race-aware coverage and print function coverage.
make coverage-html Generate coverage.html from the coverage profile.
make test-func FUNC=Name Run a matching test selection.
make fmt Apply simplified gofmt formatting across the tree.
make lint Run golangci-lint with a five-minute timeout.
make tidy Run go mod tidy.
make build Build all packages.
make clean Remove generated coverage files.
make check Run formatting, linting, and tests.

Run make check before opening a pull request. It depends on fmt, lint, and test, so install golangci-lint locally if you want the full check target to complete. 1 3

Test layers

Layer Command Credentials Purpose
Unit tests go test ./... None Validate signing vectors, request behavior, response decoding, models, and WebSocket helpers using offline test servers/mocks.
Integration tests go test -tags=integration ./... BITGET_API_KEY, BITGET_SECRET_KEY, BITGET_PASSPHRASE Exercise a public ticker call and a private account call against Bitget; use Demo credentials for the private test.

The integration test file is protected by the integration build tag. Do not place production credentials in CI logs, repository secrets visible to forks, or source files. 4

Add a REST endpoint

A well-scoped REST endpoint contribution generally follows this sequence:

  1. Identify the exact official Bitget UTA v3 endpoint documentation.
  2. Add or update typed request/response models in models/, retaining financial wire values as strings unless there is a clear reason not to.
  3. Add the service method under rest/market, rest/account, or rest/trade, using context.Context as the first argument.
  4. Include a Docs: link to the exact Bitget page in the exported method's doc comment.
  5. Add unit tests for method, path, query/body shape, signing behavior where relevant, and response/error decoding.
  6. Update docs/endpoints.md so the coverage map remains authoritative.
  7. Run go test ./... and make check.

The repository's existing service packages use injected low-level functions to avoid import cycles while keeping the public top-level RestClient simple. Use the surrounding package conventions rather than bypassing the shared client transport. 1 5

Add a WebSocket payload model

The WebSocket transport is designed to be generic. When adding typed support for a new channel, keep the transport subscription shape (models.WSArg / models.WSPush) intact and add a channel-specific data struct in models/. Document how WSPush.Data should be decoded, add known-payload tests, and update the coverage map. The current FastFill model is a useful pattern. 5 6

Pull-request checklist

Check Expected result
Scope The change adds or fixes one coherent behavior.
Types Request/response fields match the intended official API page.
Documentation Exported endpoint method has a Docs: line; coverage map is current.
Tests New behavior is covered and go test ./... passes.
Style make check completes locally.
Security No credentials, tokens, secrets, or real account data are included.

Security reports

Do not open a public issue for a suspected security vulnerability. The repository asks reporters to email sovletig@gmail.com directly. 1

References

Clone this wiki locally