File: gml

package info (click to toggle)
golang-github-thejerf-suture 4.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 260 kB
  • sloc: sh: 24; makefile: 2
file content (44 lines) | stat: -rwxr-xr-x 1,469 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

# This command wraps up the gometalinter invocation in the pre-commit hook
# so it can be used by other things.

# If used in a way that the "lintclean" file is in the current working
# directory, the contents of the lintclean directory will be added to
# this invocation, allowing you to filter out specific failures.

# Rationale:
# --exclude="composite literal uses unkeyed field" \
#  jbowers: I disagree with community on this, and side with the Go
#    creators. Keyed fields are used when you expect new fields to be
#    unimportant to you, and you want to keep compiling, i.e., a new
#    option that, since you weren't using it before, probably want to
#    keep not using it. By contrast, unkeyed fields are appropriate
#    when you expect changes to the struct to really matter to you,
#    i.e., it is discovered that something MUST have a bool field added
#    or it turns out to be logically gibberish. You can't say that
#    one or the other must always be used... each has their place.
#
# -D gocyclo
#  jbowers: I consider cyclomatic complexity a bit of a crock.

if [ `which gometalinter` == "" ]; then
    echo You need to run the \"install_buildtools\" script.
    exit 1
fi

EXTRA_ARGS=

if [ -e lintclean ]; then
    EXTRA_ARGS=$(cat lintclean)
fi

golangci-lint run \
    --exclude="composite literal uses unkeyed field" \
    -j 4 \
    -D gocyclo \
    -E gosimple \
    -E staticcheck \
    -E gofmt \
    $EXTRA_ARGS \
    $*