-
-
Save gruberdev/c567338b5ef6b475bd06e306679f912c to your computer and use it in GitHub Desktop.
Revisions
-
lalyos revised this gist
Mar 15, 2018 . 1 changed file with 1 addition and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,18 +59,8 @@ The binary linux distribution is normally dynamically lnked to glibc. It menas t will fail on alpine. There are 2 workarounds: - Use `frolvlad/alpine-glibc` instead of `library/alpine` as a base image - Download the releavant docker image layer from golang:alpine : [code here](https://gist.github.com/lalyos/9c4ce959a3e8366b716d2b4ab9329383#file-golang-alpine-install-sh) ## References -
lalyos revised this gist
Mar 15, 2018 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ The [README.md](https://github.com/golang/tools/tree/master/cmd/getgo) advices t curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer ``` ## One-liner (linux) But if you check the [server logic](https://github.com/golang/tools/blob/master/cmd/getgo/server/main.go#L42-L45) you can see, that it only checks if the url is matched _containsIgnoreCase_ agains _MINGW/Linux/Darwin_. So the url can be just: `https://get.golang.org/$(uname)`. Curl can follow redirects, so curl -Lo installer **get.golang.org/linux** @@ -53,6 +53,25 @@ curl -L https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz | tar -xz -C /usr/lo # curl -L https://storage.googleapis.com/golang/$VERSION.linux-amd64.tar.gz ``` ## Alpine linux The binary linux distribution is normally dynamically lnked to glibc. It menas that the all above will fail on alpine. There are 2 workarounds: - Use `frolvlad/alpine-glibc` instead of `library/alpine` as a base image - Download the releavant docker image layer from golang:alpine ``` # download 1 single docker image layer (https://github.com/docker-library/golang/blob/9bf6daddb324a4d8e82b0613cf348a6eff363f95/1.10/alpine3.7/Dockerfile#L10) # and untar the relevant dir (usr/local/go) into '/' # first you have to ask for a fresh Bearer token with scope=repository:library/img:tag curl -Ls -H "Authorization: Bearer $(curl -s 'https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/golang:pull' | jq .token -r)" \ https://registry-1.docker.io/v2/library/golang/blobs/sha256:6487ee6212c57a47feb500f1421c38a83cd1ab7def383ffc49804d9d56970cbb \ | tar -xzv -T <(echo usr/local/go) -C / ``` ## References - The announcement at [golang-nuts](https://groups.google.com/forum/#!topic/golang-nuts/ZFqZkGYX4x8) -
lalyos revised this gist
Jan 26, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ curl -Lo go_installer https://get.golang.org/$(uname) && chmod +x go_installer && ./go_installer && rm go_installer -
lalyos revised this gist
Jan 26, 2018 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,11 @@ ## Install latest golang ``` curl -Ls http://bit.ly/go_installer | bash ``` ## Overview If you want to install golang, normally you are following the description on the [official dowload page](https://golang.org/dl/) There is a WIP tool for installing golang in a machine/os independent way called **getgo**. Source is available on [github](https://github.com/golang/tools/tree/master/cmd/getgo) @@ -23,6 +31,9 @@ curl -Lo go_installer https://get.golang.org/linux && chmod +x go_installer && . ``` ``` curl -Ls http://bit.ly/go_installer | bash ``` ## Download The one-liner is capable of doing the following [steps](https://github.com/golang/tools/blob/36c7af3342056179a831c19ec142f2763b310f7b/cmd/getgo/main.go#L54-L60) (also interactively): -
lalyos revised this gist
Jan 26, 2018 . 2 changed files with 19 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,28 @@ If you want to install golang, normally you are following the description on the [official dowload page](https://golang.org/dl/) There is a WIP tool for installing golang in a machine/os independent way called **getgo**. Source is available on [github](https://github.com/golang/tools/tree/master/cmd/getgo) ## One-liner There is [github issue](https://github.com/golang/go/issues/23381) describint the rational, and work behind the one-liner install. The [README.md](https://github.com/golang/tools/tree/master/cmd/getgo) advices the following (works for linux/osx/windows): ``` curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer ``` ## One-liser (linux) But if you check the [server logic](https://github.com/golang/tools/blob/master/cmd/getgo/server/main.go#L42-L45) you can see, that it only checks if the url is matched _containsIgnoreCase_ agains _MINGW/Linux/Darwin_. So the url can be just: `https://get.golang.org/$(uname)`. Curl can follow redirects, so curl -Lo installer **get.golang.org/linux** So for cloud servers and/or docker containers you can do: ``` curl -Lo go_installer https://get.golang.org/linux && chmod +x go_installer && ./go_installer && rm go_installer ``` ``` ## Download The one-liner is capable of doing the following [steps](https://github.com/golang/tools/blob/36c7af3342056179a831c19ec142f2763b310f7b/cmd/getgo/main.go#L54-L60) (also interactively): @@ -31,5 +42,7 @@ curl -L https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz | tar -xz -C /usr/lo # curl -L https://storage.googleapis.com/golang/$VERSION.linux-amd64.tar.gz ``` ## References - The announcement at [golang-nuts](https://groups.google.com/forum/#!topic/golang-nuts/ZFqZkGYX4x8) - The download url was changed in a [recent commit](https://github.com/golang/tools/commit/25101aadb97aa42907eee6a238d6d26a6cb3c756#diff-5a90d0db100ac9833cb25bfb76e57be1) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ curl -Lo go_installer https://get.golang.org/linux && chmod +x go_installer && ./go_installer && rm go_installer -
lalyos revised this gist
Jan 26, 2018 . 1 changed file with 35 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ If you want to install golang, normally you are following the description on the [official dowload page](https://golang.org/dl/) There is a WIP tool for installing golang in a machine/os independent way: **getgo**. cmd/getgo ## One-liner ``` curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer ``` - https://github.com/golang/tools/tree/master/cmd/getgo - https://groups.google.com/forum/#!topic/golang-nuts/ZFqZkGYX4x8 ## Download The one-liner is capable of doing the following [steps](https://github.com/golang/tools/blob/36c7af3342056179a831c19ec142f2763b310f7b/cmd/getgo/main.go#L54-L60) (also interactively): - chooseVersion - downloadGo - unzip - setupGOPATH If you want only the download part, on linux it would be : ``` VERSION=go1.9.3 curl -L https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz | tar -xz -C /usr/local # old url # curl -L https://storage.googleapis.com/golang/$VERSION.linux-amd64.tar.gz ``` tl;dr: The download url was changed in a [recent commit](https://github.com/golang/tools/commit/25101aadb97aa42907eee6a238d6d26a6cb3c756#diff-5a90d0db100ac9833cb25bfb76e57be1) -
lalyos created this gist
Sep 12, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ sudo bash -c 'add-apt-repository ppa:ubuntu-lxc/lxd-stable; sudo apt-get -qq update;sudo apt-get install -y golang'