From 4c647847247316bae553f9b9a8c7da4034edd199 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 11 Jun 2022 22:33:33 +0200 Subject: [PATCH] all: Go 1.19 support This adds early Go 1.19 support. There are a number of things that don't work yet, but the smoke tests pass so it's at least working for a significant subset of programs. This change also switches from CircleCI convenience images to upstream Go images. This makes it a bit easier to use the latest Go versions. Also, the convenience images are not updated anymore. --- .circleci/config.yml | 48 ++++++++++++++++++++++++++++++-------------- builder/config.go | 4 ++-- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d0d2e40e..fbdc52c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,12 +22,12 @@ commands: steps: - restore_cache: keys: - - llvm-source-14-v2 + - llvm-source-14-v3 - run: name: "Fetch LLVM source" command: make llvm-source - save_cache: - key: llvm-source-14-v2 + key: llvm-source-14-v3 paths: - llvm-project/clang/lib/Headers - llvm-project/clang/include @@ -45,29 +45,32 @@ commands: steps: - restore_cache: keys: - - binaryen-linux-v1 + - binaryen-linux-v2 - run: name: "Build Binaryen" command: | make binaryen - save_cache: - key: binaryen-linux-v1 + key: binaryen-linux-v2 paths: - build/wasm-opt test-linux: parameters: llvm: type: string + fmt-check: + type: boolean + default: true steps: - checkout - submodules - run: name: "Install apt dependencies" command: | - echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<> main' | sudo tee /etc/apt/sources.list.d/llvm.list - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-get update - sudo apt-get install --no-install-recommends \ + echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<> main' > /etc/apt/sources.list.d/llvm.list + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + apt-get update + apt-get install --no-install-recommends -y \ llvm-<>-dev \ clang-<> \ libclang-<>-dev \ @@ -80,34 +83,46 @@ commands: - build-binaryen-linux - restore_cache: keys: - - go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - - go-cache-v2-{{ checksum "go.mod" }} + - go-cache-v3-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} + - go-cache-v3-{{ checksum "go.mod" }} - llvm-source-linux - run: go install -tags=llvm<> . - restore_cache: keys: - - wasi-libc-sysroot-systemclang-v5 + - wasi-libc-sysroot-systemclang-v6 - run: make wasi-libc - save_cache: - key: wasi-libc-sysroot-systemclang-v5 + key: wasi-libc-sysroot-systemclang-v6 paths: - lib/wasi-libc/sysroot - run: make gen-device -j4 - run: make smoketest XTENSA=0 - save_cache: - key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }} + key: go-cache-v3-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }} paths: - ~/.cache/go-build - /go/pkg/mod - - run: make fmt-check + - when: + condition: <> + steps: + - run: + name: Check Go code formatting + command: make fmt-check jobs: test-llvm13-go116: docker: - - image: circleci/golang:1.16-buster + - image: golang:1.16-buster steps: - test-linux: llvm: "13" + test-llvm14-go119: + docker: + - image: golang:1.19beta1-buster + steps: + - test-linux: + llvm: "14" + fmt-check: false workflows: test-all: @@ -115,3 +130,6 @@ workflows: # This tests our lowest supported versions of Go and LLVM, to make sure at # least the smoke tests still pass. - test-llvm13-go116 + # This tests a beta version of Go. It should be removed once regular + # release builds are built using this version. + - test-llvm14-go119 diff --git a/builder/config.go b/builder/config.go index 3f06c968..8ff6dafc 100644 --- a/builder/config.go +++ b/builder/config.go @@ -33,8 +33,8 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) { if err != nil { return nil, fmt.Errorf("could not read version from GOROOT (%v): %v", goroot, err) } - if major != 1 || minor < 16 || minor > 18 { - return nil, fmt.Errorf("requires go version 1.16 through 1.18, got go%d.%d", major, minor) + if major != 1 || minor < 16 || minor > 19 { + return nil, fmt.Errorf("requires go version 1.16 through 1.19, got go%d.%d", major, minor) } clangHeaderPath := getClangHeaderPath(goenv.Get("TINYGOROOT"))