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: display method receiver (when any) in go tool cover output #50094

Open
geoffroy-perso opened this issue Dec 10, 2021 · 0 comments
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@geoffroy-perso
Copy link

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

$ go version
go1.17.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kushuh/Library/Caches/go-build"
GOENV="/Users/kushuh/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/kushuh/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kushuh/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/kushuh/go/go1.17.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/kushuh/go/go1.17.3/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/kushuh/GolandProjects/anlog/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_f/pdvtdvc50q9b2jr_l_trnbf00000gn/T/go-build2228551702=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go test -count=1 -coverprofile coverage.out ./... -v -coverpkg=./...
$ go tool cover -func=coverage.out

Example file:

package errors

type CustomError1 struct {}

func (e *CustomError1) Error() string {
    return "error 1 description"
}

type CustomError2 struct {}

func (e *CustomError2) Error() string {
    return "error 2 description"
}

What did you expect to see?

gitlab.com/a-novel/tools/logs/internal/errors/errors.go:5:         CustomError1.Error                   100.0%
gitlab.com/a-novel/tools/logs/internal/errors/errors.go:11:        CustomError2.Error                   100.0%

What did you see instead?

gitlab.com/a-novel/tools/logs/internal/errors/errors.go:5:         Error                   100.0%
gitlab.com/a-novel/tools/logs/internal/errors/errors.go:11:        Error                   100.0%

Description

More a suggestion than an actual issue, but I think it would be nice if go tool cover could display methods receivers (when any) when logging results to console.

It will make output more readable and convenient for codes highly relying on interfaces and structs :)

@seankhliao seankhliao changed the title go/tools: display method receiver (when any) in go tool cover output cmd/cover: display method receiver (when any) in go tool cover output Dec 10, 2021
@toothrot toothrot added this to the Backlog milestone Dec 10, 2021
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 10, 2021
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

3 participants