wolfstudy opened a new issue #23: [Code format] 
URL: https://github.com/apache/pulsar-client-go/issues/23
 
 
   #### Expected behavior
   
   `golangci-lint run` success.
   
   #### Actual behavior
   
   ```
   pkg/compression/compression_test.go:44:8: Using the variable on range scope 
`p` in function literal (scopelint)
   pkg/compression/compression_test.go:49:18: Using the variable on range scope 
`p` in function literal (scopelint)
   pkg/compression/compression_test.go:50:25: Using the variable on range scope 
`p` in function literal (scopelint)
   pulsar/internal/commands.go:61:41: `smm` can be 
`github.com/golang/protobuf/proto.Message` (interfacer)
   pulsar/internal/commands.go:71:32: `cmdSend` can be 
`github.com/golang/protobuf/proto.Message` (interfacer)
   pulsar/internal/connection.go:464:52: unnecessary conversion (unconvert)
   pulsar/internal/connection.go:454: G402: TLS InsecureSkipVerify may be true. 
(gosec)
   pulsar/impl_client.go:33:2: `options` is unused (structcheck)
   pulsar/impl_client.go:42:2: `consumerIdGenerator` is unused (structcheck)
   pulsar/impl_client.go:38:2: `auth` is unused (structcheck)
   pulsar/impl_client.go:41:2: `producerIdGenerator` is unused (structcheck)
   perf/perf-consumer.go:94:16: Error return value of `consumer.Ack` is not 
checked (errcheck)
   perf/pulsar-perf-go.go:48:17: Error return value of `rootCmd.Execute` is not 
checked (errcheck)
   pkg/compression/zlib.go:40:9: Error return value of `w.Write` is not checked 
(errcheck)
   pkg/compression/zlib.go:53:8: Error return value of `r.Read` is not checked 
(errcheck)
   pulsar/internal/hash.go:35:9: Error return value of `h.Write` is not checked 
(errcheck)
   pkg/auth/token.go:34:2: ifElseChain: rewrite if-else to switch statement 
(gocritic)
   pulsar/impl_client.go:57:2: ifElseChain: rewrite if-else to switch statement 
(gocritic)
   pulsar/internal/batch_builder.go:101:2: ifElseChain: rewrite if-else to 
switch statement (gocritic)
   pulsar/impl_producer.go:81:46: loopclosure: loop variable partition captured 
by func literal (govet)
   pulsar/impl_producer.go:82:23: loopclosure: loop variable partitionIdx 
captured by func literal (govet)
   pulsar/impl_client.go:65:10: nilness: impossible condition: nil != nil 
(govet)
   pulsar/producer_test.go:46:3: shadow: declaration of "err" shadows 
declaration at line 33 (govet)
   pulsar/producer_test.go:136:5: shadow: declaration of "err" shadows 
declaration at line 122 (govet)
   pulsar/producer_test.go:168:3: shadow: declaration of "err" shadows 
declaration at line 153 (govet)
   pulsar/internal/lookup_service.go:98:9: ineffectual assignment to `err` 
(ineffassign)
   pkg/auth/disabled.go:24: File is not `gofmt`-ed with `-s` (gofmt)
   pkg/auth/provider.go:23: File is not `gofmt`-ed with `-s` (gofmt)
   perf/perf-consumer.go:26: File is not `gofmt`-ed with `-s` (gofmt)
   pkg/auth/token.go:24: File is not `goimports`-ed (goimports)
   perf/perf-consumer.go:25: File is not `goimports`-ed (goimports)
   pkg/compression/compression_test.go:23: File is not `goimports`-ed 
(goimports)
   pkg/auth/disabled.go:42:17: method GetTlsCertificate should be 
GetTLSCertificate (golint)
   pkg/auth/tls.go:53:27: method GetTlsCertificate should be GetTLSCertificate 
(golint)
   pkg/auth/token.go:48:11: `if` block ends with a `return` statement, so drop 
this `else` and outdent its block (golint)
   pkg/auth/token.go:66:11: `if` block ends with a `return` statement, so drop 
this `else` and outdent its block (golint)
   pkg/auth/token.go:83:29: method GetTlsCertificate should be 
GetTLSCertificate (golint)
   pkg/auth/token.go:91:9: `if` block ends with a `return` statement, so drop 
this `else` and outdent its block (golint)
   perf/perf-consumer.go:84:26: should drop = 0 from declaration of var 
msgReceived; it is the zero value (golint)
   perf/perf-consumer.go:85:28: should drop = 0 from declaration of var 
bytesReceived; it is the zero value (golint)
   perf/perf-producer.go:96:39: should drop = nil from declaration of var 
rateLimiter; it is the zero value (golint)
   perf/perf-producer.go:143:4: should replace `messagesPublished += 1` with 
`messagesPublished++` (golint)
   pulsar/impl_message.go:27:6: type `messageId` should be `messageID` (golint)
   pulsar/impl_message.go:34:6: func newMessageId should be newMessageID 
(golint)
   pulsar/impl_message.go:44:2: var `msgId` should be `msgID` (golint)
   pulsar/impl_message.go:54:6: func deserializeMessageId should be 
deserializeMessageID (golint)
   pulsar/impl_message.go:55:2: var `msgId` should be `msgID` (golint)
   pulsar/impl_partition_producer.go:52:2: struct field `producerId` should be 
`producerID` (golint)
   pulsar/impl_partition_producer.go:54:2: struct field `sequenceIdGenerator` 
should be `sequenceIDGenerator` (golint)
   pulsar/impl_partition_producer.go:150:3: var `nextSequenceId` should be 
`nextSequenceID` (golint)
   pulsar/impl_partition_producer.go:248:2: var `sequenceId` should be 
`sequenceID` (golint)
   pulsar/impl_partition_producer.go:268:2: struct field `sequenceId` should be 
`sequenceID` (golint)
   pulsar/impl_partition_producer.go:273:13: var `sequenceId` should be 
`sequenceID` (golint)
   pulsar/impl_producer.go:139:18: should drop = nil from declaration of var 
err; it is the zero value (golint)
   pulsar/impl_producer.go:149:18: should drop = nil from declaration of var 
err; it is the zero value (golint)
   pulsar/message.go:83:2: comment on exported var `EarliestMessage` should be 
of the form `EarliestMessage ...` (golint)
   pulsar/message.go:84:18: should omit type MessageID from declaration of var 
EarliestMessage; it will be inferred from the right-hand side (golint)
   pulsar/message.go:86:2: comment on exported var `LatestMessage` should be of 
the form `LatestMessage ...` (golint)
   pulsar/message.go:87:16: should omit type MessageID from declaration of var 
LatestMessage; it will be inferred from the right-hand side (golint)
   pulsar/test_helper.go:28:2: const `serviceUrl` should be `serviceURL` 
(golint)
   pulsar/test_helper.go:29:2: const `serviceUrlTls` should be `serviceURLTLS` 
(golint)
   pulsar/internal/batch_builder.go:48:2: struct field `producerId` should be 
`producerID` (golint)
   pulsar/internal/batch_builder.go:57:61: func parameter `producerId` should 
be `producerID` (golint)
   pulsar/internal/batch_builder.go:84:15: should replace 
`errors.New(fmt.Sprintf(...))` with `fmt.Errorf(...)` (golint)
   pulsar/internal/batch_builder.go:99:65: method parameter `sequenceId` should 
be `sequenceID` (golint)
   pulsar/internal/batch_builder.go:125:2: should replace `bb.numMessages += 1` 
with `bb.numMessages++` (golint)
   pulsar/internal/batch_builder.go:137:52: method result `sequenceId` should 
be `sequenceID` (golint)
   pulsar/internal/commands.go:128:3: should replace `i += 1` with `i++` 
(golint)
   pulsar/internal/connection.go:54:14: interface method parameter `requestId` 
should be `requestID` (golint)
   pulsar/internal/connection.go:66:2: const `connectionTcpConnected` should be 
`connectionTCPConnected` (golint)
   pulsar/internal/connection.go:95:2: struct field `requestIdGenerator` should 
be `requestIDGenerator` (golint)
   pulsar/internal/connection.go:348:34: method parameter `requestId` should be 
`requestID` (golint)
   pulsar/internal/connection.go:361:37: method parameter `requestId` should be 
`requestID` (golint)
   pulsar/internal/connection.go:374:2: var `producerId` should be `producerID` 
(golint)
   pulsar/internal/connection.go:448:22: method newRequestId should be 
newRequestID (golint)
   pulsar/internal/connection.go:452:22: method getTlsConfig should be 
getTLSConfig (golint)
   pulsar/internal/connection_pool.go:58:10: if block ends with a return 
statement, so drop this else and outdent its block (move short variable 
declaration to its own line if necessary) (golint)
   pulsar/internal/connection_pool.go:75:9: if block ends with a return 
statement, so drop this else and outdent its block (move short variable 
declaration to its own line if necessary) (golint)
   pulsar/internal/lookup_service.go:42:2: struct field `serviceUrl` should be 
`serviceURL` (golint)
   pulsar/internal/lookup_service.go:45:44: func parameter `serviceUrl` should 
be `serviceURL` (golint)
   pulsar/internal/lookup_service.go:127:16: should replace 
`errors.New(fmt.Sprintf(...))` with `fmt.Errorf(...)` (golint)
   pulsar/internal/lookup_service_test.go:30:6: type `mockedRpcClient` should 
be `mockedRPCClient` (golint)
   ```
   
   #### Steps to reproduce
   
   Install `golangci-lint` and run `golangci-lint run`
   
   #### System configuration
   **Pulsar version**: latest
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to