Skip to content

Detected a bug while using Print function in fmt package #34740

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

Closed
ariain opened this issue Oct 7, 2019 · 1 comment
Closed

Detected a bug while using Print function in fmt package #34740

ariain opened this issue Oct 7, 2019 · 1 comment

Comments

@ariain
Copy link

ariain commented Oct 7, 2019

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

$ go version = go version go1.12.9 windows/amd64

Does this issue reproduce with the latest release?

I think so yes....

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

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Jaina\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Jaina\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Jaina\AppData\Local\Temp\go-build778068474=/tmp/go-build -gno-record-gcc-switches

What did you do?

fmt.Print(temp.data, ' ')
here temp.data in an int value...

What did you expect to see?

let temp.data is 10
I see 3210

What did you see instead?

Expected output is "10 " ( except "" ) not 3210...

@bradfitz
Copy link
Contributor

bradfitz commented Oct 7, 2019

This is working correctly.

See https://blog.golang.org/constants.

Your ' ' is a number, not a string.

@bradfitz bradfitz closed this as completed Oct 7, 2019
@golang golang locked and limited conversation to collaborators Oct 6, 2020
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