sanbornm / go-selfupdate

Enable your Go applications to self update
MIT License
1.53k stars 176 forks source link

default platform value #2

Closed thomasf closed 9 years ago

thomasf commented 9 years ago

If I understand what you want to do this is incorrect:

plat = os.Getenv("GOOS") + "-" + os.Getenv("GOARCH")

runtime.GOOS and runtime.GOARCH should be used instead(?)

My reason for asking is that I am adding more command line options (using flags) and I stumbled upon this inconsistency.

This is the work so far.. It's mostly done and compatible with the the current way arguments are handed:

https://github.com/thomasf/go-selfupdate/compare/sanbornm:master...master

sanbornm commented 9 years ago

I was using environment variables as it seemed like that was what many people were using to cross compile:

http://stackoverflow.com/questions/12168873/cross-compile-go-on-osx

Maybe the order in which it is set goes:

flag -> env vars -> runtime ?

Let me know your thoughts before we merge in #3

thomasf commented 9 years ago

I actually decided to pull go-selfupdate into my application because I only need a smaller subset of features. I'll make that change anyway, I will set the default value for the flag from the environment, but only if both GOOS and GOARCH are set.

thomasf commented 9 years ago

I've made that change