go-lintinglisted
Install: claude install-skill abdullahkhawer/devops-skills
# Go Linting Skill
Run this skill when asked to lint, format, or check style for Go code.
## Step 1 — Detect available tooling
```bash
which golangci-lint go 2>/dev/null
ls .golangci.yml .golangci.yaml 2>/dev/null
```
If `golangci-lint` is not installed, inform the user and ask before installing:
```bash
brew install golangci-lint
```
`gofmt` and `go vet` ship with the Go toolchain, so no separate install is needed for those.
---
## Step 2 — Run formatting check
```bash
gofmt -l .
```
This lists files that are not correctly formatted (empty output means everything is formatted). Show the diff for any listed file:
```bash
gofmt -d <file>
```
---
## Step 3 — Run vet (correctness checks)
```bash
go vet ./...
```
---
## Step 4 — Run the linter
```bash
golangci-lint run ./...
```
Respect the project's `.golangci.yml`/`.golangci.yaml` if present — do not pass extra flags that override its enabled/disabled linters.
Report all findings grouped by file, with line numbers and linter names.
---
## Step 5 — Apply fixes (only with user confirmation)
```bash
gofmt -w <file>
golangci-lint run --fix ./...
```
Only run auto-fix commands after showing the user what will change and getting explicit confirmation. `go vet` findings and most `golangci-lint` findings require manual code changes — present each with a suggested fix.
---
## Standard conventions enforced
- Formatting is always `gofmt`-compliant — this is non-negotiable in Go and never a matter of style prefere