DEV Community

Cover image for cmd/go: go mod init fails to determine module path in subdirectory
vasubabu
vasubabu

Posted on

cmd/go: go mod init fails to determine module path in subdirectory

#go

I know you came for solution as always i don't talk much ;)

Problem:

cmd/go: go mod init fails to determine module path in subdirectory

Solutions:

#1: Update your go path to your current working directory (you can specify multiple)

 export GOPATH="/Users/XXXX/dir1:/Users/XXXX/dir2"

#2: if Plan A not working then Plan B

go mod init <module_name>

Hopefully Plan B works, if not please mention in comment section. i can help you :)

Discussion (0)