Skip to content

Commit 7319ccc

Browse files
committed
Add 1.8beta1
1 parent 4fd5df8 commit 7319ccc

File tree

11 files changed

+543
-0
lines changed

11 files changed

+543
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: bash
22
services: docker
33

44
env:
5+
- VERSION=1.8 VARIANT=
6+
- VERSION=1.8 VARIANT=wheezy
7+
- VERSION=1.8 VARIANT=alpine
58
- VERSION=1.7 VARIANT=
69
- VERSION=1.7 VARIANT=wheezy
710
- VERSION=1.7 VARIANT=alpine

1.8/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM buildpack-deps:jessie-scm
2+
3+
# gcc for cgo
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
gcc \
7+
libc6-dev \
8+
make \
9+
pkg-config \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
ENV GOLANG_VERSION 1.8beta1
13+
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
14+
ENV GOLANG_DOWNLOAD_SHA256 768d8d73ccea69c9a0941f9ef2333b1ff8c82120abfcdedd4e91af039c674a8d
15+
16+
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
17+
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
18+
&& tar -C /usr/local -xzf golang.tar.gz \
19+
&& rm golang.tar.gz
20+
21+
ENV GOPATH /go
22+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
23+
24+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
25+
WORKDIR $GOPATH
26+
27+
COPY go-wrapper /usr/local/bin/

1.8/alpine/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM alpine:3.4
2+
3+
RUN apk add --no-cache ca-certificates
4+
5+
ENV GOLANG_VERSION 1.8beta1
6+
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
7+
ENV GOLANG_SRC_SHA256 7204232743f85a2ebb31dbbb8ea0d792eeb89357bb2ff0ef3ed62e192fdd60e4
8+
9+
# https://golang.org/issue/14851
10+
COPY no-pic.patch /
11+
12+
RUN set -ex \
13+
&& apk add --no-cache --virtual .build-deps \
14+
bash \
15+
gcc \
16+
musl-dev \
17+
openssl \
18+
go \
19+
\
20+
&& export GOROOT_BOOTSTRAP="$(go env GOROOT)" \
21+
\
22+
&& wget -q "$GOLANG_SRC_URL" -O golang.tar.gz \
23+
&& echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c - \
24+
&& tar -C /usr/local -xzf golang.tar.gz \
25+
&& rm golang.tar.gz \
26+
&& cd /usr/local/go/src \
27+
&& patch -p2 -i /no-pic.patch \
28+
&& ./make.bash \
29+
\
30+
&& rm -rf /*.patch \
31+
&& apk del .build-deps
32+
33+
ENV GOPATH /go
34+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
35+
36+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
37+
WORKDIR $GOPATH
38+
39+
COPY go-wrapper /usr/local/bin/

1.8/alpine/go-wrapper

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/sh
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+
In Go 1.4, a feature was introduced to supply the canonical "import path" for a
14+
given package in a comment attached to a package statement
15+
(https://golang.org/s/go14customimport).
16+
17+
This script allows us to take a generic directory of Go source files such as
18+
"/go/src/app" and determine that the canonical "import path" of where that code
19+
expects to live and reference itself is "github.com/jsmith/my-cool-app". It
20+
will then ensure that "/go/src/github.com/jsmith/my-cool-app" is a symlink to
21+
"/go/src/app", which allows us to build and run it under the proper package
22+
name.
23+
24+
For compatibility with versions of Go older than 1.4, the "import path" may also
25+
be placed in a file named ".godir".
26+
27+
Available Commands:
28+
29+
$base download
30+
$base download -u
31+
(equivalent to "go get -d [args] [godir]")
32+
33+
$base install
34+
$base install -race
35+
(equivalent to "go install [args] [godir]")
36+
37+
$base run
38+
$base run -app -specific -arguments
39+
(assumes "GOPATH/bin" is in "PATH")
40+
41+
EOUSAGE
42+
}
43+
44+
# make sure there is a subcommand specified
45+
if [ "$#" -eq 0 ]; then
46+
usage >&2
47+
exit 1
48+
fi
49+
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
50+
cmd="$1"
51+
shift
52+
53+
goDir="$(go list -e -f '{{.ImportComment}}' 2>/dev/null || true)"
54+
55+
if [ -z "$goDir" -a -s .godir ]; then
56+
goDir="$(cat .godir)"
57+
fi
58+
59+
dir="$(pwd -P)"
60+
if [ "$goDir" ]; then
61+
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)
62+
goDirPath="$goPath/src/$goDir"
63+
mkdir -p "$(dirname "$goDirPath")"
64+
if [ ! -e "$goDirPath" ]; then
65+
ln -sfv "$dir" "$goDirPath"
66+
elif [ ! -L "$goDirPath" ]; then
67+
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
68+
exit 1
69+
fi
70+
goBin="$goPath/bin/$(basename "$goDir")"
71+
else
72+
goBin="$(basename "$dir")" # likely "app"
73+
fi
74+
75+
case "$cmd" in
76+
download)
77+
set -- go get -v -d "$@"
78+
if [ "$goDir" ]; then set -- "$@" "$goDir"; fi
79+
set -x; exec "$@"
80+
;;
81+
82+
install)
83+
set -- go install -v "$@"
84+
if [ "$goDir" ]; then set -- "$@" "$goDir"; fi
85+
set -x; exec "$@"
86+
;;
87+
88+
run)
89+
set -x; exec "$goBin" "$@"
90+
;;
91+
92+
*)
93+
echo >&2 'error: unknown command:' "$cmd"
94+
usage >&2
95+
exit 1
96+
;;
97+
esac

1.8/alpine/no-pic.patch

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
2+
index 14f4fa9..5599307 100644
3+
--- a/src/cmd/link/internal/ld/lib.go
4+
+++ b/src/cmd/link/internal/ld/lib.go
5+
@@ -1272,6 +1272,11 @@ func hostlink() {
6+
argv = append(argv, peimporteddlls()...)
7+
}
8+
9+
+ // The Go linker does not currently support building PIE
10+
+ // executables when using the external linker. See:
11+
+ // https://github.com/golang/go/issues/6940
12+
+ argv = append(argv, "-fno-PIC")
13+
+
14+
if Debug['v'] != 0 {
15+
fmt.Fprintf(Bso, "host link:")
16+
for _, v := range argv {

1.8/go-wrapper

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/sh
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+
In Go 1.4, a feature was introduced to supply the canonical "import path" for a
14+
given package in a comment attached to a package statement
15+
(https://golang.org/s/go14customimport).
16+
17+
This script allows us to take a generic directory of Go source files such as
18+
"/go/src/app" and determine that the canonical "import path" of where that code
19+
expects to live and reference itself is "github.com/jsmith/my-cool-app". It
20+
will then ensure that "/go/src/github.com/jsmith/my-cool-app" is a symlink to
21+
"/go/src/app", which allows us to build and run it under the proper package
22+
name.
23+
24+
For compatibility with versions of Go older than 1.4, the "import path" may also
25+
be placed in a file named ".godir".
26+
27+
Available Commands:
28+
29+
$base download
30+
$base download -u
31+
(equivalent to "go get -d [args] [godir]")
32+
33+
$base install
34+
$base install -race
35+
(equivalent to "go install [args] [godir]")
36+
37+
$base run
38+
$base run -app -specific -arguments
39+
(assumes "GOPATH/bin" is in "PATH")
40+
41+
EOUSAGE
42+
}
43+
44+
# make sure there is a subcommand specified
45+
if [ "$#" -eq 0 ]; then
46+
usage >&2
47+
exit 1
48+
fi
49+
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
50+
cmd="$1"
51+
shift
52+
53+
goDir="$(go list -e -f '{{.ImportComment}}' 2>/dev/null || true)"
54+
55+
if [ -z "$goDir" -a -s .godir ]; then
56+
goDir="$(cat .godir)"
57+
fi
58+
59+
dir="$(pwd -P)"
60+
if [ "$goDir" ]; then
61+
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)
62+
goDirPath="$goPath/src/$goDir"
63+
mkdir -p "$(dirname "$goDirPath")"
64+
if [ ! -e "$goDirPath" ]; then
65+
ln -sfv "$dir" "$goDirPath"
66+
elif [ ! -L "$goDirPath" ]; then
67+
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
68+
exit 1
69+
fi
70+
goBin="$goPath/bin/$(basename "$goDir")"
71+
else
72+
goBin="$(basename "$dir")" # likely "app"
73+
fi
74+
75+
case "$cmd" in
76+
download)
77+
set -- go get -v -d "$@"
78+
if [ "$goDir" ]; then set -- "$@" "$goDir"; fi
79+
set -x; exec "$@"
80+
;;
81+
82+
install)
83+
set -- go install -v "$@"
84+
if [ "$goDir" ]; then set -- "$@" "$goDir"; fi
85+
set -x; exec "$@"
86+
;;
87+
88+
run)
89+
set -x; exec "$goBin" "$@"
90+
;;
91+
92+
*)
93+
echo >&2 'error: unknown command:' "$cmd"
94+
usage >&2
95+
exit 1
96+
;;
97+
esac

1.8/onbuild/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.8
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.8/wheezy/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM buildpack-deps:wheezy-scm
2+
3+
# gcc for cgo
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
gcc \
7+
libc6-dev \
8+
make \
9+
pkg-config \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
ENV GOLANG_VERSION 1.8beta1
13+
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
14+
ENV GOLANG_DOWNLOAD_SHA256 768d8d73ccea69c9a0941f9ef2333b1ff8c82120abfcdedd4e91af039c674a8d
15+
16+
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
17+
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
18+
&& tar -C /usr/local -xzf golang.tar.gz \
19+
&& rm golang.tar.gz
20+
21+
ENV GOPATH /go
22+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
23+
24+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
25+
WORKDIR $GOPATH
26+
27+
COPY go-wrapper /usr/local/bin/

0 commit comments

Comments
 (0)