From abff7bae773c472c0324e5eb56a47f4598ed7859 Mon Sep 17 00:00:00 2001 From: KevinTchokodeu Date: Mon, 29 Nov 2021 16:43:50 +0100 Subject: [PATCH] all: add windows support Updates #2 --- internal/lock/cred_windows.go | 13 +++++++++++++ internal/lock/creds_darwin.go | 5 +++-- internal/lock/creds_linux.go | 5 +++-- internal/lock/daemon_darwin.go | 5 +++-- internal/lock/daemon_linux.go | 5 +++-- internal/lock/daemon_windows.go | 13 +++++++++++++ main.go | 4 +++- 7 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 internal/lock/cred_windows.go create mode 100644 internal/lock/daemon_windows.go diff --git a/internal/lock/cred_windows.go b/internal/lock/cred_windows.go new file mode 100644 index 0000000..9cd062f --- /dev/null +++ b/internal/lock/cred_windows.go @@ -0,0 +1,13 @@ +//go:build windows +// +build windows + +package lock + +import ( + "errors" + "net" +) + +func writeCredentials(c *net.UnixConn) error { + return errors.New("unimplemented") +} diff --git a/internal/lock/creds_darwin.go b/internal/lock/creds_darwin.go index 8454b75..2a5ca68 100644 --- a/internal/lock/creds_darwin.go +++ b/internal/lock/creds_darwin.go @@ -1,7 +1,8 @@ -package lock - +//go:build darwin // +build darwin +package lock + import ( "errors" "net" diff --git a/internal/lock/creds_linux.go b/internal/lock/creds_linux.go index c90ea5b..9d5c91a 100644 --- a/internal/lock/creds_linux.go +++ b/internal/lock/creds_linux.go @@ -1,6 +1,7 @@ -package lock +//go:build linux +// +build linux -// +build !darwin +package lock import ( "fmt" diff --git a/internal/lock/daemon_darwin.go b/internal/lock/daemon_darwin.go index 7039b16..906b071 100644 --- a/internal/lock/daemon_darwin.go +++ b/internal/lock/daemon_darwin.go @@ -1,11 +1,12 @@ +//go:build darwin +// +build darwin + package lock import ( "log" ) -// +build darwin - // RunDaemon runs lock daemon func RunDaemon() { log.Fatal("running daemon on darwin systems are not supported.") diff --git a/internal/lock/daemon_linux.go b/internal/lock/daemon_linux.go index 55878d8..25af71b 100644 --- a/internal/lock/daemon_linux.go +++ b/internal/lock/daemon_linux.go @@ -1,6 +1,7 @@ -package lock +//go:build linux +// +build linux -// +build !darwin +package lock import ( "encoding/gob" diff --git a/internal/lock/daemon_windows.go b/internal/lock/daemon_windows.go new file mode 100644 index 0000000..334afb8 --- /dev/null +++ b/internal/lock/daemon_windows.go @@ -0,0 +1,13 @@ +//go:build windows +// +build windows + +package lock + +import ( + "log" +) + +// RunDaemon runs lock daemon +func RunDaemon() { + log.Fatal("running daemon on windows systems are not supported.") +} diff --git a/main.go b/main.go index 16e08a3..da4855a 100644 --- a/main.go +++ b/main.go @@ -329,7 +329,9 @@ func runBench(args []string) { return } - fname := "bench-" + time.Now().Format("2006-01-02-15:04:05") + ".txt" + // Note that we should avoid using : in filename, because it is not + // supported on Windows file systems. + fname := "bench-" + time.Now().Format("2006-01-02-15-04-05") + ".txt" err = ioutil.WriteFile(fname, results, 0644) if err != nil { // try again, maybe the user was too fast?