Comment From: jincheng9

@EhsanRezaie please provide more details.

Comment From: jincheng9

@EhsanRezaie I think this is not the problem of Gin. Please close this issue. Thanks.

Comment From: hacker-szabo

Hi, I am very new to go and this was the first library I wanted to import

For other newbies:

I used the following commands to run the example code:

go mod init github.com/gin-gonic/gin
go mod tidy

And when I tried to run the example code:

go run main.go

I received this "import cycle not allowed". The solution for this was this:

First, delete the go.mod file, then:

go mod init example.com/packages

Then have the example code ready in main.go and run:

go mod tidy

Now, go mod tidy had output and added gin as a requirement and also created a go.sum file.

After this I could run the example code:

go run main.go

This is not a gin issue, it's just there are a lot of maybe outdated misinformation that the way to import this library is:

go mod init github.com/gin-gonic/gin
go mod tidy

which did not work at all for me with go1.21.

And TBH, I don't yet get what "example.com/packages" mean, probably my own package name which would explain the cyclic import error message.