-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
Part of #63352
The current mechanism takes the last segment of the package path and appends a numeric suffix (if needed) to ensure uniqueness. This produces low-quality local names such path2
, format3
and strings5
.
I propose to add strategies (2) and (3), as illustrated below, to generate better names. These follow common practices for package aliasing and result in more meaningful names.
- Try
PkgName
(unchanged). - Try
PkgName
+"pkg"
. For example,path
becomespathpkg
. - Prepend preceding path segments until the name is unique or no all segments have been used. For example,
golang.org/x/tools/internal/astutil
becomesinternalastutil
,toolsinternalastutil
,xtoolsinternalastutil
, orgolangorgxtoolsinternalastutil
. Adding a length limit might be a good idea. - Appending a numeric suffix (unchanged). For example,
path
becomespath1
,path2
, ...
I'd love to implement these myself.
Metadata
Metadata
Assignees
Labels
ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.