Skip to content

Commit 0a0d05b

Browse files
Merge pull request #25781 from kolyshkin/rm-goimports
Use golangci-lint fmt for pkg/bindings
2 parents 951a2ce + 9d4e820 commit 0a0d05b

File tree

13 files changed

+5
-504
lines changed

13 files changed

+5
-504
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ formatters:
77
- gofmt
88
- goimports
99
exclusions:
10-
generated: strict
10+
generated: disable
1111

1212
linters:
1313
enable:

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ podman-testing: bin/podman-testing
478478
###
479479

480480
.PHONY: generate-bindings
481-
generate-bindings:
481+
generate-bindings: .install.golangci-lint
482482
ifneq ($(GOOS),darwin)
483483
$(GOCMD) generate ./pkg/bindings/... ;
484484
endif
@@ -1023,10 +1023,6 @@ endif
10231023
install.tools: .install.golangci-lint ## Install needed tools
10241024
$(MAKE) -C test/tools
10251025

1026-
.PHONY: .install.goimports
1027-
.install.goimports:
1028-
$(MAKE) -C test/tools build/goimports
1029-
10301026
.PHONY: .install.ginkgo
10311027
.install.ginkgo:
10321028
$(GO) build -o $(GINKGO) ./vendor/github.com/onsi/ginkgo/v2/ginkgo

contrib/cirrus/postbuild.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ cd $CIRRUS_WORKING_DIR
3838
showrun make -C test/tools vendor
3939
SUGGESTION="run 'make vendor', 'make -C test/tools vendor' and 'make completions' and commit all changes" ./hack/tree_status.sh
4040

41-
showrun make .install.goimports
4241
showrun make generate-bindings
4342
SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh
4443

pkg/bindings/generator/generator.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,8 @@ func main() {
160160
}
161161
closed = true
162162

163-
// go fmt file
164-
gofmt := exec.Command("go", "fmt", out.Name())
165-
gofmt.Stderr = os.Stdout
166-
if err := gofmt.Run(); err != nil {
167-
fmt.Println(err)
168-
os.Exit(1)
169-
}
170-
171-
// go import file
172-
goimport := exec.Command("../../../test/tools/build/goimports", "-w", out.Name())
163+
// Format file.
164+
goimport := exec.Command("../../../bin/golangci-lint", "fmt", out.Name())
173165
goimport.Stderr = os.Stdout
174166
if err := goimport.Run(); err != nil {
175167
fmt.Println(err)

test/tools/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ clean:
2020

2121
.PHONY: $(BUILDDIR)
2222
$(BUILDDIR): \
23-
$(BUILDDIR)/goimports \
2423
$(BUILDDIR)/go-md2man \
2524
$(BUILDDIR)/git-validation \
2625
$(BUILDDIR)/swagger
2726

28-
$(BUILDDIR)/goimports: $(SOURCES)
29-
$(GO_BUILD) -o $@ ./vendor/golang.org/x/tools/cmd/goimports
30-
3127
$(BUILDDIR)/go-md2man: $(SOURCES)
3228
$(GO_BUILD) -o $@ ./vendor/github.com/cpuguy83/go-md2man/v2
3329

test/tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/cpuguy83/go-md2man/v2 v2.0.6
1010
github.com/go-swagger/go-swagger v0.30.5
1111
github.com/vbatts/git-validation v1.2.2
12-
golang.org/x/tools v0.30.0
1312
)
1413

1514
require (
@@ -69,6 +68,7 @@ require (
6968
golang.org/x/sync v0.11.0 // indirect
7069
golang.org/x/sys v0.30.0 // indirect
7170
golang.org/x/text v0.21.0 // indirect
71+
golang.org/x/tools v0.30.0 // indirect
7272
gopkg.in/ini.v1 v1.67.0 // indirect
7373
gopkg.in/yaml.v2 v2.4.0 // indirect
7474
gopkg.in/yaml.v3 v3.0.1 // indirect

test/tools/tools.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ import (
99
_ "github.com/cpuguy83/go-md2man/v2"
1010
_ "github.com/go-swagger/go-swagger/cmd/swagger"
1111
_ "github.com/vbatts/git-validation"
12-
_ "golang.org/x/tools/cmd/goimports"
1312
)

test/tools/vendor/golang.org/x/tools/cmd/goimports/doc.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)