From df507a4a556362932bd1d1c06b9212a7b82f1840 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Fri, 19 Oct 2018 12:28:36 -0400 Subject: [PATCH] A few misc fixes found by go vet --- agent/consul/acl_test.go | 1 - agent/consul/fsm/snapshot_oss.go | 2 +- agent/consul/state/acl.go | 2 +- testutil/server.go | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/agent/consul/acl_test.go b/agent/consul/acl_test.go index 68e03610d..cd3604e10 100644 --- a/agent/consul/acl_test.go +++ b/agent/consul/acl_test.go @@ -214,7 +214,6 @@ func (d *ACLResolverTestDelegate) RPC(method string, args interface{}, reply int panic("Bad Test Implmentation: should provide a policyResolveFn to the ACLResolverTestDelegate") } panic("Bad Test Implementation: Was the ACLResolver updated to use new RPC methods") - return nil } func newTestACLResolver(t *testing.T, delegate ACLResolverDelegate, cb func(*ACLResolverConfig)) *ACLResolver { diff --git a/agent/consul/fsm/snapshot_oss.go b/agent/consul/fsm/snapshot_oss.go index c03d82bed..3650add7a 100644 --- a/agent/consul/fsm/snapshot_oss.go +++ b/agent/consul/fsm/snapshot_oss.go @@ -446,7 +446,7 @@ func restoreACLBootstrap(header *snapshotHeader, restore *state.Restore, decoder // With V2 ACLs whether bootstrapping has been performed is stored in the index table like nomad // so this "restores" into that index table. - return restore.IndexRestore(&state.IndexEntry{"acl-token-bootstrap", req.ModifyIndex}) + return restore.IndexRestore(&state.IndexEntry{Key: "acl-token-bootstrap", Value: req.ModifyIndex}) } func restoreCoordinates(header *snapshotHeader, restore *state.Restore, decoder *codec.Decoder) error { diff --git a/agent/consul/state/acl.go b/agent/consul/state/acl.go index 5ef43b80c..aab336243 100644 --- a/agent/consul/state/acl.go +++ b/agent/consul/state/acl.go @@ -210,7 +210,7 @@ func (s *Store) ACLBootstrap(idx, resetIndex uint64, token *structs.ACLToken, le // We must have initialized before this will ever be possible. existing, err := tx.First("index", "id", "acl-token-bootstrap") if err != nil { - fmt.Errorf("bootstrap check failed: %v", err) + return fmt.Errorf("bootstrap check failed: %v", err) } if existing != nil { if resetIndex == 0 { diff --git a/testutil/server.go b/testutil/server.go index 3ff72639b..db76c8ae6 100644 --- a/testutil/server.go +++ b/testutil/server.go @@ -89,7 +89,7 @@ type TestServerConfig struct { PrimaryDatacenter string `json:"primary_datacenter,omitempty"` ACLDefaultPolicy string `json:"acl_default_policy,omitempty"` ACLEnforceVersion8 bool `json:"acl_enforce_version_8"` - ACL TestACLs `json:"acl",omitempty` + ACL TestACLs `json:"acl,omitempty"` Encrypt string `json:"encrypt,omitempty"` CAFile string `json:"ca_file,omitempty"` CertFile string `json:"cert_file,omitempty"`