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/go: go test -race -coverpkg broken in master #22728

Closed
tarm opened this issue Nov 15, 2017 · 2 comments
Closed

cmd/go: go test -race -coverpkg broken in master #22728

tarm opened this issue Nov 15, 2017 · 2 comments

Comments

@tarm
Copy link

tarm commented Nov 15, 2017

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

master as of Nov 14 (git commit 918396b)

Does this issue reproduce with the latest release?

v1.9.2 behaves as I expect it to.

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

GOARCH="amd64"
GOOS="darwin"

What did you do?

cat junk/main.go:

package main

import "junk/pkg"

func main() {
	pkg.Fn()
}

cat junk/pkg/pkg.go

package pkg

import "fmt"

func Fn() {
	fmt.Println("Hello")
}
~/go/src/junk $ go test -c -covermode=atomic -race -coverpkg junk/pkg junk
# junk/pkg
/var/folders/5t/rzxkjjy92675c7kfkqbbknxw0000gn/T/go-build680272980/b002/pkg.go:1:21: can't find import: "sync/atomic"

What did you expect to see?

In v1.9.2 and earlier releases, there would not be an error about "sync/atomic"

I used a script to bisect the issue down to

0be2d52ebaa85c4d055bde4239a6698d7135ca3e is the first bad commit
commit 0be2d52ebaa85c4d055bde4239a6698d7135ca3e
Author: Russ Cox <rsc@golang.org>
Date:   Fri Jun 9 11:15:53 2017 -0400

    cmd/go: use -importcfg to invoke compiler, linker
    
    This is a step toward using cached build artifacts: the importcfg
    will direct the compiler and linker to read them right from the cache
    if necessary. However, this CL does not have a cache yet, so it still
    reads them from the usual install location or build location.
    Even so, this fixes a long-standing issue that -I and -L (no longer used)
    are not expressive enough to describe complex GOPATH setups.
    
    Shared libraries are handled enough that all.bash passes, but
    there may still be more work to do here. If so, tests and fixes
    can be added in follow-up CLs.
    
    Gccgo will need updating to support -importcfg as well.
    
    Fixes #14271.
    
    Change-Id: I5c52a0a5df0ffbf7436e1130c74e9e24fceff80f
    Reviewed-on: https://go-review.googlesource.com/56279
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: David Crawshaw <crawshaw@golang.org>
    Reviewed-by: Ian Lance Taylor <iant@golang.org>
@tarm
Copy link
Author

tarm commented Nov 15, 2017

cc @rsc

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Nov 15, 2017
@bradfitz bradfitz changed the title go test -race -coverpkg broken in master cmd/go: go test -race -coverpkg broken in master Nov 15, 2017
@gopherbot
Copy link

Change https://golang.org/cl/81497 mentions this issue: cmd/go: fix -covermode=atomic use of sync/atomic in -coverpkg matches

@golang golang locked and limited conversation to collaborators Dec 4, 2018
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants