cloudwego / cloudwego/hertz

Thrift files with different namespaces but the same ending cannot be used for hz update.

Open
#1,028 3 comments 1 reaction 1 assignee Claimed by @FGYFFFF View on GitHub
enhancement
Dominant language
Go
Stars
7.4k
Forks
643
Avg merge
14h 5m
Merged PRs (30d)
2

Description

**Describe the bug**

There are currently two thrift files, with the namespaces respectively:

`namespace go admin.b`

`namespace go b`

When using the "hz update" command to update at this time, an error will occur.

```bash
plugin thriftgo_gen_hertz returns error: exit status 2, cause:
[WARN] stdout:

[WARN] stderr:
[ERROR]/Users/ozlinex/go/pkg/mod/github.com/cloudwego/hertz/cmd/hz@v0.7.1/thrift/plugin.go:162: generate package failed: update register for biz/router/technician/register.go failed, err: the router(technician.Register(r)
) has been registered

execute plugin 'hertz' failed: exit status 4

make: *** [gen] Error 4
```

**To Reproduce**

Steps to reproduce the behavior:
1. Create two different thrift files with namespaces similar to the previous ones.
2. Use "hz update" on two files. such as `hz update -idl ./idl/admin/technician.thrift`,

**Expected behavior**

If this check is blocked, it can actually generate `b.register(r)` and `admin_b.register(r)`, without encountering any issues elsewhere.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Hertz version:**

0.7.1

**Environment:**

```bash
❯ go env
GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/ozlinex/Library/Caches/go-build'
GOENV='/Users/ozlinex/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/ozlinex/go/pkg/mod'
GONOPROXY='github.com/west2-online'
GONOSUMDB='github.com/west2-online'
GOOS='darwin'
GOPATH='/Users/ozliinex/go'
GOPRIVATE='github.com/west2-online'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.5/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.5/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/ozlinex/projects/repair/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/d4/t6l8w_nn5dd1b81nnyg629d40000gn/T/go-build3271880908=/tmp/go-build -gno-record-gcc-switches -fno-common
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.