credential: fix lint errors (#3746)

The existing pattern was subject to a bug whereby a lock
value was copied every time the value was passed around.
This was happening because of the use of an embedded
protobuf type. To avoid copying a mutex, use a pointer
type in the embedding.

Also fixes a few linter warnings complaining about the use
of unkeyed literals.
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2023-09-19 09:17:42 -07:00
1 parent 35a8fa62cf
commit 2e0587bff0
6 files changed
+6 -6

No files matched your search

@@ -718,7 +718,7 @@ func toJsonStorageCredential(ctx context.Context, storeId string, in *pb.Credent
ctx,
storeId,
credential.JsonObject{
*object,
Struct: object,
},
opts...)
if err != nil {
@@ -727,7 +727,7 @@ func TestCreate(t *testing.T) {
Type: credential.JsonSubtype.String(),
Attrs: &pb.Credential_JsonAttributes{
JsonAttributes: &pb.JsonAttributes{
Object: &obj.Struct,
Object: obj.Struct,
},
},
}},