cmd/viewer: import types/views when generating a getter for a map field

Fixes #13873

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl
2024-10-21 12:28:41 -05:00
committed by Nick Khyl
parent f8f53bb6d4
commit 0f4c9c0ecb
3 changed files with 84 additions and 0 deletions

View File

@@ -97,6 +97,11 @@ func (it *ImportTracker) Import(pkg string) {
}
}
// Has reports whether the specified package has been imported.
func (it *ImportTracker) Has(pkg string) bool {
return it.packages[pkg]
}
func (it *ImportTracker) qualifier(pkg *types.Package) string {
if it.thisPkg == pkg {
return ""