Open
Description
In #47709 it was proposed to add type inference for slice literals, e.g., foo := []{"bar", "baz"}
. That proposal was declined in favour of creating an equivalent function in slices
.
This issue proposes a slices.Of(…)
method to do that, e.g.:
foo := slices.Of("bar", "baz")
… would be equivalent to:
foo := []string{"bar", "baz"}
The benefit is minimal in a trivial case like the above, but to create a slice of *somepackage.NameThatIsRatherLong
it would be helpful.
Metadata
Metadata
Assignees
Type
Projects
Status
Incoming