ch3nnn / webstack-go

基于Gin框架的网址导航项目,具备完整的前后台。您可以拿来制作自己平日收藏的网址导航。
http://47.94.59.82:9999/
MIT License
218 stars 61 forks source link

本地编译及容器编译时graphql发生错误,提示cannot use err (variable of type error) as *gqlerror.Error value in argument to errcode.Set: need type assertion #91

Open xiaoquqi opened 1 month ago

xiaoquqi commented 1 month ago

直接进行Go编译

go version go1.22.1 linux/amd64

执行go build,出现错误

# github.com/99designs/gqlgen/graphql/executor
/home/ubuntu/go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:73:22: cannot use validator.VariableValues(e.es.Schema(), rc.Operation, params.Variables) (value of type error) as *gqlerror.Error value in assignment: need type assertion
/home/ubuntu/go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:174:15: cannot use err (variable of type error) as *gqlerror.Error value in argument to errcode.Set: need type assertion
/home/ubuntu/go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:175:29: cannot use err (variable of type error) as *gqlerror.Error value in array or slice literal: need type assertion

容器编译异常

sudo docker-compose build
#0 15.78 go: downloading github.com/antchfx/xpath v1.2.3
#0 15.78 go: downloading github.com/andybalholm/cascadia v1.2.0
#0 15.84 go: downloading golang.org/x/mod v0.17.0
#0 16.08 go: downloading github.com/go-openapi/jsonpointer v0.19.5
#0 16.13 go: downloading github.com/go-openapi/jsonreference v0.19.5
#0 16.15 go: downloading github.com/go-openapi/swag v0.19.14
#0 16.81 go: downloading github.com/PuerkitoBio/purell v1.1.1
#0 16.81 go: downloading github.com/mailru/easyjson v0.7.6
#0 17.14 go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
#0 17.21 go: downloading github.com/josharian/intern v1.0.0
#0 33.70 # golang.org/x/tools/go/types/objectpath
#0 33.70 /go/pkg/mod/golang.org/x/tools@v0.21.1-0.20240508182429-e35e4ccd0d2d/go/types/objectpath/objectpath.go:397:10: meth.Origin undefined (type *types.Func has no field or method Origin)
#0 33.70 note: module requires Go 1.19
#0 39.65 # github.com/99designs/gqlgen/graphql/executor
#0 39.65 /go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:73:22: cannot use validator.VariableValues(e.es.Schema(), rc.Operation, params.Variables) (value of type error) as type *gqlerror.Error in assignment:
#0 39.65    need type assertion
#0 39.65 /go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:174:15: cannot use err (variable of type error) as type *gqlerror.Error in argument to errcode.Set:
#0 39.65    need type assertion
#0 39.65 /go/pkg/mod/github.com/99designs/gqlgen@v0.14.0/graphql/executor/executor.go:175:29: cannot use err (variable of type error) as type *gqlerror.Error in array or slice literal:
#0 39.65    need type assertion
------
failed to solve: process "/bin/sh -c cd /go/src/github.com/ch3nnn/webstack-go && go build  ." did not complete successfully: exit code: 2
ch3nnn commented 1 month ago

已解决, 拉取最新提交