golang/go

x/tools/internal/typesinternal: FileQualifier needs to add imports, and reject unnameable types

Open

#75,604 创建于 2025年9月25日

在 GitHub 查看
 (8 评论) (0 反应) (1 负责人)Go (133,883 star) (19,008 fork)batch import
NeedsFixRefactoringToolshelp wanted

描述

The job of FileQualifier is to help TypeString print types in valid Go syntax, respecting the local lexical environment and the file's set of existing imports. However, in general this may require (a) adding new imports for types belonging to packages that are not currently imported and (b) reporting that the task cannot be completed because one or more types are members of another package and are inaccessible either because they are unexported or because that package is internal relative to this one.

The task of this issue is to augment FileQualifier to accumulate a list of import edits, and an error when it sees a type it cannot print. This should fix a number of bugs across all our refactoring tools. It could also use some good tests.

贡献者指南