Reputation: 10846
I have a go generate directive which looks like this:
//go:generate myprog -someName thisname -data 'Request: Typ "." callMe, Rsp: MyTyp "." close'
The issue is that the program receives only value of -someName
flag ("thisname"). I assume the -data
flag is discarded for some reasons. Any idea why? It's working if I execute the program directly from command line so I guess it's a go specific issue.
Upvotes: 2
Views: 1118
Reputation: 42413
From the design document of go generate https://docs.google.com/document/d/1V03LUfjSADDooDMhe-_K59EgpTEm3V8uvQRuNMAEnjg/edit:
The arguments are space-separated tokens (or double-quoted strings) passed to the generator as individual arguments when it is run.
So if you want to pass an argument containing space you will have to double quote them. You used single quotes which works in your shell but not with go generate
Upvotes: 5