
go-work
List Go modules in workspace with smart path detection
go-work is a workspace management application that auto discovers Go modules in the workspace and lists module paths and versions. Perfect fit with monorepos, multi-module projects, and complex Go workspaces.
CHINESE README
δΈζθ―΄ζ
Features
- π Auto Discovers: Auto discovers Go modules in the workspace
- π― Smart Filtering: Excludes paths without Go source files
- ποΈ Flexible Options: Configure project and submodules scanning
- π JSON Output: Clean JSON format output
- π’ Monorepo Support: Perfect fit with monorepo architecture
Installation
go install github.com/yylego/go-work/cmd/go-work@latest
Usage
List Module Paths
# List all Go modules in current workspace
cd awesome-path && go-work
Output:
[
{
"path": "/Users/admin/awesome-path",
"module": "github.com/example/awesome"
}
]
List Module Versions
# List Go versions used in each module
cd awesome-path && go-work version
Output:
[
{
"path": "/Users/admin/awesome-path",
"module": "github.com/example/awesome",
"version": "1.22.8"
}
]
Command Line Options
Usage:
go-work [command]
Available Commands:
version List Go versions used in each module
help Help about any command
Flags:
-h, --help help for go-work
Package Usage
import "github.com/yylego/go-work/workspath"
// Get project root path
root, ok := workspath.GetProjectRoot("/path/to/sub")
// Get project path with details
info, ok := workspath.GetProjectPath("/path/to/sub")
// info.Root = "/path/to/project"
// info.SubPath = "sub"
// Scan modules with options
paths := workspath.GetModulePaths(
"/path/to/workspace",
workspath.WithCurrentProject(),
workspath.ScanDeep(),
workspath.SkipNoGo(),
)
π License
MIT License - see LICENSE.
Contributions are welcome! Report bugs, suggest features, and contribute code:
- π Mistake reports? Open an issue on GitHub with reproduction steps
- π‘ Fresh ideas? Create an issue to discuss
- π Documentation confusing? Report it so we can improve
- π Need new features? Share the use cases to help us understand requirements
- β‘ Performance issue? Help us optimize through reporting slow operations
- π§ Configuration problem? Ask questions about complex setups
- π’ Follow project progress? Watch the repo to get new releases and features
- π Success stories? Share how this package improved the workflow
- π¬ Feedback? We welcome suggestions and comments
π§ Development
New code contributions, follow this process:
- Fork: Fork the repo on GitHub (using the webpage UI).
- Clone: Clone the forked project (
git clone https://github.com/yourname/repo-name.git).
- Navigate: Navigate to the cloned project (
cd repo-name)
- Branch: Create a feature branch (
git checkout -b feature/xxx).
- Code: Implement the changes with comprehensive tests
- Testing: (Golang project) Ensure tests pass (
go test ./...) and follow Go code style conventions
- Documentation: Update documentation to support client-facing changes
- Stage: Stage changes (
git add .)
- Commit: Commit changes (
git commit -m "Add feature xxx") ensuring backward compatible code
- Push: Push to the branch (
git push origin feature/xxx).
- PR: Open a merge request on GitHub (on the GitHub webpage) with detailed description.
Please ensure tests pass and include relevant documentation updates.
π Support
Welcome to contribute to this project via submitting merge requests and reporting issues.
Project Support:
- β Give GitHub stars if this project helps you
- π€ Share with teammates and (golang) programming friends
- π Write tech blogs about development tools and workflows - we provide content writing support
- π Join the ecosystem - committed to supporting open source and the (golang) development scene
Have Fun Coding with this package! πππ
GitHub Stars
