Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

init/linter: add linter to github workflow jobs #49

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,25 @@ jobs:
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: KaymeKaydex/go-vshard-router
slug: KaymeKaydex/go-vshard-router

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2

- uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
continue-on-error: true
with:
# The first run is for GitHub Actions error format.
args: --config=.golangci.yaml

- name: golangci-lint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never worked with GitHub actions before, but I guess we should run the second iteration only if the first has failed.

https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f

uses: golangci/golangci-lint-action@v3
with:
# The second run is for human-readable error format with a file name
# and a line number.
args: --out-${NO_FUTURE}format colored-line-number --config=.golangci.yaml
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ FEATURES:

* Added etcd v2 topology provider implementation (#16)
* Add TopologyController mock for testing improve
* Add linter job (#33)

REFACTOR:

* Refactored docs (add QuickStart doc) and that library base on vhsard router
* Several linters are enabled because they are usefull
* Ignore .tmp files
* Refactored provider creation test caused by golang-ci lint (#33)



Expand Down
3 changes: 2 additions & 1 deletion providers/static/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func TestNewProvider(t *testing.T) {

for _, tc := range tCases {
t.Run("provider", func(t *testing.T) {
if tc.Source == nil || len(tc.Source) == 0 {
if len(tc.Source) == 0 {

require.Panics(t, func() {
NewProvider(tc.Source)
})
Expand Down
Loading