From b3e15cc8438952e56183d9775a9ea0d25707937b Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Thu, 27 Jan 2022 09:50:37 -0700 Subject: [PATCH 1/2] pre-commit: add configuration --- .gitignore | 1 + .pre-commit-config.yaml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index ec61c09..69edebe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea *.yaml +!.pre-commit-config.yaml !example-config.yaml *.session diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..abb3979 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: trailing-whitespace + exclude_types: [markdown] + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + + - repo: https://github.com/tekwizely/pre-commit-golang + rev: v1.0.0-beta.5 + hooks: + - id: go-imports-repo From 3a4b11895684f2ebea327d3bf6026299d635aecf Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Thu, 27 Jan 2022 09:52:00 -0700 Subject: [PATCH 2/2] ci: add go workflow --- .github/workflows/go.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..d95f655 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,29 @@ +name: Go + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go-version: [1.17] + steps: + - uses: actions/checkout@v2 + + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Install goimports + run: | + go install golang.org/x/tools/cmd/goimports@latest + export PATH="$HOME/go/bin:$PATH" + + - name: Install pre-commit + run: pip install pre-commit + + - name: Lint + run: pre-commit run -a