Signed-off-by: wgliang <liangcszzu@163.com>
| ... | ... |
@@ -181,7 +181,7 @@ type ImageBuildOptions struct {
|
| 181 | 181 |
SessionID string |
| 182 | 182 |
|
| 183 | 183 |
// TODO @jhowardmsft LCOW Support: This will require extending to include |
| 184 |
- // `Platform string`, but is ommited for now as it's hard-coded temporarily |
|
| 184 |
+ // `Platform string`, but is omitted for now as it's hard-coded temporarily |
|
| 185 | 185 |
// to avoid API changes. |
| 186 | 186 |
} |
| 187 | 187 |
|
| ... | ... |
@@ -168,7 +168,7 @@ func (daemon *Daemon) containerAttach(c *container.Container, cfg *stream.Attach |
| 168 | 168 |
// Wait for the container to stop before returning. |
| 169 | 169 |
waitChan := c.Wait(context.Background(), container.WaitConditionNotRunning) |
| 170 | 170 |
defer func() {
|
| 171 |
- _ = <-waitChan // Ignore returned exit code. |
|
| 171 |
+ <-waitChan // Ignore returned exit code. |
|
| 172 | 172 |
}() |
| 173 | 173 |
} |
| 174 | 174 |
|
| ... | ... |
@@ -860,7 +860,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
| 860 | 860 |
|
| 861 | 861 |
// Wait without timeout for the container to exit. |
| 862 | 862 |
// Ignore the result. |
| 863 |
- _ = <-c.Wait(context.Background(), container.WaitConditionNotRunning) |
|
| 863 |
+ <-c.Wait(context.Background(), container.WaitConditionNotRunning) |
|
| 864 | 864 |
return nil |
| 865 | 865 |
} |
| 866 | 866 |
|
| ... | ... |
@@ -61,7 +61,7 @@ func checkFile(drv graphdriver.Driver, layer, filename string, content []byte) e |
| 61 | 61 |
return err |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
- if bytes.Compare(fileContent, content) != 0 {
|
|
| 64 |
+ if !bytes.Equal(fileContent, content) {
|
|
| 65 | 65 |
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
| 66 | 66 |
} |
| 67 | 67 |
|
| ... | ... |
@@ -211,7 +211,7 @@ func checkManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) |
| 211 | 211 |
|
| 212 | 212 |
content := randomContent(64, seed+int64(i+j)) |
| 213 | 213 |
|
| 214 |
- if bytes.Compare(fileContent, content) != 0 {
|
|
| 214 |
+ if !bytes.Equal(fileContent, content) {
|
|
| 215 | 215 |
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
| 216 | 216 |
} |
| 217 | 217 |
} |
| ... | ... |
@@ -300,7 +300,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
| 300 | 300 |
return err |
| 301 | 301 |
} |
| 302 | 302 |
|
| 303 |
- if bytes.Compare(layerIDBytes, []byte(layer)) != 0 {
|
|
| 303 |
+ if !bytes.Equal(layerIDBytes, []byte(layer)) {
|
|
| 304 | 304 |
return fmt.Errorf("mismatched file content %v, expecting %v", layerIDBytes, []byte(layer))
|
| 305 | 305 |
} |
| 306 | 306 |
|
| ... | ... |
@@ -311,7 +311,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
| 311 | 311 |
if err != nil {
|
| 312 | 312 |
return err |
| 313 | 313 |
} |
| 314 |
- if bytes.Compare(thisLayerIDBytes, layerIDBytes) != 0 {
|
|
| 314 |
+ if !bytes.Equal(thisLayerIDBytes, layerIDBytes) {
|
|
| 315 | 315 |
return fmt.Errorf("mismatched file content %v, expecting %v", thisLayerIDBytes, layerIDBytes)
|
| 316 | 316 |
} |
| 317 | 317 |
layerIDBytes, err = ioutil.ReadFile(path.Join(layerDir, "parent-id")) |
| ... | ... |
@@ -23,33 +23,33 @@ |
| 23 | 23 |
// |
| 24 | 24 |
// * lcow.sandboxsize - Specifies a custom sandbox size in GB for starting a container |
| 25 | 25 |
// -- Possible values: >= default sandbox size (opengcs defined, currently 20) |
| 26 |
-// -- Default if ommitted: 20 |
|
| 26 |
+// -- Default if omitted: 20 |
|
| 27 | 27 |
// |
| 28 | 28 |
// The following options are read by opengcs: |
| 29 | 29 |
// |
| 30 | 30 |
// * lcow.kirdpath - Specifies a custom path to a kernel/initrd pair |
| 31 | 31 |
// -- Possible values: Any local path that is not a mapped drive |
| 32 |
-// -- Default if ommitted: %ProgramFiles%\Linux Containers |
|
| 32 |
+// -- Default if omitted: %ProgramFiles%\Linux Containers |
|
| 33 | 33 |
// |
| 34 | 34 |
// * lcow.kernel - Specifies a custom kernel file located in the `lcow.kirdpath` path |
| 35 | 35 |
// -- Possible values: Any valid filename |
| 36 |
-// -- Default if ommitted: bootx64.efi |
|
| 36 |
+// -- Default if omitted: bootx64.efi |
|
| 37 | 37 |
// |
| 38 | 38 |
// * lcow.initrd - Specifies a custom initrd file located in the `lcow.kirdpath` path |
| 39 | 39 |
// -- Possible values: Any valid filename |
| 40 |
-// -- Default if ommitted: initrd.img |
|
| 40 |
+// -- Default if omitted: initrd.img |
|
| 41 | 41 |
// |
| 42 | 42 |
// * lcow.bootparameters - Specifies additional boot parameters for booting in kernel+initrd mode |
| 43 | 43 |
// -- Possible values: Any valid linux kernel boot options |
| 44 |
-// -- Default if ommitted: <nil> |
|
| 44 |
+// -- Default if omitted: <nil> |
|
| 45 | 45 |
// |
| 46 | 46 |
// * lcow.vhdx - Specifies a custom vhdx file to boot (instead of a kernel+initrd) |
| 47 | 47 |
// -- Possible values: Any valid filename |
| 48 |
-// -- Default if ommitted: uvm.vhdx under `lcow.kirdpath` |
|
| 48 |
+// -- Default if omitted: uvm.vhdx under `lcow.kirdpath` |
|
| 49 | 49 |
// |
| 50 | 50 |
// * lcow.timeout - Specifies a timeout for utility VM operations in seconds |
| 51 | 51 |
// -- Possible values: >=0 |
| 52 |
-// -- Default if ommitted: 300 |
|
| 52 |
+// -- Default if omitted: 300 |
|
| 53 | 53 |
|
| 54 | 54 |
// TODO: Grab logs from SVM at terminate or errors |
| 55 | 55 |
|
| ... | ... |
@@ -836,7 +836,7 @@ func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) {
|
| 836 | 836 |
ci.Unlock() |
| 837 | 837 |
|
| 838 | 838 |
// Start the SVM with a mapped virtual disk. Note that if the SVM is |
| 839 |
- // already runing and we are in global mode, this will be |
|
| 839 |
+ // already running and we are in global mode, this will be |
|
| 840 | 840 |
// hot-added. |
| 841 | 841 |
mvd := &hcsshim.MappedVirtualDisk{
|
| 842 | 842 |
HostPath: ci.hostPath, |
| ... | ... |
@@ -160,7 +160,7 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
|
| 160 | 160 |
|
| 161 | 161 |
// Wait for exit with no timeout. |
| 162 | 162 |
// Ignore returned status. |
| 163 |
- _ = <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning) |
|
| 163 |
+ <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning) |
|
| 164 | 164 |
|
| 165 | 165 |
return nil |
| 166 | 166 |
} |
| ... | ... |
@@ -78,7 +78,7 @@ func (daemon *Daemon) containerStop(container *containerpkg.Container, seconds i |
| 78 | 78 |
// 3. If it doesn't, then send SIGKILL |
| 79 | 79 |
if err := daemon.Kill(container); err != nil {
|
| 80 | 80 |
// Wait without a timeout, ignore result. |
| 81 |
- _ = <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning) |
|
| 81 |
+ <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning) |
|
| 82 | 82 |
logrus.Warn(err) // Don't return error because we only care that container is stopped, not what function stopped it |
| 83 | 83 |
} |
| 84 | 84 |
} |
| ... | ... |
@@ -73,14 +73,14 @@ func executeTests(funkerName string, testChunks [][]string) error {
|
| 73 | 73 |
} |
| 74 | 74 |
log.Printf("Finished chunk %d [%d/%d] with %d test filters in %s, code=%d.",
|
| 75 | 75 |
chunkID, passed+failed, len(testChunks), len(tests), |
| 76 |
- time.Now().Sub(chunkBegin), result.Code) |
|
| 76 |
+ time.Since(chunkBegin), result.Code) |
|
| 77 | 77 |
} |
| 78 | 78 |
}(chunkID, tests) |
| 79 | 79 |
} |
| 80 | 80 |
wg.Wait() |
| 81 | 81 |
// TODO: print actual tests rather than chunks |
| 82 | 82 |
log.Printf("Executed %d chunks in %s. PASS: %d, FAIL: %d.",
|
| 83 |
- len(testChunks), time.Now().Sub(begin), passed, failed) |
|
| 83 |
+ len(testChunks), time.Since(begin), passed, failed) |
|
| 84 | 84 |
if failed > 0 {
|
| 85 | 85 |
return fmt.Errorf("%d chunks failed", failed)
|
| 86 | 86 |
} |
| ... | ... |
@@ -103,7 +103,7 @@ func executeTestChunk(funkerName string, args types.Args) (types.Result, error) |
| 103 | 103 |
|
| 104 | 104 |
func executeTestChunkWithRetry(funkerName string, args types.Args) (types.Result, error) {
|
| 105 | 105 |
begin := time.Now() |
| 106 |
- for i := 0; time.Now().Sub(begin) < funkerRetryTimeout; i++ {
|
|
| 106 |
+ for i := 0; time.Since(begin) < funkerRetryTimeout; i++ {
|
|
| 107 | 107 |
result, err := executeTestChunk(funkerName, args) |
| 108 | 108 |
if err == nil {
|
| 109 | 109 |
log.Printf("executeTestChunk(%q, %d) returned code %d in trial %d", funkerName, args.ChunkID, result.Code, i)
|
| ... | ... |
@@ -58,7 +58,7 @@ func handle(workerImageDigest string, executor testChunkExecutor) error {
|
| 58 | 58 |
RawLog: rawLog, |
| 59 | 59 |
} |
| 60 | 60 |
} |
| 61 |
- elapsed := time.Now().Sub(begin) |
|
| 61 |
+ elapsed := time.Since(begin) |
|
| 62 | 62 |
log.Printf("Finished chunk %d, code=%d, elapsed=%v", args.ChunkID, code, elapsed)
|
| 63 | 63 |
return types.Result{
|
| 64 | 64 |
ChunkID: args.ChunkID, |
| ... | ... |
@@ -193,9 +193,7 @@ func runDockerCp(c *check.C, src, dst string, params []string) (err error) {
|
| 193 | 193 |
|
| 194 | 194 |
args := []string{"cp"}
|
| 195 | 195 |
|
| 196 |
- for _, param := range params {
|
|
| 197 |
- args = append(args, param) |
|
| 198 |
- } |
|
| 196 |
+ args = append(args, params...) |
|
| 199 | 197 |
|
| 200 | 198 |
args = append(args, src, dst) |
| 201 | 199 |
|
| ... | ... |
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
| 36 | 36 |
// List of available time formats to --since |
| 37 | 37 |
unixTs := func(t time.Time) string { return fmt.Sprintf("%v", t.Unix()) }
|
| 38 | 38 |
rfc3339 := func(t time.Time) string { return t.Format(time.RFC3339) }
|
| 39 |
- duration := func(t time.Time) string { return time.Now().Sub(t).String() }
|
|
| 39 |
+ duration := func(t time.Time) string { return time.Since(t).String() }
|
|
| 40 | 40 |
|
| 41 | 41 |
// --since=$start must contain only the 'untag' event |
| 42 | 42 |
for _, f := range []func(time.Time) string{unixTs, rfc3339, duration} {
|
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 | 14 |
// DevmapperLogger defines methods required to register as a callback for |
| 15 |
-// logging events recieved from devicemapper. Note that devicemapper will send |
|
| 15 |
+// logging events received from devicemapper. Note that devicemapper will send |
|
| 16 | 16 |
// *all* logs regardless to callbacks (including debug logs) so it's |
| 17 | 17 |
// recommended to not spam the console with the outputs. |
| 18 | 18 |
type DevmapperLogger interface {
|