diff --git a/.circleci/config.yml b/.circleci/config.yml index fb58e22f6..fdcad17b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 defaults: &defaults working_directory: /go/src/github.com/weaveworks/scope docker: - - image: weaveworks/scope-backend-build:build-updates-1b1c9664 + - image: weaveworks/scope-backend-build:go-1-17-8-bcdf2caa client-defaults: &client-defaults working_directory: /home/weave/scope diff --git a/app/multitenant/collector.go b/app/multitenant/collector.go index 55e453142..68e3b7254 100644 --- a/app/multitenant/collector.go +++ b/app/multitenant/collector.go @@ -107,6 +107,7 @@ type pendingEntry struct { older []*report.Report } +// NewLiveCollector makes a new LiveCollector from the supplied config. func NewLiveCollector(config LiveCollectorConfig) (app.Collector, error) { c := &liveCollector{ cfg: config, diff --git a/backend/Dockerfile b/backend/Dockerfile index 9654072e3..8f10fbcc9 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16.2 +FROM golang:1.17.8-buster ENV SCOPE_SKIP_UI_ASSETS true RUN set -eux; \ export arch_val="$(dpkg --print-architecture)"; \ @@ -7,22 +7,14 @@ RUN set -eux; \ apt-get install -y libpcap-dev time file shellcheck git gcc-arm-linux-gnueabihf curl build-essential gcc-s390x-linux-gnu; \ else \ apt-get install -y libpcap-dev time file shellcheck git curl build-essential; \ - fi; \ - \ + fi && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -RUN go clean -i net && \ - go install -tags netgo std && \ - export arch_val="$(dpkg --print-architecture)"; \ - if [ "$arch_val" != "ppc64el" ] && [ "$arch_val" != "s390x" ]; then \ - go install -race -tags netgo std; \ - fi; \ - go get -tags netgo \ +RUN go get -tags netgo \ github.com/fzipp/gocyclo \ golang.org/x/lint/golint \ github.com/kisielk/errcheck \ github.com/client9/misspell/cmd/misspell && \ - chmod a+wr --recursive /usr/local/go && \ rm -rf /go/pkg/ /go/src/ # Only install shfmt on amd64, as the version v1.3.0 isn't supported for ppc64le diff --git a/probe/docker/network_linux.go b/probe/docker/network_linux.go index e7a182e1f..3a3d82d6f 100644 --- a/probe/docker/network_linux.go +++ b/probe/docker/network_linux.go @@ -1,4 +1,5 @@ // withNetNS function requires a fix that first appeared in Go version 1.10 +//go:build go1.10 // +build go1.10 package docker diff --git a/probe/docker/network_others.go b/probe/docker/network_others.go index 2f02f14d8..4f36105d7 100644 --- a/probe/docker/network_others.go +++ b/probe/docker/network_others.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package docker diff --git a/probe/endpoint/connection_tracker.go b/probe/endpoint/connection_tracker.go index 14f94d79e..3c955516f 100644 --- a/probe/endpoint/connection_tracker.go +++ b/probe/endpoint/connection_tracker.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/conntrack.go b/probe/endpoint/conntrack.go index 52840c1e2..90636e7d5 100644 --- a/probe/endpoint/conntrack.go +++ b/probe/endpoint/conntrack.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/dns_snooper.go b/probe/endpoint/dns_snooper.go index e3058ac19..754a6893c 100644 --- a/probe/endpoint/dns_snooper.go +++ b/probe/endpoint/dns_snooper.go @@ -1,3 +1,4 @@ +//go:build (linux && amd64) || (linux && ppc64le) // +build linux,amd64 linux,ppc64le // Build constraint to use this file for amd64 & ppc64le on Linux diff --git a/probe/endpoint/dns_snooper_others.go b/probe/endpoint/dns_snooper_others.go index 3189dd8f7..439e8f20a 100644 --- a/probe/endpoint/dns_snooper_others.go +++ b/probe/endpoint/dns_snooper_others.go @@ -1,3 +1,4 @@ +//go:build darwin || arm || arm64 || s390x // +build darwin arm arm64 s390x // Cross-compiling the snooper requires having pcap binaries, diff --git a/probe/endpoint/dns_snooper_test.go b/probe/endpoint/dns_snooper_test.go index ade8e0a6e..f2a4e08e7 100644 --- a/probe/endpoint/dns_snooper_test.go +++ b/probe/endpoint/dns_snooper_test.go @@ -1,3 +1,4 @@ +//go:build (linux && amd64) || (linux && ppc64le) // +build linux,amd64 linux,ppc64le package endpoint diff --git a/probe/endpoint/ebpf.go b/probe/endpoint/ebpf.go index 06fa8e18c..53116a5a9 100644 --- a/probe/endpoint/ebpf.go +++ b/probe/endpoint/ebpf.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/ebpf_test.go b/probe/endpoint/ebpf_test.go index f5daa688e..f407a61ca 100644 --- a/probe/endpoint/ebpf_test.go +++ b/probe/endpoint/ebpf_test.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/nat.go b/probe/endpoint/nat.go index e3dd1f2a1..f63f73014 100644 --- a/probe/endpoint/nat.go +++ b/probe/endpoint/nat.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/nat_internal_test.go b/probe/endpoint/nat_internal_test.go index d4f3c4354..a830596b8 100644 --- a/probe/endpoint/nat_internal_test.go +++ b/probe/endpoint/nat_internal_test.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/reporter_linux.go b/probe/endpoint/reporter_linux.go index e465cc9cc..65fba32b0 100644 --- a/probe/endpoint/reporter_linux.go +++ b/probe/endpoint/reporter_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package endpoint diff --git a/probe/endpoint/reporter_other.go b/probe/endpoint/reporter_other.go index bf77b5d64..29e9234e3 100644 --- a/probe/endpoint/reporter_other.go +++ b/probe/endpoint/reporter_other.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package endpoint diff --git a/prog/tools.go b/prog/tools.go index d71f291fc..0ef27b4b3 100644 --- a/prog/tools.go +++ b/prog/tools.go @@ -1,5 +1,6 @@ // Ensure go mod fetches files needed to build the Docker container; // the build constraint ensures this file is ignored +//go:build tools // +build tools package report diff --git a/report/tools.go b/report/tools.go index 8b08bc979..4c9ac7b71 100644 --- a/report/tools.go +++ b/report/tools.go @@ -1,5 +1,6 @@ // Ensure go mod fetches files needed at code generation time; // the build constraint ensures this file is ignored +//go:build tools // +build tools package report