summaryrefslogtreecommitdiff
path: root/internal/util
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-20 13:21:34 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-20 13:21:34 +0200
commit25d2143a627531fc0475d639c1e8f657ccafa630 (patch)
tree3b5b69b64f5f6879810842464056543e315c64a4 /internal/util
parentb0e4e454fc94935cf8ee3282a07596ec53268a18 (diff)
Golang-ci-lint: Fixes
Diffstat (limited to 'internal/util')
-rw-r--r--internal/util/util.go4
-rw-r--r--internal/util/util_test.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/util/util.go b/internal/util/util.go
index e652779..834b8d4 100644
--- a/internal/util/util.go
+++ b/internal/util/util.go
@@ -86,8 +86,8 @@ func ReplaceWAYF(authTemplate string, authURL string, orgID string) string {
// https://github.com/eduvpn/documentation/blob/dc4d53c47dd7a69e95d6650eec408e16eaa814a2/SERVER_DISCOVERY.md#language-matching
func GetLanguageMatched(languageMap map[string]string, languageTag string) string {
- // If no or empty map is given, return the empty string
- if languageMap == nil || len(languageMap) == 0 {
+ // If no map is given, return the empty string
+ if len(languageMap) == 0 {
return ""
}
// Try to find the exact match
diff --git a/internal/util/util_test.go b/internal/util/util_test.go
index 31d01e7..77af603 100644
--- a/internal/util/util_test.go
+++ b/internal/util/util_test.go
@@ -48,7 +48,7 @@ func Test_MakeRandomByteSlice(t *testing.T) {
t.Fatalf("2, Got: %v, want: nil", randomErr)
}
- if bytes.Compare(random2, random) == 0 {
+ if bytes.Equal(random2, random) {
t.Fatalf("Two random byteslices are the same: %v, %v", random2, random)
}
}
@@ -56,7 +56,7 @@ func Test_MakeRandomByteSlice(t *testing.T) {
func Test_GetCurrentTime(t *testing.T) {
time_now := GetCurrentTime()
- time.Sleep(1)
+ time.Sleep(1 * time.Second)
time_after_1_second := GetCurrentTime()