From 5572ab2f7d0d09ff0f184a826d811215a6037d7b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 9 Feb 2023 15:57:19 -0800 Subject: [PATCH] Bump go version to 1.20 Signed-off-by: Andrei Vagin --- Makefile | 2 +- WORKSPACE | 18 +++++++++++------- runsc/container/trace_test.go | 11 ++++++++++- test/root/BUILD | 1 + tools/bazeldefs/go.bzl | 4 +++- tools/rules_go_sdk.patch | 10 +++++----- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index f3e093ed3..a1087e774 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ smoke-race-tests: ## Runs a smoke test after build building runsc in race config .PHONY: smoke-race-tests nogo-tests: - @$(call test,--build_tag_filters=nogo --test_tag_filters=nogo --//tools/nogo:full //:all pkg/... tools/...) + @$(call test,--build_tag_filters=nogo --test_tag_filters=nogo --//tools/nogo:full //:all pkg/... tools/...) .PHONY: nogo-tests # For unit tests, we take everything in the root, pkg/... and tools/..., and diff --git a/WORKSPACE b/WORKSPACE index 414ecdf5c..e4b6a52b9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -42,10 +42,10 @@ http_archive( # Allow for patching of the go_sdk. "//tools:rules_go_sdk.patch", ], - sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", + sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip", ], ) @@ -70,7 +70,7 @@ go_download_sdk( # time on our continuous integration. patch = "//tools:go_types_memoize.patch", patch_strip = 2, - version = "1.19.3", + version = "1.20", ) gazelle_dependencies() @@ -81,8 +81,8 @@ gazelle_dependencies() go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", - sum = "h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM=", - version = "v0.3.0", + sum = "h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=", + version = "v0.5.0", ) go_repository( @@ -140,7 +140,11 @@ http_archive( load("@coral_crosstool//:configure.bzl", "cc_crosstool") -cc_crosstool(name = "crosstool") +cc_crosstool( + name = "crosstool", + c_version = "gnu17", +) + register_toolchains("//:cc_toolchain_k8", "//:cc_toolchain_aarch64") # Load protobuf dependencies. diff --git a/runsc/container/trace_test.go b/runsc/container/trace_test.go index 2a84301ab..68317a030 100644 --- a/runsc/container/trace_test.go +++ b/runsc/container/trace_test.go @@ -17,6 +17,7 @@ package container import ( "encoding/json" "io/ioutil" + "os" "strings" "testing" "time" @@ -375,7 +376,15 @@ func TestProcfsDump(t *testing.T) { if len(procfsDump[0].FDs) < 3 { t.Errorf("expected at least 3 FDs for the sleep process, got %+v", procfsDump[0].FDs) } else { - modes := []uint16{unix.S_IFCHR, unix.S_IFIFO, unix.S_IFREG} + modes := [3]uint32{} + for i, _ := range []*os.File{os.Stdin, os.Stdout, os.Stderr} { + stat := unix.Stat_t{} + err := unix.Fstat(i, &stat) + if err != nil { + t.Fatalf("unix.Fatat(i) failed: %s", err) + } + modes[i] = stat.Mode & unix.S_IFMT + } for i, fd := range procfsDump[0].FDs[:3] { if want := int32(i); fd.Number != want { t.Errorf("expected FD number %d, got %d", want, fd.Number) diff --git a/test/root/BUILD b/test/root/BUILD index a2deafea7..9c1054e3c 100644 --- a/test/root/BUILD +++ b/test/root/BUILD @@ -22,6 +22,7 @@ go_test( "//runsc", ], library = ":root", + pure = True, tags = [ "local", "manual", diff --git a/tools/bazeldefs/go.bzl b/tools/bazeldefs/go.bzl index f27d32785..f4fece797 100644 --- a/tools/bazeldefs/go.bzl +++ b/tools/bazeldefs/go.bzl @@ -140,8 +140,10 @@ def go_context(ctx, goos = None, goarch = None, std = False): goos = go_ctx.sdk.goos if goarch == None: goarch = go_ctx.sdk.goarch + env = go_ctx.env + env["CGO_ENABLED"] = "0" return struct( - env = go_ctx.env, + env = env, go = go_ctx.go, goarch = goarch, goos = goos, diff --git a/tools/rules_go_sdk.patch b/tools/rules_go_sdk.patch index f022e5ff9..6e5c3aa8f 100644 --- a/tools/rules_go_sdk.patch +++ b/tools/rules_go_sdk.patch @@ -1,8 +1,8 @@ diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl -index cf6f73e6..26c9720c 100644 +index 0d55d474..1b2a776b 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl -@@ -109,6 +109,8 @@ def _go_download_sdk_impl(ctx): +@@ -127,6 +127,8 @@ def _go_download_sdk_impl(ctx): "sdks": ctx.attr.sdks, "urls": ctx.attr.urls, "version": version, @@ -11,8 +11,8 @@ index cf6f73e6..26c9720c 100644 "strip_prefix": ctx.attr.strip_prefix, } return None -@@ -121,6 +123,8 @@ _go_download_sdk = repository_rule( - "sdks": attr.string_list_dict(), +@@ -142,6 +144,8 @@ _go_download_sdk = repository_rule( + ), "urls": attr.string_list(default = ["https://dl.google.com/go/{}"]), "version": attr.string(), + "patch": attr.label(default = None), @@ -20,7 +20,7 @@ index cf6f73e6..26c9720c 100644 "strip_prefix": attr.string(default = "go"), }, ) -@@ -210,6 +214,8 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256): +@@ -334,6 +338,8 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256): res = ctx.execute(["tar", "-xf", "go_sdk.tar.gz", "--strip-components=1"]) if res.return_code: fail("error extracting Go SDK:\n" + res.stdout + res.stderr)