paths: remove wasm file, no-op stubs, make OS-specific funcs consistent

Some OS-specific funcs were defined in init. Another used build tags
and required all other OSes to stub it out. Another one could just be in
the portable file.

Simplify it a bit, removing a file and some stubs in the process.

Updates #5794

Change-Id: I51df8772cc60a9335ac4c1dc0ab59b8a0d236961
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-08-23 21:19:11 -07:00
committed by Brad Fitzpatrick
parent d58ba59fd5
commit a5dcc4c87b
4 changed files with 28 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build !windows && !js && !wasip1
//go:build !windows && !wasm && !plan9
package paths
@@ -17,6 +17,7 @@ import (
func init() {
stateFileFunc = stateFileUnix
ensureStateDirPerms = ensureStateDirPermsUnix
}
func statePath() string {
@@ -65,7 +66,7 @@ func xdgDataHome() string {
return filepath.Join(os.Getenv("HOME"), ".local/share")
}
func ensureStateDirPerms(dir string) error {
func ensureStateDirPermsUnix(dir string) error {
if filepath.Base(dir) != "tailscale" {
return nil
}
@@ -83,8 +84,3 @@ func ensureStateDirPerms(dir string) error {
}
return os.Chmod(dir, perm)
}
// LegacyStateFilePath is not applicable to UNIX; it is just stubbed out.
func LegacyStateFilePath() string {
return ""
}