gin-contrib / static

Static middleware
MIT License
290 stars 41 forks source link

fix: replace gopkg with github. #1

Closed appleboy closed 7 years ago

codecov-io commented 7 years ago

Codecov Report

Merging #1 into master will not change coverage. The diff coverage is n/a.

@@          Coverage Diff          @@
##           master     #1   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          25     25           
=====================================
  Hits           25     25
Impacted Files Coverage Δ
static.go 100% <ø> (ø) :white_check_mark:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3375beb...238af72. Read the comment docs.

pkopac commented 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!

pkopac commented 7 years ago

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

appleboy commented 7 years ago

Could you provide example code? BTW the gin source code wherever downloads from github.com or gppkg.in are the same now.

pkopac commented 7 years ago

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:

appleboy commented 7 years ago

@pkopac I can't reproduce your problem. See the example: https://github.com/gin-contrib/static/blob/master/example/simple/example.go

pkopac commented 7 years ago

@appleboy, the example is what I do, no difference in code then. Maybe we have different environments? I can reproduce this on:

I think it's caused by the vendor folder & configuration, I haven't seen that yet and must check, how that works in Go.

pkopac commented 7 years ago

@appleboy, I found a solution, please merge #4 ;) Thanks.