-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
What version of Go, VS Code & VS Code Go extension are you using?
go: go1.15.4 windows/amd64
VSCode: 1.51.0
Extension: 0.18.1
Env:
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\coev\AppData\Local\go-build
set GOENV=C:\Users\coev\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\coev\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\coev\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\coev\Documents\Development\eprom\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\coev\AppData\Local\Temp\go-build248616018=/tmp/go-build -gno-record-gcc-switches
Share the Go related settings you have added/edited
{
"go.useLanguageServer": true
}
(Note: the above is strange, because in the extension settings UI the option "Go: Use Language Server" is NOT selected?? However toggling this setting does not change the behaviour of the bug)
Describe the bug
Starting with a go file that includes a section of code commented out as a block with /* and */, when I save the file VSCode alters the file before saving corrupting the code. This does not happen if the code does not contain the block comment.
Expected behaviour: Save the code as displayed
Steps to reproduce the behavior:
- Set up VSCode with the Go 0.18.1 extension (bug reproduced both with and without other extensions loaded)
- Rename the test case file "vscode_go_save_bug_before_saving.go.txt" to remove the ".txt" extension and open it
- Save the file (File->Save or ctrl-S)
- The file is damaged BEFORE save, so it is corrupted both on disk and on screen in the editor. The result is shons in file vscode_go_save_bug_after_saving.go.txt (again, remove the .txt extension)
vscode_go_save_bug_before_saving.go.txt
vscode_go_save_bug_after_saving.go.txt