fix: 修复lint问题
This commit is contained in:
parent
a4e4767d0e
commit
7e8f07a958
@ -1,10 +1,5 @@
|
|||||||
linters-settings:
|
|
||||||
golint:
|
|
||||||
min-confidence: 0
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: false
|
||||||
enable:
|
enable:
|
||||||
- typecheck
|
- typecheck
|
||||||
- goimports
|
- goimports
|
||||||
@ -12,10 +7,39 @@ linters:
|
|||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- gosimple
|
- gosimple
|
||||||
- deadcode
|
|
||||||
- structcheck
|
|
||||||
- unused
|
- unused
|
||||||
- errcheck
|
- errcheck
|
||||||
|
- staticcheck
|
||||||
|
- gofmt
|
||||||
|
- bodyclose
|
||||||
|
- loggercheck
|
||||||
|
- nilerr
|
||||||
|
- prealloc
|
||||||
|
- predeclared
|
||||||
|
- durationcheck
|
||||||
|
- makezero
|
||||||
|
- exportloopref
|
||||||
|
- rowserrcheck
|
||||||
|
- stylecheck
|
||||||
|
- gosec
|
||||||
|
- nolintlint
|
||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 10m
|
||||||
|
|
||||||
|
linters-settings:
|
||||||
|
stylecheck:
|
||||||
|
checks: ["-ST1003"]
|
||||||
|
gosec:
|
||||||
|
excludes:
|
||||||
|
- G306
|
||||||
|
- G401
|
||||||
|
- G402
|
||||||
|
- G404
|
||||||
|
- G501
|
||||||
|
- G505
|
||||||
|
golint:
|
||||||
|
min-confidence: 0
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *watch) queryRecord(value string) (*dnspod.RecordListItem, error) {
|
func (w *watch) queryRecord(domain, name, value string) (*dnspod.RecordListItem, error) {
|
||||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||||
request := dnspod.NewDescribeRecordListRequest()
|
request := dnspod.NewDescribeRecordListRequest()
|
||||||
|
|
||||||
request.Domain = common.StringPtr(w.config.Domain)
|
request.Domain = common.StringPtr(domain)
|
||||||
|
|
||||||
response, err := w.client.DescribeRecordList(request)
|
response, err := w.client.DescribeRecordList(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -21,7 +21,7 @@ func (w *watch) queryRecord(value string) (*dnspod.RecordListItem, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, v := range response.Response.RecordList {
|
for _, v := range response.Response.RecordList {
|
||||||
if *v.Name == w.config.Name && *v.Value == value {
|
if *v.Name == name && *v.Value == value {
|
||||||
logger.Default().Info("record found", zap.Any("record", v))
|
logger.Default().Info("record found", zap.Any("record", v))
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ func (w *watch) Start(ctx context.Context, cfg *configs.Config) error {
|
|||||||
}
|
}
|
||||||
for _, c := range w.config.CheckDomain {
|
for _, c := range w.config.CheckDomain {
|
||||||
for _, v := range c.Value {
|
for _, v := range c.Value {
|
||||||
r, err := w.queryRecord(v)
|
r, err := w.queryRecord(c.Domain, c.Name, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user