If you want to contribute to this repository, consider posting a bug report, or a feature request, or a pull request.
You can talk to us directly on our Discord server in the #smartcontracts-dev
channel.
Please base your work on the develop
branch.
Before creating a pull request, ensure all tests pass locally, and the linter reports no violations.
To run tests locally, execute one of the following commands:
go test -short -tags rocksdb ./...
Or, as an alternative:
make test-short
The commands above execute a subset of all available tests. If you introduced major changes, consider running the whole test suite instead, with make test
or make test-full
(these can take several minutes, so go and grab a coffee!).
See the provider instructions on how to install golintci.
See the provider instructions on integrating golintci
into your source code editor. You can also find our recommended settings for VS Code and GoLand at the bottom of this article.
To run the linter locally, execute:
golangci-lint run
or
make lint
The linter will also automatically run every time you run:
make
You can disable false positives by placing a special comment directly above the "violating" element:
//nolint
func foobar() *string {
// ...
}
To be sure that the linter will not ignore actual issues in the future, try to suppress only relevant warnings over an element. Also, explain the reason why the nolint
is needed. E.g.:
//nolint:unused // This is actually used by the xyz tool
func foo() *string {
// ...
}
Adjust your VS Code settings as follows:
// required:
"go.lintTool": "golangci-lint",
// recommended:
"go.lintOnSave": "package"
"go.lintFlags": ["--fix"],
"editor.formatOnSave": true,
- Install the golintci plugin.
- Configure path for
golangci
.
- Add a
golangci
file watcher with a custom command. We recommend using it with the--fix
parameter.