Skip to content

Commit ed695e2

Browse files
author
NGUYEN Duc Trung
committed
style: fix code format with gofmt
1 parent 93c4e92 commit ed695e2

File tree

14 files changed

+51
-27
lines changed

14 files changed

+51
-27
lines changed

.github/workflows/build-test-push-workflow.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ jobs:
1818
with:
1919
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
2020
- name: Check Source formatting
21-
run: make fmt && if [[ $? -ne 0 ]]; then false; fi
21+
run: |
22+
UNFORMATTED=$(gofmt -l .)
23+
if [ -n "$UNFORMATTED" ]; then
24+
echo "These files are not formatted:"
25+
echo "$UNFORMATTED"
26+
exit 1
27+
fi
2228
- name: Lint source code
2329
run: make vet && if [[ $? -ne 0 ]]; then false; fi
2430
unit-tests:

cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ func main() {
107107
// as certificates issued by a trusted Certificate Authority (CA). The primary risk is potentially allowing
108108
// unauthorized access to sensitive metrics data. Consider replacing with CertDir, CertName, and KeyName
109109
// to provide certificates, ensuring the server communicates using trusted and secure certificates.
110-
TLSOpts: tlsOpts,
110+
TLSOpts: tlsOpts,
111111
FilterProvider: filters.WithAuthenticationAndAuthorization,
112112
}
113113

114-
// TODO: enable https for /metrics endpoint by default
114+
// TODO: enable https for /metrics endpoint by default
115115
// if secureMetrics {
116116
// // FilterProvider is used to protect the metrics endpoint with authn/authz.
117117
// // These configurations ensure that only authorized users and service accounts

