FAQ
I am trying to build packages using an existing set of protos that my
company has and have run into some issues. I have simplified the issue I am
getting to the following workspace. Could someone please give me insight
into what I am doing wrong or the appropriate documentation or venue to get
help. Thank you and sorry if this is a simple question.

patrick$ echo $GOPATH
/Users/patrick/Code/workspace

patrick$ pwd
/Users/patrick/Code/workspace

patrick$ cat src/foo/foo.proto
package foo;

message Foo
{
   optional string foo = 1;
}

patrick$ cat src/bar/bar.proto
package bar;

import "foo/foo.proto";

message Bar
{
   optional foo.Foo foo = 1;
   optional string bar = 2;
}

patrick$ protoc --go_out=src --proto_path=src/ src/foo/foo.proto
patrick$ protoc --go_out=src --proto_path=src/ src/bar/bar.proto
patrick$ go install foo
patrick$ go build bar
src/bar/bar.pb.go:18:8: cannot find package "foo/foo.pb" in any of:
         /usr/local/Cellar/go/1.3/libexec/src/pkg/foo/foo.pb (from $GOROOT)
         /Users/patrick/Code/workspace/src/foo/foo.pb (from $GOPATH)

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Andrew Gwozdziewycz at Feb 25, 2015 at 9:37 pm

    On Tuesday, February 24, 2015 at 8:15:25 PM UTC-5, doherty...@gmail.com wrote:

    patrick$ protoc --go_out=src --proto_path=src/ src/foo/foo.proto
    patrick$ protoc --go_out=src --proto_path=src/ src/bar/bar.proto
    patrick$ go install foo
    patrick$ go build bar
    src/bar/bar.pb.go:18:8: cannot find package "foo/foo.pb" in any of:
    /usr/local/Cellar/go/1.3/libexec/src/pkg/foo/foo.pb (from $GOROOT)
    /Users/patrick/Code/workspace/src/foo/foo.pb (from $GOPATH)
    Call me silly (I've never used protoc with go), but is this just a file
    name problem? You're using .proto, and it seems to be looking for .pb ?



    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Doherty Patrick at Feb 25, 2015 at 10:11 pm
    protoc generates src/foo/foo.pb.go and src/bar/bar.pb.go so I do not
    believe that is the issue.

    On Wednesday, February 25, 2015 at 3:38:01 PM UTC-6, Andrew Gwozdziewycz
    wrote:


    On Tuesday, February 24, 2015 at 8:15:25 PM UTC-5, doherty...@gmail.com
    wrote:
    patrick$ protoc --go_out=src --proto_path=src/ src/foo/foo.proto
    patrick$ protoc --go_out=src --proto_path=src/ src/bar/bar.proto
    patrick$ go install foo
    patrick$ go build bar
    src/bar/bar.pb.go:18:8: cannot find package "foo/foo.pb" in any of:
    /usr/local/Cellar/go/1.3/libexec/src/pkg/foo/foo.pb (from $GOROOT)
    /Users/patrick/Code/workspace/src/foo/foo.pb (from $GOPATH)
    Call me silly (I've never used protoc with go), but is this just a file
    name problem? You're using .proto, and it seems to be looking for .pb ?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jason E. Aten at Feb 25, 2015 at 10:42 pm
    it looks you generated a package "foo", but then you're trying to import a
    different package, "foo/foo.pb"

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Doherty Patrick at Feb 27, 2015 at 2:53 am
    Yes. When I change the import path for foo in bar.pb.go to import foo I can
    get the bar package to compile. Do you know how to get protoc to generate
    the correct import path?
    On Wednesday, February 25, 2015 at 4:42:53 PM UTC-6, Jason E. Aten wrote:

    it looks you generated a package "foo", but then you're trying to import a
    different package, "foo/foo.pb"
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 25, '15 at 1:15a
activeFeb 27, '15 at 2:53a
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase