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.
proposal: add *input* builtin function #40194
Hello. I don't know whether this is the correct place for this proposal.
input would be a convenience function for a quick interaction with the user from the command line, similar to Python's
I think its implementation could be this simple:
Example of use
Thanks. This seems like a function that could easily live in a third party library. The standard library doesn't have any package or set of functions for interactive I/O. https://golang.org/doc/faq#x_in_std
(Note that your suggested implementation is not safe, as the buffered
After some tries with Scan, Scanf and Scanln I come to the conclussion to use reader := bufio.NewReader(os.Stdin) as a global.
Something like this
which works if os.Stdin is the output from another program and is harmless if os.Stdin is a tty.
So the implementation of input would be
And excuse me for this, there is a problem that happens with string.TrimRight though
The output is
The output is being stepped on, which don't happen without strings.TrimRight or any other strings functions
I attach the files for the reproducible example.
Yes El mié., 15 jul. 2020 23:16, Ian Lance Taylor <firstname.lastname@example.org> escribió:…
@dotoscat <https://github.com/dotoscat> Do you still want to propose a change to the standard library? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#40194 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AECOFU75DYRONEWDDWU7AA3R3YMCPANCNFSM4OY2KEXA> .