aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/gops/internal/internal.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/gops/internal/internal.go')
-rw-r--r--vendor/github.com/google/gops/internal/internal.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/github.com/google/gops/internal/internal.go b/vendor/github.com/google/gops/internal/internal.go
deleted file mode 100644
index 1382822..0000000
--- a/vendor/github.com/google/gops/internal/internal.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package internal
-
-import (
- "errors"
- "fmt"
- "io/ioutil"
- "os"
- "os/user"
- "path/filepath"
- "runtime"
- "strings"
-)
-
-func ConfigDir() (string, error) {
- if runtime.GOOS == "windows" {
- return filepath.Join(os.Getenv("APPDATA"), "gops"), nil
- }
- homeDir := guessUnixHomeDir()
- if homeDir == "" {
- return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
- }
- return filepath.Join(homeDir, ".config", "gops"), nil
-}
-
-func guessUnixHomeDir() string {
- usr, err := user.Current()
- if err == nil {
- return usr.HomeDir
- }
- return os.Getenv("HOME")
-}
-
-func PIDFile(pid int) (string, error) {
- gopsdir, err := ConfigDir()
- if err != nil {
- return "", err
- }
- return fmt.Sprintf("%s/%d", gopsdir, pid), nil
-}
-
-func GetPort(pid int) (string, error) {
- portfile, err := PIDFile(pid)
- if err != nil {
- return "", err
- }
- b, err := ioutil.ReadFile(portfile)
- if err != nil {
- return "", err
- }
- port := strings.TrimSpace(string(b))
- return port, nil
-}