cloudwego / cwgo Goto Github PK
View Code? Open in Web Editor NEWAn all-in-one code generation tool for CloudWeGo
License: Apache License 2.0
An all-in-one code generation tool for CloudWeGo
License: Apache License 2.0
如题
Is your feature request related to a problem? Please describe.
The code for gorm initialisation is placed in the db command.
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.
Is your feature request related to a problem? Please describe.
There is a need for mongodb code generation.
Describe the solution you'd like
Code generation with mongodb support
Describe alternatives you've considered
Adding commands to support mongo code generation
Additional context
cwgo目前模版 生成biz/service 存在问题如下:
1)list getDemo(1:i64 entID , 2:i64 userID , 3:byte clientType),
生成 thrift entIDint64userID
中间没有","分隔
2 生成 test 对于 int string 类型
生成代码为 &int64{}
这是 go语言不支持的语法
3)生成rpc客户端
对于返回结果为 string的客户端
demo_default.go
if err != nil {
klog.CtxErrorf(ctx, "UpdateApp call failed,err =%+v", err)
return nil, err
}
永远是return nil, err,实际需要为 return "",nil
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Documentation is now sketchy
Describe the solution you'd like
Improving Cwgo Documentation
Describe alternatives you've considered
Improving Cwgo Documentation
Additional context
None
Describe the bug
在非gopath下使用cwgo命令添加-module失效
To Reproduce
Steps to reproduce the behavior:
cwgo server .....
的命令Expected behavior
生成成功
Screenshots
Kitex version:
v0.4.4
Environment:
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/acs/.cache/go-build"
GOENV="/home/acs/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/acs/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/acs/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/snap/go/10030"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/10030/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/acs/workspace/projects/cwgo_test/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3863773717=/tmp/go-build -gno-record-gcc-switches"
Additional context
none
Describe the bug
在proto中定义rpc方法,当参数变动时,再次调用
cwgo server -serverice=myservice -type RPC -idl=idl/myservice.proto -modelu test/myservice
没有生成新的struct
kitex:v0.5.0
cwgo: v0.0.1
go: v1.20.2
Is your feature request related to a problem? Please describe.
The current default log print configuration performs poorly
Describe the solution you'd like
Support for asynchronous log printing and removal of stdout
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
I want to use brew to install cwgo, and it need a release tag, please help
Is your feature request related to a problem? Please describe.
Currently, cwgo's rpc and http commands have a lot of parameters, so passing the commands through a file configuration can simplify the user's operation.
Describe the solution you'd like
support for adding configuration files to pass parameters to cwgo
Describe alternatives you've considered
Additional context
Describe the solution you'd like
cwgo provide a way for providing both rpc & http APIs in one server.
Describe alternatives you've considered
Organically combine kitex and hertz to distribute different protocol processing logic through protocol sniffing at the protocol layer.
Users generates a server that supports different protocols at the same time through a set of IDL.
Additional context
No extra copy during the entire process.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Describe the bug
A clear and concise description of what the bug is.
(1) 正常运行main.go时, 与conf处于同一目录层级. 能获取正常的配置文件conf/test/conf.yaml
(2) 在biz/service/xx_test.go 里面进行初始化的时候, 不能获取正确的conf/test/conf.yaml路径
需要在initConf里面动态获取配置文件的路径
func initConf() {
wd, _ := os.Getwd()
wd = strutil.Before(wd, "cw_test")
// 获取绝对路径
prefix := wd + "cw_test/conf"
...
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.
Is your feature request related to a problem? Please describe.
currently, the platform code error handling is a little bit chaos, therefore it is difficult for end users to locate the source of errors from logs
Describe the solution you'd like
specify error code or error type for each error case, and print more detailed log (set appropriate log level) as much as possible.
(also welcome providing alternative solutions)
Additional context
Add any other context or screenshots about the feature request here.
cwgo目前模版 生成biz/service 存在问题如下:
1)list getDemo(1:i64 entID , 2:i64 userID , 3:byte clientType),
生成 thrift entIDint64userID
中间没有","分隔
2 生成 test 对于 int string 类型
生成代码为 &int64{}
这是 go语言不支持的语法
3)生成rpc客户端
对于返回结果为 string的客户端
demo_default.go
if err != nil {
klog.CtxErrorf(ctx, "UpdateApp call failed,err =%+v", err)
return nil, err
}
永远是return nil, err,实际需要为 return "",nil
Is your feature request related to a problem? Please describe.
A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Currently the templates only support local template configuration, which makes it very inconvenient to use and impossible for the user to copy the template file once for each project
Describe the solution you'd like
support use git as template-path
Additional context
Describe the bug
A clear and concise description of what the bug is.
This method gets the path dependent on the go binary
https://github.com/cloudwego/cwgo/blame/44092d34148e073aaaf9c1ad3a22d79c098ec44d/tpl/hertz/server/standard/layout.yaml#L201
To Reproduce
eg dockerfile below
https://github.com/bnkamalesh/golang-dockerfile/blob/master/Dockerfile-alpine
In order to reduce the size of the docker image, it is generally built using the go image and then run using the ordinary alpine image. Relying on go will cause panic.
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.
Describe the bug
Crash when type is HTTP and module not set
A clear and concise description of what the bug is.
To Reproduce
syntax = "proto3";
package biz.hello;
// The greeting service definition.
option go_package = "biz/hello";
message Request {
string message = 1;
}
message Response {
string message = 1;
}
service Echo {
rpc Echo (Request) returns (Response) {}
}
➜ cwgo server -service=Host -type HTTP -I idl -idl idl/hello/hello.proto
plugin protoc_gen_hertz returns error: exit status 1, cause:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x100adb498]
goroutine 1 [running]:
github.com/cloudwego/hertz/cmd/hz/protobuf.(*Plugin).Run.func1()
/Users/rogers/go/pkg/mod/github.com/cloudwego/hertz/cmd/[email protected]/protobuf/plugin.go:86 +0x28
github.com/cloudwego/hertz/cmd/hz/protobuf.(*Plugin).Run(0x14000121eb8)
/Users/rogers/go/pkg/mod/github.com/cloudwego/hertz/cmd/[email protected]/protobuf/plugin.go:115 +0x518
github.com/cloudwego/hertz/cmd/hz/app.PluginMode()
/Users/rogers/go/pkg/mod/github.com/cloudwego/hertz/cmd/[email protected]/app/app.go:130 +0x9c
main.main()
/Users/rogers/go/pkg/mod/github.com/cloudwego/[email protected]/cwgo.go:32 +0x20
--hertz_out: protoc-gen-hertz: Plugin failed with status code 2.
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.
Describe the bug
A clear and concise description of what the bug is.
protobuf IDL generate failed
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
cwgo client --type HTTP -I=idl --idl=idl/hello/hello.proto --service service2
hz client -I=idl --idl=idl/hello/hello.proto
Add any other context about the problem here.
Is your feature request related to a problem? Please describe.
Generate DB code based on IDL to reduce the amount of user-written code and reuse structures.
Describe the solution you'd like
Code to support DB generation based on IDL
Describe alternatives you've considered
None
Additional context
None
Is your feature request related to a problem? Please describe.
Currently there is only one MVC layout template and need to add the-clean-architecture layout template
Describe the solution you'd like
refer to https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html and add template
Additional context
以前用kitex生成的代码,能自动调整成mvc layout结构吗?
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
using "server --type http" can be generated in "out_dir" path,
but "server --type rpc" is still generated in current path
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
.
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/lib/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/lib/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/lib/go/go-1.19.5"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/go-1.19.5/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/mnt/e/Coding/Project/cwgo/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1878667886=/tmp/go-build -gno-record-gcc-switches"
Additional context
Add any other context about the problem here.
Is your feature request related to a problem? Please describe.
Currently cwgo wraps kitex and hz, if kitex and hz change, how does cgwo update the functionality.
Describe the solution you'd like
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Describe the bug
missing closing quota in kitex_info.yaml.
To Reproduce
Steps to reproduce the behavior:
cwgo server --type RPC --idl ./idl/pms.thrift --service pms --module gitlab.dth.com/pms
Expected behavior
generate correct code in kitex_info.yaml
Screenshots
Kitex version:
v0.5.2
Environment:
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/zhangyt/Library/Caches/go-build"
GOENV="/Users/zhangyt/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rainstop_3/go/pkg/mod"
GONOPROXY="gitlab.dth.com"
GONOSUMDB="gitlab.dth.com"
GOOS="darwin"
GOPATH="/Users/rainstop_3/go"
GOPRIVATE="gitlab.dth.com"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.9"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/rainstop_3/code/dth/pms/go.mod"
GOWORK="/Users/rainstop_3/code/dth/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9x/xf__ts7154v52yfr42tkb1nm0000gn/T/go-build231264519=/tmp/go-build -gno-record-gcc-switches -fno-common"
Additional context
Add any other context about the problem here.
cwgo/tpl/hertz/server/standard/package.yaml
Lines 30 to 46 in 0051712
Should "bind error" be the default status code 400, and should "service error" be the default 500?
Describe the bug
Generated GPRC rpc client code error
To Reproduce
Steps to reproduce the behavior:
Generating GPRC rpc client code with cwgo
Expected behavior
The generated code is normal
Screenshots
Kitex version:
Environment:
Additional context
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.
the quest follows:
i use cwgo generate a standard dictionary;then i create a go test file in biz/dal
dictionary to test if the mysql connection work,
but how can i change the environment of unit test, it always print error message of panic: open conf/test/conf.yaml: no such file or directory
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
client code generation supports template parameters, which it does not currently support
Describe the solution you'd like
client code generation support for template parameters
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
cwgo之前版本可不可以 打一个tag
I would like to know what exactly should be passed to the --registry of the service registration component when using this command?
cwgo server --type HTTP --registry
Describe the bug
cwgo init always return error could not find field matching protoSearch
A clear and concise description of what the bug is.
To Reproduce
syntax = "proto3";
package biz.hello;
// The greeting service definition.
option go_package = "biz/hello";
message Request {
string message = 1;
}
message Response {
string message = 1;
}
service Echo {
rpc Echo (Request) returns (Response) {}
}
➜ cwgo init
? Select generate type server
? Select service type RPC
? Please input service name hello
? Please input module hello
? Please input idlpath idl/hello.proto
? Please input proto search path if exists, space as separator idl
2023/02/24 17:15:52.190868 cwgo.go:41: [Error] could not find field matching protoSearch
cwgo server works fine.
➜ cwgo server -service=hello -type RPC -idl=idl/hello.proto -module hello -I idl
go: creating new go.mod: module hello
go: to add module requirements and sums:
go mod tidy
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
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.
Is your feature request related to a problem? Please describe.
The access log middleware has poorer performance
Describe the solution you'd like
hope to optimise the performance of access_log
Describe alternatives you've considered
refer to fiber access_log
Additional context
Is your feature request related to a problem? Please describe.
Generating a single test is rather rudimentary
Describe the solution you'd like
Adjusting the template for single tests
Describe alternatives you've considered
it's a good idea to refer to https://www.cloudwego.io/zh/docs/hertz/tutorials/basic-feature/unit-test/
Additional context
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
Generate api docs for api server(hertz/kitex), maybe integrating protoc/thrift plugin during the generation phase.
Describe alternatives you've considered
Hertz may cooperate with swagger middleware. Kitex not sure for now...
Additional context
使用cwgo生成kitex框架
cwgo server -service=platform -type RPC -idl=demo.thrift --module test
如果handler方法存在 则不会进行更新。 是否判断存在问题。
并且无法生成 kitex_gen文件,想要生成thrift文件还需删除handler才可以
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
None
Additional context
None
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.