You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating dagger.gen.go, it's possible for the user to name their arguments to clash with other internal names.
For example, a user can name their arguments to collide with imported names, like json, fmt and os or with internal local variables like parent, inputArgs and err, or even with keywords, such as package.
These kind of collisions cause weird internal errors that don't really make much sense to the user - like Unmarshal undefined (type bool has no field or method Unmarshal).
We should update the Go modules SDK so that we can detect these cases, and rename local variables to avoid this kind of collision - e.g. if we have an argument named json, and we have json declared in an outer scope already, we should instead call the internal variable json2 (or similar, it doesn't hugely matter since it's in an internal function scope).
Reacted by Šimon Woidig, Robert Marsal, James Light and Marcos Nils
Activity
[-]Zenith: variable name collisions in Go modules[/-][+]Variable name collisions in Go modules[/+]