code optimization#1386
Conversation
|
|
||
| .DS_Store | ||
|
|
||
| .idea/ |
There was a problem hiding this comment.
This change is not related. Please remove this change.
| // uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree | ||
| // With GCCGO we need to remove interface information starting from pN<dd>. | ||
| re := regexp.MustCompile("\\.pN\\d+_") | ||
| re := regexp.MustCompile(`\.pN\d+_`) |
There was a problem hiding this comment.
This change is not needed. This is just a quotes changes. While I agree that it improves redability, it has nothing to do in a MR that claims "code optimization". Please make a separate MR.
| for i := 0; i < len(expected); i++ { | ||
| arr[i] = expected[i] | ||
| } | ||
| copy(arr, expected) |
There was a problem hiding this comment.
Better:
// Clone expected into arr
arr := append(([]interface{})(nil), expected)
|
|
||
| require.Equal(t, 1, len(tcl.errs)) | ||
| assert.Regexp(t, regexp.MustCompile("(?s)FAIL: 0 out of 1 expectation\\(s\\) were met.*The code you are testing needs to make 1 more call\\(s\\).*"), tcl.errs[0]) | ||
| assert.Regexp(t, regexp.MustCompile(`(?s)FAIL: 0 out of 1 expectation\(s\) were met.*The code you are testing needs to make 1 more call\(s\).*`), tcl.errs[0]) |
There was a problem hiding this comment.
This changes quoting. This is an unrelated change.
| assert.Regexp(t, regexp.MustCompile(`(?s)FAIL: 0 out of 1 expectation\(s\) were met.*The code you are testing needs to make 1 more call\(s\).*`), tcl.errs[0]) | ||
| require.Equal(t, 2, len(tcl.logs)) | ||
| assert.Regexp(t, regexp.MustCompile("(?s)FAIL:\tGetTime\\(int\\).*"), tcl.logs[0]) | ||
| assert.Regexp(t, regexp.MustCompile(`(?s)FAIL:\tGetTime\(int\).*`), tcl.logs[0]) |
There was a problem hiding this comment.
This changes quoting. This is an unrelated change.
| func TestAfterTotalWaitTimeWhileExecution(t *testing.T) { | ||
| waitDuration := 1 | ||
| total, waitMs := 5, time.Millisecond*time.Duration(waitDuration) | ||
| total, wait := 5, time.Millisecond*time.Duration(waitDuration) |
There was a problem hiding this comment.
This changes a variable name. This is an unrelated change. Remove it.
| os.Stdout.Close() | ||
| os.Stdout = sc.oldStdout | ||
| bytes, err := ioutil.ReadAll(sc.readPipe) | ||
| bytes, err := io.ReadAll(sc.readPipe) |
There was a problem hiding this comment.
This change requires Go 1.16. testify is used in a wide range of project. This is not a good thing to force users to upgrade Go while it is not necessary (io/ioutil will stay forever).
|
This PR bundles too many unrelated changes with a misleading title. I recommend @testwill to close it and submit more targetted changes and take more care in the description of the PR. |
io/ioutil deprecated etc.