builder: add support for Go 1.20
Not all features work yet, but allow it to compile with this Go version.
Этот коммит содержится в:
родитель
3177591b31
коммит
0d646d8e95
6 изменённых файлов: 24 добавлений и 10 удалений
|
@ -105,6 +105,13 @@ jobs:
|
|||
- test-linux:
|
||||
llvm: "14"
|
||||
resource_class: large
|
||||
test-llvm15-go120:
|
||||
docker:
|
||||
- image: golang:1.20-rc-buster
|
||||
steps:
|
||||
- test-linux:
|
||||
llvm: "15"
|
||||
resource_class: large
|
||||
|
||||
workflows:
|
||||
test-all:
|
||||
|
@ -112,3 +119,4 @@ workflows:
|
|||
# This tests our lowest supported versions of Go and LLVM, to make sure at
|
||||
# least the smoke tests still pass.
|
||||
- test-llvm14-go118
|
||||
- test-llvm15-go120
|
||||
|
|
1
Makefile
1
Makefile
|
@ -286,7 +286,6 @@ TEST_PACKAGES_FAST = \
|
|||
container/list \
|
||||
container/ring \
|
||||
crypto/des \
|
||||
crypto/internal/subtle \
|
||||
crypto/md5 \
|
||||
crypto/rc4 \
|
||||
crypto/sha1 \
|
||||
|
|
|
@ -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 < 18 || minor > 19 {
|
||||
return nil, fmt.Errorf("requires go version 1.18 through 1.19, got go%d.%d", major, minor)
|
||||
if major != 1 || minor < 18 || minor > 20 {
|
||||
return nil, fmt.Errorf("requires go version 1.18 through 1.20, got go%d.%d", major, minor)
|
||||
}
|
||||
|
||||
clangHeaderPath := getClangHeaderPath(goenv.Get("TINYGOROOT"))
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"go/types"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -21,9 +22,15 @@ var flagUpdate = flag.Bool("update", false, "Update images based on test output.
|
|||
|
||||
// normalizeResult normalizes Go source code that comes out of tests across
|
||||
// platforms and Go versions.
|
||||
func normalizeResult(result string) string {
|
||||
actual := strings.ReplaceAll(result, "\r\n", "\n")
|
||||
return actual
|
||||
func normalizeResult(t *testing.T, result string) string {
|
||||
result = strings.ReplaceAll(result, "\r\n", "\n")
|
||||
|
||||
// This changed to 'undefined:', in Go 1.20.
|
||||
result = strings.ReplaceAll(result, ": undeclared name:", ": undefined:")
|
||||
// Go 1.20 added a bit more detail
|
||||
result = regexp.MustCompile(`(unknown field z in struct literal).*`).ReplaceAllString(result, "$1")
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func TestCGo(t *testing.T) {
|
||||
|
@ -88,7 +95,7 @@ func TestCGo(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("could not write out CGo AST: %v", err)
|
||||
}
|
||||
actual := normalizeResult(buf.String())
|
||||
actual := normalizeResult(t, buf.String())
|
||||
|
||||
// Read the file with the expected output, to compare against.
|
||||
outfile := filepath.Join("testdata", name+".out.go")
|
||||
|
|
4
cgo/testdata/errors.out.go
предоставленный
4
cgo/testdata/errors.out.go
предоставленный
|
@ -8,9 +8,9 @@
|
|||
// Type checking errors after CGo processing:
|
||||
// testdata/errors.go:102: cannot use 2 << 10 (untyped int constant 2048) as C.char value in variable declaration (overflows)
|
||||
// testdata/errors.go:105: unknown field z in struct literal
|
||||
// testdata/errors.go:108: undeclared name: C.SOME_CONST_1
|
||||
// testdata/errors.go:108: undefined: C.SOME_CONST_1
|
||||
// testdata/errors.go:110: cannot use C.SOME_CONST_3 (untyped int constant 1234) as byte value in variable declaration (overflows)
|
||||
// testdata/errors.go:112: undeclared name: C.SOME_CONST_4
|
||||
// testdata/errors.go:112: undefined: C.SOME_CONST_4
|
||||
|
||||
package main
|
||||
|
||||
|
|
2
testdata/stdlib.go
предоставленный
2
testdata/stdlib.go
предоставленный
|
@ -24,7 +24,7 @@ func main() {
|
|||
syscall.Getppid()
|
||||
|
||||
// package math/rand
|
||||
fmt.Println("pseudorandom number:", rand.Int31())
|
||||
fmt.Println("pseudorandom number:", rand.New(rand.NewSource(1)).Int31())
|
||||
|
||||
// package strings
|
||||
fmt.Println("strings.IndexByte:", strings.IndexByte("asdf", 'd'))
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче