Skip to content

valast: slice got generates want for which some linters show a warning #6

@fabstu

Description

@fabstu

See this example:

	tests := []struct {
		name string
		want autogold.Value
	}{
		{name: "good", want: autogold.Want("good", []A{A{
			A: valast.Addr("abc").(*string),
			B: "def",
			C: valast.Addr(false).(*bool),
			D: valast.Addr(true).(*bool),
		}})},
	}

[]A{A{ could be rewritten as []A{{. I'm not sure whether it s a linter or some other tool but the second A being there shows up as a warning in my code. It would be awesome if that could be avoided. Else I'd have to remote the A on every want-change, because it gets readded there again.

Another option would be to ignore this, but it would be nice if avoiding to write the A would be possible. :-)

The warning:

redundant type from array, slice, or map composite literalsimplifycompositelit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions