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
Closed

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

FredFoo opened this issue Apr 11, 2019 · 0 comments

Comments

@FredFoo
Copy link

FredFoo 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 as completed Apr 11, 2019
@golang golang locked and limited conversation to collaborators Apr 10, 2020
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