Common libraries and tools used across Keep repositories. This repository is a
fork of keep-core/keep-common,
continuing independently from the upstream v1.7.0 tag.
See Release guide and Changelog for versioning, tagging, and history.
Go: 1.22 (CI uses
actions/setup-go@v4with module cache).Checks:
go generate(enforced clean),go vet,go build,go testviagotestsum.Security:
govulncheck(informational),gosecpinned version.Lint:
golintinstalled viago install.
See Release guide for versioning, tagging, and publishing steps. Pushing a v* tag on main runs the release workflow, which regenerates code, vets, tests, and publishes a GitHub release for that tag.
The directory structure used in the keep-common repository is the same as
used on other Keep repositories, and very similar to that used in other Go
projects:
keep-common/
tools/ (1)
generators/ (2)
pkg/ (3)
chain/
chain.go, *.go (4)
ethereum/
gen/
gen.go (5)
relay/
relay.go, *.goKeep tools have categorized directories here, which are typically Go commands that can be used from other repositories.
Code generators in particular live in this subtree.
All additional Go packages live in
pkg/.The high-level interfaces for a package
mypackagelive inmypackage.go. Packages likechainare interface packages that expose a common interface to network and blockchain layers, for example. Their subpackages provide particular implementations of these common interfaces, if these are considered shared implementations..When a package requires generated code, it should have a subpackage named
gen/. This subpackage should contain a single file,gen.go, with a// go:generateannotation to trigger appropriate code generation. All code generation is done with a single invocation ofgo generateat build time.
Clone this repo
Install Go v1.22
Generate go files:
$ go generate ./…/genBuild the project:
$ go build ./…Run tests:
$ go test ./…
See Contribution Guide for forking, signing, and PR expectations; keep tests green and generators clean before review.