cmd/compile: provide line number for cgo directive error (fix a TODO)

Also: Remove double "go:" prefix in related error message.

Fixes #18882.

Change-Id: Ifbbd8e2f7529b43f035d3dbf7ca4a91f212bc6b6
Reviewed-on: https://go-review.googlesource.com/36121
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2017-02-01 15:17:32 -08:00
parent e546b295b8
commit c1363b2d91
6 changed files with 32 additions and 12 deletions

View file

@ -4,7 +4,10 @@
package gc
import "testing"
import (
"cmd/internal/src"
"testing"
)
func eq(a, b []string) bool {
if len(a) != len(b) {
@ -69,8 +72,9 @@ func TestPragcgo(t *testing.T) {
{`go:cgo_ldflag "a rg"`, "cgo_ldflag 'a rg'\n"},
}
var p noder
for _, tt := range tests {
got := pragcgo(tt.in)
got := p.pragcgo(src.NoPos, tt.in)
if got != tt.want {
t.Errorf("pragcgo(%q) = %q; want %q", tt.in, got, tt.want)
continue