3 ms·
Worse yet, a shell script would work whereas go generate does not. Go generate is probably the most half-assed thing the go team has done yet. Now, I know the
by TheDong 12y ago
Worse yet, a shell script would work whereas go generate does not.
Go generate is probably the most half-assed thing the go team has done yet.
Now, I know the above line is harsh, but I don't say that without proof. Run the following and bear witness to its terrible implementation.
curl http://pastebin.com/raw.php?i=fhu14iwk > main.go
cat main.go
go run main.go
go generate -v main.go
go generate -help
go generate -x -v -run ".*(echo|one).*"
Yeah...
If you don't feel like looking at the above, the implementation of go generate is a hack of substring matching, not language parsing, and it also doesn't implement, in its production release, the "-run" flag documented in "-help".
- breakingcups 12y agoYour concern seems fair and valid. Have you raised this issue on the mailing list?
- bluesign 12y agoI don't think this is a valid test case, as far as I understand, //go:generate works like "preprocessor directive". Maybe I can agree that // prefix is a bad choice, as coming from C world I would prefer #
- TheDong 12y agoHere's a corresponding C program in which I use a #define that is not processed by the pre-processor since it's not a dumb string matcher. http://pastebin.com/raw.php?i=dE7QsTgS http://pastebin.com/raw.php?i=dE7QsTgS Define might be. But actual directives are not. In go, the directives are.