From 56ac5b678a07abc1be1357201156872b6daac89c Mon Sep 17 00:00:00 2001 From: Justinas Stankevicius Date: Sat, 6 Apr 2024 21:00:06 +0300 Subject: [PATCH] Add GitHub Actions, fix a lint --- .github/workflows/lint.yaml | 21 +++++++++++++++++++++ .github/workflows/test.yaml | 21 +++++++++++++++++++++ chain_test.go | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..9f6dc60 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,21 @@ +name: Lint +on: [push, pull_request] +jobs: + lint: + strategy: + matrix: + go: + - stable + - oldstable + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go }} + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..b1698dc --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,21 @@ +name: Test +on: [push, pull_request] +jobs: + lint: + strategy: + matrix: + go: + - stable + - oldstable + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go }} + + - name: Run tests + run: go test -v ./... diff --git a/chain_test.go b/chain_test.go index 6f4316b..c486553 100644 --- a/chain_test.go +++ b/chain_test.go @@ -14,7 +14,7 @@ import ( func tagMiddleware(tag string) Constructor { return func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(tag)) + _, _ = w.Write([]byte(tag)) h.ServeHTTP(w, r) }) } @@ -29,7 +29,7 @@ func funcsEqual(f1, f2 interface{}) bool { } var testApp = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("app\n")) + _, _ = w.Write([]byte("app\n")) }) func TestNew(t *testing.T) {