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: vgo build ignores import comment #24188

Closed
cybrcodr opened this issue Mar 1, 2018 · 2 comments

Comments

@cybrcodr
Copy link
Contributor

commented Mar 1, 2018

Please answer these questions before submitting your issue. Thanks!

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

$ go version
go version go1.10 darwin/amd64

What did you do?

I followed the vgo tour at https://research.swtch.com/vgo-cmd.
I forked rsc.io/quote repo to my own at https://github.com/cybrcodr/quote.
I have a go-import redirect at https://go.cybrcodr.net/quote that produces ...

<meta name="go-import" content="go.cybrcodr.net/quote git https://github.com/cybrcodr/quote">

I rewrote hello.go ...

package main

import (
   "fmt"

   "go.cybrcodr.net/quote"
)

func main() {
   fmt.Println(quote.Hello())
}

with go.mod ...

module "hello"

require (
   "go.cybrcodr.net/quote" v1.5.2
)

Note that quote.go still has

package quote // import "rsc.io/quote"

See https://github.com/cybrcodr/quote/blob/v1.5.2/quote.go#L6

vgo build builds fine. Note that vgo get also fetches the package without any failures. I then attempted to use normal go get which showed an error because I forgot to update the import comment.

What did you expect to see?

Unless it is expected for vgo to ignore import comments, it should probably error out like normal go does.

@gopherbot gopherbot added this to the vgo milestone Mar 1, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2018

It does ignore import comments, and intentionally. As long as go.mod is up-to-date, I think import comments become redundant / deprecated. But maybe that will change. Will leave this open until we're sure.

@rsc rsc added the NeedsDecision label Mar 27, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2018

I think I'm OK with vgo not checking these comments. The go.mod lines will become the source of truth.

@rsc rsc closed this Jun 6, 2018

cactus added a commit to cactus/go-camo that referenced this issue Aug 2, 2018
remove deprecated import comments
it seems[1] like the import comments are no longer required for vgo.
so... remove them.

[1]: golang/go#24188

@golang golang locked and limited conversation to collaborators Jun 6, 2019

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