Skip to main content

Helper for golangci-lint

Project description

Lintme

A convenience wrapper around golangci-lint that discovers Go modules in your workspace and runs the linter per module with zero configuration fuss.

Overview

In a Go workspace (go.work) with many modules, running golangci-lint requires cd-ing into each module directory and invoking it separately. lintme automates that loop — one command from anywhere in the workspace lints everything.

Module discovery works with workspaces: when lintme finds a go.work file, it lints every module listed under a use directive, in order. When no go.work exists, it walks up from the current directory until it finds a go.mod and lints that single module.

For each module, lintme also walks up the directory tree to find the nearest .golangci.yaml (or an equivalent config file), so each module can carry its own linter config. Output streams in real time — nothing buffers it.

Requirements

Installation

go install github.com/StevenACoffman/lintme@latest

This places the lintme binary in $GOPATH/bin or $GOBIN. Ensure that directory is on your PATH.

Commands

Running bare lintme defaults to lintme branch — it lints only issues introduced on the current branch since its merge-base with the remote default branch.

lintme branch (Default)

Lint only issues introduced on the current branch.

# Lint issues introduced on the current branch (auto-detects merge-base)
lintme

# Specify the base branch explicitly
lintme branch -B main

# Apply formatting instead of linting
lintme --fmt-only

# Forward extra flags to every golangci-lint invocation
lintme -- --timeout=5m

lintme branch queries git ls-remote --symref origin HEAD to determine the remote default branch without requiring a local checkout. Use -B when there is no remote or the remote is not named origin.

Flag Default Description
-B, --base Base branch for the merge-base computation; default: remote HEAD via ls-remote

lintme run

Lint all modules in the workspace, regardless of branch.

# Lint all modules, applying --fix (default)
lintme run

# Check only — do not modify files
lintme run --no-fix

# Format using golangci-lint fmt instead of golangci-lint run
lintme run --fmt-only

# Report only issues introduced since a given commit
lintme run --new-from-rev=main

# Forward extra flags to every golangci-lint invocation
lintme run -- --timeout=5m
lintme run --no-fix -- --timeout=5m --out-format=json

lintme pr

Lint only issues introduced by a GitHub pull request.

# Lint the PR for the current branch (auto-detects PR number)
lintme pr

# Lint a specific PR
lintme pr 123

# With an explicit token and repo
lintme pr --token=$GITHUB_TOKEN --repo=owner/repo 123

When <pr-number> is omitted, lintme pr detects the open PR for the current branch via the GitHub API, matching the behavior of gh pr view.

Flag Default Description
--token $GITHUB_TOKEN GitHub personal access token
--repo detected from git remote Repository as owner/repo
--github-url $GITHUB_API_URL GitHub API base URL for GitHub Enterprise

lintme version

Print build and version information.

lintme version         # human-readable table
lintme version --json  # machine-readable JSON

Shared Flags

These flags work with all commands that invoke golangci-lint.

Flag Default Description
--no-fix off Skip --fix; report issues without modifying files
--fmt-only off Run golangci-lint fmt instead of golangci-lint run; mutually exclusive with --no-fix
--new-from-rev=<rev> Pass --new-from-rev=<rev> to every golangci-lint invocation; golangci-lint reports only issues introduced since <rev>

Module and Config Discovery

Module Discovery

lintme walks up from the current directory looking for a go.work file. When it finds one, it lints every module listed under a use directive in declaration order. When no go.work exists, it continues walking up until it finds a go.mod and lints that single module.

Config Discovery

For each module, lintme walks up from the module directory looking for a config file in this priority order:

  1. .golangci.yml
  2. .golangci.yaml
  3. .golangci.toml
  4. .golangci.json

The output header for each module shows the resolved path. When no config file exists, golangci-lint runs without --config and applies its own defaults.

Environment Variables

Every flag can also be set via a LINTME_-prefixed environment variable. The mapping rule: prepend LINTME_, uppercase, replace dashes with underscores.

Flag Environment variable
--no-fix LINTME_NO_FIX=true
--fmt-only LINTME_FMT_ONLY=true
--new-from-rev LINTME_NEW_FROM_REV=<rev>

Flags on the command line always take precedence over environment variables.

