Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cwd configuration in Run: Start Without Debugging not respected #918

Closed
zpv opened this issue Nov 13, 2020 · 7 comments
Closed

cwd configuration in Run: Start Without Debugging not respected #918

zpv opened this issue Nov 13, 2020 · 7 comments
Assignees
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Milestone

Comments

@zpv
Copy link

zpv commented Nov 13, 2020

Describe the bug

https://github.com/zpv/cwd-test

With the following launch configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/cmd/app/main.go",
            "env": {},
            "args": []
        }
    ]
}

the cwd property is respected in Debug mode, but is seemingly ignored when Start without Debugging is used.

Running this project will panic as it tries to read the file in cmd/app instead of the workspace root.

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.15.2 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.51.1
      e5a624b788d92b8d34d1392e4c4d9789406efe8f
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.18.1
  • Run go env to get the go development environment details
    • GO111MODULE=""
      GOARCH="amd64"
      GOBIN=""
      GOCACHE="/Users/steven/Library/Caches/go-build"
      GOENV="/Users/steven/Library/Application Support/go/env"
      GOEXE=""
      GOFLAGS=""
      GOHOSTARCH="amd64"
      GOHOSTOS="darwin"
      GOINSECURE=""
      GOMODCACHE="/Users/steven/go/pkg/mod"
      GONOPROXY=""
      GONOSUMDB=""
      GOOS="darwin"
      GOPATH="/Users/steven/go"
      GOPRIVATE=""
      GOPROXY="https://proxy.golang.org,direct"
      GOROOT="/usr/local/Cellar/go/1.15.2/libexec"
      GOSUMDB="sum.golang.org"
      GOTMPDIR=""
      GOTOOLDIR="/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64"
      GCCGO="gccgo"
      AR="ar"
      CC="clang"
      CXX="clang++"
      CGO_ENABLED="1"
      GOMOD=""
      CGO_CFLAGS="-g -O2"
      CGO_CPPFLAGS=""
      CGO_CXXFLAGS="-g -O2"
      CGO_FFLAGS="-g -O2"
      CGO_LDFLAGS="-g -O2"
      PKG_CONFIG="pkg-config"
      GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1g/dlx_p3_j02gcs41jxpyy38s80000gn/T/go-build059177566=/tmp/go-build -gno-record-gcc-switches -fno-common"
@suzmue suzmue added the Debug Issues related to the debugging functionality of the extension. label Nov 13, 2020
@suzmue suzmue self-assigned this Nov 13, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/270437 mentions this issue: src/goDebug: respect user cwd debug configuration in noDebug

@zpv
Copy link
Author

zpv commented Nov 21, 2020

Thank you @suzmue! 🙏

@dipling78
Copy link

Unfortunately this fix doesn't properly work on GOOS=windows, a file named out cannot be executed: src/debugAdapter/goDebug.ts:486. It would have to be named out.exe instead.

Trace output when hitting Ctrl+F5 (Run Without Debugging) on Win10 with golang.go v0.19.0:

[...]
Current working directory: c:\Users\Myself\go\src\hello_world
Building: C:\Program Files\go\bin\go.exe build -o=C:\Users\Myself\AppData\Local\Temp\out .
Build process exiting normally null
Current working directory: c:\Users\Myself\go\src\hello_world
Running: C:\Users\Myself\AppData\Local\Temp\out
Process exiting with code: -4058 signal: false
[...]

@suzmue
Copy link
Contributor

suzmue commented Dec 2, 2020

Thanks for filing this issue @mkilzer78! Will get this fixed

I think this failure should be showing up in the long tests as well.

@suzmue suzmue reopened this Dec 2, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/274872 mentions this issue: src/goDebug: fix noDebug mode for windows

gopherbot pushed a commit that referenced this issue Dec 2, 2020
On windows, the executable file has to have '.exe' extension. Add the
extension when building the program in noDebug mode.

Updates #918

Change-Id: Icddf6c2dced50f885e1dd27fc685a14ea54d52e1
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/274872
Trust: Suzy Mueller <suzmue@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@suzmue suzmue added this to the v0.19.1 milestone Dec 2, 2020
@suzmue suzmue closed this as completed Dec 2, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/276214 mentions this issue: src/goDebug: fix noDebug mode for windows

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/276214 mentions this issue: [release] src/goDebug: fix noDebug mode for windows

gopherbot pushed a commit that referenced this issue Dec 8, 2020
On windows, the executable file has to have '.exe' extension. Add the
extension when building the program in noDebug mode.

Updates #918

Change-Id: Icddf6c2dced50f885e1dd27fc685a14ea54d52e1
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/274872
Trust: Suzy Mueller <suzmue@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
(cherry picked from commit e2d78f1)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/276214
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Polina Sokolova <polina@google.com>
@golang golang locked and limited conversation to collaborators Dec 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants