Closed iaxax closed 2 years ago
This is surely a surprising behavior. Currently gore tries to 1. parse the input as an expression, 2. parse as a declaration in the main function 3. declaration outside the main function. The struct declaration in the main function is allowed in Go so the input generates the following code. But maybe we can fix this without breaking other behaviors.
package main
func main() { type A struct{ v int } }
func foo(a A) { a.v = 2 }
https://github.com/x-motemen/gore/issues/34#issuecomment-991494511 struct method also cannot define...
can we define struct out side the main function. then struct method and function reference costom struct can use correct. will it be breaking change?
I have support this in my side
can try my version https://github.com/xiantang/gore..
I have supported method and pointer function for struct, but dont know whether it's a breaking change..
if you want use this feature can clone my fork than make install
@itchyny
This has been resolved in v0.5.5.