Skip to content

Commit 034129a

Browse files
committedFeb 22, 2025··
Use goimports
1 parent 6e87391 commit 034129a

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed
 

‎Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
OUT_DIR := ./out
22
GO_FILES := $(shell find . -type f \( -iname '*.go' \))
3+
GO_MODULE := github.com/eikendev/hackenv
34

45
SCRIPT_FILES := $(wildcard ./bin/*)
56

@@ -14,17 +15,18 @@ clean:
1415

1516
.PHONY: test
1617
test: lint_scripts
17-
stdout=$$(gofumpt -l . 2>&1); if [ "$$stdout" ]; then exit 1; fi
18+
if [ -n "$$(gofumpt -l $(GO_FILES))" ]; then echo "Code is not properly formatted"; exit 1; fi
19+
if [ -n "$$(goimports -l -local $(GO_MODULE) $(GO_FILES))" ]; then echo "Imports are not properly formatted"; exit 1; fi
1820
go vet ./...
1921
misspell -error $(GO_FILES)
2022
gocyclo -over 10 $(GO_FILES)
2123
staticcheck ./...
22-
errcheck ./...
24+
errcheck -ignoregenerated ./...
2325
gocritic check -disable='#experimental,#opinionated' -@ifElseChain.minThreshold 3 ./...
2426
revive -set_exit_status ./...
2527
nilaway ./...
2628
go test -v -cover ./...
27-
gosec -exclude-dir=tests ./...
29+
gosec -exclude-generated ./...
2830
govulncheck ./...
2931
@printf '\n%s\n' "> Test successful"
3032

@@ -37,6 +39,7 @@ setup:
3739
go install github.com/mgechev/revive@latest
3840
go install github.com/securego/gosec/v2/cmd/gosec@latest
3941
go install go.uber.org/nilaway/cmd/nilaway@latest
42+
go install golang.org/x/tools/cmd/goimports@latest
4043
go install golang.org/x/vuln/cmd/govulncheck@latest
4144
go install honnef.co/go/tools/cmd/staticcheck@latest
4245
go install mvdan.cc/gofumpt@latest

‎internal/buildconfig/buildconfig.go

-5
This file was deleted.

‎internal/commands/fix.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import (
55
"os/exec"
66
"strings"
77

8+
log "github.com/sirupsen/logrus"
9+
810
"github.com/eikendev/hackenv/internal/options"
911
"github.com/eikendev/hackenv/internal/scripts"
10-
log "github.com/sirupsen/logrus"
1112
)
1213

1314
// FixCommand represents the options specific to the fix command.

‎internal/images/images.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"regexp"
88
"time"
99

10+
"github.com/adrg/xdg"
1011
log "github.com/sirupsen/logrus"
12+
rawLibvirt "libvirt.org/go/libvirt"
1113

12-
"github.com/adrg/xdg"
1314
"github.com/eikendev/hackenv/internal/constants"
14-
rawLibvirt "libvirt.org/go/libvirt"
1515
)
1616

1717
type infoRetriever func(string, *regexp.Regexp) (*DownloadInfo, error)

‎internal/libvirt/libvirt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"errors"
66

77
log "github.com/sirupsen/logrus"
8+
"libvirt.org/go/libvirt"
89

910
"github.com/eikendev/hackenv/internal/constants"
1011
"github.com/eikendev/hackenv/internal/images"
11-
"libvirt.org/go/libvirt"
1212
)
1313

1414
var domainStates = map[libvirt.DomainState]string{

‎internal/paths/paths.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"os/exec"
88
"path/filepath"
99

10+
"github.com/adrg/xdg"
1011
log "github.com/sirupsen/logrus"
1112

12-
"github.com/adrg/xdg"
1313
"github.com/eikendev/hackenv/internal/constants"
1414
)
1515

0 commit comments

Comments
 (0)
Please sign in to comment.