summaryrefslogtreecommitdiff
path: root/internal/file
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-04-16 16:11:42 +0300
committerPaul Buetow <paul@buetow.org>2025-04-16 16:11:42 +0300
commit8373683c8fb16b7d26a9b4056eab4461f12c3e66 (patch)
tree30889732b0f49d96d69c63e0e10ba2b581c73ed6 /internal/file
parent9745923f0acc994181f643fb02b612f10426f41b (diff)
fix
Diffstat (limited to 'internal/file')
-rw-r--r--internal/file/file.go8
-rw-r--r--internal/file/file_test.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/file/file.go b/internal/file/file.go
index 6c29961..aff9b8b 100644
--- a/internal/file/file.go
+++ b/internal/file/file.go
@@ -25,7 +25,7 @@ type FdFile struct {
func NewFd(fd int32, name []byte, flags int32) FdFile {
f := FdFile{
fd: fd,
- name: stringValue(name),
+ name: StringValue(name),
flags: Flags(flags),
}
if f.flags == -1 {
@@ -106,7 +106,7 @@ type oldnameNewnameFile struct {
}
func NewOldnameNewname(oldname, newname []byte) oldnameNewnameFile {
- return oldnameNewnameFile{stringValue(oldname), stringValue(newname)}
+ return oldnameNewnameFile{StringValue(oldname), StringValue(newname)}
}
func (f oldnameNewnameFile) Name() string {
@@ -136,7 +136,7 @@ type pathnameFile struct {
}
func NewPathname(pathname []byte) pathnameFile {
- return pathnameFile{stringValue(pathname)}
+ return pathnameFile{StringValue(pathname)}
}
func (f pathnameFile) Name() string {
@@ -160,6 +160,6 @@ func (f pathnameFile) String() string {
}
// As data comes in from arrays, converted to slices, there will be null-bytes at the end..
-func stringValue(byteStr []byte) string {
+func StringValue(byteStr []byte) string {
return string(byteStr[:bytes.IndexByte(byteStr, 0)])
}
diff --git a/internal/file/file_test.go b/internal/file/file_test.go
index dc59738..a8b6fb2 100644
--- a/internal/file/file_test.go
+++ b/internal/file/file_test.go
@@ -8,7 +8,7 @@ func TestStringValue(t *testing.T) {
var array [128]byte
copy(array[:], "test string")
- if str := stringValue(array[:]); str != "test string" {
+ if str := StringValue(array[:]); str != "test string" {
t.Errorf("epxected 'test string' but got '%s' with bytes '%v'", str, []byte(str))
}
}