Merge pull request #1709 from thaJeztah/18.09_backport_bump_golang_1.11

[18.09 backport] bump Golang 1.11.11, and some makefile improvements
This commit is contained in:
Kirill Kolyshkin 2019-07-23 15:21:43 -07:00 committed by GitHub
commit 5f4a501c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 36 additions and 22 deletions

View File

@ -21,6 +21,10 @@ test: test-unit ## run tests
test-coverage: ## run test coverage test-coverage: ## run test coverage
./scripts/test/unit-with-coverage $(shell go list ./... | grep -vE '/vendor/|/e2e/') ./scripts/test/unit-with-coverage $(shell go list ./... | grep -vE '/vendor/|/e2e/')
.PHONY: fmt
fmt:
go list -f {{.Dir}} ./... | xargs gofmt -w -s -d
.PHONY: lint .PHONY: lint
lint: ## run all the lint tools lint: ## run all the lint tools
gometalinter --config gometalinter.json ./... gometalinter --config gometalinter.json ./...

View File

@ -4,7 +4,7 @@ clone_folder: c:\gopath\src\github.com\docker\cli
environment: environment:
GOPATH: c:\gopath GOPATH: c:\gopath
GOVERSION: 1.10.8 GOVERSION: 1.11.11
DEPVERSION: v0.4.1 DEPVERSION: v0.4.1
install: install:

View File

@ -71,14 +71,14 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) {
}{ }{
// Image not changed // Image not changed
{ {
image: "foobar:1.2.3", image: "foobar:1.2.3",
expectedQueryRegistry: false, expectedQueryRegistry: false,
expectedImage: "foobar:1.2.3@sha256:deadbeef", expectedImage: "foobar:1.2.3@sha256:deadbeef",
expectedForceUpdate: 123, expectedForceUpdate: 123,
}, },
// Image changed // Image changed
{ {
image: "foobar:1.2.4", image: "foobar:1.2.4",
expectedQueryRegistry: true, expectedQueryRegistry: true,
expectedImage: "foobar:1.2.4", expectedImage: "foobar:1.2.4",
expectedForceUpdate: 123, expectedForceUpdate: 123,

View File

@ -231,7 +231,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
repoEndpoint := repositoryEndpoint{endpoint: endpoint, info: repoInfo} repoEndpoint := repositoryEndpoint{endpoint: endpoint, info: repoInfo}
repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint) repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint)
if err != nil { if err != nil {
logrus.Debugf("error with repo endpoint %s: %s", repoEndpoint, err) logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint)
if _, ok := err.(ErrHTTPProto); ok { if _, ok := err.(ErrHTTPProto); ok {
continue continue
} }

View File

@ -10,7 +10,12 @@ LINTER_IMAGE_NAME = docker-cli-lint$(IMAGE_TAG)
CROSS_IMAGE_NAME = docker-cli-cross$(IMAGE_TAG) CROSS_IMAGE_NAME = docker-cli-cross$(IMAGE_TAG)
VALIDATE_IMAGE_NAME = docker-cli-shell-validate$(IMAGE_TAG) VALIDATE_IMAGE_NAME = docker-cli-shell-validate$(IMAGE_TAG)
E2E_IMAGE_NAME = docker-cli-e2e$(IMAGE_TAG) E2E_IMAGE_NAME = docker-cli-e2e$(IMAGE_TAG)
GO_BUILD_CACHE ?= y
MOUNTS = -v "$(CURDIR)":/go/src/github.com/docker/cli MOUNTS = -v "$(CURDIR)":/go/src/github.com/docker/cli
CACHE_VOLUME_NAME := docker-cli-dev-cache
ifeq ($(GO_BUILD_CACHE),y)
MOUNTS += -v "$(CACHE_VOLUME_NAME):/root/.cache/go-build"
endif
VERSION = $(shell cat VERSION) VERSION = $(shell cat VERSION)
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT -e PLATFORM ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT -e PLATFORM
@ -54,6 +59,7 @@ build: binary ## alias for binary
.PHONY: clean .PHONY: clean
clean: build_docker_image ## clean build artifacts clean: build_docker_image ## clean build artifacts
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
docker volume rm -f $(CACHE_VOLUME_NAME)
.PHONY: test-unit .PHONY: test-unit
test-unit: build_docker_image # run unit tests (using go test) test-unit: build_docker_image # run unit tests (using go test)
@ -86,6 +92,10 @@ shell: dev ## alias for dev
lint: build_linter_image ## run linters lint: build_linter_image ## run linters
docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME) docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME)
.PHONY: fmt
fmt:
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make fmt
.PHONY: vendor .PHONY: vendor
vendor: build_docker_image vendor.conf ## download dependencies (vendor/) listed in vendor.conf vendor: build_docker_image vendor.conf ## download dependencies (vendor/) listed in vendor.conf
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor

