]> Cypherpunks repositories - goredo.git/commitdiff
Use an updated recfile library
authorSergey Matveev <stargrave@stargrave.org>
Sun, 13 Jul 2025 07:17:23 +0000 (10:17 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 13 Jul 2025 07:17:48 +0000 (10:17 +0300)
buildlog.go
depfix.go
go.mod
go.sum
inode.go
main.go
run.go

index 425f7ef19cf9293d71f19d37765b0c892f6ad5ca..fc7073eac38b667e9b307986502017cb759fc84f 100644 (file)
@@ -29,7 +29,7 @@ import (
        "strings"
        "time"
 
-       "go.cypherpunks.su/recfile/v2"
+       "go.cypherpunks.su/recfile/v3"
        "go.cypherpunks.su/tai64n/v4"
 )
 
index 38292b0356c2e7f9a441693fb2ae1e8859e9d1bd..32eb72d4e553eb27c0f3c22e6f7bad348532a251 100644 (file)
--- a/depfix.go
+++ b/depfix.go
@@ -26,7 +26,7 @@ import (
        "strings"
 
        "github.com/google/uuid"
-       "go.cypherpunks.su/recfile/v2"
+       "go.cypherpunks.su/recfile/v3"
 )
 
 var DepFixHashCache map[string]Hash
diff --git a/go.mod b/go.mod
index 6e903b638b88e531a9634a5c6a31a9990cead52d..2b16430b6e01afe2e5ad20082b067e4d398d9118 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -1,12 +1,12 @@
 module go.cypherpunks.su/goredo
 
-go 1.21
+go 1.24
 
-toolchain go1.22.5
+toolchain go1.24.5
 
 require (
        github.com/google/uuid v1.6.0
-       go.cypherpunks.su/recfile/v2 v2.0.0
+       go.cypherpunks.su/recfile/v3 v3.0.0
        go.cypherpunks.su/tai64n/v4 v4.1.0
        golang.org/x/sys v0.28.0
        golang.org/x/term v0.27.0
diff --git a/go.sum b/go.sum
index a6b115550e1b2c201b686a9d9fb69c5711f2693e..85a03135cb0fc2ab33c93910252bf2da3bd87cd9 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -2,8 +2,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
 github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
-go.cypherpunks.su/recfile/v2 v2.0.0 h1:Q2o+OzM1H2O1WnshU88r+waBqylkqZj8plBdBWZitcU=
-go.cypherpunks.su/recfile/v2 v2.0.0/go.mod h1:36EnyBwx6VpsSM5MMcYGTDiKrVEP49S09p33EFuhQYU=
+go.cypherpunks.su/recfile/v3 v3.0.0 h1:cHuH9GK153v+XJogb4XxuDMaC+RGmn4G2G5MLJ3SIpc=
+go.cypherpunks.su/recfile/v3 v3.0.0/go.mod h1:JAkipcy9IUNuYMR+vfNqf/f6KydLdhw1TBaOnNjdHv4=
 go.cypherpunks.su/tai64n/v4 v4.1.0 h1:jW0EyklKXpSy9DSFMcDbu7XuLlMkn6kkpNWiMG6UT5c=
 go.cypherpunks.su/tai64n/v4 v4.1.0/go.mod h1:/uKUdhLOy8UciRKpapPaFXSOoa/SiXjs3XsDDpAz7OA=
 golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
index cdd0167933cb76f60ad346bfd85f451b7a5add0b..c345fcceecca942494fa81fc492b353399746f8f 100644 (file)
--- a/inode.go
+++ b/inode.go
@@ -23,7 +23,7 @@ import (
        "os"
        "strconv"
 
-       "go.cypherpunks.su/recfile/v2"
+       "go.cypherpunks.su/recfile/v3"
        "golang.org/x/sys/unix"
 )
 
@@ -65,17 +65,17 @@ func (our *Inode) Equals(their *Inode) bool {
 
 func (inode *Inode) RecfileFields() []recfile.Field {
        return []recfile.Field{
-               {Name: "Size", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "Size", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[0*8:1*8])), 10)},
-               {Name: "InodeNum", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "InodeNum", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[1*8:2*8])), 10)},
-               {Name: "CtimeSec", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "CtimeSec", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[2*8:3*8])), 10)},
-               {Name: "CtimeNsec", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "CtimeNsec", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[3*8:4*8])), 10)},
-               {Name: "MtimeSec", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "MtimeSec", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[4*8:5*8])), 10)},
-               {Name: "MtimeNsec", Value: strconv.FormatUint(binary.BigEndian.Uint64(
+               {F: "MtimeNsec", V: strconv.FormatUint(binary.BigEndian.Uint64(
                        []byte(inode[5*8:6*8])), 10)},
        }
 }
diff --git a/main.go b/main.go
index 0566e7a16ac6a5e2c6e847d27c0651dfa9e92c68..fd33b3a98ad716375c0c55fb586bc3031e7e90d8 100644 (file)
--- a/main.go
+++ b/main.go
@@ -34,7 +34,7 @@ import (
        "syscall"
 
        "github.com/google/uuid"
-       "go.cypherpunks.su/recfile/v2"
+       "go.cypherpunks.su/recfile/v3"
        "golang.org/x/sys/unix"
 )
 
@@ -520,7 +520,7 @@ func main() {
                                break
                        }
                        err = recfileWrite(os.Stdout, append(
-                               []recfile.Field{{Name: "Target", Value: tgt.String()}},
+                               []recfile.Field{{F: "Target", V: tgt.String()}},
                                inode.RecfileFields()...)...)
                        if err != nil {
                                err = ErrLine(err)
@@ -539,9 +539,7 @@ func main() {
                        break
                }
                w := bufio.NewWriter(os.Stdout)
-               err = recfileWrite(w, []recfile.Field{
-                       {Name: "Build", Value: build.String()},
-               }...)
+               err = recfileWrite(w, []recfile.Field{{F: "Build", V: build.String()}}...)
                if err != nil {
                        break
                }
@@ -552,36 +550,34 @@ func main() {
                        typ, chunk, data, _ = chunkRead(data)
                        switch typ {
                        case DepTypeAlways:
-                               err = recfileWrite(w, []recfile.Field{
-                                       {Name: "Type", Value: "always"},
-                               }...)
+                               err = recfileWrite(w, []recfile.Field{{F: "Type", V: "always"}}...)
                        case DepTypeStamp:
                                err = recfileWrite(w, []recfile.Field{
-                                       {Name: "Type", Value: "stamp"},
-                                       {Name: "Hash", Value: hex.EncodeToString(chunk)},
+                                       {F: "Type", V: "stamp"},
+                                       {F: "Hash", V: hex.EncodeToString(chunk)},
                                }...)
                        case DepTypeIfcreate:
                                err = recfileWrite(w, []recfile.Field{
-                                       {Name: "Type", Value: "ifcreate"},
-                                       {Name: "Target", Value: string(chunk)},
+                                       {F: "Type", V: "ifcreate"},
+                                       {F: "Target", V: string(chunk)},
                                }...)
                        case DepTypeIfchange:
                                name := string(chunk[InodeLen+HashLen:])
                                meta := chunk[:InodeLen+HashLen]
                                fields := []recfile.Field{
-                                       {Name: "Type", Value: "ifchange"},
-                                       {Name: "Target", Value: name},
+                                       {F: "Type", V: "ifchange"},
+                                       {F: "Target", V: name},
                                }
                                fields = append(fields, recfile.Field{
-                                       Name: "Hash", Value: Hash(meta[InodeLen:]).String(),
+                                       F: "Hash", V: Hash(meta[InodeLen:]).String(),
                                })
                                inode = Inode(meta[:][:InodeLen])
                                fields = append(fields, inode.RecfileFields()...)
                                err = recfileWrite(w, fields...)
                        case DepTypeIfchangeNonex:
                                err = recfileWrite(w, []recfile.Field{
-                                       {Name: "Type", Value: "ifchange"},
-                                       {Name: "Target", Value: string(chunk)},
+                                       {F: "Type", V: "ifchange"},
+                                       {F: "Target", V: string(chunk)},
                                }...)
                        }
                        if err != nil {
diff --git a/run.go b/run.go
index 1b00bf005f411dc6c6a9bcc8a2d5b36a5e4a15bb..b82293b502d218f97bc49cafdf45c8af1f299c9c 100644 (file)
--- a/run.go
+++ b/run.go
@@ -38,7 +38,7 @@ import (
        "time"
 
        "github.com/google/uuid"
-       "go.cypherpunks.su/recfile/v2"
+       "go.cypherpunks.su/recfile/v3"
        "go.cypherpunks.su/tai64n/v4"
        "golang.org/x/sys/unix"
 )
@@ -526,38 +526,38 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                        os.FileMode(0o666),
                                ); err == nil {
                                        fields := []recfile.Field{
-                                               {Name: "Build", Value: BuildUUID.String()},
-                                               {Name: "PPID", Value: strconv.Itoa(os.Getpid())},
-                                               {Name: "Cwd", Value: cwd},
+                                               {F: "Build", V: BuildUUID.String()},
+                                               {F: "PPID", V: strconv.Itoa(os.Getpid())},
+                                               {F: "Cwd", V: cwd},
                                        }
                                        if cmd.Process != nil {
                                                fields = append(fields, recfile.Field{
-                                                       Name: "PID", Value: strconv.Itoa(cmd.Process.Pid),
+                                                       F: "PID", V: strconv.Itoa(cmd.Process.Pid),
                                                })
                                        }
                                        var ts tai64n.TAI64N
                                        ts.FromTime(started)
                                        fields = append(fields,
-                                               recfile.Field{Name: "Started", Value: ts.Encode()},
+                                               recfile.Field{F: "Started", V: ts.Encode()},
                                        )
                                        ts.FromTime(finished)
                                        fields = append(fields,
-                                               recfile.Field{Name: "Finished", Value: ts.Encode()})
+                                               recfile.Field{F: "Finished", V: ts.Encode()})
                                        fields = append(fields, recfile.Field{
-                                               Name:  "Duration",
-                                               Value: strconv.FormatInt(finished.Sub(started).Nanoseconds(), 10),
+                                               F: "Duration",
+                                               V: strconv.FormatInt(finished.Sub(started).Nanoseconds(), 10),
                                        })
-                                       fields = append(fields, recfile.Field{Name: "Cmd", Value: cmdName})
+                                       fields = append(fields, recfile.Field{F: "Cmd", V: cmdName})
                                        for _, arg := range args {
-                                               fields = append(fields, recfile.Field{Name: "Arg", Value: arg})
+                                               fields = append(fields, recfile.Field{F: "Arg", V: arg})
                                        }
                                        for _, env := range cmd.Env {
-                                               fields = append(fields, recfile.Field{Name: "Env", Value: env})
+                                               fields = append(fields, recfile.Field{F: "Env", V: env})
                                        }
                                        if exitErr != nil {
                                                fields = append(fields, recfile.Field{
-                                                       Name:  "ExitCode",
-                                                       Value: strconv.Itoa(exitErr.ProcessState.ExitCode()),
+                                                       F: "ExitCode",
+                                                       V: strconv.Itoa(exitErr.ProcessState.ExitCode()),
                                                })
                                        }
 
@@ -571,8 +571,8 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                                }
                                                for _, ifchange := range ifchanges {
                                                        fields = append(fields, recfile.Field{
-                                                               Name:  "Ifchange",
-                                                               Value: ifchange,
+                                                               F: "Ifchange",
+                                                               V: ifchange,
                                                        })
                                                }
                                        }