Skip to content

Commit 6798d09

Browse files
committed
chore: use gofumpt to tidyup formatting
gofumpt is a stricter but compatible gofmt: https://github.com/mvdan/gofumpt Run it across the repo just to tidy things up a little more.
1 parent 1aac8e5 commit 6798d09

File tree

98 files changed

+690
-624
lines changed

Some content is hidden

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

98 files changed

+690
-624
lines changed

acl_bindings.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//Resource holds information about acl resource type
3+
// Resource holds information about acl resource type
44
type Resource struct {
55
ResourceType AclResourceType
66
ResourceName string
@@ -46,7 +46,7 @@ func (r *Resource) decode(pd packetDecoder, version int16) (err error) {
4646
return nil
4747
}
4848

49-
//Acl holds information about acl type
49+
// Acl holds information about acl type
5050
type Acl struct {
5151
Principal string
5252
Host string
@@ -93,7 +93,7 @@ func (a *Acl) decode(pd packetDecoder, version int16) (err error) {
9393
return nil
9494
}
9595

96-
//ResourceAcls is an acl resource type
96+
// ResourceAcls is an acl resource type
9797
type ResourceAcls struct {
9898
Resource
9999
Acls []*Acl

acl_create_request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//CreateAclsRequest is an acl creation request
3+
// CreateAclsRequest is an acl creation request
44
type CreateAclsRequest struct {
55
Version int16
66
AclCreations []*AclCreation
@@ -60,7 +60,7 @@ func (c *CreateAclsRequest) requiredVersion() KafkaVersion {
6060
}
6161
}
6262

63-
//AclCreation is a wrapper around Resource and Acl type
63+
// AclCreation is a wrapper around Resource and Acl type
6464
type AclCreation struct {
6565
Resource
6666
Acl

acl_create_request_test.go

+25-21
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ var (
2727
func TestCreateAclsRequestv0(t *testing.T) {
2828
req := &CreateAclsRequest{
2929
Version: 0,
30-
AclCreations: []*AclCreation{{
31-
Resource: Resource{
32-
ResourceType: AclResourceGroup,
33-
ResourceName: "group",
30+
AclCreations: []*AclCreation{
31+
{
32+
Resource: Resource{
33+
ResourceType: AclResourceGroup,
34+
ResourceName: "group",
35+
},
36+
Acl: Acl{
37+
Principal: "principal",
38+
Host: "host",
39+
Operation: AclOperationAll,
40+
PermissionType: AclPermissionDeny,
41+
},
3442
},
35-
Acl: Acl{
36-
Principal: "principal",
37-
Host: "host",
38-
Operation: AclOperationAll,
39-
PermissionType: AclPermissionDeny,
40-
}},
4143
},
4244
}
4345

@@ -47,18 +49,20 @@ func TestCreateAclsRequestv0(t *testing.T) {
4749
func TestCreateAclsRequestv1(t *testing.T) {
4850
req := &CreateAclsRequest{
4951
Version: 1,
50-
AclCreations: []*AclCreation{{
51-
Resource: Resource{
52-
ResourceType: AclResourceGroup,
53-
ResourceName: "group",
54-
ResourcePatternType: AclPatternLiteral,
52+
AclCreations: []*AclCreation{
53+
{
54+
Resource: Resource{
55+
ResourceType: AclResourceGroup,
56+
ResourceName: "group",
57+
ResourcePatternType: AclPatternLiteral,
58+
},
59+
Acl: Acl{
60+
Principal: "principal",
61+
Host: "host",
62+
Operation: AclOperationAll,
63+
PermissionType: AclPermissionDeny,
64+
},
5565
},
56-
Acl: Acl{
57-
Principal: "principal",
58-
Host: "host",
59-
Operation: AclOperationAll,
60-
PermissionType: AclPermissionDeny,
61-
}},
6266
},
6367
}
6468

acl_create_response.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package sarama
22

33
import "time"
44

5-
//CreateAclsResponse is a an acl response creation type
5+
// CreateAclsResponse is a an acl response creation type
66
type CreateAclsResponse struct {
77
ThrottleTime time.Duration
88
AclCreationResponses []*AclCreationResponse
@@ -63,7 +63,7 @@ func (c *CreateAclsResponse) requiredVersion() KafkaVersion {
6363
return V0_11_0_0
6464
}
6565

66-
//AclCreationResponse is an acl creation response type
66+
// AclCreationResponse is an acl creation response type
6767
type AclCreationResponse struct {
6868
Err KError
6969
ErrMsg *string

acl_delete_request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//DeleteAclsRequest is a delete acl request
3+
// DeleteAclsRequest is a delete acl request
44
type DeleteAclsRequest struct {
55
Version int
66
Filters []*AclFilter

acl_delete_response.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package sarama
22

33
import "time"
44

5-
//DeleteAclsResponse is a delete acl response
5+
// DeleteAclsResponse is a delete acl response
66
type DeleteAclsResponse struct {
77
Version int16
88
ThrottleTime time.Duration
@@ -64,7 +64,7 @@ func (d *DeleteAclsResponse) requiredVersion() KafkaVersion {
6464
return V0_11_0_0
6565
}
6666

67-
//FilterResponse is a filter response type
67+
// FilterResponse is a filter response type
6868
type FilterResponse struct {
6969
Err KError
7070
ErrMsg *string
@@ -115,7 +115,7 @@ func (f *FilterResponse) decode(pd packetDecoder, version int16) (err error) {
115115
return nil
116116
}
117117

118-
//MatchingAcl is a matching acl type
118+
// MatchingAcl is a matching acl type
119119
type MatchingAcl struct {
120120
Err KError
121121
ErrMsg *string

acl_delete_response_test.go

+15-17
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,21 @@ import (
55
"time"
66
)
77

8-
var (
9-
deleteAclsResponse = []byte{
10-
0, 0, 0, 100,
11-
0, 0, 0, 1,
12-
0, 0, // no error
13-
255, 255, // no error message
14-
0, 0, 0, 1, // 1 matching acl
15-
0, 0, // no error
16-
255, 255, // no error message
17-
2, // resource type
18-
0, 5, 't', 'o', 'p', 'i', 'c',
19-
0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
20-
0, 4, 'h', 'o', 's', 't',
21-
4,
22-
3,
23-
}
24-
)
8+
var deleteAclsResponse = []byte{
9+
0, 0, 0, 100,
10+
0, 0, 0, 1,
11+
0, 0, // no error
12+
255, 255, // no error message
13+
0, 0, 0, 1, // 1 matching acl
14+
0, 0, // no error
15+
255, 255, // no error message
16+
2, // resource type
17+
0, 5, 't', 'o', 'p', 'i', 'c',
18+
0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
19+
0, 4, 'h', 'o', 's', 't',
20+
4,
21+
3,
22+
}
2523

2624
func TestDeleteAclsResponse(t *testing.T) {
2725
resp := &DeleteAclsResponse{

acl_describe_request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//DescribeAclsRequest is a secribe acl request type
3+
// DescribeAclsRequest is a secribe acl request type
44
type DescribeAclsRequest struct {
55
Version int
66
AclFilter

acl_describe_response.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package sarama
22

33
import "time"
44

5-
//DescribeAclsResponse is a describe acl response type
5+
// DescribeAclsResponse is a describe acl response type
66
type DescribeAclsResponse struct {
77
Version int16
88
ThrottleTime time.Duration

acl_filter.go

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func (a *AclFilter) decode(pd packetDecoder, version int16) (err error) {
4646

4747
if a.Version == 1 {
4848
pattern, err := pd.getInt8()
49-
5049
if err != nil {
5150
return err
5251
}

acl_types.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ func (a *AclOperation) String() string {
5555
return s
5656
}
5757

58-
//MarshalText returns the text form of the AclOperation (name without prefix)
58+
// MarshalText returns the text form of the AclOperation (name without prefix)
5959
func (a *AclOperation) MarshalText() ([]byte, error) {
6060
return []byte(a.String()), nil
6161
}
6262

63-
//UnmarshalText takes a text reprentation of the operation and converts it to an AclOperation
63+
// UnmarshalText takes a text reprentation of the operation and converts it to an AclOperation
6464
func (a *AclOperation) UnmarshalText(text []byte) error {
6565
normalized := strings.ToLower(string(text))
6666
mapping := map[string]AclOperation{
@@ -109,12 +109,12 @@ func (a *AclPermissionType) String() string {
109109
return s
110110
}
111111

112-
//MarshalText returns the text form of the AclPermissionType (name without prefix)
112+
// MarshalText returns the text form of the AclPermissionType (name without prefix)
113113
func (a *AclPermissionType) MarshalText() ([]byte, error) {
114114
return []byte(a.String()), nil
115115
}
116116

117-
//UnmarshalText takes a text reprentation of the permission type and converts it to an AclPermissionType
117+
// UnmarshalText takes a text reprentation of the permission type and converts it to an AclPermissionType
118118
func (a *AclPermissionType) UnmarshalText(text []byte) error {
119119
normalized := strings.ToLower(string(text))
120120
mapping := map[string]AclPermissionType{
@@ -159,12 +159,12 @@ func (a *AclResourceType) String() string {
159159
return s
160160
}
161161

162-
//MarshalText returns the text form of the AclResourceType (name without prefix)
162+
// MarshalText returns the text form of the AclResourceType (name without prefix)
163163
func (a *AclResourceType) MarshalText() ([]byte, error) {
164164
return []byte(a.String()), nil
165165
}
166166

167-
//UnmarshalText takes a text reprentation of the resource type and converts it to an AclResourceType
167+
// UnmarshalText takes a text reprentation of the resource type and converts it to an AclResourceType
168168
func (a *AclResourceType) UnmarshalText(text []byte) error {
169169
normalized := strings.ToLower(string(text))
170170
mapping := map[string]AclResourceType{
@@ -209,12 +209,12 @@ func (a *AclResourcePatternType) String() string {
209209
return s
210210
}
211211

212-
//MarshalText returns the text form of the AclResourcePatternType (name without prefix)
212+
// MarshalText returns the text form of the AclResourcePatternType (name without prefix)
213213
func (a *AclResourcePatternType) MarshalText() ([]byte, error) {
214214
return []byte(a.String()), nil
215215
}
216216

217-
//UnmarshalText takes a text reprentation of the resource pattern type and converts it to an AclResourcePatternType
217+
// UnmarshalText takes a text reprentation of the resource pattern type and converts it to an AclResourcePatternType
218218
func (a *AclResourcePatternType) UnmarshalText(text []byte) error {
219219
normalized := strings.ToLower(string(text))
220220
mapping := map[string]AclResourcePatternType{

acl_types_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestAclPermissionTypeTextMarshal(t *testing.T) {
3737
}
3838
}
3939
}
40+
4041
func TestAclResourceTypeTextMarshal(t *testing.T) {
4142
for i := AclResourceUnknown; i <= AclResourceTransactionalID; i++ {
4243
text, err := i.MarshalText()
@@ -53,6 +54,7 @@ func TestAclResourceTypeTextMarshal(t *testing.T) {
5354
}
5455
}
5556
}
57+
5658
func TestAclResourcePatternTypeTextMarshal(t *testing.T) {
5759
for i := AclPatternUnknown; i <= AclPatternPrefixed; i++ {
5860
text, err := i.MarshalText()

add_offsets_to_txn_request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//AddOffsetsToTxnRequest adds offsets to a transaction request
3+
// AddOffsetsToTxnRequest adds offsets to a transaction request
44
type AddOffsetsToTxnRequest struct {
55
TransactionalID string
66
ProducerID int64

add_offsets_to_txn_request_test.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ package sarama
22

33
import "testing"
44

5-
var (
6-
addOffsetsToTxnRequest = []byte{
7-
0, 3, 't', 'x', 'n',
8-
0, 0, 0, 0, 0, 0, 31, 64,
9-
0, 0,
10-
0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd',
11-
}
12-
)
5+
var addOffsetsToTxnRequest = []byte{
6+
0, 3, 't', 'x', 'n',
7+
0, 0, 0, 0, 0, 0, 31, 64,
8+
0, 0,
9+
0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd',
10+
}
1311

1412
func TestAddOffsetsToTxnRequest(t *testing.T) {
1513
req := &AddOffsetsToTxnRequest{

add_offsets_to_txn_response.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"time"
55
)
66

7-
//AddOffsetsToTxnResponse is a response type for adding offsets to txns
7+
// AddOffsetsToTxnResponse is a response type for adding offsets to txns
88
type AddOffsetsToTxnResponse struct {
99
ThrottleTime time.Duration
1010
Err KError

add_offsets_to_txn_response_test.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import (
55
"time"
66
)
77

8-
var (
9-
addOffsetsToTxnResponse = []byte{
10-
0, 0, 0, 100,
11-
0, 47,
12-
}
13-
)
8+
var addOffsetsToTxnResponse = []byte{
9+
0, 0, 0, 100,
10+
0, 47,
11+
}
1412

1513
func TestAddOffsetsToTxnResponse(t *testing.T) {
1614
resp := &AddOffsetsToTxnResponse{

add_partitions_to_txn_request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sarama
22

3-
//AddPartitionsToTxnRequest is a add paartition request
3+
// AddPartitionsToTxnRequest is a add paartition request
44
type AddPartitionsToTxnRequest struct {
55
TransactionalID string
66
ProducerID int64

add_partitions_to_txn_request_test.go

+8-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ package sarama
22

33
import "testing"
44

5-
var (
6-
addPartitionsToTxnRequest = []byte{
7-
0, 3, 't', 'x', 'n',
8-
0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
9-
0, 0, 0, 0, // ProducerEpoch
10-
0, 1, // 1 topic
11-
0, 5, 't', 'o', 'p', 'i', 'c',
12-
0, 0, 0, 1, 0, 0, 0, 1,
13-
}
14-
)
5+
var addPartitionsToTxnRequest = []byte{
6+
0, 3, 't', 'x', 'n',
7+
0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
8+
0, 0, 0, 0, // ProducerEpoch
9+
0, 1, // 1 topic
10+
0, 5, 't', 'o', 'p', 'i', 'c',
11+
0, 0, 0, 1, 0, 0, 0, 1,
12+
}
1513

1614
func TestAddPartitionsToTxnRequest(t *testing.T) {
1715
req := &AddPartitionsToTxnRequest{

0 commit comments

Comments
 (0)