Skip to content

lsif-go can't find nested go.mod

Created by: nicksnyder

https://github.com/nicksnyder/go-i18n has a go.mod file in a v2 subfolder (and not at a the top level).

LSIF uploads recently started failing with this error:

Run lsif-go
⠸ Resolving module name... WARNING: No go.mod file found in current directory.
✔ Resolving module name... Done
WARNING: No go.mod file found in current directory.

error: failed to list project dependencies: failed to list project packages: exit status 1
go: cannot find main module, but found .git/config in /__w/go-i1[8](https://github.com/nicksnyder/go-i18n/runs/5266223901?check_suite_focus=true#step:4:8)n/go-i18n
	to create a module there, run:
	go mod init
Error: Process completed with exit code 1.

Source: https://github.com/nicksnyder/go-i18n/runs/5266223901?check_suite_focus=true

This same check passed on June 23, 2021, and nothing else has changed in my project since then, so this appears to be a regression in lsif-go.

I would expect lsif-go to transitively search subdirectories for go.mod files if it doesn't find one at the top (it seems like it was doing this before).

I was able to workaround this by adding the working directory to the github action: https://github.com/nicksnyder/go-i18n/pull/268/commits/8eed4382ee875c5ba03442d5ee81da646dfe966a