Skip to content

x/tools/go/packages: C.getaddrinfo type check error on linux #47903

@reusee

Description

@reusee

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

$ go version
go version go1.17 linux/amd64

Does this issue reproduce with the latest release?

yes

runs fine on 1.16

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/reus/.cache/go-build"
GOENV="/home/reus/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/reus/pkg/mod"
GONOPROXY="github.com/reusee/*"
GONOSUMDB="github.com/reusee/*"
GOOS="linux"
GOPATH="/home/reus"
GOPRIVATE="github.com/reusee/*"
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"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/shm/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-build2654214782=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.17 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.17
uname -sr: Linux 5.13.12-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.33.

What did you do?

package main

import (
        "golang.org/x/tools/go/packages"
)

func main() {
        pkgs, err := packages.Load(
                &packages.Config{
                        Mode: 0xffff,
                },
                "net",
        )
        if err != nil {
                panic(err)
        }
        if packages.PrintErrors(pkgs) > 0 {
                return
        }
}

What did you expect to see?

no error

What did you see instead?

/usr/lib/go/src/net/cgo_resnew.go:24:22: cannot use err (variable of type bool) as error value in return statement: missing method Error
/usr/lib/go/src/net/cgo_unix.go:109:17: cannot use C.getaddrinfo(nil, (*C.char)(unsafe.Pointer(&cservice[0])), hints, &res) (value of type bool) as error value in assignment: missing method Error
/usr/lib/go/src/net/cgo_unix.go:163:17: cannot use C.getaddrinfo((*C.char)(unsafe.Pointer(&h[0])), nil, &hints, &res) (value of type bool) as error value in assignment: missing method Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions