-
Notifications
You must be signed in to change notification settings - Fork 0
Development and Contributing
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
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
| 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
| 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
A well-scoped REST endpoint contribution generally follows this sequence:
- Identify the exact official Bitget UTA v3 endpoint documentation.
- Add or update typed request/response models in
models/, retaining financial wire values as strings unless there is a clear reason not to. - Add the service method under
rest/market,rest/account, orrest/trade, usingcontext.Contextas the first argument. - Include a
Docs:link to the exact Bitget page in the exported method's doc comment. - Add unit tests for method, path, query/body shape, signing behavior where relevant, and response/error decoding.
- Update
docs/endpoints.mdso the coverage map remains authoritative. - Run
go test ./...andmake 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
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
| 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. |
Do not open a public issue for a suspected security vulnerability. The repository asks reporters to email sovletig@gmail.com directly. 1