From bd88ca2b5a9aba4983827aaa3f800b50b6b68d3d Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sun, 12 May 2024 13:21:27 +0200 Subject: [PATCH] feat: add go linting --- .github/workflows/lint.yml | 27 +++++++++++++++++++++++++++ .github/workflows/test.yml | 12 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6d0663a7..cdef83d4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,3 +12,30 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --check . + + go: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.22 + - name: Check linting + run: go vet ./... + working-directory: ./tests/go + - name: Check tests + run: go test ./... + working-directory: ./tests/go + - name: Check imports + run: | + go install github.com/daixiang0/gci@latest + gci diff --skip-generated -s standard -s default --skip-vendor . + working-directory: ./tests/go + - name: Check golines + run: | + go install mvdan.cc/gofumpt@latest + go install github.com/segmentio/golines@latest + golines --base-formatter=gofumpt --ignore-generated --tab-len=1 --max-len=120 . + working-directory: ./tests/go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d76b68c4..c7704f39 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,3 +23,15 @@ jobs: ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start - name: Run tests run: nvim --headless -c "PlenaryBustedDirectory test {minimal_init = 'tests/minimal_init.lua', sequential = true}" + go: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.22 + - name: Check tests + run: go test ./... + working-directory: ./tests/go