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.3.0-py3-none-win_arm64.whl (7.0 MB view details)

Uploaded Python 3Windows ARM64

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

lintmego-0.3.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.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

lintmego-0.3.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.3.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: lintmego-0.3.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.3.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 28b0c84c4acfcad76917429e17e399857ea03459ac940b57a6e837257b824c91
MD5 0aba8e0926a74bd3c2a2d321f8624b0f
BLAKE2b-256 918e213eb5ccb29559d4aabe7c7869ac68d3989b9f1a307b2cb39478d8186391

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lintmego-0.3.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.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7fc723dda99a96f767a77be007988353181197d7ceb25ef9e4d9b3d9017b7e39
MD5 776a60ab7d7ab8f22c6db73467c31455
BLAKE2b-256 401cbc840894b59e5bd563d94b1472f275e6349737db2583605844c6ae64a10a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 20dad1359750da316252328b3d50cccbdd442ae9771fce52f1711f07adaf9f6d
MD5 6c8c91fca4a08b08e7d2f02c96b7a45f
BLAKE2b-256 504dfeead6e670d993ddc500dfa6e383fcd042d48a9d9387cab512e3e097e502

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ecc3f778208b4bf343d602ac0aaa8093557ea2bf0828c990a391d9552eb08aaf
MD5 4e97f6ca7790a90a8a73628ad9b2ab33
BLAKE2b-256 8433a63c42ecb214d2686f2d776180cf1a2fbe1cfcb67d3549fe83b2001bdeaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 633ccc29dd87790dec68b9be02ead78082979ed013e3b9f3865b873b55000b7e
MD5 e3682eddcce5512199b1239683a11ee2
BLAKE2b-256 856346c3870827bc2302a1bd579e91c59e51d6da9f813ffa5d53ade660c96ce2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 03a7674bc6a18d6b6676fb5f93c57d8622da12ae45890ac4814690a7df97c9c5
MD5 8533d557ccae4de40b5fc17b14eecc7c
BLAKE2b-256 72f97723b79ea809074cd848c90e17b2e543b0ddba6979fb5d6b687d483ef9e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d491ba21568320c02ab6ff5292ff39a955c6703afc122022ef2f3c1f3a532918
MD5 044aa08566ba74143a1e3edc8fa297f7
BLAKE2b-256 d6428dc43f264dde72feaa2d1078a848d7a77556c4576f45caa44df0e01da43f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lintmego-0.3.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 432a0adbfd754907522f77fc6d8baac9a74f050c211bb64b6b3ec6e1f8e95530
MD5 c4a8f75abb8e8d83d1f1c6a93a6ef01a
BLAKE2b-256 887f4be9719b3c2fb2048c89d2101c44e184b996e725571a9724af17813ff045

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