I've found some sort of similar problems in c, but the solutions are c specific. package main
Here is a minimum working example of the code
import "fmt"
func main() {
var mode string
var base int
for {
fmt.Printf("(Base) [-->]: ")
fmt.Scanf("%d", &base)
fmt.Printf("(Mode) [-->]: ")
fmt.Scanf("%s", &mode)
}
}
My issue is that after asking for the mode input, it doesn't wait for input, and immediately skips to the beginning of the loop. Something like this:
(Base) [-->]: 5
(Mode) [-->]: (Base) [-->]:
5as the input forbaseandfooformode, without the behaviour you described. Are you sure you, on your machine, can reproduce the error with the code in the question? and with the same input? If you really do get the weird behaviour then try checking the errors returned fromScanf.