kitex
kitex copied to clipboard
Failed to detect current executable: cannot find executable path
Describe the bug
kitex fails when codegen.
To Reproduce
Steps to reproduce the behavior:
- A new M3 Macbook with go1.21 installed
- Prepare a new directory with go.mod initialized
- Install kitex and thriftgo with go install @latest
- Run kitex on the idl:
$ kitex -module echo -service echo echo.thrift Failed to detect current executable: cannot find executable path
Expected behavior
Project scaffold correcctly generated.
Screenshots
user@userdeMacBook-Pro:echo $ go version
go version go1.21.11 darwin/arm64
user@userdeMacBook-Pro:echo $ thriftgo -version
thriftgo 0.3.13
user@userdeMacBook-Pro:echo $ kitex -version
v0.10.0
user@userdeMacBook-Pro:echo $ kitex -module echo -service echo echo.thrift
Failed to detect current executable: cannot find executable path
Kitex version:
v0.10.0
Environment:
The output of go env.
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/user/Library/Caches/go-build'
GOENV='/Users/user/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/user/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/user/go/go1.21'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/user/go/go1.21/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.11'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/user/code/kitex-project/demo/echo/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/_p/7cjc7csn26x0s0yws6ym39mw0000gn/T/go-build2572489021=/tmp/go-build -gno-record-gcc-switches -fno-common'
Additional context
Seems to be golang's problem: os.executablePath should have been set by runtime as stated in the comment.
Same case for go1.20 and kitex 0.9.1
get
我翻了一下 golang,可能和 executablePath 的获取有关
你试试直接执行 os.Executable() ?以及用更低版本的 golang 试试(比如 1.19)