diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-27 17:33:12 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-27 17:33:12 +0900 |
| commit | 775a9f57c9ec3bc6877e3973a8c4972558707375 (patch) | |
| tree | 7410791c10ca3d8adfd8a17914ef799d55be1b5a /cmd/sharefs/main.go | |
| parent | 2f8ca8337633a199aae9b4cdd71c66ed1c9529a5 (diff) | |
cmd/sharefs: check option parsing behaviour
This change makes it possible to check parseOpts behaviour as part of Go tests.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/sharefs/main.go')
| -rw-r--r-- | cmd/sharefs/main.go | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/cmd/sharefs/main.go b/cmd/sharefs/main.go index c90c8624..941a1668 100644 --- a/cmd/sharefs/main.go +++ b/cmd/sharefs/main.go @@ -3,23 +3,14 @@ package main import ( "log" "os" - "path" ) -// executableName is the [path.Base] name of the executable that started the current process. -var executableName = func() string { - if len(os.Args) > 0 { - return path.Base(os.Args[0]) - } else if name, err := os.Executable(); err != nil { - return "sharefs" - } else { - return path.Base(name) - } -}() +// sharefsName is the prefix used by log.std in the sharefs process. +const sharefsName = "sharefs" func main() { log.SetFlags(0) - log.SetPrefix(executableName + ": ") + log.SetPrefix(sharefsName + ": ") - os.Exit(_main(len(os.Args), copyStrings(os.Args...))) + os.Exit(_main(os.Args...)) } |
