Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go project start error #1180

Open
qingyggg opened this issue Aug 28, 2024 · 4 comments
Open

go project start error #1180

qingyggg opened this issue Aug 28, 2024 · 4 comments

Comments

@qingyggg
Copy link

environment:

_GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/wen/.cache/go-build'
GOENV='/home/wen/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=' -mod='
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/wen/.gvm/pkgsets/go1.23/global/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/wen/.gvm/pkgsets/go1.23/global'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/wen/.gvm/gos/go1.23'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/wen/.gvm/gos/go1.23/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/wen/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/wen/workspace/qingyggg/storybook/server_hertz/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build671446177=/tmp/go-build -gno-record-gcc-switches'_

step1:write main.go

package main

import (
	"context"
	"github.com/cloudwego/hertz/pkg/app"
	"github.com/cloudwego/hertz/pkg/app/server"
	"github.com/cloudwego/hertz/pkg/common/utils"
	"github.com/cloudwego/hertz/pkg/protocol/consts"
)

func main() {
	h := server.Default()

	h.GET("/ping", func(ctx context.Context, c *app.RequestContext) {
		c.JSON(consts.StatusOK, utils.H{"message": "pong"})
	})

	h.Spin()
}

step2:go mod tidy,go run main.go

error console :
# command-line-arguments
link: github.com/bytedance/sonic/ast: invalid reference to encoding/json.safeSet
@github-actions github-actions bot added the invalid issue invalid issue (not related to Hertz or described in document or not enough information provided) label Aug 28, 2024
@Royal-go
Copy link

这个是1.23.0 默认开启了//go:linkname 检查,通过 -ldflags=-checklinkname=0 关闭就可以了, 以下两种方式可以解决go get -u github.com/bytedance/sonic 升级这个库到最新 或 在 go build 加上 -ldflags=-checklinkname=0 即可编译通过

@qingyggg
Copy link
Author

我把go语言版本回退到1.22就好了,希望官方改进一下 ,谢谢

Copy link

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 28, 2024
@li-jin-gou li-jin-gou removed invalid issue invalid issue (not related to Hertz or described in document or not enough information provided) stale labels Aug 29, 2024
@Duslia
Copy link
Member

Duslia commented Sep 2, 2024

这个我们最近会修复一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants