Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: Scanf rejects \r\n at end of line on Windows #51346

Closed
msh2050 opened this issue Feb 24, 2022 · 1 comment
Closed

fmt: Scanf rejects \r\n at end of line on Windows #51346

msh2050 opened this issue Feb 24, 2022 · 1 comment

Comments

@msh2050
Copy link

msh2050 commented Feb 24, 2022

What version of Go are you using (go version)?

$ go version
go1.17.7

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (v)?

windows 11 / amd64

go env Output
$ go env
set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=####\AppData\Local\go-build
set GOENV=####\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=####\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=####
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=###\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=####\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.7
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\msh20\AppData\Local\Temp\go-build1493363615=/tmp/go-build -gno-record-gcc-switches
same as in [this close issue](https://github.com//issues/5391)

What did you do?

package main

import (
    "fmt"
    "strconv"
)

func main() {

    for {
        name := ""
        fmt.Print("Enter : ")
        fmt.Scanf("%s", &name)
        b1, _ := strconv.ParseBool(name)
        fmt.Printf("%T, %v\n", b1, b1)
    }

}

this happens on vscode in windows 11 and Windows-terminal with (Powershell, cmd, and bash) and the same issue with cmder terminal. this will not happen with wsl and with MobaXterm terminal, I did not make further checking with other terminals.
I added question in stackoverflow before opening this issue

What did you expect to see?

Enter : true
bool, true 
Enter :

What did you see instead?

Enter : true
bool, true 
Enter : bool, false
Enter :
@seankhliao
Copy link
Member

Duplicate of #23562

@seankhliao seankhliao marked this as a duplicate of #23562 Feb 24, 2022
@golang golang locked and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants