1
0
mirror of https://github.com/golang/go synced 2024-11-18 20:04:52 -07:00

go/packages: change the driverResponse.Sizes to have type StdSizes

This will allow Sizes to be marshalled and unmarshalled. All the Sizes
we care about ane StdSizes anyways.

Change-Id: I79d1dcaebba32f7730de4375945e372eeefa78fe
Reviewed-on: https://go-review.googlesource.com/c/147978
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Michael Matloob 2018-11-06 17:04:41 -05:00
parent 42c3d2e9aa
commit 34b416bd17
2 changed files with 3 additions and 2 deletions

View File

@ -113,7 +113,8 @@ extractQueries:
if sizeserr != nil {
return nil, sizeserr
}
response.Sizes = sizes
// types.SizesFor always returns nil or a *types.StdSizes
response.Sizes, _ = sizes.(*types.StdSizes)
if len(containFiles) == 0 && len(packagesNamed) == 0 {
return response, nil

View File

@ -138,7 +138,7 @@ type driver func(cfg *Config, patterns ...string) (*driverResponse, error)
// driverResponse contains the results for a driver query.
type driverResponse struct {
// Sizes, if not nil, is the types.Sizes to use when type checking.
Sizes types.Sizes
Sizes *types.StdSizes
// Roots is the set of package IDs that make up the root packages.
// We have to encode this separately because when we encode a single package