You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-10Lines changed: 32 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,14 @@ Gommon is a collection of common util libraries written in Go.
10
10
11
11
It has the following components:
12
12
13
-
-[Config](config) A YAML config reader with template support
14
-
-[Log](log) A Javaish logger for Go, application can control library and set level for different pkg via config or flag
15
-
-[Generator](generator) Render go template, generate methods for logger interface based on `gommon.yml`
16
-
-[Noodle](noodle) Embed static assets for web application with `.noodleignore` support
17
-
-[Requests](requests) A pythonic wrapper for `net/http`, HTTP for Gopher.
18
-
-[Cast](cast) Convert Golang types
19
-
-[Data structure](structure) Bring Set etc. to Golang.
13
+
-[config](config) A YAML config reader with template support
14
+
-[errors](errors) Wrap error and multi error
15
+
-[generator](generator) Render go template, generate methods for logger interface based on `gommon.yml`
16
+
-[log](log) A Javaish logger for Go, application can control library and set level for different pkg via config or flag
17
+
-[noodle](noodle) Embed static assets for web application with `.noodleignore` support
18
+
-[requests](requests) A pythonic wrapper for `net/http`, HTTP for Gopher.
19
+
-[cast](cast) Convert Golang types
20
+
-[structure](structure) Bring data structure like Set etc. to Golang.
20
21
21
22
Legacy
22
23
@@ -68,25 +69,46 @@ Currently, gommon is in a very violate state, please open issues after it become
68
69
Gommon is inspired by the following awesome libraries, most gommon packages have much less features and a few improvements
69
70
compared to packages it modeled after.
70
71
72
+
log
73
+
71
74
-[sirupsen/logrus](https://github.com/sirupsen/logrus) for structured logging
72
75
- log v1 is entirely modeled after logrus, entry contains log information with methods like `Info`, `Infof`
73
76
-[apex/log](https://github.com/apex/log) for log handlers
74
77
- log v2's handler is inspired by apex/log, but we didn't use entry and chose to pass multiple parameters to explicitly state what a handler should handle
75
78
-[uber-go/zap](https://github.com/uber-go/zap) for serialize log fields without using `fmt.Sprintf` and use `strconv` directly
76
79
- we didn't go that extreme as Zap or ZeroLog for zero allocation, performance is not our goal for now
80
+
81
+
config
82
+
77
83
-[spf13/cast](https://github.com/spf13/cast) for cast, it is used by Viper
78
84
-[spf13/viper](https://github.com/spf13/viper/) for config
79
85
- looking up config via string key makes type system useless, so we always marshal entire config file to a single struct
80
86
- it also makes refactor easier
87
+
88
+
requests
89
+
81
90
-[Requests](http://docs.python-requests.org/en/master/) for requests
91
+
-[hashicorp/go-cleanhttp](https://github.com/hashicorp/go-cleanhttp) for using non default http transport and client
92
+
93
+
generator
94
+
82
95
-[benbjohnson/tmpl](https://github.com/benbjohnson/tmpl) for go template generator
83
96
- first saw it in [influxdata/influxdb](https://github.com/influxdata/influxdb/blob/master/tsdb/engine/tsm1/encoding.gen.go.tmpl)
84
97
- we put template data in `gommon.yml`, so we don't need to pass data as json via cli
85
-
-[GeertJohan/go.rice](https://github.com/GeertJohan/go.rice) for ~~rice~~ noodle
- we implemented `.gitignore` like [feature](https://github.com/at15/go.rice/issues/1) but the upstream didn't respond for the [feature request #83](https://github.com/GeertJohan/go.rice/issues/83)
87
-
-[pkg/errors](https://github.com/pkg/errors) for errors, it can not introduce breaking change, but `WithMessage` and `WithStack` is annoying
103
+
104
+
errors
105
+
106
+
-[pkg/errors](https://github.com/pkg/errors) it can not introduce breaking change, but `WithMessage` and `WithStack` is annoying
88
107
- see [#54](https://github.com/dyweb/gommon/issues/54) and [errors/doc](errors/doc) about other error packages
89
-
108
+
-https://github.com/pkg/errors/pull/122 for check existing stack before attach new one
109
+
-[uber-go/multierr#21](https://github.com/uber-go/multierr/issues/21) for return bool after append
110
+
-[hashicorp/go-multierror](https://github.com/hashicorp/go-multierror) for `ErrorOrNil`
111
+
90
112
## About
91
113
92
114
It was part of [Ayi](https://github.com/dyweb/Ayi) and split out for wider use.
0 commit comments