-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
1.10
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/chotepud/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"/.local/go"
GORACE=""
GOROOT="
GOTMPDIR=""
GOTOOLDIR="~/.local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build941063065=/tmp/go-build -gno-record-gcc-switches"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
package test
import "fmt"
func Foo() {
fmt.Println("Hello World")
}
package test_test
import (
"testing"
"github.com/AlexRouSg/test"
)
func TestFoo(t *testing.T) {
test.Foo()
}
Run both go test -coverpkg=all and go test -coverpkg=all ./...
What did you expect to see?
Same coverage value for go test -coverpkg=all vs go test -coverpkg=all ./...
What did you see instead?
go test -coverpkg=all ./...
ok github.com/AlexRouSg/test 0.002s coverage: 16.1% of statements in all
go test -coverpkg=all
Hello World
PASS
coverage: 14.8% of statements in all
ok github.com/AlexRouSg/test 0.002s
In actual packages the difference could be as big as go test -coverpkg=all ./... 47.3% vs go test -coverpkg=all 94.4% when comparing the same package.