aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-13 14:12:37 +0800
committerRunxi Yu <me@runxiyu.org>2025-01-13 14:12:37 +0800
commitb626ea8beb4bc1eef134a990eb1a7361c1c126b1 (patch)
treee054c0b34b6d009e22487f73a7beb4e4e77c9bd2 /misc
parentAdd color to logging functions (diff)
downloadgo-lindenii-common-b626ea8beb4bc1eef134a990eb1a7361c1c126b1.tar.gz
go-lindenii-common-b626ea8beb4bc1eef134a990eb1a7361c1c126b1.tar.zst
go-lindenii-common-b626ea8beb4bc1eef134a990eb1a7361c1c126b1.zip
Reformat code
Diffstat (limited to 'misc')
-rw-r--r--misc/open_file.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/misc/open_file.go b/misc/open_file.go
index ec5d402..945d78b 100644
--- a/misc/open_file.go
+++ b/misc/open_file.go
@@ -1,20 +1,20 @@
package misc
import (
- "os"
"errors"
+ "os"
+ "path"
"strings"
"syscall"
- "path"
)
type Dir_t struct {
- fd int
+ fd int
name string
}
var (
- Err_illegal_filename = errors.New("illegal filename")
+ Err_illegal_filename = errors.New("illegal filename")
Err_invalid_file_descriptor = errors.New("invalid file descriptor")
)
@@ -29,9 +29,9 @@ func Open_file_at(dir Dir_t, filename string, flags int, perms os.FileMode) (*os
// Open a file at or beneath the given directory.
func Open_file_beneath(dir Dir_t, filename string, flags int, perms os.FileMode) (*os.File, error) {
fd, err := Openat2(dir.fd, filename, &Open_how_t{
- Flags: uint64(flags)|syscall.O_CLOEXEC,
- Mode: uint64(syscallMode(perms)),
- Resolve: RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS,
+ Flags: uint64(flags) | syscall.O_CLOEXEC,
+ Mode: uint64(syscallMode(perms)),
+ Resolve: RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS,
})
if err != nil {
return nil, err