Fix plugin logging missing context fields
Fix an issue where context fields logged by server on behalf of plugins didn't contain correct name/value pairs:
- bump Logr version to add key/value methods to sugar logger
- expose factory args when configuring logging with custom target types (needed for FocalBoard to create log target adapter that converts typed fields into slices of interface{} as per plugin logging API)
Этот коммит содержится в:
@@ -123,7 +123,7 @@ func setupTestHelper(dbStore store.Store, searchEngine *searchengine.Broker, ent
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&memoryConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
// lock logger config so server init cannot override it during testing.
|
||||
|
||||
@@ -82,7 +82,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&memoryConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
if errW := mlog.AddWriterTarget(testLogger, buffer, true, mlog.StdAll...); errW != nil {
|
||||
|
||||
@@ -889,16 +889,16 @@ func (api *PluginAPI) HasPermissionToChannel(userID, channelID string, permissio
|
||||
}
|
||||
|
||||
func (api *PluginAPI) LogDebug(msg string, keyValuePairs ...interface{}) {
|
||||
api.logger.Debug(msg, keyValuePairs...)
|
||||
api.logger.Debugw(msg, keyValuePairs...)
|
||||
}
|
||||
func (api *PluginAPI) LogInfo(msg string, keyValuePairs ...interface{}) {
|
||||
api.logger.Info(msg, keyValuePairs...)
|
||||
api.logger.Infow(msg, keyValuePairs...)
|
||||
}
|
||||
func (api *PluginAPI) LogError(msg string, keyValuePairs ...interface{}) {
|
||||
api.logger.Error(msg, keyValuePairs...)
|
||||
api.logger.Errorw(msg, keyValuePairs...)
|
||||
}
|
||||
func (api *PluginAPI) LogWarn(msg string, keyValuePairs ...interface{}) {
|
||||
api.logger.Warn(msg, keyValuePairs...)
|
||||
api.logger.Warnw(msg, keyValuePairs...)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError) {
|
||||
|
||||
@@ -850,7 +850,7 @@ func (s *Server) configureLogger(name string, logger *mlog.Logger, logSettings *
|
||||
return fmt.Errorf("invalid config source for %s, %w", name, err)
|
||||
}
|
||||
|
||||
if err := logger.ConfigureTargets(cfg); err != nil {
|
||||
if err := logger.ConfigureTargets(cfg, nil); err != nil {
|
||||
return fmt.Errorf("invalid config for %s, %w", name, err)
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -536,7 +536,7 @@ func TestPanicLog(t *testing.T) {
|
||||
|
||||
cfg, err := config.MloggerConfigFromLoggerConfig(logSettings, nil, config.GetLogFileLocation)
|
||||
require.NoError(t, err)
|
||||
err = logger.ConfigureTargets(cfg)
|
||||
err = logger.ConfigureTargets(cfg, nil)
|
||||
require.NoError(t, err)
|
||||
logger.LockConfiguration()
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&memoryConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
// lock logger config so server init cannot override it during testing.
|
||||
|
||||
@@ -61,7 +61,7 @@ func (a *Audit) Log(level mlog.Level, path string, evt string, status string, us
|
||||
|
||||
// Configure sets zero or more target to output audit logs to.
|
||||
func (a *Audit) Configure(cfg mlog.LoggerConfiguration) error {
|
||||
return a.logger.ConfigureTargets(cfg)
|
||||
return a.logger.ConfigureTargets(cfg, nil)
|
||||
}
|
||||
|
||||
// Flush attempts to write all queued audit records to all targets.
|
||||
|
||||
12
go.mod
12
go.mod
@@ -18,8 +18,6 @@ require (
|
||||
github.com/blang/semver v3.5.1+incompatible
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/cespare/xxhash/v2 v2.1.1
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
|
||||
github.com/corpix/uarand v0.1.1 // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
@@ -56,7 +54,6 @@ require (
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/memberlist v0.2.4
|
||||
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect
|
||||
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
|
||||
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
||||
github.com/jmoiron/sqlx v1.3.4
|
||||
github.com/jonboulle/clockwork v0.2.2
|
||||
@@ -72,8 +69,7 @@ require (
|
||||
github.com/mattermost/gosaml2 v0.3.3
|
||||
github.com/mattermost/gziphandler v0.0.1
|
||||
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d
|
||||
github.com/mattermost/logr v1.0.13 // indirect
|
||||
github.com/mattermost/logr/v2 v2.0.10
|
||||
github.com/mattermost/logr/v2 v2.0.15
|
||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
||||
github.com/mattn/go-isatty v0.0.13 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
@@ -103,7 +99,6 @@ require (
|
||||
github.com/russellhaering/goxmldsig v1.1.0
|
||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
|
||||
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/smartystreets/assertions v1.0.0 // indirect
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/splitio/go-client/v6 v6.1.0
|
||||
@@ -119,15 +114,12 @@ require (
|
||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.4
|
||||
github.com/wiggin77/merror v1.0.3
|
||||
github.com/wiggin77/srslog v1.0.1 // indirect
|
||||
github.com/willf/bitset v1.1.11 // indirect
|
||||
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c
|
||||
github.com/yuin/goldmark v1.3.8
|
||||
go.etcd.io/bbolt v1.3.6 // indirect
|
||||
go.opentelemetry.io/otel/internal/metric v0.21.0 // indirect
|
||||
go.uber.org/atomic v1.8.0 // indirect
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
|
||||
golang.org/x/image v0.0.0-20210622092929-e6eecd499c2c
|
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
|
||||
@@ -139,9 +131,9 @@ require (
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
gopkg.in/mail.v2 v2.3.1
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/olivere/elastic.v6 v6.2.35
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
willnorris.com/go/imageproxy v0.10.0
|
||||
)
|
||||
|
||||
|
||||
50
go.sum
50
go.sum
@@ -36,8 +36,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
code.sajari.com/docconv v1.1.1-0.20200701232649-d9ea05fbd50a h1:e0dRHyAfGcext3/lnwfsl81PKJRNgLyA843n72mPCes=
|
||||
code.sajari.com/docconv v1.1.1-0.20200701232649-d9ea05fbd50a/go.mod h1:DooS873W9YwUjTwEYGpg55aDlvnx1VcEdr7IJ9rEW8g=
|
||||
code.sajari.com/docconv v1.1.1-0.20210427001343-7b3472bc323a h1:AEvqb7V5SSC89lAp9UQd7ytVVLm6f4AQbtzr9lk0bFg=
|
||||
code.sajari.com/docconv v1.1.1-0.20210427001343-7b3472bc323a/go.mod h1:KPNt2zuWplps1W0TpOb6ltHj4Xu+j6h7a+YkqGHrxQE=
|
||||
contrib.go.opencensus.io/exporter/ocagent v0.4.9/go.mod h1:ueLzZcP7LPhPulEBukGn4aLh7Mx9YJwpVJ9nL2FYltw=
|
||||
@@ -66,14 +64,10 @@ github.com/JalfResi/justext v0.0.0-20170829062021-c0282dea7198 h1:8P+AjBhGByCuCX
|
||||
github.com/JalfResi/justext v0.0.0-20170829062021-c0282dea7198/go.mod h1:0SURuH1rsE8aVWvutuMZghRNrNrYEUzibzJfhEYR8L0=
|
||||
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
|
||||
github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74=
|
||||
github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2oc2f4tzPWic=
|
||||
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
|
||||
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/squirrel v1.5.0 h1:JukIZisrUXadA9pl3rMkjhiamxiB0cXiu+HGp/Y8cY8=
|
||||
github.com/Masterminds/squirrel v1.5.0/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
|
||||
github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
@@ -183,9 +177,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
|
||||
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
|
||||
github.com/containerd/containerd v1.4.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/containerd/containerd v1.4.1 h1:pASeJT3R3YyVn+94qEPk0SnU1OQ20Jd/T+SPKy9xehY=
|
||||
@@ -200,8 +191,6 @@ github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/corpix/uarand v0.1.1 h1:RMr1TWc9F4n5jiPDzFHtmaUXLKLNUFK0SgCLo4BhX/U=
|
||||
github.com/corpix/uarand v0.1.1/go.mod h1:SFKZvkcRoLqVRFZ4u25xPmp6m9ktANfbpXZ7SJ0/FNU=
|
||||
github.com/couchbase/ghistogram v0.1.0/go.mod h1:s1Jhy76zqfEecpNWJfWUiKZookAFaiGOEoyzgHt9i7k=
|
||||
github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs=
|
||||
github.com/couchbase/vellum v1.0.2 h1:BrbP0NKiyDdndMPec8Jjhy0U47CZ0Lgx3xUC2r9rZqw=
|
||||
@@ -213,9 +202,7 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
|
||||
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8=
|
||||
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8=
|
||||
github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
|
||||
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso=
|
||||
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
|
||||
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 h1:MZRmHqDBd0vxNwenEbKSQqRVT24d3C05ft8kduSwlqM=
|
||||
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -265,11 +252,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
|
||||
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
|
||||
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
|
||||
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
|
||||
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=
|
||||
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
|
||||
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
|
||||
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
@@ -504,8 +488,6 @@ github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 h1:Y4V+SFe7d3iH+9p
|
||||
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 h1:Mo9W14pwbO9VfRe+ygqZ8dFbPpoIK1HFrG/zjTuQ+nc=
|
||||
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo=
|
||||
github.com/ikawaha/kagome.ipadic v1.1.2/go.mod h1:DPSBbU0czaJhAb/5uKQZHMc9MTVRpDugJfX+HddPHHg=
|
||||
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
@@ -653,22 +635,8 @@ github.com/mattermost/gziphandler v0.0.1 h1:uXHcXF5agnQ6bXabvpiwwwZOlCYoa7mKHH0l
|
||||
github.com/mattermost/gziphandler v0.0.1/go.mod h1:CvvZR7sXqhj81V2swXuQY7T04Ccc89u7W7pHNPKev8g=
|
||||
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ0KNm4yZxxFvC1nvRz/gY/Daa35aI=
|
||||
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
|
||||
github.com/mattermost/logr v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8=
|
||||
github.com/mattermost/logr v1.0.13/go.mod h1:Mt4DPu1NXMe6JxPdwCC0XBoxXmN9eXOIRPoZarU2PXs=
|
||||
github.com/mattermost/logr/v2 v2.0.4 h1:LiqvzNNfia23hlu1zmmCDmjqmSfwWNsEtFlL4/7jf8o=
|
||||
github.com/mattermost/logr/v2 v2.0.4/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.5 h1:qYuPn0FSDtsmxcwhGUsSDkiWCH17ZYts6BLAAgsp1ks=
|
||||
github.com/mattermost/logr/v2 v2.0.5/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.6 h1:Ewmtqm+o6y6yDSqdMZdrP5o0P7rCKbBNJQl+FbhcWHg=
|
||||
github.com/mattermost/logr/v2 v2.0.6/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.7 h1:rcwGa3faMWa/0k841FZhrcb8qZexfV8sk9ZVCV/8KUg=
|
||||
github.com/mattermost/logr/v2 v2.0.7/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.8 h1:HQuie671ZtmIp0Y6gY0u34UQvnBw8rPFLeLxWOxv5VM=
|
||||
github.com/mattermost/logr/v2 v2.0.8/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.9 h1:WZev0JYaWmRa/wmpXe8xGA+YDTj9iqbn25rM55Hgutw=
|
||||
github.com/mattermost/logr/v2 v2.0.9/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.10 h1:i6rJbuX/EkBM9maM8M0eJ3rxB+fsBKNslPvzSlA2w/M=
|
||||
github.com/mattermost/logr/v2 v2.0.10/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/logr/v2 v2.0.15 h1:+WNbGcsc3dBao65eXlceB6dTILNJRIrvubnsTl3zBew=
|
||||
github.com/mattermost/logr/v2 v2.0.15/go.mod h1:mpPp935r5dIkFDo2y9Q87cQWhFR/4xXpNh0k/y8Hmwg=
|
||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0 h1:G9tL6JXRBMzjuD1kkBtcnd42kUiT6QDwxfFYu7adM6o=
|
||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
@@ -760,7 +728,6 @@ github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a
|
||||
github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||
github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
|
||||
github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ=
|
||||
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
|
||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||
@@ -803,7 +770,6 @@ github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm
|
||||
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
|
||||
github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
|
||||
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
|
||||
github.com/otiai10/gosseract/v2 v2.2.4/go.mod h1:ahOp/kHojnOMGv1RaUnR0jwY5JVa6BYKhYAS8nbMLSo=
|
||||
github.com/otiai10/gosseract/v2 v2.3.1 h1:BFy9Rru7dzqEYX7/tJuEvjVPkkJck0f+b5fYzzr6/RM=
|
||||
@@ -878,7 +844,6 @@ github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqn
|
||||
github.com/reflog/dateconstraints v0.2.1 h1:Hz1n2Q1vEm0Rj5gciDQcCN1iPBwfFjxUJy32NknGP/s=
|
||||
github.com/reflog/dateconstraints v0.2.1/go.mod h1:Ax8AxTBcJc3E/oVS2hd2j7RDM/5MDtuPwuR7lIHtPLo=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
@@ -1041,8 +1006,6 @@ github.com/vmihailenco/msgpack/v5 v5.3.4 h1:qMKAwOV+meBw2Y8k9cVwAy7qErtYCwBzZ2el
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/wiggin77/cfg v1.0.2 h1:NBUX+iJRr+RTncTqTNvajHwzduqbhCQjEqxLHr6Fk7A=
|
||||
github.com/wiggin77/cfg v1.0.2/go.mod h1:b3gotba2e5bXTqTW48DwIFoLc+4lWKP7WPi/CdvZ4aE=
|
||||
github.com/wiggin77/merror v1.0.2/go.mod h1:uQTcIU0Z6jRK4OwqganPYerzQxSFJ4GSHM3aurxxQpg=
|
||||
github.com/wiggin77/merror v1.0.3 h1:8+ZHV+aSnJoYghE3EUThl15C6rvF2TYRSvOSBjdmNR8=
|
||||
github.com/wiggin77/merror v1.0.3/go.mod h1:H2ETSu7/bPE0Ymf4bEwdUoo73OOEkdClnoRisfw0Nm0=
|
||||
@@ -1101,24 +1064,17 @@ go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9deb
|
||||
go.opentelemetry.io/otel/metric v0.21.0 h1:ZtcJlHqVE4l8Su0WOLOd9fEPheJuYEiQ0wr9wv2p25I=
|
||||
go.opentelemetry.io/otel/metric v0.21.0/go.mod h1:JWCt1bjivC4iCrz/aCrM1GSw+ZcvY44KCbaeeRhzHnc=
|
||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
||||
go.opentelemetry.io/otel/oteltest v1.0.0-RC1 h1:G685iP3XiskCwk/z0eIabL55XUl2gk0cljhGk9sB0Yk=
|
||||
go.opentelemetry.io/otel/oteltest v1.0.0-RC1/go.mod h1:+eoIG0gdEOaPNftuy1YScLr1Gb4mL/9lpDkZ0JjMRq4=
|
||||
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
||||
go.opentelemetry.io/otel/trace v1.0.0-RC1 h1:jrjqKJZEibFrDz+umEASeU3LvdVyWKlnTh7XEfwrT58=
|
||||
go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6e1U+3ViBOc+NXAg=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4=
|
||||
go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=
|
||||
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
|
||||
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
|
||||
golang.org/x/build v0.0.0-20190314133821-5284462c4bec/go.mod h1:atTaCNAy0f16Ah5aV1gMSwgiKVHwu/JncqDpuRr7lS4=
|
||||
@@ -1350,7 +1306,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
|
||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
@@ -1570,7 +1525,6 @@ gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
@@ -49,7 +49,7 @@ func setupTestHelper(enterprise bool) *TestHelper {
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&newConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
// lock logger config so server init cannot override it during testing.
|
||||
|
||||
@@ -274,7 +274,7 @@ func TestRudderTelemetry(t *testing.T) {
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&cfg.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
defer testLogger.Shutdown()
|
||||
|
||||
@@ -108,7 +108,7 @@ func TestLoggingAfterInitialized(t *testing.T) {
|
||||
}
|
||||
|
||||
logger, _ := mlog.NewLogger()
|
||||
err := logger.ConfigureTargets(map[string]mlog.TargetCfg{testCase.description: testCase.cfg})
|
||||
err := logger.ConfigureTargets(map[string]mlog.TargetCfg{testCase.description: testCase.cfg}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
mlog.InitGlobalLogger(logger)
|
||||
|
||||
@@ -49,6 +49,9 @@ type LogRec = logr.LogRec
|
||||
type LogCloner = logr.LogCloner
|
||||
type MetricsCollector = logr.MetricsCollector
|
||||
type TargetCfg = logrcfg.TargetCfg
|
||||
type TargetFactory = logrcfg.TargetFactory
|
||||
type FormatterFactory = logrcfg.FormatterFactory
|
||||
type Factories = logrcfg.Factories
|
||||
type Sugar = logr.Sugar
|
||||
|
||||
// LoggerConfiguration is a map of LogTarget configurations.
|
||||
@@ -179,7 +182,10 @@ func NewLogger(options ...Option) (*Logger, error) {
|
||||
// For each case JSON containing log targets is provided. Target name collisions are resolved
|
||||
// using the following precedence:
|
||||
// cfgFile > cfgEscaped
|
||||
func (l *Logger) Configure(cfgFile string, cfgEscaped string) error {
|
||||
//
|
||||
// An optional set of factories can be provided which will be called to create any target
|
||||
// types or formatters not built-in.
|
||||
func (l *Logger) Configure(cfgFile string, cfgEscaped string, factories *Factories) error {
|
||||
if atomic.LoadInt32(l.lockConfig) != 0 {
|
||||
return ErrConfigurationLock
|
||||
}
|
||||
@@ -213,16 +219,18 @@ func (l *Logger) Configure(cfgFile string, cfgEscaped string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return logrcfg.ConfigureTargets(l.log.Logr(), cfgMap.toTargetCfg(), nil)
|
||||
return logrcfg.ConfigureTargets(l.log.Logr(), cfgMap.toTargetCfg(), factories)
|
||||
}
|
||||
|
||||
// ConfigureTargets provides a new configuration for this logger via a `LoggerConfig` map.
|
||||
// Typically `mlog.Configure` is used instead which accepts JSON formatted configuration.
|
||||
func (l *Logger) ConfigureTargets(cfg LoggerConfiguration) error {
|
||||
// An optional set of factories can be provided which will be called to create any target
|
||||
// types or formatters not built-in.
|
||||
func (l *Logger) ConfigureTargets(cfg LoggerConfiguration, factories *Factories) error {
|
||||
if atomic.LoadInt32(l.lockConfig) != 0 {
|
||||
return ErrConfigurationLock
|
||||
}
|
||||
return logrcfg.ConfigureTargets(l.log.Logr(), cfg.toTargetCfg(), nil)
|
||||
return logrcfg.ConfigureTargets(l.log.Logr(), cfg.toTargetCfg(), factories)
|
||||
}
|
||||
|
||||
// LockConfiguration disallows further configuration changes until `UnlockConfiguration`
|
||||
@@ -405,6 +413,22 @@ func GetPackageName(f string) string {
|
||||
return f
|
||||
}
|
||||
|
||||
// ShouldQuote returns true if val contains any characters that might be unsafe
|
||||
// when injecting log output into an aggregator, viewer or report.
|
||||
// Returning true means that val should be surrounded by quotation marks before being
|
||||
// output into logs.
|
||||
func ShouldQuote(val string) bool {
|
||||
for _, c := range val {
|
||||
if !((c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
c == '-' || c == '.' || c == '_' || c == '/' || c == '@' || c == '^' || c == '+') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type logWriter struct {
|
||||
logger *Logger
|
||||
}
|
||||
|
||||
2
vendor/github.com/corpix/uarand/.gitignore
сгенерированный
поставляемый
2
vendor/github.com/corpix/uarand/.gitignore
сгенерированный
поставляемый
@@ -1,2 +0,0 @@
|
||||
/build
|
||||
*~
|
||||
3
vendor/github.com/corpix/uarand/.travis.yml
сгенерированный
поставляемый
3
vendor/github.com/corpix/uarand/.travis.yml
сгенерированный
поставляемый
@@ -1,3 +0,0 @@
|
||||
language: nix
|
||||
|
||||
script: nix-shell --pure --command "make lint test"
|
||||
24
vendor/github.com/corpix/uarand/LICENSE
сгенерированный
поставляемый
24
vendor/github.com/corpix/uarand/LICENSE
сгенерированный
поставляемый
@@ -1,24 +0,0 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
32
vendor/github.com/corpix/uarand/Makefile
сгенерированный
поставляемый
32
vendor/github.com/corpix/uarand/Makefile
сгенерированный
поставляемый
@@ -1,32 +0,0 @@
|
||||
.DEFAULT_GOAL = all
|
||||
|
||||
version := $(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)
|
||||
|
||||
name := uarand
|
||||
package := github.com/corpix/$(name)
|
||||
|
||||
.PHONY: all
|
||||
all:: useragents.go
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -v ./...
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
.PHONY: lint
|
||||
lint:
|
||||
golangci-lint --color=always \
|
||||
--exclude='uses unkeyed fields' \
|
||||
--exclude='type .* is unused' \
|
||||
--exclude='should merge variable declaration with assignment on next line' \
|
||||
--deadline=120s \
|
||||
run ./...
|
||||
|
||||
.PHONY: check
|
||||
check: lint test
|
||||
|
||||
.PHONY: useragents.go
|
||||
useragents.go:
|
||||
./scripts/fetch-user-agents | ./scripts/generate-useragents-go $(name) > $@
|
||||
go fmt $@
|
||||
38
vendor/github.com/corpix/uarand/README.md
сгенерированный
поставляемый
38
vendor/github.com/corpix/uarand/README.md
сгенерированный
поставляемый
@@ -1,38 +0,0 @@
|
||||
uarand
|
||||
----------------
|
||||
|
||||
[](https://travis-ci.org/corpix/uarand)
|
||||
|
||||
Random user-agent producer for go.
|
||||
|
||||
## Example
|
||||
|
||||
``` go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/corpix/uarand"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(uarand.GetRandom())
|
||||
}
|
||||
```
|
||||
|
||||
Save it to `snippet.go` and run:
|
||||
|
||||
``` shell
|
||||
go run snippet.go
|
||||
```
|
||||
|
||||
Which should produce something similar to:
|
||||
|
||||
``` text
|
||||
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[Unlicense](https://unlicense.org/)
|
||||
14
vendor/github.com/corpix/uarand/go.mod
сгенерированный
поставляемый
14
vendor/github.com/corpix/uarand/go.mod
сгенерированный
поставляемый
@@ -1,14 +0,0 @@
|
||||
module github.com/corpix/uarand
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/Masterminds/glide v0.13.2 // indirect
|
||||
github.com/Masterminds/semver v1.4.2 // indirect
|
||||
github.com/Masterminds/vcs v1.13.0 // indirect
|
||||
github.com/codegangsta/cli v1.20.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/ngdinhtoan/glide-cleanup v0.2.0 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
||||
)
|
||||
22
vendor/github.com/corpix/uarand/go.sum
сгенерированный
поставляемый
22
vendor/github.com/corpix/uarand/go.sum
сгенерированный
поставляемый
@@ -1,22 +0,0 @@
|
||||
github.com/Masterminds/glide v0.13.2 h1:M5MOH04TyRiMBVeWHbifqTpnauxWINIubTCOkhXh+2g=
|
||||
github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2oc2f4tzPWic=
|
||||
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
|
||||
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Masterminds/vcs v1.13.0 h1:USF5TvZGYgIpcbNAEMLfFhHqP08tFZVlUVrmTSpqnyA=
|
||||
github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
|
||||
github.com/codegangsta/cli v1.20.0 h1:iX1FXEgwzd5+XN6wk5cVHOGQj6Q3Dcp20lUeS4lHNTw=
|
||||
github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/ngdinhtoan/glide-cleanup v0.2.0 h1:kN4sV+0tp2F1BvwU+5SfNRMDndRmvIfnI3kZ7B8Yv4Y=
|
||||
github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
17
vendor/github.com/corpix/uarand/shell.nix
сгенерированный
поставляемый
17
vendor/github.com/corpix/uarand/shell.nix
сгенерированный
поставляемый
@@ -1,17 +0,0 @@
|
||||
let
|
||||
nixpkgs = builtins.fetchTarball {
|
||||
url = "https://github.com/nixos/nixpkgs/archive/ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.gz";
|
||||
sha256 = "0fjk69mn58h0gjzgxgnkfkhhf1l707bg2cn4823ma9xbjxbhl0ya";
|
||||
};
|
||||
in with import nixpkgs {};
|
||||
stdenv.mkDerivation {
|
||||
name = "nix-shell";
|
||||
buildInputs = [
|
||||
coreutils bashInteractive jq curl gcc git gnumake
|
||||
go golangci-lint cacert openssl
|
||||
];
|
||||
shellHook = ''
|
||||
unset GOPATH
|
||||
export NIX_PATH=nixpkgs=${nixpkgs}
|
||||
'';
|
||||
}
|
||||
63
vendor/github.com/corpix/uarand/uarand.go
сгенерированный
поставляемый
63
vendor/github.com/corpix/uarand/uarand.go
сгенерированный
поставляемый
@@ -1,63 +0,0 @@
|
||||
package uarand
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
// Default is the UARand with default settings.
|
||||
Default = New(
|
||||
rand.New(
|
||||
rand.NewSource(time.Now().UnixNano()),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
// Randomizer represents some entity which could provide us an entropy.
|
||||
type Randomizer interface {
|
||||
Seed(n int64)
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
// UARand describes the user agent randomizer settings.
|
||||
type UARand struct {
|
||||
Randomizer
|
||||
UserAgents []string
|
||||
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
// GetRandom returns a random user agent from UserAgents slice.
|
||||
func (u *UARand) GetRandom() string {
|
||||
u.mutex.Lock()
|
||||
n := u.Intn(len(u.UserAgents))
|
||||
u.mutex.Unlock()
|
||||
|
||||
return u.UserAgents[n]
|
||||
}
|
||||
|
||||
// GetRandom returns a random user agent from UserAgents slice.
|
||||
// This version is driven by Default configuration.
|
||||
func GetRandom() string {
|
||||
return Default.GetRandom()
|
||||
}
|
||||
|
||||
// New return UserAgent randomizer settings with default user-agents list
|
||||
func New(r Randomizer) *UARand {
|
||||
return &UARand{
|
||||
Randomizer: r,
|
||||
UserAgents: UserAgents,
|
||||
mutex: sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
// NewWithCustomList return UserAgent randomizer settings with custom user-agents list
|
||||
func NewWithCustomList(userAgents []string) *UARand {
|
||||
return &UARand{
|
||||
Randomizer: rand.New(rand.NewSource(time.Now().UnixNano())),
|
||||
UserAgents: userAgents,
|
||||
mutex: sync.Mutex{},
|
||||
}
|
||||
}
|
||||
1735
vendor/github.com/corpix/uarand/useragents.go
сгенерированный
поставляемый
1735
vendor/github.com/corpix/uarand/useragents.go
сгенерированный
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
26
vendor/github.com/icrowley/fake/.gitignore
сгенерированный
поставляемый
26
vendor/github.com/icrowley/fake/.gitignore
сгенерированный
поставляемый
@@ -1,26 +0,0 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
/vendor
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
.DS_Store
|
||||
11
vendor/github.com/icrowley/fake/.go-makefile.json
сгенерированный
поставляемый
11
vendor/github.com/icrowley/fake/.go-makefile.json
сгенерированный
поставляемый
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"build_id_generator": "0x$(shell echo $(version) | sha1sum | awk '{print $$1}')",
|
||||
"host": "github.com",
|
||||
"include": [],
|
||||
"kind": "package",
|
||||
"name": "fake",
|
||||
"tool": [],
|
||||
"user": "icrowley",
|
||||
"version_generator": "$(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)",
|
||||
"version_variable": "cli.version"
|
||||
}
|
||||
11
vendor/github.com/icrowley/fake/.travis.yml
сгенерированный
поставляемый
11
vendor/github.com/icrowley/fake/.travis.yml
сгенерированный
поставляемый
@@ -1,11 +0,0 @@
|
||||
sudo: false
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.6
|
||||
- 1.7
|
||||
- 1.8
|
||||
- master
|
||||
- tip
|
||||
|
||||
script: make test
|
||||
22
vendor/github.com/icrowley/fake/LICENSE
сгенерированный
поставляемый
22
vendor/github.com/icrowley/fake/LICENSE
сгенерированный
поставляемый
@@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Dmitry Afanasyev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
48
vendor/github.com/icrowley/fake/Makefile
сгенерированный
поставляемый
48
vendor/github.com/icrowley/fake/Makefile
сгенерированный
поставляемый
@@ -1,48 +0,0 @@
|
||||
.DEFAULT_GOAL = all
|
||||
|
||||
numcpus := $(shell cat /proc/cpuinfo | grep '^processor\s*:' | wc -l)
|
||||
version := $(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)
|
||||
|
||||
name := fake
|
||||
package := github.com/icrowley/$(name)
|
||||
|
||||
.PHONY: all
|
||||
all:: dependencies
|
||||
|
||||
.PHONY: tools
|
||||
tools::
|
||||
@if [ ! -e "$(GOPATH)"/bin/glide ]; then go get github.com/Masterminds/glide; fi
|
||||
@if [ ! -e "$(GOPATH)"/bin/godef ]; then go get github.com/rogpeppe/godef; fi
|
||||
@if [ ! -e "$(GOPATH)"/bin/gocode ]; then go get github.com/nsf/gocode; fi
|
||||
@if [ ! -e "$(GOPATH)"/bin/gometalinter ]; then go get github.com/alecthomas/gometalinter && gometalinter --install; fi
|
||||
@if [ ! -e "$(GOPATH)"/src/github.com/stretchr/testify/assert ]; then go get github.com/stretchr/testify/assert; fi
|
||||
|
||||
.PHONY: dependencies
|
||||
dependencies:: tools
|
||||
glide install
|
||||
|
||||
.PHONY: clean
|
||||
clean:: tools
|
||||
glide cache-clear
|
||||
|
||||
.PHONY: test
|
||||
test:: dependencies
|
||||
go test -v \
|
||||
$(shell glide novendor)
|
||||
|
||||
.PHONY: bench
|
||||
bench:: dependencies
|
||||
go test \
|
||||
-bench=. -v \
|
||||
$(shell glide novendor)
|
||||
|
||||
.PHONY: lint
|
||||
lint:: dependencies
|
||||
go vet $(shell glide novendor)
|
||||
gometalinter \
|
||||
--deadline=5m \
|
||||
--concurrency=$(numcpus) \
|
||||
$(shell glide novendor)
|
||||
|
||||
.PHONY: check
|
||||
check:: lint test
|
||||
90
vendor/github.com/icrowley/fake/README.md
сгенерированный
поставляемый
90
vendor/github.com/icrowley/fake/README.md
сгенерированный
поставляемый
@@ -1,90 +0,0 @@
|
||||
[](https://travis-ci.org/icrowley/fake) [](https://godoc.org/github.com/icrowley/fake) [](https://raw.githubusercontent.com/icrowley/fake/master/LICENSE)
|
||||
|
||||
Fake
|
||||
====
|
||||
|
||||
Fake is a fake data generator for Go (Golang), heavily inspired by the forgery and ffaker Ruby gems.
|
||||
|
||||
## About
|
||||
|
||||
Most data and methods are ported from forgery/ffaker Ruby gems.
|
||||
For the list of available methods please look at https://godoc.org/github.com/icrowley/fake.
|
||||
Currently english and russian languages are available.
|
||||
|
||||
Fake embeds samples data files unless you call `UseExternalData(true)` in order to be able to work without external files dependencies when compiled, so, if you add new data files or make changes to existing ones don't forget to regenerate data.go file using `github.com/mjibson/esc` tool and `esc -o data.go -pkg fake data` command (or you can just use `go generate` command if you are using Go 1.4 or later).
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
go get github.com/icrowley/fake
|
||||
```
|
||||
|
||||
## Import
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/icrowley/fake"
|
||||
)
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found at godoc:
|
||||
|
||||
https://godoc.org/github.com/icrowley/fake
|
||||
|
||||
## Test
|
||||
To run the project tests:
|
||||
|
||||
```shell
|
||||
cd test
|
||||
go test
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```go
|
||||
name := fake.FirstName()
|
||||
fullname := fake.FullName()
|
||||
product := fake.Product()
|
||||
```
|
||||
|
||||
Changing language:
|
||||
|
||||
```go
|
||||
err := fake.SetLang("ru")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
password := fake.SimplePassword()
|
||||
```
|
||||
|
||||
Using english fallback:
|
||||
|
||||
```go
|
||||
err := fake.SetLang("ru")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fake.EnFallback(true)
|
||||
password := fake.Paragraph()
|
||||
```
|
||||
|
||||
Using external data:
|
||||
|
||||
```go
|
||||
fake.UseExternalData(true)
|
||||
password := fake.Paragraph()
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
Dmitry Afanasyev,
|
||||
http://twitter.com/i_crowley
|
||||
dimarzio1986@gmail.com
|
||||
|
||||
|
||||
### Maintainers
|
||||
|
||||
Dmitry Moskowski
|
||||
https://github.com/corpix
|
||||
69
vendor/github.com/icrowley/fake/addresses.go
сгенерированный
поставляемый
69
vendor/github.com/icrowley/fake/addresses.go
сгенерированный
поставляемый
@@ -1,69 +0,0 @@
|
||||
package fake
|
||||
|
||||
import "strconv"
|
||||
|
||||
// Continent generates random continent
|
||||
func Continent() string {
|
||||
return lookup(lang, "continents", true)
|
||||
}
|
||||
|
||||
// Country generates random country
|
||||
func Country() string {
|
||||
return lookup(lang, "countries", true)
|
||||
}
|
||||
|
||||
// City generates random city
|
||||
func City() string {
|
||||
city := lookup(lang, "cities", true)
|
||||
switch r.Intn(5) {
|
||||
case 0:
|
||||
return join(cityPrefix(), city)
|
||||
case 1:
|
||||
return join(city, citySuffix())
|
||||
default:
|
||||
return city
|
||||
}
|
||||
}
|
||||
|
||||
func cityPrefix() string {
|
||||
return lookup(lang, "city_prefixes", false)
|
||||
}
|
||||
|
||||
func citySuffix() string {
|
||||
return lookup(lang, "city_suffixes", false)
|
||||
}
|
||||
|
||||
// State generates random state
|
||||
func State() string {
|
||||
return lookup(lang, "states", false)
|
||||
}
|
||||
|
||||
// StateAbbrev generates random state abbreviation
|
||||
func StateAbbrev() string {
|
||||
return lookup(lang, "state_abbrevs", false)
|
||||
}
|
||||
|
||||
// Street generates random street name
|
||||
func Street() string {
|
||||
street := lookup(lang, "streets", true)
|
||||
return join(street, streetSuffix())
|
||||
}
|
||||
|
||||
// StreetAddress generates random street name along with building number
|
||||
func StreetAddress() string {
|
||||
return join(Street(), strconv.Itoa(r.Intn(100)))
|
||||
}
|
||||
|
||||
func streetSuffix() string {
|
||||
return lookup(lang, "street_suffixes", true)
|
||||
}
|
||||
|
||||
// Zip generates random zip code using one of the formats specifies in zip_format file
|
||||
func Zip() string {
|
||||
return generate(lang, "zips", true)
|
||||
}
|
||||
|
||||
// Phone generates random phone number using one of the formats format specified in phone_format file
|
||||
func Phone() string {
|
||||
return generate(lang, "phones", true)
|
||||
}
|
||||
69
vendor/github.com/icrowley/fake/credit_cards.go
сгенерированный
поставляемый
69
vendor/github.com/icrowley/fake/credit_cards.go
сгенерированный
поставляемый
@@ -1,69 +0,0 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type creditCard struct {
|
||||
vendor string
|
||||
length int
|
||||
prefixes []int
|
||||
}
|
||||
|
||||
var creditCards = map[string]creditCard{
|
||||
"visa": {"VISA", 16, []int{4539, 4556, 4916, 4532, 4929, 40240071, 4485, 4716, 4}},
|
||||
"mastercard": {"MasterCard", 16, []int{51, 52, 53, 54, 55}},
|
||||
"amex": {"American Express", 15, []int{34, 37}},
|
||||
"discover": {"Discover", 16, []int{6011}},
|
||||
}
|
||||
|
||||
// CreditCardType returns one of the following credit values:
|
||||
// VISA, MasterCard, American Express and Discover
|
||||
func CreditCardType() string {
|
||||
n := len(creditCards)
|
||||
var vendors []string
|
||||
for _, cc := range creditCards {
|
||||
vendors = append(vendors, cc.vendor)
|
||||
}
|
||||
|
||||
return vendors[r.Intn(n)]
|
||||
}
|
||||
|
||||
// CreditCardNum generated credit card number according to the card number rules
|
||||
func CreditCardNum(vendor string) string {
|
||||
if vendor != "" {
|
||||
vendor = strings.ToLower(vendor)
|
||||
} else {
|
||||
var vendors []string
|
||||
for v := range creditCards {
|
||||
vendors = append(vendors, v)
|
||||
}
|
||||
vendor = vendors[r.Intn(len(vendors))]
|
||||
}
|
||||
card := creditCards[vendor]
|
||||
prefix := strconv.Itoa(card.prefixes[r.Intn(len(card.prefixes))])
|
||||
num := []rune(prefix)
|
||||
for i := 0; i < card.length-len(prefix); i++ {
|
||||
num = append(num, genCCDigit(num))
|
||||
}
|
||||
return string(num)
|
||||
}
|
||||
|
||||
func genCCDigit(num []rune) rune {
|
||||
sum := 0
|
||||
for i := len(num) - 1; i >= 0; i-- {
|
||||
n := int(num[i])
|
||||
if i%2 != 0 {
|
||||
sum += n
|
||||
} else {
|
||||
if n*2 > 9 {
|
||||
sum += n*2 - 9
|
||||
} else {
|
||||
sum += n * 2
|
||||
}
|
||||
}
|
||||
}
|
||||
return rune(((sum/10+1)*10 - sum) % 10)
|
||||
}
|
||||
11
vendor/github.com/icrowley/fake/currencies.go
сгенерированный
поставляемый
11
vendor/github.com/icrowley/fake/currencies.go
сгенерированный
поставляемый
@@ -1,11 +0,0 @@
|
||||
package fake
|
||||
|
||||
// Currency generates currency name
|
||||
func Currency() string {
|
||||
return lookup(lang, "currencies", true)
|
||||
}
|
||||
|
||||
// CurrencyCode generates currency code
|
||||
func CurrencyCode() string {
|
||||
return lookup(lang, "currency_codes", true)
|
||||
}
|
||||
493
vendor/github.com/icrowley/fake/data.go
сгенерированный
поставляемый
493
vendor/github.com/icrowley/fake/data.go
сгенерированный
поставляемый
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
42
vendor/github.com/icrowley/fake/dates.go
сгенерированный
поставляемый
42
vendor/github.com/icrowley/fake/dates.go
сгенерированный
поставляемый
@@ -1,42 +0,0 @@
|
||||
package fake
|
||||
|
||||
// Day generates day of the month
|
||||
func Day() int {
|
||||
return r.Intn(31) + 1
|
||||
}
|
||||
|
||||
// WeekDay generates name ot the week day
|
||||
func WeekDay() string {
|
||||
return lookup(lang, "weekdays", true)
|
||||
}
|
||||
|
||||
// WeekDayShort generates abbreviated name of the week day
|
||||
func WeekDayShort() string {
|
||||
return lookup(lang, "weekdays_short", true)
|
||||
}
|
||||
|
||||
// WeekdayNum generates number of the day of the week
|
||||
func WeekdayNum() int {
|
||||
return r.Intn(7) + 1
|
||||
}
|
||||
|
||||
// Month generates month name
|
||||
func Month() string {
|
||||
return lookup(lang, "months", true)
|
||||
}
|
||||
|
||||
// MonthShort generates abbreviated month name
|
||||
func MonthShort() string {
|
||||
return lookup(lang, "months_short", true)
|
||||
}
|
||||
|
||||
// MonthNum generates month number (from 1 to 12)
|
||||
func MonthNum() int {
|
||||
return r.Intn(12) + 1
|
||||
}
|
||||
|
||||
// Year generates year using the given boundaries
|
||||
func Year(from, to int) int {
|
||||
n := r.Intn(to-from) + 1
|
||||
return from + n
|
||||
}
|
||||
214
vendor/github.com/icrowley/fake/fake.go
сгенерированный
поставляемый
214
vendor/github.com/icrowley/fake/fake.go
сгенерированный
поставляемый
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
Package fake is the fake data generatror for go (Golang), heavily inspired by forgery and ffaker Ruby gems
|
||||
|
||||
Most data and methods are ported from forgery/ffaker Ruby gems.
|
||||
|
||||
Currently english and russian languages are available.
|
||||
|
||||
For the list of available methods please look at https://godoc.org/github.com/icrowley/fake.
|
||||
|
||||
Fake embeds samples data files unless you call UseExternalData(true) in order to be able to work without external files dependencies when compiled, so, if you add new data files or make changes to existing ones don't forget to regenerate data.go file using github.com/mjibson/esc tool and esc -o data.go -pkg fake data command (or you can just use go generate command if you are using Go 1.4 or later).
|
||||
|
||||
Examples:
|
||||
name := fake.FirstName()
|
||||
fullname = := fake.FullName()
|
||||
product := fake.Product()
|
||||
|
||||
Changing language:
|
||||
err := fake.SetLang("ru")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
password := fake.SimplePassword()
|
||||
|
||||
Using english fallback:
|
||||
err := fake.SetLang("ru")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fake.EnFallback(true)
|
||||
password := fake.Paragraph()
|
||||
|
||||
Using external data:
|
||||
fake.UseExternalData(true)
|
||||
password := fake.Paragraph()
|
||||
*/
|
||||
package fake
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:generate go get github.com/mjibson/esc
|
||||
//go:generate esc -o data.go -pkg fake data
|
||||
|
||||
// cat/subcat/lang/samples
|
||||
type samplesTree map[string]map[string][]string
|
||||
|
||||
var samplesLock sync.Mutex
|
||||
var samplesCache = make(samplesTree)
|
||||
var r = rand.New(&rndSrc{src: rand.NewSource(time.Now().UnixNano())})
|
||||
var lang = "en"
|
||||
var useExternalData = false
|
||||
var enFallback = true
|
||||
var availLangs = GetLangs()
|
||||
|
||||
var (
|
||||
// ErrNoLanguageFn is the error that indicates that given language is not available
|
||||
ErrNoLanguageFn = func(lang string) error { return fmt.Errorf("The language passed (%s) is not available", lang) }
|
||||
// ErrNoSamplesFn is the error that indicates that there are no samples for the given language
|
||||
ErrNoSamplesFn = func(lang string) error { return fmt.Errorf("No samples found for language: %s", lang) }
|
||||
)
|
||||
|
||||
// Seed uses the provided seed value to initialize the internal PRNG to a
|
||||
// deterministic state.
|
||||
func Seed(seed int64) {
|
||||
r.Seed(seed)
|
||||
}
|
||||
|
||||
type rndSrc struct {
|
||||
mtx sync.Mutex
|
||||
src rand.Source
|
||||
}
|
||||
|
||||
func (s *rndSrc) Int63() int64 {
|
||||
s.mtx.Lock()
|
||||
n := s.src.Int63()
|
||||
s.mtx.Unlock()
|
||||
return n
|
||||
}
|
||||
|
||||
func (s *rndSrc) Seed(n int64) {
|
||||
s.mtx.Lock()
|
||||
s.src.Seed(n)
|
||||
s.mtx.Unlock()
|
||||
}
|
||||
|
||||
// GetLangs returns a slice of available languages
|
||||
func GetLangs() []string {
|
||||
var langs []string
|
||||
for k, v := range data {
|
||||
if v.isDir && k != "/" && k != "/data" {
|
||||
langs = append(langs, strings.Replace(k, "/data/", "", 1))
|
||||
}
|
||||
}
|
||||
return langs
|
||||
}
|
||||
|
||||
// SetLang sets the language in which the data should be generated
|
||||
// returns error if passed language is not available
|
||||
func SetLang(newLang string) error {
|
||||
found := false
|
||||
for _, l := range availLangs {
|
||||
if newLang == l {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return ErrNoLanguageFn(newLang)
|
||||
}
|
||||
lang = newLang
|
||||
return nil
|
||||
}
|
||||
|
||||
// UseExternalData sets the flag that allows using of external files as data providers (fake uses embedded ones by default)
|
||||
func UseExternalData(flag bool) {
|
||||
useExternalData = flag
|
||||
}
|
||||
|
||||
// EnFallback sets the flag that allows fake to fallback to englsh samples if the ones for the used languaged are not available
|
||||
func EnFallback(flag bool) {
|
||||
enFallback = flag
|
||||
}
|
||||
|
||||
func (st samplesTree) hasKeyPath(lang, cat string) bool {
|
||||
if _, ok := st[lang]; ok {
|
||||
if _, ok = st[lang][cat]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func join(parts ...string) string {
|
||||
var filtered []string
|
||||
for _, part := range parts {
|
||||
if part != "" {
|
||||
filtered = append(filtered, part)
|
||||
}
|
||||
}
|
||||
return strings.Join(filtered, " ")
|
||||
}
|
||||
|
||||
func generate(lang, cat string, fallback bool) string {
|
||||
format := lookup(lang, cat+"_format", fallback)
|
||||
var result string
|
||||
for _, ru := range format {
|
||||
if ru != '#' {
|
||||
result += string(ru)
|
||||
} else {
|
||||
result += strconv.Itoa(r.Intn(10))
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func lookup(lang, cat string, fallback bool) string {
|
||||
samplesLock.Lock()
|
||||
s := _lookup(lang, cat, fallback)
|
||||
samplesLock.Unlock()
|
||||
return s
|
||||
}
|
||||
|
||||
func _lookup(lang, cat string, fallback bool) string {
|
||||
var samples []string
|
||||
|
||||
if samplesCache.hasKeyPath(lang, cat) {
|
||||
samples = samplesCache[lang][cat]
|
||||
} else {
|
||||
var err error
|
||||
samples, err = populateSamples(lang, cat)
|
||||
if err != nil {
|
||||
if lang != "en" && fallback && enFallback && err.Error() == ErrNoSamplesFn(lang).Error() {
|
||||
return _lookup("en", cat, false)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
return samples[r.Intn(len(samples))]
|
||||
}
|
||||
|
||||
func populateSamples(lang, cat string) ([]string, error) {
|
||||
data, err := readFile(lang, cat)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, ok := samplesCache[lang]; !ok {
|
||||
samplesCache[lang] = make(map[string][]string)
|
||||
}
|
||||
|
||||
samples := strings.Split(strings.TrimSpace(string(data)), "\n")
|
||||
|
||||
samplesCache[lang][cat] = samples
|
||||
return samples, nil
|
||||
}
|
||||
|
||||
func readFile(lang, cat string) ([]byte, error) {
|
||||
fullpath := fmt.Sprintf("/data/%s/%s", lang, cat)
|
||||
file, err := FS(useExternalData).Open(fullpath)
|
||||
if err != nil {
|
||||
return nil, ErrNoSamplesFn(lang)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
return ioutil.ReadAll(file)
|
||||
}
|
||||
79
vendor/github.com/icrowley/fake/general.go
сгенерированный
поставляемый
79
vendor/github.com/icrowley/fake/general.go
сгенерированный
поставляемый
@@ -1,79 +0,0 @@
|
||||
package fake
|
||||
|
||||
var lowerLetters = []rune("abcdefghijklmnopqrstuvwxyz")
|
||||
var upperLetters = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
var numeric = []rune("0123456789")
|
||||
var specialChars = []rune(`!'@#$%^&*()_+-=[]{};:",./?`)
|
||||
var hexDigits = []rune("0123456789abcdef")
|
||||
|
||||
func text(atLeast, atMost int, allowLower, allowUpper, allowNumeric, allowSpecial bool) string {
|
||||
allowedChars := []rune{}
|
||||
if allowLower {
|
||||
allowedChars = append(allowedChars, lowerLetters...)
|
||||
}
|
||||
if allowUpper {
|
||||
allowedChars = append(allowedChars, upperLetters...)
|
||||
}
|
||||
if allowNumeric {
|
||||
allowedChars = append(allowedChars, numeric...)
|
||||
}
|
||||
if allowSpecial {
|
||||
allowedChars = append(allowedChars, specialChars...)
|
||||
}
|
||||
|
||||
result := []rune{}
|
||||
nTimes := r.Intn(atMost-atLeast+1) + atLeast
|
||||
for i := 0; i < nTimes; i++ {
|
||||
result = append(result, allowedChars[r.Intn(len(allowedChars))])
|
||||
}
|
||||
return string(result)
|
||||
}
|
||||
|
||||
// Password generates password with the length from atLeast to atMOst charachers,
|
||||
// allow* parameters specify whether corresponding symbols can be used
|
||||
func Password(atLeast, atMost int, allowUpper, allowNumeric, allowSpecial bool) string {
|
||||
return text(atLeast, atMost, true, allowUpper, allowNumeric, allowSpecial)
|
||||
}
|
||||
|
||||
// SimplePassword is a wrapper around Password,
|
||||
// it generates password with the length from 6 to 12 symbols, with upper characters and numeric symbols allowed
|
||||
func SimplePassword() string {
|
||||
return Password(6, 12, true, true, false)
|
||||
}
|
||||
|
||||
// Color generates color name
|
||||
func Color() string {
|
||||
return lookup(lang, "colors", true)
|
||||
}
|
||||
|
||||
// DigitsN returns n digits as a string
|
||||
func DigitsN(n int) string {
|
||||
digits := make([]rune, n)
|
||||
for i := 0; i < n; i++ {
|
||||
digits[i] = numeric[r.Intn(len(numeric))]
|
||||
}
|
||||
return string(digits)
|
||||
}
|
||||
|
||||
// Digits returns from 1 to 5 digits as a string
|
||||
func Digits() string {
|
||||
return DigitsN(r.Intn(5) + 1)
|
||||
}
|
||||
|
||||
func hexDigitsStr(n int) string {
|
||||
var num []rune
|
||||
for i := 0; i < n; i++ {
|
||||
num = append(num, hexDigits[r.Intn(len(hexDigits))])
|
||||
}
|
||||
return string(num)
|
||||
}
|
||||
|
||||
// HexColor generates hex color name
|
||||
func HexColor() string {
|
||||
return hexDigitsStr(6)
|
||||
}
|
||||
|
||||
// HexColorShort generates short hex color name
|
||||
func HexColorShort() string {
|
||||
return hexDigitsStr(3)
|
||||
}
|
||||
57
vendor/github.com/icrowley/fake/geo.go
сгенерированный
поставляемый
57
vendor/github.com/icrowley/fake/geo.go
сгенерированный
поставляемый
@@ -1,57 +0,0 @@
|
||||
package fake
|
||||
|
||||
// Latitude generates latitude (from -90.0 to 90.0)
|
||||
func Latitude() float32 {
|
||||
return r.Float32()*180 - 90
|
||||
}
|
||||
|
||||
// LatitudeDegrees generates latitude degrees (from -90 to 90)
|
||||
func LatitudeDegrees() int {
|
||||
return r.Intn(180) - 90
|
||||
}
|
||||
|
||||
// LatitudeMinutes generates latitude minutes (from 0 to 60)
|
||||
func LatitudeMinutes() int {
|
||||
return r.Intn(60)
|
||||
}
|
||||
|
||||
// LatitudeSeconds generates latitude seconds (from 0 to 60)
|
||||
func LatitudeSeconds() int {
|
||||
return r.Intn(60)
|
||||
}
|
||||
|
||||
// LatitudeDirection generates latitude direction (N(orth) o S(outh))
|
||||
func LatitudeDirection() string {
|
||||
if r.Intn(2) == 0 {
|
||||
return "N"
|
||||
}
|
||||
return "S"
|
||||
}
|
||||
|
||||
// Longitude generates longitude (from -180 to 180)
|
||||
func Longitude() float32 {
|
||||
return r.Float32()*360 - 180
|
||||
}
|
||||
|
||||
// LongitudeDegrees generates longitude degrees (from -180 to 180)
|
||||
func LongitudeDegrees() int {
|
||||
return r.Intn(360) - 180
|
||||
}
|
||||
|
||||
// LongitudeMinutes generates (from 0 to 60)
|
||||
func LongitudeMinutes() int {
|
||||
return r.Intn(60)
|
||||
}
|
||||
|
||||
// LongitudeSeconds generates (from 0 to 60)
|
||||
func LongitudeSeconds() int {
|
||||
return r.Intn(60)
|
||||
}
|
||||
|
||||
// LongitudeDirection generates (W(est) or E(ast))
|
||||
func LongitudeDirection() string {
|
||||
if r.Intn(2) == 0 {
|
||||
return "W"
|
||||
}
|
||||
return "E"
|
||||
}
|
||||
6
vendor/github.com/icrowley/fake/glide.lock
сгенерированный
поставляемый
6
vendor/github.com/icrowley/fake/glide.lock
сгенерированный
поставляемый
@@ -1,6 +0,0 @@
|
||||
hash: 9238b15272824ad573d8ef645fb468cb646b72598c63eae8977c3410ebfebe4a
|
||||
updated: 2017-07-23T15:10:00.972860398Z
|
||||
imports:
|
||||
- name: github.com/corpix/uarand
|
||||
version: 031be390f409fb4bac8fb299e3bcd101479f89f8
|
||||
testImports: []
|
||||
3
vendor/github.com/icrowley/fake/glide.yaml
сгенерированный
поставляемый
3
vendor/github.com/icrowley/fake/glide.yaml
сгенерированный
поставляемый
@@ -1,3 +0,0 @@
|
||||
package: github.com/icrowley/fake
|
||||
import:
|
||||
- package: github.com/corpix/uarand
|
||||
77
vendor/github.com/icrowley/fake/internet.go
сгенерированный
поставляемый
77
vendor/github.com/icrowley/fake/internet.go
сгенерированный
поставляемый
@@ -1,77 +0,0 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/corpix/uarand"
|
||||
)
|
||||
|
||||
// UserName generates user name in one of the following forms
|
||||
// first name + last name, letter + last names or concatenation of from 1 to 3 lowercased words
|
||||
func UserName() string {
|
||||
gender := randGender()
|
||||
switch r.Intn(3) {
|
||||
case 0:
|
||||
return lookup("en", gender+"_first_names", false) + lookup(lang, gender+"_last_names", false)
|
||||
case 1:
|
||||
return Character() + lookup(lang, gender+"_last_names", false)
|
||||
default:
|
||||
return strings.Replace(WordsN(r.Intn(3)+1), " ", "_", -1)
|
||||
}
|
||||
}
|
||||
|
||||
// TopLevelDomain generates random top level domain
|
||||
func TopLevelDomain() string {
|
||||
return lookup(lang, "top_level_domains", true)
|
||||
}
|
||||
|
||||
// DomainName generates random domain name
|
||||
func DomainName() string {
|
||||
return Company() + "." + TopLevelDomain()
|
||||
}
|
||||
|
||||
// EmailAddress generates email address
|
||||
func EmailAddress() string {
|
||||
return UserName() + "@" + DomainName()
|
||||
}
|
||||
|
||||
// EmailSubject generates random email subject
|
||||
func EmailSubject() string {
|
||||
return Sentence()
|
||||
}
|
||||
|
||||
// EmailBody generates random email body
|
||||
func EmailBody() string {
|
||||
return Paragraphs()
|
||||
}
|
||||
|
||||
// DomainZone generates random domain zone
|
||||
func DomainZone() string {
|
||||
return lookup(lang, "domain_zones", true)
|
||||
}
|
||||
|
||||
// IPv4 generates IPv4 address
|
||||
func IPv4() string {
|
||||
size := 4
|
||||
ip := make([]byte, size)
|
||||
for i := 0; i < size; i++ {
|
||||
ip[i] = byte(r.Intn(256))
|
||||
}
|
||||
return net.IP(ip).To4().String()
|
||||
}
|
||||
|
||||
// IPv6 generates IPv6 address
|
||||
func IPv6() string {
|
||||
size := 16
|
||||
ip := make([]byte, size)
|
||||
for i := 0; i < size; i++ {
|
||||
ip[i] = byte(r.Intn(256))
|
||||
}
|
||||
return net.IP(ip).To16().String()
|
||||
}
|
||||
|
||||
// UserAgent generates a random user agent.
|
||||
func UserAgent() string {
|
||||
return uarand.GetRandom()
|
||||
}
|
||||
25
vendor/github.com/icrowley/fake/jobs.go
сгенерированный
поставляемый
25
vendor/github.com/icrowley/fake/jobs.go
сгенерированный
поставляемый
@@ -1,25 +0,0 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Company generates company name
|
||||
func Company() string {
|
||||
return lookup(lang, "companies", true)
|
||||
}
|
||||
|
||||
// JobTitle generates job title
|
||||
func JobTitle() string {
|
||||
job := lookup(lang, "jobs", true)
|
||||
return strings.Replace(job, "#{N}", jobTitleSuffix(), 1)
|
||||
}
|
||||
|
||||
func jobTitleSuffix() string {
|
||||
return lookup(lang, "jobs_suffixes", false)
|
||||
}
|
||||
|
||||
// Industry generates industry name
|
||||
func Industry() string {
|
||||
return lookup(lang, "industries", true)
|
||||
}
|
||||
103
vendor/github.com/icrowley/fake/lorem_ipsum.go
сгенерированный
поставляемый
103
vendor/github.com/icrowley/fake/lorem_ipsum.go
сгенерированный
поставляемый
@@ -1,103 +0,0 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Character generates random character in the given language
|
||||
func Character() string {
|
||||
return lookup(lang, "characters", true)
|
||||
}
|
||||
|
||||
// CharactersN generates n random characters in the given language
|
||||
func CharactersN(n int) string {
|
||||
var chars []string
|
||||
for i := 0; i < n; i++ {
|
||||
chars = append(chars, Character())
|
||||
}
|
||||
return strings.Join(chars, "")
|
||||
}
|
||||
|
||||
// Characters generates from 1 to 5 characters in the given language
|
||||
func Characters() string {
|
||||
return CharactersN(r.Intn(5) + 1)
|
||||
}
|
||||
|
||||
// Word generates random word
|
||||
func Word() string {
|
||||
return lookup(lang, "words", true)
|
||||
}
|
||||
|
||||
// WordsN generates n random words
|
||||
func WordsN(n int) string {
|
||||
words := make([]string, n)
|
||||
for i := 0; i < n; i++ {
|
||||
words[i] = Word()
|
||||
}
|
||||
return strings.Join(words, " ")
|
||||
}
|
||||
|
||||
// Words generates from 1 to 5 random words
|
||||
func Words() string {
|
||||
return WordsN(r.Intn(5) + 1)
|
||||
}
|
||||
|
||||
// Title generates from 2 to 5 titleized words
|
||||
func Title() string {
|
||||
return strings.ToTitle(WordsN(2 + r.Intn(4)))
|
||||
}
|
||||
|
||||
// Sentence generates random sentence
|
||||
func Sentence() string {
|
||||
var words []string
|
||||
for i := 0; i < 3+r.Intn(12); i++ {
|
||||
word := Word()
|
||||
if r.Intn(5) == 0 {
|
||||
word += ","
|
||||
}
|
||||
words = append(words, Word())
|
||||
}
|
||||
|
||||
sentence := strings.Join(words, " ")
|
||||
|
||||
if r.Intn(8) == 0 {
|
||||
sentence += "!"
|
||||
} else {
|
||||
sentence += "."
|
||||
}
|
||||
|
||||
return sentence
|
||||
}
|
||||
|
||||
// SentencesN generates n random sentences
|
||||
func SentencesN(n int) string {
|
||||
sentences := make([]string, n)
|
||||
for i := 0; i < n; i++ {
|
||||
sentences[i] = Sentence()
|
||||
}
|
||||
return strings.Join(sentences, " ")
|
||||
}
|
||||
|
||||
// Sentences generates from 1 to 5 random sentences
|
||||
func Sentences() string {
|
||||
return SentencesN(r.Intn(5) + 1)
|
||||
}
|
||||
|
||||
// Paragraph generates paragraph
|
||||
func Paragraph() string {
|
||||
return SentencesN(r.Intn(10) + 1)
|
||||
}
|
||||
|
||||
// ParagraphsN generates n paragraphs
|
||||
func ParagraphsN(n int) string {
|
||||
var paragraphs []string
|
||||
for i := 0; i < n; i++ {
|
||||
paragraphs = append(paragraphs, Paragraph())
|
||||
}
|
||||
return strings.Join(paragraphs, "\t")
|
||||
}
|
||||
|
||||
// Paragraphs generates from 1 to 5 paragraphs
|
||||
func Paragraphs() string {
|
||||
return ParagraphsN(r.Intn(5) + 1)
|
||||
}
|
||||
147
vendor/github.com/icrowley/fake/names.go
сгенерированный
поставляемый
147
vendor/github.com/icrowley/fake/names.go
сгенерированный
поставляемый
@@ -1,147 +0,0 @@
|
||||
package fake
|
||||
|
||||
func randGender() string {
|
||||
g := "male"
|
||||
if r.Intn(2) == 0 {
|
||||
g = "female"
|
||||
}
|
||||
return g
|
||||
}
|
||||
|
||||
func firstName(gender string) string {
|
||||
return lookup(lang, gender+"_first_names", true)
|
||||
}
|
||||
|
||||
// MaleFirstName generates male first name
|
||||
func MaleFirstName() string {
|
||||
return firstName("male")
|
||||
}
|
||||
|
||||
// FemaleFirstName generates female first name
|
||||
func FemaleFirstName() string {
|
||||
return firstName("female")
|
||||
}
|
||||
|
||||
// FirstName generates first name
|
||||
func FirstName() string {
|
||||
return firstName(randGender())
|
||||
}
|
||||
|
||||
func lastName(gender string) string {
|
||||
return lookup(lang, gender+"_last_names", true)
|
||||
}
|
||||
|
||||
// MaleLastName generates male last name
|
||||
func MaleLastName() string {
|
||||
return lastName("male")
|
||||
}
|
||||
|
||||
// FemaleLastName generates female last name
|
||||
func FemaleLastName() string {
|
||||
return lastName("female")
|
||||
}
|
||||
|
||||
// LastName generates last name
|
||||
func LastName() string {
|
||||
return lastName(randGender())
|
||||
}
|
||||
|
||||
func patronymic(gender string) string {
|
||||
return lookup(lang, gender+"_patronymics", false)
|
||||
}
|
||||
|
||||
// MalePatronymic generates male patronymic
|
||||
func MalePatronymic() string {
|
||||
return patronymic("male")
|
||||
}
|
||||
|
||||
// FemalePatronymic generates female patronymic
|
||||
func FemalePatronymic() string {
|
||||
return patronymic("female")
|
||||
}
|
||||
|
||||
// Patronymic generates patronymic
|
||||
func Patronymic() string {
|
||||
return patronymic(randGender())
|
||||
}
|
||||
|
||||
func prefix(gender string) string {
|
||||
return lookup(lang, gender+"_name_prefixes", false)
|
||||
}
|
||||
|
||||
func suffix(gender string) string {
|
||||
return lookup(lang, gender+"_name_suffixes", false)
|
||||
}
|
||||
|
||||
func fullNameWithPrefix(gender string) string {
|
||||
return join(prefix(gender), firstName(gender), lastName(gender))
|
||||
}
|
||||
|
||||
// MaleFullNameWithPrefix generates prefixed male full name
|
||||
// if prefixes for the given language are available
|
||||
func MaleFullNameWithPrefix() string {
|
||||
return fullNameWithPrefix("male")
|
||||
}
|
||||
|
||||
// FemaleFullNameWithPrefix generates prefixed female full name
|
||||
// if prefixes for the given language are available
|
||||
func FemaleFullNameWithPrefix() string {
|
||||
return fullNameWithPrefix("female")
|
||||
}
|
||||
|
||||
// FullNameWithPrefix generates prefixed full name
|
||||
// if prefixes for the given language are available
|
||||
func FullNameWithPrefix() string {
|
||||
return fullNameWithPrefix(randGender())
|
||||
}
|
||||
|
||||
func fullNameWithSuffix(gender string) string {
|
||||
return join(firstName(gender), lastName(gender), suffix(gender))
|
||||
}
|
||||
|
||||
// MaleFullNameWithSuffix generates suffixed male full name
|
||||
// if suffixes for the given language are available
|
||||
func MaleFullNameWithSuffix() string {
|
||||
return fullNameWithPrefix("male")
|
||||
}
|
||||
|
||||
// FemaleFullNameWithSuffix generates suffixed female full name
|
||||
// if suffixes for the given language are available
|
||||
func FemaleFullNameWithSuffix() string {
|
||||
return fullNameWithPrefix("female")
|
||||
}
|
||||
|
||||
// FullNameWithSuffix generates suffixed full name
|
||||
// if suffixes for the given language are available
|
||||
func FullNameWithSuffix() string {
|
||||
return fullNameWithPrefix(randGender())
|
||||
}
|
||||
|
||||
func fullName(gender string) string {
|
||||
switch r.Intn(10) {
|
||||
case 0:
|
||||
return fullNameWithPrefix(gender)
|
||||
case 1:
|
||||
return fullNameWithSuffix(gender)
|
||||
default:
|
||||
return join(firstName(gender), lastName(gender))
|
||||
}
|
||||
}
|
||||
|
||||
// MaleFullName generates male full name
|
||||
// it can occasionally include prefix or suffix
|
||||
func MaleFullName() string {
|
||||
return fullName("male")
|
||||
}
|
||||
|
||||
// FemaleFullName generates female full name
|
||||
// it can occasionally include prefix or suffix
|
||||
func FemaleFullName() string {
|
||||
return fullName("female")
|
||||
}
|
||||
|
||||
// FullName generates full name
|
||||
// it can occasionally include prefix or suffix
|
||||
func FullName() string {
|
||||
return fullName(randGender())
|
||||
}
|
||||
24
vendor/github.com/icrowley/fake/personal.go
сгенерированный
поставляемый
24
vendor/github.com/icrowley/fake/personal.go
сгенерированный
поставляемый
@@ -1,24 +0,0 @@
|
||||
package fake
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Gender generates random gender
|
||||
func Gender() string {
|
||||
return lookup(lang, "genders", true)
|
||||
}
|
||||
|
||||
// GenderAbbrev returns first downcased letter of the random gender
|
||||
func GenderAbbrev() string {
|
||||
g := Gender()
|
||||
if g != "" {
|
||||
return strings.ToLower(string(g[0]))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Language generates random human language
|
||||
func Language() string {
|
||||
return lookup(lang, "languages", true)
|
||||
}
|
||||
26
vendor/github.com/icrowley/fake/products.go
сгенерированный
поставляемый
26
vendor/github.com/icrowley/fake/products.go
сгенерированный
поставляемый
@@ -1,26 +0,0 @@
|
||||
package fake
|
||||
|
||||
// Brand generates brand name
|
||||
func Brand() string {
|
||||
return Company()
|
||||
}
|
||||
|
||||
// ProductName generates product name
|
||||
func ProductName() string {
|
||||
productName := lookup(lang, "adjectives", true) + " " + lookup(lang, "nouns", true)
|
||||
if r.Intn(2) == 1 {
|
||||
productName = lookup(lang, "adjectives", true) + " " + productName
|
||||
}
|
||||
return productName
|
||||
}
|
||||
|
||||
// Product generates product title as brand + product name
|
||||
func Product() string {
|
||||
return Brand() + " " + ProductName()
|
||||
}
|
||||
|
||||
// Model generates model name that consists of letters and digits, optionally with a hyphen between them
|
||||
func Model() string {
|
||||
seps := []string{"", " ", "-"}
|
||||
return CharactersN(r.Intn(3)+1) + seps[r.Intn(len(seps))] + Digits()
|
||||
}
|
||||
28
vendor/github.com/mattermost/logr/v2/buffer.go
сгенерированный
поставляемый
Обычный файл
28
vendor/github.com/mattermost/logr/v2/buffer.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,28 @@
|
||||
package logr
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Buffer provides a thread-safe buffer useful for logging to memory in unit tests.
|
||||
type Buffer struct {
|
||||
buf bytes.Buffer
|
||||
mux sync.Mutex
|
||||
}
|
||||
|
||||
func (b *Buffer) Read(p []byte) (n int, err error) {
|
||||
b.mux.Lock()
|
||||
defer b.mux.Unlock()
|
||||
return b.buf.Read(p)
|
||||
}
|
||||
func (b *Buffer) Write(p []byte) (n int, err error) {
|
||||
b.mux.Lock()
|
||||
defer b.mux.Unlock()
|
||||
return b.buf.Write(p)
|
||||
}
|
||||
func (b *Buffer) String() string {
|
||||
b.mux.Lock()
|
||||
defer b.mux.Unlock()
|
||||
return b.buf.String()
|
||||
}
|
||||
8
vendor/github.com/mattermost/logr/v2/config/config.go
сгенерированный
поставляемый
8
vendor/github.com/mattermost/logr/v2/config/config.go
сгенерированный
поставляемый
@@ -31,8 +31,8 @@ type TargetFactory func(targetType string, options json.RawMessage) (logr.Target
|
||||
type FormatterFactory func(format string, options json.RawMessage) (logr.Formatter, error)
|
||||
|
||||
type Factories struct {
|
||||
targetFactory TargetFactory // can be nil
|
||||
formatterFactory FormatterFactory // can be nil
|
||||
TargetFactory TargetFactory // can be nil
|
||||
FormatterFactory FormatterFactory // can be nil
|
||||
}
|
||||
|
||||
var removeAll = func(ti logr.TargetInfo) bool { return true }
|
||||
@@ -56,7 +56,7 @@ func ConfigureTargets(lgr *logr.Logr, config map[string]TargetCfg, factories *Fa
|
||||
}
|
||||
|
||||
for name, tcfg := range config {
|
||||
target, err := newTarget(tcfg.Type, tcfg.Options, factories.targetFactory)
|
||||
target, err := newTarget(tcfg.Type, tcfg.Options, factories.TargetFactory)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating log target %s: %w", name, err)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func ConfigureTargets(lgr *logr.Logr, config map[string]TargetCfg, factories *Fa
|
||||
continue
|
||||
}
|
||||
|
||||
formatter, err := newFormatter(tcfg.Format, tcfg.FormatOptions, factories.formatterFactory)
|
||||
formatter, err := newFormatter(tcfg.Format, tcfg.FormatOptions, factories.FormatterFactory)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating formatter for log target %s: %w", name, err)
|
||||
}
|
||||
|
||||
2
vendor/github.com/mattermost/logr/v2/field.go
сгенерированный
поставляемый
2
vendor/github.com/mattermost/logr/v2/field.go
сгенерированный
поставляемый
@@ -15,7 +15,7 @@ var (
|
||||
Space = []byte{' '}
|
||||
Newline = []byte{'\n'}
|
||||
Quote = []byte{'"'}
|
||||
Colon = []byte{'"'}
|
||||
Colon = []byte{':'}
|
||||
)
|
||||
|
||||
// LogCloner is implemented by `Any` types that require a clone to be provided
|
||||
|
||||
6
vendor/github.com/mattermost/logr/v2/filterstd.go
сгенерированный
поставляемый
6
vendor/github.com/mattermost/logr/v2/filterstd.go
сгенерированный
поставляемый
@@ -11,6 +11,7 @@ type StdFilter struct {
|
||||
// is enabled for this filter.
|
||||
func (lt StdFilter) GetEnabledLevel(level Level) (Level, bool) {
|
||||
enabled := level.ID <= lt.Lvl.ID
|
||||
stackTrace := level.ID <= lt.Stacktrace.ID
|
||||
var levelEnabled Level
|
||||
|
||||
if enabled {
|
||||
@@ -33,6 +34,11 @@ func (lt StdFilter) GetEnabledLevel(level Level) (Level, bool) {
|
||||
levelEnabled = level
|
||||
}
|
||||
}
|
||||
|
||||
if stackTrace {
|
||||
levelEnabled.Stacktrace = true
|
||||
}
|
||||
|
||||
return levelEnabled, enabled
|
||||
}
|
||||
|
||||
|
||||
78
vendor/github.com/mattermost/logr/v2/sugar.go
сгенерированный
поставляемый
78
vendor/github.com/mattermost/logr/v2/sugar.go
сгенерированный
поставляемый
@@ -117,3 +117,81 @@ func (s Sugar) Fatalf(format string, args ...interface{}) {
|
||||
func (s Sugar) Panicf(format string, args ...interface{}) {
|
||||
s.Logf(Panic, format, args...)
|
||||
}
|
||||
|
||||
//
|
||||
// K/V style
|
||||
//
|
||||
|
||||
// With returns a new Sugar logger with the specified key/value pairs added to the
|
||||
// fields list.
|
||||
func (s Sugar) With(keyValuePairs ...interface{}) Sugar {
|
||||
return s.logger.With(s.argsToFields(keyValuePairs)...).Sugar()
|
||||
}
|
||||
|
||||
// Tracew outputs at trace level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Tracew(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Trace, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Debugw outputs at debug level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Debugw(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Debug, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Infow outputs at info level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Infow(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Info, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Warnw outputs at warn level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Warnw(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Warn, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Errorw outputs at error level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Errorw(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Error, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Fatalw outputs at fatal level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Fatalw(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Fatal, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// Panicw outputs at panic level with the specified key/value pairs converted to fields.
|
||||
func (s Sugar) Panicw(msg string, keyValuePairs ...interface{}) {
|
||||
s.logger.Log(Panic, msg, s.argsToFields(keyValuePairs)...)
|
||||
}
|
||||
|
||||
// argsToFields converts an array of args, possibly containing name/value pairs
|
||||
// into a []Field.
|
||||
func (s Sugar) argsToFields(keyValuePairs []interface{}) []Field {
|
||||
if len(keyValuePairs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
fields := make([]Field, 0, len(keyValuePairs))
|
||||
count := len(keyValuePairs)
|
||||
|
||||
for i := 0; i < count; {
|
||||
if fld, ok := keyValuePairs[i].(Field); ok {
|
||||
fields = append(fields, fld)
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
if i == count-1 {
|
||||
s.logger.Error("invalid key/value pair", Any("arg", keyValuePairs[i]))
|
||||
break
|
||||
}
|
||||
|
||||
// we should have a key/value pair now. The key must be a string.
|
||||
if key, ok := keyValuePairs[i].(string); !ok {
|
||||
s.logger.Error("invalid key for key/value pair", Int("pos", i))
|
||||
} else {
|
||||
fields = append(fields, Any(key, keyValuePairs[i+1]))
|
||||
}
|
||||
i += 2
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
72
vendor/github.com/mattermost/logr/v2/targets/testing.go
сгенерированный
поставляемый
Обычный файл
72
vendor/github.com/mattermost/logr/v2/targets/testing.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,72 @@
|
||||
package targets
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/logr/v2"
|
||||
"github.com/mattermost/logr/v2/formatters"
|
||||
)
|
||||
|
||||
// Testing is a simple log target that writes to a (*testing.T) log.
|
||||
type Testing struct {
|
||||
mux sync.Mutex
|
||||
t *testing.T
|
||||
}
|
||||
|
||||
func NewTestingTarget(t *testing.T) *Testing {
|
||||
return &Testing{
|
||||
t: t,
|
||||
}
|
||||
}
|
||||
|
||||
// Init is called once to initialize the target.
|
||||
func (tt *Testing) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Write outputs bytes to this file target.
|
||||
func (tt *Testing) Write(p []byte, rec *logr.LogRec) (int, error) {
|
||||
tt.mux.Lock()
|
||||
defer tt.mux.Unlock()
|
||||
|
||||
if tt.t != nil {
|
||||
s := strings.TrimSpace(string(p))
|
||||
tt.t.Log(s)
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// Shutdown is called once to free/close any resources.
|
||||
// Target queue is already drained when this is called.
|
||||
func (tt *Testing) Shutdown() error {
|
||||
tt.mux.Lock()
|
||||
defer tt.mux.Unlock()
|
||||
|
||||
tt.t = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateTestLogger creates a logger for unit tests. Log records are output to `(*testing.T).Log`.
|
||||
// A new logger is returned along with a method to shutdown the new logger.
|
||||
func CreateTestLogger(t *testing.T, levels ...logr.Level) (logger logr.Logger, shutdown func() error) {
|
||||
lgr, _ := logr.New()
|
||||
filter := logr.NewCustomFilter(levels...)
|
||||
formatter := &formatters.Plain{EnableCaller: true}
|
||||
target := NewTestingTarget(t)
|
||||
|
||||
if err := lgr.AddTarget(target, "test", filter, formatter, 1000); err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
shutdown = func() error {
|
||||
err := lgr.Shutdown()
|
||||
if err != nil {
|
||||
target.mux.Lock()
|
||||
target.t.Error("error shutting down test logger", err)
|
||||
target.mux.Unlock()
|
||||
}
|
||||
return err
|
||||
}
|
||||
return lgr.NewLogger(), shutdown
|
||||
}
|
||||
20
vendor/modules.txt
поставляемый
20
vendor/modules.txt
поставляемый
@@ -151,11 +151,6 @@ github.com/blevesearch/zap/v15
|
||||
# github.com/cespare/xxhash/v2 v2.1.1
|
||||
## explicit
|
||||
github.com/cespare/xxhash/v2
|
||||
# github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd
|
||||
## explicit
|
||||
# github.com/corpix/uarand v0.1.1
|
||||
## explicit
|
||||
github.com/corpix/uarand
|
||||
# github.com/couchbase/vellum v1.0.2
|
||||
github.com/couchbase/vellum
|
||||
github.com/couchbase/vellum/levenshtein
|
||||
@@ -318,9 +313,6 @@ github.com/hashicorp/memberlist
|
||||
# github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864
|
||||
## explicit
|
||||
github.com/hashicorp/yamux
|
||||
# github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
|
||||
## explicit
|
||||
github.com/icrowley/fake
|
||||
# github.com/inconshreveable/mousetrap v1.0.0
|
||||
github.com/inconshreveable/mousetrap
|
||||
# github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
||||
@@ -396,9 +388,7 @@ github.com/mattermost/gziphandler
|
||||
# github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d
|
||||
## explicit
|
||||
github.com/mattermost/ldap
|
||||
# github.com/mattermost/logr v1.0.13
|
||||
## explicit
|
||||
# github.com/mattermost/logr/v2 v2.0.10
|
||||
# github.com/mattermost/logr/v2 v2.0.15
|
||||
## explicit
|
||||
github.com/mattermost/logr/v2
|
||||
github.com/mattermost/logr/v2/config
|
||||
@@ -552,7 +542,6 @@ github.com/sean-/seed
|
||||
## explicit
|
||||
github.com/segmentio/backo-go
|
||||
# github.com/sirupsen/logrus v1.8.1
|
||||
## explicit
|
||||
github.com/sirupsen/logrus
|
||||
# github.com/smartystreets/assertions v1.0.0
|
||||
## explicit
|
||||
@@ -688,7 +677,6 @@ github.com/vmihailenco/tagparser/v2/internal/parser
|
||||
## explicit
|
||||
github.com/wiggin77/merror
|
||||
# github.com/wiggin77/srslog v1.0.1
|
||||
## explicit
|
||||
github.com/wiggin77/srslog
|
||||
# github.com/willf/bitset v1.1.11
|
||||
## explicit
|
||||
@@ -727,10 +715,6 @@ go.opentelemetry.io/otel/metric/unit
|
||||
# go.uber.org/atomic v1.8.0
|
||||
## explicit
|
||||
go.uber.org/atomic
|
||||
# go.uber.org/multierr v1.7.0
|
||||
## explicit
|
||||
# go.uber.org/zap v1.17.0
|
||||
## explicit
|
||||
# golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
|
||||
## explicit
|
||||
golang.org/x/crypto/acme
|
||||
@@ -931,7 +915,6 @@ gopkg.in/ini.v1
|
||||
## explicit
|
||||
gopkg.in/mail.v2
|
||||
# gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
## explicit
|
||||
gopkg.in/natefinch/lumberjack.v2
|
||||
# gopkg.in/olivere/elastic.v6 v6.2.35
|
||||
## explicit
|
||||
@@ -940,6 +923,7 @@ gopkg.in/olivere/elastic.v6
|
||||
## explicit
|
||||
gopkg.in/yaml.v2
|
||||
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
## explicit
|
||||
gopkg.in/yaml.v3
|
||||
# willnorris.com/go/gifresize v1.0.0
|
||||
willnorris.com/go/gifresize
|
||||
|
||||
@@ -83,7 +83,7 @@ func setupTestHelper(tb testing.TB, includeCacheLayer bool) *TestHelper {
|
||||
|
||||
testLogger, _ := mlog.NewLogger()
|
||||
logCfg, _ := config.MloggerConfigFromLoggerConfig(&newConfig.LogSettings, nil, config.GetLogFileLocation)
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg); errCfg != nil {
|
||||
if errCfg := testLogger.ConfigureTargets(logCfg, nil); errCfg != nil {
|
||||
panic("failed to configure test logger: " + errCfg.Error())
|
||||
}
|
||||
// lock logger config so server init cannot override it during testing.
|
||||
|
||||
Ссылка в новой задаче
Block a user