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

net/netip: Prefix's MarshalText and String methods produce different values #50115

Closed
capnspacehook opened this issue Dec 12, 2021 · 2 comments
Closed

Comments

@capnspacehook
Copy link

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

$ go version
go version devel go1.18-766f89b5c6 Fri Dec 10 19:26:50 2021 +0000 linux/amd64

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/capnspacehook/.cache/go-build"
GOENV="/home/capnspacehook/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/capnspacehook/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/capnspacehook/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/capnspacehook/Documents/git/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/capnspacehook/Documents/git/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.18-766f89b5c6 Fri Dec 10 19:26:50 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/capnspacehook/Documents/git/go/src/go.mod"
GOWORK=""
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-build3691310336=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tested that Prefix's MarshalText and String methods produced the same values on valid addresses:

https://go.dev/play/p/5KqfR6YXCox?v=gotip

What did you expect to see?

true
"::ffff:192.168.140.255/8", "::ffff:192.168.140.255/8"

What did you see instead?

false
"::ffff:c0a8:8cff/8", "::ffff:192.168.140.255/8"

Again, I found this while working on #49367. Seems extremely similar to #50110.

@capnspacehook
Copy link
Author

CC @bradfitz

@gopherbot
Copy link

Change https://golang.org/cl/371134 mentions this issue: net/netip: make Prefix.MarshalText format 4-in-6 IPs consistently

@golang golang locked and limited conversation to collaborators Dec 12, 2022
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

2 participants