Skip to content

cmd/cover, cmd/trace, cmd/vendor/github.com/google/pprof/internal/report: fmt.Fprintln arg list ends with redundant newline #49322

Closed
@dmitshur

Description

@dmitshur

Issue #30436 was about improving cmd/vet to detect when a fmt.Fprintln arg list ends with a redundant newline regardless of syntax (previously, it worked only when the string was a ast.BasicLit).

CL 356830 resolved that issue recently, and when it is brought into the main tree (as is being done in CL 361094, it finds 3 problems in the standard library tree:

  • cmd/cover/cover.go:43:2: fmt.Fprintln arg list ends with redundant newline

fmt.Fprintln(os.Stderr, usageMessage)

  • cmd/trace/main.go:69:3: fmt.Fprintln arg list ends with redundant newline

fmt.Fprintln(os.Stderr, usageMessage)

  • cmd/vendor/github.com/google/pprof/internal/report/source.go:877:2: fmt.Fprintln arg list ends with redundant newline

fmt.Fprintln(w, weblistPageClosing)

(Build log.)

Those packages fail to build because cmd/go (CC @bcmills, @matloob) considers this vet problem fatal during go test. E.g.:

$ go test cmd/cover
# cmd/cover
cmd/cover/cover.go:43:2: fmt.Fprintln arg list ends with redundant newline
FAIL	cmd/cover [build failed]
FAIL

This needs to be resolved to unblock the 1.18 release.

As far as I understand, the vet check is working as intended and we should fix the 3 places. The one in pprof will need to fixed upstream and vendored in.

The improvement to the vet check may be worth mentioning in 1.18 release notes (#47694).

CC @golang/release, @zpavlinovic, @timothy-king.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions