-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Summary
The development dependency github.com/golangci/golangci-lint/v2 introduces GPL-licensed transitive dependencies that are incompatible with our MIT license. While golangci-lint itself is open-source, it bundles several linters licensed under GPL-3.0, creating license compliance risks for the project.
Dependency Chain
github.com/golangci/golangci-lint/v2 (tools.go)
→ github.com/OpenPeeDeeP/depguard/v2 (GPL-3.0)
→ github.com/ldez/structtags (GPL-3.0)
→ github.com/firefart/nonamedreturns (GPL-3.0)
→ github.com/xen0n/gosmopolitan (GPL-1.0-or-later AND GPL-3.0)
→ github.com/denis-tingaikin/go-header (GPL-3.0)
→ github.com/leonklingele/grouper (GPL-3.0)
GPL License Details
Primary GPL Dependency: depguard
- Module:
github.com/OpenPeeDeeP/depguard/v2 - Version:
v2.2.1 - License: GPL-3.0 AND GPL-3.0-only
- Copyright: Copyright (c) 2007 Free Software Foundation, Inc. ((fsf.org/redacted)
- Repository: https://github.com/OpenPeeDeeP/depguard
- pkg.go.dev: https://pkg.go.dev/github.com/OpenPeeDeeP/depguard/v2
Additional GPL Dependencies
- github.com/ldez/structtags v0.6.1 (GPL-3.0)
- github.com/firefart/nonamedreturns v1.0.6 (GPL-3.0)
- github.com/xen0n/gosmopolitan v1.3.0 (GPL-1.0-or-later AND GPL-3.0)
- github.com/denis-tingaikin/go-header v0.5.0 (GPL-3.0)
- github.com/leonklingele/grouper v1.1.2 (GPL-3.0)
Current Usage
Where It's Used
The direct dependency github.com/golangci/golangci-lint/v2 is imported in:
tools.go- Build-time tool dependency tracking (blank import)
Functionality Required
We use golangci-lint for:
- Code linting with multiple linters (misspell, gomoddirectives, unconvert, testifylint)
- Build-time code quality checks
- CI/CD pipeline linting (
make lint,make golint) - Development workflow linting
GPL Linters Usage Analysis
depguard linter: ❌ NOT configured or enabled in .golangci.yml
- Purpose: Checks package imports against allowed/denied lists
- Status: Not used by our project
Other GPL linters: ❌ NOT explicitly configured
- These are bundled with golangci-lint but not actively enabled in our configuration
Direct GPL Usage
Analysis shows the GPL modules:
- ❌ Are NOT directly used by our code
- ❌ Are NOT explicitly enabled in
.golangci.yml - ✅ Are pulled in transitively by golangci-lint
⚠️ Create license compliance risk even though not actively used
Legal & Security Implications
GPL-3.0 License Restrictions
- Copyleft Requirements: GPL-3.0 requires derivative works to be distributed under GPL
- MIT Incompatibility: GPL's copyleft provisions conflict with MIT's permissive nature
- Distribution Risk: Binary distributions could trigger GPL obligations
- Dependency Contamination: GPL dependencies in build tools may affect final artifacts
Risk Assessment
Risk Level: MEDIUM-HIGH
Rationale:
- GPL dependencies are in development toolchain (not runtime)
- Not directly used or enabled in our configuration
- However, bundled in binaries created by
go installorgo build - Creates potential licensing ambiguity for downstream users
- May block enterprise adoption if license audits flag GPL in build tools
Removal/Replacement Options
Option 1: Disable GPL Linters in golangci-lint
Approach: Continue using golangci-lint but explicitly disable GPL-licensed linters
Steps:
- Add depguard and other GPL linters to
.golangci.ymldisable list - Document why these linters are disabled (GPL license incompatibility)
- Verify GPL dependencies are not pulled into compiled binaries
- Update CI/CD to run without GPL linters
Complexity: Low
Breaking Changes: No - We're not using these linters currently
Pros:
- Minimal changes to existing workflow
- Keeps golangci-lint ecosystem
- Clear documentation of licensing decisions
Cons:
- Doesn't fully remove GPL from dependency tree
- May still appear in SBOM and license audits
- Requires ongoing vigilance as golangci-lint evolves
Option 2: Migrate to Alternative Linting Tools [RECOMMENDED]
Approach: Replace golangci-lint with MIT/Apache-licensed alternatives
Alternative Packages:
-
staticcheck (MIT)
- Repository: https://github.com/dominikh/go-tools
- Stars: 6.1K
- License: MIT
- Last Updated: Active (2024)
- pkg.go.dev: https://pkg.go.dev/honnef.co/go/tools/staticcheck
- Coverage: Many checks overlap with golangci-lint
-
revive (MIT)
- Repository: https://github.com/mgechev/revive
- Stars: 4.8K
- License: MIT
- Last Updated: Active (2024)
- pkg.go.dev: https://pkg.go.dev/github.com/mgechev/revive
- Coverage: Go linter focused on style and best practices
-
go vet (BSD-3-Clause, part of Go toolchain)
- Built into Go standard toolchain
- License: BSD-3-Clause
- Coverage: Basic correctness checks
Steps:
- Install alternative linters:
staticcheck,revive - Create configuration files for each linter
- Update Makefile to use new linting pipeline
- Update CI/CD workflows
- Document linting strategy in CONTRIBUTING.md
- Remove golangci-lint from tools.go and go.mod
Complexity: Medium
Breaking Changes: No - Internal tooling change only
Pros:
- Complete GPL removal from dependency tree
- Clear MIT/Apache licensing for all dependencies
- Potentially simpler configuration
- Each linter focused on specific checks
Cons:
- More complex linting pipeline (multiple tools)
- Different configuration formats to maintain
- Some linters from golangci-lint won't have direct replacements
- Migration effort for configuration
Option 3: Use golangci-lint Binary Distribution
Approach: Use pre-built golangci-lint binaries instead of go install
Steps:
- Remove golangci-lint from tools.go
- Update Makefile to download pre-built binaries
- Use GitHub releases for versioned binaries
- Update CI/CD to use binary installation
- Document binary installation in DEVGUIDE.md
Complexity: Medium
Breaking Changes: No - Transparent to developers
Pros:
- GPL dependencies not in our go.mod
- Clean SBOM without GPL entries
- Faster installation (pre-built binary)
- Same golangci-lint functionality
Cons:
- External binary dependency management
- Platform-specific binary downloads
- Potential security verification overhead
- Less integration with Go module system
Option 4: Fork golangci-lint Without GPL Linters
Approach: Create a custom fork of golangci-lint excluding GPL components
Steps:
- Fork github.com/golangci/golangci-lint
- Remove GPL-licensed linter integrations
- Rebuild without GPL dependencies
- Maintain fork with upstream updates
- Update tools.go to use fork
Complexity: High
Breaking Changes: Potential - Fork maintenance required
Pros:
- Complete GPL removal
- Keep golangci-lint integration
- Full control over linter composition
Cons:
- High maintenance burden (fork upkeep)
- Requires tracking upstream changes
- Community support fragmentation
- Not sustainable long-term
Recommended Action
Option 2: Migrate to Alternative Linting Tools (staticcheck + revive + go vet)
Priority: High
Rationale:
- Complete GPL Removal: Eliminates all GPL dependencies from build toolchain
- License Clarity: Clean MIT/Apache/BSD licensing for audits
- Sustainability: No ongoing GPL monitoring needed
- Quality: staticcheck and revive provide comprehensive coverage
- Ecosystem Alignment: MIT-licensed tools align with project license
Implementation Plan:
- Phase 1 (Week 1): Install and configure staticcheck + revive
- Phase 2 (Week 1): Update Makefile and CI/CD workflows
- Phase 3 (Week 2): Run parallel linting (golangci-lint + new tools)
- Phase 4 (Week 2): Verify coverage, adjust configurations
- Phase 5 (Week 3): Remove golangci-lint, update documentation
Testing Requirements
After implementing the chosen solution:
- Run new linting pipeline:
make lint - Verify all enabled linters execute successfully
- Check for GPL dependencies in SBOM:
gh api repos/github/gh-aw/dependency-graph/sbom | jq '.sbom.packages[] | select(.licenseConcluded | contains("GPL"))' - Validate go.mod:
go mod graph | grep GPL(should be empty) - Run full test suite:
make test - Verify CI/CD pipelines pass
Research Links
- golangci-lint Repository
- depguard Repository
- [staticcheck Documentation]((staticcheck.io/redacted)
- [revive Documentation]((revive.run/redacted)
- [GPL vs MIT License Compatibility]((www.gnu.org/redacted)
- GitHub SBOM Documentation
Additional Notes
- golangci-lint v2.8.0 is being used (check for newer versions with better licensing)
- The GPL linters are not actively used but appear in dependency graph
- Enterprise adoption may be blocked by GPL in build toolchain
- Consider license scanning in CI/CD to prevent future GPL introductions
- Document linting strategy clearly for contributors
License Compliance Priority - This issue affects our ability to maintain clear MIT licensing and may impact enterprise adoption.
AI generated by GPL Dependency Cleaner (gpclean)
- expires on Feb 14, 2026, 12:41 AM UTC