Skip to content

cmd/vet: warn when ignoring the return value of slices.Delete and friends #62729

@Deleplace

Description

@Deleplace

Calling slices.Delete while ignoring the returned slice value is almost certainly a bug, doing some element shifting but losing track of which elements are kept/discarded.

See sample: https://go.dev/play/p/2jV918bTDAX

Suggestion

vet warning:

./prog.go:11:14: ignoring the return value of slices.Delete

Same for DeleteFunc, Compact and CompactFunc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions