FAQ
Hi,

I have made two entries into the GOPATH variable: C:\>SET
GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1
Yet when I run the "go install" tool, the gc compiler complains:
C:\GoProgramming\gp1\src\hello>go install
go install: no install location for C:\GoProgramming\gp1\src\hello: hidden
by C:
\GoProgramming2\gp2\src\hello

Any explanation as to why the first entry "hides" the other one. And what
could be done to solve it.

Sincerely,
M. Nawazish. Khan

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

  • Brainman at Oct 5, 2014 at 11:03 pm

    On Monday, 6 October 2014 06:52:58 UTC+11, Mohammad Nawazish Khan wrote:

    ... Any explanation as to why the first entry "hides" the other one.
    I suspect you have 2 package with the same name of "hello". First lives in
    C:\GoProgramming2\gp2\src\hello directory. And second lives in
    C:\GoProgramming\gp1\src\hello directory. It is impossible to refer to 2
    different packages using single package path. I guess go command chooses to
    use C:\GoProgramming2\gp2\src\hello package because you have listed
    C:\GoProgramming2\gp2 first in your GOPATH, and will ignore your
    C:\GoProgramming\gp1\src\hello directory.

    ... And what could be done to solve it.
    Go command is trying hard to tell you should not do that - do not have 2
    different packages with the same path.

    Alex

    --
    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.
  • Mohammad Nawazish Khan at Oct 6, 2014 at 6:00 am
    Thanks for your note.

    I do not have two packages with the same name - "hello". Albeit, all the
    codes are under the customary 'main' packages in both the GOPATHS
    configured.

    However, even if the packages had the same name - "hello", why should it be
    a problem since the two same-named packages are at two different project
    directory structure!

    -Nawazish


    On Monday, October 6, 2014 1:22:58 AM UTC+5:30, Mohammad Nawazish Khan
    wrote:
    Hi,

    I have made two entries into the GOPATH variable: C:\>SET
    GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1
    Yet when I run the "go install" tool, the gc compiler complains:
    C:\GoProgramming\gp1\src\hello>go install
    go install: no install location for C:\GoProgramming\gp1\src\hello: hidden
    by C:
    \GoProgramming2\gp2\src\hello

    Any explanation as to why the first entry "hides" the other one. And what
    could be done to solve it.

    Sincerely,
    M. Nawazish. Khan
    --
    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.
  • Brainman at Oct 6, 2014 at 6:42 am

    On Monday, 6 October 2014 17:00:38 UTC+11, Mohammad Nawazish Khan wrote:

    ... I do not have two packages with the same name - "hello". Albeit, all
    the codes are under the customary 'main' packages in both the GOPATHS
    configured.

    I think this is still not allowed. For example, if you run "go install
    hello" command which of the two "projects" should get built:
    C:\GoProgramming2\gp2\src\hello or C:\GoProgramming\gp1\src\hello? I think
    your go command is confused. You have to help it.
    However, even if the packages had the same name - "hello", why should it
    be a problem since the two same-named packages are at two different project
    directory structure!

    Again, if you try to import either of your packages with `import "hello"`
    somewhere in your code, which of your two packages should go command import?

    Alex

    --
    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.
  • Mohammad Nawazish Khan at Oct 6, 2014 at 8:20 am
    Thanks for your note, Alex.

    I see your point, however, in the same context (of multiple entries in the
    GOPATH configuration) there is a situation where I want your elucidation:

    If I am correct, the start of every GO code must be contained in 'main'
    package inside 'main' function. And now if I have two application (implying
    two entry points to two different applications), it would become obligatory
    that they both have same 'main' package and function. Then in this
    situation how would you configure the GOPATH, if it were you. I think I was
    able to explain the situation.

    -Nawazish

    On Monday, October 6, 2014 1:22:58 AM UTC+5:30, Mohammad Nawazish Khan
    wrote:
    Hi,

    I have made two entries into the GOPATH variable: C:\>SET
    GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1
    Yet when I run the "go install" tool, the gc compiler complains:
    C:\GoProgramming\gp1\src\hello>go install
    go install: no install location for C:\GoProgramming\gp1\src\hello: hidden
    by C:
    \GoProgramming2\gp2\src\hello

    Any explanation as to why the first entry "hides" the other one. And what
    could be done to solve it.

    Sincerely,
    M. Nawazish. Khan
    --
    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.
  • Brainman at Oct 6, 2014 at 9:46 am

    On Monday, 6 October 2014 19:20:52 UTC+11, Mohammad Nawazish Khan wrote:

    ... If I am correct, the start of every GO code must be contained in
    'main' package inside 'main' function.

    If you're talking about Go program, then, yes, every Go program must have
    "main" package that must have "main" function. And the program will start
    with that "main" function.
    ... And now if I have two application (implying two entry points to two
    different applications), it would become obligatory that they both have
    same 'main' package and function.

    They don't have "same" "main" package. Their "main" packages are unrelated
    to each other. "main" package is special in Go as I have described above.
    You also cannot import "main" package.
    ... Then in this situation how would you configure the GOPATH, if it were
    you. I think I was able to explain the situation.

    I think your confusion is because you have made your GOPATH consist of 2
    separate directories. Do not do that. Until you have good reason to have
    it, and you have understanding of consequences of that decision. For
    example, if you do GOPATH=C:\GoProgramming, then you can have 2 separate
    programs in C:\GoProgramming\src\hello1 and C:\GoProgramming\src\hello2
    directories. They can both be package "main", and therefore have "main"
    function. But they will be independent of each other. You could build them
    with correspondent commands:

    go build hello1

    and

    go build hello2

    Or you could install them with

    go install hello1

    and

    go install hello2,

    which will build them and copy executables into C:\GoProgramming\bin
    directory. So after install commands you will have
    C:\GoProgramming\bin\hello1.exe and C:\GoProgramming\bin\hello2.exe in
    there.

    You should read http://golang.org/doc/code.html It will explain everything
    much better then I do.

    Alex

    --
    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.
  • Mohammad Nawazish Khan at Oct 6, 2014 at 11:35 am
    Hi,

    I appreciate your response and the time you are giving here.

    Of course to build/install the source codes inside the GOPATH* separately*
    will not mess things up. But initially I was trying to just say "go
    install" than using the discreet form "go install hello1" and "go install
    hello2".

    Do you know any way how we can build and install multiple go programs in a
    particular GOPATH by a generic "go install" command!

    -Nawazish

    On Monday, October 6, 2014 1:22:58 AM UTC+5:30, Mohammad Nawazish Khan
    wrote:
    Hi,

    I have made two entries into the GOPATH variable: C:\>SET
    GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1
    Yet when I run the "go install" tool, the gc compiler complains:
    C:\GoProgramming\gp1\src\hello>go install
    go install: no install location for C:\GoProgramming\gp1\src\hello: hidden
    by C:
    \GoProgramming2\gp2\src\hello

    Any explanation as to why the first entry "hides" the other one. And what
    could be done to solve it.

    Sincerely,
    M. Nawazish. Khan
    --
    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.
  • Md Nawazish Khan at Oct 6, 2014 at 3:33 pm
    Hi,

    Multiple GOPATHs can be set by separating the entries by a suitable
    Operating System dependent delimiter (a semicolon or a colon for Windows or
    *nix based systems respectively). However, while running the "go install"
    tool the gc compiler complains that, "go install: no install location for
    C:\GoProgramming\gp1\src\hello: hidden by C:
    \GoProgramming2\gp2\src\hello" . Earlier I had set the GOPATH as:

    C:\>SET GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1

    Any explanation as to why the first entry in the GOPATH variable "hides"
    the other one.

    Sincerely,
    Nawazish

    --
    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.
  • Adonovan at Oct 6, 2014 at 7:02 pm

    On Sunday, 5 October 2014 15:48:53 UTC-4, Mohammad Nawazish Khan wrote:
    Hi,

    Multiple GOPATHs can be set by separating the entries by a suitable
    Operating System dependent delimiter (a semicolon or a colon for Windows or
    *nix based systems respectively). However, while running the "go install"
    tool the gc compiler complains that, "go install: no install location for
    C:\GoProgramming\gp1\src\hello: hidden by C:
    \GoProgramming2\gp2\src\hello" . Earlier I had set the GOPATH as:

    C:\>SET GOPATH=C:\GoProgramming2\gp2;C:\GoProgramming\gp1

    Any explanation as to why the first entry in the GOPATH variable "hides"
    the other one.

    Sincerely,
    Nawazish
    Were you running 'go install .' from within
    directory C:\GoProgramming\gp1\src\hello? That would explain it, since the
    import path implied by . in that directory would be "hello", but importing
    the path "hello" would yield a different package. The tool detects and
    reports this ambiguity.

    If it's not that, then please send more information.


    --
    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
postedOct 5, '14 at 7:53p
activeOct 6, '14 at 7:02p
posts9
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase