Skip to content

Commit 5636c36

Browse files
DISTMYSQL-423: Improve code formatting checks, adjust Docker images to use go-1.22.3
https://perconadev.atlassian.net/browse/DISTMYSQL-423 Code formatting according to go-1.22.3 gofmt
1 parent f1f9c36 commit 5636c36

File tree

7 files changed

+30
-36
lines changed

7 files changed

+30
-36
lines changed

go/collection/collection.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
/*
18-
1918
Package collection holds routines for collecting "high frequency"
2019
metrics and handling their auto-expiry based on a configured retention
2120
time. This becomes more interesting as the number of MySQL servers
@@ -31,10 +30,10 @@ data or the raw data for custom analysis over the period requested.
3130
3231
This is expected to be used for the following types of metric:
3332
34-
* discovery metrics (time to poll a MySQL server and collect status)
35-
* queue metrics (statistics within the discovery queue itself)
36-
* query metrics (statistics on the number of queries made to the
37-
backend MySQL database)
33+
- discovery metrics (time to poll a MySQL server and collect status)
34+
- queue metrics (statistics within the discovery queue itself)
35+
- query metrics (statistics on the number of queries made to the
36+
backend MySQL database)
3837
3938
Orchestrator code can just add a new metric without worrying about
4039
removing it later, and other code which serves API requests can
@@ -57,7 +56,6 @@ orchestrator run out of memory eventually.
5756
5857
Current code uses DiscoveryCollectionRetentionSeconds as the
5958
time to keep metric data.
60-
6159
*/
6260
package collection
6361

go/inst/cluster_alias_dao.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ func updateClusterAliasesUsingReplace() error {
152152
//
153153
// The data which is going to be inserted originates from database_instance
154154
// table, in particular the following columns:
155-
// 1. `cluster_name` varchar(128) NOT NULL
156-
// 2. `suggested_cluster_alias` varchar(128) CHARACTER SET ascii COLLATE
157-
// ascii_general_ci NOT NULL
155+
// 1. `cluster_name` varchar(128) NOT NULL
156+
// 2. `suggested_cluster_alias` varchar(128) CHARACTER SET ascii COLLATE
157+
// ascii_general_ci NOT NULL
158158
//
159159
// So it is possible to end up in the following situation when we use this
160160
// approach:

go/inst/instance_binlog.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ type BinlogEvent struct {
5151
Info string
5252
}
5353

54-
//
5554
func (this *BinlogEvent) NextBinlogCoordinates() BinlogCoordinates {
5655
return BinlogCoordinates{LogFile: this.Coordinates.LogFile, LogPos: this.NextEventPos, Type: this.Coordinates.Type}
5756
}
5857

59-
//
6058
func (this *BinlogEvent) NormalizeInfo() {
6159
for reg, replace := range eventInfoTransformations {
6260
this.Info = reg.ReplaceAllString(this.Info, replace)
@@ -76,7 +74,6 @@ func (this *BinlogEvent) EqualsIgnoreCoordinates(other *BinlogEvent) bool {
7674

7775
const maxEmptyEventsEvents int = 10
7876

79-
//
8077
type BinlogEventCursor struct {
8178
cachedEvents []BinlogEvent
8279
currentEventIndex int

go/inst/instance_binlog_dao.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ func getLastPseudoGTIDEntryInBinlog(pseudoGTIDRegexp *regexp.Regexp, instanceKey
133133
}
134134

135135
// getLastPseudoGTIDEntryInInstance will search for the last pseudo GTID entry in an instance's binary logs. Arguments:
136-
// - instance
137-
// - minBinlogCoordinates: a hint, suggested coordinates to start with. The search will _attempt_ to begin search from
138-
// these coordinates, but if search is empty, then we failback to full search, ignoring this hint
139-
// - maxBinlogCoordinates: a hard limit on the maximum position we're allowed to investigate.
140-
// - exhaustiveSearch: when 'true', continue iterating binary logs. When 'false', only investigate most recent binary log.
136+
// - instance
137+
// - minBinlogCoordinates: a hint, suggested coordinates to start with. The search will _attempt_ to begin search from
138+
// these coordinates, but if search is empty, then we failback to full search, ignoring this hint
139+
// - maxBinlogCoordinates: a hard limit on the maximum position we're allowed to investigate.
140+
// - exhaustiveSearch: when 'true', continue iterating binary logs. When 'false', only investigate most recent binary log.
141141
func getLastPseudoGTIDEntryInInstance(instance *Instance, minBinlogCoordinates *BinlogCoordinates, maxBinlogCoordinates *BinlogCoordinates, exhaustiveSearch bool) (*BinlogCoordinates, string, error) {
142142
pseudoGTIDRegexp, err := compilePseudoGTIDPattern()
143143
if err != nil {

go/inst/instance_dao.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ func (this InstancesByCountReplicas) Less(i, j int) bool {
7070
}
7171

7272
// InstancesByDc is a sortable type for Instance
73-
// 1. Instances are sorted by DC
74-
// 2. Within DC group instances are sorted by replicas count
75-
// 3. Within ReplicasCount group insances are:
76-
// a) not sorted if ReplicasCount > 0
77-
// b) sorted by replication lag if ReplicasCount == 0
73+
// 1. Instances are sorted by DC
74+
// 2. Within DC group instances are sorted by replicas count
75+
// 3. Within ReplicasCount group insances are:
76+
// a) not sorted if ReplicasCount > 0
77+
// b) sorted by replication lag if ReplicasCount == 0
7878
//
7979
// DC1 < DC2
8080
// if DC1 == DC2 => len(Replicas1) < len (Replicas2)
@@ -1209,9 +1209,9 @@ func (this byNamePort) Less(i, j int) bool {
12091209
}
12101210

12111211
// BulkReadInstance returns a list of all instances from the database
1212-
// - I only need the Hostname and Port fields.
1213-
// - I must use readInstancesByCondition to ensure all column
1214-
// settings are correct.
1212+
// - I only need the Hostname and Port fields.
1213+
// - I must use readInstancesByCondition to ensure all column
1214+
// settings are correct.
12151215
func BulkReadInstance() ([](*InstanceKey), error) {
12161216
// no condition (I want all rows) and no sorting (but this is done by Hostname, Port anyway)
12171217
const (

go/inst/instance_key.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ func NewRawInstanceKeyStrings(hostname string, port string) (*InstanceKey, error
104104
return newInstanceKeyStrings(hostname, port, false)
105105
}
106106

107-
//
108107
func (this *InstanceKey) ResolveHostname() (*InstanceKey, error) {
109108
if !this.IsValid() {
110109
return this, nil

go/os/unixcheck_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
2-
Copyright 2017 Simon Mudd, courtesy Booking.com
2+
Copyright 2017 Simon Mudd, courtesy Booking.com
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
1515
*/
1616
package os
1717

0 commit comments

Comments
 (0)