From: Sergey Matveev Date: Sun, 13 Jul 2025 07:17:23 +0000 (+0300) Subject: Use an updated recfile library X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=11f2d040a3b27bfe57a6470de7c876eaa3c34cad;p=goredo.git Use an updated recfile library --- diff --git a/buildlog.go b/buildlog.go index 425f7ef..fc7073e 100644 --- a/buildlog.go +++ b/buildlog.go @@ -29,7 +29,7 @@ import ( "strings" "time" - "go.cypherpunks.su/recfile/v2" + "go.cypherpunks.su/recfile/v3" "go.cypherpunks.su/tai64n/v4" ) diff --git a/depfix.go b/depfix.go index 38292b0..32eb72d 100644 --- 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 6e903b6..2b16430 100644 --- 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 a6b1155..85a0313 100644 --- 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= diff --git a/inode.go b/inode.go index cdd0167..c345fcc 100644 --- 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 0566e7a..fd33b3a 100644 --- 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 1b00bf0..b82293b 100644 --- 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, }) } }