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

cmd/cgo: simple types are sometimes replaced by their primitives #19801

Closed
pebbe opened this issue Mar 31, 2017 · 5 comments
Closed

cmd/cgo: simple types are sometimes replaced by their primitives #19801

pebbe opened this issue Mar 31, 2017 · 5 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@pebbe
Copy link
Contributor

pebbe commented Mar 31, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/wgillmer/workspace/go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/h2/5r4jrl855hddg359493d7gp00000gn/T/go-build081211722=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

go get github.com/pebbe/zmq4

What did you expect to see?

No output.

What did you see instead?

# github.com/pebbe/zmq4
../../../github.com/pebbe/zmq4/reactor.go:57: cannot use events (type State) as type int in field value
../../../github.com/pebbe/zmq4/reactor.go:57: cannot use handler (type func(State) error) as type func(int) error in field value
../../../github.com/pebbe/zmq4/reactor.go:68: cannot use props.e (type int) as type State in argument to r.p.Add
../../../github.com/pebbe/zmq4/reactor.go:187: cannot use item.Events (type State) as type int in argument to r.sockets[item.Socket].f

This package installs without errors on other platforms.

For details, see this bug report: pebbe/zmq4#97
Also see the question in golang-nuts: https://groups.google.com/forum/#!topic/golang-nuts/VHGqqmpAZDE

@ianlancetaylor ianlancetaylor changed the title Simple types are sometimes replaces by their primitives cmd/cgo: simple types are sometimes replaces by their primitives Mar 31, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.9 milestone Mar 31, 2017
@bradfitz bradfitz changed the title cmd/cgo: simple types are sometimes replaces by their primitives cmd/cgo: simple types are sometimes replaced by their primitives Mar 31, 2017
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 2, 2017
@hirochachacha
Copy link
Contributor

This is not reproducible to me.

go version go1.8 darwin/amd64
go version go1.8.3 darwin/amd64

@ianlancetaylor
Copy link
Contributor

I can't recreate it either. And the error frankly makes no sense. The reported error is:

../../../github.com/pebbe/zmq4/reactor.go:57: cannot use events (type State) as type int in field value
../../../github.com/pebbe/zmq4/reactor.go:57: cannot use handler (type func(State) error) as type func(int) error in field value

Line 57 of reactor.go is:

	r.sockets[soc] = &reactor_socket{e: events, f: handler}

The type reactor_socket is defined earlier in that same file as:

type reactor_socket struct {
	e State
	f func(State) error
}

So the error message is saying that in reactor_socket fields that clearly use the type State are instead using the type int. That makes no sense. The file reactor.go doesn't even use cgo.

@pebbe The zmq4 issue suggests that you are relaying a bug report from someone else. Can you recreate this problem yourself?

On the e-mail thread I asked for the diff of the work directories. Thanks for providing that. I looked through it earlier, and again just now, but I see nothing that could cause this kind of error. As noted the error is not in types created by cgo anyhow.

@pebbe
Copy link
Contributor Author

pebbe commented May 27, 2017

I can't reproduce the problem since I'm not on Darwin. All I know about it is in this issue: pebbe/zmq4#97

@ianlancetaylor
Copy link
Contributor

So right now it appears that nobody can reproduce the problem. And I don't understand how it could happen. We're not going to be able to fix this without a test case.

@ianlancetaylor ianlancetaylor added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Jun 2, 2017
@ianlancetaylor ianlancetaylor modified the milestones: Go1.10, Go1.9 Jun 2, 2017
@ianlancetaylor ianlancetaylor removed their assignment Jun 2, 2017
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jul 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants