lint: lint the code

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias committed 2019-04-20 14:15:28 +01:00
1 parent c4bef0d616
commit b7fdcc3ee9
7 files changed
+34 -35

No files matched your search

+7 -6
View File
@@ -2,11 +2,12 @@ package settings
import (
"errors"
"github.com/spf13/afero"
"log"
"os"
"regexp"
"strings"
"github.com/spf13/afero"
)
var (
@@ -15,10 +16,11 @@ var (
dashes = regexp.MustCompile(`[\-]+`)
)
func CreateUserDir(username, userScope, serverRoot string, settings *Settings) (string, error) {
// MakeUserDir makes the user directory according to settings.
func (settings *Settings) MakeUserDir(username, userScope, serverRoot string) (string, error) {
var err error
userScope = strings.TrimSpace(userScope)
if userScope == "" || userScope == "./" {
if userScope == "" || userScope == "./" {
userScope = "."
}
@@ -56,10 +58,9 @@ func CreateUserDir(username, userScope, serverRoot string, settings *Settings) (
} else {
log.Printf("create user: mkdir user home dir: [%s] successfully.", userHome)
}
return userHome,err
return userHome, err
}
func cleanUsername(s string) string {
// Remove any trailing space to avoid ending on -
@@ -74,4 +75,4 @@ func cleanUsername(s string) string {
s = dashes.ReplaceAllString(s, "-")
return s
}
}