github.com/elliots/golangci-lint@v1.10.1/.golangci.example.yml (about) 1 # This file contains all available configuration options 2 # with their default values. 3 4 # options for analysis running 5 run: 6 # default concurrency is a available CPU number 7 concurrency: 4 8 9 # timeout for analysis, e.g. 30s, 5m, default is 1m 10 deadline: 1m 11 12 # exit code when at least one issue was found, default is 1 13 issues-exit-code: 1 14 15 # include test files or not, default is true 16 tests: true 17 18 # list of build tags, all linters use it. Default is empty list. 19 build-tags: 20 - mytag 21 22 # which dirs to skip: they won't be analyzed; 23 # can use regexp here: generated.*, regexp is applied on full path; 24 # default value is empty list, but next dirs are always skipped independently 25 # from this option's value: 26 # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ 27 skip-dirs: 28 - src/external_libs 29 - autogenerated_by_my_lib 30 31 # which files to skip: they will be analyzed, but issues from them 32 # won't be reported. Default value is empty list, but there is 33 # no need to include all autogenerated files, we confidently recognize 34 # autogenerated files. If it's not please let us know. 35 skip-files: 36 - ".*\\.my\\.go$" 37 - lib/bad.go 38 39 40 # output configuration options 41 output: 42 # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" 43 format: colored-line-number 44 45 # print lines of code with issue, default is true 46 print-issued-lines: true 47 48 # print linter name in the end of issue text, default is true 49 print-linter-name: true 50 51 52 # all available settings of specific linters 53 linters-settings: 54 errcheck: 55 # report about not checking of errors in type assetions: `a := b.(MyStruct)`; 56 # default is false: such cases aren't reported by default. 57 check-type-assertions: false 58 59 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 60 # default is false: such cases aren't reported by default. 61 check-blank: false 62 govet: 63 # report about shadowed variables 64 check-shadowing: true 65 66 # Obtain type information from installed (to $GOPATH/pkg) package files: 67 # golangci-lint will execute `go install -i` and `go test -i` for analyzed packages 68 # before analyzing them. 69 # By default this option is disabled and govet gets type information by loader from source code. 70 # Loading from source code is slow, but it's done only once for all linters. 71 # Go-installing of packages first time is much slower than loading them from source code, 72 # therefore this option is disabled by default. 73 # But repeated installation is fast in go >= 1.10 because of build caching. 74 # Enable this option only if all conditions are met: 75 # 1. you use only "fast" linters (--fast e.g.): no program loading occurs 76 # 2. you use go >= 1.10 77 # 3. you do repeated runs (false for CI) or cache $GOPATH/pkg or `go env GOCACHE` dir in CI. 78 use-installed-packages: false 79 golint: 80 # minimal confidence for issues, default is 0.8 81 min-confidence: 0.8 82 gofmt: 83 # simplify code: gofmt with `-s` option, true by default 84 simplify: true 85 gocyclo: 86 # minimal code complexity to report, 30 by default (but we recommend 10-20) 87 min-complexity: 10 88 maligned: 89 # print struct with more effective memory layout or not, false by default 90 suggest-new: true 91 dupl: 92 # tokens count to trigger issue, 150 by default 93 threshold: 100 94 goconst: 95 # minimal length of string constant, 3 by default 96 min-len: 3 97 # minimal occurrences count to trigger, 3 by default 98 min-occurrences: 3 99 depguard: 100 list-type: blacklist 101 include-go-root: false 102 packages: 103 - github.com/davecgh/go-spew/spew 104 misspell: 105 # Correct spellings using locale preferences for US or UK. 106 # Default is to use a neutral variety of English. 107 # Setting locale to US will correct the British spelling of 'colour' to 'color'. 108 locale: US 109 lll: 110 # max line length, lines longer will be reported. Default is 120. 111 # '\t' is counted as 1 character by default, and can be changed with the tab-width option 112 line-length: 120 113 # tab width in spaces. Default to 1. 114 tab-width: 1 115 unused: 116 # treat code as a program (not a library) and report unused exported identifiers; default is false. 117 # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: 118 # if it's called for subdir of a project it can't find funcs usages. All text editor integrations 119 # with golangci-lint call it on a directory with the changed file. 120 check-exported: false 121 unparam: 122 # call graph construction algorithm (cha, rta). In general, use cha for libraries, 123 # and rta for programs with main packages. Default is cha. 124 algo: cha 125 126 # Inspect exported functions, default is false. Set to true if no external program/library imports your code. 127 # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: 128 # if it's called for subdir of a project it can't find external interfaces. All text editor integrations 129 # with golangci-lint call it on a directory with the changed file. 130 check-exported: false 131 nakedret: 132 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 133 max-func-lines: 30 134 prealloc: 135 # XXX: we don't recommend using this linter before doing performance profiling. 136 # For most programs usage of prealloc will be a premature optimization. 137 138 # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. 139 # True by default. 140 simple: true 141 range-loops: true # Report preallocation suggestions on range loops, true by default 142 for-loops: false # Report preallocation suggestions on for loops, false by default 143 144 145 linters: 146 enable: 147 - megacheck 148 - govet 149 enable-all: false 150 disable: 151 - maligned 152 - prealloc 153 disable-all: false 154 presets: 155 - bugs 156 - unused 157 fast: false 158 159 160 issues: 161 # List of regexps of issue texts to exclude, empty list by default. 162 # But independently from this option we use default exclude patterns, 163 # it can be disabled by `exclude-use-default: false`. To list all 164 # excluded by default patterns execute `golangci-lint run --help` 165 exclude: 166 - abcdef 167 168 # Independently from option `exclude` we use default exclude patterns, 169 # it can be disabled by this option. To list all 170 # excluded by default patterns execute `golangci-lint run --help`. 171 # Default value for this option is true. 172 exclude-use-default: false 173 174 # Maximum issues count per one linter. Set to 0 to disable. Default is 50. 175 max-per-linter: 0 176 177 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. 178 max-same: 0 179 180 # Show only new issues: if there are unstaged changes or untracked files, 181 # only those changes are analyzed, else only changes in HEAD~ are analyzed. 182 # It's a super-useful option for integration of golangci-lint into existing 183 # large codebase. It's not practical to fix all existing issues at the moment 184 # of integration: much better don't allow issues in new code. 185 # Default is false. 186 new: false 187 188 # Show only new issues created after git revision `REV` 189 new-from-rev: REV 190 191 # Show only new issues created in git patch with set file path. 192 new-from-patch: path/to/patch/file