Merge pull request #1084 from riyazdf/go-compile-lint

Merge lint.sh into compile.sh, remove unused alpine-build-go
This commit is contained in:
Justin Cormack 2017-01-23 21:34:56 +00:00 committed by GitHub
commit d4416e1b93
12 changed files with 23 additions and 80 deletions

View File

@ -1,8 +0,0 @@
FROM golang:1.7-alpine3.5
RUN apk update && apk add --no-cache build-base git
# Get linting tools
RUN go get -u github.com/golang/lint/golint
# Get the linting script and place in PATH
COPY lint.sh /usr/bin/lint.sh

View File

@ -1,29 +0,0 @@
.PHONY: tag push
BASE=golang:1.7-alpine3.5
IMAGE=alpine-build-go
default: push
hash: Dockerfile lint.sh
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint | sha1sum' | sed 's/ .*//' > hash
push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash
.DELETE_ON_ERROR:

View File

@ -1,16 +0,0 @@
#!/bin/sh
set -e
cd $1
>&2 echo "gofmt..."
test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "govet..."
test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "golint..."
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
>&2 echo "Successful lint check!"

View File

@ -3,8 +3,8 @@ QEMU_IMAGE=mobylinux/qemu-user-static@sha256:6c022f700dc6c263c9107c08aa29b4eae3b
QEMU_FILES=qemu-arm qemu-aarch64 qemu-ppc64le QEMU_FILES=qemu-arm qemu-aarch64 qemu-ppc64le
QEMU_BINARIES=$(addprefix usr/bin/,$(QEMU_FILES)) QEMU_BINARIES=$(addprefix usr/bin/,$(QEMU_FILES))
# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f # Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c
GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24
BINFMT_BINARY=usr/bin/binfmt BINFMT_BINARY=usr/bin/binfmt
# Tag: alpine:3.5 # Tag: alpine:3.5

View File

@ -3,6 +3,6 @@ RUN apk update && apk add --no-cache build-base git
RUN go get -u github.com/golang/lint/golint RUN go get -u github.com/golang/lint/golint
COPY lint.sh compile.sh /usr/bin/ COPY compile.sh /usr/bin/
ENTRYPOINT ["/usr/bin/compile.sh"] ENTRYPOINT ["/usr/bin/compile.sh"]

View File

@ -5,10 +5,10 @@ IMAGE=go-compile
default: push default: push
hash: Dockerfile lint.sh compile.sh hash: Dockerfile compile.sh
DOCKER_CONTENT_TRUST=1 docker pull $(BASE) DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build - tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint /usr/bin/compile.sh | sha1sum' | sed 's/ .*//' > hash docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /go/bin/golint /usr/bin/compile.sh | sha1sum' | sed 's/ .*//' > hash
push: hash push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ docker pull mobylinux/$(IMAGE):$(shell cat hash) || \

View File

@ -42,7 +42,17 @@ mkdir -p $dir
# untar input # untar input
tar xf - -C $dir tar xf - -C $dir
/usr/bin/lint.sh $dir cd $dir
# lint before building
>&2 echo "gofmt..."
test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "govet..."
test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "golint..."
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
>&2 echo "go build..." >&2 echo "go build..."

View File

@ -1,14 +0,0 @@
#!/bin/sh
set -e
cd $1
>&2 echo "gofmt..."
test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "govet..."
test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr)
>&2 echo "golint..."
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)

View File

@ -1,5 +1,5 @@
# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f # Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c
GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24
default: usr/bin/diagnostics-server default: usr/bin/diagnostics-server

View File

@ -1,5 +1,5 @@
# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f # Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c
GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24
all: usr/bin/slirp-proxy sbin/proxy-vsockd all: usr/bin/slirp-proxy sbin/proxy-vsockd

View File

@ -1,5 +1,5 @@
# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f # Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c
GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24
default: sbin/vsudd default: sbin/vsudd

View File

@ -5,10 +5,10 @@ generally with tags based on the image contents.
- `mobylinux/alpine-base` the base packages for Moby, before we add Docker and our code and config - `mobylinux/alpine-base` the base packages for Moby, before we add Docker and our code and config
- `mobylinux/alpine-build-c` for building C code - `mobylinux/alpine-build-c` for building C code
- `mobylinux/alpine-build-go` for building Go code
- `mobylinux/alpine-bios` for building BIOS image - `mobylinux/alpine-bios` for building BIOS image
- `mobylinux/alpine-efi` for building efi images - `mobylinux/alpine-efi` for building efi images
- `mobylinux/alpine-qemu` for Qemu eg for the tests - `mobylinux/alpine-qemu` for Qemu eg for the tests
- `mobylinux/go-compile` for building Go code
The `Dockerfile`s for these are under `alpine/base`. To update, modify the `Dockerfile` if you wish The `Dockerfile`s for these are under `alpine/base`. To update, modify the `Dockerfile` if you wish