https://github.com/pgimalac/golangci-lint-all
Wrapper script around golangci-lint to run on multiple platforms in parallel
https://github.com/pgimalac/golangci-lint-all
Last synced: about 1 year ago
JSON representation
Wrapper script around golangci-lint to run on multiple platforms in parallel
- Host: GitHub
- URL: https://github.com/pgimalac/golangci-lint-all
- Owner: pgimalac
- License: mit
- Created: 2023-08-26T19:57:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-26T20:41:16.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T01:56:07.627Z (over 1 year ago)
- Language: Shell
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# golangci-lint-all
Wrapper script around `golangci-lint` to run on multiple platforms in parallel and have a unified output.
The script relies on the fact that each lint takes a single line and is always the same when reported on different platforms (which allows simply filtering duplicate lines to avoid duplicate warnings).
The wrapper can be used directly in an IDE since the output will be the same as `golangci-lint`.
For example on VSCode it can be set as an `Alternate Tools` in the `Go` extension.
The time it takes to run is basically as long as the time of the time on the longest of each platform.
# How to use
## Arguments
Arguments provided to the script are transfered as is to `golangci-lint`.
If not argument is provided, the default argument is just `run`.
Some arguments are added by the script when not provided by the user:
- `out-format` will be `colored-line-number`. Other meaningful values can be `line-number`, `github-actions` or `tab`, as they all print each lint on a single line, otherwise the final output would not be clear.
- `print-issued-lines` will be false, similarly so that each lint takes a single line and the final output is unified.
- `allow-parallel-runners` to enable running several instances of `golangci-lint` in parallel.
## Platforms
The list of platforms to run on can be provided using the `PLATFORMS` environment variable.
It should be a space-separated list of platforms, where each platform is an operating system and
an architecture, separated by a slash.
The possible platforms are the ones supported by Go, which can be seen using the command
`go tool dist list`.
If the `PLATFORMS` variable isn't defined or is empty, the following platforms will be used by default:
- `linux/amd64`
- `linux/arm64`
- `darwin/amd64`
- `darwin/arm64`
- `windows/amd64`
- `windows/386`
## Example
```sh
PLATFORMS="linux/amd64 linux/arm64 linux/386" golangci-lint-all run -c .golangci.yml --out-format=tab
```
## Caveats
In case of error from `golangci-lint` (eg. parsing / compiling) the output might not be clear.