cloudwego / kitex-examples Goto Github PK
View Code? Open in Web Editor NEWExamples for Kitex.
License: Apache License 2.0
Examples for Kitex.
License: Apache License 2.0
Describe the bug
Can't compile KiteX examples code with Go 1.20
Details: I followed the instructions https://www.cloudwego.io/docs/kitex/getting-started/. When trying to compile the hello
server & client code, I got the error from another package's go version check:
panic("Unsupported Go version. Supported versions are: 1.15, 1.16, 1.17, 1.18, 1.19") (no value) used as value
To Reproduce
cd kitex-examples/basic/server && go run .
Expected behavior
Server code runs.
Screenshots
Kitex version:
Repo: https://github.com/cloudwego/kitex-examples.git
Branch: main
SHA: 4331b96
Environment:
package main
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/foo/Library/Caches/go-build"
GOENV="/Users/foo/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/foo/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/foo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/foo/fooWorkspace/goKitexExamples/kitex-examples/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/h2/qd6vtkhn59dd5yzk3s4w0mbm0000gn/T/go-build3190407640=/tmp/go-build -gno-record-gcc-switches -fno-common"
Additional context
N/A
能不能提供一个稍微完整点的示例项目呀、也更方便没接触过的人快速熟悉kitex呀。比如一个包含 鉴权、用户、文章三个模块的小示例。
Describe the bug
根据readme描述,使用dockerfile对项目进行编译的时候,执行到编译项目时报go版本低于1.17无法完成编译
To Reproduce
Steps to reproduce the behavior:
docker build -t kitex-examples .
#12 86.98 /go/pkg/mod/golang.org/x/[email protected]/unix/syscall.go:83:16: undefined: unsafe.Slice
#12 86.98 /go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:2271:9: undefined: unsafe.Slice
#12 86.98 /go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
#12 86.98 /go/pkg/mod/golang.org/x/[email protected]/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice
#12 86.98 note: module requires Go 1.17
------
executor failed running [/bin/sh -c go build -o hello-client ./hello/client]: exit code: 2
Expected behavior
将dockerfile内的镜像版本选为golang:1.18.10-alpine
可以编译通过
Screenshots
If applicable, add screenshots to help explain your problem.
Kitex version:
$ kitex --version
v0.5.2
如题
kitex如何指定生成service的路径,从而类似easy_note中的目录结构一样。使用常规的kitex -service demo demo.thrift只能生成这样的目录结构
.
├── build.sh // 服务的构建脚本,会创建一个名为 output 的目录并生成启动服务所需的文件到里面
├── handler.go // 用户在该文件里实现 IDL service 定义的方法
├── kitex_gen // IDL 内容相关的生成代码
│ ├── base // base.thrift 的生成代码
│ │ ├── base.go // thriftgo 的产物,包含 base.thrift 定义的内容的 go 代码
│ │ └── k-base.go // kitex 在 thriftgo 的产物之外生成的代码
│ └── demo // demo.thrift 的生成代码
│ ├── demo.go // thriftgo 的产物,包含 demo.thrift 定义的内容的 go 代码
│ ├── k-demo.go // kitex 在 thriftgo 的产物之外生成的代码
│ └── demoservice // kitex 为 demo.thrift 里定义的 demo service 生成的代码
│ ├── demoservice.go // 提供了 client.go 和 server.go 共用的一些定义
│ ├── client.go // 提供了 NewClient API
│ └── server.go // 提供了 NewServer API
├── main.go // 程序入口
└── script // 构建脚本
└── bootstrap.sh // 服务的启动脚本,会被 build.sh 拷贝至 output 下
而easy_note中的代码结构中通过kitex生成的script/*、main.go和handler.go与kitex_gen不在同一个目录下,这是怎么做到的,是自己复制的吗,那这样每次都需要自己手动修改handler.go中的包名很麻烦啊
netpoll不支持windows,请问如何进行替换。另外请问是否有支持windows的计划?
诉求:
The primary goal of this proposal is to implement a demo API Gateway on Hertz which accepts HTTP requests encoded in JSON format and uses the Generic-Call feature of Kitex to translate these requests into Thrift binary format requests. The API Gateway will then forward the request to one of the backend RPC servers discovered from the registry center.
You're encouraged to post your implementation here for others' reference.
Template:
Project Name:
Authors: [feel free to mention your github id, email, school/company, and/or any other information you'd like to provide]
Github: [url]
Documentation: [url]
Description: [brief introduction on your project]
`
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection.go:59:18: undefined: OnRequest
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:30:2: undefined: netFD
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:41:19: undefined: barrier
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:42:19: undefined: barrier
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:48:20: cannot use &connection{} (value of type *connection) as type Connec
tion in variable declaration:
*connection does not implement Connection (missing LocalAddr method)
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:299:32: undefined: Conn
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\netpoll_options.go:80:14: undefined: OnPrepare
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\netpoll_options.go:81:14: undefined: OnConnect
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\netpoll_options.go:82:14: undefined: OnRequest
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\netpoll_server.go:37:14: undefined: Listener
......\goPath\pkg\mod\github.com\cloudwego\[email protected]\connection_impl.go:299:32: too many errors
......\goPath\pkg\mod\github.com\choleraehyq\[email protected]\pid_go1.5_amd64.s:28: expected pseudo-register; found R13
......\goPath\pkg\mod\github.com\choleraehyq\[email protected]\pid_go1.5_amd64.s:29: expected pseudo-register; found R14
asm: assembly of ......\goPath\pkg\mod\github.com\choleraehyq\[email protected]\pid_go1.5_amd64.s failed
`
具体错误如下:
Expect the IDL file to have an extension of '.thrift'. Got 'user.proto'.
Describe the solution you'd like
Add more detail introduction in readme so that user can have a brief impression about what is this project.
Describe alternatives you've considered
concluse introduction and catalogue about sub-function
{"level":"fatal","ts":"2022-07-27T08:01:16.260Z","caller":"etcdmain/etcd.go:204","msg":"discovery failed","error":"listen tcp 127.0.0.1:2380: bind: address already in use","stacktrace":"go.etcd.io/etcd/server/v3/etcdmain.startEtcdOrProxyV2\n\t/go/src/go.etcd.io/etcd/release/etcd/server/etcdmain/etcd.go:204\ngo.etcd.io/etcd/server/v3/etcdmain.Main\n\t/go/src/go.etcd.io/etcd/release/etcd/server/etcdmain/main.go:40\nmain.main\n\t/go/src/go.etcd.io/etcd/release/etcd/server/main.go:32\nruntime.main\n\t/go/gos/go1.16.15/src/runtime/proc.go:225"}
An error occurs while I following the quick-start on the step go run .
go: github.com/cloudwego/kitex-contrib/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /opt/go/pkg/mod/cache/vcs/d2a4a1998dd9cf86d2cb6627756503b46f2d0a457aa31fe3bdec9be7f0670bcd: exit status 128:
remote: Repository not found.
fatal: repository 'https://github.com/cloudwego/kitex-contrib/' not found
Is your feature request related to a problem? Please describe.
刚刚了解到了 gorm、kitex、hertz 框架的强大之处,但它们的教程往往是孤立的,只涉及各自的单独使用。我觉得 easy_note 这个项目很适合将这三个框架串起来,但只有 quick start,而没有使用这三个框架逐渐构建出这个项目的教程。
Describe the solution you'd like
希望有这样一个教程:使用 gorm、kitex、hertz 一步一步构建出这个笔记项目,增强自身的一些自信心。
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
I tried to run the kitex-example/hello demo, and I followed the quick start doc
Output
# github.com/choleraehyq/pid
../../../Applications/Go/pkg/mod/github.com/choleraehyq/[email protected]/pid_go1.5_amd64.s:44: expected pseudo-register; found R13
../../../Applications/Go/pkg/mod/github.com/choleraehyq/[email protected]/pid_go1.5_amd64.s:45: expected pseudo-register; found R14
asm: assembly of ../../../Applications/Go/pkg/mod/github.com/choleraehyq/[email protected]/pid_go1.5_amd64.s failed
# github.com/cloudwego/frugal/internal/loader
../../../Applications/Go/pkg/mod/github.com/cloudwego/[email protected]/internal/loader/funcdata.go:32:22: undefined: _ModuleData
../../../Applications/Go/pkg/mod/github.com/cloudwego/[email protected]/internal/loader/funcdata.go:35:27: undefined: _ModuleData
../../../Applications/Go/pkg/mod/github.com/cloudwego/[email protected]/internal/loader/funcdata.go:39:16: undefined: _ModuleData
../../../Applications/Go/pkg/mod/github.com/cloudwego/[email protected]/internal/loader/funcdata.go:75:26: undefined: _ModuleData
../../../Applications/Go/pkg/mod/github.com/cloudwego/[email protected]/internal/loader/funcdata_invalid.go:27:9: panic("Unsupported Go version. Supported versions are: 1.15, 1.16, 1.17, 1.18, 1.19") (no value) used as value
Kitex version:
v0.5.1
Environment:
The output of go env
.
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/stx5/.cache/go-build"
GOENV="/home/stx5/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/stx5/Applications/Go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/stx5/Applications/Go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/stx5/goproject/kitex-examples/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 -fdebug-prefix-map=/tmp/go-build2960749202=/tmp/go-build -gno-record-gcc-switches"
Additional context
I am running this demo on wsl2
OS: Ubuntu 20.04 focal(on the Windows Subsystem for Linux)
Kernel: x86_64 Linux 5.10.102.1-microsoft-standard-WSL2
报错信息如下:
2021/10/19 18:44:38.967049 tracer.go:70: [Warn] Panic happened during tracer call. This doesn't affect the rpc call, but may lead to lack of monitor data such as metrics and logs: runtime error: invalid memory address or nil pointer dereference, goroutine 28 [running]:
runtime/debug.Stack(0xc0001a3880, 0x176ca60, 0x1d13d40)
/usr/local/opt/go/libexec/src/runtime/debug/stack.go:24 +0x9f
github.com/cloudwego/kitex/internal/stats.(*Controller).tryRecover(0xc000137710, 0x1921198, 0x1d26e48)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/cloudwego/kitex/internal/stats/tracer.go:70 +0x5b
panic(0x176ca60, 0x1d13d40)
/usr/local/opt/go/libexec/src/runtime/panic.go:965 +0x1b9
github.com/kitex-contrib/tracer-opentracing.(*commonTracer).newCommonSpan(0xc000137740, 0x1924400, 0xc0004147e0, 0x1921238, 0xc0004122a0)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/kitex-contrib/tracer-opentracing/opentracing.go:33 +0x111
github.com/kitex-contrib/tracer-opentracing.(*serverTracer).Finish(0xc000137740, 0x191c9c0, 0xc000418b10)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/kitex-contrib/tracer-opentracing/server.go:54 +0x16e
github.com/cloudwego/kitex/internal/stats.(*Controller).DoFinish(0xc000137710, 0x191c9c0, 0xc000418b10, 0x191e998, 0xc000422960, 0x0, 0x0, 0x1921198, 0x1d26e48)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/cloudwego/kitex/internal/stats/tracer.go:60 +0x130
github.com/cloudwego/kitex/pkg/remote/trans/nphttp2.(*svrTransHandler).finishTracer(0xc000418600, 0x191c9c0, 0xc000418b10, 0x191e998, 0xc000422960, 0x0, 0x0, 0x0, 0x0)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/server_handler.go:204 +0x105
github.com/cloudwego/kitex/pkg/remote/trans/nphttp2.(*svrTransHandler).OnRead.func1.1.1(0x9740008, 0xc00058e000, 0xc000418600, 0x191c9c0, 0xc000418b10, 0x191e998, 0xc000422960, 0x0, 0x0)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/server_handler.go:118 +0x248
github.com/cloudwego/kitex/pkg/remote/trans/nphttp2.(*svrTransHandler).OnRead.func1.1()
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/server_handler.go:149 +0x7bc
github.com/bytedance/gopkg/util/gopool.(*worker).run.func1.1(0xc00013ace0, 0xc00041c940)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/bytedance/gopkg/util/gopool/worker.go:68 +0x62
github.com/bytedance/gopkg/util/gopool.(*worker).run.func1(0xc00013ace0)
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/bytedance/gopkg/util/gopool/worker.go:69 +0xd2
created by github.com/bytedance/gopkg/util/gopool.(*worker).run
/Users/ellipsis/Apps/hhz_go/passport-kitex/vendor/github.com/bytedance/gopkg/util/gopool/worker.go:41 +0x3f
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
本地环境下的注册发现是可以实现的,但是打包成容器运行之后就不行了。
did go mod init and go get -u
this is in kitex-benchmark, sorry i posted in "wrong" issue. but possible to resolve here?
ubuntu@ubuntu:~/kitex-benchmark/protobuf/kitex-mux$ go build main.go
# github.com/cloudwego/kitex/pkg/utils
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:54:54: not enough arguments in call to t.tProt.WriteMessageBegin
have (string, thrift.TMessageType, int32)
want (context.Context, string, thrift.TMessageType, int32)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:57:21: not enough arguments in call to msg.Write
have (thrift.TProtocol)
want (context.Context, thrift.TProtocol)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:60:11: not enough arguments in call to t.tProt.WriteMessageEnd
have ()
want (context.Context)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:74:35: not enough arguments in call to t.tProt.ReadMessageBegin
have ()
want (context.Context)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:79:27: not enough arguments in call to exception.Read
have (thrift.TProtocol)
want (context.Context, thrift.TProtocol)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:82:12: not enough arguments in call to t.tProt.ReadMessageEnd
have ()
want (context.Context)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:88:20: not enough arguments in call to msg.Read
have (thrift.TProtocol)
want (context.Context, thrift.TProtocol)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:91:2: not enough arguments in call to t.tProt.ReadMessageEnd
have ()
want (context.Context)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:100:21: not enough arguments in call to msg.Write
have (thrift.TProtocol)
want (context.Context, thrift.TProtocol)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:114:20: not enough arguments in call to msg.Read
have (thrift.TProtocol)
want (context.Context, thrift.TProtocol)
../../../go/pkg/mod/github.com/cloudwego/[email protected]/pkg/utils/thrift.go:114:20: too many errors
https://github.com/cloudwego/kitex-examples/blob/main/tracer/server/opentracing/main.go
internal_opentracing "github.com/kitex-contrib/opentracing"
https://github.com/kitex-contrib This organization has no public repositories.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Kitex version:
Please provide the version of Kitex you are using.
Environment:
The output of go env
.
Additional context
Add any other context about the problem here.
使用kitex-examples/opentelemetry,otel-collector配置victoriametrics域名不生效,导致metrics没有指标数据
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.