From 775a9f57c9ec3bc6877e3973a8c4972558707375 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 27 Dec 2025 17:33:12 +0900 Subject: cmd/sharefs: check option parsing behaviour This change makes it possible to check parseOpts behaviour as part of Go tests. Signed-off-by: Ophestra --- cmd/sharefs/main.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'cmd/sharefs/main.go') 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...)) } -- cgit v1.3.1