lockbox

password manager
Log | Files | Refs | README | LICENSE

commit b6b48482ca701916b24459c8ac57584aef9cf748
parent f096dc9004514cdb57e618c18e8d66afb8ea86a3
Author: Sean Enck <sean@ttypty.com>
Date:   Thu,  3 Jul 2025 19:21:48 -0400

go toolchain update, modernize some code

Diffstat:
Mgo.mod | 4+---
Minternal/app/conv.go | 2+-
Minternal/app/help/core_test.go | 2+-
Minternal/app/totp/core_test.go | 2+-
Minternal/config/toml.go | 2+-
Minternal/output/text.go | 6+++---
6 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/go.mod b/go.mod @@ -1,8 +1,6 @@ module git.sr.ht/~enckse/lockbox -go 1.23.4 - -toolchain go1.24.1 +go 1.24.4 require ( github.com/BurntSushi/toml v1.5.0 diff --git a/internal/app/conv.go b/internal/app/conv.go @@ -71,7 +71,7 @@ func serialize(w io.Writer, tx *kdbx.Transaction, isJSON bool, filter string) er if isJSON { fmt.Fprintf(w, " %s", strings.TrimSpace(trimmed)) } else { - for _, line := range strings.Split(trimmed, "\n") { + for line := range strings.SplitSeq(trimmed, "\n") { if strings.TrimSpace(line) == "" { continue } diff --git a/internal/app/help/core_test.go b/internal/app/help/core_test.go @@ -17,7 +17,7 @@ func TestUsage(t *testing.T) { t.Errorf("invalid verbose usage, out of date? %d", len(u)) } for _, usage := range u { - for _, l := range strings.Split(usage, "\n") { + for l := range strings.SplitSeq(usage, "\n") { if len(l) > 80 { t.Errorf("usage line > 80 (%d), line: %s", len(l), l) } diff --git a/internal/app/totp/core_test.go b/internal/app/totp/core_test.go @@ -19,7 +19,7 @@ func TestPrint(t *testing.T) { generator.Print(&buf, true) count := 0 hasBlank := false - for _, line := range strings.Split(buf.String(), "\n") { + for line := range strings.SplitSeq(buf.String(), "\n") { if line == "" { if hasBlank { t.Errorf("already have blank line") diff --git a/internal/config/toml.go b/internal/config/toml.go @@ -126,7 +126,7 @@ func generateDetailText(data printer) (string, error) { "", "NOTE: the following value is NOT a default, it is an empty TOML placeholder", } { - for _, comment := range strings.Split(line, "\n") { + for comment := range strings.SplitSeq(line, "\n") { text = append(text, fmt.Sprintf("# %s", comment)) } } diff --git a/internal/output/text.go b/internal/output/text.go @@ -10,7 +10,7 @@ import ( func TextWrap(indent uint, in string) string { var sections []string var cur []string - for _, line := range strings.Split(strings.TrimSpace(in), "\n") { + for line := range strings.SplitSeq(strings.TrimSpace(in), "\n") { trimmed := strings.TrimSpace(line) if trimmed == "" { if len(cur) > 0 { @@ -33,7 +33,7 @@ func TextWrap(indent uint, in string) string { } indenture := int(80 - indent) for _, s := range sections { - for _, line := range strings.Split(wrap(s, indenture), "\n") { + for line := range strings.SplitSeq(wrap(s, indenture), "\n") { fmt.Fprintf(&out, "%s%s\n", indenting, line) } fmt.Fprint(&out, "\n") @@ -44,7 +44,7 @@ func TextWrap(indent uint, in string) string { func wrap(in string, maxLength int) string { var lines []string var cur []string - for _, p := range strings.Split(in, " ") { + for p := range strings.SplitSeq(in, " ") { state := strings.Join(cur, " ") l := len(p) if len(state)+l >= maxLength {