Skip to content

wrong text output at DEBUG CONSOLE #2131

Open
@kzhui125

Description

@kzhui125

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.17.6 darwin/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.8.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.65.2
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.32.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    go: /usr/local/bin/go: go version go1.17.6 darwin/amd64
    go-outline: /Users/zm/go/bin/go-outline (version: v0.0.0-20210608161538-9736a4bde949 built with go: go1.17.6)
    gotests: /Users/zm/go/bin/gotests (version: v1.6.0 built with go: go1.17.6)
    gomodifytags: /Users/zm/go/bin/gomodifytags (version: v1.16.0 built with go: go1.17.6)
    impl: /Users/zm/go/bin/impl (version: v1.1.0 built with go: go1.17.6)
    goplay: /Users/zm/go/bin/goplay (version: v1.0.0 built with go: go1.17.6)
    dlv: /Users/zm/go/bin/dlv (version: v1.8.1 built with go: go1.17.6)
    staticcheck: /Users/zm/go/bin/staticcheck (version: v0.2.2 built with go: go1.17.6)
    gopls: /Users/zm/go/bin/gopls (version: v0.8.1 built with go: go1.17.6)

Share the Go related settings you have added/edited

"go.delveConfig": {
    "apiVersion": 2,
    "showGlobalVariables": true
  },
  "go.formatTool": "goimports",
  "go.useLanguageServer": true,
  "go.testFlags": [
    "-v"
  ],
  "go.languageServerFlags": [
    "-rpc.trace",
  ],
  "[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true,
    },
  },
  "[go.mod]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true,
    },
  },
  "gopls": {
    "usePlaceholders": true,
    "completeUnimported": true
  },
"go.toolsManagement.autoUpdate": true,

Describe the bug

bug: the output in DEBUG CONSOLE is not the same as the content of test.txt

expected: the output should be the content of test.txt

Steps to reproduce the behavior:

  1. go mod init gtest
  2. write main.go
package main

import (
	"fmt"
	"io/ioutil"
)

func main() {
	data, err := ioutil.ReadFile(`/path/to/test.txt`)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(data))
	fmt.Println("end")
}
  1. set breakpoint at line fmt.Println("end")
  2. debug main.go
  3. debug console: output is not expected as the same as test.txt

Screenshots or recordings

the test.txt is attacted:

test.txt

go

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebugIssues related to the debugging functionality of the extension.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions