a is an integer and cannot hold a string.
fmt.Scanln() reads the first character of the input, decides that this is not a number, and stops further reading.
The program then prints the value of
a (which is still 0) and exits.
The shell now takes over the remaining input as a new command, fails to find a command by that name, and complains.
Tip: never ignore the errors that a function returns.
fmt.Scanln() has two return values: the number of successfully read characters, and an error value. (Type go doc fmt.Scanln
in the shell for info aboutScanln`.)
n, err := fmt.Scanln(&a) and print out the error if it is nil. This way you can quickly see what went wrong.