Skip to content

Commit

Permalink
Replace gometalinter with GolangCI-Lint
Browse files Browse the repository at this point in the history
gometalinter is broken @ HEAD, and I looked into why that was. During
that process, I remembered that we took the linting scripts from
skaffold, and found that in skaffold gometalinter was replaced with
GolangCI-Lint:

GoogleContainerTools/skaffold#619

The change made linting in skaffold faster, so I figured instead of
fixing gometalinter it made more sense to remove it and replace it with
GolangCI-Lint for kaniko as well.
  • Loading branch information
Priya Wadhwa committed Sep 11, 2018
1 parent 06defa6 commit 99ab68e
Show file tree
Hide file tree
Showing 19 changed files with 466 additions and 100 deletions.
4 changes: 2 additions & 2 deletions cmd/executor/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func addKanikoOptionsFlags(cmd *cobra.Command) {
RootCmd.PersistentFlags().StringVarP(&opts.SnapshotMode, "snapshotMode", "", "full", "Change the file attributes inspected during snapshotting")
RootCmd.PersistentFlags().VarP(&opts.BuildArgs, "build-arg", "", "This flag allows you to pass in ARG values at build time. Set it repeatedly for multiple values.")
RootCmd.PersistentFlags().BoolVarP(&opts.InsecurePush, "insecure", "", false, "Push to insecure registry using plain HTTP")
RootCmd.PersistentFlags().BoolVarP(&opts.SkipTlsVerify, "skip-tls-verify", "", false, "Push to insecure registry ignoring TLS verify")
RootCmd.PersistentFlags().BoolVarP(&opts.SkipTLSVerify, "skip-tls-verify", "", false, "Push to insecure registry ignoring TLS verify")
RootCmd.PersistentFlags().StringVarP(&opts.TarPath, "tarPath", "", "", "Path to save the image in as a tarball instead of pushing")
RootCmd.PersistentFlags().BoolVarP(&opts.SingleSnapshot, "single-snapshot", "", false, "Take a single snapshot at the end of the build.")
RootCmd.PersistentFlags().BoolVarP(&opts.Reproducible, "reproducible", "", false, "Strip timestamps out of the image to make it reproducible")
Expand Down Expand Up @@ -145,7 +145,7 @@ func resolveSourceContext() error {
opts.SrcContext = opts.Bucket
}
}
// if no prefix use Google Cloud Storage as default for backwards compability
// if no prefix use Google Cloud Storage as default for backwards compatibility
contextExecutor, err := buildcontext.GetBuildContext(opts.SrcContext)
if err != nil {
return err
Expand Down
29 changes: 11 additions & 18 deletions hack/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

import argparse
import glob
import json
import mmap
import os
import re
import sys


SKIPPED_DIRS = ["Godeps", "third_party", ".git", "vendor", "examples", "testdata"]
SKIPPED_FILES = ["install_golint.sh"]

parser = argparse.ArgumentParser()
parser.add_argument("filenames", help="list of files to check, all files if unspecified", nargs='*')

Expand Down Expand Up @@ -71,7 +73,7 @@ def file_passes(filename, refs, regexs):
(data, found) = p.subn("", data, 1)

# remove shebang from the top of shell files
if extension == "sh":
elif extension == "sh":
p = regexs["shebang"]
(data, found) = p.subn("", data, 1)

Expand Down Expand Up @@ -105,17 +107,11 @@ def file_passes(filename, refs, regexs):
def file_extension(filename):
return os.path.splitext(filename)[1].split(".")[-1].lower()

skipped_dirs = ['Godeps', 'third_party', '.git', "vendor", "differs/testDirs/pipTests"]

def normalize_files(files):
newfiles = []
for pathname in files:
if any(x in pathname for x in skipped_dirs):
continue
newfiles.append(pathname)
for i, pathname in enumerate(newfiles):
for i, pathname in enumerate(files):
if not os.path.isabs(pathname):
newfiles[i] = os.path.join(args.rootdir, pathname)
newfiles.append(os.path.join(args.rootdir, pathname))
return newfiles

def get_files(extensions):
Expand All @@ -124,17 +120,14 @@ def get_files(extensions):
files = args.filenames
else:
for root, dirs, walkfiles in os.walk(args.rootdir):
# don't visit certain dirs. This is just a performance improvement
# as we would prune these later in normalize_files(). But doing it
# cuts down the amount of filesystem walking we do and cuts down
# the size of the file list
for d in skipped_dirs:
for d in SKIPPED_DIRS:
if d in dirs:
dirs.remove(d)

for name in walkfiles:
pathname = os.path.join(root, name)
files.append(pathname)
if name not in SKIPPED_FILES:
pathname = os.path.join(root, name)
files.append(pathname)

files = normalize_files(files)
outfiles = []
Expand Down
17 changes: 0 additions & 17 deletions hack/gometalinter.json

This file was deleted.

Loading

0 comments on commit 99ab68e

Please sign in to comment.