Skip to content

cmd/vet: printf findings can be arbitrarily long #15907

Description

@adonovan

When vet reports a printf problem such as this one:

fmt.Printf("%d", func() { ... }) // arg in printf call is a function value, not a function call

it prints out the entire body of the function literal, which can be quite long.
For example, given the program at https://play.golang.org/p/f8W0zpISww, vet prints

% go vet ~/a.go
../../../../a.go:6: arg func() {
        println("blah")
        println("blah")
        println("blah")
... dozens more lines...
        println("blah")
        println("blah")
        println("blah")
} in printf call is a function value, not a function call

Perhaps it should not print the function body at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues related to static analysis (vet, x/tools/go/analysis)NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions