Преглед на файлове

another commit to do like @crosbymichael

Signed-off-by: Victor Vieux <vieux@docker.com>
Victor Vieux преди 11 години
родител
ревизия
a0392324f1

+ 5 - 5
api/client/commands.go

@@ -434,11 +434,11 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
 	out := engine.NewOutput()
 	out := engine.NewOutput()
 	remoteVersion, err := out.AddEnv()
 	remoteVersion, err := out.AddEnv()
 	if err != nil {
 	if err != nil {
-		log.Errorf("Error reading remote version: %s\n", err)
+		log.Errorf("Error reading remote version: %s", err)
 		return err
 		return err
 	}
 	}
 	if _, err := out.Write(body); err != nil {
 	if _, err := out.Write(body); err != nil {
-		log.Errorf("Error reading remote version: %s\n", err)
+		log.Errorf("Error reading remote version: %s", err)
 		return err
 		return err
 	}
 	}
 	out.Close()
 	out.Close()
@@ -474,7 +474,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 	}
 	}
 
 
 	if _, err := out.Write(body); err != nil {
 	if _, err := out.Write(body); err != nil {
-		log.Errorf("Error reading remote info: %s\n", err)
+		log.Errorf("Error reading remote info: %s", err)
 		return err
 		return err
 	}
 	}
 	out.Close()
 	out.Close()
@@ -691,7 +691,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
 	if *openStdin || *attach {
 	if *openStdin || *attach {
 		if tty && cli.isTerminal {
 		if tty && cli.isTerminal {
 			if err := cli.monitorTtySize(cmd.Arg(0)); err != nil {
 			if err := cli.monitorTtySize(cmd.Arg(0)); err != nil {
-				log.Errorf("Error monitoring TTY size: %s\n", err)
+				log.Errorf("Error monitoring TTY size: %s", err)
 			}
 			}
 		}
 		}
 		return <-cErr
 		return <-cErr
@@ -2159,7 +2159,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
 
 
 	if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminal {
 	if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminal {
 		if err := cli.monitorTtySize(runResult.Get("Id")); err != nil {
 		if err := cli.monitorTtySize(runResult.Get("Id")); err != nil {
-			log.Errorf("Error monitoring TTY size: %s\n", err)
+			log.Errorf("Error monitoring TTY size: %s", err)
 		}
 		}
 	}
 	}
 
 

+ 2 - 2
api/client/hijack.go

@@ -106,11 +106,11 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
 		}
 		}
 		if tcpc, ok := rwc.(*net.TCPConn); ok {
 		if tcpc, ok := rwc.(*net.TCPConn); ok {
 			if err := tcpc.CloseWrite(); err != nil {
 			if err := tcpc.CloseWrite(); err != nil {
-				log.Debugf("Couldn't send EOF: %s\n", err)
+				log.Debugf("Couldn't send EOF: %s", err)
 			}
 			}
 		} else if unixc, ok := rwc.(*net.UnixConn); ok {
 		} else if unixc, ok := rwc.(*net.UnixConn); ok {
 			if err := unixc.CloseWrite(); err != nil {
 			if err := unixc.CloseWrite(); err != nil {
-				log.Debugf("Couldn't send EOF: %s\n", err)
+				log.Debugf("Couldn't send EOF: %s", err)
 			}
 			}
 		}
 		}
 		// Discard errors due to pipe interruption
 		// Discard errors due to pipe interruption

+ 6 - 6
archive/archive.go

@@ -342,7 +342,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
 		for _, include := range options.Includes {
 		for _, include := range options.Includes {
 			filepath.Walk(filepath.Join(srcPath, include), func(filePath string, f os.FileInfo, err error) error {
 			filepath.Walk(filepath.Join(srcPath, include), func(filePath string, f os.FileInfo, err error) error {
 				if err != nil {
 				if err != nil {
-					log.Debugf("Tar: Can't stat file %s to tar: %s\n", srcPath, err)
+					log.Debugf("Tar: Can't stat file %s to tar: %s", srcPath, err)
 					return nil
 					return nil
 				}
 				}
 
 
@@ -353,7 +353,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
 
 
 				skip, err := utils.Matches(relFilePath, options.Excludes)
 				skip, err := utils.Matches(relFilePath, options.Excludes)
 				if err != nil {
 				if err != nil {
-					log.Debugf("Error matching %s\n", relFilePath, err)
+					log.Debugf("Error matching %s", relFilePath, err)
 					return err
 					return err
 				}
 				}
 
 
@@ -365,7 +365,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
 				}
 				}
 
 
 				if err := addTarFile(filePath, relFilePath, tw, twBuf); err != nil {
 				if err := addTarFile(filePath, relFilePath, tw, twBuf); err != nil {
-					log.Debugf("Can't add file %s to tar: %s\n", srcPath, err)
+					log.Debugf("Can't add file %s to tar: %s", srcPath, err)
 				}
 				}
 				return nil
 				return nil
 			})
 			})
@@ -373,13 +373,13 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
 
 
 		// Make sure to check the error on Close.
 		// Make sure to check the error on Close.
 		if err := tw.Close(); err != nil {
 		if err := tw.Close(); err != nil {
-			log.Debugf("Can't close tar writer: %s\n", err)
+			log.Debugf("Can't close tar writer: %s", err)
 		}
 		}
 		if err := compressWriter.Close(); err != nil {
 		if err := compressWriter.Close(); err != nil {
-			log.Debugf("Can't close compress writer: %s\n", err)
+			log.Debugf("Can't close compress writer: %s", err)
 		}
 		}
 		if err := pipeWriter.Close(); err != nil {
 		if err := pipeWriter.Close(); err != nil {
-			log.Debugf("Can't close pipe writer: %s\n", err)
+			log.Debugf("Can't close pipe writer: %s", err)
 		}
 		}
 	}()
 	}()
 
 

+ 3 - 3
archive/changes.go

@@ -364,19 +364,19 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
 					ChangeTime: timestamp,
 					ChangeTime: timestamp,
 				}
 				}
 				if err := tw.WriteHeader(hdr); err != nil {
 				if err := tw.WriteHeader(hdr); err != nil {
-					log.Debugf("Can't write whiteout header: %s\n", err)
+					log.Debugf("Can't write whiteout header: %s", err)
 				}
 				}
 			} else {
 			} else {
 				path := filepath.Join(dir, change.Path)
 				path := filepath.Join(dir, change.Path)
 				if err := addTarFile(path, change.Path[1:], tw, twBuf); err != nil {
 				if err := addTarFile(path, change.Path[1:], tw, twBuf); err != nil {
-					log.Debugf("Can't add file %s to tar: %s\n", path, err)
+					log.Debugf("Can't add file %s to tar: %s", path, err)
 				}
 				}
 			}
 			}
 		}
 		}
 
 
 		// Make sure to check the error on Close.
 		// Make sure to check the error on Close.
 		if err := tw.Close(); err != nil {
 		if err := tw.Close(); err != nil {
-			log.Debugf("Can't close layer: %s\n", err)
+			log.Debugf("Can't close layer: %s", err)
 		}
 		}
 		writer.Close()
 		writer.Close()
 	}()
 	}()

+ 1 - 1
daemon/graphdriver/aufs/aufs.go

@@ -210,7 +210,7 @@ func (a *Driver) Remove(id string) error {
 	defer a.Unlock()
 	defer a.Unlock()
 
 
 	if a.active[id] != 0 {
 	if a.active[id] != 0 {
-		log.Errorf("Warning: removing active id %s\n", id)
+		log.Errorf("Warning: removing active id %s", id)
 	}
 	}
 
 
 	// Make sure the dir is umounted first
 	// Make sure the dir is umounted first

+ 14 - 14
daemon/graphdriver/devmapper/deviceset.go

@@ -596,7 +596,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
 
 
 			data, err := devices.ensureImage("data", devices.dataLoopbackSize)
 			data, err := devices.ensureImage("data", devices.dataLoopbackSize)
 			if err != nil {
 			if err != nil {
-				log.Debugf("Error device ensureImage (data): %s\n", err)
+				log.Debugf("Error device ensureImage (data): %s", err)
 				return err
 				return err
 			}
 			}
 
 
@@ -627,7 +627,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
 
 
 			metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize)
 			metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize)
 			if err != nil {
 			if err != nil {
-				log.Debugf("Error device ensureImage (metadata): %s\n", err)
+				log.Debugf("Error device ensureImage (metadata): %s", err)
 				return err
 				return err
 			}
 			}
 
 
@@ -659,7 +659,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
 	// Setup the base image
 	// Setup the base image
 	if doInit {
 	if doInit {
 		if err := devices.setupBaseImage(); err != nil {
 		if err := devices.setupBaseImage(); err != nil {
-			log.Debugf("Error device setupBaseImage: %s\n", err)
+			log.Debugf("Error device setupBaseImage: %s", err)
 			return err
 			return err
 		}
 		}
 	}
 	}
@@ -686,7 +686,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
 	deviceId := devices.nextDeviceId
 	deviceId := devices.nextDeviceId
 
 
 	if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
 	if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
