From b73e1489b06fd4546da6ba32697331584db02e71 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 20 Apr 2022 16:22:07 +0200 Subject: Refactor: Eliminate most uses of pointers in structs --- src/server.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/server.go') diff --git a/src/server.go b/src/server.go index b7d55cb..7e323f6 100644 --- a/src/server.go +++ b/src/server.go @@ -6,11 +6,11 @@ import ( ) type Server struct { - BaseURL string `json:"base_url"` - Endpoints *ServerEndpoints `json:"endpoints"` - OAuth *OAuth `json:"oauth"` - Profiles *ServerProfileInfo `json:"profiles"` - ProfilesRaw string `json:"profiles_raw"` + BaseURL string `json:"base_url"` + Endpoints ServerEndpoints `json:"endpoints"` + OAuth OAuth `json:"oauth"` + Profiles ServerProfileInfo `json:"profiles"` + ProfilesRaw string `json:"profiles_raw"` } type ServerProfile struct { @@ -56,12 +56,7 @@ func (server *Server) Initialize(url string) error { } func (server *Server) NeedsRelogin() bool { - // Server has no oauth tokens - if server.OAuth == nil || server.OAuth.Token == nil { - return true - } - - // Server has oauth tokens, check if they need a relogin + // Check if OAuth needs relogin return server.OAuth.NeedsRelogin() } @@ -73,7 +68,7 @@ func (server *Server) GetEndpoints() error { return bodyErr } - endpoints := &ServerEndpoints{} + endpoints := ServerEndpoints{} jsonErr := json.Unmarshal(body, &endpoints) if jsonErr != nil { -- cgit v1.2.3