Skip to content

Commit

Permalink
cue/load: avoid "user:" and "instance:" error prefixes
Browse files Browse the repository at this point in the history
The `cue/load` package currently creates errors with `user:` and/or
`instance:` prefixes, which might make sense in the context of
the Go API, but don't really make sense on the command line,
as evidenced by comments like this:

https://review.gerrithub.io/c/cue-lang/cue/+/1194664/8/cmd/cue/cmd/testdata/script/issue174.txtar

This change removes those prefixes.

This doesn't appear to be covered by any tests, although
these prefixes do show up in some errors printed by a later
CL, which this improves.

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I66670e94c4bd0a45d84a2ed4d6dec6de8d9db758
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194762
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
rogpeppe committed May 15, 2024
1 parent e888508 commit 612837a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion cue/load/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (c *Config) newErrInstance(err error) *build.Instance {
i := c.Context.NewInstance("", nil)
i.Root = c.ModuleRoot
i.Module = c.Module
i.Err = errors.Promote(err, "instance")
i.Err = errors.Promote(err, "")
return i
}

Expand Down
3 changes: 0 additions & 3 deletions cue/load/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ func (l *loader) cueFilesPackage(files []*build.File) *build.Instance {
pkg.User = true
l.addFiles(l.cfg.Dir, pkg)

l.stk.Push("user")
_ = pkg.Complete()
l.stk.Pop()
//pkg.LocalPrefix = dirToImportPath(dir)
pkg.DisplayPath = "command-line-arguments"

return pkg
Expand Down

0 comments on commit 612837a

Please sign in to comment.