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

cmd/go: [modules] replace fails for subpackage #31397

Closed
FredFoo opened this issue Apr 11, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@FredFoo
Copy link

commented Apr 11, 2019

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

$ go version 1.12.2

Does this issue reproduce with the latest release?

I guess this is the latest release, afaik, humbly :)

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

go env Output
GOARCH="amd64"
GOOS="linux"

What did you do?

I created a module that has is a package and has a subpackage, both importing the same dependency.

- mypackage
  main.go
  - subpackage
    subcode.go
- hlog
  hlog.go

Not using GOPATH I am importing hlog in main.go and subcode.go

import (
    "git.private.home/Dumper/hlog"
)

GO111MODULE=on is what I am using. But now I need to fix or investigate something in hlog and this justifies the use of replace according to this documentation

I edited go.mod in mypackage to show this for hlog:

require (
	git.private.home/Dumper/hlog v1.0.0
)

replace git.private.home/Dumper/hlog => ../hlog

What did you expect to see?

Would expect to see mypackage compile where all source files import the local version of hlog instead of the VCS version.

What did you see instead?

I see that main.go is using the rewritten hlog version, but subpackage/subcode.go still uses the VCS version. This renders the replace directive useless if you have subpackages using the same dependencies.

@FredFoo FredFoo closed this Apr 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.