Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 2.84 KB

check-go-task.md

File metadata and controls

76 lines (51 loc) · 2.84 KB

"Check Go" workflow (Task)

Lint and check formatting of a Go module.

Installation

Workflow

Install the check-go-task.yml GitHub Actions workflow to .github/workflows/

Assets

  • Taskfile.yml - Linting and formatting tasks.
    • Install to: repository root (or merge into the existing Taskfile.yml).
  • .golangci.yml - Contains all the go-linting configurations.
    • Install to: repository root as .golangci.yml
  • Taskfile.yml - DEFAULT_GO_MODULE_PATH and DEFAULT_GO_PACKAGES variables
    • Merge into Taskfile.yml

Configuration

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

Readme badge

Markdown badge:

[![Check Go status](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/check-go-task.yml/badge.svg)](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).

Commit message

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

PR message

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