Skip to content

gms1/go-project-template

Repository files navigation

go-project-template

GitHub License Build Status Coverage Status Go Report Card Codebeat Go Reference Release

usage

  • install prerequisites

    • mandatory: gofumpt, golangci-lint and goreleaser
    go install mvdan.cc/gofumpt@latest
    go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
    go install github.com/goreleaser/goreleaser/v2@latest
    • optional and recommended: pre-commit
    pip install pre-commit
  • export this template to a new project folder

    ./scripts/export.sh <target-project-name> [target-project-owner]
  • in new project folder

    • to format, lint, build and test:
    ./scripts/all.sh
    • verify, commit and push everything to the new git repository

    • optional install pre-commit hook

    pre-commit install
    pre-commit install --hook-type commit-msg
    • create a release
    ./scripts/release.sh <version>

    this updates the Version in "pkg/common/about.go", generates the docs in "docs" and commits and pushes the changes using the commit message "release: ".

    A "v" tag is then created and pushed, which triggers the release workflow from .github/workflows/release.yaml.

    This release workflow then creates the binaries and archives for the configured OS/Arch combinations, as well as a multi-platform docker image. If the later is not needed, the “Dockerfile” can be removed, as well as the "docker" and "docker_manifests" sections in ".goreleaser.yaml"

About

my template for go projects

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •