xhd2015 / xgo

All-in-one go testing library
MIT License
322 stars 19 forks source link

Goland Xgo shadow #244

Open shubham-dogra-s1 opened 2 months ago

shubham-dogra-s1 commented 2 months ago

Hi, I am trying to use xgo with goland. Generated path using xgo shadow and prepended the path to PATH env variable for the test configuration but still goland using the default go installation.

/usr/local/go/bin/go tool test2json -t /Users/shubham.dogra/Library/Caches/JetBrains/GoLand2024.1/tmp/GoLand/___1TestHeathServer_1__http_request_error_in_internal_clients.test -test.v -test.paniconexit0 -test.run ^\QTestHeathCheckServer\E$/^\Q1:_http_request_error\E$
WARNING: xgo toolchain: failed to detect xgo version, consider install xgo: go install github.com/xhd2015/xgo/cmd/xgo@latest
note: this message can be turned off by setting XGO_CHECK_TOOLCHAIN_VERSION=false

I have verified that the first entry in path environment is the path generated by xgo shadow PATH: /Users/shubham.dogra/.xgo/shadow:/usr/local/go/bin:/Users/shubham.dogra/go/bin

Am i missing something?

shubham-dogra-s1 commented 2 months ago

May be I am wrong but currently we only invoke xgo for [[ $cmd = build || $cmd = test || $cmd = run but if you see the command generated by goland it is using /usr/local/go/bin/go tool

xhd2015 commented 2 months ago

It seems Goland always uses absolute path /usr/local/go/bin/go instead of go, which bypasses the shadow path.

For this scenario, I think xgo shadow needs to support absolute path replacement.

Let me test on my PC first.