summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/gops/internal
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-07-18 17:27:41 +0200
committerGitHub <noreply@github.com>2020-07-18 17:27:41 +0200
commit23d8742f0d95096b92f11729fb47f86ac3b68d43 (patch)
tree7b8acb02b051ae06e5454fda4a9d5118428fe016 /vendor/github.com/google/gops/internal
parent3b6a8be07b9422714db30fb50977f342057febf3 (diff)
downloadmatterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.tar.gz
matterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.tar.bz2
matterbridge-msglm-23d8742f0d95096b92f11729fb47f86ac3b68d43.zip
Update dependencies for 1.18.0 release (#1175)
Diffstat (limited to 'vendor/github.com/google/gops/internal')
-rw-r--r--vendor/github.com/google/gops/internal/internal.go13
-rw-r--r--vendor/github.com/google/gops/internal/internal_go1_13.go19
-rw-r--r--vendor/github.com/google/gops/internal/internal_lt_go1_13.go11
3 files changed, 41 insertions, 2 deletions
diff --git a/vendor/github.com/google/gops/internal/internal.go b/vendor/github.com/google/gops/internal/internal.go
index 80eac63f..ec63f918 100644
--- a/vendor/github.com/google/gops/internal/internal.go
+++ b/vendor/github.com/google/gops/internal/internal.go
@@ -6,12 +6,12 @@ package internal
import (
"errors"
- "fmt"
"io/ioutil"
"os"
"os/user"
"path/filepath"
"runtime"
+ "strconv"
"strings"
)
@@ -22,9 +22,18 @@ func ConfigDir() (string, error) {
return configDir, nil
}
+ if osUserConfigDir := getOSUserConfigDir(); osUserConfigDir != "" {
+ return filepath.Join(osUserConfigDir, "gops"), nil
+ }
+
if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("APPDATA"), "gops"), nil
}
+
+ if xdgConfigDir := os.Getenv("XDG_CONFIG_HOME"); xdgConfigDir != "" {
+ return filepath.Join(xdgConfigDir, "gops"), nil
+ }
+
homeDir := guessUnixHomeDir()
if homeDir == "" {
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
@@ -45,7 +54,7 @@ func PIDFile(pid int) (string, error) {
if err != nil {
return "", err
}
- return fmt.Sprintf("%s/%d", gopsdir, pid), nil
+ return filepath.Join(gopsdir, strconv.Itoa(pid)), nil
}
func GetPort(pid int) (string, error) {
diff --git a/vendor/github.com/google/gops/internal/internal_go1_13.go b/vendor/github.com/google/gops/internal/internal_go1_13.go
new file mode 100644
index 00000000..6e823138
--- /dev/null
+++ b/vendor/github.com/google/gops/internal/internal_go1_13.go
@@ -0,0 +1,19 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build go1.13
+
+package internal
+
+import (
+ "os"
+)
+
+func getOSUserConfigDir() string {
+ configDir, err := os.UserConfigDir()
+ if err != nil {
+ return ""
+ }
+ return configDir
+}
diff --git a/vendor/github.com/google/gops/internal/internal_lt_go1_13.go b/vendor/github.com/google/gops/internal/internal_lt_go1_13.go
new file mode 100644
index 00000000..8506cf5f
--- /dev/null
+++ b/vendor/github.com/google/gops/internal/internal_lt_go1_13.go
@@ -0,0 +1,11 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !go1.13
+
+package internal
+
+func getOSUserConfigDir() string {
+ return ""
+}