From 8e88e560a1eb76558364ee3400b3bfe0e4c054c6 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 14 Aug 2021 15:35:19 +0200 Subject: [PATCH] all: add support for Go 1.17 --- .circleci/config.yml | 8 ++++---- azure-pipelines.yml | 2 +- builder/config.go | 4 ++-- compiler/alias.go | 11 +++++++++++ compiler/compiler.go | 2 +- src/os/file.go | 5 +++++ 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bcc9b80d..5225152f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -286,8 +286,8 @@ commands: - run: name: "Install dependencies" command: | - curl https://dl.google.com/go/go1.16.darwin-amd64.tar.gz -o go1.16.darwin-amd64.tar.gz - sudo tar -C /usr/local -xzf go1.16.darwin-amd64.tar.gz + curl https://dl.google.com/go/go1.17.darwin-amd64.tar.gz -o go1.17.darwin-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.17.darwin-amd64.tar.gz ln -s /usr/local/go/bin/go /usr/local/bin/go HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu - install-xtensa-toolchain: @@ -379,12 +379,12 @@ jobs: llvm: "11" assert-test-linux: docker: - - image: circleci/golang:1.16-stretch + - image: circleci/golang:1.17-stretch steps: - assert-test-linux build-linux: docker: - - image: circleci/golang:1.16-stretch + - image: circleci/golang:1.17-stretch steps: - build-linux build-macos: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 96d91884..6a983aae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,7 +12,7 @@ jobs: steps: - task: GoTool@0 inputs: - version: '1.16' + version: '1.17' - checkout: self fetchDepth: 1 - task: Cache@2 diff --git a/builder/config.go b/builder/config.go index cdd9c0da..82693f7f 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 < 15 || minor > 16 { - return nil, fmt.Errorf("requires go version 1.15 through 1.16, got go%d.%d", major, minor) + if major != 1 || minor < 15 || minor > 17 { + return nil, fmt.Errorf("requires go version 1.15 through 1.17, got go%d.%d", major, minor) } clangHeaderPath := getClangHeaderPath(goenv.Get("TINYGOROOT")) diff --git a/compiler/alias.go b/compiler/alias.go index cc08c832..bdc6cc4d 100644 --- a/compiler/alias.go +++ b/compiler/alias.go @@ -32,33 +32,44 @@ var stdlibAliases = map[string]string{ "math.Atan2": "math.atan2", "math.Cbrt": "math.cbrt", "math.Ceil": "math.ceil", + "math.archCeil": "math.ceil", "math.Cos": "math.cos", "math.Cosh": "math.cosh", "math.Erf": "math.erf", "math.Erfc": "math.erfc", "math.Exp": "math.exp", + "math.archExp": "math.exp", "math.Expm1": "math.expm1", "math.Exp2": "math.exp2", + "math.archExp2": "math.exp2", "math.Floor": "math.floor", + "math.archFloor": "math.floor", "math.Frexp": "math.frexp", "math.Hypot": "math.hypot", + "math.archHypot": "math.hypot", "math.Ldexp": "math.ldexp", "math.Log": "math.log", + "math.archLog": "math.log", "math.Log1p": "math.log1p", "math.Log10": "math.log10", "math.Log2": "math.log2", "math.Max": "math.max", + "math.archMax": "math.max", "math.Min": "math.min", + "math.archMin": "math.min", "math.Mod": "math.mod", "math.Modf": "math.modf", + "math.archModf": "math.modf", "math.Pow": "math.pow", "math.Remainder": "math.remainder", "math.Sin": "math.sin", "math.Sinh": "math.sinh", "math.Sqrt": "math.sqrt", + "math.archSqrt": "math.sqrt", "math.Tan": "math.tan", "math.Tanh": "math.tanh", "math.Trunc": "math.trunc", + "math.archTrunc": "math.trunc", } // createAlias implements the function (in the builder) as a call to the alias diff --git a/compiler/compiler.go b/compiler/compiler.go index dda5f51e..d7811535 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -23,7 +23,7 @@ import ( // Version of the compiler pacakge. Must be incremented each time the compiler // package changes in a way that affects the generated LLVM module. // This version is independent of the TinyGo version number. -const Version = 16 // last change: fix max slice size +const Version = 17 // last change: add math.arch* aliases func init() { llvm.InitializeAllTargets() diff --git a/src/os/file.go b/src/os/file.go index 4d90bdde..4d2458a5 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -24,6 +24,11 @@ func Mkdir(path string, perm FileMode) error { return nil } +// MkdirTemp is a stub, it will always return an error. +func MkdirTemp(dir, pattern string) (string, error) { + return "", &PathError{"mkdirtemp", dir, ErrNotImplemented} +} + // Remove removes a file or (empty) directory. If the operation fails, it will // return an error of type *PathError. func Remove(path string) error {