fix_: linter and some more

This commit is contained in:
Igor Sirotin 2024-09-19 00:15:27 +01:00
parent 6696e6fb9e
commit 46ce050d39
No known key found for this signature in database
GPG Key ID: 425E227CAAB81F95
4 changed files with 15 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/status-im/status-go/cmd/statusd/server" "github.com/status-im/status-go/cmd/statusd/server"
@ -13,7 +14,6 @@ var (
) )
func main() { func main() {
srv := server.NewServer() srv := server.NewServer()
srv.Setup() srv.Setup()

View File

@ -1,6 +1,6 @@
package server 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.InitializeApplication,
@ -93,6 +93,7 @@ var EndpointsUnsupported = []string {
"ConvertToKeycardAccount", "ConvertToKeycardAccount",
"ConvertToRegularAccount", "ConvertToRegularAccount",
"SwitchFleet", "SwitchFleet",
"GenerateImages",
"InputConnectionStringForBootstrapping", "InputConnectionStringForBootstrapping",
"InputConnectionStringForBootstrappingAnotherDevice", "InputConnectionStringForBootstrappingAnotherDevice",
"InputConnectionStringForImportingKeypairsKeystores", "InputConnectionStringForImportingKeypairsKeystores",

View File

@ -1,6 +1,6 @@
package server 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 }} {{- range .FunctionsWithResp }}

View File

@ -126,7 +126,7 @@ func (s *Server) signals(w http.ResponseWriter, r *http.Request) {
func (s *Server) addEndpointWithResponse(handler func(string) string) { func (s *Server) addEndpointWithResponse(handler func(string) string) {
endpoint := endpointName(functionName(handler)) 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) { s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
request, err := io.ReadAll(r.Body) request, err := io.ReadAll(r.Body)
if err != nil { if err != nil {
@ -145,7 +145,7 @@ func (s *Server) addEndpointWithResponse(handler func(string) string) {
func (s *Server) addEndpointNoRequest(handler func() string) { func (s *Server) addEndpointNoRequest(handler func() string) {
endpoint := endpointName(functionName(handler)) 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) { s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
response := handler() response := handler()
@ -158,7 +158,7 @@ func (s *Server) addEndpointNoRequest(handler func() string) {
func (s *Server) addUnsupportedEndpoint(name string) { func (s *Server) addUnsupportedEndpoint(name string) {
endpoint := endpointName(name) 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) { s.mux.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotImplemented) w.WriteHeader(http.StatusNotImplemented)
}) })