From e3ae790730faaae4e4c6bcebbbab5e541d2ac265 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Sat, 17 Feb 2024 23:03:30 +0100 Subject: [PATCH] testing/please-build: enable with go 1.22 --- testing/please-build/APKBUILD | 4 +- testing/please-build/go-1.22.patch | 564 +++++++++++++++++++++++++++++ 2 files changed, 567 insertions(+), 1 deletion(-) create mode 100644 testing/please-build/go-1.22.patch diff --git a/testing/please-build/APKBUILD b/testing/please-build/APKBUILD index 0dc8b94ba52..15fdb9167df 100644 --- a/testing/please-build/APKBUILD +++ b/testing/please-build/APKBUILD @@ -5,7 +5,7 @@ pkgrel=0 pkgdesc="High-performance, extensible build system for reproducible multi-language builds" url="https://please.build/" # The only architectures supported upstream -arch="" +arch="x86_64 aarch64" license="Apache-2.0" makedepends="go bash" subpackages=" @@ -16,6 +16,7 @@ subpackages=" source=" $pkgname-$pkgver.tar.gz::https://github.com/thought-machine/please/archive/refs/tags/v$pkgver.tar.gz fix-test.patch + go-1.22.patch " builddir="$srcdir/please-$pkgver" @@ -75,4 +76,5 @@ tools() { sha512sums=" 862b9791989e6dc742b3dcab12a70a596ae149802206bdc44e0845fb41ba6655a89b2019e966082373e06b31cf5ab83f2f39935e2e2edd4fb7c87f1e3e2914ff please-build-17.8.0.tar.gz e628c001a45daacfa19eacb99b79b51bc2d8ba4957a1fa56da6d524c553bfef9422fe54c0551403b675c761367627312579cafdaf0944c7122d3b2ba9edc3719 fix-test.patch +9610694cd38a93b01e9fbb2b1dde3af300bef02f47f38dbd74bd6f25b98c92019bc2c9b6d78248a4d2a4e748c6ebf592d8340f3974b7d9916a615aa8c78eb7cf go-1.22.patch " diff --git a/testing/please-build/go-1.22.patch b/testing/please-build/go-1.22.patch new file mode 100644 index 00000000000..396e3eb48a8 --- /dev/null +++ b/testing/please-build/go-1.22.patch @@ -0,0 +1,564 @@ +From 744bb45cb0af9476cd1477bfa2be8be46daa21ca Mon Sep 17 00:00:00 2001 +From: Peter Ebden +Date: Mon, 12 Feb 2024 11:40:15 +0000 +Subject: [PATCH] Update to Go 1.22.0 (#3070) + +* Update images to Go 1.22 + +* update toolchain + +* update go.mod + +* bump this for my sanity + +* update plugin + +* revert this + +* update image; the base used for the old one appears to incorrectly have been an x86 image (pretty sure this must be an upstream bug) + +* Update test repos too + +* update + +* migrate this bastard to go_repo + +* Use a tagged release + +* Update moar + +* Fine, disable this for now + +* fine i'll do the docs thing +--- + .circleci/config.yml | 14 +- + docs/BUILD | 2 +- + plugins/BUILD | 2 +- + test/plugins/test_repo/plugins/BUILD_FILE | 2 +- + test/plz_exec/test_repo/plugins/BUILD_FILE | 3 +- + test/proto_plugin/BUILD | 1 + + test/proto_plugin/test_repo/.plzconfig | 6 +- + .../proto_plugin/test_repo/plugins/BUILD_FILE | 4 +- + .../test_repo/third_party/go/BUILD_FILE | 181 ++---------------- + third_party/go/BUILD | 16 +- + tools/images/alpine/Dockerfile | 2 +- + tools/images/ubuntu/Dockerfile | 2 +- + tools/images/ubuntu_alt/Dockerfile | 2 +- + 13 files changed, 47 insertions(+), 190 deletions(-) + +diff --git a/.circleci/config.yml b/.circleci/config.yml +index b751280998..c928a6e121 100644 +--- a/.circleci/config.yml ++++ b/.circleci/config.yml +@@ -3,7 +3,7 @@ jobs: + build-alpine: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_alpine:20240111 ++ - image: thoughtmachine/please_alpine:20240209 + resource_class: large + environment: + PLZ_ARGS: "-p --profile ci --profile alpine --exclude no-musl" +@@ -43,7 +43,7 @@ jobs: + build-linux: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_ubuntu:20240103 ++ - image: thoughtmachine/please_ubuntu:20240207 + resource_class: large + environment: + PLZ_ARGS: "-p --profile ci" +@@ -91,7 +91,7 @@ jobs: + build-linux-alt: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_ubuntu_alt:20240103 ++ - image: thoughtmachine/please_ubuntu_alt:20240207 + resource_class: large + environment: + PLZ_ARGS: "-p -c cover --profile ci-alt" +@@ -176,7 +176,7 @@ jobs: + build-linux-arm64: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_ubuntu:20240103 ++ - image: thoughtmachine/please_ubuntu:20240207 + resource_class: large + steps: + - checkout +@@ -245,7 +245,7 @@ jobs: + test-rex: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_ubuntu:20240103 ++ - image: thoughtmachine/please_ubuntu:20240207 + resource_class: xlarge + steps: + - checkout +@@ -262,7 +262,7 @@ jobs: + test-http-cache: + working_directory: ~/please + docker: +- - image: thoughtmachine/please_ubuntu:20240103 ++ - image: thoughtmachine/please_ubuntu:20240207 + resource_class: large + steps: + - checkout +@@ -305,7 +305,7 @@ jobs: + # Runs a benchmarking test and records some performance results. + perf-test: + docker: +- - image: thoughtmachine/please_ubuntu:20240103 ++ - image: thoughtmachine/please_ubuntu:20240207 + resource_class: xlarge # Want to run these tests with a significant amount of parallelism + steps: + - checkout +diff --git a/docs/BUILD b/docs/BUILD +index bcc3e12b92..2c15da331d 100644 +--- a/docs/BUILD ++++ b/docs/BUILD +@@ -59,7 +59,7 @@ genrule( + plugins = { + "python": "v1.5.0", + "java": "v0.4.0", +- "go": "v1.16.3", ++ "go": "v1.16.5", + "cc": "v0.4.0", + "shell": "v0.2.0", + "go-proto": "v0.3.0", +diff --git a/plugins/BUILD b/plugins/BUILD +index 13348ef2e0..a0338de522 100644 +--- a/plugins/BUILD ++++ b/plugins/BUILD +@@ -1,7 +1,7 @@ + plugin_repo( + name = "go", + plugin = "go-rules", +- revision = "v1.16.3", ++ revision = "v1.16.5", + ) + + plugin_repo( +diff --git a/test/plugins/test_repo/plugins/BUILD_FILE b/test/plugins/test_repo/plugins/BUILD_FILE +index c4ceaa968f..f3f451a3ab 100644 +--- a/test/plugins/test_repo/plugins/BUILD_FILE ++++ b/test/plugins/test_repo/plugins/BUILD_FILE +@@ -5,5 +5,5 @@ plugin_repo( + + plugin_repo( + name = "go", +- revision = "v1.2.1", ++ revision = "v1.16.5", + ) +\ No newline at end of file +diff --git a/test/plz_exec/test_repo/plugins/BUILD_FILE b/test/plz_exec/test_repo/plugins/BUILD_FILE +index 08f8bf9927..8b6aa87432 100644 +--- a/test/plz_exec/test_repo/plugins/BUILD_FILE ++++ b/test/plz_exec/test_repo/plugins/BUILD_FILE +@@ -3,8 +3,7 @@ plugin_repo( + revision = "v0.1.1", + ) + +- + plugin_repo( + name = "go", +- revision = "v1.2.0", ++ revision = "v1.16.5", + ) +diff --git a/test/proto_plugin/BUILD b/test/proto_plugin/BUILD +index 08f4ad4581..c1ee32d020 100644 +--- a/test/proto_plugin/BUILD ++++ b/test/proto_plugin/BUILD +@@ -6,6 +6,7 @@ please_repo_e2e_test( + labels = [ + "no_cirrus", + "no-musl", ++ "manual", + ], + plz_command = "plz -o plugin.go.gotool:$TOOLS_GO test", + repo = "test_repo", +diff --git a/test/proto_plugin/test_repo/.plzconfig b/test/proto_plugin/test_repo/.plzconfig +index b2cb9b90f9..883d4272cd 100644 +--- a/test/proto_plugin/test_repo/.plzconfig ++++ b/test/proto_plugin/test_repo/.plzconfig +@@ -6,7 +6,7 @@ ImportPath = github.com/thought-machine/please/test/proto_plugin + + [Plugin "proto"] + Target = //plugins:proto +-LanguageDef = ///go_proto//build_defs:go ++LanguageDef = ///go_proto//build_defs:go_proto + ProtocTool = ///proto//third_party/proto:protoc + + [Plugin "go"] +@@ -15,5 +15,5 @@ ImportPath = github.com/thought-machine/please/test/proto_plugin + + [Plugin "go_proto"] + Target = //plugins:go-proto +-GrpcPlugin = //third_party/go:protoc-gen-go-grpc +-ProtoPlugin = //third_party/go:protoc-gen-go ++GrpcPlugin = ///third_party/go/google.golang.org_grpc_cmd_protoc-gen-go-grpc//:protoc-gen-go-grpc ++ProtoPlugin = ///third_party/go/google.golang.org_protobuf//cmd/protoc-gen-go +diff --git a/test/proto_plugin/test_repo/plugins/BUILD_FILE b/test/proto_plugin/test_repo/plugins/BUILD_FILE +index 00be4f8494..793049b4b9 100644 +--- a/test/proto_plugin/test_repo/plugins/BUILD_FILE ++++ b/test/proto_plugin/test_repo/plugins/BUILD_FILE +@@ -5,10 +5,10 @@ plugin_repo( + + plugin_repo( + name = "go", +- revision = "v1.4.1", ++ revision = "v1.16.5", + ) + + plugin_repo( + name = "go-proto", +- revision = "v0.2.0", ++ revision = "v0.3.0", + ) +diff --git a/test/proto_plugin/test_repo/third_party/go/BUILD_FILE b/test/proto_plugin/test_repo/third_party/go/BUILD_FILE +index 4fa9134750..c9d1def735 100644 +--- a/test/proto_plugin/test_repo/third_party/go/BUILD_FILE ++++ b/test/proto_plugin/test_repo/third_party/go/BUILD_FILE +@@ -1,6 +1,6 @@ + subinclude("///go//build_defs:go") + +-go_module( ++go_repo( + name = "go-spew", + install = ["spew"], + module = "github.com/davecgh/go-spew", +@@ -8,7 +8,7 @@ go_module( + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "go-difflib", + install = ["difflib"], + module = "github.com/pmezard/go-difflib", +@@ -16,229 +16,86 @@ go_module( + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "yaml.v3", + module = "gopkg.in/yaml.v3", + version = "v3.0.0-20200313102051-9f266ea9e77c", + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "testify", +- install = [ +- ".", +- "assert", +- "http", +- "mock", +- "require", +- "suite", +- ], + module = "github.com/stretchr/testify", + version = "v1.7.0", + visibility = ["PUBLIC"], +- deps = [ +- ":go-difflib", +- ":go-spew", +- ":objx", +- ":yaml.v3", +- ], + ) + +-go_module( ++go_repo( + name = "objx", + module = "github.com/stretchr/objx", + version = "v0.1.0", + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "text", +- install = [ +- "secure/bidirule", +- "transform", +- "unicode/bidi", +- "unicode/norm", +- ], + module = "golang.org/x/text", + version = "v0.3.0", + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "protobuf", +- exported_deps = [":google.golang.org.protobuf"], +- install = [ +- "proto", +- "ptypes", +- "ptypes/any", +- "ptypes/duration", +- "ptypes/timestamp", +- ], + module = "github.com/golang/protobuf", + version = "v1.4.3", + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "grpc", +- install = [ +- ".", +- "attributes", +- "backoff", +- "balancer", +- "balancer/base", +- "balancer/grpclb/state", +- "balancer/roundrobin", +- "binarylog/grpc_binarylog_v1", +- "codes", +- "connectivity", +- "credentials", +- "encoding", +- "encoding/proto", +- "grpclog", +- "internal", +- "internal/backoff", +- "internal/balancerload", +- "internal/binarylog", +- "internal/buffer", +- "internal/channelz", +- "internal/credentials", +- "internal/envconfig", +- "internal/grpclog", +- "internal/grpcrand", +- "internal/grpcsync", +- "internal/grpcutil", +- "internal/metadata", +- "internal/resolver", +- "internal/resolver/dns", +- "internal/resolver/passthrough", +- "internal/resolver/unix", +- "internal/serviceconfig", +- "internal/status", +- "internal/syscall", +- "internal/transport", +- "internal/transport/networktype", +- "internal/xds/env", +- "keepalive", +- "metadata", +- "peer", +- "resolver", +- "serviceconfig", +- "stats", +- "status", +- "tap", +- ], + module = "google.golang.org/grpc", + version = "v1.42.0", + visibility = ["PUBLIC"], +- deps = [ +- ":genproto", +- ":google.golang.org.protobuf", +- ":net", +- ":protobuf", +- ":sys", +- ], + ) + +-go_mod_download( +- name = "protobuf_dl", +- module = "google.golang.org/protobuf", +- version = "v1.27.1", +-) +- +-go_module( +- name = "google.golang.org.protobuf", +- download = ":protobuf_dl", +- install = [ +- "cmd/protoc-gen-go/internal_gengo", +- "compiler/protogen", +- "encoding/prototext", +- "encoding/protowire", +- "internal/...", +- "proto", +- "reflect/protodesc", +- "reflect/protoreflect", +- "reflect/protoregistry", +- "runtime/protoiface", +- "runtime/protoimpl", +- "types/descriptorpb", +- "types/known/anypb", +- "types/known/durationpb", +- "types/known/timestamppb", +- "types/pluginpb", +- ], +- module = "google.golang.org/protobuf", +-) +- +-go_module( ++go_repo( + name = "protoc-gen-go-grpc", +- binary = True, + module = "google.golang.org/grpc/cmd/protoc-gen-go-grpc", +- version = "v1.1.0", ++ version = "v1.3.0", + visibility = ["PUBLIC"], +- deps = [":google.golang.org.protobuf"], + ) + +-go_module( +- name = "protoc-gen-go", +- binary = True, +- download = ":protobuf_dl", +- install = ["cmd/protoc-gen-go"], ++go_repo( ++ name = "google.golang.org.protobuf", + module = "google.golang.org/protobuf", ++ version = "v1.27.1", + visibility = ["PUBLIC"], +- deps = [":google.golang.org.protobuf"], + ) + +-go_module( ++go_repo( + name = "net", +- install = [ +- "http/httpguts", +- "http2", +- "http2/hpack", +- "idna", +- "internal/timeseries", +- "trace", +- ], + module = "golang.org/x/net", +- version = "v0.0.0-20200822124328-c89045814202", ++ version = "v0.21.0", + visibility = ["PUBLIC"], + deps = [":text"], + ) + +-go_module( ++go_repo( + name = "sys", +- install = ["unix"], + module = "golang.org/x/sys", +- version = "v0.0.0-20220315194320-039c03cc5b86", ++ version = "v0.17.0", + visibility = ["PUBLIC"], + ) + +-go_module( ++go_repo( + name = "genproto", +- install = ["googleapis/rpc/status"], + module = "google.golang.org/genproto", + version = "v0.0.0-20200526211855-cb27e3aa2013", + visibility = ["PUBLIC"], +- deps = [ +- ":google.golang.org.protobuf", +- ":protobuf", +- ], + ) + +-go_module( ++go_repo( + name = "go-cmp", +- install = [ +- "cmp", +- "cmp/cmpopts", +- "cmp/internal/diff", +- "cmp/internal/flags", +- "cmp/internal/function", +- "cmp/internal/testprotos", +- "cmp/internal/teststructs", +- "cmp/internal/teststructs/foo1", +- "cmp/internal/teststructs/foo2", +- "cmp/internal/value", +- ], + module = "github.com/google/go-cmp", + version = "v0.5.6", + visibility = ["PUBLIC"], +diff --git a/third_party/go/BUILD b/third_party/go/BUILD +index 6ba84d0441..28a754d342 100644 +--- a/third_party/go/BUILD ++++ b/third_party/go/BUILD +@@ -5,14 +5,14 @@ package(default_visibility = ["PUBLIC"]) + go_toolchain( + name = "toolchain", + hashes = [ +- "27014fc69e301d7588a169ca239b3cc609f0aa1abf38528bf0d20d3b259211eb", # darwin-amd64 +- "65302a7a9f7a4834932b3a7a14cb8be51beddda757b567a2f9e0cbd0d7b5a6ab", # darwin-arm64 +- "6e74f65f586e93d1f3947894766f69e9b2ebda488592a09df61f36f06bfe58a8", # freebsd-amd64 +- "1241381b2843fae5a9707eec1f8fb2ef94d827990582c7c7c32f5bdfbfd420c8", # linux-amd64 +- "fc90fa48ae97ba6368eecb914343590bbb61b388089510d0c56c2dde52987ef3", # linux-arm64 ++ "ebca81df938d2d1047cc992be6c6c759543cf309d401b86af38a6aed3d4090f4", # darwin-amd64 ++ "bf8e388b09134164717cd52d3285a4ab3b68691b80515212da0e9f56f518fb1e", # darwin-arm64 ++ "50f421c7f217083ac94aab1e09400cb9c2fea7d337679ec11f1638a11460da30", # freebsd-amd64 ++ "f6c8a87aa03b92c4b0bf3d558e28ea03006eb29db78917daec5cfb6ec1046265", # linux-amd64 ++ "6a63fef0e050146f275bf02a0896badfe77c11b6f05499bb647e7bd613a45a10", # linux-arm64 + ], + install_std = True, +- version = "1.21.3", ++ version = "1.22.0", + ) + + go_stdlib( +@@ -352,7 +352,7 @@ go_repo( + + go_repo( + module = "golang.org/x/sys", +- version = "v0.0.0-20220315194320-039c03cc5b86", ++ version = "v0.17.0", + ) + + go_repo( +@@ -387,7 +387,7 @@ go_repo( + + go_repo( + module = "github.com/cespare/xxhash/v2", +- version = "v2.1.2", ++ version = "v2.2.0", + ) + + go_repo( +diff --git a/tools/images/alpine/Dockerfile b/tools/images/alpine/Dockerfile +index 74ad14b32b..48b84506ef 100644 +--- a/tools/images/alpine/Dockerfile ++++ b/tools/images/alpine/Dockerfile +@@ -1,4 +1,4 @@ +-FROM golang:1.21-alpine ++FROM golang:1.22-alpine + MAINTAINER peter.ebden@gmail.com + + RUN apk update && apk add --no-cache git patch gcc g++ libc-dev bash libgcc xz protoc protobuf-dev perl-utils +diff --git a/tools/images/ubuntu/Dockerfile b/tools/images/ubuntu/Dockerfile +index a37cafb84a..9da3df1c0e 100644 +--- a/tools/images/ubuntu/Dockerfile ++++ b/tools/images/ubuntu/Dockerfile +@@ -15,7 +15,7 @@ RUN truncate -s0 /tmp/preseed.cfg; \ + apt-get clean + + # Go - we want a specific package version here. +-RUN curl -fsSL https://dl.google.com/go/go1.21.5.linux-amd64.tar.gz | tar -xzC /usr/local ++RUN curl -fsSL https://dl.google.com/go/go1.22.0.linux-amd64.tar.gz | tar -xzC /usr/local + RUN ln -s /usr/local/go/bin/go /usr/local/bin/go && ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt + + # Locale +diff --git a/tools/images/ubuntu_alt/Dockerfile b/tools/images/ubuntu_alt/Dockerfile +index 15d4ae8207..7d80e363a1 100644 +--- a/tools/images/ubuntu_alt/Dockerfile ++++ b/tools/images/ubuntu_alt/Dockerfile +@@ -10,7 +10,7 @@ RUN apt-get update && \ + apt-get clean + + # Go +-RUN curl -fsSL https://dl.google.com/go/go1.21.5.linux-amd64.tar.gz | tar -xzC /usr/local ++RUN curl -fsSL https://dl.google.com/go/go1.21.7.linux-amd64.tar.gz | tar -xzC /usr/local + RUN ln -s /usr/local/go/bin/go /usr/local/bin/go && ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt + + # Locale