Output

==> ./services/auth (github.com/example/myapp/services/auth)  config: ./services/auth/.golangci.yaml
... golangci-lint output ...

==> ./services/payments (github.com/example/myapp/services/payments)  config: no config
... golangci-lint output ...

2/2 modules passed

When a module fails:

==> ./services/payments (github.com/example/myapp/services/payments)  config: no config
./services/payments/handler.go:42:9: unused variable (deadcode)
FAIL  ./services/payments: golangci-lint: exit status 1

1/2 modules passed

Failing modules do not stop remaining modules from linting. lintme exits non-zero if any module fails.

Exit Codes

Code Meaning
0 All modules passed
1 One or more modules failed

CI Integration

Use --no-fix in CI so the linter reports issues without modifying files.

- name: Lint
  run: lintme --no-fix

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lintmego-0.4.0-py3-none-win_arm64.whl (7.0 MB view details)

Uploaded Python 3Windows ARM64

lintmego-0.4.0-py3-none-win_amd64.whl (7.6 MB view details)

Uploaded Python 3Windows x86-64

lintmego-0.4.0-py3-none-musllinux_1_2_x86_64.whl (7.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

lintmego-0.4.0-py3-none-musllinux_1_2_aarch64.whl (6.9 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

lintmego-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

lintmego-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

lintmego-0.4.0-py3-none-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

lintmego-0.4.0-py3-none-macosx_10_9_x86_64.whl (7.6 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file lintmego-0.4.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: lintmego-0.4.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Go-http-client/2.0

File hashes

Hashes for lintmego-0.4.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 4290c05dcbe5254ad62052b32968457690b049a2ec67a558ce6cb44d169427e3
MD5 2fbf5c61f6470aec6a4e33b45bf8bdf2
BLAKE2b-256 00872c37834d64b864edfb45cdd624afc336b2e5ddfd11c34c48cfeb15df8922

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: lintmego-0.4.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 7.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Go-http-client/2.0

File hashes

Hashes for lintmego-0.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a73e990b37d1bffe95617d9ef668044886b388e06e05660b018ff65c3663a879
MD5 17e467c8a5deff204bbad3ccb4550b63
BLAKE2b-256 206646aeab4011077eba9a7b21d126f29224f9fb1786483a891994f54de21c16

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cd4a22a7bf00d7b5651505717e38c03343e40e4d0007862732b9aa7cc07f4a87
MD5 58e4a76ca9fe494fcee7b9a01aab621b
BLAKE2b-256 02a149e28f7e355967a7a0a078fd8b3c27801459f0e34397c25e0300019c844b

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 88852db3411dc2ef68c53377b99c078cb365d902be4475f802167874fedc7148
MD5 1124fde928d1f88aab6675fc8663c5d3
BLAKE2b-256 5315f472c7261142c588c8710a7e7a61aa52170b64a248426a52898f2cfab27e

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c4af5752eff04a9b4fb1ce76ceb3812e32c72ce9dc78144da56c16b25326dc2
MD5 6ab63acbfb85d95654eee4261d016e3e
BLAKE2b-256 f09cf3e88f04f0462e69403915fad68d7a811e87f6b593f5a2f20a16a4a35048

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c31bf52750b74f6e1e51cc4fe8341666d06826b2a4723b58d096a651db095887
MD5 6b888feff857988675cf333b422fd987
BLAKE2b-256 8628d28d8040eb69a142a6f0fd08d5ef3a2aa60d8cf741150478c9ad5aeab54f

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea94d8d5af1adaa07155fd20b2583dfcbc1c09dd0cdcb9f3757fcc0d7a1c724c
MD5 c20acc13257dfdd611de5cd9b01f10e1
BLAKE2b-256 d306d45c1b7966f7080e7bfe8bd083d6273f905601f75b4373921f3a8dd23848

See more details on using hashes here.

File details

Details for the file lintmego-0.4.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lintmego-0.4.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6f56422a02e9e68d0827803fc89f4cf500c1931c0953119fb547915f06f43fff
MD5 d2ab8c81f75347452317cb7b5486a056
BLAKE2b-256 dff18ce93a077bb3b2942932154ce3a76724f601770ec76881e6038da31d9aad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page