Skip to content

Commit

Permalink
cmd/cue: use fewer go/packages Need bits in get go
Browse files Browse the repository at this point in the history
NeedFiles and NeedTypesSizes are unnecessary.
Most of the current slowness is due to NeedSyntax and NeedTypes
being combined with NeedDeps, meaning that we must parse and typecheck
all transitive dependencies - but `get go` needs this as it
recurses into all dependencies by design.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I5e6f4d7d9771c75f2f1317874c91b8072376abb9
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198962
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
mvdan committed Aug 7, 2024
1 parent 30a5c79 commit 3260084
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/cue/cmd/get_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,9 @@ func extract(cmd *Command, args []string) error {
root := binst.Root

cfg := &packages.Config{
Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles |
packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes |
packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedDeps |
packages.NeedModule,
Mode: packages.NeedName | packages.NeedCompiledGoFiles |
packages.NeedImports | packages.NeedDeps | packages.NeedTypes |
packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedModule,
}
pkgs, err := packages.Load(cfg, args...)
if err != nil {
Expand Down

0 comments on commit 3260084

Please sign in to comment.