wfarr / goenv

You know, rbenv but for go.
MIT License
111 stars 36 forks source link

goenv install flags (--list) #5

Open sighmin opened 10 years ago

sighmin commented 10 years ago

Thanks for getting this started dude.

It would be great to have a --list flag for the goenv install command o see what versions are available.

simeonwillbanks commented 10 years ago

@sighmin Cool idea. :smile:

@wfarr Here are a couple potential implementations:

  1. Open Go Downloads page in a browser
    • open https://code.google.com/p/go/downloads/list
    • Super simple but cumbersome
  2. Add and maintain a list of available binaries

Thoughts? Thanks!

simeonwillbanks commented 10 years ago

@wfarr I thought of a third option; it doesn't require extra files.

3. Add and maintain an array of available binaries

Potential array implementation:

bash-3.2$ echo $platform
darwin
bash-3.2$ echo $arch
amd64
bash-3.2$ echo $extra
-osx10.8
bash-3.2$ VERSIONS["darwin_amd64_osx108"]="1.2.1 1.2"
bash-3.2$ VERSIONS["darwin_amd64_osx106"]="1.2.1 1.2"
bash-3.2$ key="${platform}_${arch}_$(echo ${extra} | tr -d '[:punct:]')"
bash-3.2$ echo $key
darwin_amd64_osx108
bash-3.2$ echo ${VERSIONS[$key]}
1.2.1 1.2
bash-3.2$ for version in `echo ${VERSIONS[$key]}`
> do
> echo $version
> done
1.2.1
1.2

Thanks for considering!

sighmin commented 10 years ago

How's this? https://github.com/wfarr/goenv/pull/6

I went with the third version. Sorry if it's not leet I'm not a bash expert.