FAQ
I would like to run tests in my GOPATH with something like this:

go test ...


But this doesn't work because this includes all the packages in the GOROOT
as well.

I can generate a list of local packages with this little script, but is
there a more idiomatic way to do it?

STDLIB=`go list std`

LOCALPKGS=$(for i in `go list ...`; do [[ "$STDLIB" =~ "$i" ]] || echo -n
"$i "; done)

go test $LOCALPKGS

--
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/groups/opt_out.

Search Discussions

  • Jeremy Wall at Sep 26, 2013 at 3:46 pm
    if GOPATH is a single directory then

    $> cd $GOPATH; go test ./...

    Will do it.

    On Thu, Sep 26, 2013 at 10:44 AM, Sam Nguyen wrote:

    I would like to run tests in my GOPATH with something like this:

    go test ...


    But this doesn't work because this includes all the packages in the GOROOT
    as well.

    I can generate a list of local packages with this little script, but is
    there a more idiomatic way to do it?

    STDLIB=`go list std`

    LOCALPKGS=$(for i in `go list ...`; do [[ "$STDLIB" =~ "$i" ]] || echo -n
    "$i "; done)

    go test $LOCALPKGS

    --
    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/groups/opt_out.
    --
    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/groups/opt_out.
  • Sam Nguyen at Sep 27, 2013 at 7:50 pm
    This is perfect, thanks!
    On Thursday, September 26, 2013 8:46:21 AM UTC-7, Jeremy Wall wrote:

    if GOPATH is a single directory then

    $> cd $GOPATH; go test ./...

    Will do it.


    On Thu, Sep 26, 2013 at 10:44 AM, Sam Nguyen <samxn...@gmail.com<javascript:>
    wrote:
    I would like to run tests in my GOPATH with something like this:

    go test ...


    But this doesn't work because this includes all the packages in the
    GOROOT as well.

    I can generate a list of local packages with this little script, but is
    there a more idiomatic way to do it?

    STDLIB=`go list std`

    LOCALPKGS=$(for i in `go list ...`; do [[ "$STDLIB" =~ "$i" ]] || echo -n
    "$i "; done)

    go test $LOCALPKGS
    --
    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/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 26, '13 at 3:44p
activeSep 27, '13 at 7:50p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase