diff --git a/conf/wide.go b/conf/wide.go index 51ac2d5..06c6f0a 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -247,7 +247,7 @@ func FixedTimeCheckEnv() { } func checkEnv() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) cmd := exec.Command("go", "version") buf, err := cmd.CombinedOutput() diff --git a/event/events.go b/event/events.go index 3e9e014..7b55048 100644 --- a/event/events.go +++ b/event/events.go @@ -69,7 +69,7 @@ var UserEventQueues = queues{} // Load initializes the event handling. func Load() { go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for event := range EventQueue { logger.Debugf("Received a global event [code=%d]", event.Code) @@ -106,7 +106,7 @@ func (ueqs queues) New(sid string) *UserEventQueue { ueqs[sid] = q go func() { // start listening - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for evt := range q.Queue { logger.Debugf("Session [%s] received an event [%d]", sid, evt.Code) diff --git a/go.mod b/go.mod index b7854fd..24ff116 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,18 @@ module github.com/b3log/wide go 1.12 require ( - github.com/b3log/gulu v0.0.0-20190529081049-e1613607f28c - github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect - github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect + github.com/b3log/gulu v0.0.0-20190806034141-2b1d1b33ff3d + github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 // indirect + github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 // indirect github.com/fsnotify/fsnotify v1.4.7 github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect - github.com/gorilla/sessions v1.1.3 + github.com/gorilla/sessions v1.2.0 github.com/gorilla/websocket v1.4.0 github.com/moul/http2curl v1.0.0 // indirect github.com/parnurzeal/gorequest v0.2.15 github.com/pkg/errors v0.8.1 // indirect - github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3 // indirect - github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect - golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect - golang.org/x/sys v0.0.0-20190529085034-854af27f14a7 // indirect + github.com/smartystreets/assertions v1.0.1 // indirect + github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect + golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect ) diff --git a/go.sum b/go.sum index 5dd8b1d..5c850cf 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,19 @@ -github.com/b3log/gulu v0.0.0-20190529081049-e1613607f28c h1:kapEgohE3azxGP8V3VWZOMIRhxdOKaj/GdttSDS54xA= -github.com/b3log/gulu v0.0.0-20190529081049-e1613607f28c/go.mod h1:UmyB0pe8jv1K3dZy/4UE3uCpM8zYkB4nbiIgjemuQ7A= -github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f h1:8GDPb0tCY8LQ+OJ3dbHb5sA6YZWXFORQYZx5sdsTlMs= -github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f h1:AUj1VoZUfhPhOPHULCQQDnGhRelpFWHMLhQVWDsS0v4= -github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/b3log/gulu v0.0.0-20190806034141-2b1d1b33ff3d h1:Ns7H97LVniGzx1DW2T0+eUtmuroZDo6nzjEj486w4+0= +github.com/b3log/gulu v0.0.0-20190806034141-2b1d1b33ff3d/go.mod h1:UmyB0pe8jv1K3dZy/4UE3uCpM8zYkB4nbiIgjemuQ7A= +github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 h1:aZtFdDNWY/yH86JPR2WX/PN63635VsE/f/nXNPAbYxY= +github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.1.3 h1:uXoZdcdA5XdXF3QzuSlheVRUvjl+1rKY7zBXL68L9RU= -github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ= +github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -29,17 +27,17 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3 h1:hBSHahWMEgzwRyS6dRpxY0XyjZsHyQ61s084wo5PJe0= -github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= +github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= +github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= +github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190529085034-854af27f14a7 h1:d3NkRlW4s4cw9uE+DEj45iJep4AAuMRXsYmWZDkN89A= -golang.org/x/sys v0.0.0-20190529085034-854af27f14a7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/main.go b/main.go index f91ea00..5790f3f 100644 --- a/main.go +++ b/main.go @@ -408,7 +408,7 @@ func stopwatch(handler func(w http.ResponseWriter, r *http.Request)) func(w http // panicRecover wraps the panic recover process. func panicRecover(handler func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) handler(w, r) } diff --git a/output/build.go b/output/build.go index 520ea59..604e015 100644 --- a/output/build.go +++ b/output/build.go @@ -167,7 +167,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) { ///////// go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for { wsChannel := session.OutputWS[sid] diff --git a/output/cross.go b/output/cross.go index 60404ac..f6aa0fb 100644 --- a/output/cross.go +++ b/output/cross.go @@ -152,7 +152,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) { } go func(runningId int) { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) defer cmd.Wait() // read all diff --git a/output/install.go b/output/install.go index 1fa05c9..c271458 100644 --- a/output/install.go +++ b/output/install.go @@ -116,7 +116,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) { } go func(runningId int) { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) defer cmd.Wait() logger.Debugf("User [%s, %s] is running [go install] [id=%d, dir=%s]", uid, sid, runningId, curDir) diff --git a/output/test.go b/output/test.go index 6d84110..981b3bd 100644 --- a/output/test.go +++ b/output/test.go @@ -112,7 +112,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) { } go func(runningId int) { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) logger.Debugf("User [%s, %s] is running [go test] [runningId=%d]", uid, sid, runningId) diff --git a/output/vet.go b/output/vet.go index 2f73426..5bfa6bd 100644 --- a/output/vet.go +++ b/output/vet.go @@ -112,7 +112,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) { } go func(runningId int) { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) logger.Debugf("User [%s, %s] is running [go vet] [runningId=%d]", uid, sid, runningId) diff --git a/session/processes.go b/session/processes.go index dd916a5..9526ec1 100644 --- a/session/processes.go +++ b/session/processes.go @@ -122,12 +122,12 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util } go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) logger.Debugf("User [%s, %s] is running [id=%s, file=%s]", wSession.UserId, sid, rid, filePath) go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for { r, _, err := outReader.ReadRune() diff --git a/session/sessions.go b/session/sessions.go index 4c05ef1..05adb49 100644 --- a/session/sessions.go +++ b/session/sessions.go @@ -105,7 +105,7 @@ var mutex sync.Mutex // Invalid sessions: sessions that not used within 30 minutes, refers to WideSession.Updated field. func FixedTimeRelease() { go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for _ = range time.Tick(time.Hour) { hour, _ := time.ParseDuration("-30m") @@ -139,7 +139,7 @@ func (u *userReport) report() string { // FixedTimeReport reports the Wide sessions status periodically (10 minutes). func FixedTimeReport() { go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for _ = range time.Tick(10 * time.Minute) { users := userReports{} @@ -477,7 +477,7 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS } go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for { ch := SessionWS[sid] @@ -526,7 +526,7 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS }() go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) workspaces := filepath.SplitList(conf.GetUserWorkspace(uid)) for _, workspace := range workspaces { diff --git a/session/users.go b/session/users.go index 4f36e20..32c9cf3 100644 --- a/session/users.go +++ b/session/users.go @@ -158,7 +158,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) { // Main goal of this function is to save user session content, for restoring session content while user open Wide next time. func FixedTimeSave() { go func() { - defer gulu.Panic.Recover() + defer gulu.Panic.Recover(nil) for _ = range time.Tick(time.Minute) { SaveOnlineUsers()