Being able to run custom `go build` command
Closed this issue · 7 comments
I'm using godep to manage dependency. But it requires me to run godep go build
to build with my dependencies managed. I'm wondering if it makes sense to being able to run that as part of the goxc
build.
Thanks,
Owen
Hi Jingweno, that sounds do-able, I guess I could make a PrependGoCommand setting, but i'm just looking at the source code and so far it looks like godep is simply prepending a 'Godeps/_workspace' dir to the GOPATH variable.
So, I'm wondering if it's enough to do that instead. What do you think?
goxc already allows you to set env variables, as follows (on Unix):
goxc -env GOPATH=Godeps/_workspace:$GOPATH
If you wanted to store this setting for future invocations, I would use -wlc
rather than -wc
, because the variable gets expanded to a host-specific GOPATH string.
goxc -wlc -env GOPATH=Godeps/_workspace:$GOPATH
What do you think? Does it work for you? Is this sufficient?
Cheers
Sorry for the late reply. The approach on appending the godep to GOPATH works. But I found that using json setting doesn't work. I ended up setting GOPATH through env var directly.
OK. Maybe a good compromise would be to make each Env variable into a text/template template, that way you could have cross-platform Separators, PathSeparators, and other env variables.
e.g.
"GOPATH=.{{.FS}}Godeps{{.FS}}_workspace{{.PS}}{{.Env.GOPATH}}"
I'll work on it & let you know .. I think the Env json setting is pretty hopeless without it.
Hi Owen, I've implemented the text/template support.
Here's an example, as used in my own .goxc.json file:
"Env": [
"GOPATH=Godeps{{.PLS}}{{.Env.GOPATH}}"
]
I figured this format would enable to support all platforms and would help prevent platform-specific values from creeping in via -env commandline flags.
The only variables available initially are .PLS (PathListSeparator), .PS (PathSeparator), and .Env.* (all the environment variables in the current environment).
Please get latest and let me know if it's any use to you, or not.
Rgds,
Oh I just realised that the example should include the _workspace folder, i.e.
"Env": [
"GOPATH=Godeps{{.PS}}_workspace{{.PLS}}{{.Env.GOPATH}}"
]
This ended up working for me
"Env": [
"GOPATH={{.Env.PWD}}{{.PS}}Godeps{{.PS}}_workspace{{.PLS}}{{.Env.GOPATH}}"
]
Closing after long time without response from reporter.