Skip to content

spec: make isn't defined on named types #13184

Closed
@paulhankin

Description

@paulhankin

https://golang.org/ref/spec#Making_slices_maps_and_channels

"The built-in function make takes a type T, which must be a slice, map or channel type, optionally followed by a type-specific list of expressions."

This appears to exclude named types, even though make will create values of named types.

Maybe: "The built-in function make takes a type T, whose underlying type must be a slice, map or channel type, optionally followed by a type-specific list of expressions."

Here's some working code that I think is not covered by the current spec: http://play.golang.org/p/mekr0KLDWj

package main
import "fmt"
type T []int
func main() {
fmt.Println(make(T, 10))
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions