Skip to content

Conversation

@ldez
Copy link
Member

@ldez ldez commented Feb 22, 2021

Last week, maligned has been deprecated.

The recommendation is to switch to https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/fieldalignment

Related to #1555

Currently, we don't support SuggestedFixes but it's a more global topic.

@ldez ldez added the linter: new Support new linter label Feb 22, 2021
@ldez ldez merged commit 42ff682 into golangci:master Feb 22, 2021
@ldez ldez deleted the feat/fieldalignment branch February 22, 2021 16:46
This was referenced Mar 7, 2021
@Josca
Copy link

Josca commented Mar 18, 2021

@ldez please, what is correct way to fix message WARN [runner] The linter 'maligned' is deprecated due to: The repository of the linter has been archived by the owner. Use govet 'fieldalignment' instead.? Just add govet and remove maligned?

@ldez
Copy link
Member Author

ldez commented Mar 18, 2021

yes you just have to disable or remove maligned and add fieldalignment to the govet configuration:

linters:
  disable:
    - maligned

linters-settings:
  govet:
    enable:
      - fieldalignment
linters:
  disable:
    - maligned

linters-settings:
  govet:
    enable-all: true

#1825

@Josca
Copy link

Josca commented Mar 18, 2021

@ldez ok, thanks, now it works and it writes a lot of warnings, e.g.:
fieldalignment: struct with 16 pointer bytes could be 8 for:

type RhAccount struct {
	ID   int
	Name string
}

What does it mean, please? I can not find any explanation anywhere.

@Josca
Copy link

Josca commented Mar 18, 2021

@iamtakingiteasy
Copy link

iamtakingiteasy commented Mar 20, 2021

This is about "struct size" fieldalignment linting, not about "pointer bytes" you've triggered. "Pointer bytes" refers to how much of a struct bytes GC has to scan in order to check the memory, not struct size itself.

See explaination at golang/go#44877 (comment)

#1825 is about making this second type of check non-default as per author intention indicated in comment above. (As it was the case with maligned used in golangci-lint).

drpaneas added a commit to drpaneas/OpenDiablo2 that referenced this pull request Mar 24, 2021
* Replace 'maligned' with 'fieldalignment' [1]
* Remove 'interfacer' [2]
* Enable linting against go test files as well
* Disable 'funlen' linter for go table-driven tests

[1] golangci/golangci-lint#1765
[2] golangci/golangci-lint#541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linter: new Support new linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants