Skip to content

Commit

Permalink
cmd/cue: use parser.PackageClauseOnly in 'get go'
Browse files Browse the repository at this point in the history
When importing CUE files, we parse each file to obtain its package name.
We only need to parse up to the package clause for this to work.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I21247bf16fed1cc3985bd1ef3f98a5be62ceb425
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200969
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
  • Loading branch information
mvdan committed Sep 11, 2024
1 parent 74a06f8 commit d34eb57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/cue/cmd/get_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func (e *extractor) importCUEFiles(p *packages.Package, dstDir, args string) err
if !ok {
return nil
}
f, err := parser.ParseFile(path, nil)
f, err := parser.ParseFile(path, nil, parser.PackageClauseOnly)
if err != nil {
return err
}
Expand Down

0 comments on commit d34eb57

Please sign in to comment.