The project requires Go 1.24 or later. Clone the repository and install dependencies.
$ git clone https://github.com/tarantool/go-storage
$ cd go-storage
$ go mod tidyWhen creating feature branches, follow these naming patterns:
<user.name>/gh-<issue-id>-short-description(for GitHub issues)<user.name>/gh-no-short-description(for work not tied to an issue)<user.name>/tntp-<issue-id>-short-description(for TNTP issues)
For release branches, use:
<user.name>/release-v<version>
Replace <user.name> with your Git username, <issue-id> with the issue
number, and <short-description> with a brief description using lowercase,
hyphen-separated words, do not use any symbols except numbers, letters and
dashes.
Examples from existing branches:
bigbes/gh-22-redo-rsapsa-apibigbes/tntp-4191-implement-storageelhimov/tntp-4169-base-cipatapenka-alexey/tntp-4190-namerbigbes/release-v1.0.0
For more examples, look at existing branches by running git branch.
Although working on features without opened issue is possible - avoid that at all costs.
# To run unit and integration tests for the main package and each subpackage:
make test
# To run tests with race detector:
make testrace
# To run tests for a specific package (e.g., `driver/etcd`):
go test ./driver/etcdFollow these patterns when naming test functions:
// Unit test naming patterns
Test<FunctionName>_<Description>
Test<StructName>_<Method>_<Description>
Test<StructName><Method>_<Description>
// Integration test naming patterns (all above plus)
Test<Description>Examples from the codebase: TestTypedGet_PassingModRevision,
TestEtcdDriver_Put, TestTCSDriver_ValueEqualPredicate.
Integration tests require external dependencies:
- etcd: Tests use etcd's embedded integration framework; no external setup needed.
- Tarantool Config Storage (TCS): Tests require Tarantool EE SDK. If the SDK is not available, integration tests are skipped automatically.
If you have Tarantool EE SDK installed, set TARANTOOL_SDK_PATH environment
variable to the SDK directory. The integration tests will automatically detect
it.
To run tests with coverage collection:
make coverageThis generates a coverage profile and prints coverage statistics.
The project includes executable examples in the driver packages. To run the etcd examples:
go test -v -run Example ./driver/etcdFor TCS examples:
go test -v -run Example ./driver/tcsTo run the linter (golangci-lint) on the codebase:
make lintThis will automatically install golangci-lint if missing. The lint target also
runs go mod tidy and go mod vendor to ensure dependency consistency.
The project uses goimports for code formatting. The linter ensures formatting
consistency. You can format your code with:
goimports -w .To check for common misspellings in code and documentation:
make codespell- Public API contains functions, variables, constants that are needed from outside by users. All the rest should be left closed.
- Public functions, variables and constants contain at least a single-line comment.
- Code is DRY (see "Do not Repeat Yourself" principle).
- New features have functional and probably performance tests.
- There are no changes in files not related to the issue.
- There are no obvious flaky tests.
- Commits with bugfixes have tests based on reproducers.
- Changelog entry is present in
CHANGELOG.md. - Public methods contain executable examples (contains a comment with reference output).
- Autogenerated documentation looks good. Run
godoc -http=:6060and point your web browser to address "http://127.0.0.1:6060" for evaluating. - Commit message header may start with a prefix with a short description
follows after colon. It is applicable to changes in a README, examples,
tests and CI configuration files.
Examples:
github-ci: add Tarantool 2.x-latestandreadme: describe how to run tests. - Check your comments, commit title, and even variable names to be grammatically correct. Start sentences from a capital letter, end with a dot. Everywhere - in the code, in the tests, in the commit message.
Follow the Conventional Commits style:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test additions/modificationsrefactor:for code refactoringchore:for maintenance tasks
Example: feat: add support for etcd lease operations
When referencing issues in commit messages, use the appropriate prefix:
- For GitHub issues: Use
Closes #<issue-no>,Relates to #<issue-no>,Related to #<issue-no>, orPart of #<issue-no>in the commit body to automatically link the commit to the issue. - For TNTP issues: Use
Closes TNTP-<issue-no>,Relates to TNTP-<issue-no>,Related to TNTP-<issue-no>, orPart of TNTP-<issue-no>(note: useTNTP-prefix instead of#).
Place these references in the commit body, not the subject line. These references are used by automation to track issue status.
- Fork the repository and create a feature branch.
- Ensure your code passes linting and tests.
- Update the CHANGELOG.md with a brief description of your changes.
- Submit a pull request with a clear description of the changes and their purpose.
If you have questions, feel free to open an issue or reach out via Telegram (English / Russian).