Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/vgo: proposal: let sub packages could use the same version of root package in monorepo. #26087

Closed
morlay opened this issue Jun 27, 2018 · 1 comment
Milestone

Comments

@morlay
Copy link

morlay commented Jun 27, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10.3 darwin/amd64 vgo:2018-02-20.1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/morlay/Go/bin"
GOCACHE="/Users/morlay/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/morlay/Go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l1/sr0pz92x5n7fwmdjszmjfcrc0000gn/T/go-build681411572=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Here the example https://github.com/go-courier/enumeration

github.com/go-courier/enumeration/
   generator/
      go.mod
   go.mod

We often create a monorepo with to assemble all related packages. but we use them for different purpose.

As the example,

  • The root package github.com/go-courier/enumeration as core modules.
  • The github.com/go-courier/enumeration/generator for go generate.

They have different dependences, and we couldn't put all dependences into the go.mod in root package, because we don't want to includes unnecessary dependences when we just use github.com/go-courier/enumeration

However, after we added go.mod under github.com/go-courier/enumeration/generator to isolate their owner dependences. The problem comes.

github.com/go-courier/enumeration/generator requires github.com/go-courier/enumeration
and we have to commit root codes first as one version,
and commit again just with upgrading dependences of github.com/go-courier/enumeration/generator to solve dependences issue of sub package.

This may make a little trouble for maintaining monorepo.

Could we let sub packages use the same version of root package. with marking version ~ or other token?

like below:

module github.com/go-courier/enumeration/generator

require (
	github.com/go-courier/enumeration ~
        ...
)

meanings sub package github.com/go-courier/enumeration/generator will use the same version of
github.com/go-courier/enumeration

@gopherbot gopherbot added this to the vgo milestone Jun 27, 2018
@morlay morlay changed the title x/vgo: problems with sub packages in one repo. x/vgo: proposal: let sub packages could use the same version of root package in monorepo. Jun 27, 2018
@morlay
Copy link
Author

morlay commented Jun 28, 2018

use root go.mod instead. Vgo not download unnecessary deps.

@morlay morlay closed this as completed Jun 28, 2018
@golang golang locked and limited conversation to collaborators Jun 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants