myitcv / x

Mono-repo for all myitcv.io/... Go code
MIT License
103 stars 20 forks source link

[WIP] immutable/cmd/immutableGen: fix go/packages res and type-based res #128

Closed myitcv closed 5 years ago

myitcv commented 5 years ago

We need to fight go/packages a bit to find the right package to use for type information (see golang/go#27910 for more details).

Also, our logic for surfacing embedded fields where the embedded type had a valid go/types.Type was incorrect. It assumed that all such types must be external to the package being generated, and hence required that all fields be exported. However, it is possible for a package-local type to fully type check and therefore be valid. In this case, non-exported fields are valid for surfacing.

Also a small fix in cmd/gg whereby xtest packages were incorrectly being considered as not Done() because they were missing a hash (which they will never have). Added a failsafe that errors in case any work was left un-Done