Skip to content

Commit 8cffc77

Browse files
oktalzGopher Bot
authored andcommitted
BUILD/MINOR: update tolling used to check code
Format code across the repository to resolve line length warnings, primarily by wrapping long logger.LogAttrs statements and function calls to span multiple lines.
1 parent a6671c0 commit 8cffc77

71 files changed

Lines changed: 515 additions & 309 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ ci/k0s/k0s-data/
1616
test/conformance/conformance-report.yaml
1717
conformance-junit.xml
1818
conformance-junit.html
19+
gitlab-mr-checker

api/gate/v3/register.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ func Resource(resource string) schema.GroupResource {
4343

4444
// Adds the list of known types to api.Scheme.
4545
func addKnownTypes(scheme *runtime.Scheme) error {
46-
scheme.AddKnownTypes(SchemeGroupVersion,
46+
scheme.AddKnownTypes(
47+
SchemeGroupVersion,
4748
&HugGate{},
4849
&HugGateList{},
4950
&HugConf{},

cmd/gitlab-mr-checker/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const LABEL_COLOR = "#8fbc8f"
6161
// reruns won't re-add labels the user has since removed manually.
6262
const autoBackportMarker = `<!-- MR AUTO BACKPORT -->`
6363

64+
//revive:disable-next-line:function-length
6465
func main() {
6566
fmt.Print(hello) //nolint:forbidigo
6667

hug/haproxy/api/acls.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func (c *clientNative) ACLReplaceAll(parentType parser.Section, name string, rul
5757
for index, rule := range rules {
5858
err := c.ACLsCreate(index, parentType, name, rule)
5959
if err != nil {
60-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to create ACL rule",
60+
c.logger.LogAttrs(
61+
context.Background(), slog.LevelError, "failed to create ACL rule",
6162
logging.LogAttrError(err),
6263
slog.Int("rule index", index),
6364
slog.String("frontend", name),
@@ -79,7 +80,8 @@ func (c *clientNative) ACLsReplaceAll(parentType parser.Section, name string, ru
7980
for index, rule := range rules {
8081
err := c.ACLsCreate(index, parentType, name, rule)
8182
if err != nil {
82-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to create ACL rule",
83+
c.logger.LogAttrs(
84+
context.Background(), slog.LevelError, "failed to create ACL rule",
8385
logging.LogAttrError(err),
8486
slog.Int("rule index", index),
8587
slog.String("frontend", name),

hug/haproxy/api/backend.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ func (c *clientNative) BackendCreate(backend models.Backend) error {
3535
if errCreate != nil {
3636
// ... maybe it's already existing, so just edit it.
3737
if err := configuration.EditStructuredBackend(backend.Name, &backend, c.activeTransaction, 0); err != nil {
38-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to edit backend",
38+
c.logger.LogAttrs(
39+
context.Background(), slog.LevelError, "failed to edit backend",
3940
logging.LogAttrError(err),
4041
slog.String("backend", backend.Name),
4142
)
@@ -92,14 +93,16 @@ func (c *clientNative) BackendEdit(backend models.Backend) error {
9293
// Check if only Servers were updated
9394
onlyServersUpdated := false
9495
if cmp.Equal(previousBackend, backend, cmpopts.IgnoreFields(models.Backend{}, "Servers")) {
95-
c.logger.LogAttrs(context.Background(), slog.LevelInfo, "Only Servers are updated",
96+
c.logger.LogAttrs(
97+
context.Background(), slog.LevelInfo, "Only Servers are updated",
9698
slog.String("backend", backend.Name),
9799
)
98100
onlyServersUpdated = true
99101
}
100102

101103
if err := configuration.EditStructuredBackend(backend.Name, &backend, c.activeTransaction, 0); err != nil {
102-
c.logger.LogAttrs(context.Background(), slog.LevelError, "Failed to edit backend",
104+
c.logger.LogAttrs(
105+
context.Background(), slog.LevelError, "Failed to edit backend",
103106
logging.LogAttrError(err),
104107
slog.String("backend", backend.Name),
105108
)
@@ -115,7 +118,8 @@ func (c *clientNative) BackendEdit(backend models.Backend) error {
115118
// If failed, we need to reload
116119
reload.Instance().SetReload("[onlyServersUpdated] [runtime] servers state update failure - backend %s", backend.Name)
117120
} else {
118-
c.logger.LogAttrs(context.Background(), slog.LevelDebug, "[onlyServersUpdated] [runtime] success",
121+
c.logger.LogAttrs(
122+
context.Background(), slog.LevelDebug, "[onlyServersUpdated] [runtime] success",
119123
slog.String("backend", backend.Name),
120124
)
121125
}

hug/haproxy/api/backend_switching_rules.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func (c *clientNative) UseBackendReplaceAll(name string, rules models.BackendSwi
5656
for index, rule := range rules {
5757
err := c.UseBackendCreate(index, name, rule)
5858
if err != nil {
59-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to create use-backend rule",
59+
c.logger.LogAttrs(
60+
context.Background(), slog.LevelError, "failed to create use-backend rule",
6061
logging.LogAttrError(err),
6162
slog.Int("rule index", index),
6263
slog.String("frontend", name),

hug/haproxy/api/bind.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ func (c *clientNative) BindReplaceAll(parentType parser.Section, name string, bi
8181

8282
for _, bind := range binds {
8383
if err := c.BindCreate(parentType, name, bind); err != nil {
84-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to create bind",
84+
c.logger.LogAttrs(
85+
context.Background(), slog.LevelError, "failed to create bind",
8586
logging.LogAttrError(err),
8687
slog.String("bind", bind.Name),
8788
slog.String("parent", name),

hug/haproxy/api/client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ func New(logger *slog.Logger, transactionDir, configFile, programPath, runtimeSo
108108
return nil, err
109109
}
110110

111-
confClient, err := configuration.New(context.Background(),
111+
confClient, err := configuration.New(
112+
context.Background(),
112113
cfgoptions.ConfigurationFile(configFile),
113114
cfgoptions.HAProxyBin(programPath),
114115
cfgoptions.UseModelsValidation,
@@ -220,7 +221,8 @@ func (c *clientNative) APIFinalCommitTransaction() error {
220221

221222
if c.configurationHashAtTransactionStart == hash {
222223
if errDel := config.DeleteTransaction(c.activeTransaction); errDel != nil {
223-
c.logger.LogAttrs(context.Background(), slog.LevelError,
224+
c.logger.LogAttrs(
225+
context.Background(), slog.LevelError,
224226
"failed to delete transaction",
225227
logging.LogAttrError(errDel),
226228
slog.String("transactionID", c.activeTransaction),
@@ -232,7 +234,8 @@ func (c *clientNative) APIFinalCommitTransaction() error {
232234

233235
_, err = config.CommitTransaction(c.activeTransaction)
234236
if err != nil {
235-
c.logger.LogAttrs(context.Background(), slog.LevelError,
237+
c.logger.LogAttrs(
238+
context.Background(), slog.LevelError,
236239
"failed to commit transaction",
237240
logging.LogAttrError(err),
238241
slog.String("transactionID", c.activeTransaction),

hug/haproxy/api/frontend.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ func (c *clientNative) FrontendCreate(frontend models.Frontend) error {
3131
if errCreate != nil {
3232
// ... maybe it's already existing, so just edit it.
3333
if err := configuration.EditStructuredFrontend(frontend.Name, &frontend, c.activeTransaction, 0); err != nil {
34-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to edit frontend",
34+
c.logger.LogAttrs(
35+
context.Background(), slog.LevelError, "failed to edit frontend",
3536
logging.LogAttrError(err),
3637
slog.String("frontend", frontend.Name),
3738
)
@@ -82,7 +83,8 @@ func (c *clientNative) FrontendEdit(frontend models.Frontend) error {
8283
return err
8384
}
8485
if err := configuration.EditFrontend(frontend.Name, &frontend, c.activeTransaction, 0); err != nil {
85-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to edit frontend",
86+
c.logger.LogAttrs(
87+
context.Background(), slog.LevelError, "failed to edit frontend",
8688
logging.LogAttrError(err),
8789
slog.String("frontend", frontend.Name),
8890
)

hug/haproxy/api/http-requests.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func (c *clientNative) HTTPRequestReplaceAll(parentType parser.Section, name str
5757
for index, rule := range rules {
5858
err := c.HTTPRequestCreate(index, parentType, name, rule)
5959
if err != nil {
60-
c.logger.LogAttrs(context.Background(), slog.LevelError, "failed to create http-request rule",
60+
c.logger.LogAttrs(
61+
context.Background(), slog.LevelError, "failed to create http-request rule",
6162
logging.LogAttrError(err),
6263
slog.Int("rule index", index),
6364
slog.String("frontend", name),

0 commit comments

Comments
 (0)