mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 12:17:53 +08:00
improve package gcfg for searching priority
This commit is contained in:
parent
1e309e570d
commit
91e29e23a4
@ -1,4 +1,4 @@
|
|||||||
// Copyright GoFrame Author(https://github.com/gogf/gf). All Rights Reserved.
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the MIT License.
|
// This Source Code Form is subject to the terms of the MIT License.
|
||||||
// If a copy of the MIT was not distributed with this file,
|
// If a copy of the MIT was not distributed with this file,
|
||||||
@ -8,14 +8,14 @@ package ghttp
|
|||||||
|
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
// WrapF is a helper function for wrapping http.HandlerFunc and returns a ghttp middleware.
|
// WrapF is a helper function for wrapping http.HandlerFunc and returns a ghttp.HandlerFunc.
|
||||||
func WrapF(f http.HandlerFunc) HandlerFunc {
|
func WrapF(f http.HandlerFunc) HandlerFunc {
|
||||||
return func(r *Request) {
|
return func(r *Request) {
|
||||||
f(r.Response.Writer, r.Request)
|
f(r.Response.Writer, r.Request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WrapH is a helper function for wrapping http.Handler and returns a ghttp middleware.
|
// WrapH is a helper function for wrapping http.Handler and returns a ghttp.HandlerFunc.
|
||||||
func WrapH(h http.Handler) HandlerFunc {
|
func WrapH(h http.Handler) HandlerFunc {
|
||||||
return func(r *Request) {
|
return func(r *Request) {
|
||||||
h.ServeHTTP(r.Response.Writer, r.Request)
|
h.ServeHTTP(r.Response.Writer, r.Request)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the MIT License.
|
// This Source Code Form is subject to the terms of the MIT License.
|
||||||
// If a copy of the MIT was not distributed with this file,
|
// If a copy of the MIT was not distributed with this file,
|
||||||
|
@ -70,16 +70,16 @@ func New(file ...string) *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Dir path of working dir.
|
|
||||||
_ = c.SetPath(gfile.Pwd())
|
|
||||||
// Dir path of binary.
|
|
||||||
if selfPath := gfile.SelfDir(); selfPath != "" && gfile.Exists(selfPath) {
|
|
||||||
_ = c.AddPath(selfPath)
|
|
||||||
}
|
|
||||||
// Dir path of main package.
|
// Dir path of main package.
|
||||||
if mainPath := gfile.MainPkgPath(); mainPath != "" && gfile.Exists(mainPath) {
|
if mainPath := gfile.MainPkgPath(); mainPath != "" && gfile.Exists(mainPath) {
|
||||||
_ = c.AddPath(mainPath)
|
_ = c.AddPath(mainPath)
|
||||||
}
|
}
|
||||||
|
// Dir path of binary.
|
||||||
|
if selfPath := gfile.SelfDir(); selfPath != "" && gfile.Exists(selfPath) {
|
||||||
|
_ = c.AddPath(selfPath)
|
||||||
|
}
|
||||||
|
// Dir path of working dir.
|
||||||
|
_ = c.AddPath(gfile.Pwd())
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user