summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-12-12 13:30:18 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-12-12 13:39:21 +0100
commit3263a6fb3719148358ce11b3c744508451d6e1a6 (patch)
treed9661922d9522eff4051db816036cda88aefe6ac
parent7aca778d6433373b5c65d4172b28a4461239e3f8 (diff)
Format: Run gofumpt
-rw-r--r--client/fsm.go4
-rw-r--r--client/server.go20
-rw-r--r--cmd/cli/main.go2
-rw-r--r--exports/exports.go3
-rw-r--r--internal/log/log.go3
-rw-r--r--internal/oauth/oauth.go1
-rw-r--r--internal/server/secureinternet.go3
-rw-r--r--internal/server/servers.go3
-rw-r--r--internal/wireguard/wireguard.go1
9 files changed, 20 insertions, 20 deletions
diff --git a/client/fsm.go b/client/fsm.go
index 76dee05..c156fba 100644
--- a/client/fsm.go
+++ b/client/fsm.go
@@ -212,7 +212,7 @@ func (c *Client) SetSearchServer() error {
return err
}
- //TODO(jwijenbergh): Should we handle `false` returned value here?
+ // TODO(jwijenbergh): Should we handle `false` returned value here?
c.FSM.GoTransition(StateSearchServer)
return nil
}
@@ -325,7 +325,7 @@ func (c *Client) SetDisconnected(cleanup bool) error {
func (c *Client) goBackInternal() {
err := c.GoBack()
if err != nil {
- //TODO(jwijenbergh): Bit suspicious - logging level INFO, yet stacktrace logged.
+ // TODO(jwijenbergh): Bit suspicious - logging level INFO, yet stacktrace logged.
c.Logger.Infof("failed going back: %s\nstacktrace:\n%s", err.Error(), err.(*errors.Error).ErrorStack())
}
}
diff --git a/client/server.go b/client/server.go
index 7d620c6..3488b6b 100644
--- a/client/server.go
+++ b/client/server.go
@@ -16,7 +16,7 @@ func (c *Client) getConfigAuth(srv server.Server, preferTCP bool) (string, strin
return "", "", err
}
- //TODO(jwijenbergh): Should we check if it returns false?
+ // TODO(jwijenbergh): Should we check if it returns false?
c.FSM.GoTransition(StateRequestConfig)
ok, err := server.HasValidProfile(srv, c.SupportsWireguard)
@@ -83,8 +83,8 @@ func (c *Client) getConfig(srv server.Server, preferTCP bool) (string, string, e
// Save the config
if err = c.Config.Save(&c); err != nil {
- //TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
- //TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
+ // TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
+ // TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
c.Logger.Infof("c.Config.Save failed: %s\nstacktrace:\n%s",
err.Error(), err.(*errors.Error).ErrorStack())
}
@@ -130,8 +130,8 @@ func (c *Client) RemoveSecureInternet() error {
c.FSM.GoTransitionWithData(StateNoServer, c.Servers)
// Save the config
if err := c.Config.Save(&c); err != nil {
- //TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
- //TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
+ // TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
+ // TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
c.Logger.Infof("c.Config.Save failed: %s\nstacktrace:\n%s",
err.Error(), err.(*errors.Error).ErrorStack())
}
@@ -152,8 +152,8 @@ func (c *Client) RemoveInstituteAccess(url string) error {
c.FSM.GoTransitionWithData(StateNoServer, c.Servers)
// Save the config
if err := c.Config.Save(&c); err != nil {
- //TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
- //TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
+ // TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
+ // TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
c.Logger.Infof("c.Config.Save failed: %s\nstacktrace:\n%s",
err.Error(), err.(*errors.Error).ErrorStack())
}
@@ -174,8 +174,8 @@ func (c *Client) RemoveCustomServer(url string) error {
c.FSM.GoTransitionWithData(StateNoServer, c.Servers)
// Save the config
if err := c.Config.Save(&c); err != nil {
- //TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
- //TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
+ // TODO(jwijenbergh): Not sure why INFO level, yet stacktrace...
+ // TODO(jwijenbergh): Even worse, why logging it but then return nil? The calling code will think that everything went well.
c.Logger.Infof("c.Config.Save failed: %s\nstacktrace:\n%s",
err.Error(), err.(*errors.Error).ErrorStack())
}
@@ -265,7 +265,7 @@ func (c *Client) AddSecureInternetHomeServer(orgID string) (srv server.Server, e
return nil, err
}
- //TODO(jwijenbergh): Does this call transfers execution flow to UI?
+ // TODO(jwijenbergh): Does this call transfers execution flow to UI?
if err = c.askSecureLocation(); err != nil {
// Removing is the best effort
// This already goes back to the main screen
diff --git a/cmd/cli/main.go b/cmd/cli/main.go
index f23f7ff..08c964a 100644
--- a/cmd/cli/main.go
+++ b/cmd/cli/main.go
@@ -28,7 +28,7 @@ func openBrowser(url interface{}) {
fmt.Printf("OAuth: Initialized with AuthURL %s\n", str)
fmt.Println("OAuth: Opening browser with xdg-open...")
if exec.Command("xdg-open", str).Start() != nil {
- //TODO(): Shouldn't this if statement be inverted?
+ // TODO(): Shouldn't this if statement be inverted?
fmt.Println("OAuth: Browser opened with xdg-open...")
}
}
diff --git a/exports/exports.go b/exports/exports.go
index 2532dc4..87ce331 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -14,9 +14,10 @@ static int call_callback(PythonCB callback, const char *name, int oldstate, int
import "C"
import (
+ "unsafe"
+
"github.com/eduvpn/eduvpn-common/internal/log"
"github.com/go-errors/errors"
- "unsafe"
"github.com/eduvpn/eduvpn-common/client"
)
diff --git a/internal/log/log.go b/internal/log/log.go
index 68313f7..101c112 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -3,12 +3,13 @@ package log
import (
"fmt"
- "github.com/eduvpn/eduvpn-common/internal/oauth"
"io"
"log"
"os"
"path"
+ "github.com/eduvpn/eduvpn-common/internal/oauth"
+
"github.com/eduvpn/eduvpn-common/internal/util"
"github.com/go-errors/errors"
)
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index 67d9c8a..1dbdad4 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -454,7 +454,6 @@ func (oauth *OAuth) AuthURL(name string, postProcessAuth func(string) string) (s
}
u, err := httpw.ConstructURL(oauth.BaseAuthorizationURL, params)
-
if err != nil {
return "", errors.WrapPrefix(err, "httpw.ConstructURL error", 0)
}
diff --git a/internal/server/secureinternet.go b/internal/server/secureinternet.go
index 12263a6..bd2d66a 100644
--- a/internal/server/secureinternet.go
+++ b/internal/server/secureinternet.go
@@ -108,7 +108,8 @@ func (s *SecureInternetHomeServer) addLocation(locSrv *types.DiscoveryServer) (*
// Initializes the home server and adds its own location.
func (s *SecureInternetHomeServer) init(
- homeOrg *types.DiscoveryOrganization, homeLoc *types.DiscoveryServer) error {
+ homeOrg *types.DiscoveryOrganization, homeLoc *types.DiscoveryServer,
+) error {
if s.HomeOrganizationID != homeOrg.OrgID {
// New home organisation, clear everything
*s = SecureInternetHomeServer{}
diff --git a/internal/server/servers.go b/internal/server/servers.go
index 5ede005..8da1c7f 100644
--- a/internal/server/servers.go
+++ b/internal/server/servers.go
@@ -20,7 +20,6 @@ func (ss *Servers) AddSecureInternet(
// If we have specified an organization ID
// We also need to get an authorization template
err := ss.SecureInternetHomeServer.init(secureOrg, secureServer)
-
if err != nil {
return nil, err
}
@@ -30,7 +29,7 @@ func (ss *Servers) AddSecureInternet(
}
func (ss *Servers) GetCurrentServer() (Server, error) {
- //TODO(jwijenbergh): Almost certainly the return type should be pointer (*Server)
+ // TODO(jwijenbergh): Almost certainly the return type should be pointer (*Server)
if ss.IsType == SecureInternetServerType {
if !ss.HasSecureLocation() {
return nil, errors.Errorf("ss.IsType = %v; ss.HasSecureLocation() = false", ss.IsType)
diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go
index 0419ff6..cc6c577 100644
--- a/internal/wireguard/wireguard.go
+++ b/internal/wireguard/wireguard.go
@@ -13,7 +13,6 @@ import (
// It returns an error if key generation failed.
func GenerateKey() (wgtypes.Key, error) {
key, err := wgtypes.GeneratePrivateKey()
-
if err != nil {
return key, errors.WrapPrefix(err, "failed generating WireGuard key", 0)
}