/ .golangci.yml
.golangci.yml
  1  # options for analysis running
  2  run:
  3    # default concurrency is a available CPU number
  4    concurrency: 1
  5  
  6    # timeout for analysis, e.g. 30s, 5m, default is 1m
  7    deadline: 5m
  8  
  9    # exit code when at least one issue was found, default is 1
 10    issues-exit-code: 1
 11  
 12    # include test files or not, default is true
 13    tests: true
 14  
 15    # which files to skip: they will be analyzed, but issues from them
 16    # won't be reported. Default value is empty list, but there is
 17    # no need to include all autogenerated files, we confidently recognize
 18    # autogenerated files. If it's not please let us know.
 19    skip-files:
 20  
 21  issues:
 22    # Independently from option `exclude` we use default exclude patterns,
 23    # it can be disabled by this option. To list all
 24    # excluded by default patterns execute `golangci-lint run --help`.
 25    # Default value for this option is true.
 26    exclude-use-default: false
 27  
 28  # output configuration options
 29  output:
 30    # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
 31    format: colored-line-number
 32  
 33    # print lines of code with issue, default is true
 34    print-issued-lines: true
 35  
 36    # print linter name in the end of issue text, default is true
 37    print-linter-name: true
 38  
 39  # all available settings of specific linters
 40  linters-settings:
 41    govet:
 42      # report about shadowed variables
 43      check-shadowing: true
 44    golint:
 45      # minimal confidence for issues, default is 0.8
 46      min-confidence: 0.8
 47    gofmt:
 48      # simplify code: gofmt with `-s` option, true by default
 49      simplify: true
 50    errcheck:
 51      # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
 52      # default is false: such cases aren't reported by default.
 53      check-type-assertions: true
 54      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
 55      # default is false: such cases aren't reported by default.
 56      check-blank: false
 57    gocyclo:
 58      # minimal code complexity to report, 30 by default (but we recommend 10-20)
 59      min-complexity: 20
 60    misspell:
 61      # Correct spellings using locale preferences for US or UK.
 62      # Default is to use a neutral variety of English.
 63      # Setting locale to US will correct the British spelling of 'colour' to 'color'.
 64      locale: US
 65    unused:
 66      # treat code as a program (not a library) and report unused exported identifiers; default is false.
 67      # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
 68      # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
 69      # with golangci-lint call it on a directory with the changed file.
 70      check-exported: false
 71    unparam:
 72      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
 73      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
 74      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
 75      # with golangci-lint call it on a directory with the changed file.
 76      check-exported: false
 77    nakedret:
 78      # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
 79      max-func-lines: 30
 80      prealloc:
 81        # XXX: we don't recommend using this linter before doing performance profiling.
 82        # For most programs usage of prealloc will be a premature optimization.
 83  
 84        # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
 85        # True by default.
 86        simple: true
 87        range-loops: true # Report preallocation suggestions on range loops, true by default
 88        for-loops: false # Report preallocation suggestions on for loops, false by default
 89  
 90  linters:
 91    disable-all: true
 92    enable:
 93      - megacheck
 94      - nakedret
 95      - unparam
 96      - unused
 97      - govet
 98      - golint
 99      - gofmt
100      - errcheck
101      - gocyclo
102      - ineffassign
103      - deadcode
104      - goimports
105    fast: false