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: inconsistency on #v printing of byte array #44391

Closed
tkiraly opened this issue Feb 18, 2021 · 4 comments
Closed

fmt: inconsistency on #v printing of byte array #44391

tkiraly opened this issue Feb 18, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Unfortunate

Comments

@tkiraly
Copy link

tkiraly commented Feb 18, 2021

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

$ go version
1.15.8

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tki/.cache/go-build"
GOENV="/home/tki/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tki/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="bitbucket.loriot.io/*,gitlab.com/loranna/*,gitlab.com/loriot/*,simulated.network/*,gitlab.com/simulated/*"
GOOS="linux"
GOPATH="/home/tki/go"
GOPRIVATE=""
GOPROXY="http://192.168.11.11:3000,https://grey.tkiraly.hu,https://proxy.golang.org,direct"
GOROOT="/snap/go/7013"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/7013/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/tki/src/gitlab.com/tkiraly/join-server/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build155910042=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/Kmu-21IzT4O

What did you expect to see?

i expect consistency like this:
[]byte{0x1, 0x2, 0x3, 0x4}
&[]byte{0x1, 0x2, 0x3, 0x4}

OR

[]uint8{0x1, 0x2, 0x3, 0x4}
&[]uint8{0x1, 0x2, 0x3, 0x4}

What did you see instead?

[]byte{0x1, 0x2, 0x3, 0x4}
&[]uint8{0x1, 0x2, 0x3, 0x4}

@seankhliao seankhliao changed the title inconsistency on #v printing of byte array fmt: inconsistency on #v printing of byte array Feb 18, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 18, 2021
@ianlancetaylor
Copy link
Contributor

CC @robpike

This may have been introduced by https://golang.org/cl/7205047 for #4685. I don't know whether it's worth fixing.

@martisch
Copy link
Contributor

another similar issue: #14830
changing the behaviour now will break tests and therefore it might not be worth the churn to change.

If changed at all its likely warranting to consider a more generic change of always printing uint8 instead of byte and the same for other aliased types.

I would leave it as is.

@robpike
Copy link
Contributor

robpike commented Feb 25, 2021

I agree that it's unfortunate but would cause too many broken tests to be worth changing.

@seankhliao
Copy link
Member

Closing as unfortunate

@golang golang locked and limited conversation to collaborators Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Unfortunate
Projects
None yet
Development

No branches or pull requests

6 participants