Skip to content

Commit

Permalink
Switch format check to gofmt directly (#100)
Browse files Browse the repository at this point in the history
The `goimport` tool cannot cope with the `golang.org/x/tools` package: if you add the checksum it says you need via `go mod download` it then complains you need to `go mod tidy`, which then removes that checksum.

```
go: downloading golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a
go: updates to go.mod needed; to update it:
	go mod tidy
```
vs
```
missing go.sum entry for module providing package golang.org/x/tools/cmd/goimports; to add:
	go mod download golang.org/x/tools
```
  • Loading branch information
greed42 authored Dec 28, 2022
1 parent 7959e0a commit 6d87871
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check formatting
run: |
files=$(go run golang.org/x/tools/cmd/goimports -l -local "github.com/G-Research" .)
files=$(gofmt -l .)
if [[ $files != "" ]]; then
echo "Files need goimports running on them:"
echo "Files need gofmt run on them:"
echo "$files"
exit 1
fi
- name: Build binary
run: |
go build ./cmd/...
Expand All @@ -34,4 +34,4 @@ jobs:
- name: Run tests
run: |
go test ./...
go test ./...

0 comments on commit 6d87871

Please sign in to comment.