Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/compile-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
run: GO111MODULE=on go run .ci/prebuild/gofmt_check.go

- name: Run linter
uses: golangci/golangci-lint-action@v6.1.1
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v1.63.4
only-new-issues: true
args: --timeout 5m
version: v2.3.0
28 changes: 28 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "2"

run:
# timeout for analysis, e.g. 30s, 5m, default is 0
timeout: 5m

formatters:
enable:
- gofmt

settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true

linters:
disable:
- errcheck
enable:
- staticcheck

settings:
staticcheck:
checks:
- all
- -ST1000 # Incorrect or missing package comment
- -ST1003 # Poorly chosen identifier
- -ST1020 # The documentation of an exported function should start with the function’s name
2 changes: 1 addition & 1 deletion k8s/kube_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func FetchWorkloadConfig(clusterName, clusterNamespace, mgmtKubeConfigPath strin

f, err := os.CreateTemp(os.TempDir(), fmt.Sprintf("%s-workload-config", clusterName))
if err != nil {
return filePath, fmt.Errorf("Cannot create temporary file: %w", err)
return filePath, fmt.Errorf("cannot create temporary file: %w", err)
}
filePath = f.Name()
defer f.Close()
Expand Down
7 changes: 4 additions & 3 deletions k8s/result_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ func NewResultWriter(workdir, what, outputFormat, outputMode string, restApi res

writeLogs := what == "logs" || what == "all"
var printer printers.ResourcePrinter
if outputFormat == "" || outputFormat == "json" {
switch outputFormat {
case "", "json":
printer = &printers.JSONPrinter{}
} else if outputFormat == "yaml" {
case "yaml":
printer = &printers.YAMLPrinter{}
} else {
default:
return nil, fmt.Errorf("unsupported output format: %s", outputFormat)
}

Expand Down
2 changes: 1 addition & 1 deletion starlark/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func captureOutput(source io.Reader, filePath, desc string, append bool) error {
defer file.Close()

if len(desc) > 0 {
if _, err := file.WriteString(fmt.Sprintf("%s\n", desc)); err != nil {
if _, err := fmt.Fprintf(file, "%s\n", desc); err != nil {
return err
}
}
Expand Down
7 changes: 4 additions & 3 deletions starlark/set_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ func SetDefaultsFunc(thread *starlark.Thread, _ *starlark.Builtin, args starlark
if err != nil {
return starlark.None, fmt.Errorf("%s: %w", UnknownDefaultErrStr, err)
}
if constStr == identifiers.kubeCfg {
switch constStr {
case identifiers.kubeCfg:
thread.SetLocal(identifiers.kubeCfg, val)
} else if constStr == identifiers.sshCfg {
case identifiers.sshCfg:
thread.SetLocal(identifiers.sshCfg, val)
} else {
default:
return starlark.None, errors.New(UnknownDefaultErrStr)
}
case "list":
Expand Down
Loading