From b626ea8beb4bc1eef134a990eb1a7361c1c126b1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 13 Jan 2025 14:12:37 +0800 Subject: [PATCH] Reformat code --- misc/open_file.go | 14 +++++++------- scfg/writer.go | 4 +--- diff --git a/misc/open_file.go b/misc/open_file.go index ec5d402c2233a589cd53fbfda0db575c9369c79c..945d78b7766daf3693db8abf79e48a28d339f0c7 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 @@ // 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 diff --git a/scfg/writer.go b/scfg/writer.go index 97148a374c30800e1d8662272b98ac07a655a251..dd3b166370df229efb6cbd61c514910d22acba6b 100644 --- a/scfg/writer.go +++ b/scfg/writer.go @@ -6,9 +6,7 @@ "io" "strings" ) -var ( - errDirEmptyName = errors.New("scfg: directive with empty name") -) +var errDirEmptyName = errors.New("scfg: directive with empty name") // Write writes a parsed configuration to the provided io.Writer. func Write(w io.Writer, blk Block) error { -- 2.48.1