Skip to content

Commit 9dd1c2c

Browse files
committed
[doc] Update acknowledgement
1 parent d6aae98 commit 9dd1c2c

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

README.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ Gommon is a collection of common util libraries written in Go.
1010

1111
It has the following components:
1212

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.
2021

2122
Legacy
2223

@@ -68,25 +69,46 @@ Currently, gommon is in a very violate state, please open issues after it become
6869
Gommon is inspired by the following awesome libraries, most gommon packages have much less features and a few improvements
6970
compared to packages it modeled after.
7071

72+
log
73+
7174
- [sirupsen/logrus](https://github.com/sirupsen/logrus) for structured logging
7275
- log v1 is entirely modeled after logrus, entry contains log information with methods like `Info`, `Infof`
7376
- [apex/log](https://github.com/apex/log) for log handlers
7477
- 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
7578
- [uber-go/zap](https://github.com/uber-go/zap) for serialize log fields without using `fmt.Sprintf` and use `strconv` directly
7679
- we didn't go that extreme as Zap or ZeroLog for zero allocation, performance is not our goal for now
80+
81+
config
82+
7783
- [spf13/cast](https://github.com/spf13/cast) for cast, it is used by Viper
7884
- [spf13/viper](https://github.com/spf13/viper/) for config
7985
- looking up config via string key makes type system useless, so we always marshal entire config file to a single struct
8086
- it also makes refactor easier
87+
88+
requests
89+
8190
- [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+
8295
- [benbjohnson/tmpl](https://github.com/benbjohnson/tmpl) for go template generator
8396
- first saw it in [influxdata/influxdb](https://github.com/influxdata/influxdb/blob/master/tsdb/engine/tsm1/encoding.gen.go.tmpl)
8497
- 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
98+
99+
noodle
100+
101+
- [GeertJohan/go.rice](https://github.com/GeertJohan/go.rice)
86102
- 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
88107
- 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+
90112
## About
91113

92114
It was part of [Ayi](https://github.com/dyweb/Ayi) and split out for wider use.

errors/errors_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ func wrappedStdErr() error {
2828
func TestWrap(t *testing.T) {
2929
assert := asst.New(t)
3030

31+
n := Wrap(nil, "nothing")
32+
assert.Nil(n)
33+
3134
errw := Wrap(os.ErrClosed, "can't open closed file")
3235
terr, ok := errw.(TracedError)
3336
assert.True(ok)

errors/multi.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import (
77

88
type MultiErr interface {
99
error
10-
// Append returns true if the appended error is not nil, it is inspired by https://github.com/uber-go/multierr/issues/21
10+
// Append returns true if the appended error is not nil, inspired by https://github.com/uber-go/multierr/issues/21
1111
Append(error) bool
1212
Errors() []error
13+
// Error returns itself or nil if there are no errors, inspired by https://github.com/hashicorp/go-multierror
1314
ErrorOrNil() error
1415
// HasError is ErrorOrNil != nil
1516
HasError() bool

0 commit comments

Comments
 (0)