diff --git a/allschema.sh b/allschema.sh index a9951cb..0a2cef3 100755 --- a/allschema.sh +++ b/allschema.sh @@ -16,9 +16,9 @@ for status in $statusResponse; do read -ra ADDR <<<"$status" for module_name in "${ADDR[0]}"; do if [ -n "$*" ]; then - ispctl $* schema $module_name -o html > schemas/$module_name.html + ispctl $* schema -o html $module_name > schemas/$module_name.html else - ispctl schema $module_name -o html > schemas/$module_name.html + ispctl schema -o html $module_name > schemas/$module_name.html fi break done diff --git a/command/vars.go b/command/vars.go index a810f60..d443bd9 100644 --- a/command/vars.go +++ b/command/vars.go @@ -132,7 +132,9 @@ func (c Variables) readVariablesFromCsv(filepath string) ([]model.UpsertVariable if err != nil { return nil, errors.WithMessagef(err, "failed to open file %s", filepath) } - defer file.Close() + defer func() { + _ = file.Close() + }() reader := csv.NewReader(file) reader.TrimLeadingSpace = true diff --git a/main.go b/main.go index 010d318..c3e66d3 100644 --- a/main.go +++ b/main.go @@ -69,7 +69,7 @@ func configServiceFromGlobalFlags(ctx *cli.Context) (service.Config, error) { enableUnsafe := ctx.Bool(command.UnsafeFlagName) host := ctx.String(command.HostFlagName) - host = strings.Replace(host, "'", "", -1) + host = strings.ReplaceAll(host, "'", "") configCli, err := repository.NewGrpcClientWithHost(host) if err != nil { diff --git a/repository/config.go b/repository/config.go index 5b873a9..b8b3708 100644 --- a/repository/config.go +++ b/repository/config.go @@ -3,11 +3,12 @@ package repository import ( "context" "fmt" - epb "google.golang.org/genproto/googleapis/rpc/errdetails" "ispctl/model" "strings" "time" + epb "google.golang.org/genproto/googleapis/rpc/errdetails" + "github.com/pkg/errors" "github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/client" @@ -150,8 +151,8 @@ func (c Config) handleVariableError(err error, endpoint string) error { if apiError == nil { return errors.WithMessagef(err, "call %s", endpoint) } - switch { - case apiError.ErrorCode == model.ErrCodeVariableNotFound: + switch apiError.ErrorCode { + case model.ErrCodeVariableNotFound: return model.ErrVariableNotFound default: return errors.WithMessagef(err, "call %s", endpoint)