Skip to content

Commit dca31fe

Browse files
committed
Separate repository to multiple modules
1 parent b4d3b41 commit dca31fe

File tree

7 files changed

+400
-39
lines changed

7 files changed

+400
-39
lines changed

go.mod

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
module github.com/dsxack/go/v2
22

3-
require (
4-
github.com/go-kit/kit v0.8.0
5-
github.com/go-logfmt/logfmt v0.4.0 // indirect
6-
github.com/sirupsen/logrus v1.4.0
7-
github.com/stretchr/testify v1.2.2
8-
)
9-
103
go 1.13

go.sum

Lines changed: 0 additions & 25 deletions
This file was deleted.

kit/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/dsxack/go/v2/kit
2+
3+
go 1.15
4+
5+
require (
6+
github.com/go-kit/kit v0.10.0
7+
github.com/stretchr/testify v1.6.1
8+
)

kit/go.sum

Lines changed: 359 additions & 0 deletions
Large diffs are not rendered by default.

logrus/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/dsxack/go/v2/logrus
2+
3+
go 1.15
4+
5+
require (
6+
github.com/sirupsen/logrus v1.6.0
7+
github.com/stretchr/testify v1.6.1
8+
)

logrus/go.sum

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
5+
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
6+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8+
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
9+
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
10+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
11+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
12+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
13+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
14+
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
15+
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
16+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
17+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
18+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
19+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

safe/go.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package safe
22

33
import (
4-
"github.com/sirupsen/logrus"
4+
"log"
55
"runtime/debug"
66
)
77

8+
var DefaultRecover = func(err interface{}) {
9+
log.Printf("Error in Go routine: %s\nStack: %s\n", err, debug.Stack())
10+
}
11+
812
// Go starts a recoverable goroutine
913
func Go(goroutine func()) {
10-
GoWithRecover(goroutine, defaultRecoverGoroutine)
14+
GoWithRecover(goroutine, DefaultRecover)
1115
}
1216

1317
// GoWithRecover starts a recoverable goroutine using given customRecover() function
@@ -21,8 +25,3 @@ func GoWithRecover(goroutine func(), customRecover func(err interface{})) {
2125
goroutine()
2226
}()
2327
}
24-
25-
func defaultRecoverGoroutine(err interface{}) {
26-
logrus.Errorf("Error in Go routine: %s", err)
27-
logrus.Errorf("Stack: %s", debug.Stack())
28-
}

0 commit comments

Comments
 (0)