Closed mattsrobot closed 5 years ago
When I import the following.
import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" )
Then I try use the example:
router := gin.New() router.Use(cors.New(cors.Config{ AllowOrigins: []string{"https://foo.com"}, AllowMethods: []string{"PUT", "PATCH"}, AllowHeaders: []string{"Origin"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, AllowOriginFunc: func(origin string) bool { return origin == "https://github.com" }, MaxAge: 12 * time.Hour, }))
I get the following error:
cannot use cors.New(cors.Config literal) (type "github.com/gin-gonic/gin".HandlerFunc) as type "mend/vendor/github.com/gin-gonic/gin".HandlerFunc in argument to router.Use
Issue was resolved with dep ensure and restarting Visual Code. Not sure what the problem was entirely...
dep ensure
When I import the following.
Then I try use the example:
I get the following error: