ci: Add ineffsign linter

And fix an additional ineffective assignment that was not caught by staticcheck
This commit is contained in:
Daniel Nephin 2020-06-05 18:08:30 -04:00
parent 5f24171f13
commit 8753d1f1ba
4 changed files with 16 additions and 11 deletions

View File

@ -5,6 +5,7 @@ linters:
- govet
- unconvert
- staticcheck
- ineffassign
issues:
# Disable the default exclude list so that all excludes are explicitly

View File

@ -706,8 +706,6 @@ func (a *Agent) setupClientAutoEncryptWatching(rootsReq *structs.DCSpecificReque
// in time. The agent would be stuck in that case because the watches
// never use the AutoEncrypt.Sign endpoint.
go func() {
for {
// Check 10sec after cert expires. The agent cache
// should be handling the expiration and renew before
// it.
@ -716,8 +714,9 @@ func (a *Agent) setupClientAutoEncryptWatching(rootsReq *structs.DCSpecificReque
// renew, but this case shouldn't happen because at
// this point, auto_encrypt was just being setup
// successfully.
autoLogger := a.logger.Named(logging.AutoEncrypt)
interval := a.tlsConfigurator.AutoEncryptCertNotAfter().Sub(time.Now().Add(10 * time.Second))
autoLogger := a.logger.Named(logging.AutoEncrypt)
for {
a.logger.Debug("setting up client certificate expiration check on interval", "interval", interval)
select {
case <-a.shutdownCh:

View File

@ -4400,6 +4400,7 @@ func TestACLEndpoint_Login(t *testing.T) {
structs.BindingRuleBindTypeNode,
"${serviceaccount.name}",
)
require.NoError(t, err)
t.Run("do not provide a token", func(t *testing.T) {
req := structs.ACLLoginRequest{

View File

@ -282,6 +282,9 @@ func decodeHCLToMapStructure(source string, target interface{}) error {
Metadata: md,
Result: target,
})
if err != nil {
return err
}
return decoder.Decode(&raw)
}
@ -305,6 +308,7 @@ func TestHookWeakDecodeFromSlice_DoesNotModifySliceTargetsFromSliceInterface(t *
})
require.NoError(t, err)
err = decoder.Decode(&raw)
require.NoError(t, err)
expected := &nested{
Slice: []Item{{Name: "first"}},