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

fmt: fmt.Print is inconsistent adding spaces around user-defined string type #16529

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

Comments

@z-rui
Copy link

@z-rui 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 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.

@rmdashrf
Copy link

@rmdashrf rmdashrf commented Jul 29, 2016

This was fixed by 33c0ef2

@robpike robpike closed this 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.