Basically, every program now needs a "go.mod" file. Even a "hello world" program should be made like this:
mkdir hello cd hello go mod init example.com/hello # this creates "go.mod" vi hello.go # create your program here go run . Whilst it still does work to say "go run hello.go" for a simple hello-world-and-nothing-else, as soon as it depends on any third-party libraries, it will fail. You *must* include a go.mod file. Then when you import external libraries, "go mod tidy" will fetch them for you, including their dependencies, and update go.mod On Monday, 10 October 2022 at 06:35:38 UTC+1 princ...@gmail.com wrote: > I am trying to use this git api(*https://github.com/go-git/go-git > <https://github.com/go-git/go-git>*), but before that I tried to run the > provided example (i.e. cloning the repo by golang). So I run the program > *https://github.com/go-git/go-git/blob/master/_examples/clone/main.go > <https://github.com/go-git/go-git/blob/master/_examples/clone/main.go>* > > So when I run this program I used to get this error: > sample.go:7:2: no required module provides package > github.com/go-git/go-git/v5: go.mod file not found in current directory > or any parent directory; see 'go help modules' > > sample.go:8:2: no required module provides package > github.com/go-git/go-git/v5/_examples: go.mod file not found in current > directory or any parent directory; see 'go help modules' > > *Please help me, how I can execute this?* > > I am using the following: > Go version: go version go1.18.1 linux/amd64 > Platform: Ubuntu 22.04.1 LTS -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/39c1bc4d-cf78-4799-8a69-40d6f9134afdn%40googlegroups.com.