From f32dde2806a1c747cd497dd7da5ee7ff4c2680fb Mon Sep 17 00:00:00 2001 From: oanatmaria Date: Mon, 25 Sep 2023 15:32:51 +0300 Subject: [PATCH] Fix linting --- .golangci.yaml | 2 +- pkg/app/ui/handler.go | 22 +++++++++++----------- pkg/cli/cmd/manifest.go | 16 ---------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index ac63286c..da8ff724 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -34,7 +34,7 @@ linters-settings: - whyNoLint - wrapperFunc gocyclo: - min-complexity: 18 + min-complexity: 20 goimports: local-prefixes: github.com/golangci/golangci-lint golint: diff --git a/pkg/app/ui/handler.go b/pkg/app/ui/handler.go index 3c810cdc..1f599e27 100644 --- a/pkg/app/ui/handler.go +++ b/pkg/app/ui/handler.go @@ -30,11 +30,11 @@ func UIHandler(consoleFS http.FileSystem) http.Handler { func ConfigHandler(confServices *config.Config) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { type consoleCfg struct { - AsertoDirectoryUrl string `json:"asertoDirectoryUrl"` - AuthorizerServiceUrl string `json:"authorizerServiceUrl"` - AuthorizerApiKey string `json:"authorizerApiKey"` - DirectoryApiKey string `json:"directoryApiKey"` - DirectoryTenantId string `json:"directoryTenantId"` + AsertoDirectoryURL string `json:"asertoDirectoryUrl"` + AuthorizerServiceURL string `json:"authorizerServiceUrl"` + AuthorizerAPIKey string `json:"authorizerApiKey"` + DirectoryAPIKey string `json:"directoryApiKey"` + DirectoryTenantID string `json:"directoryTenantId"` } var apiKey string @@ -45,22 +45,22 @@ func ConfigHandler(confServices *config.Config) func(w http.ResponseWriter, r *h cfg := &consoleCfg{} if serviceConfig, ok := confServices.Services["authorizer"]; ok { - cfg.AuthorizerServiceUrl = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress) - cfg.AuthorizerApiKey = apiKey + cfg.AuthorizerServiceURL = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress) + cfg.AuthorizerAPIKey = apiKey } if serviceConfig, ok := confServices.Services["reader"]; ok { - cfg.AsertoDirectoryUrl = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress) + cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress) } else { host := strings.Split(confServices.DirectoryResolver.Address, ":")[0] - cfg.AsertoDirectoryUrl = fmt.Sprintf("https://%s", host) + cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", host) if confServices.DirectoryResolver.TenantID != "" { - cfg.DirectoryTenantId = confServices.DirectoryResolver.TenantID + cfg.DirectoryTenantID = confServices.DirectoryResolver.TenantID } } if confServices.DirectoryResolver.APIKey != "" { - cfg.DirectoryApiKey = confServices.DirectoryResolver.APIKey + cfg.DirectoryAPIKey = confServices.DirectoryResolver.APIKey } buf, _ := json.Marshal(cfg) diff --git a/pkg/cli/cmd/manifest.go b/pkg/cli/cmd/manifest.go index a7a845b9..ab6a8501 100644 --- a/pkg/cli/cmd/manifest.go +++ b/pkg/cli/cmd/manifest.go @@ -41,14 +41,6 @@ func (cmd *GetManifestCmd) Run(c *cc.CommonCtx) error { return err } - // if !cmd.Stdout && cmd.Path == "" { - // currentDir, err := os.Getwd() - // if err != nil { - // return err - // } - // cmd.Path = path.Join(currentDir, defaultManifestName) - // } - color.Green(">>> get manifest to %s", cmd.Path) r, err := dirClient.GetManifest(c.Context) @@ -91,14 +83,6 @@ func (cmd *SetManifestCmd) Run(c *cc.CommonCtx) error { } } - // if cmd.Path == defaultManifestName { - // currentDir, err := os.Getwd() - // if err != nil { - // return err - // } - // cmd.Path = path.Join(currentDir, defaultManifestName) - // } - color.Green(">>> set manifest from %s", cmd.Path) return dirClient.SetManifest(c.Context, r)