Add staticcheck and go-generate Github check (#968)

* Fix Staticcheck errors & minor logic simplification

Simplify logic in ui.go. In that diff, `st` would already have the
Reversed flag set; there's no need to set it again.

Also, minor changes to remove all the statickcheck errors VS code's
Go extension complains about.

* Add staticcheck and Go 1.19 go-generate Github check

This adds a few Github action checks:

1. Check that `go fmt` and `go generate` were run on Go 1.19, following
up on https://github.com/gokcehan/lf/commit/654b8737b8a35729aa89aa93acf05ed5871b2616.
On earlier Go versions, `go generate` results in whitespace changes.

2. Check that [Staticcheck](https://staticcheck.io/) passes.
This commit is contained in:
Ilya Grigoriev authored and GitHub committed 2022-10-16 18:54:34 +03:00
1 parent 04d40832f1
commit 624992ad7b
1 file changed
+23
+23
View File
@@ -15,6 +15,8 @@ jobs:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
@@ -26,3 +28,24 @@ jobs:
- name: Test - name: Test
run: go test -v ./... run: go test -v ./...
- uses: dominikh/staticcheck-action@v1.2.0
with:
version: "2022.1.3"
install-go: false
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Test `go fmt && go generate` on Go 1.19 creates no diffs
run: go fmt && go generate && git diff --exit-code