Skip to content

Latest commit

 

History

History
114 lines (82 loc) · 2.81 KB

CONTRIBUTING.md

File metadata and controls

114 lines (82 loc) · 2.81 KB

Contribution Guide

Package Publication

The following section refers to publishing package(s) to https://pkg.go.dev.

  1. Establish a LICENSE to the project.
  2. Ensure dependencies are updated.
    go mod tidy
  3. Sync the working tree's HEAD with its remote.
    git add .
    git commit --message "<commit-msg>"
    git push --set-upstream origin main
  4. Assign a tag and push.
    git tag "v$(head VERSION)" && git push origin "v$(head VERSION)"
  5. Make the module available, publicly.
    GOPROXY=proxy.golang.org go list -mutex "github.com/x-ethr/example@v$(head VERSION)"

Adding the package to pkg.go.dev may need to be requested. Navigate to the mirror's expected url, and follow instructions for requesting the addition.

Upon successful request, a message should be displayed:

We're still working on “github.com/x-ethr/example”. Check back in a few minutes!

For any other issues, consult the official documentation.

Testing

Basic
go test ./...
Testing with Useful Logging
go test -c "./path-with-tests" -o pkg.test -json

go tool test2json -t ./pkg.test -test.failfast -test.fullpath -test.v -test.paniconexit0

Simplified

go test ./... -json

Pre-Commit

The following project makes use of pre-commit for local-development git-hooks. These hooks are useful in cases such as preventing secrets from getting pushed into version-control.

See the .pre-commit-config.yaml for implementation specifics.

Local Setup

  1. Install pre-commit from https://pre-commit.com/#install.
  2. Auto-update the config to the latest repos' versions by executing pre-commit autoupdate.
  3. Install with pre-commit install.

General Command Reference(s)

Update the configuration's upstreams

pre-commit autoupdate

Install pre-commit to local instance

pre-commit install

Documentation

Tool godoc is required to render the documentation, which includes examples.

  • See doc.go for code-specific package documentation.

Installation Steps:

  1. Install godoc.
    go install golang.org/x/tools/cmd/godoc@latest
  2. Backup shell profile and update PATH.
    cp ~/.zshrc ~/.zshrc.bak
    printf "export PATH=\"\${PATH}:%s\"\n" "$(go env --json | jq -r ".GOPATH")/bin" >> ~/.zshrc
    source ~/.zshrc
  3. Start the godoc server.
    godoc -http=:6060
  4. Open the webpage.
    open "http://localhost:6060/pkg/"