зеркало из https://github.com/github/vitess-gh.git
Fix errchecks in a few places
Signed-off-by: Andrew Mason <amason@slack-corp.com>
This commit is contained in:
Родитель
b803b28a37
Коммит
fd8edfd1ff
|
@ -19,7 +19,7 @@ func TestMain(m *testing.M) {
|
|||
wordlist1 = make([][]byte, n)
|
||||
for i := range wordlist1 {
|
||||
b := make([]byte, 32)
|
||||
rand.Read(b)
|
||||
_, _ = rand.Read(b)
|
||||
wordlist1[i] = b
|
||||
}
|
||||
fmt.Println("\n###############\nbbloom_test.go")
|
||||
|
|
|
@ -179,7 +179,7 @@ func (logger *StreamLogger) LogToFile(path string, logf LogFormatter) (chan inte
|
|||
for {
|
||||
select {
|
||||
case record := <-logChan:
|
||||
logf(f, formatParams, record)
|
||||
logf(f, formatParams, record) // nolint:errcheck
|
||||
case <-rotateChan:
|
||||
f.Close()
|
||||
f, _ = os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
||||
|
|
|
@ -235,7 +235,7 @@ func TestFile(t *testing.T) {
|
|||
|
||||
// Send the rotate signal which should reopen the original file path
|
||||
// for new logs to go to
|
||||
syscall.Kill(syscall.Getpid(), syscall.SIGUSR2)
|
||||
_ = syscall.Kill(syscall.Getpid(), syscall.SIGUSR2)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
logger.Send(&logMessage{"test 4"})
|
||||
|
|
|
@ -58,7 +58,7 @@ func TestTablesFilterPass(t *testing.T) {
|
|||
got = bltToString(reply)
|
||||
return nil
|
||||
})
|
||||
f(eventToken, statements)
|
||||
_ = f(eventToken, statements)
|
||||
want := `statement: <6, "set1"> statement: <7, "dml1 /* _stream included1 (id ) (500 ); */"> statement: <7, "dml2 /* _stream included2 (id ) (500 ); */"> position: "MariaDB/0-41983-1" `
|
||||
if want != got {
|
||||
t.Errorf("want\n%s, got\n%s", want, got)
|
||||
|
@ -88,7 +88,7 @@ func TestTablesFilterSkip(t *testing.T) {
|
|||
got = bltToString(reply)
|
||||
return nil
|
||||
})
|
||||
f(eventToken, statements)
|
||||
_ = f(eventToken, statements)
|
||||
want := `position: "MariaDB/0-41983-1" `
|
||||
if want != got {
|
||||
t.Errorf("want %s, got %s", want, got)
|
||||
|
@ -118,7 +118,7 @@ func TestTablesFilterDDL(t *testing.T) {
|
|||
got = bltToString(reply)
|
||||
return nil
|
||||
})
|
||||
f(eventToken, statements)
|
||||
_ = f(eventToken, statements)
|
||||
want := `position: "MariaDB/0-41983-1" `
|
||||
if want != got {
|
||||
t.Errorf("want %s, got %s", want, got)
|
||||
|
@ -154,7 +154,7 @@ func TestTablesFilterMalformed(t *testing.T) {
|
|||
got = bltToString(reply)
|
||||
return nil
|
||||
})
|
||||
f(eventToken, statements)
|
||||
_ = f(eventToken, statements)
|
||||
want := `position: "MariaDB/0-41983-1" `
|
||||
if want != got {
|
||||
t.Errorf("want %s, got %s", want, got)
|
||||
|
|
|
@ -283,7 +283,7 @@ func hupTest(t *testing.T, tmpFile *os.File, oldStr, newStr string) {
|
|||
if pass != oldStr {
|
||||
t.Fatalf("%s's Password should still be '%s'", oldStr, oldStr)
|
||||
}
|
||||
syscall.Kill(syscall.Getpid(), syscall.SIGHUP)
|
||||
_ = syscall.Kill(syscall.Getpid(), syscall.SIGHUP)
|
||||
time.Sleep(100 * time.Millisecond) // wait for signal handler
|
||||
_, _, err := cs.GetUserAndPassword(oldStr)
|
||||
if err != ErrUnknownUser {
|
||||
|
|
|
@ -791,7 +791,7 @@ func TestGetSchema(t *testing.T) {
|
|||
err := c.Vtctld.Dial(ctx)
|
||||
require.NoError(t, err, "could not dial test vtctld")
|
||||
|
||||
c.GetSchema(ctx, "testkeyspace", cluster.GetSchemaOptions{
|
||||
_, _ = c.GetSchema(ctx, "testkeyspace", cluster.GetSchemaOptions{
|
||||
BaseRequest: req,
|
||||
Tablets: []*vtadminpb.Tablet{tablet},
|
||||
})
|
||||
|
|
|
@ -382,7 +382,7 @@ func (svss *SysVarSetAware) Execute(vcursor VCursor, env evalengine.ExpressionEn
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
vcursor.Session().SetSQLSelectLimit(intValue)
|
||||
vcursor.Session().SetSQLSelectLimit(intValue) // nolint:errcheck
|
||||
case sysvars.TransactionMode.Name:
|
||||
str, err := svss.evalAsString(env)
|
||||
if err != nil {
|
||||
|
|
|
@ -72,7 +72,7 @@ func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.
|
|||
// the healthcheck module.
|
||||
func (q *StreamHealthQueryService) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error {
|
||||
for shr := range q.healthResponses {
|
||||
callback(shr)
|
||||
callback(shr) // nolint:errcheck
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func (tm *TabletManager) ExecuteFetchAsDba(ctx context.Context, query []byte, db
|
|||
if dbName != "" {
|
||||
// This execute might fail if db does not exist.
|
||||
// Error is ignored because given query might create this database.
|
||||
conn.ExecuteFetch("USE "+sqlescape.EscapeID(dbName), 1, false)
|
||||
_, _ = conn.ExecuteFetch("USE "+sqlescape.EscapeID(dbName), 1, false)
|
||||
}
|
||||
|
||||
// run the query
|
||||
|
@ -83,7 +83,7 @@ func (tm *TabletManager) ExecuteFetchAsAllPrivs(ctx context.Context, query []byt
|
|||
if dbName != "" {
|
||||
// This execute might fail if db does not exist.
|
||||
// Error is ignored because given query might create this database.
|
||||
conn.ExecuteFetch("USE "+sqlescape.EscapeID(dbName), 1, false)
|
||||
_, _ = conn.ExecuteFetch("USE "+sqlescape.EscapeID(dbName), 1, false)
|
||||
}
|
||||
|
||||
// run the query
|
||||
|
|
|
@ -89,6 +89,6 @@ func (tm *TabletManager) ApplySchema(ctx context.Context, change *tmutils.Schema
|
|||
}
|
||||
|
||||
// and if it worked, reload the schema
|
||||
tm.ReloadSchema(ctx, "")
|
||||
tm.ReloadSchema(ctx, "") // nolint:errcheck
|
||||
return scr, nil
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче