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: go run doesn't recognize semantic-versioned import path for main package #24676

Closed
hajimehoshi opened this issue Apr 4, 2018 · 4 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hajimehoshi
Copy link
Member

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/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/7t/qw3np69559591s1v0mk5_p1m0000gn/T/go-build743754165=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Create a main package with version 2 (go.mod), like

$ cat $GOPATH/src/github.com/hajimehoshi/vgotest/main.go
package main

func main() {
        println("Hello")
}

$ cat $GOPATH/src/github.com/hajimehoshi/vgotest/go.mod

module "github.com/hajimehoshi/vgotest/v2"

What did you expect to see?

vgo run main.go at $GOPATH/src/github.com/hajimehoshi/vgotest succeeds.

What did you see instead?

Error message:

build github.com/hajimehoshi/vgotest: cannot find module for path github.com/hajimehoshi/vgotest

Additional information

Instead of specifying a file, specifying a package path (#22726) might solve this?

@gopherbot gopherbot added this to the vgo milestone Apr 4, 2018
@bcmills
Copy link
Contributor

bcmills commented Apr 4, 2018

Duplicate of #24667?

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 4, 2018
@hajimehoshi
Copy link
Member Author

As #22726 is solved, is this issue automatically solved?

@rsc rsc modified the milestones: vgo, Go1.11 Jul 12, 2018
@rsc rsc added the modules label Jul 12, 2018
@rsc rsc changed the title x/vgo: vgo run doesn't recognize semantic-versioned import path for main package cmd/go: go run doesn't recognize semantic-versioned import path for main package Jul 12, 2018
@rsc
Copy link
Contributor

rsc commented Jul 17, 2018

This seems to be working now. I'm not exactly sure when we fixed it. Sorry for the long delay.

$ cat go.mod
module github.com/hajimehoshi/vgotest/v2
$ cat main.go
package main
func main() { println("hello") }
$ GO111MODULE=on go run main.go
hello
$ GO111MODULE=on go run .
hello
$ 

@rsc rsc closed this as completed Jul 17, 2018
@hajimehoshi
Copy link
Member Author

Thank you for confirming!

@golang golang locked and limited conversation to collaborators Jul 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants