kitex_gen is not generated due to the -use option
- Dominant language
- Go
- Stars
- 8k
- Forks
- 918
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 7
Description
**Describe the bug**
Generate code with "-use" flag failed, error message: "kitex_gen is not generated due to the -use option"
**To Reproduce**
Steps to reproduce the behavior:
1. Create a local module _sample_module_ which may contains several services inside of it.
2. cd into /cmd/service_a/ folder, exec command: "kitex -v -module sample_module -service service_a ../../kitex_gen/service_a ../../idl/service_a.thrift"
3. Observe whether the related codes and folders are generated.
4. kitex_gen folder was not generated, seen error message.
**Expected behavior**
Expected the project to be generated as the following layout:
> .
> ├── client // contain the client code
> ├── cmd // contain the code of several services
> │ ├── api // contain service apis code
> │ ├── service_a
> │ │ ├── script // generated by kitex
> │ │ │ └── bootstrap.sh // bootstrap.sh generated by kitex
> │ │ ├── service // contain service code
> │ │ ├── build.sh // build.sh generated by kitex
> │ │ ├── go.mod // go.mod generated by kitex
> │ │ ├── handler.go // handler.go generated by kitex
> │ │ └── main.go // main.go generated by kitex
> │ └── service_b
> ├── kitex_gen // -use flag to specify the import path
> │ ├── service_a // generated by kitex
> │ └── service_b // generated by kitex
> ├── idl // project idls for different services
> ├── pkg // dependencies
> ├── go.mod // generated by kitex
> └── go.sum // generated by kitex
**Screenshots**
N/A
**Kitex version:**
v0.4.2
**Environment:**
The output of `go env`:
> GO111MODULE=""
> GOARCH="arm64"
> GOBIN=""
> GOCACHE="/Users/danielwong/Library/Caches/go-build"
> GOENV="/Users/danielwong/Library/Application Support/go/env"
> GOEXE=""
> GOEXPERIMENT=""
> GOFLAGS=""
> GOHOSTARCH="arm64"
> GOHOSTOS="darwin"
> GOINSECURE=""
> GOMODCACHE="/Users/danielwong/Dev/go/pkg/mod"
> GONOPROXY=""
> GONOSUMDB=""
> GOOS="darwin"
> GOPATH="/Users/danielwong/Dev/go"
> GOPRIVATE=""
> GOPROXY="https://proxy.golang.org,direct"
> GOROOT="/opt/homebrew/Cellar/go/1.19.2/libexec"
> GOSUMDB="sum.golang.org"
> GOTMPDIR=""
> GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.2/libexec/pkg/tool/darwin_arm64"
> GOVCS=""
> GOVERSION="go1.19.2"
> GCCGO="gccgo"
> AR="ar"
> CC="clang"
> CXX="clang++"
> CGO_ENABLED="1"
> GOMOD="xxxxx"
> 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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ql/05dw_j5x4pg52d5dfl4kbqgr0000gn/T/go-build2202954618=/tmp/go-build -gno-record-gcc-switches -fno-common"
**Additional context**
verbose log:
> go: creating new go.mod: module sample_module
> go: to add module requirements and sums:
> go mod tidy
> thriftgo -v -o kitex_gen -g go:naming_style=golint,ignore_initialisms,gen_setter,gen_deep_equal,compatible_names,package_prefix=../../kitex_gen/service_a -p kitex=/Users/danielwong/Dev/go/bin/kitex:"Verbose=true,GenerateMain=true,GenerateInvoker=false,Version=v0.4.2,NoFastAPI=false,ModuleName=sample_module,ServiceName=service_a,Use=../../kitex_gen/service_a,IDLType=thrift,Includes=,ThriftOptions=naming_style=golint;ignore_initialisms;gen_setter;gen_deep_equal;compatible_names,ProtobufOptions=,IDL=../../idl/service_a.thrift,OutputPath=/Users/danielwong/Dev/XXX/sample_module/cmd/service_a,PackagePrefix=../../kitex_gen/service_a,CombineService=false,CopyIDL=false,Features=" ../../idl/service_a.thrift
> [INFO] Generating: "go"
> [INFO] option: naming_style=golint
> [INFO] option: ignore_initialisms=
> [INFO] option: gen_setter=
> [INFO] option: gen_deep_equal=
> [INFO] option: compatible_names=
> [INFO] option: package_prefix=../../kitex_gen/service_a
> [INFO] Processing ../../idl/service_a.thrift
> [INFO] Got 2 contents
> [INFO] Run plugin "kitex"
> [WARN] option:naming_style=golint
> [WARN] option:ignore_initialisms=
> [WARN] option:gen_setter=
> [WARN] option:gen_deep_equal=
> [WARN] option:compatible_names=
> [WARN] option:package_prefix=../../kitex_gen/service_a
> [WARN] /Users/danielwong/Dev/XXX/sample_module/cmd/service_a/script/bootstrap.shexists. Skipped.
> [WARN] Write/Users/danielwong/Dev/XXX/sample_module/cmd/service_a/build.sh
> [WARN] Write/Users/danielwong/Dev/XXX/sample_module/cmd/service_a/main.go
> [WARN] Write/Users/danielwong/Dev/XXX/sample_module/cmd/service_a/handler.go
> kitex_gen is not generated due to the -use option
Contributor guide
Assessment
This issue has not been assessed yet.