4

I have a syntax error in write-file.go

├── go.mod
└── write-file
    └── write-file.go

I run write-file.go via shift-F9, and see this output in vscode:

Starting: /home/guettli/go/bin/dlv dap --check-go-version=false --listen=127.0.0.1:42097 --log-dest=3 from /home/guettli/projects/hello-go/write-file
DAP server listening at: 127.0.0.1:42097
Build Error: go build -o /home/guettli/projects/hello-go/write-file/__debug_bin -gcflags all=-N -l .
# exampe.com/hello/write-file
./write-file.go:7:29: cannot use "üöä" (untyped string constant) as []byte value in argument to os.WriteFile (exit status 2)

I click on ./write-file.go:7:29: to jump to this location, but vscode does not find this file.

I guess the current-working-directory of vscode is the parent directory of write-file.

Is this a bug, feature or am I doing something wrong?

I want to be able to click on build error messages and jump to the corresponding line.

The error (cannot use "üöä" (untyped string constant) as []byte value) is just an example and not relavant for this question.

guettli
  • 25,042
  • 81
  • 346
  • 663
  • Do you want to fix that bug or do you want to fix VSCode? – lupz Jun 13 '22 at 06:22
  • @lupzI updated the question: The error (cannot use "üöä" (untyped string constant) as []byte value) is just an example and not relavant for this question. – guettli Jun 13 '22 at 06:46
  • Does this work for other errors? – lupz Jun 13 '22 at 06:49
  • 1
    @lupz If I add `panic("foo")`, then jumping to the corresponding line works, since I see an absolute path in the output. But for build errors, there is always a relative path, and then ctrl-click does not work. – guettli Jun 13 '22 at 06:59

0 Answers0