diff --git a/module/example/go.mod b/module/example/go.mod index fbe0b86..6e432a5 100644 --- a/module/example/go.mod +++ b/module/example/go.mod @@ -1,7 +1,7 @@ module github.com/alimy/mir/module/example require ( - github.com/alimy/mir v0.4.0 - github.com/alimy/mir/module/gin v0.0.0-20190115172208-cbe6c950f89b + github.com/alimy/mir v0.5.1-0.20190119172507-476d88190b52 + github.com/alimy/mir/module/gin v0.0.0-20190119173040-ab7801c02a7b github.com/gin-gonic/gin v1.3.0 ) diff --git a/module/example/go.sum b/module/example/go.sum index 067ed15..6d789ed 100644 --- a/module/example/go.sum +++ b/module/example/go.sum @@ -1,19 +1,31 @@ -github.com/alimy/mir v0.4.0 h1:sHHe5Lux6lufrvsIAzp7SZkPBaM56brTlyqBPlx28v0= -github.com/alimy/mir v0.4.0/go.mod h1:OcrVTghXSDdFJYE301IkBL2FZy5Lk6RdVMx1lZA2Bsg= -github.com/alimy/mir/module/gin v0.0.0-20190115172208-cbe6c950f89b h1:frXsXZKv0KMZ/+KkUfnEFiqJg9kwZaWXieNNaJQ9Ku4= -github.com/alimy/mir/module/gin v0.0.0-20190115172208-cbe6c950f89b/go.mod h1:ylXdWSzlBFvTGyILNR0CjDjOoro8lY5hC81dS5a/L6A= +github.com/alimy/mir v0.5.1-0.20190119172507-476d88190b52 h1:RnFUqAvzDsWRW8pJ2FJiI4mkh9+RtPofUswYam2cUXI= +github.com/alimy/mir v0.5.1-0.20190119172507-476d88190b52/go.mod h1:JIZY+q16FJKFNm2/a9KgUmYpa6SpsT9i7hafdg7xBhQ= +github.com/alimy/mir/module/gin v0.0.0-20190119173040-ab7801c02a7b h1:5bw+J8gNeX3R32Mj+/6dr+g60pb4zsmnZl2cyLwMIH4= +github.com/alimy/mir/module/gin v0.0.0-20190119173040-ab7801c02a7b/go.mod h1:Ca00fJk4piLwAxA04EzRJtVGi+9qMvvSoSTgBj/O/Ig= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs= github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4= github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/module/example/main.go b/module/example/main.go index 269cabc..2c86567 100644 --- a/module/example/main.go +++ b/module/example/main.go @@ -9,7 +9,7 @@ import ( "github.com/gin-gonic/gin" "net/http" - ginE "github.com/alimy/mir/module/gin" + mirE "github.com/alimy/mir/module/gin" ) type site struct { @@ -31,14 +31,14 @@ func (h *site) GetArticles(context *gin.Context) { } func main() { - engine := gin.New() + e := gin.New() // Register handler to engine by mir - e := ginE.Mir(engine) - if err := mir.Register(e, &site{Chain: gin.HandlersChain{gin.Logger(), gin.Recovery()}}); err != nil { + handlersChain := gin.HandlersChain{gin.Logger(), gin.Recovery()} + if err := mirE.Register(e, &site{Chain: handlersChain}); err != nil { panic(err) } // Start gin engine serve - engine.Run() + e.Run() }