go.mod

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ require (
1212
github.com/aws/aws-sdk-go-v2/credentials v1.17.71
1313
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.85
1414
github.com/aws/aws-sdk-go-v2/service/s3 v1.84.1
15-
github.com/go-logr/logr v1.4.2
15+
github.com/go-logr/logr v1.4.3
1616
github.com/google/go-cmp v0.7.0
1717
github.com/google/uuid v1.6.0
1818
github.com/joho/godotenv v1.5.1
1919
github.com/minio/minio-go/v7 v7.0.16
20-
github.com/onsi/ginkgo/v2 v2.23.4
21-
github.com/onsi/gomega v1.38.0
20+
github.com/onsi/ginkgo/v2 v2.27.2
21+
github.com/onsi/gomega v1.38.2
2222
github.com/pkg/errors v0.9.1
2323
github.com/prometheus/client_golang v1.19.1
2424
github.com/stretchr/testify v1.9.0
@@ -39,6 +39,7 @@ require (
3939
cloud.google.com/go/iam v1.1.1 // indirect
4040
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
4141
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
42+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
4243
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
4344
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
4445
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 // indirect
@@ -129,6 +130,8 @@ require (
129130
golang.org/x/crypto v0.45.0 // indirect
130131
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
131132
golang.org/x/net v0.47.0 // indirect
133+
go.yaml.in/yaml/v3 v3.0.4 // indirect
134+
golang.org/x/mod v0.28.0 // indirect
132135
golang.org/x/oauth2 v0.27.0 // indirect
133136
golang.org/x/sync v0.18.0 // indirect
134137
golang.org/x/sys v0.38.0 // indirect
@@ -143,7 +146,7 @@ require (
143146
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
144147
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
145148
google.golang.org/grpc v1.65.0 // indirect
146-
google.golang.org/protobuf v1.36.6 // indirect
149+
google.golang.org/protobuf v1.36.7 // indirect
147150
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
148151
gopkg.in/inf.v0 v0.9.1 // indirect
149152
gopkg.in/ini.v1 v1.66.4 // indirect

go.sum

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1/go.mod h1:ap1dmS6vQK
2121
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
2222
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
2323
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
24+
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
25+
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
2426
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
2527
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
2628
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
@@ -118,6 +120,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
118120
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
119121
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
120122
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
123+
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
124+
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
121125
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
122126
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
123127
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
@@ -247,8 +251,12 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J
247251
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
248252
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
249253
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
254+
github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns=
255+
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
250256
github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY=
251257
github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o=
258+
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
259+
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
252260
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
253261
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
254262
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -270,6 +278,7 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
270278
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
271279
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
272280
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
281+
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
273282
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
274283
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
275284
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -333,6 +342,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
333342
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
334343
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
335344
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
345+
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
346+
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
336347
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
337348
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
338349
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -354,6 +365,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
354365
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
355366
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
356367
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
368+
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
369+
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
357370
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
358371
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
359372
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -501,6 +514,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
501514
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
502515
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
503516
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
517+
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
518+
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
504519
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
505520
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
506521
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=

pkg/splunk/enterprise/afwscheduler_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ func TestRunLocalScopedPlaybook(t *testing.T) {
30643064
// Test3: get installed app name passes but isAppAlreadyInstalled fails with real error (not "Could not find object")
30653065
mockPodExecReturnContexts[1].StdErr = ""
30663066
mockPodExecReturnContexts[2].StdErr = "Some other real error message" // Real error, not "Could not find object"
3067-
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 2") // Real error, not grep exit code 1
3067+
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 2") // Real error, not grep exit code 1
30683068
localInstallCtxt.sem <- struct{}{}
30693069
waiter.Add(1)
30703070
err = localInstallCtxt.runPlaybook(ctx)
@@ -3073,10 +3073,10 @@ func TestRunLocalScopedPlaybook(t *testing.T) {
30733073
}
30743074

30753075
// Test4: isAppAlreadyInstalled returns app not enabled (grep exit code 1), then install fails
3076-
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
3077-
mockPodExecReturnContexts[2].StdErr = "" // No stderr
3078-
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
3079-
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
3076+
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
3077+
mockPodExecReturnContexts[2].StdErr = "" // No stderr
3078+
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
3079+
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
30803080
mockPodExecReturnContexts[3].Err = fmt.Errorf("install command failed") // This causes the actual failure
30813081

30823082
localInstallCtxt.sem <- struct{}{}
@@ -3103,7 +3103,7 @@ func TestRunLocalScopedPlaybook(t *testing.T) {
31033103

31043104
// Test6: Install succeeds with stderr content (should be ignored), but cleanup fails
31053105
mockPodExecReturnContexts[3].StdErr = "Some informational message in stderr" // Stderr content should be ignored
3106-
mockPodExecReturnContexts[3].Err = nil // No actual error for install
3106+
mockPodExecReturnContexts[3].Err = nil // No actual error for install
31073107
// Keep cleanup failure from previous test setup to make overall test fail
31083108
// mockPodExecReturnContexts[4] still has error from earlier
31093109

@@ -3326,10 +3326,10 @@ func TestPremiumAppScopedPlaybook(t *testing.T) {
33263326

33273327
// Test4: isAppAlreadyInstalled returns app is not enabled (grep exit code 1)
33283328
// so app install will run and it should fail with real error
3329-
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
3330-
mockPodExecReturnContexts[2].StdErr = "" // No stderr
3331-
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
3332-
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
3329+
mockPodExecReturnContexts[2].StdOut = "" // No stdout means grep didn't find ENABLED
3330+
mockPodExecReturnContexts[2].StdErr = "" // No stderr
3331+
mockPodExecReturnContexts[2].Err = fmt.Errorf("exit status 1") // grep exit code 1 = pattern not found
3332+
mockPodExecReturnContexts[3].StdErr = "real installation error" // This is just logged now
33333333
mockPodExecReturnContexts[3].Err = fmt.Errorf("install command failed") // This causes the actual failure
33343334

33353335
localInstallCtxt.sem <- struct{}{}
@@ -3341,7 +3341,7 @@ func TestPremiumAppScopedPlaybook(t *testing.T) {
33413341

33423342
// Test5: Install succeeds with stderr content (should be ignored), but post install fails
33433343
mockPodExecReturnContexts[3].StdErr = "Some informational message in stderr" // Stderr content should be ignored
3344-
mockPodExecReturnContexts[3].Err = nil // No actual error for install
3344+
mockPodExecReturnContexts[3].Err = nil // No actual error for install
33453345

33463346
localInstallCtxt.sem <- struct{}{}
33473347
waiter.Add(1)

pkg/splunk/enterprise/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2503,7 +2503,7 @@ func loadFixture(t *testing.T, filename string) string {
25032503
if err != nil {
25042504
t.Fatalf("Failed to load fixture %s: %v", filename, err)
25052505
}
2506-
2506+
25072507
// Compact the JSON to match the output from json.Marshal
25082508
var compactJSON bytes.Buffer
25092509
if err := json.Compact(&compactJSON, data); err != nil {

test/secret/manager_secret_m4_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"context"
1818
"fmt"
1919

20-
"github.com/onsi/ginkgo/v2/types"
2120
. "github.com/onsi/ginkgo/v2"
21+
"github.com/onsi/ginkgo/v2/types"
2222
. "github.com/onsi/gomega"
2323

2424
enterpriseApi "github.com/splunk/splunk-operator/api/v4"

test/secret/manager_secret_s1_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919

2020
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2121

22-
"github.com/onsi/ginkgo/v2/types"
2322
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/types"
2424
. "github.com/onsi/gomega"
2525

2626
corev1 "k8s.io/api/core/v1"

test/secret/secret_c3_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919

2020
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2121

22-
"github.com/onsi/ginkgo/v2/types"
2322
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/types"
2424
. "github.com/onsi/gomega"
2525

2626
"github.com/splunk/splunk-operator/test/testenv"

test/secret/secret_m4_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919

2020
enterpriseApi "github.com/splunk/splunk-operator/api/v4"
2121

22-
"github.com/onsi/ginkgo/v2/types"
2322
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/types"
2424
. "github.com/onsi/gomega"
2525

2626
"github.com/splunk/splunk-operator/test/testenv"

0 commit comments

Comments
 (0)