Skip to content

Commit

Permalink
ci: Improve Golang code quality with updated lint configuration file (#…
Browse files Browse the repository at this point in the history
…307)

* refactor: Optimize code logic and reduce nesting.

* ci: Improve Golang code quality with updated configuration file

* chore: Update GitHub actions setup-go to version 5 and optimize caching.
  • Loading branch information
moonD4rk committed Apr 12, 2024
1 parent 2f22fa7 commit 7bd5a06
Show file tree
Hide file tree
Showing 6 changed files with 333 additions and 36 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,24 @@ jobs:
goVer: ["1.21.x"]

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.goVer }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goVer }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: cache go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Format Check
if: matrix.os != 'windows-latest'
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Golang
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
- name: Checkout code
uses: actions/checkout@v4

- name: Check spelling with custom config file
uses: crate-ci/typos@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v4

- name: Use Golang
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21.x"

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
if: success()
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4

- name: Run tests
run: go test -v ./... -covermode=count

Expand All @@ -29,7 +31,7 @@ jobs:
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
- name: Checkout code
Expand Down
Loading

0 comments on commit 7bd5a06

Please sign in to comment.