From ae7daa7d3321fcefa4aee1bb690b1b7ce9b5c78b Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Sat, 27 Mar 2021 13:49:40 +0100 Subject: [PATCH] chore: update linter (#1379) --- .github/workflows/main.yml | 4 +-- .golangci.toml | 32 +++++++++---------- providers/dns/constellix/internal/model.go | 2 +- .../constellix/internal/txtrecords_test.go | 2 +- providers/dns/otc/mock_test.go | 10 ++++-- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9824bb6..d0b81137 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,9 +15,9 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: 1.16 - GOLANGCI_LINT_VERSION: v1.38.0 + GOLANGCI_LINT_VERSION: v1.39.0 HUGO_VERSION: 0.54.0 - SEIHON_VERSION: v0.5.1 + SEIHON_VERSION: v0.8.3 CGO_ENABLED: 0 LEGO_E2E_TESTS: CI MEMCACHED_HOSTS: localhost:11211 diff --git a/.golangci.toml b/.golangci.toml index 28bd7cab..ee3aa4eb 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -46,29 +46,28 @@ disable = [ "interfacer", # deprecated "maligned", # deprecated + "scopelint", # deprecated + "cyclop", # duplicate of gocyclo "lll", - "gas", - "dupl", - "prealloc", - "scopelint", - "bodyclose", - "wsl", - "stylecheck", + "gosec", + "dupl", # not relevant + "prealloc", # too many false-positive + "bodyclose", # too many false-positive "gomnd", "testpackage", # not relevant - "nestif", # too many false-positive - "goerr113", # not relevant - "noctx", - "nlreturn", # not relevant - "wrapcheck", "tparallel", # not relevant "paralleltest", # not relevant - "exhaustivestruct", # too many false-positive + "nestif", # too many false-positive + "wrapcheck", + "goerr113", # not relevant + "nlreturn", # not relevant + "wsl", # not relevant + "exhaustive", # not relevant + "exhaustivestruct", # not relevant "makezero", # not relevant - "forbidigo", # not relevant "ifshort", # not relevant - "cyclop", # duplicate of gocyclo - "wastedassign", # false-positive https://github.com/sanposhiho/wastedassign/issues/21 + "forbidigo", # not relevant + "noctx", "forcetypeassert", ] @@ -79,6 +78,7 @@ exclude = [ "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked", "exported (type|method|function) (.+) should have comment or be unexported", + "ST1000: at least one file in a package should have a package comment" ] [[issues.exclude-rules]] path = "(.+)_test.go" diff --git a/providers/dns/constellix/internal/model.go b/providers/dns/constellix/internal/model.go index c1218f96..cd8bc5d2 100644 --- a/providers/dns/constellix/internal/model.go +++ b/providers/dns/constellix/internal/model.go @@ -75,7 +75,7 @@ type Record struct { ParentID int `json:"parentId,omitempty"` Parent string `json:"parent,omitempty"` Source string `json:"source,omitempty"` - ModifiedTs int64 `json:"modifiedTs,omitempty"` + ModifiedTS int64 `json:"modifiedTs,omitempty"` Value []RecordValue `json:"value,omitempty"` RoundRobin []RecordValue `json:"roundRobin,omitempty"` } diff --git a/providers/dns/constellix/internal/txtrecords_test.go b/providers/dns/constellix/internal/txtrecords_test.go index a942011d..9d0397c9 100644 --- a/providers/dns/constellix/internal/txtrecords_test.go +++ b/providers/dns/constellix/internal/txtrecords_test.go @@ -122,7 +122,7 @@ func TestTxtRecordService_Get(t *testing.T) { ParentID: 273302, Parent: "domain", Source: "Domain", - ModifiedTs: 1580908547863, + ModifiedTS: 1580908547863, Value: []RecordValue{{ Value: `"test"`, }}, diff --git a/providers/dns/otc/mock_test.go b/providers/dns/otc/mock_test.go index 7832f455..b52f0404 100644 --- a/providers/dns/otc/mock_test.go +++ b/providers/dns/otc/mock_test.go @@ -149,8 +149,14 @@ func (m *DNSServerMock) HandleListRecordsetsSuccessfully() { body, err := ioutil.ReadAll(r.Body) assert.Nil(m.t, err) - exceptedString := "{\"name\":\"_acme-challenge.example.com.\",\"description\":\"Added TXT record for ACME dns-01 challenge using lego client\",\"type\":\"TXT\",\"ttl\":300,\"records\":[\"\\\"w6uP8Tcg6K2QR905Rms8iXTlksL6OD1KOWBxTK7wxPI\\\"\"]}" - assert.Equal(m.t, string(body), exceptedString) + exceptedString := `{ + "name": "_acme-challenge.example.com.", + "description": "Added TXT record for ACME dns-01 challenge using lego client", + "type": "TXT", + "ttl": 300, + "records": ["\"w6uP8Tcg6K2QR905Rms8iXTlksL6OD1KOWBxTK7wxPI\""] + }` + assert.JSONEq(m.t, string(body), exceptedString) fmt.Fprintf(w, `{ "recordsets":[{ "id":"321321"