diff options
| author | Paul Buetow <paul@buetow.org> | 2024-03-01 11:04:31 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-03-01 11:04:31 +0200 |
| commit | acba0e87d7b4d0caca6639aea6162419aa446754 (patch) | |
| tree | 3d04de163adb05e1d58f285375f51f6521ada883 /internal | |
| parent | c30de8c9696bb2bf1c7f76aca8b6b9bc75b10016 (diff) | |
add file
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/file.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/file.go b/internal/file.go new file mode 100644 index 0000000..069e68f --- /dev/null +++ b/internal/file.go @@ -0,0 +1,26 @@ +package internal + +import ( + "strconv" + "strings" +) + +type file struct { + fd int32 + name string +} + +func (f file) String() string { + var sb strings.Builder + + if len(f.name) == 0 { + sb.WriteString("file:?") + } else { + sb.WriteString("file:(") + sb.WriteString(strconv.FormatInt(int64(f.fd), 10)) + sb.WriteString(")") + sb.WriteString(f.name) + } + + return sb.String() +} |
