# golangci-lint

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> The golangci-lint Go linter, built with the workstation's Go toolchain onto the system PATH.


Installs `golangci-lint` by building it with the workstation's Go toolchain and placing the
binary in `/usr/local/bin`, so it is on the PATH of both root and the login user.

```yaml
devtools:
  - name: go
  - name: golangci-lint
```

## Version behavior

| `version` | Result |
|-----------|--------|
| omitted | a pinned default release, chosen to be a known-good v2 |
| `v2.13.0` | that exact release tag |
| `2.13.0` | normalized to `v2.13.0` |
| `latest` | the newest release, resolved at install time |

A changed `version` replaces the installed release on the next configuration pass.
`version: latest` picks the newest release once, when golangci-lint is installed, and then
stays on it.

## Updates

With `updatePolicy: latest` and no `version`, golangci-lint takes the
[Ringleader default route](https://docs-stg.ringleader.dev/reference/tools/devtools/#update-routes). It moves when an update to
Ringleader raises the default release.

## Dependency on Go

The recipe needs a Go toolchain to install the linter. If [`go`](https://docs-stg.ringleader.dev/reference/tools/devtools/go/)
is declared first, that toolchain is used. If no Go toolchain is present at all, the
recipe installs the distribution's Go package as a fallback, which is usually older
and occasionally too old for the pinned linter. Declare `go` explicitly whenever you care
which toolchain builds it.

## Example

```yaml
devtools:
  - name: go
    version: "1.22.5"
  - name: golangci-lint
    version: v2.13.0
```

## Notes

- The install check runs `golangci-lint version`, so a partially written binary from an
  interrupted install is detected and replaced.
- Changing `version` reinstalls on the next setup run.
- Works on Debian, Ubuntu, and Alpine.

