diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 12ee94e..dd3892f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,35 +8,6 @@ on: pull_request: branches: [ "*" ] jobs: - go-mod-tidy: - name: "Lint Go Modules" - runs-on: "ubuntu-latest" - steps: - - uses: "actions/checkout@v3" - - uses: "actions/setup-go@v3" - with: - go-version: "^1.18" - - name: "Run `go mod tidy`" - run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'" - - go-fmt: - name: "Format Go" - runs-on: "ubuntu-latest" - steps: - - uses: "actions/checkout@v3" - - uses: "actions/setup-go@v3" - with: - go-version: "^1.18" - - name: "Install gofumpt" - run: "go install mvdan.cc/gofumpt@latest" - - name: "Run `gofumpt`" - run: | - GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | xargs gofumpt -d)" - if [ -n "$GOFUMPT_OUTPUT" ]; then - echo "The following files are not correctly formatted:" - echo "${GOFUMPT_OUTPUT}" - exit 1 - fi go-lint: name: "Lint Go" runs-on: "ubuntu-latest" @@ -45,11 +16,10 @@ jobs: - uses: "actions/setup-go@v3" with: go-version: "^1.18" - - uses: "golangci/golangci-lint-action@v3" - with: - version: "v1.45.2" - skip-pkg-cache: true - skip-build-cache: false + - uses: "authzed/actions/gofumpt@main" + - uses: "authzed/actions/go-mod-tidy@main" + - uses: "authzed/actions/go-generate@main" + - uses: "authzed/actions/golangci-lint@main" codeql: name: "Analyze with CodeQL" @@ -64,8 +34,4 @@ jobs: language: [ "go" ] steps: - uses: "actions/checkout@v3" - - uses: "github/codeql-action/init@v1" - with: - languages: "${{ matrix.language }}" - - uses: "github/codeql-action/autobuild@v1" - - uses: "github/codeql-action/analyze@v1" \ No newline at end of file + - uses: "authzed/actions/codeql@main" \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml index b644552..31cbeb7 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -6,6 +6,9 @@ output: linters-settings: goimports: local-prefixes: "sot-te.ch/mochi" + staticcheck: + checks: + - "all" gosec: excludes: - "G404" # Allow the usage of math/rand diff --git a/frontend/frontend.go b/frontend/frontend.go index f0992a2..1d95cc9 100644 --- a/frontend/frontend.go +++ b/frontend/frontend.go @@ -1,3 +1,5 @@ +// Package frontend defines interface which should satisfy +// every network frontend package frontend import ( diff --git a/frontend/udp/bytepool/bytepool.go b/frontend/udp/bytepool/bytepool.go index 78453d2..8482803 100644 --- a/frontend/udp/bytepool/bytepool.go +++ b/frontend/udp/bytepool/bytepool.go @@ -1,3 +1,4 @@ +// Package bytepool defines pool for storing and reusing raw bytes package bytepool import "sync" diff --git a/middleware/torrentapproval/container/container.go b/middleware/torrentapproval/container/container.go index 810742f..af648ba 100644 --- a/middleware/torrentapproval/container/container.go +++ b/middleware/torrentapproval/container/container.go @@ -1,3 +1,5 @@ +// Package container contains interface and register +// used for torrent approval hash source package container import ( diff --git a/middleware/varinterval/varinterval.go b/middleware/varinterval/varinterval.go index 611c208..9dd530f 100644 --- a/middleware/varinterval/varinterval.go +++ b/middleware/varinterval/varinterval.go @@ -1,3 +1,4 @@ +// Package varinterval contains interval variation middleware package varinterval import ( diff --git a/storage/prometheus.go b/storage/prometheus.go index 210a8d1..1b7be7a 100644 --- a/storage/prometheus.go +++ b/storage/prometheus.go @@ -1,3 +1,4 @@ +// Package storage contains prometheus specific globals, used by storages package storage import "github.com/prometheus/client_golang/prometheus" diff --git a/storage/storage.go b/storage/storage.go index 219bbe3..98c82f6 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -1,3 +1,5 @@ +// Package storage contains interfaces and register of storage provider and +// interface which should satisfy tracker storage package storage import ( diff --git a/storage/test/storage_bench.go b/storage/test/storage_bench.go index 0efce33..2c1a93d 100644 --- a/storage/test/storage_bench.go +++ b/storage/test/storage_bench.go @@ -1,3 +1,5 @@ +// Package test contains storage benchmarks. +// Not used in production. package test import ( diff --git a/storage/test/storage_test_base.go b/storage/test/storage_test_base.go index b533dbd..bb6b936 100644 --- a/storage/test/storage_test_base.go +++ b/storage/test/storage_test_base.go @@ -1,3 +1,5 @@ +// Package test contains storage tests. +// Not used in production. package test import ( diff --git a/storage/test/storage_test_data.go b/storage/test/storage_test_data.go index c2a2611..38ed925 100644 --- a/storage/test/storage_test_data.go +++ b/storage/test/storage_test_data.go @@ -1,3 +1,5 @@ +// Package test contains generated data for storage tests. +// Not used in production. package test import (