Skip to content

Commit

Permalink
enabled ineffassign in golangci
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinier Schoof committed Jan 17, 2022
1 parent 1b39835 commit c198b01
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ linters:
- unconvert
- whitespace
- govet
- ineffassign
# ToDo:
#- gosimple
#- ineffassign
#- gocritic
#- golint
linters-settings:
Expand Down
3 changes: 1 addition & 2 deletions client/resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ func (c *Conn) handleOKPacket(data []byte) (*Result, error) {

//todo:strict_mode, check warnings as error
r.Warnings = binary.LittleEndian.Uint16(data[pos:])
pos += 2
} else if c.capability&CLIENT_TRANSACTIONS > 0 {
r.Status = binary.LittleEndian.Uint16(data[pos:])
c.status = r.Status
pos += 2
}

//new ok package will check CLIENT_SESSION_TRACK too, but I don't support it now.
// pos += 2

//skip info
return r, nil
Expand Down
2 changes: 1 addition & 1 deletion client/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (c *Conn) Prepare(query string) (*Stmt, error) {

//warnings
s.warnings = int(binary.LittleEndian.Uint16(data[pos:]))
pos += 2
// pos += 2

if s.params > 0 {
if err := s.conn.readUntilEOF(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (t *mysqlTestSuite) TestMysqlGTIDInterval(c *check.C) {

i, err = parseInterval("1-2")
c.Assert(err, check.IsNil)
c.Assert(i, check.DeepEquals, Interval{1, 3})
}

func (t *mysqlTestSuite) TestMysqlGTIDIntervalSlice(c *check.C) {
Expand Down
2 changes: 1 addition & 1 deletion mysql/rowdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (p RowData) ParseText(f []*Field, dst []FieldValue) ([]FieldValue, error) {
var v []byte
var isNull bool
var pos int = 0
var n int = 0
var n int

for i := range f {
v, isNull, n, err = LengthEncodedString(p[pos:])
Expand Down
4 changes: 2 additions & 2 deletions replication/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (h *EventHeader) Decode(data []byte) error {
pos += 4

h.Flags = binary.LittleEndian.Uint16(data[pos:])
pos += 2
// pos += 2

if h.EventSize < uint32(EventHeaderSize) {
return errors.Errorf("invalid event size %d, must >= 19", h.EventSize)
Expand Down Expand Up @@ -420,7 +420,7 @@ func (e *GTIDEvent) Decode(data []byte) error {
// If the most significant bit set, another 4 byte follows representing OriginalServerVersion
e.ImmediateServerVersion &= ^(uint32(1) << 31)
e.OriginalServerVersion = binary.LittleEndian.Uint32(data[pos:])
pos += 4
// pos += 4
} else {
// Otherwise OriginalServerVersion == ImmediateServerVersion
e.OriginalServerVersion = e.ImmediateServerVersion
Expand Down
2 changes: 0 additions & 2 deletions replication/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ func (t *testSyncerSuite) testSync(c *C, s *BinlogStreamer) {
return
}

eventCount := 0
for {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
e, err := s.GetEvent(ctx)
cancel()

if err == context.DeadlineExceeded {
eventCount += 1
return
}

Expand Down
2 changes: 1 addition & 1 deletion server/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (c *Conn) bindStmtArgs(s *Stmt, nullBitmap, paramTypes, paramValues []byte)
pos := 0

var v []byte
var n int = 0
var n int
var isNull bool
var err error

Expand Down

0 comments on commit c198b01

Please sign in to comment.