I have the following code, is really simple. The point is that the code after the first fmt.Println is never executed. Any idea why?
The code creates a random string, and then creates a Gin Router. The code that executes the router is never being runned.
func send(cmd *cobra.Command, args []string) {
randomString = createRandomString()
fmt.Println("Code for share: " + randomString)
var files filesToSend = args
//Create http to listen to port
g := gin.Default()
g.GET("/", files.sendHttpHandler)
g.Run()
}
Problem is the
import path
inmain.go
vs the module name ingo.mod
. The capitalization is different:go.mod:
It is best practice to use all lowercase for package (and module) names. From the Go Blog: