Skip to content

Commit 1bab172

Browse files
committed
Add 1.4rc1
This includes support for both `android/arm` and `nacl/arm`. :)
1 parent 455b15a commit 1bab172

File tree

8 files changed

+270
-2
lines changed

8 files changed

+270
-2
lines changed

1.4/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:jessie
2+
3+
# SCMs for "go get", gcc for cgo
4+
RUN apt-get update && apt-get install -y \
5+
ca-certificates curl gcc libc6-dev make \
6+
bzr git mercurial \
7+
--no-install-recommends \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
ENV GOLANG_VERSION 1.4rc1
11+
12+
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
13+
| tar -v -C /usr/src -xz
14+
15+
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
16+
17+
ENV PATH /usr/src/go/bin:$PATH
18+
19+
RUN mkdir -p /go/src
20+
ENV GOPATH /go
21+
ENV PATH /go/bin:$PATH
22+
WORKDIR /go
23+
24+
COPY go-wrapper /usr/local/bin/

1.4/cross/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM golang:1.4rc1
2+
3+
# see https://golang.org/doc/install/source#environment
4+
# see also http://build.golang.org/
5+
# and canonically, see defs_OS_ARCH.h files in src/runtime
6+
# https://code.google.com/p/go/source/browse?name=go1.4beta1#hg%2Fsrc%2Fruntime
7+
ENV GOLANG_CROSSPLATFORMS \
8+
android/arm \
9+
darwin/386 darwin/amd64 \
10+
dragonfly/386 dragonfly/amd64 \
11+
freebsd/386 freebsd/amd64 freebsd/arm \
12+
linux/386 linux/amd64 linux/arm \
13+
nacl/386 nacl/amd64p32 nacl/arm \
14+
netbsd/386 netbsd/amd64 netbsd/arm \
15+
openbsd/386 openbsd/amd64 \
16+
plan9/386 plan9/amd64 \
17+
solaris/amd64 \
18+
windows/386 windows/amd64
19+
20+
# ls src/runtime/defs_*_*.h | sed -r 's!^.*/defs_([^_]+)_([^_]+)[.]h$!\1/\2!'
21+
22+
# (set an explicit GOARM of 5 for maximum ARM compatibility)
23+
ENV GOARM 5
24+
25+
RUN cd /usr/src/go/src \
26+
&& set -ex \
27+
&& for platform in $GOLANG_CROSSPLATFORMS; do \
28+
GOOS=${platform%/*} \
29+
GOARCH=${platform##*/} \
30+
./make.bash --no-clean 2>&1; \
31+
done

1.4/go-wrapper

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
set -e
3+
4+
usage() {
5+
base="$(basename "$0")"
6+
cat <<EOUSAGE
7+
8+
usage: $base command [args]
9+
10+
This script assumes that is is run from the root of your Go package (for
11+
example, "/go/src/app" if your GOPATH is set to "/go").
12+
13+
The main feature of this wrapper over the native "go" tool is that it supports
14+
the addition of a ".godir" file in your package directory which is a plain text
15+
file that is the import path your application expects (ie, it would be something
16+
like "github.com/jsmith/my-cool-app"). If this file is found, the current
17+
package is then symlinked to /go/src/<.gopath> and the commands then use that
18+
full import path to act on it. This allows for applications to be universally
19+
cloned into a path like "/go/src/app" and then automatically built properly so
20+
that inter-package imports use the existing source instead of downloading it a
21+
second time. This also makes the final binary have the correct name (ie,
22+
instead of being "/go/bin/app", it can be "/go/bin/my-cool-app"), which is why
23+
the "run" command exists here.
24+
25+
Available Commands:
26+
27+
$base download
28+
$base download -u
29+
(equivalent to "go get -d [args] [godir]")
30+
31+
$base install
32+
$base install -race
33+
(equivalent to "go install [args] [godir]")
34+
35+
$base run
36+
$base run -app -specific -arguments
37+
(assumes "GOPATH/bin" is in "PATH")
38+
39+
EOUSAGE
40+
}
41+
42+
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
43+
cmd="$1"
44+
if ! shift; then
45+
usage >&2
46+
exit 1
47+
fi
48+
49+
dir="$(pwd -P)"
50+
goBin="$(basename "$dir")" # likely "app"
51+
52+
goDir=
53+
if [ -f .godir ]; then
54+
goDir="$(cat .godir)"
55+
goPath="${GOPATH%%:*}" # this just grabs the first path listed in GOPATH, if there are multiple (which is the detection logic "go get" itself uses, too)
56+
goDirPath="$goPath/src/$goDir"
57+
mkdir -p "$(dirname "$goDirPath")"
58+
if [ ! -e "$goDirPath" ]; then
59+
ln -sfv "$dir" "$goDirPath"
60+
elif [ ! -L "$goDirPath" ]; then
61+
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
62+
exit 1
63+
fi
64+
goBin="$goPath/bin/$(basename "$goDir")"
65+
fi
66+
67+
case "$cmd" in
68+
download)
69+
execCommand=( go get -v -d "$@" )
70+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
71+
set -x; exec "${execCommand[@]}"
72+
;;
73+
74+
install)
75+
execCommand=( go install -v "$@" )
76+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
77+
set -x; exec "${execCommand[@]}"
78+
;;
79+
80+
run)
81+
set -x; exec "$goBin" "$@"
82+
;;
83+
84+
*)
85+
echo >&2 'error: unknown command:' "$cmd"
86+
usage >&2
87+
exit 1
88+
;;
89+
esac

