Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Update to Go 1.13.3 #3712

Merged
merged 6 commits into from
Nov 4, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
defaults: &defaults
docker:
- image: weaveworks/weavebuild:circle20-2e6504d3
- image: weaveworks/weavebuild:go-1-13-1-5110a604
working_directory: /go/src/github.com/weaveworks/weave

jobs:
Expand Down
30 changes: 8 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,11 @@ PUSH_ML=push_ml_weave push_ml_weaveexec push_ml_weave-kube push_ml_weave-npc

WEAVE_EXPORT=weave$(ARCH_EXT).tar.gz

NETGO_CHECK=@strings $@ | grep cgo_stub\\\.go >/dev/null || { \
rm $@; \
echo "\nYour go standard library was built without the 'netgo' build tag."; \
echo "To fix that, run"; \
echo " sudo go clean -i net"; \
echo " sudo go install -tags netgo std"; \
false; \
}
# The flags we are passing to go build. -extldflags -static for making a static binary,
# -linkmode external for linking external C libraries into the binary, -X main.version for telling the
# Go binary which version it is, -tags netgo for enforcing the native Go DNS resolver
BUILD_FLAGS=-i -ldflags "-linkmode external -extldflags -static -X main.version=$(WEAVE_VERSION)" -tags netgo
# -X main.version for telling the Go binary which version it is,
# -s -w drop symbol tables used by debuggers (not Go's internal symbol info)
# -tags "osusergo netgo" to use native Go UID and DNS implementations
BUILD_FLAGS=-ldflags "-extldflags -static -X main.version=$(WEAVE_VERSION) -s -w" -tags "osusergo netgo"

PACKAGE_BASE=$(shell go list -e ./)

Expand Down Expand Up @@ -216,10 +209,8 @@ ifeq ($(BUILD_IN_CONTAINER),true)
# This make target compiles all binaries inside of the weaveworks/build container
# It bind-mounts the source into the container and passes all important variables
exes $(EXES) tests lint: $(BUILD_UPTODATE)
@mkdir -p $(shell pwd)/.pkg
$(SUDO) docker run $(RM) $(RUN_FLAGS) \
-v $(shell pwd):/go/src/github.com/weaveworks/weave \
-v $(shell pwd)/.pkg:/go/pkg \
-e GOARCH=$(ARCH) -e CGO_ENABLED=1 -e GOOS=linux -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW -e DEBUG \
$(BUILD_IMAGE) COVERAGE=$(COVERAGE) WEAVE_VERSION=$(WEAVE_VERSION) CC=$(CC) QEMUARCH=$(QEMUARCH) CGO_LDFLAGS=$(CGO_LDFLAGS) $@
touch $@
Expand All @@ -235,19 +226,15 @@ ifeq ($(COVERAGE),true)
else
go build $(BUILD_FLAGS) -o $@ ./$(@D)
endif
$(NETGO_CHECK)

$(WEAVEUTIL_EXE) $(KUBEUTILS_EXE) $(WEAVENPC_EXE) $(NETWORKTESTER_EXE):
go build $(BUILD_FLAGS) -o $@ ./$(@D)
$(NETGO_CHECK)

$(WEAVEWAIT_EXE):
go build $(BUILD_FLAGS) -tags "netgo iface mcast" -o $@ ./$(@D)
$(NETGO_CHECK)
go build $(BUILD_FLAGS) -tags "osusergo netgo iface mcast" -o $@ ./$(@D)

$(WEAVEWAIT_NOMCAST_EXE):
go build $(BUILD_FLAGS) -tags "netgo iface" -o $@ ./$(@D)
$(NETGO_CHECK)
go build $(BUILD_FLAGS) -tags "osusergo netgo iface" -o $@ ./$(@D)

# These programs need a separate rule as they fail the netgo check in
# the main build stanza due to not importing net package
Expand Down Expand Up @@ -412,15 +399,14 @@ clean-bin:
-$(SUDO) DOCKER_HOST=$(DOCKER_HOST) docker rmi $(IMAGES)
find prog -type f -name "Dockerfile.*" -not -name "Dockerfile.template" -print | xargs rm -f
find prog -type f -name "*qemu-*" -print | xargs rm -f
rm -rf $(EXES) $(IMAGES_UPTODATE) $(WEAVEDB_UPTODATE) weave*.tar.gz .pkg
go clean ./...
rm -rf $(EXES) $(IMAGES_UPTODATE) $(WEAVEDB_UPTODATE) weave*.tar.gz .cache

clean: clean-bin clean-work-dir
-$(SUDO) DOCKER_HOST=$(DOCKER_HOST) docker rmi $(BUILD_IMAGE)
rm -rf test/tls/*.pem test/coverage.* test/coverage $(BUILD_UPTODATE)

build:
$(SUDO) go clean -i net
$(SUDO) go install -tags netgo std
$(MAKE)

run-smoketests: all testrunner
Expand Down
15 changes: 1 addition & 14 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.12.7-buster
FROM golang:1.13.3-buster

# Support Raspberry Pi 2 and newer
ENV GOARM 7
Expand Down Expand Up @@ -57,19 +57,6 @@ RUN go get \
github.com/fatih/hclfmt \
github.com/client9/misspell/cmd/misspell

# First clean, because we're gonna rebuild the std both with -race enabled and disabled
# Running go install std twice is intentional and required, as content is written in two different directories
# (/usr/local/go/pkg/linux_amd64 vs /usr/local/go/pkg/linux_amd64_race)
# The other architectures do not have support for -race
RUN go clean -i net \
&& go install -tags netgo std \
&& go install -race -tags netgo std

# Prebuild std for the other architectures
RUN for platform in ${GO_CROSSPLATFORMS}; do \
GOOS=${platform%/*} GOARCH=${platform##*/} \
go install -tags netgo std; done

# Allow full write access to the Go folders for anyone
RUN chmod -R a+w /usr/local/go

Expand Down