-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[goreleaser] docs: update README with cross-repository usage instruct…
…ions Co-Authored-By: [email protected] <[email protected]>
- Loading branch information
1 parent
e3dcb98
commit c9da56a
Showing
1 changed file
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,109 @@ | ||
# Golang CI Lint Version Manager | ||
|
||
This tool manages the installation of golangci-lint versions specified in the root .golangci-version file. | ||
A standalone tool for managing and running specific versions of golangci-lint across different repositories. This package can be used in any Go project to ensure consistent linting with version pinning, regardless of where it's installed. | ||
|
||
## Features | ||
- Architecture-specific binary downloads (supports both AMD64 and ARM64) | ||
- Version pinning via .golangci-version file | ||
- Binary caching to avoid redundant downloads | ||
- Automatic version management through make lint | ||
- **Cross-Repository Usage**: Can be installed and used in any Go project | ||
- **Version Pinning**: Automatically uses the version specified in `.golangci-version` | ||
- **Architecture Support**: Downloads correct binary for your system (AMD64/ARM64) | ||
- **Binary Caching**: Avoids redundant downloads of the same version | ||
- **Secure Downloads**: Verifies binary checksums for security | ||
- **CI/CD Integration**: Easy to integrate with GitHub Actions and other CI systems | ||
|
||
## Usage | ||
The tool is automatically invoked by `make lint`. To manually run: | ||
## Installation | ||
|
||
As a standalone tool: | ||
```bash | ||
go install github.com/synapsecns/sanguine/contrib/golang-ci-lint@latest | ||
``` | ||
|
||
Or in your project's go.mod: | ||
```go | ||
go run contrib/golang-ci-lint | ||
require github.com/synapsecns/sanguine/contrib/golang-ci-lint v1.0.0 | ||
``` | ||
|
||
## Usage | ||
|
||
### 1. Version Configuration | ||
Create a `.golangci-version` file in your repository root: | ||
``` | ||
1.61.0 | ||
``` | ||
|
||
### 2. Running the Linter | ||
|
||
As a standalone binary: | ||
```bash | ||
golang-ci-lint run --fix --config=.golangci.yml | ||
``` | ||
|
||
Or using go run: | ||
```bash | ||
go run github.com/synapsecns/sanguine/contrib/golang-ci-lint run --fix --config=.golangci.yml | ||
``` | ||
|
||
### 3. Makefile Integration | ||
|
||
Add to your project's Makefile: | ||
```makefile | ||
.PHONY: lint | ||
lint: | ||
go run github.com/synapsecns/sanguine/contrib/golang-ci-lint run --fix --config=.golangci.yml | ||
``` | ||
|
||
### 4. CI/CD Integration | ||
|
||
GitHub Actions example: | ||
```yaml | ||
name: Lint | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- name: Install golang-ci-lint manager | ||
run: go install github.com/synapsecns/sanguine/contrib/golang-ci-lint@latest | ||
- name: Run linter | ||
run: golang-ci-lint run --config=.golangci.yml | ||
``` | ||
|
||
## Common Use Cases | ||
|
||
1. **Multiple Projects**: Use the same linter version across all your repositories | ||
2. **CI/CD Pipelines**: Ensure consistent linting in automated workflows | ||
3. **Team Collaboration**: Maintain consistent code style across development teams | ||
4. **Version Control**: Lock linter version to avoid unexpected behavior changes | ||
|
||
## Troubleshooting | ||
|
||
1. **Binary Not Found** | ||
```bash | ||
# Clear the cache and redownload | ||
rm -rf ~/.cache/golangci-lint | ||
golang-ci-lint run | ||
``` | ||
|
||
2. **Version Mismatch** | ||
- Ensure `.golangci-version` exists in repository root | ||
- Check file permissions and format | ||
|
||
3. **Architecture Issues** | ||
- The tool automatically detects and downloads the correct binary | ||
- Supported: linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64 | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please ensure: | ||
- Cross-platform compatibility (Linux, macOS, Windows) | ||
- Backward compatibility with existing `.golangci-version` files | ||
- Proper error handling and user feedback | ||
|
||
## License | ||
|
||
MIT License - See LICENSE file for details |