1.4/onbuild/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.4rc1
2+
3+
RUN mkdir -p /go/src/app
4+
WORKDIR /go/src/app
5+
6+
# this will ideally be built by the ONBUILD below ;)
7+
CMD ["go-wrapper", "run"]
8+
9+
ONBUILD COPY . /go/src/app
10+
ONBUILD RUN go-wrapper download
11+
ONBUILD RUN go-wrapper install

1.4/wheezy/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:wheezy
2+
3+
# SCMs for "go get", gcc for cgo
4+
RUN apt-get update && apt-get install -y \
5+
ca-certificates curl gcc libc6-dev make \
6+
bzr git mercurial \
7+
--no-install-recommends \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
ENV GOLANG_VERSION 1.4rc1
11+
12+
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
13+
| tar -v -C /usr/src -xz
14+
15+
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
16+
17+
ENV PATH /usr/src/go/bin:$PATH
18+
19+
RUN mkdir -p /go/src
20+
ENV GOPATH /go
21+
ENV PATH /go/bin:$PATH
22+
WORKDIR /go
23+
24+
COPY go-wrapper /usr/local/bin/

1.4/wheezy/go-wrapper

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
set -e
3+
4+
usage() {
5+
base="$(basename "$0")"
6+
cat <<EOUSAGE
7+
8+
usage: $base command [args]
9+
10+
This script assumes that is is run from the root of your Go package (for
11+
example, "/go/src/app" if your GOPATH is set to "/go").
12+
13+
The main feature of this wrapper over the native "go" tool is that it supports
14+
the addition of a ".godir" file in your package directory which is a plain text
15+
file that is the import path your application expects (ie, it would be something
16+
like "github.com/jsmith/my-cool-app"). If this file is found, the current
17+
package is then symlinked to /go/src/<.gopath> and the commands then use that
18+
full import path to act on it. This allows for applications to be universally
19+
cloned into a path like "/go/src/app" and then automatically built properly so
20+
that inter-package imports use the existing source instead of downloading it a
21+
second time. This also makes the final binary have the correct name (ie,
22+
instead of being "/go/bin/app", it can be "/go/bin/my-cool-app"), which is why
23+
the "run" command exists here.
24+
25+
Available Commands:
26+
27+
$base download
28+
$base download -u
29+
(equivalent to "go get -d [args] [godir]")
30+
31+
$base install
32+
$base install -race
33+
(equivalent to "go install [args] [godir]")
34+
35+
$base run
36+
$base run -app -specific -arguments
37+
(assumes "GOPATH/bin" is in "PATH")
38+
39+
EOUSAGE
40+
}
41+
42+
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
43+
cmd="$1"
44+
if ! shift; then
45+
usage >&2
46+
exit 1
47+
fi
48+
49+
dir="$(pwd -P)"
50+
goBin="$(basename "$dir")" # likely "app"
51+
52+
goDir=
53+
if [ -f .godir ]; then
54+
goDir="$(cat .godir)"
55+
goPath="${GOPATH%%:*}" # this just grabs the first path listed in GOPATH, if there are multiple (which is the detection logic "go get" itself uses, too)
56+
goDirPath="$goPath/src/$goDir"
57+
mkdir -p "$(dirname "$goDirPath")"
58+
if [ ! -e "$goDirPath" ]; then
59+
ln -sfv "$dir" "$goDirPath"
60+
elif [ ! -L "$goDirPath" ]; then
61+
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
62+
exit 1
63+
fi
64+
goBin="$goPath/bin/$(basename "$goDir")"
65+
fi
66+
67+
case "$cmd" in
68+
download)
69+
execCommand=( go get -v -d "$@" )
70+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
71+
set -x; exec "${execCommand[@]}"
72+
;;
73+
74+
install)
75+
execCommand=( go install -v "$@" )
76+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
77+
set -x; exec "${execCommand[@]}"
78+
;;
79+
80+
run)
81+
set -x; exec "$goBin" "$@"
82+
;;
83+
84+
*)
85+
echo >&2 'error: unknown command:' "$cmd"
86+
usage >&2
87+
exit 1
88+
;;
89+
esac

generate-stackbrew-library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ echo '# maintainer: Johan Euphrosine <[email protected]> (@proppy)'
1818
for version in "${versions[@]}"; do
1919
commit="$(git log -1 --format='format:%H' -- "$version")"
2020
fullVersion="$(grep -m1 'ENV GOLANG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
21-
[[ "$fullVersion" == *.*.* ]] || fullVersion+='.0'
21+
[[ "$fullVersion" == *.*[^0-9]* ]] || fullVersion+='.0'
2222
versionAliases=( $fullVersion $version ${aliases[$version]} )
2323

2424
echo

update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ versions=( "${versions[@]%/}" )
1212
for version in "${versions[@]}"; do
1313
fullVersion="$(curl -sSL 'https://golang.org/dl' | grep '">go'"$version"'.*\.src.tar.gz<' | sed -r 's!.*go([^"/<]+)\.src\.tar\.gz.*!\1!' | sort -V | tail -1)"
1414
versionTag="$fullVersion"
15-
[[ "$versionTag" == *.*.* ]] || versionTag+='.0'
15+
[[ "$versionTag" == *.*[^0-9]* ]] || versionTag+='.0'
1616
(
1717
set -x
1818
sed -ri 's/^(ENV GOLANG_VERSION) .*/\1 '"$fullVersion"'/' "$version/Dockerfile"

0 commit comments

Comments
 (0)