wfarr / goenv

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

Change storage url #21

Closed lukashes closed 8 years ago

lukashes commented 8 years ago

All golang sources from https://golang.org/dl/ placed in: https://stortage.googleapis.com/golang/...

spraints commented 8 years ago

I can't get curl to download anything from storage.googleapis.com. Can you paste an example of goenv installing an old go version with this URL?

lukashes commented 8 years ago

Example of curl request:

curl -I https://storage.googleapis.com/golang/go1.2.2.linux-amd64.tar.gz
HTTP/1.1 200 OK

The minimal version is 1.2.2 and current is 1.5.1

Installation:

$ goenv install 1.3
...
Installed 1.3
$ goenv versions
1.2.2
1.3
1.5
1.5.1
spraints commented 8 years ago

Won't go >= 1.2 get downloaded from golang.org?

lukashes commented 8 years ago

I understood:

$ curl -I https://golang.org/dl/go1.2.2.linux-amd64.tar.gz
HTTP/1.1 302 Found
Location: https://storage.googleapis.com/golang/go1.2.2.linux-amd64.tar.gz

But if I checkout my changes I see:

goenv install 1.5.1

curl: (22) The requested URL returned error: 404 Not Found
goenv: unable to install Go `1.5.1' from binary, download not available at https://go.googlecode.com/files/go1.5.1.linux-amd64.tar.gz

It seems like error in vercomp function. Please try to install 1.5.1 version.

lukashes commented 8 years ago

I see problem:

$ goenv help install
Usage: goenv install <version>

Versions should be in the form of N.N.N

And after I try 1.5.1 as it written in documentation, func vercomp returns "1 1" instead "1"

spraints commented 8 years ago

It seems like error in vercomp function.

And after I try 1.5.1 as it written in documentation, func vercomp returns "1 1" instead "1"

Ah ha! I'm fine with dropping support for the really old versions of go (1.0, 1.1), which means that this part of the install script could avoid doing vercomp at all and just download from golang.org. What do you think?

lukashes commented 8 years ago

Hi! I missed your comment :) I think is good idea to support new versions. Can I do anything to help you?

spraints commented 8 years ago

I mean, instead of this:

rtn=$(vercomp ${version} 1.2)
# URL to download from
if [ "$rtn" == "1" ]
then
    download="http://golang.org/dl/go${version}.${platform}-${arch}${extra}.tar.gz"
else
    download="https://storage.googleapis.com/golang/go${version}.${platform}-${arch}${extra}.tar.gz"
fi

would this work?

download="http://golang.org/dl/go${version}.${platform}-${arch}${extra}.tar.gz"
lukashes commented 8 years ago

Yes, it works!

lukashes@lukashes-pc:~/src/goenv$ goenv install 1.3.1
####################################                                      50,7%^C
lukashes@lukashes-pc:~/src/goenv$ goenv install 1.5.1
#########                                                                 13,4%^C
spraints commented 8 years ago

Yes, it works!

Great! Can you try out #22 and make sure I didn't break something on that branch?

ryurock commented 8 years ago

Hey. is this brach merged master?

ryurock commented 8 years ago

goenv-install is it arrived failed to pull this pullrequest in darwin. But storage is like are extra also lost other than the url.

What both modified and I have to pullrequest.

https://github.com/wfarr/goenv/pull/23

spraints commented 8 years ago

@ryurock this pull request is still open, so it hasn't been merged. #23 looks like it'd be equally important. I'd rather merge #22 + #23 than this PR.

ryurock commented 8 years ago

@spraints

I along with your intention. Pull this request to close