Skip to content

fakexml: doesn't terminate checking type X *X #1202

@fho

Description

@fho

The following code causes staticcheck v0.2.2 (staticcheck ./...) to hang forever.
staticcheck v0.2.1 terminates quickly on the same code.

package main

import "fmt"

type OperationHeaders struct {
	OperationCode *OperationCode `xml:"operationCode"`
}

type OperationCode *OperationCode

func main() {
	fmt.Println("hello")
}

If the struct tag xml:"operationCode" in OperationHeaders is omitted, staticcheck 0.2.2 also terminates.

A type definition like this was generated by an xml code generator.
I don't know when such a type definition could make sense.
Go 1.17 and 1.18 compile the code without any issues.


$ staticcheck --version
staticcheck 2021.1.2 (v0.2.2)

$ staticcheck -debug.version
staticcheck 2021.1.2 (v0.2.2)

Compiled with Go version: go1.17.8
Main module:
	honnef.co/go/[email protected] (sum: h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk=)
Dependencies:
	github.com/BurntSushi/[email protected] (sum: h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=)
	golang.org/x/[email protected] (sum: h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=)
	golang.org/x/[email protected] (sum: h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=)
	golang.org/x/[email protected] (sum: h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=)
	golang.org/x/[email protected] (sum: h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=)
$ go version
go version go1.17.8 linux/amd64
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fho/.cache/go-build"
GOENV="/home/fho/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/fho/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/fho/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/t/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-build66536980=/tmp/go-build -gno-record-gcc-switches"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions