"strings"
"time"
- "go.cypherpunks.su/recfile/v2"
+ "go.cypherpunks.su/recfile/v3"
"go.cypherpunks.su/tai64n/v4"
)
"strings"
"github.com/google/uuid"
- "go.cypherpunks.su/recfile/v2"
+ "go.cypherpunks.su/recfile/v3"
)
var DepFixHashCache map[string]Hash
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
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=
"os"
"strconv"
- "go.cypherpunks.su/recfile/v2"
+ "go.cypherpunks.su/recfile/v3"
"golang.org/x/sys/unix"
)
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)},
}
}
"syscall"
"github.com/google/uuid"
- "go.cypherpunks.su/recfile/v2"
+ "go.cypherpunks.su/recfile/v3"
"golang.org/x/sys/unix"
)
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)
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
}
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 {
"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"
)
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()),
})
}
}
for _, ifchange := range ifchanges {
fields = append(fields, recfile.Field{
- Name: "Ifchange",
- Value: ifchange,
+ F: "Ifchange",
+ V: ifchange,
})
}
}