View File

@ -1,4 +1,4 @@
FROM golang:1.10.8-alpine FROM golang:1.11.11-alpine
RUN apk add -U git bash coreutils gcc musl-dev RUN apk add -U git bash coreutils gcc musl-dev

View File

@ -1,4 +1,4 @@
FROM dockercore/golang-cross:1.10.8@sha256:a93210f55a8137b4aa4b9f033ac7a80b66ab6337e98e7afb62abe93b4ad73cad FROM dockercore/golang-cross:1.11.11
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1 ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
WORKDIR /go/src/github.com/docker/cli WORKDIR /go/src/github.com/docker/cli
COPY . . COPY . .

View File

@ -1,5 +1,4 @@
FROM golang:1.11.11-alpine
FROM golang:1.10.8-alpine
RUN apk add -U git make bash coreutils ca-certificates curl RUN apk add -U git make bash coreutils ca-certificates curl

View File

@ -1,4 +1,4 @@
ARG GO_VERSION=1.10.8 ARG GO_VERSION=1.11.11
FROM docker/containerd-shim-process:a4d1531 AS containerd-shim-process FROM docker/containerd-shim-process:a4d1531 AS containerd-shim-process

View File

@ -1,4 +1,4 @@
FROM golang:1.10.8-alpine FROM golang:1.11.11-alpine
RUN apk add -U git RUN apk add -U git

View File

@ -69,18 +69,18 @@ func TestParseDockerDaemonHost(t *testing.T) {
"[::1]:5555/path": "tcp://[::1]:5555/path", "[::1]:5555/path": "tcp://[::1]:5555/path",
"[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375", "[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375",
"[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path", "[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path",
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost), ":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost), ":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
"tcp://": DefaultTCPHost, "tcp://": DefaultTCPHost,
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost), "tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost), "tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
"unix:///run/docker.sock": "unix:///run/docker.sock", "unix:///run/docker.sock": "unix:///run/docker.sock",
"unix://": "unix://" + DefaultUnixSocket, "unix://": "unix://" + DefaultUnixSocket,
"fd://": "fd://", "fd://": "fd://",
"fd://something": "fd://something", "fd://something": "fd://something",
"localhost:": "tcp://localhost:2375", "localhost:": "tcp://localhost:2375",
"localhost:5555": "tcp://localhost:5555", "localhost:5555": "tcp://localhost:5555",
"localhost:5555/path": "tcp://localhost:5555/path", "localhost:5555/path": "tcp://localhost:5555/path",
} }
for invalidAddr, expectedError := range invalids { for invalidAddr, expectedError := range invalids {
if addr, err := parseDockerDaemonHost(invalidAddr); err == nil || err.Error() != expectedError { if addr, err := parseDockerDaemonHost(invalidAddr); err == nil || err.Error() != expectedError {

View File

@ -11,6 +11,7 @@ export CGO_ENABLED=1
export GOOS=darwin export GOOS=darwin
export GOARCH=amd64 export GOARCH=amd64
export CC=o64-clang export CC=o64-clang
export CXX=o64-clang++
export LDFLAGS="$LDFLAGS -linkmode external -s" export LDFLAGS="$LDFLAGS -linkmode external -s"
export LDFLAGS_STATIC_DOCKER='-extld='${CC} export LDFLAGS_STATIC_DOCKER='-extld='${CC}