From 7fece7d3a48b6228f00f268ba051ee76d9151012 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Wed, 1 Aug 2018 16:30:15 -0700 Subject: [PATCH] Fix some lint errors --- arguments.go | 6 +++--- arguments_test.go | 26 +++++++++++++------------- rakefile.rb | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/arguments.go b/arguments.go index 69a771f..4cb0b28 100644 --- a/arguments.go +++ b/arguments.go @@ -29,13 +29,13 @@ type arguments struct { documentRoot string concurrency int timeout time.Duration - recursive bool excludedPattern *regexp.Regexp + recursive bool verbose bool } func getArguments(argv []string) (arguments, error) { - args, err := docopt.Parse(fmt.Sprintf(usage, defaultConcurrency), argv, true, "liche", true) + args, err := docopt.ParseArgs(fmt.Sprintf(usage, defaultConcurrency), argv, "0.1.0") if err != nil { return arguments{}, err @@ -76,8 +76,8 @@ func getArguments(argv []string) (arguments, error) { args["--document-root"].(string), int(c), time.Duration(t) * time.Second, - args["--recursive"].(bool), r, + args["--recursive"].(bool), args["--verbose"].(bool), }, nil } diff --git a/arguments_test.go b/arguments_test.go index 76c4098..d56fcce 100644 --- a/arguments_test.go +++ b/arguments_test.go @@ -15,55 +15,55 @@ func TestGetArguments(t *testing.T) { }{ { argv: []string{"file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, false, nil, false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, nil, false, false}, }, { argv: []string{"-c", "42", "file"}, - args: arguments{[]string{"file"}, "", 42, 0, false, nil, false}, + args: arguments{[]string{"file"}, "", 42, 0, nil, false, false}, }, { argv: []string{"--concurrency", "42", "file"}, - args: arguments{[]string{"file"}, "", 42, 0, false, nil, false}, + args: arguments{[]string{"file"}, "", 42, 0, nil, false, false}, }, { argv: []string{"-d", "directory", "file"}, - args: arguments{[]string{"file"}, "directory", defaultConcurrency, 0, false, nil, false}, + args: arguments{[]string{"file"}, "directory", defaultConcurrency, 0, nil, false, false}, }, { argv: []string{"--document-root", "directory", "file"}, - args: arguments{[]string{"file"}, "directory", defaultConcurrency, 0, false, nil, false}, + args: arguments{[]string{"file"}, "directory", defaultConcurrency, 0, nil, false, false}, }, { argv: []string{"-r", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, true, nil, false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, nil, true, false}, }, { argv: []string{"--recursive", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, true, nil, false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, nil, true, false}, }, { argv: []string{"-t", "42", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 42 * time.Second, false, nil, false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 42 * time.Second, nil, false, false}, }, { argv: []string{"--timeout", "42", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 42 * time.Second, false, nil, false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 42 * time.Second, nil, false, false}, }, { argv: []string{"-x", "^.*$", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, false, regexp.MustCompile(`^.*$`), false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, regexp.MustCompile(`^.*$`), false, false}, }, { argv: []string{"--exclude", "^.*$", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, false, regexp.MustCompile(`^.*$`), false}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, regexp.MustCompile(`^.*$`), false, false}, }, { argv: []string{"-v", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, false, nil, true}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, nil, false, true}, }, { argv: []string{"--verbose", "file"}, - args: arguments{[]string{"file"}, "", defaultConcurrency, 0, false, nil, true}, + args: arguments{[]string{"file"}, "", defaultConcurrency, 0, nil, false, true}, }, } { args, err := getArguments(c.argv) diff --git a/rakefile.rb b/rakefile.rb index a8ffe7e..d75e3ec 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -45,6 +45,7 @@ task :lint do sh %w[gometalinter --deadline 300s --disable gocyclo + --disable gosec --disable vetshadow --enable gofmt --enable goimports