Skip to content

cmd/vet: false positive about recursive call to String method #23550

@marat-rkh

Description

@marat-rkh

Please answer these questions before submitting your issue. Thanks!

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

go1.9.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

Run go vet and go run on the following file:

package main

import "fmt"

type X string
func (x *X) String() string { return fmt.Sprint(">> ", &x) }

func main() {
	var x X = ""
	fmt.Println(x.String())
}

What did you expect to see?

go vet reports no errors as program runs without problems, prints pointer address and exits normally.

What did you see instead?

go vet reports arg &x in Sprint call causes recursive call to String method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions