We use Go 1.14 Modules to manage dependency versions.
The main branch of every Cosmos repository should just build with go get
, which means they should be kept up-to-date with their dependencies, so we can get away with telling people they can just go get
our software.
Since some dependencies are not under our control, a third party may break our build, in which case we can fall back on go mod tidy -v
.
Other helpful commands:
go get
to add a new go module (including if the existing go module is being semantic version bumped, i.e. my/module/v1 -> my/module/v2).go get -u
to update an existing dependency.go mod tidy
to update dependencies ingo.sum
.
We use Protocol Buffers along with buf and gogoproto to generate code for use in ibc-go.
For deterministic behavior around protobuf tooling, everything is containerized using Docker. Make sure to have Docker installed on your machine, or head to Docker's website to install it.
For formatting code in .proto
files, you can run the make proto-format
command.
For linting and checking breaking changes, we also use buf. You can use the commands make proto-lint
and make proto-check-breaking
to respectively lint your proto files and check for breaking changes.
To generate the protobuf stubs, you can run make proto-gen
.
We also added the make proto-all
command to run the above commands (proto-format
, proto-lint
and proto-gen
) sequentially.
To update third-party protobuf dependencies, you can run make proto-update-deps
. This requires buf
to be installed in the local development environment (see buf
s installation documentation for more details).
For generating or updating the swagger file that documents the URLs of the RESTful API that exposes the gRPC endpoints over HTTP, you can run the proto-swagger-gen
command.
It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC.
- The latest state of development is on
main
. - Build the
simd
test chain binary withmake build
. main
must never failmake test
.- No
--force
ontomain
(except when reverting a broken commit, which should seldom happen). - Create a development branch either on
github.com/cosmos/ibc-go
, or your fork (usinggit remote add fork
). - Before submitting a pull request, begin
git rebase
on top ofmain
. - Ensure you are using the pre-commit hooks by running
make setup-pre-commit
.
All Go tests in ibc-go can be ran by running make test
.
Please make sure to run make format
before every commit - the easiest way to do this is have your editor run it for you upon saving a file. Additionally please ensure that your code is lint compliant by running make lint-fix
(requires golangci-lint
).
When testing a function under a variety of different inputs, we prefer to use table driven tests.
All unit tests should use the testing package. Please see the testing package README for more information.
Test coverage is continuously deployed at SonarCloud. PRs that improve test coverage are welcome, but in general the test coverage should be used as a guidance for finding API use cases that are not covered by tests. We don't recommend adding tests that only improve coverage but not actually test a meaning use case.
- If you open a PR on ibc-go, it is mandatory to update the relevant documentation in
/docs
. - We lint the markdown files for documentation with markdownlint-cli. Please run
make docs-lint
before pushing changes in the markdown files (you will need to havemarkdownlint-cli
installed, so please follow the installation instructions). - Generate the folder
docs/.vuepress/dist
with all the static files for the documentation site withmake build-docs
. - Run the documentation site locally with
make view-docs
.