I couldn't figure out the root cause of the problem. What I observed was if there're multiple inputs, e.g., type in username and then type in password etc.. The Go program will hang on the second input. Giving it a small time interval solves the hanging problem. I'll keep this in mind and see if I could fix it as I move forward. I'll adjust the comment to avoid confusion.