Skip to content

Commit b83d021

Browse files
ferhatelmasLinkinStars
authored andcommitted
feat(ci): add lint action
related to #1432 Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
1 parent 5be6ec9 commit b83d021

File tree

5 files changed

+90
-28
lines changed

5 files changed

+90
-28
lines changed

.github/workflows/lint.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Lint
19+
20+
on:
21+
push:
22+
pull_request:
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
lint:
30+
name: Lint (${{ matrix.os }})
31+
runs-on: ${{ matrix.os }}
32+
timeout-minutes: 15
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [ubuntu-latest]
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Setup Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: "1.23"
46+
cache: true
47+
48+
- name: Run go mod tidy
49+
run: go mod tidy
50+
51+
- name: Run golangci-lint
52+
run: make lint
53+
54+
- name: Check for uncommitted changes
55+
shell: bash
56+
run: |
57+
if [ -n "$(git status --porcelain)" ]; then
58+
echo "::error::Uncommitted changes detected"
59+
git status
60+
git diff
61+
exit 1
62+
fi

cmd/wire_gen.go

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ require (
3737
github.com/grokify/html-strip-tags-go v0.1.0
3838
github.com/jinzhu/copier v0.4.0
3939
github.com/jinzhu/now v1.1.5
40+
github.com/joho/godotenv v1.5.1
4041
github.com/lib/pq v1.10.9
4142
github.com/microcosm-cc/bluemonday v1.0.27
4243
github.com/mozillazg/go-pinyin v0.20.0
@@ -117,7 +118,6 @@ require (
117118
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
118119
github.com/hashicorp/hcl v1.0.0 // indirect
119120
github.com/inconshreveable/mousetrap v1.1.0 // indirect
120-
github.com/joho/godotenv v1.5.1 // indirect
121121
github.com/josharian/intern v1.0.0 // indirect
122122
github.com/json-iterator/go v1.1.12 // indirect
123123
github.com/klauspost/cpuid/v2 v2.2.8 // indirect

internal/base/translator/provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,15 @@ func inspectTranslatorNode(node any, path []string, isRoot bool) error {
242242
return nil
243243
case []any:
244244
for idx, child := range data {
245-
nextPath := append(path, fmt.Sprintf("[%d]", idx))
245+
nextPath := append(path, fmt.Sprintf("[%d]", idx)) //nolint: gocritic
246246
if err := inspectTranslatorNode(child, nextPath, false); err != nil {
247247
return err
248248
}
249249
}
250250
return nil
251251
case []map[string]any:
252252
for idx, child := range data {
253-
nextPath := append(path, fmt.Sprintf("[%d]", idx))
253+
nextPath := append(path, fmt.Sprintf("[%d]", idx)) //nolint: gocritic
254254
if err := inspectTranslatorNode(child, nextPath, false); err != nil {
255255
return err
256256
}

script/check-asf-header.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ else
2626
exit 1
2727
fi
2828

29-
$CONTAINER_RUNTIME run -it --rm -v "$(pwd)":/github/workspace ghcr.io/korandoru/hawkeye-native format
29+
$CONTAINER_RUNTIME run --rm -v "$(pwd)":/github/workspace ghcr.io/korandoru/hawkeye-native format
3030

3131
gofmt -w -l .

0 commit comments

Comments
 (0)