Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cover: coverage failed to track lines in function literal #14039

Closed
daviddengcn opened this issue Jan 20, 2016 · 1 comment
Closed

cmd/cover: coverage failed to track lines in function literal #14039

daviddengcn opened this issue Jan 20, 2016 · 1 comment
Milestone

Comments

@daviddengcn
Copy link

@daviddengcn daviddengcn commented Jan 20, 2016

Source

The lines with fmt.Println("not tracked") are not tracked.

a.go

package main

import "fmt"

func a(f func()) error {
    return nil
}

func main() {
    if err := a(func() {
        fmt.Println("not tracked")
        fmt.Println("not tracked")
    }); err != nil {
        fmt.Println(err)
    }
}

a_test.go

package main

import (
    "testing"
)

func TestA(t *testing.T) {
}

screen shot 2016-01-20 at 5 14 52 am

@ianlancetaylor ianlancetaylor changed the title Coverage failed to track some lines cmd/cover: coverage failed to track lines in function literal Jan 20, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Jan 20, 2016
@gopherbot
Copy link

@gopherbot gopherbot commented Feb 21, 2016

CL https://golang.org/cl/19775 mentions this issue.

@gopherbot gopherbot closed this in e7f6d8b Feb 22, 2016
@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.