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: doesn't work with grpc.go4.org #25768

Closed
broady opened this issue Jun 7, 2018 · 6 comments

Comments

@broady
Copy link
Member

commented Jun 7, 2018

using golang.org/x/vgo at 085872, not cmd/go from tip.

  1. Write a program importing grpc.go4.org.
  2. Run vgo build
  3. See this (partial) output:
	import "grpc.go4.org" [/usr/local/google/home/cbro/go/src/grpc.go4.org]: open /usr/local/google/home/cbro/go/src/grpc.go4.org: no such file or directory
$ go env GOROOT
/usr/local/google/home/cbro/go
$ go env GOPATH
/usr/local/google/home/cbro

(so, it was looking in GOROOT for some reason?)

@oiooj oiooj changed the title vgo: doesn't work with grpc.go4.org x/vgo: doesn't work with grpc.go4.org Jun 7, 2018

@gopherbot gopherbot added this to the vgo milestone Jun 7, 2018

@myitcv

This comment has been minimized.

Copy link
Member

commented Jun 7, 2018

Seems to work for me (using this example)?

cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello/
cat <<EOD > hello.go
package main // import "example.com/hello"

import (
        "log"
        "os"

        "context"
        "grpc.go4.org"
        pb "grpc.go4.org/examples/helloworld/helloworld"
)

const (
        address     = "localhost:50051"
        defaultName = "world"
)

func main() {
        // Set up a connection to the server.
        conn, err := grpc.Dial(address, grpc.WithInsecure())
        if err != nil {
                log.Fatalf("did not connect: %v", err)
        }
        defer conn.Close()
        c := pb.NewGreeterClient(conn)

        // Contact the server and print out its response.
        name := defaultName
        if len(os.Args) > 1 {
                name = os.Args[1]
        }
        r, err := c.SayHello(context.Background(), &pb.HelloRequest{Name: name})
        if err != nil {
                log.Fatalf("could not greet: %v", err)
        }
        log.Printf("Greeting: %s", r.Message)
}
EOD
echo > go.mod
vgo build
cat go.mod

gives:

module example.com/hello

require (
        github.com/golang/protobuf v1.1.0
        golang.org/x/net v0.0.0-20180530234432-1e491301e022
        golang.org/x/text v0.3.0
        grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
)

Using:

go version go1.10.2 linux/amd64
vgo commit 6a94eb3b5ccc04453d2fb45c23641e5993118068
@broady

This comment has been minimized.

Copy link
Member Author

commented Jun 7, 2018

@myitcv that worked for me, so there's a bug somewhere else. probably because this package does live on my GOPATH?

@myitcv

This comment has been minimized.

Copy link
Member

commented Jun 7, 2018

@broady did you have a go.mod when you tried to run vgo build?

Do you have a set of repro steps?

@broady

This comment has been minimized.

Copy link
Member Author

commented Jun 8, 2018

Yes, there was an empty go.mod file.

Very odd, I can't reproduce this in a docker container, but can on my workstation. I'll do some more investigation tomorrow.

@bcmills

This comment has been minimized.

Copy link
Member

commented Jun 8, 2018

Odd. It seems to work fine on my workstation too, and I suspect that my workstation fairly closely resembles @broady's.

~$ mkdir -p /tmp/go4
~$ cd /tmp/go4
/tmp/go4$ echo module m > go.mod
/tmp/go4$ mkdir p
/tmp/go4$ cat > p/p.go
package p
import _ "grpc.go4.org"

/tmp/go4$ cd p
/tmp/go4/p$ vgo build .
vgo: resolving import "grpc.go4.org"
vgo: finding grpc.go4.org (latest)
vgo: adding grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
vgo: finding grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
vgo: downloading grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
vgo: resolving import "github.com/golang/protobuf/proto"
vgo: finding github.com/golang/protobuf (latest)
vgo: adding github.com/golang/protobuf v1.1.0
vgo: resolving import "golang.org/x/net/http2"
vgo: finding golang.org/x/net (latest)
vgo: adding golang.org/x/net v0.0.0-20180530234432-1e491301e022
vgo: finding golang.org/x/net v0.0.0-20180530234432-1e491301e022
vgo: finding github.com/golang/protobuf v1.1.0
vgo: downloading github.com/golang/protobuf v1.1.0
vgo: downloading golang.org/x/net v0.0.0-20180530234432-1e491301e022
vgo: resolving import "golang.org/x/text/secure/bidirule"
vgo: finding golang.org/x/text (latest)
vgo: adding golang.org/x/text v0.3.0
vgo: finding golang.org/x/text v0.3.0
vgo: downloading golang.org/x/text v0.3.0
@gopherbot

This comment has been minimized.

Copy link

commented Jun 10, 2018

Change https://golang.org/cl/117715 mentions this issue: cmd/go/internal/vgo: fix importDir bug

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

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