forked from jobtome-labs/ci-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-go.yml
44 lines (38 loc) · 1018 Bytes
/
lint-go.yml
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
lint:go:
stage: lint
image: gadiener/golint-reviewdog:v1.0.0
variables:
GITLAB_API: ${CI_API_V4_URL}
script:
- |
echo
echo "-> Linting Go files:"
echo
if [ -z "${LINT_PATH}" ]; then
LINT_PATH="./..."
fi
if [ "${ENABLE_REVIEWDOG}" = "1" ]; then
echo
echo "-> Enabled Review Dog!"
echo
if [ -z "${REVIEWDOG_GITLAB_API_TOKEN}" ]; then
echo
echo "-> [WARNING] Missing 'REVIEWDOG_GITLAB_API_TOKEN' variable!"
echo
exit 1
fi
if [ -z "${REVIEWDOG_LEVEL}" ]; then
REVIEWDOG_LEVEL="warning"
fi
golint "${LINT_PATH}" | reviewdog -name="Go Linter" \
-f=golint -diff="git diff master" -reporter=gitlab-mr-discussion -level="${REVIEWDOG_LEVEL}"
else
golint "${LINT_PATH}"
fi
echo
echo "-> Go files checked!"
echo
except:
variables:
- $SKIP_CI_LINT == "true"
- $CI_FAST_TRACK == "true"