Fix lint of files in ./contrib/log/fluent (#1432)

* fix(transport/http):fix nil problem

* fix(contrib/log/fluent):part of #1430,fix ./contrib/log/fluent
pull/1434/head
Casper-Mars 3 years ago committed by GitHub
parent 8823a1c618
commit 3f51a15949
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      contrib/log/fluent/fluent.go
  2. 1
      hack/.lintcheck_failures

@ -102,30 +102,30 @@ type Logger struct {
// tcp://127.0.0.1:24224 // tcp://127.0.0.1:24224
// unix://var/run/fluent/fluent.sock // unix://var/run/fluent/fluent.sock
func NewLogger(addr string, opts ...Option) (*Logger, error) { func NewLogger(addr string, opts ...Option) (*Logger, error) {
options := options{} option := options{}
for _, o := range opts { for _, o := range opts {
o(&options) o(&option)
} }
u, err := url.Parse(addr) u, err := url.Parse(addr)
if err != nil { if err != nil {
return nil, err return nil, err
} }
c := fluent.Config{ c := fluent.Config{
Timeout: options.timeout, Timeout: option.timeout,
WriteTimeout: options.writeTimeout, WriteTimeout: option.writeTimeout,
BufferLimit: options.bufferLimit, BufferLimit: option.bufferLimit,
RetryWait: options.retryWait, RetryWait: option.retryWait,
MaxRetry: options.maxRetry, MaxRetry: option.maxRetry,
MaxRetryWait: options.maxRetryWait, MaxRetryWait: option.maxRetryWait,
TagPrefix: options.tagPrefix, TagPrefix: option.tagPrefix,
Async: options.async, Async: option.async,
ForceStopAsyncSend: options.forceStopAsyncSend, ForceStopAsyncSend: option.forceStopAsyncSend,
} }
switch u.Scheme { switch u.Scheme {
case "tcp": case "tcp":
host, port, err := net.SplitHostPort(u.Host) host, port, err2 := net.SplitHostPort(u.Host)
if err != nil { if err2 != nil {
return nil, err return nil, err2
} }
if c.FluentPort, err = strconv.Atoi(port); err != nil { if c.FluentPort, err = strconv.Atoi(port); err != nil {
return nil, err return nil, err
@ -143,7 +143,7 @@ func NewLogger(addr string, opts ...Option) (*Logger, error) {
return nil, err return nil, err
} }
return &Logger{ return &Logger{
opts: options, opts: option,
log: fl, log: fl,
}, nil }, nil
} }

@ -11,4 +11,3 @@
./contrib/registry/kubernetes ./contrib/registry/kubernetes
./contrib/registry/zookeeper ./contrib/registry/zookeeper
./contrib/registry/etcd ./contrib/registry/etcd
./contrib/log/fluent

Loading…
Cancel
Save