FAQ
Reviewers: golang-dev1,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/go/


Description:
cmd/go: fix bad error message in coverage for package without non-test
files
Was checking for nil map; must check for empty map instead.

Before:

go test -cover
# testmain
/var/folders/00/013l0000h01000cxqpysvccm0004fc/T/go-build233480051/_/Users/r/issue/_test/_testmain.go:11:
imported and not used: "_/Users/r/issue"
FAIL _/Users/r/issue [build failed]

Now:

go test -cover
testing: warning: no tests to run
PASS
coverage: 0.0% of statements
ok _/Users/r/issue 0.021s

Please review this at https://codereview.appspot.com/12916043/

Affected files:
    M src/cmd/go/test.go


Index: src/cmd/go/test.go
===================================================================
--- a/src/cmd/go/test.go
+++ b/src/cmd/go/test.go
@@ -1010,7 +1010,7 @@
   func writeTestmain(out string, pmain, p *Package) error {
    var cover []coverInfo
    for _, cp := range pmain.imports {
- if cp.coverVars != nil {
+ if len(cp.coverVars) > 0 {
      cover = append(cover, coverInfo{cp, cp.coverVars})
     }
    }


--

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

Search Discussions

  • Brad Fitzpatrick at Aug 14, 2013 at 4:24 pm
    LGTM


    On Tue, Aug 13, 2013 at 9:03 PM, wrote:

    Reviewers: golang-dev1,

    Message:
    Hello golang-dev@googlegroups.com,

    I'd like you to review this change to
    https://code.google.com/p/go/


    Description:
    cmd/go: fix bad error message in coverage for package without non-test
    files
    Was checking for nil map; must check for empty map instead.

    Before:

    go test -cover
    # testmain
    /var/folders/00/**013l0000h01000cxqpysvccm0004fc**
    /T/go-build233480051/_/Users/**r/issue/_test/_testmain.go:11:
    imported and not used: "_/Users/r/issue"
    FAIL _/Users/r/issue [build failed]

    Now:

    go test -cover
    testing: warning: no tests to run
    PASS
    coverage: 0.0% of statements
    ok _/Users/r/issue 0.021s

    Please review this at https://codereview.appspot.**com/12916043/<https://codereview.appspot.com/12916043/>

    Affected files:
    M src/cmd/go/test.go


    Index: src/cmd/go/test.go
    ==============================**==============================**=======
    --- a/src/cmd/go/test.go
    +++ b/src/cmd/go/test.go
    @@ -1010,7 +1010,7 @@
    func writeTestmain(out string, pmain, p *Package) error {
    var cover []coverInfo
    for _, cp := range pmain.imports {
    - if cp.coverVars != nil {
    + if len(cp.coverVars) > 0 {
    cover = append(cover, coverInfo{cp, cp.coverVars})
    }
    }


    --

    ---You received this message because you are subscribed to the Google
    Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+unsubscribe@**googlegroups.com<golang-dev%2Bunsubscribe@googlegroups.com>
    .
    For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
    .
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • R at Aug 15, 2013 at 12:37 am
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=60eb79a2cd0f ***

    cmd/go: fix bad error message in coverage for package without non-test
    files
    Was checking for nil map; must check for empty map instead.

    Fixes issue 6065

    Before:

    go test -cover
    # testmain
    /var/folders/00/013l0000h01000cxqpysvccm0004fc/T/go-build233480051/_/Users/r/issue/_test/_testmain.go:11:
    imported and not used: "_/Users/r/issue"
    FAIL _/Users/r/issue [build failed]

    Now:

    go test -cover
    testing: warning: no tests to run
    PASS
    coverage: 0.0% of statements
    ok _/Users/r/issue 0.021s

    R=golang-dev, bradfitz
    CC=golang-dev
    https://codereview.appspot.com/12916043


    https://codereview.appspot.com/12916043/

    --

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedAug 14, '13 at 4:03a
activeAug 15, '13 at 12:37a
posts3
users2
websitegolang.org

2 users in discussion

R: 2 posts Brad Fitzpatrick: 1 post

People

Translate

site design / logo © 2022 Grokbase