Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: Scanln returns "unexpected newline" error on an empty line #9666
Scanln stops scanning at the newline (or EOF) but otherwise scans space-separated values. There are 0 space-separated values on an empty line (since arbitrary many "empty strings" makes no sense). If you call fmt.Scanln() just like this (w/ no arguments), then you won't get an error since you're not expecting anything. If you call it with more than one argument, than you have to provide an appropriate number of non-empty input values which are space-separated. If you want an empty string, provide an empty string "".
This is working as intended.
Next time, please leave a complete example so the context is clear (a reader has to guess the arguments you may or may not have provided).
Also, next time, please don't use the issue tracker to ask questions - that's what the go-nuts mailing list is for.