mirror of
https://github.com/getsops/sops.git
synced 2026-02-05 12:45:21 +01:00
*: solve go vet errors
``` stores/dotenv/store.go:74:12: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields stores/dotenv/store_test.go:29:10: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields keyservice/server.go:149:9: assignment copies lock value to key: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:206:20: call of ks.prompt copies lock value: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:214:22: keyToString passes lock by value: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:231:29: prompt passes lock by value: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:232:27: call of keyToString copies lock value: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:251:9: assignment copies lock value to key: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex keyservice/server.go:308:20: call of ks.prompt copies lock value: github.com/getsops/sops/v3/keyservice.Key contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex stores/yaml/store_test.go:27:11: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields stores/yaml/store_test.go:39:11: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields stores/yaml/store_test.go:107:5: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields stores/yaml/store_test.go:139:13: github.com/getsops/sops/v3.Comment struct literal uses unkeyed fields decrypt/example_test.go:34:1: ExampleDecryptFile refers to unknown identifier: DecryptFile ``` Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
@@ -31,7 +31,7 @@ type configuration struct {
|
||||
AnEmptyValue string `json:"anEmptyValue"`
|
||||
}
|
||||
|
||||
func ExampleDecryptFile() {
|
||||
func ExampleFile() {
|
||||
var (
|
||||
confPath string = "./example.json"
|
||||
cfg configuration
|
||||
|
||||
@@ -146,7 +146,7 @@ func (ks *Server) decryptWithAge(key *AgeKey, ciphertext []byte) ([]byte, error)
|
||||
// result
|
||||
func (ks Server) Encrypt(ctx context.Context,
|
||||
req *EncryptRequest) (*EncryptResponse, error) {
|
||||
key := *req.Key
|
||||
key := req.Key
|
||||
var response *EncryptResponse
|
||||
switch k := key.KeyType.(type) {
|
||||
case *Key_PgpKey:
|
||||
@@ -211,7 +211,7 @@ func (ks Server) Encrypt(ctx context.Context,
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func keyToString(key Key) string {
|
||||
func keyToString(key *Key) string {
|
||||
switch k := key.KeyType.(type) {
|
||||
case *Key_PgpKey:
|
||||
return fmt.Sprintf("PGP key with fingerprint %s", k.PgpKey.Fingerprint)
|
||||
@@ -228,7 +228,7 @@ func keyToString(key Key) string {
|
||||
}
|
||||
}
|
||||
|
||||
func (ks Server) prompt(key Key, requestType string) error {
|
||||
func (ks Server) prompt(key *Key, requestType string) error {
|
||||
keyString := keyToString(key)
|
||||
var response string
|
||||
for response != "y" && response != "n" {
|
||||
@@ -248,7 +248,7 @@ func (ks Server) prompt(key Key, requestType string) error {
|
||||
// result
|
||||
func (ks Server) Decrypt(ctx context.Context,
|
||||
req *DecryptRequest) (*DecryptResponse, error) {
|
||||
key := *req.Key
|
||||
key := req.Key
|
||||
var response *DecryptResponse
|
||||
switch k := key.KeyType.(type) {
|
||||
case *Key_PgpKey:
|
||||
|
||||
@@ -72,7 +72,7 @@ func (store *Store) LoadPlainFile(in []byte) (sops.TreeBranches, error) {
|
||||
}
|
||||
if line[0] == '#' {
|
||||
branch = append(branch, sops.TreeItem{
|
||||
Key: sops.Comment{string(line[1:])},
|
||||
Key: sops.Comment{Value: string(line[1:])},
|
||||
Value: nil,
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/getsops/sops/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var PLAIN = []byte(strings.TrimLeft(`
|
||||
@@ -26,7 +26,7 @@ var BRANCH = sops.TreeBranch{
|
||||
Value: "val2",
|
||||
},
|
||||
sops.TreeItem{
|
||||
Key: sops.Comment{"comment"},
|
||||
Key: sops.Comment{Value: "comment"},
|
||||
Value: nil,
|
||||
},
|
||||
sops.TreeItem{
|
||||
|
||||
@@ -3,8 +3,8 @@ package yaml
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/getsops/sops/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var PLAIN = []byte(`---
|
||||
@@ -24,7 +24,7 @@ key1_a: value
|
||||
var BRANCHES = sops.TreeBranches{
|
||||
sops.TreeBranch{
|
||||
sops.TreeItem{
|
||||
Key: sops.Comment{" comment 0"},
|
||||
Key: sops.Comment{Value: " comment 0"},
|
||||
Value: nil,
|
||||
},
|
||||
sops.TreeItem{
|
||||
@@ -36,7 +36,7 @@ var BRANCHES = sops.TreeBranches{
|
||||
Value: "value",
|
||||
},
|
||||
sops.TreeItem{
|
||||
Key: sops.Comment{" ^ comment 1"},
|
||||
Key: sops.Comment{Value: " ^ comment 1"},
|
||||
Value: nil,
|
||||
},
|
||||
},
|
||||
@@ -101,10 +101,10 @@ var COMMENT_6 = []byte(`a:
|
||||
var COMMENT_6_BRANCHES = sops.TreeBranches{
|
||||
sops.TreeBranch{
|
||||
sops.TreeItem{
|
||||
Key: "a",
|
||||
Key: "a",
|
||||
Value: []interface{}{
|
||||
"a",
|
||||
sops.Comment{" I no longer get duplicated"},
|
||||
sops.Comment{Value: " I no longer get duplicated"},
|
||||
sops.TreeBranch{},
|
||||
},
|
||||
},
|
||||
@@ -124,10 +124,10 @@ e:
|
||||
var COMMENT_7_BRANCHES = sops.TreeBranches{
|
||||
sops.TreeBranch{
|
||||
sops.TreeItem{
|
||||
Key: "a",
|
||||
Key: "a",
|
||||
Value: sops.TreeBranch{
|
||||
sops.TreeItem{
|
||||
Key: "b",
|
||||
Key: "b",
|
||||
Value: sops.TreeBranch{
|
||||
sops.TreeItem{
|
||||
Key: "c",
|
||||
@@ -136,13 +136,13 @@ var COMMENT_7_BRANCHES = sops.TreeBranches{
|
||||
},
|
||||
},
|
||||
sops.TreeItem{
|
||||
Key: sops.Comment{" comment"},
|
||||
Key: sops.Comment{Value: " comment"},
|
||||
Value: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
sops.TreeItem{
|
||||
Key: "e",
|
||||
Key: "e",
|
||||
Value: []interface{}{
|
||||
"f",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user