//go:build windows package main import ( "fmt" "os" ) func acquireLock(path string) (func(), error) { file, err := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0o600) if err != nil { return nil, fmt.Errorf("another test harness process may hold %s: %w", path, err) } return func() { _ = file.Close() _ = os.Remove(path) }, nil }