Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Specify outname name of binary #33

Closed
keithpitt opened this issue Feb 3, 2014 · 5 comments
Closed

Specify outname name of binary #33

keithpitt opened this issue Feb 3, 2014 · 5 comments

Comments

@keithpitt
Copy link

With go build I can specify -o to customize the name of the binary it builds:

go build -o my-awesome-project

Is there a way to achieve this with goxc? (Apologies for the silly question!)

@laher
Copy link
Owner

laher commented Feb 5, 2014

Hi Keith: not a silly question!

I've been meaning to implement this for ages, as a 'text/template'. It needs to be a template because it needs to produce different file paths for each platform.

I've started work on it, and the default template looks like this:

{{.Version}}{{.PS}}{{.Os}}_{{.Arch}}{{.PS}}{{.AppName}}{{.Ext}}

So, you can just change it to -xt="blah{{.Ext}}" and then it will just create it as blah (or blah.exe for windows)

Would that work for you?

I'll let you know once it's ready. Cheers

@laher
Copy link
Owner

laher commented Feb 18, 2014

Hi, for the moment you have control over that to some extent (you can
override the 'GOPATHPART/bin/src-xc' with the -d option, and 'unknown'
(i.e. the package version) with the -pv option:

goxc -d destination/dir -pv 0.0.1 xc

This will mean it ends up inside destination/dir/0.0.1 (then e.g.
.../windows_386/)

Basically I'd still recommend putting your app into its own directory.
That's where goxc expects it to be, and if you ever want your app to be
go-gettable, then it would make sense for you to do that.

BTW, I'll finish & release the new features off as soon as I get my hands
on some time. About 2 more hours should do it. Hopefully this weekend.

On Feb 17, 2014 11:25 AM, "Alex Casanova" notifications@github.com wrote:

@laher https://github.com/laher is this something I can change
currently? Right now the output gos to $GOPATH/bin/src-xc/unknown. Is it
possible to output to a different directory?

Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-35218247
.

@laher
Copy link
Owner

laher commented Feb 22, 2014

This is now done. Please update (go get -u), test and let me know.

You can use -o, but be awaer that this is a template: the default template is as follows: -o="{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.Os}}_{{.Arch}}{{.PS}}{{.AppName}}{{.Ext}}".

You can just specify a plain-text value for -o, but I wouldn't recommend that unless you specify a single platform e.g. goxc -o=myapp.exe -bc=windows,386 xc - otherwise you'll overwrite the file. Note that I'll put in validation to prevent this overwriting in future versions.

Note also that -o can be defined in your json config as OutPath (or via the 'write config' option goxc -wc -o=XXXXX).
There will be more to follow on this tack, but for now this should give the flexibility you were asking for.

Rgds,

@sanbornm
Copy link

sanbornm commented Mar 8, 2014

I also wanted this feature. I just updated goxc and tested this and can confirm this works for me!

Thanks,

@laher
Copy link
Owner

laher commented Mar 25, 2014

sweet, thanks for letting me know. Closing

@laher laher closed this as completed Mar 25, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants