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: replace directive does not work with modules that do not have a go.mod #24110

Closed
leighmcculloch opened this issue Feb 25, 2018 · 4 comments

Comments

@leighmcculloch
Copy link
Contributor

commented Feb 25, 2018

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

go version go1.10 linux/amd64 vgo:2018-02-20.1

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

linux amd64

What did you do?

The root module, github.com/leighmcculloch/today.bible contains this go.mod file. None of its dependencies have a go.mod file.

module "github.com/leighmcculloch/today.bible"

require (
        "4d63.com/biblepassageapi" v0.0.0-20180105044528-9d5d1c7387b7
        "4d63.com/biblestats" v0.0.0-20180221070837-db3cb0a63ce6
        "4d63.com/collapsewhitespace" v0.0.0-20180206055443-697160e33fd4
        "4d63.com/static" v0.0.0-20180221054436-5af232ad25e5
        "4d63.com/youtubelength" v0.0.0-20180105163403-5f3917c3a5f1
)

replace (
        "4d63.com/biblepassageapi" v0.0.0-20180105044528-9d5d1c7387b7 => "../go-biblepassageapi"
)

What did you expect to see?

$ vgo build

What did you see instead?

$ vgo build
vgo: open /home/leighmcculloch/go-biblepassageapi/go.mod: no such file or directory

Additional notes

  • The vgo build command works when the replace directive is not present.
  • The vgo build command works if a go.mod file is added to the version of 4d63.com/biblepassagepi that I'm referencing with the replace.

@gopherbot gopherbot added this to the vgo milestone Feb 25, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2018

I think this is working as intended. The idea behind replace is to drop in one module for another. Vgo needs that module's requirements and such.

@rsc rsc closed this Mar 30, 2018

@leighmcculloch

This comment has been minimized.

Copy link
Contributor Author

commented Mar 30, 2018

@rsc So to replace a dependency it's working as intended that the dependency must have a go.mod file?

jhump added a commit to fullstorydev/hauser that referenced this issue Dec 17, 2018
jhump added a commit to fullstorydev/hauser that referenced this issue Dec 19, 2018
Add go.mod so hauser can be built using Go 1.11 with modules enabled (#…
…41)

* prune gorepoman from vendor folder
* add go.mod file so hauser can be built with Go 1.11 with modules enabled
* with Go modules, locally stored packages used in 'replace' directives must have go.mod files (golang/go#24110)
* make travis CI run tests using Go modules
@anacrolix

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2019

It seems unnecessary to have this requirement. In the issue I referenced, we're trying to use a dependency that has no go mod specifically to get go mod working.

@anacrolix

This comment has been minimized.

Copy link
Contributor

commented Feb 15, 2019

I think this might actually work as I expected, no go.mod file is required, I just had a typo on the left side of the => after replace. Perhaps there could be a warning if unused packages are replaced? That seems thematic for Go.

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