-		log.Debugf("Error creating snap device: %s\n", err)
+		log.Debugf("Error creating snap device: %s", err)
 		return err
 		return err
 	}
 	}
 
 
@@ -695,7 +695,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
 
 
 	if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil {
 	if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil {
 		deleteDevice(devices.getPoolDevName(), deviceId)
 		deleteDevice(devices.getPoolDevName(), deviceId)
-		log.Debugf("Error registering device: %s\n", err)
+		log.Debugf("Error registering device: %s", err)
 		return err
 		return err
 	}
 	}
 	return nil
 	return nil
@@ -708,7 +708,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
 		// manually
 		// manually
 		if err := devices.activateDeviceIfNeeded(info); err == nil {
 		if err := devices.activateDeviceIfNeeded(info); err == nil {
 			if err := BlockDeviceDiscard(info.DevName()); err != nil {
 			if err := BlockDeviceDiscard(info.DevName()); err != nil {
-				log.Debugf("Error discarding block on device: %s (ignoring)\n", err)
+				log.Debugf("Error discarding block on device: %s (ignoring)", err)
 			}
 			}
 		}
 		}
 	}
 	}
@@ -716,13 +716,13 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
 	devinfo, _ := getInfo(info.Name())
 	devinfo, _ := getInfo(info.Name())
 	if devinfo != nil && devinfo.Exists != 0 {
 	if devinfo != nil && devinfo.Exists != 0 {
 		if err := devices.removeDeviceAndWait(info.Name()); err != nil {
 		if err := devices.removeDeviceAndWait(info.Name()); err != nil {
-			log.Debugf("Error removing device: %s\n", err)
+			log.Debugf("Error removing device: %s", err)
 			return err
 			return err
 		}
 		}
 	}
 	}
 
 
 	if err := deleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
 	if err := deleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
-		log.Debugf("Error deleting device: %s\n", err)
+		log.Debugf("Error deleting device: %s", err)
 		return err
 		return err
 	}
 	}
 
 
@@ -735,7 +735,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
 		devices.devicesLock.Lock()
 		devices.devicesLock.Lock()
 		devices.Devices[info.Hash] = info
 		devices.Devices[info.Hash] = info
 		devices.devicesLock.Unlock()
 		devices.devicesLock.Unlock()
-		log.Debugf("Error removing meta data: %s\n", err)
+		log.Debugf("Error removing meta data: %s", err)
 		return err
 		return err
 	}
 	}
 
 
@@ -779,7 +779,7 @@ func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
 	// Wait for the unmount to be effective,
 	// Wait for the unmount to be effective,
 	// by watching the value of Info.OpenCount for the device
 	// by watching the value of Info.OpenCount for the device
 	if err := devices.waitClose(info); err != nil {
 	if err := devices.waitClose(info); err != nil {
-		log.Errorf("Warning: error waiting for device %s to close: %s\n", info.Hash, err)
+		log.Errorf("Warning: error waiting for device %s to close: %s", info.Hash, err)
 	}
 	}
 
 
 	devinfo, err := getInfo(info.Name())
 	devinfo, err := getInfo(info.Name())
@@ -903,12 +903,12 @@ func (devices *DeviceSet) Shutdown() error {
 			// container. This means it'll go away from the global scope directly,
 			// container. This means it'll go away from the global scope directly,
 			// and the device will be released when that container dies.
 			// and the device will be released when that container dies.
 			if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil {
 			if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil {
-				log.Debugf("Shutdown unmounting %s, error: %s\n", info.mountPath, err)
+				log.Debugf("Shutdown unmounting %s, error: %s", info.mountPath, err)
 			}
 			}
 
 
 			devices.Lock()
 			devices.Lock()
 			if err := devices.deactivateDevice(info); err != nil {
 			if err := devices.deactivateDevice(info); err != nil {
-				log.Debugf("Shutdown deactivate %s , error: %s\n", info.Hash, err)
+				log.Debugf("Shutdown deactivate %s , error: %s", info.Hash, err)
 			}
 			}
 			devices.Unlock()
 			devices.Unlock()
 		}
 		}
@@ -920,7 +920,7 @@ func (devices *DeviceSet) Shutdown() error {
 		info.lock.Lock()
 		info.lock.Lock()
 		devices.Lock()
 		devices.Lock()
 		if err := devices.deactivateDevice(info); err != nil {
 		if err := devices.deactivateDevice(info); err != nil {
-			log.Debugf("Shutdown deactivate base , error: %s\n", err)
+			log.Debugf("Shutdown deactivate base , error: %s", err)
 		}
 		}
 		devices.Unlock()
 		devices.Unlock()
 		info.lock.Unlock()
 		info.lock.Unlock()
@@ -928,7 +928,7 @@ func (devices *DeviceSet) Shutdown() error {
 
 
 	devices.Lock()
 	devices.Lock()
 	if err := devices.deactivatePool(); err != nil {
 	if err := devices.deactivatePool(); err != nil {
-		log.Debugf("Shutdown deactivate pool , error: %s\n", err)
+		log.Debugf("Shutdown deactivate pool , error: %s", err)
 	}
 	}
 	devices.Unlock()
 	devices.Unlock()
 
 

+ 1 - 1
daemon/graphdriver/devmapper/devmapper.go

@@ -198,7 +198,7 @@ func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64,
 func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
 func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
 	loopInfo, err := ioctlLoopGetStatus64(file.Fd())
 	loopInfo, err := ioctlLoopGetStatus64(file.Fd())
 	if err != nil {
 	if err != nil {
-		log.Errorf("Error get loopback backing file: %s\n", err)
+		log.Errorf("Error get loopback backing file: %s", err)
 		return 0, 0, ErrGetLoopbackBackingFile
 		return 0, 0, ErrGetLoopbackBackingFile
 	}
 	}
 	return loopInfo.loDevice, loopInfo.loInode, nil
 	return loopInfo.loDevice, loopInfo.loInode, nil

+ 1 - 1
daemon/graphdriver/devmapper/driver.go

@@ -138,7 +138,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
 
 
 func (d *Driver) Put(id string) {
 func (d *Driver) Put(id string) {
 	if err := d.DeviceSet.UnmountDevice(id); err != nil {
 	if err := d.DeviceSet.UnmountDevice(id); err != nil {
-		log.Errorf("Warning: error unmounting device %s: %s\n", id, err)
+		log.Errorf("Warning: error unmounting device %s: %s", id, err)
 	}
 	}
 }
 }
 
 

+ 1 - 1
daemon/monitor.go

@@ -88,7 +88,7 @@ func (m *containerMonitor) Close() error {
 	// because they share same runconfig and change image. Must be fixed
 	// because they share same runconfig and change image. Must be fixed
 	// in builder/builder.go
 	// in builder/builder.go
 	if err := m.container.toDisk(); err != nil {
 	if err := m.container.toDisk(); err != nil {
-		log.Errorf("Error dumping container %s state to disk: %s\n", m.container.ID, err)
+		log.Errorf("Error dumping container %s state to disk: %s", m.container.ID, err)
 
 
 		return err
 		return err
 	}
 	}

+ 2 - 2
graph/push.go

@@ -97,9 +97,9 @@ func (s *TagStore) pushRepository(r *registry.Session, out io.Writer, localName,
 		}
 		}
 	}
 	}
 
 
-	log.Debugf("Preparing to push %s with the following images and tags\n", localRepo)
+	log.Debugf("Preparing to push %s with the following images and tags", localRepo)
 	for _, data := range imageIndex {
 	for _, data := range imageIndex {
-		log.Debugf("Pushing ID: %s with Tag: %s\n", data.ID, data.Tag)
+		log.Debugf("Pushing ID: %s with Tag: %s", data.ID, data.Tag)
 	}
 	}
 
 
 	// Register all the images in a repository with the registry
 	// Register all the images in a repository with the registry

+ 3 - 3
integration/runtime_test.go

@@ -107,16 +107,16 @@ func init() {
 	if dockerinit := os.Getenv("TEST_DOCKERINIT_PATH"); dockerinit != "" {
 	if dockerinit := os.Getenv("TEST_DOCKERINIT_PATH"); dockerinit != "" {
 		src, err := os.Open(dockerinit)
 		src, err := os.Open(dockerinit)
 		if err != nil {
 		if err != nil {
-			log.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s\n", err)
+			log.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s", err)
 		}
 		}
 		defer src.Close()
 		defer src.Close()
 		dst, err := os.OpenFile(filepath.Join(filepath.Dir(utils.SelfPath()), "dockerinit"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0555)
 		dst, err := os.OpenFile(filepath.Join(filepath.Dir(utils.SelfPath()), "dockerinit"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0555)
 		if err != nil {
 		if err != nil {
-			log.Fatalf("Unable to create dockerinit in test directory: %s\n", err)
+			log.Fatalf("Unable to create dockerinit in test directory: %s", err)
 		}
 		}
 		defer dst.Close()
 		defer dst.Close()
 		if _, err := io.Copy(dst, src); err != nil {
 		if _, err := io.Copy(dst, src); err != nil {
-			log.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s\n", err)
+			log.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s", err)
 		}
 		}
 		dst.Close()
 		dst.Close()
 		src.Close()
 		src.Close()