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: fmt.Print is inconsistent adding spaces around user-defined string type #16529

Closed
z-rui opened this issue Jul 28, 2016 · 2 comments
Closed

Comments

@z-rui
Copy link

z-rui commented Jul 28, 2016

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

go version go1.6.3 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="x86_64-pc-linux-gnu-gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"

3.What did you do?

package main

import "fmt"

type myString string

func main() {
    s := myString("+")
    fmt.Print(1, s, 1)
}

4.What did you expect to see?
either 1+1 or 1 + 1
5.What did you see instead?

1+ 1
@nhooyr
Copy link
Contributor

nhooyr commented Jul 29, 2016

Cannot reproduce this locally on a recently built 1.7 from master. However, I can on play.golang.org.

I suspect it has already been fixed somewhere.

@ghost
Copy link

ghost commented Jul 29, 2016

This was fixed by 33c0ef2

@robpike robpike closed this as completed Jul 29, 2016
@golang golang locked and limited conversation to collaborators Jul 29, 2017
@mikioh mikioh changed the title fmt.Print is inconsistent adding spaces around user-defined string type fmt: fmt.Print is inconsistent adding spaces around user-defined string type Aug 3, 2017
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

4 participants