go-lang-plugin-org/go-lang-idea-plugin

Scanln fails to stop for input during debug on Linux

Closed this issue · 3 comments

  • Plugin version (or commit hash):
    0.13.1914

  • IDE name and version:
    IntelliJ IDEA community

  • Go version;
    1.7.3

  • Java version:
    1.8.0_111

  • OS name and version:
    Ubuntu 16.04.1 LTS

  • What are you trying to do?
    Trying to get program to stop for input on fmt.Scanln

  • What would you expect to happen?
    Execution to wait for input when Scanln is reached

  • What happens?
    Execution continues and program acts like empty string/white space was entered

This is really simple example I created to test the Scanln issue as I used to get it on Windows. Funny story: on windows it now works (same IDE, plugin and go versions) but fails under Linux.

Code:

package main

import "fmt"

func main() {
var x string
fmt.Println("Type smth:")
fmt.Scanln(&x)
fmt.Println("Typed:", x)
}

This works if simply executed either in IDE or using simple 'go build' from command line, but fails when debuger is attached.

Tested configuration:

  1. GOROOT and GOPATH on separate partition mounted into /media/usr
    ide

  2. Default root and go path in /home/usr
    default

Ok did something most obvious and try to handle the error. Looks like the Scanln when called through Delve throws EOF -> this is not thrown when program is simply run, without debuging. Happens both through the IDE and directly in command line:

IDE
latest

CMD
cmdln

This looks like delve issue. Moved to https://github.com/derekparker/delve/issues/679.

Closed.

Thank you for investigation. Indeed it looks like delve's issue