Skip to content

Commit a107d3b

Browse files
committed
chore: enable exportloopref and misspell linters
Apply spelling fixes where appropriate.
1 parent 4228af2 commit a107d3b

8 files changed

+20
-19
lines changed

.golangci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ linters:
4040
- bodyclose
4141
- deadcode
4242
- depguard
43+
- exportloopref
4344
- dogsled
4445
# - dupl
4546
- errcheck
@@ -55,7 +56,7 @@ linters:
5556
# - gosimple
5657
- govet
5758
# - ineffassign
58-
# - misspell
59+
- misspell
5960
# - nakedret
6061
- nilerr
6162
# - scopelint

async_producer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ type ProducerMessage struct {
207207
// Partition is the partition that the message was sent to. This is only
208208
// guaranteed to be defined if the message was successfully delivered.
209209
Partition int32
210-
// Timestamp can vary in behaviour depending on broker configuration, being
210+
// Timestamp can vary in behavior depending on broker configuration, being
211211
// in either one of the CreateTime or LogAppendTime modes (default CreateTime),
212212
// and requiring version at least 0.10.0.
213213
//

config_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func TestNetConfigValidates(t *testing.T) {
115115
cfg.Net.SASL.Mechanism = SASLTypeSCRAMSHA256
116116
cfg.Net.SASL.SCRAMClientGeneratorFunc = nil
117117
cfg.Net.SASL.User = "user"
118-
cfg.Net.SASL.Password = "stong_password"
118+
cfg.Net.SASL.Password = "strong_password"
119119
},
120120
"A SCRAMClientGeneratorFunc function must be provided to Net.SASL.SCRAMClientGeneratorFunc",
121121
},
@@ -126,7 +126,7 @@ func TestNetConfigValidates(t *testing.T) {
126126
cfg.Net.SASL.Mechanism = SASLTypeSCRAMSHA512
127127
cfg.Net.SASL.SCRAMClientGeneratorFunc = nil
128128
cfg.Net.SASL.User = "user"
129-
cfg.Net.SASL.Password = "stong_password"
129+
cfg.Net.SASL.Password = "strong_password"
130130
},
131131
"A SCRAMClientGeneratorFunc function must be provided to Net.SASL.SCRAMClientGeneratorFunc",
132132
},

consumer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func (child *partitionConsumer) preferredBroker() (*Broker, error) {
373373
}
374374
}
375375

376-
// if prefered replica cannot be found fallback to leader
376+
// if preferred replica cannot be found fallback to leader
377377
return child.consumer.client.Leader(child.topic, child.partition)
378378
}
379379

