This project has been moved upstream to multiformats/go-multicodec.
Periodically self-generated Go constants of multicodecs used by the multiformats projects.
Consolidation of multiple constant definitions. E.g.
- multiformats/go-multihash/multihash.go#L38 or not obvious constant generation
- multiformats/go-cid/cid.go#L52
- maybe more?
Every night a few minutes after midnight (UTC) a GitHub-Action fetches the latest multicodecs table, generates the constants, commits possible changes and creates a pull request. It will update the same pull request if subsequent runs find different changes and it won't create a pull request if no changes were detected.
go-multicodec is a standard Go module which can be installed with:
go get github.com/dennis-tra/go-multicodecpackage main
import "github.com/dennis-tra/go-multicodec"
func main() {
_ = multicodec.Sha2_256
}The corresponding name value for each codec from the multicodecs table can be accessed via its String() method. E.g. multicodec.Sha2_256.String() will return sha2-256.
To generate the constants yourself checkout the repository like
git clone https://github.com/dennis-tra/go-multicodec.gitThen run go generate in the root of the repository. Currently this will invoke (see init.go):
go run ./gen/gen.go
gofmt -w codec.go
stringer -type=Codec -linecommentNote: You may need to install stringer via go install golang.org/x/tools/cmd/stringer.
MIT © Dennis Trautwein