]> Sergey Matveev's repositories - meta4ra.git/commitdiff
Modernise the code
authorSergey Matveev <stargrave@stargrave.org>
Wed, 12 Feb 2025 10:47:59 +0000 (13:47 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 12 Feb 2025 10:47:59 +0000 (13:47 +0300)
internal/hasher.go

index 168d63cae914514c377c7208e11b7f02ae0b8fe3..1f6b3f52ea42cfcf1202f27954ac16854aed24ad 100644 (file)
@@ -32,7 +32,7 @@ type Hasher struct {
 
 func NewHasher(hashes string) (*Hasher, error) {
        h := Hasher{}
-       for _, hc := range strings.Split(hashes, ",") {
+       for hc := range strings.SplitSeq(hashes, ",") {
                cols := strings.SplitN(hc, ":", 2)
                name, cmdline := cols[0], cols[1]
                if cmdline == BuiltinCmd {
@@ -95,7 +95,7 @@ func (h *Hasher) Write(p []byte) (n int, rerr error) {
                        errs <- err
                }(in)
        }
-       for i := 0; i < len(h.Names); i++ {
+       for range len(h.Names) {
                if err := <-errs; err != nil {
                        rerr = err
                }