What version of Go are you using (go version)?
$ go version
go version go1.11.4 darwin/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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jc/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jc/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pf/_mdvc42j193c4tf6kgfm80gcss_jqd/T/go-build565539251=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
For example, if I have the following package:
package xml
import (
"encoding/xml"
"io"
)
type XMLMap map[string]string
type XMLMapEntry struct {
XMLName xml.Name
Value string `xml:",chardata"`
}
// UnmarshalXML
func (m *XMLMap) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
v := XMLMap{}
for {
var e XMLMapEntry
err := dec.Decode(&e)
if err == io.EOF {
break
}
if err != nil {
return err
}
v[e.XMLName.Local] = e.Value
}
*m = v
return nil
}
What did you expect to see?
go vet ./...
< no output>
What did you see instead?
$ go vet ./...
./xml.go:16: method UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error should have signature UnmarshalXML(*xml.Decoder, xml.StartElement) error
even if I try to alias encoding/xml import I still get same error.
If instead I have the same code, but rename package:
package something
...
<same code as before>
go vet ./...
< no output>
go vet doesn't seem to handle correctly if code is in package also named xml.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
For example, if I have the following package:
What did you expect to see?
What did you see instead?
even if I try to alias
encoding/xmlimport I still get same error.If instead I have the same code, but rename package:
go vet doesn't seem to handle correctly if code is in package also named xml.