From 46ce050d39f7e822e8d158ef3d693e124904602c Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 19 Sep 2024 00:15:27 +0100 Subject: [PATCH] fix_: linter and some more --- cmd/status-backend/main.go | 2 +- cmd/statusd/server/endpoints.go | 11 ++++++----- cmd/statusd/server/parse-api/endpoints_template.txt | 10 +++++----- cmd/statusd/server/signals_server.go | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cmd/status-backend/main.go b/cmd/status-backend/main.go index d06f0b6d1..96039490a 100644 --- a/cmd/status-backend/main.go +++ b/cmd/status-backend/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "github.com/ethereum/go-ethereum/log" "github.com/status-im/status-go/cmd/statusd/server" @@ -13,7 +14,6 @@ var ( ) func main() { - srv := server.NewServer() srv.Setup() diff --git a/cmd/statusd/server/endpoints.go b/cmd/statusd/server/endpoints.go index 3bd7f0e88..d8565d5d1 100644 --- a/cmd/statusd/server/endpoints.go +++ b/cmd/statusd/server/endpoints.go @@ -1,8 +1,8 @@ package server -import "github.com/status-im/status-go/mobile" +import statusgo "github.com/status-im/status-go/mobile" -var EndpointsWithResponse = []func(string) string { +var EndpointsWithResponse = []func(string) string{ statusgo.InitializeApplication, statusgo.ExtractGroupMembershipSignatures, statusgo.SignGroupMembership, @@ -54,7 +54,7 @@ var EndpointsWithResponse = []func(string) string { statusgo.AddCentralizedMetric, } -var EndpointsNoRequest = []func() string { +var EndpointsNoRequest = []func() string{ statusgo.GetNodeConfig, statusgo.ResetChainData, statusgo.Logout, @@ -70,7 +70,7 @@ var EndpointsNoRequest = []func() string { statusgo.CentralizedMetricsInfo, } -var EndpointsUnsupported = []string { +var EndpointsUnsupported = []string{ "VerifyAccountPassword", "VerifyDatabasePassword", "MigrateKeyStoreDir", @@ -93,9 +93,10 @@ var EndpointsUnsupported = []string { "ConvertToKeycardAccount", "ConvertToRegularAccount", "SwitchFleet", + "GenerateImages", "InputConnectionStringForBootstrapping", "InputConnectionStringForBootstrappingAnotherDevice", "InputConnectionStringForImportingKeypairsKeystores", "EncodeTransfer", "EncodeFunctionCall", -} \ No newline at end of file +} diff --git a/cmd/statusd/server/parse-api/endpoints_template.txt b/cmd/statusd/server/parse-api/endpoints_template.txt index 896d94b2a..f223b86c2 100644 --- a/cmd/statusd/server/parse-api/endpoints_template.txt +++ b/cmd/statusd/server/parse-api/endpoints_template.txt @@ -1,21 +1,21 @@ package server -import "github.com/status-im/status-go/mobile" +import statusgo "github.com/status-im/status-go/mobile" -var EndpointsWithResponse = []func(string) string { +var EndpointsWithResponse = []func(string) string{ {{- range .FunctionsWithResp }} {{ $.PackageName }}.{{ . }}, {{- end }} } -var EndpointsNoRequest = []func() string { +var EndpointsNoRequest = []func() string{ {{- range .FunctionsNoArgs }} {{ $.PackageName }}.{{ . }}, {{- end }} } -var EndpointsUnsupported = []string { +var EndpointsUnsupported = []string{ {{- range .UnsupportedEndpoints }} "{{ . }}", {{- end }} -} \ No newline at end of file +} diff --git a/cmd/statusd/server/signals_server.go b/cmd/statusd/server/signals_server.go index f66c6dc6a..a20e28842 100644 --- a/cmd/statusd/server/signals_server.go +++ b/cmd/statusd/server/signals_server.go @@ -126,7 +126,7 @@ func (s *Server) signals(w http.ResponseWriter, r *http.Request) { func (s *Server) addEndpointWithResponse(handler func(string) string) { endpoint := endpointName(functionName(handler)) - log.Info("adding endpoint", "name", endpoint) + log.Debug("adding endpoint", "name", endpoint) s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) { request, err := io.ReadAll(r.Body) if err != nil { @@ -145,7 +145,7 @@ func (s *Server) addEndpointWithResponse(handler func(string) string) { func (s *Server) addEndpointNoRequest(handler func() string) { endpoint := endpointName(functionName(handler)) - log.Info("adding endpoint", "name", endpoint) + log.Debug("adding endpoint", "name", endpoint) s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) { response := handler() @@ -158,7 +158,7 @@ func (s *Server) addEndpointNoRequest(handler func() string) { func (s *Server) addUnsupportedEndpoint(name string) { endpoint := endpointName(name) - log.Info("marking unsupported endpoint", "name", endpoint) + log.Debug("marking unsupported endpoint", "name", endpoint) s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotImplemented) })