diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4492e9f9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab diff --git a/.github/.editorconfig b/.github/.editorconfig new file mode 100644 index 00000000..0902c6ae --- /dev/null +++ b/.github/.editorconfig @@ -0,0 +1,2 @@ +[{*.yml,*.yaml}] +indent_size = 2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..5e6fe64d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,47 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + go: ["1.19", "1.20", "1.21", "1.22", "1.23"] + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: ${{ matrix.go }} + + - name: Test + run: go test -race -v ./... + + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: "1.23" + + - name: Lint + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 + with: + version: v1.63.4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1755fb84..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,39 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: Test -permissions: - contents: read -jobs: - test: - strategy: - matrix: - go-version: [1.19.x, 1.20.x, 1.21.x] - platform: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - - name: Install staticcheck - if: matrix.go-version == '1.21.x' - run: go install honnef.co/go/tools/cmd/staticcheck@latest - shell: bash - - name: Update PATH - run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - - name: Checkout code - uses: actions/checkout@v3 - - name: Fmt - if: matrix.platform != 'windows-latest' # :( - run: "diff <(gofmt -d .) <(printf '')" - shell: bash - - name: Vet - run: go vet ./... - - name: Staticcheck - if: matrix.go-version == '1.21.x' - run: staticcheck ./... - - name: Test - run: go test -race ./... diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000..2efd235c --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,13 @@ +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/spf13/viper) + +linters: + disable-all: true + enable: + - gofmt + # - gofumpt + - staticcheck