The following section refers to publishing package(s) to https://pkg.go.dev.
- See GO's Publishing a Module for additional details.
- Establish a
LICENSE
to the project. - Ensure dependencies are updated.
go mod tidy
- Sync the working tree's
HEAD
with its remote.git add . git commit --message "<commit-msg>" git push --set-upstream origin main
- Assign a tag and push.
git tag "v$(head VERSION)" && git push origin "v$(head VERSION)"
- 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.
go test ./...
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
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.
- Install pre-commit from https://pre-commit.com/#install.
- Auto-update the config to the latest repos' versions by executing
pre-commit autoupdate
. - Install with
pre-commit install
.
The following section is intended only for project maintainers & developers.
- Please see the getting started section for installation and upgrade instructions.
-
Install
goreleaser
if it isn't installedbrew install goreleaser/tap/goreleaser
-
Initialize the repository for new repositories
goreleaser init
-
Test the snapshot without VCS deployment
goreleaser release --snapshot --clean
-
Configure the default system's local
gitlab_token
orgithub_token
secretmkdir -p ~/.config/goreleaser && touch ~/.config/goreleaser/gitlab_token mkdir -p ~/.config/goreleaser && touch ~/.config/goreleaser/github_token
-
Commit and push to VCS
git add . && git commit -m "CI - Example" && git push
-
List
git
tags to get a version that isn't already establishedgit tag --list
-
Using the output from above, increment the version and push a new tag
git tag -a v0.0.1 -m "Bump: Initial Release" && git push origin v0.0.1
-
Create and push a new release
goreleaser release --clean
-
Update the Cask if already established
brew update
-
Install the package (see the installation section)
Update the configuration's upstreams
pre-commit autoupdate
Install pre-commit
to local instance
pre-commit install
Tool godoc
is required to render the documentation, which includes examples.
Installation Steps:
- Install
godoc
.go install golang.org/x/tools/cmd/godoc@latest
- 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
- Start the
godoc
server.godoc -http=:6060
- Open the webpage.
open "http://localhost:6060/pkg/"