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/compile: spurious line info added to interface satisfaction error #50907

Closed
rsc opened this issue Jan 29, 2022 · 5 comments
Closed

cmd/compile: spurious line info added to interface satisfaction error #50907

rsc opened this issue Jan 29, 2022 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jan 29, 2022

% cat /tmp/x.go
package p

import (
	"fmt"
	"strings"
)

func main() {
	var b strings.Builder
	fmt.Fprintf(b, "hello")
}
% go tool compile -G=0 /tmp/x.go
/tmp/x.go:10:13: cannot use b (type strings.Builder) as type io.Writer in argument to fmt.Fprintf:
	strings.Builder does not implement io.Writer (Write method has pointer receiver)
% go tool compile /tmp/x.go
/tmp/x.go:10:14: cannot use b (variable of type strings.Builder) as type io.Writer in argument to fmt.Fprintf:
	strings.Builder does not implement io.Writer (Write method has pointer receiver) at $GOROOT/src/strings/builder.go:88:19
% 

The $GOROOT makes the added line info not useful.
I am not sure where that's coming from.
But it's probably also just not useful in general:
much of the time, the type will be in a dependency
somewhere, and the user is not really helped
by printing the path of some file in the module cache.

The "at ..." should be deleted.

Not a beta blocker.

@rsc rsc added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 29, 2022
@rsc rsc added this to the Go1.18 milestone Jan 29, 2022
@AGMETEOR
Copy link

@rsc do you mind if I work on this incase it's not too complicated for a beginner contributor?

@ianlancetaylor
Copy link
Contributor

@AGMETEOR Feel free to take a look, but it's very likely that this will be fixed by one of the compiler developers in a week or two.

@ianlancetaylor
Copy link
Contributor

CC @griesemer @findleyr

@griesemer griesemer self-assigned this Feb 1, 2022
@griesemer
Copy link
Contributor

This was introduced by CL 373634 which fixed two issues that wanted the line info...

Will remove.

@gopherbot
Copy link

Change https://golang.org/cl/381774 mentions this issue: cmd/compile: tweak missingMethodReason logic to improve message

@golang golang locked and limited conversation to collaborators Jun 22, 2023
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. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants