Giter Site home page Giter Site logo

cwgo's People

Contributors

chaoranz758 avatar cheerioinf avatar dmwangnima avatar duslia avatar fgyffff avatar kevinwang15 avatar li-jin-gou avatar nihilism0 avatar rogerogers avatar shanestevenlei avatar skyenought avatar stellarisw avatar tanbowen03 avatar violapioggia avatar welkeyever avatar wzekin avatar zhyt1985 avatar zstone12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cwgo's Issues

optimize: merge gorm init with initialisation code

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.

cwgo生成代码模版问题

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

Feature Request: add document for plateform

Is your feature request related to a problem? Please describe.

  • plateform is not currently documented

Describe the solution you'd like

  • add document for plateform

Describe alternatives you've considered

  • None

Additional context

  • None

Feature Request: Improving Cwgo Documentation

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

在非gopath下使用cwgo命令添加-module失效

Describe the bug

在非gopath下使用cwgo命令添加-module失效

To Reproduce

Steps to reproduce the behavior:

  1. mkdir cwgo_test && cd cwgo_test
  2. go mod init cwgo_test
  3. 添加idl
  4. 輸入cwgo server .....的命令

Expected behavior

生成成功

Screenshots

image

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

更新proto 参数,重新生成代码不生效

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

Feature Request: Support for asynchronous log printing and removal of stdout

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

  • Use zap or change the way logrus is initialised

Additional context

  • The logic for these initialisations is in the cwgo template

Release Required

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

Feature Request: support for adding configuration files to pass parameters to cwgo

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

  • None

Additional context

  • None

Proposal: provide both rpc & http APIs in one server

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.

Feature Request: Generated code products support tagging

Is your feature request related to a problem? Please describe.

  • Tagging is not currently supported for code artefacts

Describe the solution you'd like

  • Generated code products support tagging

Describe alternatives you've considered

  • None

Additional context

  • None

获取conf路径的问题

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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.

Feature Request: Give a more graceful error handling in platform

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使用问题

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

Feature Request: support for specifying repo owner of generating code repo

Is your feature request related to a problem? Please describe.

  • End user need to specify repo owner of generating code repo. Currently generating code repo owner is consistent with idl repo owner

A clear and concise description of what you want to happen.

  • support for specifying repo owner of generating code repo

A clear and concise description of any alternative solutions or features you've considered.

  • None

Add any other context or screenshots about the feature request here.

image
image

Feature Request: Add Unit Tests for platform

Is your feature request related to a problem? Please describe.

  • There are currently no unit tests to ensure the robustness of the system

Describe the solution you'd like

  • Add Unit Tests for platform

Describe alternatives you've considered

  • None

Additional context

  • None

feat: support use git as template-path

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

  • It is a real user need, not a rosy vision.

It is inappropriate to rely on go after building

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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.

Crash when type is HTTP and module not set

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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.

[protobuf]: protobuf IDL generate failed

Describe the bug

A clear and concise description of what the bug is.
protobuf IDL generate failed
To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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.

Feature Request: Code to support DB generation based on IDL

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

mvc layout 调整

以前用kitex生成的代码,能自动调整成mvc layout结构吗?

option "out_dir" in "server --type rpc" not working

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.

How to synchronise changes from hertz and kitex to cwgo

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

  • No good ideas at the moment, feel free to discuss

Feature Request: Offline Dynamic Command Line, Provide Associative Tools

Is your feature request related to a problem? Please describe.

  • Based on actual user feedback, the dynamic command line is not very useful

Describe the solution you'd like

  • Offline Dynamic Command Line, Provide Associative Tools

Describe alternatives you've considered

  • none

Additional context

  • none

missing closing quota in kitex_info.yaml

Describe the bug

missing closing quota in kitex_info.yaml.

To Reproduce

Steps to reproduce the behavior:

  1. write an idl file use thrift
  2. generate code
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

image

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.

question[hertz]: default error code

if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}
{{end}}
{{if eq $MethodInfo.OutputDir "" -}}
resp,err := service.New{{$MethodInfo.Name}}Service(ctx, c).Run(&req)
if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}
{{else}}
resp,err := {{$MethodInfo.OutputDir}}.New{{$MethodInfo.Name}}Service(ctx, c).Run(&req)
if err != nil {
utils.SendErrResponse(ctx, c, consts.StatusOK, err)
return
}

Should "bind error" be the default status code 400, and should "service error" be the default 500?

Bug: Generated GPRC rpc client code error

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

  • None

Kitex version:

  • None

Environment:

  • None

Additional context

  • None

feat: -use flag 指定kitex_gen路径

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.

how to use go test command in different dictionary made by cwgo ?

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

feat: support client template

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

  • It is a real user need, not a rosy vision.

Feature Request: cwgo supports code generation capabilities

Is your feature request related to a problem? Please describe.

  • cwgo has no code generation capabilities of its own, which makes it a bit of a pain to support a lot of features.

Describe the solution you'd like

  • cwgo supports code generation capabilities

Describe alternatives you've considered

  • none

Additional context

  • none

Feature Request: support for template management for plateform

Is your feature request related to a problem? Please describe.

  • not support for template management for plateform

Describe the solution you'd like

  • support for template management for plateform

Describe alternatives you've considered

  • None

Additional context

  • None

cwgo init always return error could not find field matching protoSearch

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots
image

If applicable, add screenshots to help explain your problem.

Kitex version:
image

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.

proposal: generate API docs for API server

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生成kitex框架
cwgo server -service=platform -type RPC -idl=demo.thrift --module test
如果handler方法存在 则不会进行更新。 是否判断存在问题。
并且无法生成 kitex_gen文件,想要生成thrift文件还需删除handler才可以

Feature Request: Use furgal to reduce the amount of code for plateform

Is your feature request related to a problem? Please describe.

  • The amount of code is now very high and needs to be reduced

Describe the solution you'd like

  • Use furgal to reduce the amount of code for plateform

Describe alternatives you've considered

  • None

Additional context

  • None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.