FAQ
Hi,


Probably I am wrong - but I don't if I am wrong because I am doing
something wrong or because the concept is wrong.

I have a project which will generate few binaries, therefore, I have few
packages under cmd, like:

github.com/yatayatayta/
----> cmd/magic1
----> cmd/magic2


When I have only magic1 or magic2 under cmd, when I call:
$ go build ./cmd/...

It generates the magic1 binary correctly. But when I have both, the same
command generates no binary at all.

What is it wrong that I am doing/thinking?


Thanks,
         - CC

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

  • Mike Ossareh at Feb 28, 2015 at 12:12 am
    This is by design and is documented here:
    http://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies

    When the command line specifies a single main package, build writes the
    resulting executable to output. Otherwise build compiles the packages but
    discards the results, serving only as a check that the packages can be
    built.

    To build both you can issue:

    go build github.com/yatayatayta/cmd/magic1
    go build github.com/yatayatayta/cmd/magic2

    given the commands are under cmd/ you can readily script this so that you
    don't have to build each one by hand.

    On Fri, Feb 27, 2015 at 5:12 PM, Carlos U. Cirello Filho wrote:

    Hi,


    Probably I am wrong - but I don't if I am wrong because I am doing
    something wrong or because the concept is wrong.

    I have a project which will generate few binaries, therefore, I have few
    packages under cmd, like:

    github.com/yatayatayta/
    ----> cmd/magic1
    ----> cmd/magic2


    When I have only magic1 or magic2 under cmd, when I call:
    $ go build ./cmd/...

    It generates the magic1 binary correctly. But when I have both, the same
    command generates no binary at all.

    What is it wrong that I am doing/thinking?


    Thanks,
    - CC

    --
    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.
    --
    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.
  • Ian Davis at Feb 28, 2015 at 2:10 am

    On Fri, Feb 27, 2015, at 11:12 PM, Carlos U. Cirello Filho wrote:
    Hi,


    Probably I am wrong - but I don't if I am wrong because I am doing
    something wrong or because the concept is wrong.

    I have a project which will generate few binaries, therefore, I have
    few packages under cmd, like:

    github.com/yatayatayta/ ----> cmd/magic1 ----> cmd/magic2


    When I have only magic1 or magic2 under cmd, when I call: $ go build
    ./cmd/...

    It generates the magic1 binary correctly. But when I have both, the
    same command generates no binary at all.

    What is it wrong that I am doing/thinking?
    Use go install instead

    Ian

    --
    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.
  • Dave Cheney at Feb 28, 2015 at 2:17 am

    On Saturday, 28 February 2015 10:13:36 UTC+11, Carlos wrote:
    Hi,


    Probably I am wrong - but I don't if I am wrong because I am doing
    something wrong or because the concept is wrong.

    I have a project which will generate few binaries, therefore, I have few
    packages under cmd, like:

    github.com/yatayatayta/
    ----> cmd/magic1
    ----> cmd/magic2


    When I have only magic1 or magic2 under cmd, when I call:
    $ go build ./cmd/...

    It generates the magic1 binary correctly. But when I have both, the same
    command generates no binary at all.
    You didn't include an example of trying this, and the results. That said,
    most of the go commands take multiple arguments, consider

    % go build ./cmd/magic1 ./cmd/magic2

    To echo what Ian also said, please prefer go install over go build, pretty
    much always.


    What is it wrong that I am doing/thinking?


    Thanks,
    - CC
    --
    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 27, '15 at 11:12p
activeFeb 28, '15 at 2:17a
posts4
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase