From 8a2444ea7deafcdbd872b1a5a23212e9ef2f4a72 Mon Sep 17 00:00:00 2001 From: Yi Duan Date: Mon, 29 Jul 2024 12:52:17 +0800 Subject: [PATCH] chore: match go1.23 (#662) --- .github/workflows/go_latest_test.yml | 45 +++++++ ast/api.go | 4 +- ast/api_compat.go | 2 +- ast/api_native_test.go | 4 +- ast/stubs.go | 106 +++++++++++++++- compat.go | 2 +- decode_test.go | 4 +- decoder/decoder_compat.go | 2 +- decoder/decoder_native.go | 4 +- decoder/decoder_native_test.go | 4 +- encode_test.go | 4 +- encoder/encoder_compat.go | 2 +- encoder/encoder_native.go | 2 +- encoder/encoder_native_test.go | 2 +- go1.23 | 1 + internal/decoder/api/decoder_amd64.go | 4 +- internal/decoder/api/decoder_arm64.go | 2 +- .../decoder/jitdec/asm_stubs_amd64_go121.go | 2 +- .../decoder/jitdec/assembler_regabi_amd64.go | 2 +- .../decoder/jitdec/generic_regabi_amd64.go | 2 +- .../jitdec/generic_regabi_amd64_test.s | 2 +- internal/encoder/alg/spec.go | 4 +- internal/encoder/alg/spec_compat.go | 2 +- internal/encoder/x86/asm_stubs_amd64_go121.go | 4 +- .../encoder/x86/assembler_regabi_amd64.go | 4 +- internal/encoder/x86/debug_go117.go | 4 +- internal/native/traceback_test.mock_tmpl | 2 +- internal/rt/base64_amd64.go | 2 +- internal/rt/base64_compat.go | 2 +- loader/funcdata_go123.go | 118 ++++++++++++++++++ loader/funcdata_latest.go | 4 +- loader/loader_latest.go | 2 +- rfc_test.go | 4 +- scripts/go_latest.sh | 13 +- scripts/go_latest_test.yml | 29 ----- search_test.go | 4 +- sonic.go | 4 +- 37 files changed, 316 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/go_latest_test.yml create mode 160000 go1.23 create mode 100644 loader/funcdata_go123.go delete mode 100644 scripts/go_latest_test.yml diff --git a/.github/workflows/go_latest_test.yml b/.github/workflows/go_latest_test.yml new file mode 100644 index 000000000..9c2e7e1bb --- /dev/null +++ b/.github/workflows/go_latest_test.yml @@ -0,0 +1,45 @@ +name: Go Latest Linux-X64 + +on: push + +jobs: + build: + strategy: + matrix: + os: [arm, X64] + runs-on: ${{ matrix.os }} + steps: + - name: Clear repository + run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE + + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.22.4 + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: build go + run: sh ./scripts/go_latest.sh go1.23 + continue-on-error: true + + - name: test + run: | + PWD=$(pwd) + export GOROOT=$PWD/go1.23 + export PATH=$GOROOT/bin:$PATH + go version + GOMAXPROCS=4 go test -v -race . + GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast + GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/encoder + GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/decoder + GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/issue_test + + diff --git a/ast/api.go b/ast/api.go index 3fc62fd0e..7c8253aa1 100644 --- a/ast/api.go +++ b/ast/api.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2022 ByteDance Inc. diff --git a/ast/api_compat.go b/ast/api_compat.go index 19c5cd681..22778a39a 100644 --- a/ast/api_compat.go +++ b/ast/api_compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.17 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2022 ByteDance Inc. diff --git a/ast/api_native_test.go b/ast/api_native_test.go index b58f86404..61cf85d94 100644 --- a/ast/api_native_test.go +++ b/ast/api_native_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2022 ByteDance Inc. diff --git a/ast/stubs.go b/ast/stubs.go index 89bdb6750..53bf3b8aa 100644 --- a/ast/stubs.go +++ b/ast/stubs.go @@ -17,9 +17,10 @@ package ast import ( - `unsafe` + "unicode/utf8" + "unsafe" - `github.com/bytedance/sonic/internal/rt` + "github.com/bytedance/sonic/internal/rt" ) //go:noescape @@ -36,5 +37,106 @@ func mem2ptr(s []byte) unsafe.Pointer { return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr } +var safeSet = [utf8.RuneSelf]bool{ + ' ': true, + '!': true, + '"': false, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + ',': true, + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + ';': true, + '<': true, + '=': true, + '>': true, + '?': true, + '@': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + '[': true, + '\\': false, + ']': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '{': true, + '|': true, + '}': true, + '~': true, + '\u007f': true, +} + +var hex = "0123456789abcdef" + //go:linkname unquoteBytes encoding/json.unquoteBytes func unquoteBytes(s []byte) (t []byte, ok bool) diff --git a/compat.go b/compat.go index ac8d13413..b32342a84 100644 --- a/compat.go +++ b/compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.17 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2021 ByteDance Inc. diff --git a/decode_test.go b/decode_test.go index 7b65915fa..f3ed66ecc 100644 --- a/decode_test.go +++ b/decode_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/decoder/decoder_compat.go b/decoder/decoder_compat.go index a5c1fb39f..e8519dbba 100644 --- a/decoder/decoder_compat.go +++ b/decoder/decoder_compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.17 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2023 ByteDance Inc. diff --git a/decoder/decoder_native.go b/decoder/decoder_native.go index bc3ac97e2..9442d028b 100644 --- a/decoder/decoder_native.go +++ b/decoder/decoder_native.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* diff --git a/decoder/decoder_native_test.go b/decoder/decoder_native_test.go index 20604dd68..ffa659b51 100644 --- a/decoder/decoder_native_test.go +++ b/decoder/decoder_native_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* diff --git a/encode_test.go b/encode_test.go index 64a5e68b0..f97244a2c 100644 --- a/encode_test.go +++ b/encode_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/encoder/encoder_compat.go b/encoder/encoder_compat.go index f4195b1e0..2db5806d8 100644 --- a/encoder/encoder_compat.go +++ b/encoder/encoder_compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.17 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2023 ByteDance Inc. diff --git a/encoder/encoder_native.go b/encoder/encoder_native.go index 737ec001f..b300ebf08 100644 --- a/encoder/encoder_native.go +++ b/encoder/encoder_native.go @@ -1,4 +1,4 @@ -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2023 ByteDance Inc. diff --git a/encoder/encoder_native_test.go b/encoder/encoder_native_test.go index 47d5d2e9d..84c0d187b 100644 --- a/encoder/encoder_native_test.go +++ b/encoder/encoder_native_test.go @@ -1,4 +1,4 @@ -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/go1.23 b/go1.23 new file mode 160000 index 000000000..c9940fe2a --- /dev/null +++ b/go1.23 @@ -0,0 +1 @@ +Subproject commit c9940fe2a9f2eb77327efca860abfbae8d94bf28 diff --git a/internal/decoder/api/decoder_amd64.go b/internal/decoder/api/decoder_amd64.go index 7280bf3aa..4e1c3f42c 100644 --- a/internal/decoder/api/decoder_amd64.go +++ b/internal/decoder/api/decoder_amd64.go @@ -1,5 +1,5 @@ -//go:build go1.17 && !go1.23 -// +build go1.17,!go1.23 +//go:build go1.17 && !go1.24 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/decoder/api/decoder_arm64.go b/internal/decoder/api/decoder_arm64.go index ec9287248..65a9478b4 100644 --- a/internal/decoder/api/decoder_arm64.go +++ b/internal/decoder/api/decoder_arm64.go @@ -1,4 +1,4 @@ -// +build go1.17,!go1.23 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/decoder/jitdec/asm_stubs_amd64_go121.go b/internal/decoder/jitdec/asm_stubs_amd64_go121.go index a74263898..cbec3d248 100644 --- a/internal/decoder/jitdec/asm_stubs_amd64_go121.go +++ b/internal/decoder/jitdec/asm_stubs_amd64_go121.go @@ -1,4 +1,4 @@ -// +build go1.21,!go1.23 +// +build go1.21,!go1.24 // Copyright 2023 CloudWeGo Authors // diff --git a/internal/decoder/jitdec/assembler_regabi_amd64.go b/internal/decoder/jitdec/assembler_regabi_amd64.go index 51cc3957e..1daddad0e 100644 --- a/internal/decoder/jitdec/assembler_regabi_amd64.go +++ b/internal/decoder/jitdec/assembler_regabi_amd64.go @@ -1,4 +1,4 @@ -// +build go1.17,!go1.23 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/decoder/jitdec/generic_regabi_amd64.go b/internal/decoder/jitdec/generic_regabi_amd64.go index c9dea936c..e6d5e3e84 100644 --- a/internal/decoder/jitdec/generic_regabi_amd64.go +++ b/internal/decoder/jitdec/generic_regabi_amd64.go @@ -1,4 +1,4 @@ -// +build go1.17,!go1.23 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/decoder/jitdec/generic_regabi_amd64_test.s b/internal/decoder/jitdec/generic_regabi_amd64_test.s index b4b0de183..19ed3752f 100644 --- a/internal/decoder/jitdec/generic_regabi_amd64_test.s +++ b/internal/decoder/jitdec/generic_regabi_amd64_test.s @@ -1,4 +1,4 @@ -// +build go1.17,!go1.23 +// +build go1.17,!go1.24 // // Copyright 2021 ByteDance Inc. diff --git a/internal/encoder/alg/spec.go b/internal/encoder/alg/spec.go index 3c2a9fe7a..bff943626 100644 --- a/internal/encoder/alg/spec.go +++ b/internal/encoder/alg/spec.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.16 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.16,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.16 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.16,!go1.24 arm64,go1.20,!go1.24 /** * Copyright 2024 ByteDance Inc. diff --git a/internal/encoder/alg/spec_compat.go b/internal/encoder/alg/spec_compat.go index 5bb7b042e..c15cbf7d8 100644 --- a/internal/encoder/alg/spec_compat.go +++ b/internal/encoder/alg/spec_compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.16 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.16 arm64,!go1.20 /** * Copyright 2024 ByteDance Inc. diff --git a/internal/encoder/x86/asm_stubs_amd64_go121.go b/internal/encoder/x86/asm_stubs_amd64_go121.go index 789266d6c..3d70021e4 100644 --- a/internal/encoder/x86/asm_stubs_amd64_go121.go +++ b/internal/encoder/x86/asm_stubs_amd64_go121.go @@ -1,5 +1,5 @@ -//go:build go1.21 && !go1.23 -// +build go1.21,!go1.23 +//go:build go1.21 && !go1.24 +// +build go1.21,!go1.24 // Copyright 2023 CloudWeGo Authors // diff --git a/internal/encoder/x86/assembler_regabi_amd64.go b/internal/encoder/x86/assembler_regabi_amd64.go index 470278e86..75e3ecde6 100644 --- a/internal/encoder/x86/assembler_regabi_amd64.go +++ b/internal/encoder/x86/assembler_regabi_amd64.go @@ -1,5 +1,5 @@ -//go:build go1.17 && !go1.23 -// +build go1.17,!go1.23 +//go:build go1.17 && !go1.24 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/encoder/x86/debug_go117.go b/internal/encoder/x86/debug_go117.go index 14502a056..0aca3f4c5 100644 --- a/internal/encoder/x86/debug_go117.go +++ b/internal/encoder/x86/debug_go117.go @@ -1,5 +1,5 @@ -//go:build go1.17 && !go1.23 -// +build go1.17,!go1.23 +//go:build go1.17 && !go1.24 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/internal/native/traceback_test.mock_tmpl b/internal/native/traceback_test.mock_tmpl index 2742f49ba..706d2dbea 100644 --- a/internal/native/traceback_test.mock_tmpl +++ b/internal/native/traceback_test.mock_tmpl @@ -1,5 +1,5 @@ -// +build !race,amd64,go1.16,!go1.23 +// +build !race,amd64,go1.16,!go1.24 // Code generated by Makefile, DO NOT EDIT. diff --git a/internal/rt/base64_amd64.go b/internal/rt/base64_amd64.go index cbbe346f5..263bc592f 100644 --- a/internal/rt/base64_amd64.go +++ b/internal/rt/base64_amd64.go @@ -1,4 +1,4 @@ -// +build amd64,go1.17,!go1.23 +// +build amd64,go1.17,!go1.24 package rt diff --git a/internal/rt/base64_compat.go b/internal/rt/base64_compat.go index 5d5c10cdb..791f79355 100644 --- a/internal/rt/base64_compat.go +++ b/internal/rt/base64_compat.go @@ -1,4 +1,4 @@ -// +build !amd64 !go1.17 go1.23 +// +build !amd64 !go1.17 go1.24 package rt diff --git a/loader/funcdata_go123.go b/loader/funcdata_go123.go new file mode 100644 index 000000000..a50cd364f --- /dev/null +++ b/loader/funcdata_go123.go @@ -0,0 +1,118 @@ +//go:build go1.23 && !go1.24 +// +build go1.23,!go1.24 + +/* + * Copyright 2021 ByteDance Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package loader + +import ( + `unsafe` + `github.com/bytedance/sonic/loader/internal/rt` +) + +const ( + _Magic uint32 = 0xFFFFFFF1 +) + +type moduledata struct { + pcHeader *pcHeader + funcnametab []byte + cutab []uint32 + filetab []byte + pctab []byte + pclntable []byte + ftab []funcTab + findfunctab uintptr + minpc, maxpc uintptr // first func address, last func address + last func size + + text, etext uintptr // start/end of text, (etext-text) must be greater than MIN_FUNC + noptrdata, enoptrdata uintptr + data, edata uintptr + bss, ebss uintptr + noptrbss, enoptrbss uintptr + covctrs, ecovctrs uintptr + end, gcdata, gcbss uintptr + types, etypes uintptr + rodata uintptr + gofunc uintptr // go.func.* is actual funcinfo object in image + + textsectmap []textSection // see runtime/symtab.go: textAddr() + typelinks []int32 // offsets from types + itablinks []*rt.GoItab + + ptab []ptabEntry + + pluginpath string + pkghashes []modulehash + + // This slice records the initializing tasks that need to be + // done to start up the program. It is built by the linker. + inittasks []unsafe.Pointer + + modulename string + modulehashes []modulehash + + hasmain uint8 // 1 if module contains the main function, 0 otherwise + bad bool // module failed to load and should be ignored + + gcdatamask, gcbssmask bitVector + + typemap map[int32]*rt.GoType // offset to *_rtype in previous module + + next *moduledata +} + +type _func struct { + entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart + nameOff int32 // function name, as index into moduledata.funcnametab. + + args int32 // in/out args size + deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any. + + pcsp uint32 + pcfile uint32 + pcln uint32 + npcdata uint32 + cuOffset uint32 // runtime.cutab offset of this function's CU + startLine int32 // line number of start of function (func keyword/TEXT directive) + funcID uint8 // set for certain special runtime functions + flag uint8 + _ [1]byte // pad + nfuncdata uint8 // + + // The end of the struct is followed immediately by two variable-length + // arrays that reference the pcdata and funcdata locations for this + // function. + + // pcdata contains the offset into moduledata.pctab for the start of + // that index's table. e.g., + // &moduledata.pctab[_func.pcdata[_PCDATA_UnsafePoint]] is the start of + // the unsafe point table. + // + // An offset of 0 indicates that there is no table. + // + // pcdata [npcdata]uint32 + + // funcdata contains the offset past moduledata.gofunc which contains a + // pointer to that index's funcdata. e.g., + // *(moduledata.gofunc + _func.funcdata[_FUNCDATA_ArgsPointerMaps]) is + // the argument pointer map. + // + // An offset of ^uint32(0) indicates that there is no entry. + // + // funcdata [nfuncdata]uint32 +} diff --git a/loader/funcdata_latest.go b/loader/funcdata_latest.go index 6029f204d..b19fa6b7d 100644 --- a/loader/funcdata_latest.go +++ b/loader/funcdata_latest.go @@ -1,5 +1,5 @@ -// go:build go1.18 && !go1.23 -// +build go1.18,!go1.23 +// go:build go1.18 && !go1.24 +// +build go1.18,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/loader/loader_latest.go b/loader/loader_latest.go index 57e7c1e79..cc2d7ac00 100644 --- a/loader/loader_latest.go +++ b/loader/loader_latest.go @@ -1,4 +1,4 @@ -// +build go1.17,!go1.23 +// +build go1.17,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/rfc_test.go b/rfc_test.go index f49c7909d..90fbc83b5 100644 --- a/rfc_test.go +++ b/rfc_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 package sonic_test diff --git a/scripts/go_latest.sh b/scripts/go_latest.sh index 689af4d8c..86f3037e2 100755 --- a/scripts/go_latest.sh +++ b/scripts/go_latest.sh @@ -1,20 +1,11 @@ #!/bin/bash TAG=$1 -git clone https://github.com/golang/go.git $TAG +git clone -b release-branch.$TAG https://github.com/golang/go.git $TAG cd $TAG/src -git checkout -b build/$TAG $TAG ./all.bash -cd .. -export GOROOT=$PWD -export PATH=$GOROOT/bin:$PATH -go version -cd .. -GOMAXPROCS=4 go test -v -race . -GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast -GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/internal/encoder -GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/internal/decoder + diff --git a/scripts/go_latest_test.yml b/scripts/go_latest_test.yml deleted file mode 100644 index 758e8854e..000000000 --- a/scripts/go_latest_test.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Unit Test Go-Latest-Linux-X64 - -on: push - -jobs: - build: - runs-on: [self-hosted, X64] - steps: - - name: Clear repository - run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE - - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.20.6 - - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: script - run: | - sh ./scripts/go_latest.sh master - diff --git a/search_test.go b/search_test.go index 9dd9799b7..a17a4c6e6 100644 --- a/search_test.go +++ b/search_test.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2021 ByteDance Inc. diff --git a/sonic.go b/sonic.go index 83b016054..72e568d48 100644 --- a/sonic.go +++ b/sonic.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.17 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.17,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2021 ByteDance Inc.