go-precommit

Run golangci-lint, go test with race detection, and final lint checks.

4|Updated Sep 6, 2013
One-click install
npx skills add https://github.com/mway/dotfiles --skill go-precommit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-precommit
Source: https://github.com/mway/dotfiles/tree/main/home/dot_codex/skills/go-precommit
Command: npx skills add https://github.com/mway/dotfiles --skill go-precommit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects frequently suffer from inconsistent formatting, flaky tests, or lint errors that slip through manual checks. This skill automates a full pre-commit workflow to catch formatting, linting, and test failures before changes enter the codebase.

Core Features & Use Cases

  • Automated formatting and linting: runs golangci-lint with the --fix option across all packages.
  • Comprehensive testing: executes go test with race detection and coverage to validate correctness.
  • End-to-end validation: performs a final lint pass to ensure no issues are introduced during fixes.
  • Use Case: Run this workflow before pushing commits or opening a PR to guarantee code quality.

Quick Start

Run the full pre-commit workflow in your Go project to ensure code quality before commits.

Frequently Asked Questions about go-precommit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Go pre-commit checks for formatting, tests, and linting?

Go pre-commit automation runs a three-step pipeline applying golangci-lint with --fix, executing go test with race detection and coverage, and performing a final lint pass to catch formatting and test failures before commits.

What is the best way to run golangci-lint and go test before pushing a Go project?

The best way is to run an automated workflow that applies golangci-lint with --fix across all packages, runs go test with race detection and coverage, and performs a final lint check to ensure no issues are introduced.

Does the Go pre-commit workflow support race detection and code coverage?

Yes, the Go pre-commit workflow executes go test with both race detection and coverage enabled to validate correctness and catch concurrency issues before changes enter the codebase.

Why does my Go pre-commit pipeline fail after applying code fixes?

Go pre-commit pipelines fail after fixes if the final lint pass detects new issues introduced during the automated golangci-lint --fix step, ensuring no errors slip through into the codebase.

Can I use this pre-commit workflow to catch flaky tests in my Go codebase?

Yes, you can use this pre-commit workflow to catch flaky tests because it executes go test with race detection and coverage to validate correctness before changes enter the codebase.