Skip to content

Commit

Permalink
*: strings.Title deprecation
Browse files Browse the repository at this point in the history
In both cases, `fmt.Sprintf("%t", ...)` yields the same result.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
  • Loading branch information
hiddeco committed Aug 16, 2023
1 parent 0fbafd7 commit 3cba2f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions aes/cipher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import (
"fmt"
"regexp"
"strconv"
"strings"

"github.com/sirupsen/logrus"
"github.com/getsops/sops/v3"
"github.com/getsops/sops/v3/logging"
"github.com/sirupsen/logrus"
)

var log *logrus.Logger
Expand Down Expand Up @@ -172,7 +171,7 @@ func (c Cipher) Encrypt(plaintext interface{}, key []byte, additionalData string
case bool:
encryptedType = "bool"
// The Python version encodes booleans with Titlecase
plainBytes = []byte(strings.Title(strconv.FormatBool(value)))
plainBytes = []byte(fmt.Sprintf("%t", value))
case sops.Comment:
encryptedType = "comment"
plainBytes = []byte(value.Value)
Expand Down
4 changes: 2 additions & 2 deletions sops.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import (
"strings"
"time"

"github.com/sirupsen/logrus"
"github.com/getsops/sops/v3/audit"
"github.com/getsops/sops/v3/keys"
"github.com/getsops/sops/v3/keyservice"
"github.com/getsops/sops/v3/logging"
"github.com/getsops/sops/v3/shamir"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

Expand Down Expand Up @@ -727,7 +727,7 @@ func ToBytes(in interface{}) ([]byte, error) {
case float64:
return []byte(strconv.FormatFloat(in, 'f', -1, 64)), nil
case bool:
return []byte(strings.Title(strconv.FormatBool(in))), nil
return []byte(fmt.Sprintf("%t", in)), nil
case []byte:
return in, nil
case Comment:
Expand Down

0 comments on commit 3cba2f5

Please sign in to comment.