Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
/ go-multicodec Public archive

Periodically self-generated Go constants of multicodecs used by the multiformats projects.

License

Notifications You must be signed in to change notification settings

dennis-tra/go-multicodec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚧 Archived

This project has been moved upstream to multiformats/go-multicodec.

go-multicodec

Multicodecs update standard-readme compliant Go Report Card

Periodically self-generated Go constants of multicodecs used by the multiformats projects.

Table of Contents

Motivation

Consolidation of multiple constant definitions. E.g.

Workflow

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.

Install

go-multicodec is a standard Go module which can be installed with:

go get github.com/dennis-tra/go-multicodec

Usage

package 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.

Generator

To generate the constants yourself checkout the repository like

git clone https://github.com/dennis-tra/go-multicodec.git

Then 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 -linecomment

Note: You may need to install stringer via go install golang.org/x/tools/cmd/stringer.

Maintainers

@dennis-tra.

License

MIT © Dennis Trautwein

About

Periodically self-generated Go constants of multicodecs used by the multiformats projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages