Skip to content

Commit dd70986

Browse files
authored
test: fix flaky goimports test (#1662)
Install tools ahead of time so tests verifying output don't have extraneous module downloading output.
1 parent 05a817b commit dd70986

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

.github/workflows/librarian.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@ jobs:
2525
go-version-file: 'go.mod'
2626
- name: Display Go version
2727
run: go version
28-
- name: Install protoc
28+
- name: Install tools
2929
run: |
3030
set -e
3131
curl -fSSL -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
3232
cd /usr/local
3333
sudo unzip -x /tmp/protoc.zip
3434
protoc --version
35+
go install github.com/google/yamlfmt/cmd/[email protected]
36+
go install golang.org/x/tools/cmd/goimports@latest
3537
- name: Run tests
3638
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
3739
- name: Check YAML formatting
3840
run: |
39-
go install github.com/google/yamlfmt/cmd/[email protected]
4041
yamlfmt .
4142
- name: Detect formatting changes
4243
run: git diff --exit-code

all_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ func TestGoImports(t *testing.T) {
165165
if err := cmd.Run(); err != nil {
166166
t.Fatalf("goimports failed to run: %v\nOutput:\n%s", err, out.String())
167167
}
168-
if out.Len() > 0 {
169-
t.Errorf("goimports found unformatted files:\n%s", out.String())
170-
}
171168
}
172169

173170
func TestGoModTidy(t *testing.T) {

0 commit comments

Comments
 (0)