summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2026-02-12 12:03:54 +0100
committerJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2026-02-12 12:03:54 +0100
commitb00ce8214479c50e137db73c77b0cc1393c5e7d4 (patch)
tree5b5421728e91645ce5e44980f13029ad590a53ad
parentfd7abf186da1895e20dd2fdb2e8a1406e60081d7 (diff)
All: Run modernize --test --fix
-rw-r--r--cmd/eduvpn-cli/main.go6
-rw-r--r--internal/config/v2/v2.go4
-rw-r--r--internal/levenshtein/levenshtein.go4
-rw-r--r--internal/log/rotate_test.go2
-rw-r--r--internal/test/server.go1
5 files changed, 8 insertions, 9 deletions
diff --git a/cmd/eduvpn-cli/main.go b/cmd/eduvpn-cli/main.go
index 2a8ffc1..bb90e40 100644
--- a/cmd/eduvpn-cli/main.go
+++ b/cmd/eduvpn-cli/main.go
@@ -35,17 +35,17 @@ func openBrowser(data any) {
func getProfileInteractive(profiles *srvtypes.Profiles, data any) (string, error) {
fmt.Printf("Multiple VPN profiles found. Please select a profile by entering e.g. 1")
- ps := ""
+ var ps strings.Builder
var options []string
i := 0
for k, v := range profiles.Map {
- ps += fmt.Sprintf("\n%d - %s", i+1, i18n.GetLanguageMatched(v.DisplayName, "en"))
+ ps.WriteString(fmt.Sprintf("\n%d - %s", i+1, i18n.GetLanguageMatched(v.DisplayName, "en")))
options = append(options, k)
i++
}
// Show the profiles
- fmt.Println(ps)
+ fmt.Println(ps.String())
var idx int
if _, err := fmt.Scanf("%d", &idx); err != nil || idx <= 0 ||
diff --git a/internal/config/v2/v2.go b/internal/config/v2/v2.go
index 7851cb8..056fb73 100644
--- a/internal/config/v2/v2.go
+++ b/internal/config/v2/v2.go
@@ -18,9 +18,9 @@ type Server struct {
Profiles server.Profiles `json:"profiles"`
// LastAuthorizeTime is the time we last authorized
// This is used for determining when to show e.g. the renew button
- LastAuthorizeTime time.Time `json:"last_authorize_time,omitempty"`
+ LastAuthorizeTime time.Time `json:"last_authorize_time"`
// ExpireTime is the time at which the VPN expires
- ExpireTime time.Time `json:"expire_time,omitempty"`
+ ExpireTime time.Time `json:"expire_time"`
// CountryCode is the country code for the server in case of secure internet
// Otherwise it is an empty string
diff --git a/internal/levenshtein/levenshtein.go b/internal/levenshtein/levenshtein.go
index 80f58a3..d731e5d 100644
--- a/internal/levenshtein/levenshtein.go
+++ b/internal/levenshtein/levenshtein.go
@@ -56,8 +56,8 @@ func levenshtein(os, ot string) int {
// for these a score of -1 returned
// for all others it is the normal levenshtein distance
func adjusted(substr, full string) int {
- sSub := strings.Split(substr, " ")
- for _, vSub := range sSub {
+ sSub := strings.SplitSeq(substr, " ")
+ for vSub := range sSub {
if !strings.Contains(full, vSub) {
return -1
}
diff --git a/internal/log/rotate_test.go b/internal/log/rotate_test.go
index 5381a49..4fa77fd 100644
--- a/internal/log/rotate_test.go
+++ b/internal/log/rotate_test.go
@@ -69,7 +69,7 @@ func TestWriteTrim(t *testing.T) {
writeNCheckSize := func(n int, size int64) {
buf := make([]byte, n)
- for i := 0; i < n; i++ {
+ for i := range n {
buf[i] = 'x'
}
_, err := fr.Write(buf)
diff --git a/internal/test/server.go b/internal/test/server.go
index f222abc..2596f29 100644
--- a/internal/test/server.go
+++ b/internal/test/server.go
@@ -62,7 +62,6 @@ func (hp *HandlerPath) HandlerFunc() func(http.ResponseWriter, *http.Request) {
func NewServerWithHandles(hps []HandlerPath, listener net.Listener) *Server {
mux := http.NewServeMux()
for _, hp := range hps {
- hp := hp
if hp.ResponseCode == 0 {
hp.ResponseCode = 200
}