-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add Go SDK #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add Go SDK #52
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eaa2b9f
docs: add AI agent contribution guidelines
Xe 2ad13f3
refactor: rename test workflow to javascript workflow
Xe cb8adda
feat: add Go SDK
Xe a4ab876
fix(go): add type assertion safety in HeadBucketForkOrSnapshot
Xe e5402bd
docs(go): improve CreateBucketFork documentation
Xe 88ecabf
fix(go): handle nil credentials in New client initialization
Xe 03e3812
ci(javascript): run JS tests on different OSes and architectures just…
Xe eb446cd
docs(go): fix package name and function name in doc comments
Xe be21021
ci(javascript): disable tests on ubuntu-arm for now
Xe d8fc0ee
ci(javascript): only ubuntu amd64 for now, windows is broken too
Xe f756dad
fix(go): correct snapshot header parameter name
Xe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Go | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["main"] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| actions: write | ||
|
|
||
| jobs: | ||
| go_tests: | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - ubuntu-24.04 | ||
| - windows-2025 | ||
| - macos-15 | ||
| - ubuntu-24.04-arm | ||
| - windows-11-arm | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-tags: true | ||
|
|
||
| - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
| with: | ||
| node-version: latest | ||
|
|
||
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | ||
| with: | ||
| go-version: stable | ||
|
|
||
| - name: Test | ||
| run: | | ||
| go vet ./... | ||
| go test ./... | ||
|
|
||
| - uses: dominikh/staticcheck-action@024238d2898c874f26d723e7d0ff4308c35589a2 # v1.4.0 | ||
| with: | ||
| version: "latest" | ||
| install-go: false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # Contribution Guidelines | ||
|
|
||
| ## Code Quality & Security | ||
|
|
||
| ### Commit Guidelines | ||
|
|
||
| Commit messages follow **Conventional Commits** format: | ||
|
|
||
| ```text | ||
| [optional scope]: <description> | ||
| [optional body] | ||
| [optional footer(s)] | ||
| ``` | ||
|
|
||
| **Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` | ||
|
|
||
| - Add `!` after type/scope for breaking changes or include `BREAKING CHANGE:` in the footer | ||
| - Keep descriptions concise, imperative, lowercase, and without a trailing period | ||
| - Reference issues/PRs in the footer when applicable | ||
|
|
||
| ### Attribution Requirements | ||
|
|
||
| AI agents must disclose what tool and model they are using in the "Assisted-by" commit footer: | ||
|
|
||
| ```text | ||
| Assisted-by: [Model Name] via [Tool Name] | ||
| ``` | ||
|
|
||
| Example: | ||
|
|
||
| ```text | ||
| Assisted-by: GLM 4.6 via Claude Code | ||
| ``` | ||
|
|
||
| ### Pull Request Requirements | ||
|
|
||
| - Include a clear description of changes | ||
| - Reference any related issues | ||
| - Pass CI (`npm test` for JavaScript, `go test` for Go) | ||
| - Optionally add screenshots for UI changes | ||
|
|
||
| ### Security Best Practices | ||
|
|
||
| - Secrets never belong in the repo; use environment variables or the `secrets` directory (ignored by Git) | ||
| - Run `npm audit` periodically for JavaScript packages and address reported vulnerabilities | ||
| - For Go, use `go mod` to manage dependencies and keep them updated | ||
|
|
||
| ## Project Structure | ||
|
|
||
| This is a monorepo for Tigris object storage SDKs and CLI, containing: | ||
|
|
||
| ### JavaScript/TypeScript Packages | ||
|
|
||
| Located in the root `packages/` directory as npm workspaces: | ||
|
|
||
| - **`@tigrisdata/storage`** ([packages/storage](packages/storage)) - Tigris Storage SDK | ||
| - Built with TypeScript | ||
| - Uses AWS SDK v3 for S3 compatibility | ||
| - Exports both server and client modules | ||
| - Build: `npm run build:storage` | ||
| - Test: `npm run test --workspace=@tigrisdata/storage` | ||
|
|
||
| - **`@tigrisdata/cli`** ([packages/cli](packages/cli)) - Command-line interface | ||
| - Built with TypeScript using Commander.js | ||
| - Depends on `@tigrisdata/storage` | ||
| - Build: `npm run build:cli` | ||
|
|
||
| Root-level npm scripts: | ||
| - `npm run build` - Build all packages | ||
| - `npm test` - Run all tests | ||
| - `npm run lint` - Lint all packages | ||
| - `npm run format` - Format all packages with Prettier | ||
| - `npm run clean` - Clean build artifacts | ||
|
|
||
| ### Go SDK | ||
|
|
||
| Located in the [`go/`](go/) directory: | ||
|
|
||
| - **Module**: `github.com/tigrisdata/storage` | ||
| - **Go version**: 1.25.5 | ||
| - **Uses**: AWS SDK v2 for Go | ||
| - **Main files**: | ||
| - `client.go` - Client implementation | ||
| - `storage.go` - Storage operations | ||
| - `tigrisheaders/` - Tigris-specific headers | ||
|
|
||
| Go commands: | ||
| - `go test ./go/...` - Run all Go tests | ||
| - `go build ./go/...` - Build all Go packages | ||
| - `go mod tidy` - Clean up dependencies | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| ### JavaScript/TypeScript Development | ||
|
|
||
| 1. Install dependencies: `npm install` | ||
| 2. Build packages: `npm run build` or `npm run build:storage` / `npm run build:cli` | ||
| 3. Run tests: `npm test` | ||
| 4. Format code: `npm run format` | ||
| 5. Lint code: `npm run lint` | ||
|
|
||
| ### Go Development | ||
|
|
||
| 1. Navigate to Go directory: `cd go` | ||
| 2. Run tests: `go test ./...` | ||
| 3. Build: `go build ./...` | ||
| 4. Format code: `go fmt ./...` | ||
| 5. Manage dependencies: `go mod tidy` | ||
|
|
||
| ## Testing | ||
|
|
||
| - **JavaScript**: Uses Vitest as the test runner | ||
| - **Go**: Uses the standard `go test` command | ||
| - Always run tests before committing changes | ||
| - Ensure all tests pass in CI before merging | ||
|
|
||
| ## Release Process | ||
|
|
||
| - Releases are automated using semantic-release | ||
| - Commits to `main` trigger automatic releases | ||
| - Pre-releases are done on the `next` branch | ||
| - Both JavaScript packages and Go SDK follow semantic versioning | ||
|
|
||
| ## Additional Notes | ||
|
|
||
| - The project uses Husky for Git hooks (commitlint, etc.) | ||
| - Commitizen is configured for conventional commits | ||
| - ESLint and Prettier are used for JavaScript/TypeScript code quality | ||
| - Go code should follow standard Go conventions and use `go fmt` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @AGENTS.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| module github.com/tigrisdata/storage | ||
|
|
||
| go 1.25.5 | ||
|
|
||
| require ( | ||
| github.com/aws/aws-sdk-go-v2 v1.41.0 | ||
| github.com/aws/aws-sdk-go-v2/config v1.32.6 | ||
| github.com/aws/aws-sdk-go-v2/credentials v1.19.6 | ||
| github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0 | ||
| ) | ||
|
|
||
| require ( | ||
| github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect | ||
| github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect | ||
| github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/sso v1.30.8 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect | ||
| github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 // indirect | ||
| github.com/aws/smithy-go v1.24.0 // indirect | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| github.com/aws/aws-sdk-go-v2 v1.41.0 h1:tNvqh1s+v0vFYdA1xq0aOJH+Y5cRyZ5upu6roPgPKd4= | ||
| github.com/aws/aws-sdk-go-v2 v1.41.0/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0= | ||
| github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU= | ||
| github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4/go.mod h1:IOAPF6oT9KCsceNTvvYMNHy0+kMF8akOjeDvPENWxp4= | ||
| github.com/aws/aws-sdk-go-v2/config v1.32.6 h1:hFLBGUKjmLAekvi1evLi5hVvFQtSo3GYwi+Bx4lpJf8= | ||
| github.com/aws/aws-sdk-go-v2/config v1.32.6/go.mod h1:lcUL/gcd8WyjCrMnxez5OXkO3/rwcNmvfno62tnXNcI= | ||
| github.com/aws/aws-sdk-go-v2/credentials v1.19.6 h1:F9vWao2TwjV2MyiyVS+duza0NIRtAslgLUM0vTA1ZaE= | ||
| github.com/aws/aws-sdk-go-v2/credentials v1.19.6/go.mod h1:SgHzKjEVsdQr6Opor0ihgWtkWdfRAIwxYzSJ8O85VHY= | ||
| github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 h1:80+uETIWS1BqjnN9uJ0dBUaETh+P1XwFy5vwHwK5r9k= | ||
| github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16/go.mod h1:wOOsYuxYuB/7FlnVtzeBYRcjSRtQpAW0hCP7tIULMwo= | ||
| github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 h1:rgGwPzb82iBYSvHMHXc8h9mRoOUBZIGFgKb9qniaZZc= | ||
| github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16/go.mod h1:L/UxsGeKpGoIj6DxfhOWHWQ/kGKcd4I1VncE4++IyKA= | ||
| github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 h1:1jtGzuV7c82xnqOVfx2F0xmJcOw5374L7N6juGW6x6U= | ||
| github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16/go.mod h1:M2E5OQf+XLe+SZGmmpaI2yy+J326aFf6/+54PoxSANc= | ||
| github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= | ||
| github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= | ||
| github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16 h1:CjMzUs78RDDv4ROu3JnJn/Ig1r6ZD7/T2DXLLRpejic= | ||
| github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16/go.mod h1:uVW4OLBqbJXSHJYA9svT9BluSvvwbzLQ2Crf6UPzR3c= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 h1:0ryTNEdJbzUCEWkVXEXoqlXV72J5keC1GvILMOuD00E= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4/go.mod h1:HQ4qwNZh32C3CBeO6iJLQlgtMzqeG17ziAA/3KDJFow= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 h1:DIBqIrJ7hv+e4CmIk2z3pyKT+3B6qVMgRsawHiR3qso= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7/go.mod h1:vLm00xmBke75UmpNvOcZQ/Q30ZFjbczeLFqGx5urmGo= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 h1:oHjJHeUy0ImIV0bsrX0X91GkV5nJAyv1l1CC9lnO0TI= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16/go.mod h1:iRSNGgOYmiYwSCXxXaKb9HfOEj40+oTKn8pTxMlYkRM= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 h1:NSbvS17MlI2lurYgXnCOLvCFX38sBW4eiVER7+kkgsU= | ||
| github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16/go.mod h1:SwT8Tmqd4sA6G1qaGdzWCJN99bUmPGHfRwwq3G5Qb+A= | ||
| github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0 h1:MIWra+MSq53CFaXXAywB2qg9YvVZifkk6vEGl/1Qor0= | ||
| github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0/go.mod h1:79S2BdqCJpScXZA2y+cpZuocWsjGjJINyXnOsf5DTz8= | ||
| github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 h1:HpI7aMmJ+mm1wkSHIA2t5EaFFv5EFYXePW30p1EIrbQ= | ||
| github.com/aws/aws-sdk-go-v2/service/signin v1.0.4/go.mod h1:C5RdGMYGlfM0gYq/tifqgn4EbyX99V15P2V3R+VHbQU= | ||
| github.com/aws/aws-sdk-go-v2/service/sso v1.30.8 h1:aM/Q24rIlS3bRAhTyFurowU8A0SMyGDtEOY/l/s/1Uw= | ||
| github.com/aws/aws-sdk-go-v2/service/sso v1.30.8/go.mod h1:+fWt2UHSb4kS7Pu8y+BMBvJF0EWx+4H0hzNwtDNRTrg= | ||
| github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 h1:AHDr0DaHIAo8c9t1emrzAlVDFp+iMMKnPdYy6XO4MCE= | ||
| github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12/go.mod h1:GQ73XawFFiWxyWXMHWfhiomvP3tXtdNar/fi8z18sx0= | ||
| github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 h1:SciGFVNZ4mHdm7gpD1dgZYnCuVdX1s+lFTg4+4DOy70= | ||
| github.com/aws/aws-sdk-go-v2/service/sts v1.41.5/go.mod h1:iW40X4QBmUxdP+fZNOpfmkdMZqsovezbAeO+Ubiv2pk= | ||
| github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= | ||
| github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.