I searched some article, all they used this why:
$go mod init project_name
Then created main.go and coded these:
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
then go run main.go
but in the fact, I can't remember the lib's full name like "github.com/gin-gonic/gin", maybe I just remember gin.
So is there some way to install lib like python pip tool or go get like go mod install gin
PS:
because that I am using goland as my IDE, under the GOPATH, I can get the code tips, but under the go mod, I couldn't get it, Then I have started the question of this.
github.com/gin-gonic/ginfrom the import.