I'd like to be able to see the stdout and stderr when using delve to debug go programs. Is this possible? How would I do this?
Asked
Active
Viewed 1,083 times
1 Answers
1
You do not need to do anything.
Delve by default prints the stdout and stderr to its console. I have tried this in MacOS ElCapitan delve version 0.11.0-alpha
Have a main.go in the right subdir in your GOPATH
package main
import "fmt"
import "os"
func main() {
fmt.Fprintf(os.Stderr, "Writing something to stderr\n")
fmt.Fprintf(os.Stdout, "Writing something to stdout\n")
}
Then run the delve in the same dir as the main.go
$ dlv debug
Type 'help' for list of commands.
(dlv) restart
Process restarted with PID 70964
(dlv) c
Writing something to stderr
Writing something to stdout
Process 70964 has exited with status 0
(dlv)

Hakan Baba
- 1,897
- 4
- 21
- 37