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/compile: error positions are verbose in cgo-using files #20628

Closed
aclements opened this issue Jun 9, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@aclements
Copy link
Member

commented Jun 9, 2017

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

go version devel +11c61eb6af Fri Jun 9 04:38:37 2017 +0000 linux/amd64

What did you do?

Build a file that imports "C" and has compile errors in it.

What did you expect to see?

Go 1.8 printed out succinct error messages that were the same whether or not the package imported "C". Eg.,

$ go build
./model.go:89: invalid operation: i < n (mismatched types int and C.uint)

What did you see instead?

At tip, the error positions are much more verbose and include a reference to a temporary path generated by the cgo tool that doesn't even exist after the go tool exits:

$ go build
./model.go:89[/tmp/go-build298567481/github.com/aclements/go-z3/z3/_test/_obj_test/model.cgo1.go:110:25]: invalid operation: i < n (mismatched types int and _Ctype_uint)

/cc @griesemer @mdempsky

@ALTree

This comment has been minimized.

Copy link
Member

commented Jun 9, 2017

Introduced in 2a5cf48.

@odeke-em

This comment has been minimized.

Copy link
Member

commented Jun 12, 2017

Repro for a test when fixing it:

package main

import "C"

func main() {
	n := C.uint(10)
	i := 1
	if i < n {
	}
}
@griesemer

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2017

This may be due to a regex not matching anymore when the position information contains column info. It may be as easy as disabling the printing of column info when invoking the compiler.

@griesemer griesemer self-assigned this Jun 12, 2017

@griesemer griesemer added this to the Go1.9 milestone Jun 12, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Jun 13, 2017

CL https://golang.org/cl/45612 mentions this issue.

@gopherbot gopherbot closed this in 4c028e5 Jun 13, 2017

@golang golang locked and limited conversation to collaborators Jun 13, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.