x/tools/gopls/internal/analysis/modernize: the ./...
command is ineffective for certain repositories that use the multi-module pattern
#73650
Labels
gopls
Issues related to the Go language server, gopls.
ToolProposal
Issues describing a requested change to a Go tool or command-line program.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Go version
go1.24.2
Output of
go env
in your module/workspace:What did you do?
In many repositories that use the multi-module pattern (often monorepos), if there is a go.mod file in one directory, the Go files in a subdirectory that also contains a go.mod file will not be processed.
This organizational structure may violate the best practices of multi-module setups, but I have found that such situations are prevalent in many open-source projects.
For example, for the following organizational structure and code:
What did you see happen?
After executing
modernize -fix -test ./...
The
diff.go
file has changed as expected, whileutils/utils.go
has not changed.What did you expect to see?
I'm not sure if this is expected behavior or a bug. However, I think that since
./...
is explicitly specified, it should process the Go files in the current directory and all its subdirectories. Otherwise, this situation would lead to inconsistencies in style within the same repository.The text was updated successfully, but these errors were encountered: