Skip to content

Create builtin functions in statement context inspection #2740

@grenki

Description

@grenki
func main()  {
    len("asd") // error : len("asd") evaluated but not used
        2 + 3        // error: 2 + 3 evaluated but not used
    T(4)         // error: T(4) evaluated but not used
}

type T int

The following built-in functions are not permitted in statement context:
append cap complex imag len make new real
unsafe.Alignof unsafe.Offsetof unsafe.Sizeof

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

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