go-work

module
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: MIT

README ΒΆ

GitHub Workflow Status (branch) GoDoc Coverage Status Supported Go Versions GitHub Release Go Report Card

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.


πŸ’¬ Contact & Feedback

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:

  1. Fork: Fork the repo on GitHub (using the webpage UI).
  2. Clone: Clone the forked project (git clone https://github.com/yourname/repo-name.git).
  3. Navigate: Navigate to the cloned project (cd repo-name)
  4. Branch: Create a feature branch (git checkout -b feature/xxx).
  5. Code: Implement the changes with comprehensive tests
  6. Testing: (Golang project) Ensure tests pass (go test ./...) and follow Go code style conventions
  7. Documentation: Update documentation to support client-facing changes
  8. Stage: Stage changes (git add .)
  9. Commit: Commit changes (git commit -m "Add feature xxx") ensuring backward compatible code
  10. Push: Push to the branch (git push origin feature/xxx).
  11. 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

Stargazers

Directories ΒΆ

Path Synopsis
cmd
go-work command
Package main: go-work entrypoint Lists Go module paths and versions in the current workspace
Package main: go-work entrypoint Lists Go module paths and versions in the current workspace
internal
utils
Package utils: Internal utilities that detect and analyze Go project paths Traverses file system and finds Go modules
Package utils: Internal utilities that detect and analyze Go project paths Traverses file system and finds Go modules
Package workspace: Go workspace structure management in multi-module projects Defines workspace configuration and validates project structure Supports both classic projects and Go workspace mode with go.work files
Package workspace: Go workspace structure management in multi-module projects Defines workspace configuration and validates project structure Supports both classic projects and Go workspace mode with go.work files
Package workspath: Go module path detection and workspace scanning Scans workspace structures and detects Go modules with configurable options
Package workspath: Go module path detection and workspace scanning Scans workspace structures and detects Go modules with configurable options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL