chore(codebase): enable linter recvcheck (#5522)

* chore(codebase): enable linter recvcheck

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(codebase): enable linter recvcheck

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(codebase): enable linter recvcheck

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

---------

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
This commit is contained in:
Ivan Ka 2025-06-22 11:22:59 +01:00 committed by GitHub
parent 7108979df1
commit d30674b650
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 14 deletions

View File

@ -11,6 +11,7 @@ linters:
- ineffassign
- misspell
- revive
- recvcheck # Checks for receiver type consistency. https://golangci-lint.run/usage/linters/#recvcheck
- rowserrcheck # Checks whether Rows.Err of rows is checked successfully.
- errchkjson # Checks types passed to the json encoding functions. ref: https://golangci-lint.run/usage/linters/#errchkjson
- errorlint # Checking for unchecked errors in Go code https://golangci-lint.run/usage/linters/#errcheck

View File

@ -124,13 +124,13 @@ func (t planTableRow) String() string {
return fmt.Sprintf("planTableRow{current=%v, candidates=%v}", t.current, t.candidates)
}
func (t planTable) addCurrent(e *endpoint.Endpoint) {
func (t *planTable) addCurrent(e *endpoint.Endpoint) {
key := t.newPlanKey(e)
t.rows[key].current = append(t.rows[key].current, e)
t.rows[key].records[e.RecordType].current = e
}
func (t planTable) addCandidate(e *endpoint.Endpoint) {
func (t *planTable) addCandidate(e *endpoint.Endpoint) {
key := t.newPlanKey(e)
t.rows[key].candidates = append(t.rows[key].candidates, e)
t.rows[key].records[e.RecordType].candidates = append(t.rows[key].records[e.RecordType].candidates, e)
@ -316,7 +316,7 @@ func (p *Plan) shouldUpdateProviderSpecific(desired, current *endpoint.Endpoint)
}
// filterRecordsForPlan removes records that are not relevant to the planner.
// Currently this just removes TXT records to prevent them from being
// Currently, this just removes TXT records to prevent them from being
// deleted erroneously by the planner (only the TXT registry should do this.)
//
// Per RFC 1034, CNAME records conflict with all other records - it is the

View File

@ -195,7 +195,7 @@ func planChangesByZoneName(zones []string, changes *plan.Changes) map[string]*pl
return output
}
func (p OVHProvider) computeSingleZoneChanges(_ context.Context, zoneName string, existingRecords []ovhRecord, changes *plan.Changes) ([]ovhChange, error) {
func (p *OVHProvider) computeSingleZoneChanges(_ context.Context, zoneName string, existingRecords []ovhRecord, changes *plan.Changes) ([]ovhChange, error) {
allChanges := []ovhChange{}
var computedChanges []ovhChange
@ -496,7 +496,7 @@ func ovhGroupByNameAndType(records []ovhRecord) []*endpoint.Endpoint {
return endpoints
}
func (p OVHProvider) newOvhChangeCreateDelete(action int, endpoints []*endpoint.Endpoint, zone string, existingRecords []ovhRecord) ([]ovhChange, []ovhRecord) {
func (p *OVHProvider) newOvhChangeCreateDelete(action int, endpoints []*endpoint.Endpoint, zone string, existingRecords []ovhRecord) ([]ovhChange, []ovhRecord) {
var ovhChanges []ovhChange
var toDeleteIds []int
@ -564,7 +564,7 @@ func normalizeDNSName(dnsName string) string {
return strings.TrimSpace(strings.ToLower(dnsName))
}
func (p OVHProvider) newOvhChangeUpdate(endpointsOld []*endpoint.Endpoint, endpointsNew []*endpoint.Endpoint, zone string, existingRecords []ovhRecord) ([]ovhChange, error) {
func (p *OVHProvider) newOvhChangeUpdate(endpointsOld []*endpoint.Endpoint, endpointsNew []*endpoint.Endpoint, zone string, existingRecords []ovhRecord) ([]ovhChange, error) {
zoneNameIDMapper := provider.ZoneIDName{}
zoneNameIDMapper.Add(zone, zone)
@ -709,7 +709,7 @@ func (c *ovhChange) String() string {
return fmt.Sprintf("%s zone action(%s) : %s %d IN %s %s", c.Zone, action, c.SubDomain, c.TTL, c.FieldType, c.Target)
}
func (p OVHProvider) formatCNAMETarget(change *ovhChange) {
func (p *OVHProvider) formatCNAMETarget(change *ovhChange) {
if change.FieldType != endpoint.RecordTypeCNAME {
return
}

View File

@ -202,31 +202,31 @@ func (f *fakeClient) Get(request rest.Request, dest interface{}) error {
return f.getFunc(request, dest)
}
func (f fakeClient) Put(request rest.Request) error {
func (f *fakeClient) Put(request rest.Request) error {
return errors.New("PUT not implemented")
}
func (f fakeClient) Post(request rest.Request) error {
func (f *fakeClient) Post(request rest.Request) error {
return errors.New("POST not implemented")
}
func (f fakeClient) Delete(request rest.Request) error {
func (f *fakeClient) Delete(request rest.Request) error {
return errors.New("DELETE not implemented")
}
func (f fakeClient) Patch(request rest.Request) error {
func (f *fakeClient) Patch(request rest.Request) error {
return errors.New("PATCH not implemented")
}
func (f fakeClient) PatchWithResponse(request rest.Request) (rest.Response, error) {
func (f *fakeClient) PatchWithResponse(request rest.Request) (rest.Response, error) {
return rest.Response{}, errors.New("PATCH with response not implemented")
}
func (f fakeClient) PostWithResponse(request rest.Request) (rest.Response, error) {
func (f *fakeClient) PostWithResponse(request rest.Request) (rest.Response, error) {
return rest.Response{}, errors.New("POST with response not implemented")
}
func (f fakeClient) PutWithResponse(request rest.Request) (rest.Response, error) {
func (f *fakeClient) PutWithResponse(request rest.Request) (rest.Response, error) {
return rest.Response{}, errors.New("PUT with response not implemented")
}