Skip to content

enabled ineffassign in golangci #666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions client/resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (c *Conn) handleOKPacket(data []byte) (*Result, error) {

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

//new ok package will check CLIENT_SESSION_TRACK too, but I don't support it now.
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
3 changes: 0 additions & 3 deletions mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ func (t *mysqlTestSuite) TestMysqlGTIDInterval(c *check.C) {
i, err = parseInterval("1-1")
c.Assert(err, check.IsNil)
c.Assert(i, check.DeepEquals, Interval{1, 2})

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

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