8000 cmd/go: test -coverprofile should ask compiler to drop (incorrect) position information · Issue #67938 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
cmd/go: test -coverprofile should ask compiler to drop (incorrect) position information #67938
Open
@rsc

Description

@rsc
% cat x.go
package p

func f(int) string

func g() {
	b := f(1)
	collect := func(min, max, stop int) []int {
		return nil
	}
	b := f(2)
	_ = collect
}
% go test -coverprofile=c.out x.go
# command-line-arguments
./x.go:6:2: `b' declared and not used
./x.go:10:35: no new variables on left side of :=

There is no column 35 on the line b := f(2), making the error message very confusing. The problem is that cover has inserted text into the lines. When the compiler did not print column information, that was invisible. Now it's not.

To make it invisible again, the compiler should add a flag to drop position information, and then the go command should use that flag when compiling with test coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.gabywins

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0