github.com/dylandreimerink/gobpfld@v0.6.1-0.20220205171531-e79c330ad608/.golangci.yml (about) 1 run: 2 skip-dirs: 3 - "cmd/examples" # Commands are not part of the library, just examples at the moment 4 - "cmd/test" 5 tests: false 6 7 linters-settings: 8 errcheck: 9 # report about not checking of errors in type assertions: `a := b.(MyStruct)`; 10 # default is false: such cases aren't reported by default. 11 check-type-assertions: true 12 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 13 # default is false: such cases aren't reported by default. 14 check-blank: true 15 16 govet: 17 # report about shadowed variables 18 check-shadowing: true 19 # Enable all analyzers 20 enable-all: true 21 22 lll: 23 # max line length, lines longer will be reported. Default is 120. 24 # '\t' is counted as 1 character by default, and can be changed with the tab-width option 25 line-length: 120 26 # tab width in spaces. Default to 1. 27 tab-width: 4 28 29 misspell: 30 # Correct spellings using locale preferences for US or UK. 31 # Default is to use a neutral variety of English. 32 # Setting locale to US will correct the British spelling of 'colour' to 'color'. 33 locale: US 34 ignore-words: [] 35 36 # We want to keep the amount of dependencies to a minimum, so we use a whitelist here. 37 # This list is not automatically mutated by the go toolchain and thus provides a manual sanity check. 38 depguard: 39 list-type: whitelist 40 include-go-root: false 41 packages: 42 - github.com/vishvananda/netlink 43 - golang.org/x/sys 44 - github.com/dylandreimerink/gobpfld 45 - github.com/alecthomas/participle/v2 46 - github.com/spf13/cobra 47 - golang.org/x/tools/cover 48 - github.com/dylandreimerink/gocovmerge 49 - github.com/dylandreimerink/tarp 50 51 linters: 52 # please, do not use `enable-all`: it's deprecated and will be removed soon. 53 # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint 54 disable-all: true 55 enable: 56 - govet # Check for common errors 57 - errcheck # Check for missing error handling 58 - staticcheck # Adds extra checks on top of govet 59 - gosimple # Check for code which can be simpeler 60 - structcheck # Check for unused struct fields 61 - varcheck # Check for unused globals and consts 62 - ineffassign # Check for ineffectual assignments 63 - deadcode # Check for dead/unreachable code 64 - bodyclose # Check for unclosed HTTP bodies (causes resource leaking) 65 - gofmt # Check for code formatting 66 - gofumpt # Is stricter than gofmt 67 - gosec # Inspects source code for security problems 68 - unconvert # Remove unnecessary type conversions 69 - misspell # Finds commonly misspelled English words in comments 70 - lll # Reports long lines 71 - revive # A maintained replacement for golint 72 - depguard # Make sure we don't accidentally dependencies 73 74 # DO NOT ENABLE 75 # unused gives lots of false positives 76 # - unused # Check for unused consts, variables, functions and types 77 # golint is depricated 78 # - golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes 79 80 issues: 81 exclude-rules: 82 # The library has a not of underscores due to copied C-style names, this will not change so code can be easily 83 # cross referenced with kernel sourcecode 84 - text: "don't use underscores in Go names" 85 linters: 86 - revive 87 88 # The library has a not of underscores due to copied C-style names, this will not change so code can be easily 89 # cross referenced with kernel sourcecode 90 - text: "don't use ALL_CAPS in Go names" 91 linters: 92 - revive 93 94 # staticcheck notes that using consts with value 0 has no effect. We know this, the code is there to convey intent 95 - path: ebpf/ 96 text: "SA4016:" 97 linters: 98 - staticcheck 99 100 # variable shadowing is a bad thing, but shadowing err happens a lot due to the nature of err check in go 101 # so just of the err variable it can be ignored 102 - text: '"err" shadows declaration' 103 linters: 104 - govet 105 106 # fieldalignment is an optimization which often is traded of for readability of a struct 107 - text: "fieldalignment:" 108 linters: 109 - govet