kitex icon indicating copy to clipboard operation
kitex copied to clipboard

Failed to detect current executable: cannot find executable path

Open felix021 opened this issue 1 year ago • 3 comments

Describe the bug

kitex fails when codegen.

To Reproduce

Steps to reproduce the behavior:

  1. A new M3 Macbook with go1.21 installed
  2. Prepare a new directory with go.mod initialized
  3. Install kitex and thriftgo with go install @latest
  4. Run kitex on the idl:

$ kitex -module echo -service echo echo.thrift Failed to detect current executable: cannot find executable path

image

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.

image

felix021 avatar Jun 18 '24 15:06 felix021

Same case for go1.20 and kitex 0.9.1

felix021 avatar Jun 18 '24 15:06 felix021

get

HeyJavaBean avatar Jun 19 '24 02:06 HeyJavaBean

我翻了一下 golang,可能和 executablePath 的获取有关 image

你试试直接执行 os.Executable() ?以及用更低版本的 golang 试试(比如 1.19)

HeyJavaBean avatar Jun 19 '24 07:06 HeyJavaBean