Categorygithub.com/xmlking/go-workspace
modulepackage
1.1.4
Repository: https://github.com/xmlking/go-workspace.git
Documentation: pkg.go.dev

# README

go-workspace

Experimenting with golang-1.18 multi-module workspaces

GitHub go.mod Go version Go

Run

# run generate first
go generate ./...

# root module
go run ./...
go test -v ./... 
go test -v -fuzz=Fuzz ./internal
# lib module
go test -v ./lib/...
# app modules
go run ./cmd/app1/...
go run ./cmd/app2/...
go generate ./...
go build -v .
# check SBOM
go version -m go-workspace
# run binary
./go-workspace

Workspace commands

$ go help work
Usage:

        go work <command> [arguments]

The commands are:

        edit        edit go.work from tools or scripts
        init        initialize workspace file
        sync        sync workspace build list to modules
        use         add modules to workspace file

Project structure

.
├── README.md
├── cmd
│   ├── app1
│   │   ├── go.mod
│   │   └── main.go
│   └── app2
│       ├── go.mod
│       └── main.go
├── go.work
├── go.work.sum
└── lib
    ├── binaryheap
    │   ├── binaryheap.go
    │   └── binaryheap_test.go
    ├── filter
    │   ├── filter.go
    │   └── filter_test.go
    └── go.mod

Reference