-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run 'lint-install', Address golangci-lint errors #100
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
# NOTE: This file is populated by the lint-install tool. Local adjustments may be overwritten. | ||
linters-settings: | ||
cyclop: | ||
# NOTE: This is a very high transitional threshold | ||
max-complexity: 37 | ||
package-average: 34.0 | ||
skip-tests: true | ||
|
||
gocognit: | ||
# NOTE: This is a very high transitional threshold | ||
min-complexity: 98 | ||
|
||
dupl: | ||
threshold: 200 | ||
|
||
goconst: | ||
min-len: 4 | ||
min-occurrences: 5 | ||
ignore-tests: true | ||
|
||
errorlint: | ||
# these are still common in Go: for instance, exit errors. | ||
asserts: false | ||
|
||
exhaustive: | ||
default-signifies-exhaustive: true | ||
|
||
nestif: | ||
min-complexity: 8 | ||
|
||
nolintlint: | ||
require-explanation: true | ||
allow-unused: false | ||
require-specific: true | ||
|
||
revive: | ||
ignore-generated-header: true | ||
severity: warning | ||
rules: | ||
- name: atomic | ||
- name: blank-imports | ||
- name: bool-literal-in-expr | ||
- name: confusing-naming | ||
- name: constant-logical-expr | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: deep-exit | ||
- name: defer | ||
- name: range-val-in-closure | ||
- name: range-val-address | ||
- name: dot-imports | ||
- name: error-naming | ||
- name: error-return | ||
- name: error-strings | ||
- name: errorf | ||
- name: exported | ||
- name: identical-branches | ||
- name: if-return | ||
- name: import-shadowing | ||
- name: increment-decrement | ||
- name: indent-error-flow | ||
- name: indent-error-flow | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: redefines-builtin-id | ||
- name: superfluous-else | ||
- name: struct-tag | ||
- name: time-naming | ||
- name: unexported-naming | ||
- name: unexported-return | ||
- name: unnecessary-stmt | ||
- name: unreachable-code | ||
- name: unused-parameter | ||
- name: var-declaration | ||
- name: var-naming | ||
- name: unconditional-recursion | ||
- name: waitgroup-by-value | ||
|
||
staticcheck: | ||
go: "1.16" | ||
|
||
unused: | ||
go: "1.16" | ||
|
||
output: | ||
sort-results: true | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- cyclop | ||
- deadcode | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
# errname is only available in golangci-lint v1.42.0+ - wait until v1.43 is available to settle | ||
#- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forcetypeassert | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- godot | ||
- gofmt | ||
- goheader | ||
- goimports | ||
- goprintffuncname | ||
- gosimple | ||
- govet | ||
- ifshort | ||
- importas | ||
- ineffassign | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- noctx | ||
- nolintlint | ||
- predeclared | ||
# disabling for the initial iteration of the linting tool | ||
#- promlinter | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- wastedassign | ||
- whitespace | ||
|
||
# Disabled linters, due to being misaligned with Go practices | ||
# - exhaustivestruct | ||
# - gochecknoglobals | ||
# - gochecknoinits | ||
# - goconst | ||
# - godox | ||
# - goerr113 | ||
# - gomnd | ||
# - lll | ||
# - nlreturn | ||
# - testpackage | ||
# - wsl | ||
# Disabled linters, due to not being relevant to our code base: | ||
# - maligned | ||
# - prealloc "For most programs usage of prealloc will be a premature optimization." | ||
# Disabled linters due to bad error messages or bugs | ||
# - gofumpt | ||
# - gosec | ||
# - tagliatelle | ||
|
||
issues: | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gocyclo | ||
- errcheck | ||
- dupl | ||
- gosec | ||
|
||
- path: cmd.* | ||
linters: | ||
- noctx | ||
|
||
- path: main\.go | ||
linters: | ||
- noctx | ||
|
||
- path: cmd.* | ||
text: "deep-exit" | ||
|
||
- path: main\.go | ||
text: "deep-exit" | ||
|
||
# This check is of questionable value | ||
- linters: | ||
- tparallel | ||
text: "call t.Parallel on the top level as well as its subtests" | ||
|
||
# Don't hide lint issues just because there are many of them | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
# BEGIN: lint-install ../sandbox | ||
# http://github.com/tinkerbell/lint-install | ||
|
||
GOLINT_VERSION ?= v1.42.0 | ||
|
||
SHELLCHECK_VERSION ?= v0.7.2 | ||
LINT_OS := $(shell uname) | ||
LINT_ARCH := $(shell uname -m) | ||
LINT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
# shellcheck and hadolint lack arm64 native binaries: rely on x86-64 emulation | ||
ifeq ($(LINT_OS),Darwin) | ||
ifeq ($(LINT_ARCH),arm64) | ||
LINT_ARCH=x86_64 | ||
endif | ||
endif | ||
|
||
LINT_LOWER_OS = $(shell echo $(LINT_OS) | tr '[:upper:]' '[:lower:]') | ||
GOLINT_CONFIG:=$(LINT_ROOT)/.golangci.yml | ||
|
||
lint: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) | ||
find . -name go.mod | xargs -n1 dirname | xargs -n1 -I{} sh -c "cd {} && $(LINT_ROOT)/out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run -c $(GOLINT_CONFIG)" | ||
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck $(shell find . -name "*.sh") | ||
|
||
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck: | ||
mkdir -p out/linters | ||
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/shellcheck-$(SHELLCHECK_VERSION).$(LINT_LOWER_OS).$(LINT_ARCH).tar.xz | tar -C out/linters -xJf - | ||
mv out/linters/shellcheck-$(SHELLCHECK_VERSION) out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH) | ||
|
||
out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH): | ||
mkdir -p out/linters | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b out/linters $(GOLINT_VERSION) | ||
mv out/linters/golangci-lint out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) | ||
|
||
# END: lint-install ../sandbox |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,5 +151,4 @@ func getImageTagFromRepo(repoName string) (string, error) { | |
} | ||
|
||
return tag, nil | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,23 @@ module github.com/tinkerbell/sandbox | |
go 1.15 | ||
|
||
require ( | ||
github.com/containerd/containerd v1.4.1 // indirect | ||
github.com/containers/image v3.0.2+incompatible | ||
github.com/containers/image/v5 v5.10.5 | ||
github.com/gianarb/vagrant-go v0.0.0-20200902133321-62ba563fe383 | ||
github.com/docker/docker v17.12.0-ce-rc1.0.20200916142827-bd33bbf0497b+incompatible // indirect | ||
github.com/go-git/go-git/v5 v5.2.0 | ||
github.com/golang/protobuf v1.4.2 // indirect | ||
github.com/google/go-cmp v0.5.2 // indirect | ||
github.com/joho/godotenv v1.3.0 | ||
github.com/pkg/errors v0.9.1 | ||
github.com/tinkerbell/tink v0.0.0-20210315140655-1b178daeaeda | ||
github.com/prometheus/client_golang v1.3.0 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/github.com/prometheus/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/github.com/prometheus/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
go.opencensus.io v0.22.2 // indirect | ||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/golang.org/x/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/golang.org/x/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect | ||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect | ||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | ||
google.golang.org/genproto v0.0.0-20201026171402-d4b8fe4fd877 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
google.golang.org/grpc v1.32.0 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
google.golang.org/protobuf v1.25.0 // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical OSS Vulnerability: pkg:golang/golang.org/x/[email protected]5 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] CRITICAL Vulnerabilities (5)CVE-2018-17143
CVE-2018-17848
CVE-2018-17847
CVE-2018-17142
CVE-2018-17846
(at-me in a reply with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Severe OSS Vulnerability: pkg:golang/golang.org/x/[email protected]0 Critical, 1 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/google.golang.org/[email protected] SEVERE Vulnerabilities (1)
(at-me in a reply with |
||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical OSS Vulnerability:
pkg:golang/github.com/gogo/[email protected]
1 Critical, 0 Severe, 0 Moderate and 0 Unknown vulnerabilities have been found in a transitive dependency of pkg:golang/github.com/prometheus/[email protected]
CRITICAL Vulnerabilities (1)
(at-me in a reply with
help
orignore
)