Skip to content

Commit 671a62d

Browse files
ffjlabohongky-1994
authored andcommitted
Enable gofmt linter (#5630)
* Add gofmt linter Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix deployment_store_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/app/piped/executor/analysis/mannwhitney/udist.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/app/pipedv1/livestatereporter/livestatereporter_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/insight/provider_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/log/log_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix tool/actions-gh-release/comment_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix tool/actions-gh-release/release_test.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/app/piped/executor/cloudrun/cloudrun.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix pkg/app/piped/platformprovider/cloudrun/cloudrun.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix tool/actions-gh-release/github.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Fix tool/actions-plan-preview/github.go for 'gofmt -s' Signed-off-by: Yoshiki Fujikane <[email protected]> * Use datastoretest.MockProjectStore Signed-off-by: Yoshiki Fujikane <[email protected]> --------- Signed-off-by: Yoshiki Fujikane <[email protected]> Signed-off-by: kypham <[email protected]>
1 parent 992f17d commit 671a62d

File tree

14 files changed

+182
-275
lines changed

14 files changed

+182
-275
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ run:
44
linters:
55
disable-all: true
66
enable:
7+
- gofmt
78
- depguard
89
- gocritic
910
- goheader

pkg/app/ops/handler/handler_mock.go

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

pkg/app/ops/handler/handler_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ import (
2525
"strings"
2626
"testing"
2727

28-
"github.com/golang/mock/gomock"
2928
"github.com/stretchr/testify/assert"
29+
"go.uber.org/mock/gomock"
3030
"go.uber.org/zap"
3131

3232
"github.com/pipe-cd/pipecd/pkg/config"
33+
"github.com/pipe-cd/pipecd/pkg/datastore/datastoretest"
3334
"github.com/pipe-cd/pipecd/pkg/model"
3435
)
3536

36-
func createMockHandler(ctrl *gomock.Controller) (*MockprojectStore, *Handler) {
37-
m := NewMockprojectStore(ctrl)
37+
func createMockHandler(ctrl *gomock.Controller) (*datastoretest.MockProjectStore, *Handler) {
38+
m := datastoretest.NewMockProjectStore(ctrl)
3839
logger, _ := zap.NewProduction()
3940

4041
h := NewHandler(

pkg/app/piped/executor/analysis/mannwhitney/udist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func makeUmemo(twoU, n1 int, t []int) []map[ukey]float64 {
228228
// bounds. It might be worth turning these into directly
229229
// indexible slices.
230230
A := make([]map[ukey]float64, K+1)
231-
A[K] = map[ukey]float64{ukey{n1: n1, twoU: twoU}: 0}
231+
A[K] = map[ukey]float64{{n1: n1, twoU: twoU}: 0}
232232

233233
// Compute memo table (k, n1, twoU) triples from high K values
234234
// to low K values. This drives the recurrence relation

pkg/app/piped/executor/cloudrun/cloudrun.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ func apply(ctx context.Context, client provider.Client, sm provider.ServiceManif
139139

140140
func waitRevisionReady(ctx context.Context, client provider.Client, revisionName string, retryDuration, retryTimeout time.Duration, lp executor.LogPersister) error {
141141
shouldCheckConditions := map[string]struct{}{
142-
"Active": struct{}{},
143-
"Ready": struct{}{},
144-
"ConfigurationsReady": struct{}{},
145-
"RoutesReady": struct{}{},
146-
"ContainerHealthy": struct{}{},
147-
"ResourcesAvailable": struct{}{},
142+
"Active": {},
143+
"Ready": {},
144+
"ConfigurationsReady": {},
145+
"RoutesReady": {},
146+
"ContainerHealthy": {},
147+
"ResourcesAvailable": {},
148148
}
149149
mustPassConditions := map[string]struct{}{
150-
"Ready": struct{}{},
151-
"Active": struct{}{},
150+
"Ready": {},
151+
"Active": {},
152152
}
153153

154154
doCheck := func() (bool, error) {

pkg/app/piped/platformprovider/cloudrun/cloudrun.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ var (
4141

4242
var (
4343
TypeConditions = map[string]struct{}{
44-
"Active": struct{}{},
45-
"Ready": struct{}{},
46-
"ConfigurationsReady": struct{}{},
47-
"RoutesReady": struct{}{},
48-
"ContainerHealthy": struct{}{},
49-
"ResourcesAvailable": struct{}{},
44+
"Active": {},
45+
"Ready": {},
46+
"ConfigurationsReady": {},
47+
"RoutesReady": {},
48+
"ContainerHealthy": {},
49+
"ResourcesAvailable": {},
5050
}
5151
TypeHealthyServiceConditions = map[string]struct{}{
52-
"Ready": struct{}{},
53-
"ConfigurationsReady": struct{}{},
54-
"RoutesReady": struct{}{},
52+
"Ready": {},
53+
"ConfigurationsReady": {},
54+
"RoutesReady": {},
5555
}
5656
TypeHealthyRevisionConditions = map[string]struct{}{
57-
"Ready": struct{}{},
58-
"Active": struct{}{},
59-
"ContainerHealthy": struct{}{},
60-
"ResourcesAvailable": struct{}{},
57+
"Ready": {},
58+
"Active": {},
59+
"ContainerHealthy": {},
60+
"ResourcesAvailable": {},
6161
}
6262
)
6363

pkg/app/pipedv1/livestatereporter/livestatereporter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func Test_reporter_flushSnapshots(t *testing.T) {
142142
snapshotFlushInterval: 1 * time.Minute,
143143
appLister: &fakeAPILister{
144144
apps: []*model.Application{
145-
&model.Application{
145+
{
146146
Id: "app-id",
147147
Name: "app-name",
148148
GitPath: &model.ApplicationGitPath{

0 commit comments

Comments
 (0)