mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
run gofumpt cleanup across code-base (#14015)
This commit is contained in:
@@ -45,7 +45,7 @@ func (c Context) MarshalText() ([]byte, error) {
|
||||
|
||||
// Pre-allocate a buffer - 128 bytes is an arbitrary
|
||||
// heuristic value that seems like a good starting size.
|
||||
var b = bytes.NewBuffer(make([]byte, 0, 128))
|
||||
b := bytes.NewBuffer(make([]byte, 0, 128))
|
||||
if len(c) == 1 {
|
||||
for k, v := range c {
|
||||
b.WriteString(`{"`)
|
||||
|
||||
@@ -55,7 +55,7 @@ func NewWithConfig(config Config) (KMS, error) {
|
||||
if len(config.Endpoints) == 0 {
|
||||
return nil, errors.New("kms: no server endpoints")
|
||||
}
|
||||
var endpoints = make([]string, len(config.Endpoints)) // Copy => avoid being affect by any changes to the original slice
|
||||
endpoints := make([]string, len(config.Endpoints)) // Copy => avoid being affect by any changes to the original slice
|
||||
copy(endpoints, config.Endpoints)
|
||||
|
||||
client := kes.NewClientWithConfig("", &tls.Config{
|
||||
@@ -85,7 +85,7 @@ func (c *kesClient) Stat() (Status, error) {
|
||||
if _, err := c.client.Version(ctx); err != nil {
|
||||
return Status{}, err
|
||||
}
|
||||
var endpoints = make([]string, len(c.client.Endpoints))
|
||||
endpoints := make([]string, len(c.client.Endpoints))
|
||||
copy(endpoints, c.client.Endpoints)
|
||||
return Status{
|
||||
Name: "KES",
|
||||
|
||||
@@ -108,7 +108,7 @@ func (d *DEK) UnmarshalText(text []byte) error {
|
||||
Ciphertext []byte `json:"ciphertext"`
|
||||
}
|
||||
var v JSON
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
if err := json.Unmarshal(text, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func Parse(s string) (KMS, error) {
|
||||
return nil, errors.New("kms: invalid master key format")
|
||||
}
|
||||
|
||||
var keyID, b64Key = v[0], v[1]
|
||||
keyID, b64Key := v[0], v[1]
|
||||
key, err := base64.StdEncoding.DecodeString(b64Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -152,7 +152,7 @@ func (kms secretKey) GenerateKey(keyID string, context Context) (DEK, error) {
|
||||
associatedData, _ := context.MarshalText()
|
||||
ciphertext := aead.Seal(nil, nonce, plaintext, associatedData)
|
||||
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
ciphertext, err = json.Marshal(encryptedKey{
|
||||
Algorithm: algorithm,
|
||||
IV: iv,
|
||||
@@ -175,7 +175,7 @@ func (kms secretKey) DecryptKey(keyID string, ciphertext []byte, context Context
|
||||
}
|
||||
|
||||
var encryptedKey encryptedKey
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
if err := json.Unmarshal(ciphertext, &encryptedKey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user