FAQ
I'm pretty sure this is a very basic newb question, but I couldn't find
anything online:

I've installed Go and was able to build the sample program successfully.
I can also build http://github.com/nats-io/gnatsd without issues.

However, I'm now trying to build a local project that uses protobuf and
grpc.

When building I got the following:



*#
command-line-argumentsC:\dev\tools\Go\1.6\pkg\tool\windows_amd64\link.exe:
cannot open file
C:\dev\tools\Go\1.6/pkg/windows_amd64/golang.org/x/net/context.a: open
C:\dev\tools\Go\1.6/pkg/windows_amd64/golang.org/x/net/context.a: The
system cannot find the pathpecified.*

I've tried running *go get golang.org/x/net/context* (and then *go get -u
golang.org/x/net/context*...) and it seemed to work, but it installed the
library under my GOPATH, whereas the message above tries to look for it
under my GOROOT (*C:\dev\tools\Go\1.6*) where I have no golang.org under
pkg.

Copy the folders manually from GOPATH to GOROOT (just for the sake of the
experiment), makes things work.
You need to copy more than just the golang.org folder (also github.com &
google.golang.org in this case), but it works.

Building on OS-X also works (I'm with Windows 7).


Anyway, I ultimately solved my problem, *by removing all relative path
imports* from our go code.
So, out of curiosity:

1. Would it be true to say we should not use relative path imports in go
projects?
2. How is this error message related to such imports? A different message
would be much more helpful.

--
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

  • James Bardin at Mar 2, 2016 at 7:43 pm

    On Wednesday, March 2, 2016 at 2:08:29 PM UTC-5, adam...@gmail.com wrote:

    1. Would it be true to say we should not use relative path imports in go
    projects?
    That's correct. Never use relative import paths.

    2. How is this error message related to such imports? A different message
    would be much more helpful.
    A relative path is making it to the linker, which it can't resolve. This
    might have something to do with how Windows handles the current directory
    when creating a new process. If you use the full import path of your
    package when building or installing, you'll get an error message about
    having a "local import in a non-local package" (with "local" here meaning
    outside of GOPATH.) which might help.

    --
    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
postedMar 2, '16 at 7:08p
activeMar 2, '16 at 7:43p
posts2
users2
websitegolang.org

2 users in discussion

Adamhonen: 1 post James Bardin: 1 post

People

Translate

site design / logo © 2021 Grokbase