Browse Source

Merge pull request #12794 from runcom/small-cleaning

Small if err cleaning
Tibor Vass 10 years ago
parent
commit
62a85fe202

+ 1 - 1
api/client/build.go

@@ -173,7 +173,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
 			includes = append(includes, ".dockerignore", *dockerfileName)
 			includes = append(includes, ".dockerignore", *dockerfileName)
 		}
 		}
 
 
-		if err = utils.ValidateContextDirectory(root, excludes); err != nil {
+		if err := utils.ValidateContextDirectory(root, excludes); err != nil {
 			return fmt.Errorf("Error checking context is accessible: '%s'. Please check permissions and try again.", err)
 			return fmt.Errorf("Error checking context is accessible: '%s'. Please check permissions and try again.", err)
 		}
 		}
 		options := &archive.TarOptions{
 		options := &archive.TarOptions{

+ 1 - 2
api/client/diff.go

@@ -31,8 +31,7 @@ func (cli *DockerCli) CmdDiff(args ...string) error {
 	}
 	}
 
 
 	changes := []types.ContainerChange{}
 	changes := []types.ContainerChange{}
-	err = json.NewDecoder(rdr).Decode(&changes)
-	if err != nil {
+	if err := json.NewDecoder(rdr).Decode(&changes); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
api/client/history.go

@@ -30,8 +30,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
 	}
 	}
 
 
 	history := []types.ImageHistory{}
 	history := []types.ImageHistory{}
-	err = json.NewDecoder(rdr).Decode(&history)
-	if err != nil {
+	if err := json.NewDecoder(rdr).Decode(&history); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
api/client/ps.go

@@ -92,8 +92,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
 	}
 	}
 
 
 	containers := []types.Container{}
 	containers := []types.Container{}
-	err = json.NewDecoder(rdr).Decode(&containers)
-	if err != nil {
+	if err := json.NewDecoder(rdr).Decode(&containers); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
api/client/rmi.go

@@ -37,8 +37,7 @@ func (cli *DockerCli) CmdRmi(args ...string) error {
 			encounteredError = fmt.Errorf("Error: failed to remove one or more images")
 			encounteredError = fmt.Errorf("Error: failed to remove one or more images")
 		} else {
 		} else {
 			dels := []types.ImageDelete{}
 			dels := []types.ImageDelete{}
-			err = json.NewDecoder(rdr).Decode(&dels)
-			if err != nil {
+			if err := json.NewDecoder(rdr).Decode(&dels); err != nil {
 				fmt.Fprintf(cli.err, "%s\n", err)
 				fmt.Fprintf(cli.err, "%s\n", err)
 				encounteredError = fmt.Errorf("Error: failed to remove one or more images")
 				encounteredError = fmt.Errorf("Error: failed to remove one or more images")
 				continue
 				continue

+ 1 - 2
api/client/search.go

@@ -51,8 +51,7 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
 	}
 	}
 
 
 	results := ByStars{}
 	results := ByStars{}
-	err = json.NewDecoder(rdr).Decode(&results)
-	if err != nil {
+	if err := json.NewDecoder(rdr).Decode(&results); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
api/client/top.go

@@ -31,8 +31,7 @@ func (cli *DockerCli) CmdTop(args ...string) error {
 	}
 	}
 
 
 	procList := types.ContainerProcessList{}
 	procList := types.ContainerProcessList{}
-	err = json.NewDecoder(stream).Decode(&procList)
-	if err != nil {
+	if err := json.NewDecoder(stream).Decode(&procList); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
api/common.go

@@ -107,8 +107,7 @@ func MatchesContentType(contentType, expectedType string) bool {
 // LoadOrCreateTrustKey attempts to load the libtrust key at the given path,
 // LoadOrCreateTrustKey attempts to load the libtrust key at the given path,
 // otherwise generates a new one
 // otherwise generates a new one
 func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) {
 func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) {
-	err := os.MkdirAll(filepath.Dir(trustKeyPath), 0700)
-	if err != nil {
+	if err := os.MkdirAll(filepath.Dir(trustKeyPath), 0700); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	trustKey, err := libtrust.LoadKeyFile(trustKeyPath)
 	trustKey, err := libtrust.LoadKeyFile(trustKeyPath)

+ 3 - 4
api/server/server.go

@@ -277,8 +277,7 @@ func (s *Server) postContainersKill(eng *engine.Engine, version version.Version,
 	if vars == nil {
 	if vars == nil {
 		return fmt.Errorf("Missing parameter")
 		return fmt.Errorf("Missing parameter")
 	}
 	}
-	err := parseForm(r)
-	if err != nil {
+	if err := parseForm(r); err != nil {
 		return err
 		return err
 	}
 	}
 
 
@@ -289,7 +288,7 @@ func (s *Server) postContainersKill(eng *engine.Engine, version version.Version,
 	if sigStr := vars["signal"]; sigStr != "" {
 	if sigStr := vars["signal"]; sigStr != "" {
 		// Check if we passed the signal as a number:
 		// Check if we passed the signal as a number:
 		// The largest legal signal is 31, so let's parse on 5 bits
 		// The largest legal signal is 31, so let's parse on 5 bits
-		sig, err = strconv.ParseUint(sigStr, 10, 5)
+		sig, err := strconv.ParseUint(sigStr, 10, 5)
 		if err != nil {
 		if err != nil {
 			// The signal is not a number, treat it as a string (either like
 			// The signal is not a number, treat it as a string (either like
 			// "KILL" or like "SIGKILL")
 			// "KILL" or like "SIGKILL")
@@ -301,7 +300,7 @@ func (s *Server) postContainersKill(eng *engine.Engine, version version.Version,
 		}
 		}
 	}
 	}
 
 
-	if err = s.daemon.ContainerKill(name, sig); err != nil {
+	if err := s.daemon.ContainerKill(name, sig); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 9 - 2
builder/internals.go

@@ -148,8 +148,15 @@ func (b *Builder) runContextCommand(args []string, allowRemote bool, allowDecomp
 	// do the copy (e.g. hash value if cached).  Don't actually do
 	// do the copy (e.g. hash value if cached).  Don't actually do
 	// the copy until we've looked at all src files
 	// the copy until we've looked at all src files
 	for _, orig := range args[0 : len(args)-1] {
 	for _, orig := range args[0 : len(args)-1] {
-		err := calcCopyInfo(b, cmdName, &copyInfos, orig, dest, allowRemote, allowDecompression)
-		if err != nil {
+		if err := calcCopyInfo(
+			b,
+			cmdName,
+			&copyInfos,
+			orig,
+			dest,
+			allowRemote,
+			allowDecompression,
+		); err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}

+ 1 - 2
cliconfig/config.go

@@ -166,8 +166,7 @@ func (configFile *ConfigFile) Save() error {
 		return err
 		return err
 	}
 	}
 
 
-	err = ioutil.WriteFile(configFile.filename, data, 0600)
-	if err != nil {
+	if err := ioutil.WriteFile(configFile.filename, data, 0600); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
daemon/container.go

@@ -149,8 +149,7 @@ func (container *Container) toDisk() error {
 		return err
 		return err
 	}
 	}
 
 
-	err = ioutil.WriteFile(pth, data, 0666)
-	if err != nil {
+	if err := ioutil.WriteFile(pth, data, 0666); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
daemon/daemon.go

@@ -1181,8 +1181,7 @@ func tempDir(rootDir string) (string, error) {
 	if tmpDir = os.Getenv("DOCKER_TMPDIR"); tmpDir == "" {
 	if tmpDir = os.Getenv("DOCKER_TMPDIR"); tmpDir == "" {
 		tmpDir = filepath.Join(rootDir, "tmp")
 		tmpDir = filepath.Join(rootDir, "tmp")
 	}
 	}
-	err := os.MkdirAll(tmpDir, 0700)
-	return tmpDir, err
+	return tmpDir, os.MkdirAll(tmpDir, 0700)
 }
 }
 
 
 func checkKernel() error {
 func checkKernel() error {

+ 1 - 2
daemon/exec.go

@@ -214,8 +214,7 @@ func (d *Daemon) ContainerExecStart(execName string, stdin io.ReadCloser, stdout
 	// the exitStatus) even after the cmd is done running.
 	// the exitStatus) even after the cmd is done running.
 
 
 	go func() {
 	go func() {
-		err := container.Exec(execConfig)
-		if err != nil {
+		if err := container.Exec(execConfig); err != nil {
 			execErr <- fmt.Errorf("Cannot run exec command %s in container %s: %s", execName, container.ID, err)
 			execErr <- fmt.Errorf("Cannot run exec command %s in container %s: %s", execName, container.ID, err)
 		}
 		}
 	}()
 	}()

+ 6 - 7
daemon/graphdriver/devmapper/deviceset.go

@@ -218,7 +218,7 @@ func (devices *DeviceSet) ensureImage(name string, size int64) (string, error) {
 		}
 		}
 		defer file.Close()
 		defer file.Close()
 
 
-		if err = file.Truncate(size); err != nil {
+		if err := file.Truncate(size); err != nil {
 			return "", err
 			return "", err
 		}
 		}
 	}
 	}
@@ -697,7 +697,7 @@ func (devices *DeviceSet) setupBaseImage() error {
 
 
 	logrus.Debugf("Creating filesystem on base device-mapper thin volume")
 	logrus.Debugf("Creating filesystem on base device-mapper thin volume")
 
 
-	if err = devices.activateDeviceIfNeeded(info); err != nil {
+	if err := devices.activateDeviceIfNeeded(info); err != nil {
 		return err
 		return err
 	}
 	}
 
 
@@ -706,7 +706,7 @@ func (devices *DeviceSet) setupBaseImage() error {
 	}
 	}
 
 
 	info.Initialized = true
 	info.Initialized = true
-	if err = devices.saveMetadata(info); err != nil {
+	if err := devices.saveMetadata(info); err != nil {
 		info.Initialized = false
 		info.Initialized = false
 		return err
 		return err
 	}
 	}
@@ -1099,14 +1099,14 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
 	// If we didn't just create the data or metadata image, we need to
 	// If we didn't just create the data or metadata image, we need to
 	// load the transaction id and migrate old metadata
 	// load the transaction id and migrate old metadata
 	if !createdLoopback {
 	if !createdLoopback {
-		if err = devices.initMetaData(); err != nil {
+		if err := devices.initMetaData(); err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}
 
 
 	// Right now this loads only NextDeviceId. If there is more metadata
 	// Right now this loads only NextDeviceId. If there is more metadata
 	// down the line, we might have to move it earlier.
 	// down the line, we might have to move it earlier.
-	if err = devices.loadDeviceSetMetaData(); err != nil {
+	if err := devices.loadDeviceSetMetaData(); err != nil {
 		return err
 		return err
 	}
 	}
 
 
@@ -1528,8 +1528,7 @@ func (devices *DeviceSet) MetadataDevicePath() string {
 
 
 func (devices *DeviceSet) getUnderlyingAvailableSpace(loopFile string) (uint64, error) {
 func (devices *DeviceSet) getUnderlyingAvailableSpace(loopFile string) (uint64, error) {
 	buf := new(syscall.Statfs_t)
 	buf := new(syscall.Statfs_t)
-	err := syscall.Statfs(loopFile, buf)
-	if err != nil {
+	if err := syscall.Statfs(loopFile, buf); err != nil {
 		logrus.Warnf("Couldn't stat loopfile filesystem %v: %v", loopFile, err)
 		logrus.Warnf("Couldn't stat loopfile filesystem %v: %v", loopFile, err)
 		return 0, err
 		return 0, err
 	}
 	}

+ 2 - 3
graph/graph.go

@@ -348,9 +348,8 @@ func (graph *Graph) Delete(name string) error {
 	tmp, err := graph.Mktemp("")
 	tmp, err := graph.Mktemp("")
 	graph.idIndex.Delete(id)
 	graph.idIndex.Delete(id)
 	if err == nil {
 	if err == nil {
-		err = os.Rename(graph.ImageRoot(id), tmp)
-		// On err make tmp point to old dir and cleanup unused tmp dir
-		if err != nil {
+		if err := os.Rename(graph.ImageRoot(id), tmp); err != nil {
+			// On err make tmp point to old dir and cleanup unused tmp dir
 			os.RemoveAll(tmp)
 			os.RemoveAll(tmp)
 			tmp = graph.ImageRoot(id)
 			tmp = graph.ImageRoot(id)
 		}
 		}

+ 2 - 4
graph/pull.go

@@ -537,8 +537,7 @@ func (s *TagStore) pullV2Tag(r *registry.Session, out io.Writer, endpoint *regis
 				di.err <- downloadFunc(di)
 				di.err <- downloadFunc(di)
 			}(&downloads[i])
 			}(&downloads[i])
 		} else {
 		} else {
-			err := downloadFunc(&downloads[i])
-			if err != nil {
+			if err := downloadFunc(&downloads[i]); err != nil {
 				return false, err
 				return false, err
 			}
 			}
 		}
 		}
@@ -548,8 +547,7 @@ func (s *TagStore) pullV2Tag(r *registry.Session, out io.Writer, endpoint *regis
 	for i := len(downloads) - 1; i >= 0; i-- {
 	for i := len(downloads) - 1; i >= 0; i-- {
 		d := &downloads[i]
 		d := &downloads[i]
 		if d.err != nil {
 		if d.err != nil {
-			err := <-d.err
-			if err != nil {
+			if err := <-d.err; err != nil {
 				return false, err
 				return false, err
 			}
 			}
 		}
 		}

+ 1 - 2
graph/push.go

@@ -367,8 +367,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
 			logrus.Debugf("Pushing layer: %s", layer.ID)
 			logrus.Debugf("Pushing layer: %s", layer.ID)
 
 
 			if layer.Config != nil && metadata.Image != layer.ID {
 			if layer.Config != nil && metadata.Image != layer.ID {
-				err = runconfig.Merge(&metadata, layer.Config)
-				if err != nil {
+				if err := runconfig.Merge(&metadata, layer.Config); err != nil {
 					return err
 					return err
 				}
 				}
 			}
 			}

+ 1 - 2
image/image.go

@@ -268,8 +268,7 @@ func NewImgJSON(src []byte) (*Image, error) {
 func ValidateID(id string) error {
 func ValidateID(id string) error {
 	validHex := regexp.MustCompile(`^([a-f0-9]{64})$`)
 	validHex := regexp.MustCompile(`^([a-f0-9]{64})$`)
 	if ok := validHex.MatchString(id); !ok {
 	if ok := validHex.MatchString(id); !ok {
-		err := fmt.Errorf("image ID '%s' is invalid", id)
-		return err
+		return fmt.Errorf("image ID '%s' is invalid", id)
 	}
 	}
 	return nil
 	return nil
 }
 }

+ 4 - 4
integration-cli/docker_api_containers_test.go

@@ -176,7 +176,7 @@ func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
 		c.Fatal(out, err)
 		c.Fatal(out, err)
 	}
 	}
 
 
-	name := "testing"
+	name := "TestContainerApiStartDupVolumeBinds"
 	config := map[string]interface{}{
 	config := map[string]interface{}{
 		"Image":   "busybox",
 		"Image":   "busybox",
 		"Volumes": map[string]struct{}{volPath: {}},
 		"Volumes": map[string]struct{}{volPath: {}},
@@ -620,7 +620,7 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 		c.Fatal(err, out)
 		c.Fatal(err, out)
 	}
 	}
 
 
-	name := "testcommit" + stringid.GenerateRandomID()
+	name := "TestContainerApiCommit"
 	status, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+cName, nil)
 	status, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+cName, nil)
 	c.Assert(status, check.Equals, http.StatusCreated)
 	c.Assert(status, check.Equals, http.StatusCreated)
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
@@ -842,12 +842,12 @@ func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestContainerApiRename(c *check.C) {
 func (s *DockerSuite) TestContainerApiRename(c *check.C) {
-	runCmd := exec.Command(dockerBinary, "run", "--name", "first_name", "-d", "busybox", "sh")
+	runCmd := exec.Command(dockerBinary, "run", "--name", "TestContainerApiRename", "-d", "busybox", "sh")
 	out, _, err := runCommandWithOutput(runCmd)
 	out, _, err := runCommandWithOutput(runCmd)
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
 
 
 	containerID := strings.TrimSpace(out)
 	containerID := strings.TrimSpace(out)
-	newName := "new_name" + stringid.GenerateRandomID()
+	newName := "TestContainerApiRenameNew"
 	statusCode, _, err := sockRequest("POST", "/containers/"+containerID+"/rename?name="+newName, nil)
 	statusCode, _, err := sockRequest("POST", "/containers/"+containerID+"/rename?name="+newName, nil)
 
 
 	// 204 No Content is expected, not 200
 	// 204 No Content is expected, not 200

+ 1 - 2
integration-cli/utils.go

@@ -169,8 +169,7 @@ func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode in
 }
 }
 
 
 func unmarshalJSON(data []byte, result interface{}) error {
 func unmarshalJSON(data []byte, result interface{}) error {
-	err := json.Unmarshal(data, result)
-	if err != nil {
+	if err := json.Unmarshal(data, result); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 2
pkg/jsonlog/jsonlog_marshalling.go

@@ -65,8 +65,7 @@ import (
 func (mj *JSONLog) MarshalJSON() ([]byte, error) {
 func (mj *JSONLog) MarshalJSON() ([]byte, error) {
 	var buf bytes.Buffer
 	var buf bytes.Buffer
 	buf.Grow(1024)
 	buf.Grow(1024)
-	err := mj.MarshalJSONBuf(&buf)
-	if err != nil {
+	if err := mj.MarshalJSONBuf(&buf); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	return buf.Bytes(), nil
 	return buf.Bytes(), nil

+ 1 - 2
pkg/mflag/flag.go

@@ -486,8 +486,7 @@ func (f *FlagSet) Set(name, value string) error {
 	if !ok {
 	if !ok {
 		return fmt.Errorf("no such flag -%v", name)
 		return fmt.Errorf("no such flag -%v", name)
 	}
 	}
-	err := flag.Value.Set(value)
-	if err != nil {
+	if err := flag.Value.Set(value); err != nil {
 		return err
 		return err
 	}
 	}
 	if f.actual == nil {
 	if f.actual == nil {

+ 1 - 2
pkg/system/lstat.go

@@ -12,8 +12,7 @@ import (
 // Throws an error if the file does not exist
 // Throws an error if the file does not exist
 func Lstat(path string) (*Stat_t, error) {
 func Lstat(path string) (*Stat_t, error) {
 	s := &syscall.Stat_t{}
 	s := &syscall.Stat_t{}
-	err := syscall.Lstat(path, s)
-	if err != nil {
+	if err := syscall.Lstat(path, s); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	return fromStatT(s)
 	return fromStatT(s)

+ 1 - 2
pkg/system/stat_linux.go

@@ -20,8 +20,7 @@ func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
 // Throws an error if the file does not exist
 // Throws an error if the file does not exist
 func Stat(path string) (*Stat_t, error) {
 func Stat(path string) (*Stat_t, error) {
 	s := &syscall.Stat_t{}
 	s := &syscall.Stat_t{}
-	err := syscall.Stat(path, s)
-	if err != nil {
+	if err := syscall.Stat(path, s); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	return fromStatT(s)
 	return fromStatT(s)

+ 1 - 2
pkg/timeoutconn/timeoutconn.go

@@ -17,8 +17,7 @@ type conn struct {
 
 
 func (c *conn) Read(b []byte) (int, error) {
 func (c *conn) Read(b []byte) (int, error) {
 	if c.timeout > 0 {
 	if c.timeout > 0 {
-		err := c.Conn.SetReadDeadline(time.Now().Add(c.timeout))
-		if err != nil {
+		if err := c.Conn.SetReadDeadline(time.Now().Add(c.timeout)); err != nil {
 			return 0, err
 			return 0, err
 		}
 		}
 	}
 	}

+ 1 - 2
registry/session.go

@@ -597,8 +597,7 @@ func (r *Session) SearchRepositories(term string) (*SearchResults, error) {
 		return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res)
 		return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res)
 	}
 	}
 	result := new(SearchResults)
 	result := new(SearchResults)
-	err = json.NewDecoder(res.Body).Decode(result)
-	return result, err
+	return result, json.NewDecoder(res.Body).Decode(result)
 }
 }
 
 
 func (r *Session) GetAuthConfig(withPasswd bool) *cliconfig.AuthConfig {
 func (r *Session) GetAuthConfig(withPasswd bool) *cliconfig.AuthConfig {

+ 1 - 3
registry/session_v2.go

@@ -387,10 +387,8 @@ func (r *Session) GetV2RemoteTags(ep *Endpoint, imageName string, auth *RequestA
 		return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to fetch for %s", res.StatusCode, imageName), res)
 		return nil, httputils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to fetch for %s", res.StatusCode, imageName), res)
 	}
 	}
 
 
-	decoder := json.NewDecoder(res.Body)
 	var remote remoteTags
 	var remote remoteTags
-	err = decoder.Decode(&remote)
-	if err != nil {
+	if err := json.NewDecoder(res.Body).Decode(&remote); err != nil {
 		return nil, fmt.Errorf("Error while decoding the http response: %s", err)
 		return nil, fmt.Errorf("Error while decoding the http response: %s", err)
 	}
 	}
 	return remote.Tags, nil
 	return remote.Tags, nil

+ 3 - 6
trust/trusts.go

@@ -62,8 +62,7 @@ func NewTrustStore(path string) (*TrustStore, error) {
 		baseEndpoints: endpoints,
 		baseEndpoints: endpoints,
 	}
 	}
 
 
-	err = t.reload()
-	if err != nil {
+	if err := t.reload(); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
@@ -170,8 +169,7 @@ func (t *TrustStore) fetch() {
 			continue
 			continue
 		}
 		}
 		// TODO check if value differs
 		// TODO check if value differs
-		err = ioutil.WriteFile(path.Join(t.path, bg+".json"), b, 0600)
-		if err != nil {
+		if err := ioutil.WriteFile(path.Join(t.path, bg+".json"), b, 0600); err != nil {
 			logrus.Infof("Error writing trust graph statement: %s", err)
 			logrus.Infof("Error writing trust graph statement: %s", err)
 		}
 		}
 		fetchCount++
 		fetchCount++
@@ -180,8 +178,7 @@ func (t *TrustStore) fetch() {
 
 
 	if fetchCount > 0 {
 	if fetchCount > 0 {
 		go func() {
 		go func() {
-			err := t.reload()
-			if err != nil {
+			if err := t.reload(); err != nil {
 				logrus.Infof("Reload of trust graph failed: %s", err)
 				logrus.Infof("Reload of trust graph failed: %s", err)
 			}
 			}
 		}()
 		}()