mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 10:41:03 +01:00
fix travis fail on deprecation example test
Former-commit-id: 3f6bb0f01702ab2c2cd7f348b29ec142af036cb3
This commit is contained in:
parent
d0104defa8
commit
1f9ead426e
|
@ -21,13 +21,21 @@ func getCaller() (string, int) {
|
|||
|
||||
for {
|
||||
frame, more := frames.Next()
|
||||
file := frame.File
|
||||
|
||||
if (!strings.Contains(frame.File, "github.com/kataras/iris") ||
|
||||
strings.Contains(frame.File, "github.com/kataras/iris/_examples") ||
|
||||
strings.Contains(frame.File, "github.com/iris-contrib/examples") ||
|
||||
(strings.Contains(frame.File, "github.com/kataras/iris/core/router") && !strings.Contains(frame.File, "deprecated.go"))) &&
|
||||
!strings.HasSuffix(frame.Func.Name(), ".getCaller") && !strings.Contains(frame.File, "/go/src/testing") {
|
||||
return frame.File, frame.Line
|
||||
splitAfterPart := "/src/"
|
||||
if (!strings.Contains(file, "github.com/kataras/iris") ||
|
||||
strings.Contains(file, "github.com/kataras/iris/_examples") ||
|
||||
strings.Contains(file, "github.com/iris-contrib/examples") ||
|
||||
(strings.Contains(file, "github.com/kataras/iris/core/router") && !strings.Contains(file, "deprecated.go"))) &&
|
||||
!strings.HasSuffix(frame.Func.Name(), ".getCaller") && !strings.Contains(file, "/go/src/testing") {
|
||||
|
||||
// remove the $GOPATH.
|
||||
n := strings.Index(file, splitAfterPart)
|
||||
if n != -1 {
|
||||
file = file[n+len(splitAfterPart):]
|
||||
}
|
||||
return file, frame.Line
|
||||
}
|
||||
|
||||
if !more {
|
||||
|
|
|
@ -15,7 +15,7 @@ func ExampleParty_StaticWeb() {
|
|||
|
||||
fmt.Print(err)
|
||||
// Output: StaticWeb is DEPRECATED and it will be removed eventually.
|
||||
// Source: C:/mygopath/src/github.com/kataras/iris/core/router/deprecated_example_test.go:9
|
||||
// Source: github.com/kataras/iris/core/router/deprecated_example_test.go:9
|
||||
// Use .HandleDir("/static", "./assets") instead.
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ func ExampleParty_StaticHandler() {
|
|||
|
||||
fmt.Print(err)
|
||||
// Output: StaticHandler is DEPRECATED and it will be removed eventually.
|
||||
// Source: C:/mygopath/src/github.com/kataras/iris/core/router/deprecated_example_test.go:24
|
||||
// Source: github.com/kataras/iris/core/router/deprecated_example_test.go:24
|
||||
// Use iris.FileServer("./assets", iris.DirOptions{ShowList: false, Gzip: true}) instead.
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ func ExampleParty_StaticEmbedded() {
|
|||
fmt.Print(err)
|
||||
// Output: StaticEmbedded is DEPRECATED and it will be removed eventually.
|
||||
// It is also miss the AssetInfo bindata function, which is required now.
|
||||
// Source: C:/mygopath/src/github.com/kataras/iris/core/router/deprecated_example_test.go:39
|
||||
// Source: github.com/kataras/iris/core/router/deprecated_example_test.go:39
|
||||
// Use .HandleDir("/static", "./assets", iris.DirOptions{Asset: Asset, AssetInfo: AssetInfo, AssetNames: AssetNames}) instead.
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,6 @@ func ExampleParty_StaticEmbeddedGzip() {
|
|||
fmt.Print(err)
|
||||
// Output: StaticEmbeddedGzip is DEPRECATED and it will be removed eventually.
|
||||
// It is also miss the AssetInfo bindata function, which is required now.
|
||||
// Source: C:/mygopath/src/github.com/kataras/iris/core/router/deprecated_example_test.go:55
|
||||
// Source: github.com/kataras/iris/core/router/deprecated_example_test.go:55
|
||||
// Use .HandleDir("/static", "./assets", iris.DirOptions{Gzip: true, Asset: Asset, AssetInfo: AssetInfo, AssetNames: AssetNames}) instead.
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ type embeddedFileSystem struct {
|
|||
|
||||
asset func(name string) ([]byte, error)
|
||||
assetInfo func(name string) (os.FileInfo, error)
|
||||
assetNames []string
|
||||
}
|
||||
|
||||
var _ http.FileSystem = (*embeddedFileSystem)(nil)
|
||||
|
@ -265,11 +264,12 @@ func FileServer(directory string, opts ...DirOptions) context.Handler {
|
|||
|
||||
asset: asset,
|
||||
assetInfo: assetInfo,
|
||||
assetNames: names,
|
||||
}
|
||||
} else if !DirectoryExists(directory) {
|
||||
panic("FileServer: system directory: " + directory + " does not exist")
|
||||
}
|
||||
// Let it for now.
|
||||
// else if !DirectoryExists(directory) {
|
||||
// panic("FileServer: system directory: " + directory + " does not exist")
|
||||
// }
|
||||
|
||||
plainStatusCode := func(ctx context.Context, statusCode int) {
|
||||
if writer, ok := ctx.ResponseWriter().(*context.GzipResponseWriter); ok && writer != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user