@@ -845,7 +845,7 @@ func (bc *brokerConsumer) handleResponses() {
845845
if result == nil {
846846
if preferredBroker, err := child.preferredBroker(); err == nil {
847847
if bc.broker.ID() != preferredBroker.ID() {
848-
// not an error but needs redispatching to consume from prefered replica
848+
// not an error but needs redispatching to consume from preferred replica
849849
child.trigger <- none{}
850850
delete(bc.subscriptions, child)
851851
}

consumer_group.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type ConsumerGroup interface {
3030
// in a separate goroutine which requires it to be thread-safe. Any state must be carefully protected
3131
// from concurrent reads/writes.
3232
// 4. The session will persist until one of the ConsumeClaim() functions exits. This can be either when the
33-
// parent context is cancelled or when a server-side rebalance cycle is initiated.
33+
// parent context is canceled or when a server-side rebalance cycle is initiated.
3434
// 5. Once all the ConsumeClaim() loops have exited, the handler's Cleanup() hook is called
3535
// to allow the user to perform any final tasks before a rebalance.
3636
// 6. Finally, marked offsets are committed one last time before claims are released.

functional_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestMain(m *testing.M) {
6060
//
6161
// In either case, the following topics will be deleted (if they exist) and
6262
// then created/pre-seeded with data for the functional test run:
63-
// * uncomitted-topic-test-4
63+
// * uncommitted-topic-test-4
6464
// * test.1
6565
// * test.4
6666
// * test.64
@@ -134,7 +134,7 @@ func prepareDockerTestEnvironment(ctx context.Context, env *testEnvironment) err
134134
c.Env = append(os.Environ(), fmt.Sprintf("CONFLUENT_PLATFORM_VERSION=%s", confluentPlatformVersion))
135135
err := c.Run()
136136
if err != nil {
137-
return fmt.Errorf("failed to run docker-compose to start test enviroment: %w", err)
137+
return fmt.Errorf("failed to run docker-compose to start test environment: %w", err)
138138
}
139139

140140
// Set up toxiproxy Proxies
@@ -252,10 +252,10 @@ func tearDownDockerTestEnvironment(ctx context.Context, env *testEnvironment) er
252252
c.Stderr = os.Stderr
253253
rmErr := c.Run()
254254
if downErr != nil {
255-
return fmt.Errorf("failed to run docker-compose to stop test enviroment: %w", downErr)
255+
return fmt.Errorf("failed to run docker-compose to stop test environment: %w", downErr)
256256
}
257257
if rmErr != nil {
258-
return fmt.Errorf("failed to run docker-compose to rm test enviroment: %w", rmErr)
258+
return fmt.Errorf("failed to run docker-compose to rm test environment: %w", rmErr)
259259
}
260260
return nil
261261
}
@@ -342,14 +342,14 @@ func prepareTestTopics(ctx context.Context, env *testEnvironment) error {
342342
}
343343

344344
// This is kind of gross, but we don't actually have support for doing transactional publishing
345-
// with sarama, so we need to use a java-based tool to publish uncomitted messages to
345+
// with sarama, so we need to use a java-based tool to publish uncommitted messages to
346346
// the uncommitted-topic-test-4 topic
347347
jarName := filepath.Base(uncomittedMsgJar)
348348
if _, err := os.Stat(jarName); err != nil {
349349
Logger.Printf("Downloading %s\n", uncomittedMsgJar)
350350
req, err := http.NewRequest("GET", uncomittedMsgJar, nil)
351351
if err != nil {
352-
return fmt.Errorf("failed creating requst for uncomitted msg jar: %w", err)
352+
return fmt.Errorf("failed creating requst for uncommitted msg jar: %w", err)
353353
}
354354
res, err := http.DefaultClient.Do(req)
355355
if err != nil {
@@ -358,13 +358,13 @@ func prepareTestTopics(ctx context.Context, env *testEnvironment) error {
358358
defer res.Body.Close()
359359
jarFile, err := os.OpenFile(jarName, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0o644)
360360
if err != nil {
361-
return fmt.Errorf("failed opening the uncomitted msg jar: %w", err)
361+
return fmt.Errorf("failed opening the uncommitted msg jar: %w", err)
362362
}
363363
defer jarFile.Close()
364364

365365
_, err = io.Copy(jarFile, res.Body)
366366
if err != nil {
367-
return fmt.Errorf("failed writing the uncomitted msg jar: %w", err)
367+
return fmt.Errorf("failed writing the uncommitted msg jar: %w", err)
368368
}
369369
}
370370

@@ -373,7 +373,7 @@ func prepareTestTopics(ctx context.Context, env *testEnvironment) error {
373373
c.Stderr = os.Stderr
374374
err = c.Run()
375375
if err != nil {
376-
return fmt.Errorf("failed running uncomitted msg jar: %w", err)
376+
return fmt.Errorf("failed running uncommitted msg jar: %w", err)
377377
}
378378
return nil
379379
}

mockbroker.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ type RequestNotifierFunc func(bytesRead, bytesWritten int)
3030
// to facilitate testing of higher level or specialized consumers and producers
3131
// built on top of Sarama. Note that it does not 'mimic' the Kafka API protocol,
3232
// but rather provides a facility to do that. It takes care of the TCP
33-
// transport, request unmarshalling, response marshalling, and makes it the test
33+
// transport, request unmarshalling, response marshaling, and makes it the test
3434
// writer responsibility to program correct according to the Kafka API protocol
35-
// MockBroker behaviour.
35+
// MockBroker behavior.
3636
//
3737
// MockBroker is implemented as a TCP server listening on a kernel-selected
3838
// localhost port that can accept many connections. It reads Kafka requests

partitioner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func NewHashPartitioner(topic string) Partitioner {
169169

170170
// NewReferenceHashPartitioner is like NewHashPartitioner except that it handles absolute values
171171
// in the same way as the reference Java implementation. NewHashPartitioner was supposed to do
172-
// that but it had a mistake and now there are people depending on both behaviours. This will
172+
// that but it had a mistake and now there are people depending on both behaviors. This will
173173
// all go away on the next major version bump.
174174
func NewReferenceHashPartitioner(topic string) Partitioner {
175175
p := new(hashPartitioner)

0 commit comments

Comments
 (0)