Skip to content

Cannot scan command inputs  #121

@etiennepericat

Description

@etiennepericat

If i'm launching my app with fresh, i'm not able to scan user input from the command line. (tested with bufio and others go scanners)

This bunch of code (from https://developers.google.com/gmail/api/quickstart/go) :

	authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline)
	fmt.Printf("Go to the following link in your browser then type the "+
		"authorization code: \n%v\n", authURL)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	err := scanner.Err()
	if err != nil {
		log.Fatalf("Unable to retrieve authorization code: %v", err)
	}
	authCode := scanner.Text()
	fmt.Printf("Auth code: %s\n", authCode)

will never stop (it should stop at "Scan()" on line 5)

If I'm launching my app without fresh this code works.

Do someone knows how can I fix this ?

Thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions