main.go : no required module provides package - working directory is not part of a module

Опубликовано: 15 Октябрь 2024
на канале: Let's Fix That Error
8,915
42

I faced this error when trying to run a program written in go / golang with this command "go run main.go". The error is:


main.go : no required module provides package : working directory is not part of a module


Fix the error:
go mod init package-name
go get -v dependency.url.com.something/whatever