Skip to content

Commit

Permalink
fix: golang ci lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Aug 22, 2024
1 parent e898548 commit 3345160
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ linters:
disable-all: true
enable:
- bodyclose
- exportloopref
- exhaustive
- goconst
- gofmt
- goprintffuncname
# - gosec
# - gosec
- gosimple
- govet
- ineffassign
Expand Down Expand Up @@ -60,11 +59,9 @@ linters-settings:
- "Prefix(github.com/FriendsOfShopware/shopware-cli)"

issues:
exclude-dirs:
- version
exclude-rules:
- path: cmd\/*
linters:
- forbidigo

run:
skip-dirs:
- version
2 changes: 1 addition & 1 deletion account-api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (*Client) doRequest(request *http.Request) ([]byte, error) {
}

if resp.StatusCode >= 400 {
return nil, fmt.Errorf(string(data))
return nil, fmt.Errorf(string(data)+", got status code %d", resp.StatusCode)
}

return data, nil
Expand Down
2 changes: 1 addition & 1 deletion account-api/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func fetchMemberships(ctx context.Context, token token) ([]Membership, error) {
}

if resp.StatusCode != 200 {
return nil, fmt.Errorf(string(data))
return nil, fmt.Errorf(string(data)+" but got status code %d", resp.StatusCode)
}

var companies []Membership
Expand Down
4 changes: 2 additions & 2 deletions cmd/project/project_proxy.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package project

import (
"fmt"
"errors"
"os"
"os/exec"
"runtime"
Expand Down Expand Up @@ -35,7 +35,7 @@ var projectProxyCmd = &cobra.Command{
message += "See cloudflare for more information: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
}

return fmt.Errorf(message)
return errors.New(message)
}

logging.FromContext(cobraCmd.Context()).Infof("Make sure you have set TRUSTED_PROXIES=127.0.0.1,::1 inside your .env file")
Expand Down
2 changes: 1 addition & 1 deletion extension/asset_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func InstallNPMDependencies(path string, packageJsonData NpmPackage, additionalP
}
}

if isProductionMode && (packageJsonData.Dependencies == nil || len(packageJsonData.Dependencies) == 0) {
if isProductionMode && len(packageJsonData.Dependencies) == 0 {
return nil
}

Expand Down

0 comments on commit 3345160

Please sign in to comment.