-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: tidy code && prealloc some slice for performance #13468
Conversation
cmd/explaintest/main.go
Outdated
@@ -140,11 +140,11 @@ LOOP: | |||
break LOOP | |||
default: | |||
if strings.HasPrefix(s, "--error") { | |||
t.expectedErrs = strings.Split(strings.TrimSpace(strings.TrimLeft(s, "--error")), ",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TrimLeft returns a slice of the string s with all leading
// Unicode code points contained in cutset removed.
//
// To remove a prefix, use TrimPrefix instead.
As the context (HasPrefix
) , I think we should use TrimPrefix
ddl/db_test.go
Outdated
@@ -3606,7 +3606,7 @@ func (s *testDBSuite2) TestTablesLockDelayClean(c *C) { | |||
tk.Se.Close() | |||
wg.Done() | |||
}() | |||
time.Sleep(50) | |||
time.Sleep(50 * time.Nanosecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time.Sleep(50)
is puzzled, we should add the unit.
@@ -225,7 +225,7 @@ func TestSyncerSimple(t *testing.T) { | |||
} | |||
|
|||
func isTimeoutError(err error) bool { | |||
if terror.ErrorEqual(err, goctx.DeadlineExceeded) || grpc.Code(errors.Cause(err)) == codes.DeadlineExceeded || | |||
if terror.ErrorEqual(err, goctx.DeadlineExceeded) || status.Code(errors.Cause(err)) == codes.DeadlineExceeded || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code returns the error code for err if it was produced by the rpc system. Otherwise, it returns codes.Unknown.
Deprecated: use status.Code instead.
Codecov Report
@@ Coverage Diff @@
## master #13468 +/- ##
===========================================
Coverage ? 80.0788%
===========================================
Files ? 473
Lines ? 116620
Branches ? 0
===========================================
Hits ? 93388
Misses ? 15888
Partials ? 7344 |
BTW, this PR is conflicted with the master branch, please resolve the conflicts in your spare time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/merge |
/run-all-tests |
What problem does this PR solve?
Tests
This change is