Skip to content

proposal: cmd/vet: warn on unused AppendFormat return value #63689

Description

@1f604

Currently the compiler will throw an error if the return value of append is not used, but it does not error or even warn if the return value of time.AppendFormat is not used, even though AppendFormat has the same semantics as append.

https://go.dev/play/p/IpxJrcX3FkT

If someone calls AppendFormat without using the return value, that is always an error, because it does nothing.

I looked for linters that would catch this issue and could not find any.

EDIT: I tried to add it to go vet unusedresult but I couldn't get it to work...is it that unusedresult still only works for pure functions as stated in #14972 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions