Skip to content

cmd/vet: does not understand multiple keys in key:value pair in struct tag #43083

@myitcv

Description

@myitcv

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

$ go version
go version devel +e10c94af26 Mon Dec 7 02:31:33 2020 +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/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/myitcv/gostuff/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel +e10c94af26 Mon Dec 7 02:31:33 2020 +0000"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/tmp.Y0bBClLQls/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-build628121616=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go vet .

-- go.mod --
module mod.com

go 1.16
-- main.go --
package main

type MyStruct struct {
	Field1 string `json bson xml form:"field_1,omitempty" other:"value"`
}

What did you expect to see?

No error (because this example is taken from #40281 (comment))

What did you see instead?

./main.go:4:2: struct field tag `json bson xml form:"field_1,omitempty" other:"value"` not compatible with reflect.StructTag.Get: bad syntax for struct tag pair

Marking as a release-blocker because I believe it to be one.

Despite raising this issue, I share the concerns raised by @rogpeppe in #40281 (comment).

cc @rsc @mvdan @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions