Lint and check formatting of a Go module.
Install the check-go-task.yml
GitHub Actions workflow to .github/workflows/
Taskfile.yml
- Linting and formatting tasks.- Install to: repository root (or merge into the existing
Taskfile.yml
).
- Install to: repository root (or merge into the existing
.golangci.yml
- Contains all the go-linting configurations.- Install to: repository root as
.golangci.yml
- Install to: repository root as
Taskfile.yml
-DEFAULT_GO_MODULE_PATH
andDEFAULT_GO_PACKAGES
variables- Merge into
Taskfile.yml
- Merge into
Configure the version of Go used for development of the project in the env.GO_VERSION
field of check-go-task.yml
.
If the project contains Go modules in paths other than the root of the repository, add their paths to the job matrices of check-go-task.yml
at:
jobs.check-errors.strategy.matrix.module[].path
jobs.check-outdated.strategy.matrix.module[].path
jobs.check-style.strategy.matrix.module[].path
jobs.check-formatting.strategy.matrix.module[].path
jobs.check-config.strategy.matrix.module[].path
Markdown badge:
[](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/check-go-task.yml)
Replace the TODO_REPO_OWNER
and TODO_REPO_NAME
placeholders in the URLs with the final repository owner and name (example).
Asciidoc badge:
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-go-task.yml/badge.svg["Check Go status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-go-task.yml"]
Define the {repository-owner}
and {repository-name}
attributes and use them throughout the readme (example).
Add CI workflow to lint and check formatting of Go code
On every push and pull request that affects relevant files, check the Go module for:
- Common detectable errors in the code.
- Use of outdated APIs
- Code style violations
- Code formatting inconsistency
- Misconfiguration
On every push and pull request that affects relevant files, check the repository's [Go](https://golang.org/) module for:
- Common detectable errors in the code.
- Use of outdated APIs
- Code style violations
- Code formatting inconsistency
- Misconfiguration