Closed as not planned
Closed as not planned
Description
What version of Go are you using (go version
)?
$ go version go version go1.20.4 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="/home/otfried/bin" GOCACHE="/home/otfried/.cache/go-build" GOENV="/home/otfried/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/otfried/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/otfried/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.20.4" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="0" GOMOD="/home/otfried/gospace/rg6server/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2527071798=/tmp/go-build -gno-record-gcc-switches"
What did you do?
package main
import (
"encoding/json"
"fmt"
)
func main() {
var bytes = []byte({"user": "magnus", "rating": "3856"}
)
type Animal struct {
user string
rating string
}
var one_animal Animal
err := json.Unmarshal(bytes, &one_animal)
if err != nil {
fmt.Println("error:", err)
}
fmt.Printf("%+v", one_animal)
}
What did you expect to see?
{User:magnus Rating:3856}
What did you see instead?
{user: rating:}