diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index fa1cd085..07a05715 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -9,13 +9,19 @@ on: branches: - master jobs: - golangci-lint: + go-lint: name: Lint Go code runs-on: ubuntu-latest steps: - name: Install taglib run: sudo apt-get install libtag1-dev + - name: Set up Go 1.17 + uses: actions/setup-go@v2 + with: + go-version: 1.17 + id: go + - uses: actions/checkout@v2 - name: golangci-lint @@ -25,6 +31,18 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} args: --timeout 2m + - name: Install goimports + run: go install golang.org/x/tools/cmd/goimports + + - run: goimports -w `find . -name '*.go' | grep -v '_gen.go$'` + - run: go mod tidy + - name: Verify no changes from goimports and go mod tidy + run: | + git status --porcelain + if [ -n "$(git status --porcelain)" ]; then + exit 1 + fi + go: name: Test with Go ${{ matrix.go_version }} runs-on: ubuntu-latest @@ -61,6 +79,7 @@ jobs: - name: Test continue-on-error: ${{contains(matrix.go_version, 'beta') || contains(matrix.go_version, 'rc')}} run: go test -cover ./... -v + js: name: Build JS bundle runs-on: ubuntu-latest @@ -102,7 +121,7 @@ jobs: binaries: name: Build binaries - needs: [js, go, golangci-lint] + needs: [js, go, go-lint] runs-on: ubuntu-latest steps: - name: Checkout Code diff --git a/cmd/signaler_unix.go b/cmd/signaler_unix.go index 919dc5bf..541c998b 100644 --- a/cmd/signaler_unix.go +++ b/cmd/signaler_unix.go @@ -1,5 +1,5 @@ -// +build !windows -// +build !plan9 +//go:build !windows && !plan9 +// +build !windows,!plan9 package cmd diff --git a/go.sum b/go.sum index cde76171..7665bbe2 100644 --- a/go.sum +++ b/go.sum @@ -277,7 +277,6 @@ github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4 github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/goccy/go-json v0.7.6 h1:H0wq4jppBQ+9222sk5+hPLL25abZQiRuQ6YPnjO9c+A= github.com/goccy/go-json v0.7.6/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.7.8 h1:CvMH7LotYymYuLGEohBM1lTZWX4g6jzWUUl2aLFuBoE= github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= @@ -557,7 +556,6 @@ github.com/lestrrat-go/httpcc v1.0.0 h1:FszVC6cKfDvBKcJv646+lkh4GydQg2Z29scgUfkO github.com/lestrrat-go/httpcc v1.0.0/go.mod h1:tGS/u00Vh5N6FHNkExqGGNId8e0Big+++0Gf8MBnAvE= github.com/lestrrat-go/iter v1.0.1 h1:q8faalr2dY6o8bV45uwrxq12bRa1ezKrB6oM9FUgN4A= github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/jwx v1.2.6 h1:XAgfuHaOB7fDZ/6WhVgl8K89af768dU+3Nx4DlTbLIk= github.com/lestrrat-go/jwx v1.2.6/go.mod h1:tJuGuAI3LC71IicTx82Mz1n3w9woAs2bYJZpkjJQ5aU= github.com/lestrrat-go/jwx v1.2.7 h1:wO7fEc3PW56wpQBMU5CyRkrk4DVsXxCoJg7oIm5HHE4= github.com/lestrrat-go/jwx v1.2.7/go.mod h1:bw24IXWbavc0R2RsOtpXL7RtMyP589yZ1+L7kd09ZGA= diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.go index cfcfe8ff..4ac52d51 100644 --- a/server/subsonic/responses/responses_test.go +++ b/server/subsonic/responses/responses_test.go @@ -1,4 +1,5 @@ -//+build linux darwin +//go:build linux || darwin +// +build linux darwin // TODO Fix snapshot tests in Windows // Response Snapshot tests. Only run in Linux and macOS, as they fail in Windows diff --git a/server/subsonic/wire_injectors.go b/server/subsonic/wire_injectors.go index 75a6c82d..f865aaa3 100644 --- a/server/subsonic/wire_injectors.go +++ b/server/subsonic/wire_injectors.go @@ -1,4 +1,5 @@ -//+build wireinject +//go:build wireinject +// +build wireinject package subsonic diff --git a/tools.go b/tools.go index ef4a35d6..b4305c0e 100644 --- a/tools.go +++ b/tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package main