fix: sonic on arm64 (#4234)

This commit is contained in:
Yash 2025-05-11 20:04:09 +05:30 committed by GitHub
parent 67c9d4ee11
commit 7a1b655074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ jobs:
[ [
"", "",
"-tags nomsgpack", "-tags nomsgpack",
'--ldflags="-checklinkname=0" -tags "sonic avx"', '--ldflags="-checklinkname=0" -tags sonic',
"-tags go_json", "-tags go_json",
"-race", "-race",
] ]

View File

@ -84,10 +84,10 @@ go build -tags=jsoniter .
go build -tags=go_json . go build -tags=go_json .
``` ```
[sonic](https://github.com/bytedance/sonic) (you have to ensure that your cpu supports avx instruction.) [sonic](https://github.com/bytedance/sonic)
```sh ```sh
$ go build -tags="sonic avx" . $ go build -tags=sonic .
``` ```
### Build without `MsgPack` rendering feature ### Build without `MsgPack` rendering feature

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/gin-gonic/gin
go 1.23.0 go 1.23.0
require ( require (
github.com/bytedance/sonic v1.13.1 github.com/bytedance/sonic v1.13.2
github.com/gin-contrib/sse v1.1.0 github.com/gin-contrib/sse v1.1.0
github.com/go-playground/validator/v10 v10.26.0 github.com/go-playground/validator/v10 v10.26.0
github.com/goccy/go-json v0.10.2 github.com/goccy/go-json v0.10.2

4
go.sum
View File

@ -1,5 +1,5 @@
github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g= github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT style // Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !jsoniter && !go_json && !(sonic && avx && (linux || windows || darwin) && amd64) //go:build !jsoniter && !go_json && !(sonic && (linux || windows || darwin))
package json package json

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT style // Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build sonic && avx && (linux || windows || darwin) && amd64 //go:build sonic && (linux || windows || darwin)
package json package json