• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-mate / go-work / 20190688123

13 Dec 2025 10:19AM UTC coverage: 65.865% (-0.03%) from 65.899%
20190688123

push

github

yangyile
Streamline workspath API with functional options pattern

BREAKING CHANGES - Migration Guide:
- Old: NewOptions().WithIncludeCurrentProject(true).WithIncludeSubModules(true)
- New: GetModulePaths(path, WithCurrentProject(), ScanDeep(), SkipNoGo())
- Old: FindModulePaths(path, options)
- New: GetModulePaths(path, ...Option)
- Old: GetProjectPath() returns (root, subpath, ok)
- New: GetProjectPath() returns (*ProjectPath, ok) with Root/SubPath fields
- New: GetProjectRoot() returns (root, ok) - simple root detection

Code Changes:
- Split workspath into works_path.go and options.go
- Add functional options: WithCurrentProject(), WithCurrentPackage(), ScanDeep(), SkipNoGo(), DebugMode(), WithDebug(bool)
- Add GetProjectRoot() function - returns project root path
- Add ProjectPath struct with Root and SubPath fields
- Rename internal functions: shouldSkip→isHidden, hasGoFiles→existsGoFiles
- Reduce package from ~270 lines to ~160 lines

CLI Changes:
- Remove command execution (worksexec/worksubcmd packages removed in previous commit)
- Default command: list module paths with JSON output
- Add version subcommand: list Go versions from go.mod files
- Add cobra.NoArgs to restrict arguments
- Use golang.org/x/mod/modfile to parse go.mod

Documentation and CI:
- Update README.md and README.zh.md with new API examples
- Update footer template to version 2025-11-25
- Add .github/workflows/release.yml with Go 1.22.x-1.25.x matrix
- Update Go version badge link to go.dev

Tests:
- Add tests: GetProjectPath, GetProjectRoot, GetModulePaths with options
- Add edge case tests: NotFound, RootIsModule, ScanDeep, SkipNoGo, NotModule
- Use setupTestProject/cleanupDIR test helpers

79 of 138 new or added lines in 3 files covered. (57.25%)

3 existing lines in 2 files now uncovered.

137 of 208 relevant lines covered (65.87%)

27.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.7
/workspath/works_path.go


Build SHA Not Found

The commit SHA "0b75b0f752469c4af98db2ca485a5f053e11d279" was not found in your repository, so the file cannot be loaded. This may be because you posted from a local development environment, or your CI created an ephemeral commit.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc