google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.32k stars 212 forks source link

starlark: do not use reflect.Value.MethodByName #444

Closed aarzilli closed 1 year ago

aarzilli commented 1 year ago

Using MethodByName disables deadcode elimination in the linker (see the deadcode function in $GOROOT/src/cmd/link/internal/ld/deadcode.go).

Since the only use of MethodByName is with a static string as an argument it can be easily replaced with a downcast to an interface.