cmd/cue/cmd: fix build breakage

Need relative path.

Change-Id: Idd7db15ddc9e5034c9aa2730f25240a9d60de215
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6143
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cmd/cue/cmd/fixall.go b/cmd/cue/cmd/fixall.go
index 87df949..6209659 100644
--- a/cmd/cue/cmd/fixall.go
+++ b/cmd/cue/cmd/fixall.go
@@ -17,6 +17,8 @@
 import (
 	"fmt"
 	"hash/fnv"
+	"os"
+	"path/filepath"
 	"strings"
 
 	"cuelang.org/go/cue"
@@ -30,9 +32,12 @@
 )
 
 func fixAll(a []*build.Instance) errors.Error {
+	cwd, _ := os.Getwd()
+
 	// Collect all
 	p := processor{
 		instances: a,
+		cwd:       cwd,
 
 		done:      map[ast.Node]bool{},
 		rename:    map[*ast.Ident]string{},
@@ -52,6 +57,7 @@
 
 type processor struct {
 	instances []*build.Instance
+	cwd       string
 
 	done map[ast.Node]bool
 	// Evidence for rewrites. Rewrite in a later pass.
@@ -246,8 +252,13 @@
 
 				b := &strings.Builder{}
 				fmt.Fprintln(b, "Possible references to this location:")
-				for _, p := range refs {
-					fmt.Fprintf(b, "\t%s\n", p)
+				for _, r := range refs {
+					s, err := filepath.Rel(p.cwd, r.String())
+					if err != nil {
+						s = r.String()
+					}
+					s = filepath.ToSlash(s)
+					fmt.Fprintf(b, "\t%s\n", s)
 				}
 
 				cg := internal.NewComment(true, b.String())
diff --git a/cmd/cue/cmd/testdata/fix/unsupported.txtar b/cmd/cue/cmd/testdata/fix/unsupported.txtar
index 26518d2..4fd5f0a 100644
--- a/cmd/cue/cmd/testdata/fix/unsupported.txtar
+++ b/cmd/cue/cmd/testdata/fix/unsupported.txtar
@@ -21,8 +21,8 @@
 package foo
 
 // Possible references to this location:
-// /Users/mpvl/Cloud/dev/cue/cmd/cue/cmd/testdata/fix/foo/foo.cue:8:4
-// /Users/mpvl/Cloud/dev/cue/cmd/cue/cmd/testdata/fix/foo/foo.cue:9:7
+// testdata/fix/foo/foo.cue:8:4
+// testdata/fix/foo/foo.cue:9:7
 #Def: {
 	a: int
 	b: "foo"