Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golang to 1.11.0 #37358

Merged
merged 7 commits into from Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions Dockerfile
Expand Up @@ -24,10 +24,7 @@
# the case. Therefore, you don't have to disable it anymore.
#

FROM golang:1.10.4 AS base
# FIXME(vdemeester) this is kept for other script depending on it to not fail right away
# Remove this once the other scripts uses something else to detect the version
ENV GO_VERSION 1.10.4
FROM golang:1.11.0 AS base
# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.e2e
@@ -1,5 +1,5 @@
## Step 1: Build tests
FROM golang:1.10.4-alpine3.7 as builder
FROM golang:1.11.0-alpine3.7 as builder

RUN apk add --update \
bash \
Expand Down
14 changes: 1 addition & 13 deletions Dockerfile.simple
Expand Up @@ -5,7 +5,7 @@

# This represents the bare minimum required to build and test Docker.

FROM debian:stretch
FROM golang:1.11.0-stretch

# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
Expand Down Expand Up @@ -37,18 +37,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
vim-common \
&& rm -rf /var/lib/apt/lists/*

# Install Go
# IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
# will need updating, to avoid errors. Ping #docker-maintainers on IRC
# with a heads-up.
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.10.4
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
| tar -xzC /usr/local
ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
ENV CGO_LDFLAGS -L/lib

# Install runc, containerd, tini and docker-proxy
# Please edit hack/dockerfile/install/<name>.installer to update them.
COPY hack/dockerfile/install hack/dockerfile/install
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.windows
Expand Up @@ -161,7 +161,7 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
# - FROM_DOCKERFILE is used for detection of building within a container.
ENV GO_VERSION=1.10.4 `
ENV GO_VERSION=1.11 `
GIT_VERSION=2.11.1 `
GOPATH=C:\go `
FROM_DOCKERFILE=1
Expand Down
4 changes: 2 additions & 2 deletions api/types/strslice/strslice_test.go
Expand Up @@ -29,8 +29,8 @@ func TestStrSliceMarshalJSON(t *testing.T) {

func TestStrSliceUnmarshalJSON(t *testing.T) {
parts := map[string][]string{
"": {"default", "values"},
"[]": {},
"": {"default", "values"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a workaround, we can add a blank line between the short and long keys to make it work for both 1.10 and 1.11 (see containerd/containerd#2436) but it's really a workaround

I opened a ticket upstream for the gofmt change; golang/go#26228

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this was marked as a "won't fix", "documentation only" change golang/go#26228 (comment), so if we want to support multiple versions of Go, we need to make some changes to CI and/or the contributing guide;

This change was done on purpose in golang/go@542ea5a.
As to why gofmt changes every release - see @griesemer's comment in golang/go#25161 (comment).
However, I agree that this change should be documented in the release notes. I can't see it in https://tip.golang.org/doc/go1.11.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks better (in most cases), thanks for suggestion!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussing possible enhancements on the ticket upstream to ease migrating between Go versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases, if I remember correctly, once rebasing to a newer Go version we are losing compatibility with older ones either directly (i.e. some code in moby/moby starts using some feature from the new Go version) or indirectly (i.e. some code in vendored or otherwise used packages relies on a feature from the new Go version). I am about 84% sure current moby can't be compiled with Go 1.9, for example.

Therefore, chances are slim we'll be supporting Go 1.10 when Go 1.11 will become the current stable version of Go. Having said that, I am all for maintaining compatibility with older versions unless it requires some tremendous efforts.

"[]": {},
`["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"},
}
for json, expectedParts := range parts {
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon.go
Expand Up @@ -788,7 +788,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S

for operatingSystem, gd := range d.graphDrivers {
layerStores[operatingSystem], err = layer.NewStoreFromOptions(layer.StoreOptions{
Root: config.Root,
Root: config.Root,
MetadataStorePathTemplate: filepath.Join(config.Root, "image", "%s", "layerdb"),
GraphDriver: gd,
GraphDriverOptions: config.GraphOptions,
Expand Down
2 changes: 1 addition & 1 deletion daemon/logger/gelf/gelf_test.go
Expand Up @@ -156,7 +156,7 @@ func TestNewGELFTCPWriter(t *testing.T) {
"gelf-address": url,
"gelf-tcp-max-reconnect": "0",
"gelf-tcp-reconnect-delay": "0",
"tag": "{{.ID}}",
"tag": "{{.ID}}",
},
ContainerID: "12345678901234567890",
}
Expand Down
14 changes: 7 additions & 7 deletions daemon/logger/splunk/splunk_test.go
Expand Up @@ -30,10 +30,10 @@ func TestValidateLogOpt(t *testing.T) {
splunkVerifyConnectionKey: "true",
splunkGzipCompressionKey: "true",
splunkGzipCompressionLevelKey: "1",
envKey: "a",
envRegexKey: "^foo",
labelsKey: "b",
tagKey: "c",
envKey: "a",
envRegexKey: "^foo",
labelsKey: "b",
tagKey: "c",
})
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -251,9 +251,9 @@ func TestInlineFormatWithNonDefaultOptions(t *testing.T) {
splunkIndexKey: "myindex",
splunkFormatKey: splunkFormatInline,
splunkGzipCompressionKey: "true",
tagKey: "{{.ImageName}}/{{.Name}}",
labelsKey: "a",
envRegexKey: "^foo",
tagKey: "{{.ImageName}}/{{.Name}}",
labelsKey: "a",
envRegexKey: "^foo",
},
ContainerID: "containeriid",
ContainerName: "/container_name",
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerfile/install/vndr.installer
@@ -1,6 +1,6 @@
#!/bin/sh

VNDR_COMMIT=a6e196d8b4b0cbbdc29aebdb20c59ac6926bb384
VNDR_COMMIT=81cb8916aad3c8d06193f008dba3e16f82851f52

install_vndr() {
echo "Install vndr version $VNDR_COMMIT"
Expand Down
2 changes: 1 addition & 1 deletion hack/make.ps1
Expand Up @@ -130,7 +130,7 @@ Function Check-InContainer() {
# outside of a container where it may be out of date with master.
Function Verify-GoVersion() {
Try {
$goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^FROM golang:").ToString().Split(" ")[1].SubString(7)
$goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^FROM golang:").ToString().Split(" ")[1].SubString(7) -replace '\.0$',''
$goVersionInstalled=(go version).ToString().Split(" ")[2].SubString(2)
}
Catch [Exception] {
Expand Down
6 changes: 1 addition & 5 deletions hack/validate/vendor
Expand Up @@ -9,11 +9,7 @@ validate_vendor_diff(){
unset IFS

if [ ${#files[@]} -gt 0 ]; then
# Remove vendor/ first so that anything not included in vendor.conf will
# cause the validation to fail. archive/tar is a special case, see vendor.conf
# for details.
ls -d vendor/* | grep -v vendor/archive | xargs rm -rf
# run vndr to recreate vendor/
# recreate vendor/
vndr
# check if any files have changed
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_build_test.go
Expand Up @@ -656,7 +656,7 @@ func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
"file2.txt": "test2",
"dir/nested_file": "nested file",
"dir/nested_dir/nest_nest_file": "2 times nested",
"dirt": "dirty",
"dirt": "dirty",
}))
defer ctx.Close()

Expand Down
24 changes: 12 additions & 12 deletions integration/build/build_test.go
Expand Up @@ -37,53 +37,53 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
RUN exit 0
RUN exit 0`,
numberOfIntermediateContainers: 2,
rm: false,
forceRm: false,
rm: false,
forceRm: false,
},
{
name: "successful build with remove",
dockerfile: `FROM busybox
RUN exit 0
RUN exit 0`,
numberOfIntermediateContainers: 0,
rm: true,
forceRm: false,
rm: true,
forceRm: false,
},
{
name: "successful build with remove and force remove",
dockerfile: `FROM busybox
RUN exit 0
RUN exit 0`,
numberOfIntermediateContainers: 0,
rm: true,
forceRm: true,
rm: true,
forceRm: true,
},
{
name: "failed build with no removal",
dockerfile: `FROM busybox
RUN exit 0
RUN exit 1`,
numberOfIntermediateContainers: 2,
rm: false,
forceRm: false,
rm: false,
forceRm: false,
},
{
name: "failed build with remove",
dockerfile: `FROM busybox
RUN exit 0
RUN exit 1`,
numberOfIntermediateContainers: 1,
rm: true,
forceRm: false,
rm: true,
forceRm: false,
},
{
name: "failed build with remove and force remove",
dockerfile: `FROM busybox
RUN exit 0
RUN exit 1`,
numberOfIntermediateContainers: 0,
rm: true,
forceRm: true,
rm: true,
forceRm: true,
},
}

Expand Down
16 changes: 8 additions & 8 deletions libcontainerd/client_local_windows.go
Expand Up @@ -168,9 +168,9 @@ func (c *client) Create(_ context.Context, id string, spec *specs.Spec, runtimeO
func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) error {
logger := c.logger.WithField("container", id)
configuration := &hcsshim.ContainerConfig{
SystemType: "Container",
Name: id,
Owner: defaultOwner,
SystemType: "Container",
Name: id,
Owner: defaultOwner,
IgnoreFlushesDuringBoot: spec.Windows.IgnoreFlushesDuringBoot,
HostName: spec.Hostname,
HvPartition: false,
Expand Down Expand Up @@ -377,11 +377,11 @@ func (c *client) createLinux(id string, spec *specs.Spec, runtimeOptions interfa
}

configuration := &hcsshim.ContainerConfig{
HvPartition: true,
Name: id,
SystemType: "container",
ContainerType: "linux",
Owner: defaultOwner,
HvPartition: true,
Name: id,
SystemType: "container",
ContainerType: "linux",
Owner: defaultOwner,
TerminateOnLastHandleClosed: true,
}

Expand Down
4 changes: 2 additions & 2 deletions migrate/v1/migratev1_test.go
Expand Up @@ -40,9 +40,9 @@ func TestMigrateRefs(t *testing.T) {
}

expected := map[string]string{
"docker.io/library/busybox:latest": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
"docker.io/library/busybox:latest": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
"docker.io/library/busybox@sha256:16a2a52884c2a9481ed267c2d46483eac7693b813a63132368ab098a71303f8a": "sha256:fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9",
"docker.io/library/registry:2": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae",
"docker.io/library/registry:2": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae",
}

if !reflect.DeepEqual(expected, ta.refs) {
Expand Down
24 changes: 12 additions & 12 deletions opts/hosts_test.go
Expand Up @@ -69,18 +69,18 @@ func TestParseDockerDaemonHost(t *testing.T) {
"[::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]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path",
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
"tcp://": DefaultTCPHost,
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
"unix:///run/docker.sock": "unix:///run/docker.sock",
"unix://": "unix://" + DefaultUnixSocket,
"fd://": "fd://",
"fd://something": "fd://something",
"localhost:": "tcp://localhost:2375",
"localhost:5555": "tcp://localhost:5555",
"localhost:5555/path": "tcp://localhost:5555/path",
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
"tcp://": DefaultTCPHost,
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
"unix:///run/docker.sock": "unix:///run/docker.sock",
"unix://": "unix://" + DefaultUnixSocket,
"fd://": "fd://",
"fd://something": "fd://something",
"localhost:": "tcp://localhost:2375",
"localhost:5555": "tcp://localhost:5555",
"localhost:5555/path": "tcp://localhost:5555/path",
}
for invalidAddr, expectedError := range invalids {
if addr, err := parseDaemonHost(invalidAddr); err == nil || err.Error() != expectedError {
Expand Down
2 changes: 1 addition & 1 deletion pkg/authorization/api_test.go
Expand Up @@ -17,7 +17,7 @@ import (

func TestPeerCertificateMarshalJSON(t *testing.T) {
template := &x509.Certificate{
IsCA: true,
IsCA: true,
BasicConstraintsValid: true,
SubjectKeyId: []byte{1, 2, 3},
SerialNumber: big.NewInt(1234),
Expand Down
2 changes: 1 addition & 1 deletion pkg/authorization/authz_unix_test.go
Expand Up @@ -144,7 +144,7 @@ func TestDrainBody(t *testing.T) {
length int // length is the message length send to drainBody
expectedBodyLength int // expectedBodyLength is the expected body length after drainBody is called
}{
{10, 10}, // Small message size
{10, 10}, // Small message size
{maxBodySize - 1, maxBodySize - 1}, // Max message size
{maxBodySize * 2, 0}, // Large message size (skip copying body)

Expand Down
10 changes: 5 additions & 5 deletions reference/store_test.go
Expand Up @@ -16,11 +16,11 @@ import (

var (
saveLoadTestCases = map[string]digest.Digest{
"registry:5000/foobar:HEAD": "sha256:470022b8af682154f57a2163d030eb369549549cba00edc69e1b99b46bb924d6",
"registry:5000/foobar:alternate": "sha256:ae300ebc4a4f00693702cfb0a5e0b7bc527b353828dc86ad09fb95c8a681b793",
"registry:5000/foobar:latest": "sha256:6153498b9ac00968d71b66cca4eac37e990b5f9eb50c26877eb8799c8847451b",
"registry:5000/foobar:master": "sha256:6c9917af4c4e05001b346421959d7ea81b6dc9d25718466a37a6add865dfd7fc",
"jess/hollywood:latest": "sha256:ae7a5519a0a55a2d4ef20ddcbd5d0ca0888a1f7ab806acc8e2a27baf46f529fe",
"registry:5000/foobar:HEAD": "sha256:470022b8af682154f57a2163d030eb369549549cba00edc69e1b99b46bb924d6",
"registry:5000/foobar:alternate": "sha256:ae300ebc4a4f00693702cfb0a5e0b7bc527b353828dc86ad09fb95c8a681b793",
"registry:5000/foobar:latest": "sha256:6153498b9ac00968d71b66cca4eac37e990b5f9eb50c26877eb8799c8847451b",
"registry:5000/foobar:master": "sha256:6c9917af4c4e05001b346421959d7ea81b6dc9d25718466a37a6add865dfd7fc",
"jess/hollywood:latest": "sha256:ae7a5519a0a55a2d4ef20ddcbd5d0ca0888a1f7ab806acc8e2a27baf46f529fe",
"registry@sha256:367eb40fd0330a7e464777121e39d2f5b3e8e23a1e159342e53ab05c9e4d94e6": "sha256:24126a56805beb9711be5f4590cc2eb55ab8d4a85ebd618eed72bb19fc50631c",
"busybox:latest": "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
}
Expand Down
4 changes: 2 additions & 2 deletions registry/service_v2.go
Expand Up @@ -57,7 +57,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
Scheme: "https",
Host: hostname,
},
Version: APIVersion2,
Version: APIVersion2,
AllowNondistributableArtifacts: ana,
TrimHostname: true,
TLSConfig: tlsConfig,
Expand All @@ -70,7 +70,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
Scheme: "http",
Host: hostname,
},
Version: APIVersion2,
Version: APIVersion2,
AllowNondistributableArtifacts: ana,
TrimHostname: true,
// used to check if supposed to be secure via InsecureSkipVerify
Expand Down
16 changes: 8 additions & 8 deletions runconfig/hostconfig_test.go
Expand Up @@ -22,20 +22,20 @@ func TestNetworkModeTest(t *testing.T) {
"something:weird": {true, false, false, false, false, false},
"bridge": {true, true, false, false, false, false},
DefaultDaemonNetworkMode(): {true, true, false, false, false, false},
"host": {false, false, true, false, false, false},
"container:name": {false, false, false, true, false, false},
"none": {true, false, false, false, true, false},
"default": {true, false, false, false, false, true},
"host": {false, false, true, false, false, false},
"container:name": {false, false, false, true, false, false},
"none": {true, false, false, false, true, false},
"default": {true, false, false, false, false, true},
}
networkModeNames := map[container.NetworkMode]string{
"": "",
"something:weird": "something:weird",
"bridge": "bridge",
DefaultDaemonNetworkMode(): "bridge",
"host": "host",
"container:name": "container",
"none": "none",
"default": "default",
"host": "host",
"container:name": "container",
"none": "none",
"default": "default",
}
for networkMode, state := range networkModes {
if networkMode.IsPrivate() != state[0] {
Expand Down