Closed
Description
The command 'gopls semtok /tmp/a.go' takes 84 seconds when run in my home directory on my Mac. (a.go is short: 'package main; func main(){}') Most users would not see this problem because they would invoke gopls from an editor.
All the time is spent in findModules. It's called twice, once for findWorkspaceRoot (27.7 elapsed seconds) and once for newWorkspace (53.2 elapsed seconds). With a go.work file added, it instead finishes instantaneously. The file tree rooted at home directories tends to be large on Macs, because it include s./Library, which, for me, is 500,000 files.