Takahiro Suzuki | 241c10e | 2020-12-17 20:17:57 +0900 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | cd "$(dirname $0)" |
| 4 | |
| 5 | go get golang.org/x/lint/golint |
| 6 | DIRS=". tcpassembly tcpassembly/tcpreader ip4defrag reassembly macs pcapgo pcap afpacket pfring routing defrag/lcmdefrag" |
| 7 | # Add subdirectories here as we clean up golint on each. |
| 8 | for subdir in $DIRS; do |
| 9 | pushd $subdir |
| 10 | if golint | |
| 11 | grep -v CannotSetRFMon | # pcap exported error name |
| 12 | grep -v DataLost | # tcpassembly/tcpreader exported error name |
| 13 | grep .; then |
| 14 | exit 1 |
| 15 | fi |
| 16 | popd |
| 17 | done |
| 18 | |
| 19 | pushd layers |
| 20 | for file in *.go; do |
| 21 | if cat .lint_blacklist | grep -q $file; then |
| 22 | echo "Skipping lint of $file due to .lint_blacklist" |
| 23 | elif golint $file | grep .; then |
| 24 | echo "Lint error in file $file" |
| 25 | exit 1 |
| 26 | fi |
| 27 | done |
| 28 | popd |