Closed appleboy closed 7 years ago
Hello @appleboy, my code just stopped building and I've traced it to this PR :)
Could I ask, what's the reason of replacing the URL with github
instead of the versioned gopkg
? And what's the recommended fix, if I don't want to be downloading master
, but a concrete version (of gin-gonic
)?
It can be problematic, using master, like in this case ;)
cannot use static.Serve("/", static.LocalFile("./static", false)) (type "github.com/gin-contrib/static/vendor/github.com/gin-gonic/gin".HandlerFunc) as type "gopkg.in/gin-gonic/gin.v1".HandlerFunc in argument to router.Use
Thanks for helping!
When I try to replace it with the github
URL anyway (since you recommended that elsewhere, I've just found) it still fails:
cannot use static.Serve("/", static.LocalFile("./static", false)) (type "github.com/gin-contrib/static/vendor/github.com/gin-gonic/gin".HandlerFunc) as type "github.com/gin-gonic/gin".HandlerFunc in argument to router.Use
Could you provide example code? BTW the gin source code wherever downloads from github.com
or gppkg.in
are the same now.
Thank you for the fast reaction!
The error comes from here: router.Use(static.Serve("/", static.LocalFile("./static", false)))
I use it, because I need to serve /robots.txt
, for everything else I use router.Static("/static", "./static")
importing:
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
@pkopac I can't reproduce your problem. See the example: https://github.com/gin-contrib/static/blob/master/example/simple/example.go
@appleboy, the example is what I do, no difference in code then. Maybe we have different environments? I can reproduce this on:
go1.7.4 windows/amd64
go1.8 linux/amd64
I think it's caused by the vendor
folder & configuration, I haven't seen that yet and must check, how that works in Go.
@appleboy, I found a solution, please merge #4 ;) Thanks.
Codecov Report
100% <ø> (ø)
Continue to review full report at Codecov.