-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gometalinter -> golangci-lint migration #3933
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3933 +/- ##
===========================================
- Coverage 60.26% 60.22% -0.05%
===========================================
Files 196 197 +1
Lines 14615 14628 +13
===========================================
+ Hits 8808 8809 +1
- Misses 5214 5225 +11
- Partials 593 594 +1 |
{,scripts/}Makefile: - Remove gometalinter, install golangci-lint. - Remove distinction between tools and devtools. Just tools is enough. - test_lint -> lint Migrating away from underscore separated names. - Remove unnecessary targets. - Drop tendermint/lint. Incompatbile with golangci-lint and no longer necessary anyway. Port tools/gometalinter.json to .golangci.yml Update CircleCI config accordingly. Closes: #3896
6a6289d
to
8df582c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple minor things - thanks for this
@@ -337,7 +337,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress | |||
|
|||
cleanup = func() { | |||
logger.Debug("cleaning up LCD initialization") | |||
node.Stop() | |||
node.Stop() //nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still have nolint
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -43,7 +43,7 @@ $ gaiacli query gov proposal 1 | |||
|
|||
var proposal gov.Proposal | |||
cdc.MustUnmarshalJSON(res, &proposal) | |||
return cliCtx.PrintOutput(proposal) | |||
return cliCtx.PrintOutput(proposal) // nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this errcheck
suppression for lines like these? Is there anything we can do to fix this lint issue? what's causing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PrintOutput()
returns err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bug in errcheck
to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
if err := cliCtx.PrintOutput(proposal); err != nil {
return err
}
return nil
is not an error but what we have is an error, then yes, it looks like an errcheck
bug to me
Co-Authored-By: alessio <quadrispro@ubuntu.com>
dep -> go mod migration leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 simplification is always nice.
Would be great to find a way to remove the lint ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments. The PR LGTM (especially that it simplifies the Makefile) 👍
The only thing to reconsider: The file install-golangci.sh should probably be downloaded during setup time instead of copied from the golangci-lint repository: https://github.com/golangci/golangci-lint/blob/master/install.sh (note the License there)
Drop tendermint/lint. Incompatbile with golangci-lint
and no longer necessary anyway.
Question: Does that mean we can delete/archive this repo?
// DeleteKeyReq requests deleting a key | ||
type DeleteKeyReq struct { | ||
Password string `json:"password"` | ||
} | ||
|
||
// NewDeleteKeyReq constructs a new DeleteKeyReq structure. | ||
func NewDeleteKeyReq(password string) DeleteKeyReq { return DeleteKeyReq{Password: password} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In go usually anything New*
returns a pointer to the struct though, no? Meaning return &DeleteKeyReq{}
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In go usually anything New* returns a pointer to the struct though, no?
I used to believe so. Apparently the use of the New
prefix is idiomatic regardless of whether the function returns a struct or a pointer.
@@ -145,7 +145,9 @@ func fingerprintForCertificate(certBytes []byte) (string, error) { | |||
return "", err | |||
} | |||
h := sha256.New() | |||
h.Write(cert.Raw) | |||
if _, err := h.Write(cert.Raw); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: sha256's write actually doesn't err. This is perfect for a nolint
with a comment.
See: https://golang.org/src/crypto/sha256/sha256.go?s=4118:4138#L203
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Nice catch, didn't know about that, thanks! Nonetheless, certificates.go will be gone shortly - we intend to remove the --secure
option from the REST server altogether.
@@ -43,7 +43,7 @@ $ gaiacli query gov proposal 1 | |||
|
|||
var proposal gov.Proposal | |||
cdc.MustUnmarshalJSON(res, &proposal) | |||
return cliCtx.PrintOutput(proposal) | |||
return cliCtx.PrintOutput(proposal) // nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bug in errcheck
to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK; new linter & Makefile scripts all seem to work. One minor comment.
@@ -200,6 +225,9 @@ jobs: | |||
- checkout | |||
- *dependencies | |||
- run: mkdir -p /tmp/logs | |||
- restore_cache: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit too much of restore_cache, should happen only in the required job, in this case setup_dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and when installing/downloading occurs.
I'll double check now to be sure which of those should keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup_dependencies
is a job that runs only once. Other jobs need to restore the cache indipendently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but are all of them using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Closes: #3896
Also addresses #2835
docs/
)sdkch add [section] [stanza] [message]
Files changed
in the github PR explorerFor Admin Use: