Common libraries and tools used across Keep repositories.
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/
Makefile (1)
docs/
contracts/ (2)
docs/
solidity/
tools/ (3)
generators/ (4)
pkg/ (5)
net/
net.go, *.go (5)
libp2p/
chain/
chain.go, *.go (5)
ethereum/
gen/
gen.go (6)
relay/
relay.go, *.go
-
The Makefile should be minimal, mirroring the Dockerfile when possible.
-
While Keep only uses Solidity at the moment, the directory structure allows for other contract languages.
-
Keep 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
mypackage
live inmypackage.go
.net
andchain
are 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:generate
annotation to trigger appropriate code generation. All code generation is done with a single invocation ofgo generate
at build time.