fix: 修复lint问题

This commit is contained in:
王一之 2023-08-28 10:55:50 +08:00
parent a4e4767d0e
commit 7e8f07a958
3 changed files with 37 additions and 13 deletions

View File

@ -1,10 +1,5 @@
linters-settings:
golint:
min-confidence: 0
misspell:
locale: US
linters:
disable-all: true
disable-all: false
enable:
- typecheck
- goimports
@ -12,10 +7,39 @@ linters:
- govet
- ineffassign
- gosimple
- deadcode
- structcheck
- unused
- errcheck
- staticcheck
- gofmt
- bodyclose
- loggercheck
- nilerr
- prealloc
- predeclared
- durationcheck
- makezero
- exportloopref
- rowserrcheck
- stylecheck
- gosec
- nolintlint
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

View File

@ -9,11 +9,11 @@ import (
"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 := dnspod.NewDescribeRecordListRequest()
request.Domain = common.StringPtr(w.config.Domain)
request.Domain = common.StringPtr(domain)
response, err := w.client.DescribeRecordList(request)
if err != nil {
@ -21,7 +21,7 @@ func (w *watch) queryRecord(value string) (*dnspod.RecordListItem, error) {
return nil, err
}
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))
return v, nil
}

View File

@ -58,7 +58,7 @@ func (w *watch) Start(ctx context.Context, cfg *configs.Config) error {
}
for _, c := range w.config.CheckDomain {
for _, v := range c.Value {
r, err := w.queryRecord(v)
r, err := w.queryRecord(c.Domain, c.Name, v)
if err != nil {
return err
}