Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
run: make generate-mock

- name: Static Code Analysis
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: latest
version: latest
34 changes: 15 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Options for analysis running
# More info could be found at https://golangci-lint.run/usage/configuration/
version: "2"

run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
modules-download-mode: readonly

# List of useful linters could be found at https://github.com/golangci/awesome-go-linters
linters:
disable-all: true
default: none
enable:
- errcheck
- copyloopvar
- gofumpt
- goimports
- gosimple
- govet
- ineffassign
- makezero
Expand All @@ -27,21 +24,20 @@ linters:
- unused
- wastedassign
- gosec
settings:
staticcheck:
checks: [ "all", "-SA1019", "-SA1029", "-ST1000", "-ST1003" ]
gosec:
excludes: [ "G204", "G301", "G302", "G304", "G306", "G601", "G101" ]
config:
global:
nosec: true

linters-settings:
staticcheck:
# https://staticcheck.io/docs/options#checks
checks: [ "all","-SA1019","-SA1029" ]
gosec:
excludes: [ "G204", "G301", "G302", "G304", "G306", "G601", "G101" ]
exclude-generated: true
config:
global:
nosec: true
formatters:
enable:
- gofumpt
- goimports

issues:
exclude-use-default: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ GOIMPORTS:
########## ANALYSE ##########

GOLANGCI_LINT = ${TOOLS_DIR}/golangci-lint
GOLANGCI_LINT_VERSION = 1.63.4
GOLANGCI_LINT_VERSION = 2.12.2

verify: GOLANGCI_LINT
echo $(GO_SOURCES)
$(GOLANGCI_LINT) run --out-format tab --config "${WORKSPACE_ROOT}/.golangci.yml"
$(GOLANGCI_LINT) run --config "${WORKSPACE_ROOT}/.golangci.yml"

GOLANGCI_LINT:
${GOLANGCI_LINT} --version 2>/dev/null | grep ${GOLANGCI_LINT_VERSION} || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${TOOLS_DIR} v${GOLANGCI_LINT_VERSION}
Expand Down
8 changes: 6 additions & 2 deletions apptrust/common/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func PrintTable(data []byte, w io.Writer, orderedKeys []string) error {
return fmt.Errorf("failed to parse response: %w", err)
}
tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0)
fmt.Fprintln(tw, "FIELD\tVALUE")
if _, err := fmt.Fprintln(tw, "FIELD\tVALUE"); err != nil {
return err
}
for _, key := range orderedKeys {
val, ok := fields[key]
if !ok || val == nil {
Expand All @@ -60,7 +62,9 @@ func PrintTable(data []byte, w io.Writer, orderedKeys []string) error {
if strVal == "" {
continue
}
fmt.Fprintf(tw, "%s\t%s\n", key, strVal)
if _, err := fmt.Fprintf(tw, "%s\t%s\n", key, strVal); err != nil {
return err
}
}
return tw.Flush()
}
Loading