summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/go-homedir
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-01-11 16:57:47 +0100
committerJoram Wilander <jwawilander@gmail.com>2018-01-11 10:57:47 -0500
commit6990d052d5e95295e729aae28a0d30bfdcb98573 (patch)
treedc441fdd959997f97cfff298c833a2503cee4a37 /vendor/github.com/minio/go-homedir
parent0a9200c35d4f3c5c0462135f5f6dfe60bfe364e8 (diff)
downloadchat-6990d052d5e95295e729aae28a0d30bfdcb98573.tar.gz
chat-6990d052d5e95295e729aae28a0d30bfdcb98573.tar.bz2
chat-6990d052d5e95295e729aae28a0d30bfdcb98573.zip
[XYZ-6] Add sampledata platform command (#8027)
* Add fake dependency * [XYZ-6] Add sampledata platform command * Creating EMOJI_NAME_MAX_LENGTH as a constant and using it where needed
Diffstat (limited to 'vendor/github.com/minio/go-homedir')
-rw-r--r--vendor/github.com/minio/go-homedir/README.md2
-rw-r--r--vendor/github.com/minio/go-homedir/dir_posix.go3
-rw-r--r--vendor/github.com/minio/go-homedir/dir_windows.go3
-rw-r--r--vendor/github.com/minio/go-homedir/homedir.go19
4 files changed, 10 insertions, 17 deletions
diff --git a/vendor/github.com/minio/go-homedir/README.md b/vendor/github.com/minio/go-homedir/README.md
index 085f57775..2d9456fa5 100644
--- a/vendor/github.com/minio/go-homedir/README.md
+++ b/vendor/github.com/minio/go-homedir/README.md
@@ -13,4 +13,4 @@ it has a cgo dependency on Darwin systems. This means that any Go code
that uses that package cannot cross compile. But 99% of the time the
use for `os/user` is just to retrieve the home directory, which we can
do for the current user without cgo. This library does that, enabling
-cross-compilation.
+cross-compilation.
diff --git a/vendor/github.com/minio/go-homedir/dir_posix.go b/vendor/github.com/minio/go-homedir/dir_posix.go
index 4615fe063..f1de21488 100644
--- a/vendor/github.com/minio/go-homedir/dir_posix.go
+++ b/vendor/github.com/minio/go-homedir/dir_posix.go
@@ -1,8 +1,5 @@
// +build !windows
-// Copyright 2016 (C) Mitchell Hashimoto
-// Distributed under the MIT License.
-
package homedir
import (
diff --git a/vendor/github.com/minio/go-homedir/dir_windows.go b/vendor/github.com/minio/go-homedir/dir_windows.go
index 85e5218c7..e1ac9cf77 100644
--- a/vendor/github.com/minio/go-homedir/dir_windows.go
+++ b/vendor/github.com/minio/go-homedir/dir_windows.go
@@ -1,6 +1,3 @@
-// Copyright 2016 (C) Mitchell Hashimoto
-// Distributed under the MIT License.
-
package homedir
import (
diff --git a/vendor/github.com/minio/go-homedir/homedir.go b/vendor/github.com/minio/go-homedir/homedir.go
index 092373801..ecc9c5e4b 100644
--- a/vendor/github.com/minio/go-homedir/homedir.go
+++ b/vendor/github.com/minio/go-homedir/homedir.go
@@ -1,6 +1,3 @@
-// Copyright 2016 (C) Mitchell Hashimoto
-// Distributed under the MIT License.
-
// Package homedir implements a portable function to determine current user's homedir.
package homedir
@@ -15,23 +12,25 @@ import (
var DisableCache bool
var homedirCache string
-var cacheLock sync.Mutex
+var cacheLock sync.RWMutex
// Dir returns the home directory for the executing user.
//
// This uses an OS-specific method for discovering the home directory.
// An error is returned if a home directory cannot be detected.
func Dir() (string, error) {
- cacheLock.Lock()
- defer cacheLock.Unlock()
-
- // Return cached homedir if available.
if !DisableCache {
- if homedirCache != "" {
- return homedirCache, nil
+ cacheLock.RLock()
+ cached := homedirCache
+ cacheLock.RUnlock()
+ if cached != "" {
+ return cached, nil
}
}
+ cacheLock.Lock()
+ defer cacheLock.Unlock()
+
// Determine OS speific current homedir.
result, err := dir()
if err != nil {