]> Cypherpunks repositories - gostls13.git/commit
go/internal/gcimporter: restore Go 1.19 Package.SetImports behavior
authorMatthew Dempsky <mdempsky@google.com>
Mon, 13 Feb 2023 22:40:01 +0000 (14:40 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 13 Feb 2023 23:55:24 +0000 (23:55 +0000)
commit0cd309e12818f988693bf8e4d9f1453331dcf9f2
treeebcec9447daaf4737a21ad121769447d2f981f66
parent93f10b88293f331d507cf62f4374ec809f611780
go/internal/gcimporter: restore Go 1.19 Package.SetImports behavior

This CL is a port of go.dev/cl/465936 from the x/tools importer, which
changes the unified importer to (1) only call Package.SetImports on
the main package being imported (not any transitively imported
packages), and (2) to only populate it with any packages that were
referenced by the exported API.

With these changes, it should behave identically to how the indexed
importer worked in Go 1.19. It will also allow eventually dropping the
serialized import DAG from the export data format, which should help
with export data file sizes somewhat.

Updates #54096.
Updates #58296.

Change-Id: I70d252a19cada3333ed59b16d1df2abc5a4cff73
Reviewed-on: https://go-review.googlesource.com/c/go/+/467896
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/internal/gcimporter/ureader.go