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: compiler directives are not handled properly #17315

Closed
JayNakrani opened this issue Oct 2, 2016 · 2 comments
Closed

cmd/cover: compiler directives are not handled properly #17315

JayNakrani opened this issue Oct 2, 2016 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@JayNakrani
Copy link
Contributor

What version of Go are you using (go version)?

go version go1.7.1 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

What did you do?

Complete instruction on reproducing this error:

$ cat ~/tmp/haha.go 
package haha

import "hihi"

func init() {
    HahaImpl := haha
}

// Haha hihi hehe!
//
//go:noescape
func haha()

$ # Notice the misplaced compiler directive in the output below.
$ go tool cover -mode atomic -var Haha5678901234567890123 ~/tmp/haha.go
package haha

import _cover_atomic_ "sync/atomic"

import "hihi"

func init() {
    _cover_atomic_.AddUint32(&Haha5678901234567890123.

    //go:noescape
    Count[0], 1)
    HahaImpl := haha
}

func haha()

var _ = _cover_atomic_.AddUint32

var Haha5678901234567890123 = struct {
    Count     [1]uint32
    Pos       [3 * 1]uint32
    NumStmt   [1]uint16
} {
    Pos: [3 * 1]uint32{
        5, 7, 0x2000d, // [0]
    },
    NumStmt: [1]uint16{
        1, // 0
    },
}

What did you expect to see?

The compiler directive, //go:noescape, should not have been misplaced. It should have stayed with function declaration haha().

What did you see instead?

The compiler directive was misplaced.

@gopherbot
Copy link

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

@odeke-em odeke-em changed the title go cover doesn't handle compiler directives properly cmd/cover: compiler directives are not handled properly Oct 2, 2016
@odeke-em
Copy link
Member

odeke-em commented Oct 2, 2016

/cc @robpike

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 3, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Oct 3, 2016
@golang golang locked and limited conversation to collaborators Oct 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants