Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
reusee opened this issue Aug 23, 2021 · 6 comments
Closed

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

reusee opened this issue Aug 23, 2021 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@reusee
Copy link

reusee commented Aug 23, 2021

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
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 23, 2021
@gopherbot gopherbot added this to the Unreleased milestone Aug 23, 2021
@seankhliao
Copy link
Member

Note this fails on 1.17 but works on tip
cc @matloob

@toothrot toothrot added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 24, 2021
@zimmski
Copy link
Contributor

zimmski commented Aug 29, 2021

We just upgraded from 1.16.7 to 1.17. Everything works great except for the problem described here. This is especially annoying since it pops up in Visual Studio Code during working on (seemingly) unrelated packages. So there are now always "problems" listed even though everything is fine in ones repository.

@zimmski
Copy link
Contributor

zimmski commented Sep 2, 2021

Is this issue maybe a duplicate of #47854 ?

@ianlancetaylor
Copy link
Contributor

What is reporting the errors that you see? If it is gopls or go vet or some analyzer, then I agree that this is a dup of #47854. Thanks.

@reusee
Copy link
Author

reusee commented Sep 9, 2021

The errors were produced from go run of the above program. I can confirm that it's fixed in release-branch.go1.17 branch.

@reusee reusee closed this as completed Sep 9, 2021
@zimmski
Copy link
Contributor

zimmski commented Sep 9, 2021

Can confirm that this is gone for me with Go 1.17.1

@golang golang locked and limited conversation to collaborators Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants