Przeglądaj źródła

[fmt] Fix fmt issues with go master

cgars 6 lat temu
rodzic
commit
af956d0acd

+ 4 - 4
models/mirror.go

@@ -306,7 +306,7 @@ func SyncMirrors() {
 
 
 		m, err := GetMirrorByRepoID(com.StrTo(repoID).MustInt64())
 		m, err := GetMirrorByRepoID(com.StrTo(repoID).MustInt64())
 		if err != nil {
 		if err != nil {
-			log.Error(2, "GetMirrorByRepoID [%s]: %v", m.RepoID, err)
+			log.Error(2, "GetMirrorByRepoID [%d]: %v", m.RepoID, err)
 			continue
 			continue
 		}
 		}
 
 
@@ -316,7 +316,7 @@ func SyncMirrors() {
 
 
 		m.ScheduleNextUpdate()
 		m.ScheduleNextUpdate()
 		if err = UpdateMirror(m); err != nil {
 		if err = UpdateMirror(m); err != nil {
-			log.Error(2, "UpdateMirror [%s]: %v", m.RepoID, err)
+			log.Error(2, "UpdateMirror [%d]: %v", m.RepoID, err)
 			continue
 			continue
 		}
 		}
 
 
@@ -324,14 +324,14 @@ func SyncMirrors() {
 		// update if latest commit date is newer.
 		// update if latest commit date is newer.
 		commitDate, err := git.GetLatestCommitDate(m.Repo.RepoPath(), "")
 		commitDate, err := git.GetLatestCommitDate(m.Repo.RepoPath(), "")
 		if err != nil {
 		if err != nil {
-			log.Error(2, "GetLatestCommitDate [%s]: %v", m.RepoID, err)
+			log.Error(2, "GetLatestCommitDate [%d]: %v", m.RepoID, err)
 			continue
 			continue
 		} else if commitDate.Before(m.Repo.Updated) {
 		} else if commitDate.Before(m.Repo.Updated) {
 			continue
 			continue
 		}
 		}
 
 
 		if _, err = x.Exec("UPDATE repository SET updated_unix = ? WHERE id = ?", commitDate.Unix(), m.RepoID); err != nil {
 		if _, err = x.Exec("UPDATE repository SET updated_unix = ? WHERE id = ?", commitDate.Unix(), m.RepoID); err != nil {
-			log.Error(2, "Update repository 'updated_unix' [%s]: %v", m.RepoID, err)
+			log.Error(2, "Update repository 'updated_unix' [%d]: %v", m.RepoID, err)
 			continue
 			continue
 		}
 		}
 	}
 	}

+ 3 - 3
models/repo_editor.go

@@ -488,9 +488,9 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
 		if err = com.Copy(tmpPath, targetPath); err != nil {
 		if err = com.Copy(tmpPath, targetPath); err != nil {
 			return fmt.Errorf("Copy: %v", err)
 			return fmt.Errorf("Copy: %v", err)
 		}
 		}
-		log.Trace("Check for annexing: %s,%s", upload.Name)
+		log.Trace("Check for annexing: %s", upload.Name)
 		if finfo, err := os.Stat(targetPath); err == nil {
 		if finfo, err := os.Stat(targetPath); err == nil {
-			log.Trace("Filesize is:%s", finfo.Size())
+			log.Trace("Filesize is:%d", finfo.Size())
 			// Should we annex
 			// Should we annex
 			if finfo.Size() > setting.Repository.Upload.AnexFileMinSize*gannex.MEGABYTE {
 			if finfo.Size() > setting.Repository.Upload.AnexFileMinSize*gannex.MEGABYTE {
 				log.Trace("This file should be annexed: %s", upload.Name)
 				log.Trace("This file should be annexed: %s", upload.Name)
@@ -588,7 +588,7 @@ func StartIndexing(user, owner *User, repo *Repository) {
 	client := http.Client{}
 	client := http.Client{}
 	resp, err := client.Do(req)
 	resp, err := client.Do(req)
 	if err != nil || resp.StatusCode != http.StatusOK {
 	if err != nil || resp.StatusCode != http.StatusOK {
-		log.Trace("Error doing index request:%+v,%d", err)
+		log.Trace("Error doing index request:%+v", err)
 		return
 		return
 	}
 	}
 }
 }

+ 1 - 1
pkg/auth/ldap/ldap.go

@@ -178,7 +178,7 @@ func bindUser(l *ldap.Conn, userDN, passwd string) error {
 func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, string, string, string, bool, bool) {
 func (ls *Source) SearchEntry(name, passwd string, directBind bool) (string, string, string, string, bool, bool) {
 	// See https://tools.ietf.org/search/rfc4513#section-5.1.2
 	// See https://tools.ietf.org/search/rfc4513#section-5.1.2
 	if len(passwd) == 0 {
 	if len(passwd) == 0 {
-		log.Trace("authentication failed for '%s' with empty password")
+		log.Trace("authentication failed for '%s' with empty password", name)
 		return "", "", "", "", false, false
 		return "", "", "", "", false, false
 	}
 	}
 	l, err := dial(ls)
 	l, err := dial(ls)

+ 1 - 1
routes/repo/http.go

@@ -281,7 +281,7 @@ func serviceRPC(h serviceHandler, service string) {
 	cmd.Stderr = &stderr
 	cmd.Stderr = &stderr
 	cmd.Stdin = reqBody
 	cmd.Stdin = reqBody
 	if err = cmd.Run(); err != nil {
 	if err = cmd.Run(); err != nil {
-		log.Error(2, "HTTP.serviceRPC: fail to serve RPC '%s': %v - %s", service, err, stderr)
+		log.Error(2, "HTTP.serviceRPC: fail to serve RPC '%s': %v - %s", service, err, stderr.String())
 		h.w.WriteHeader(http.StatusInternalServerError)
 		h.w.WriteHeader(http.StatusInternalServerError)
 		return
 		return
 	}
 	}

+ 1 - 1
routes/repo/setting.go

@@ -319,7 +319,7 @@ func inviteWithMail(c *context.Context, mail string) (*models.User, error) {
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	log.Info("User: %s created", user.Name, pw)
+	log.Info("User: %s created", user.Name)
 	c.Context.Data["Account"] = user.Name
 	c.Context.Data["Account"] = user.Name
 	c.Context.Data["Inviter"] = c.User.Name
 	c.Context.Data["Inviter"] = c.User.Name
 	c.Context.Data["Pw"] = pw
 	c.Context.Data["Pw"] = pw

+ 1 - 1
routes/repo/view.go

@@ -184,7 +184,7 @@ func renderDirectory(c *context.Context, treeLink string) {
 func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink string, cpt *captcha.Captcha) {
 func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink string, cpt *captcha.Captcha) {
 	c.Data["IsViewFile"] = true
 	c.Data["IsViewFile"] = true
 	blob := entry.Blob()
 	blob := entry.Blob()
-	log.Trace("Blob size is %s", blob.Size())
+	log.Trace("Blob size is %d", blob.Size())
 	if blob.Size() > gannex.MEGABYTE*10 && setting.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) && !c.IsLogged {
 	if blob.Size() > gannex.MEGABYTE*10 && setting.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) && !c.IsLogged {
 		c.Data["EnableCaptcha"] = true
 		c.Data["EnableCaptcha"] = true
 		c.HTML(200, "repo/download")
 		c.HTML(200, "repo/download")