mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
refactor: improve code quality and efficiency in various files (#548)
- Replace loadConfig() with _ = loadConfig() - Update file permissions from 0660 to 0o660 - Simplify variable declarations - Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term - Remove unused getCertPrincipals function - Replace time.Now().Sub() with time.Since() - Add test for ArgToIndex function Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/548 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io> Co-authored-by: appleboy <appleboy.tw@gmail.com> Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@ -28,7 +28,7 @@ func IssueDetails(issue *gitea.Issue, reactions []*gitea.Reaction) {
|
||||
out += fmt.Sprintf("\n---\n\n%s\n", formatReactions(reactions))
|
||||
}
|
||||
|
||||
outputMarkdown(out, getRepoURL(issue.HTMLURL))
|
||||
_ = outputMarkdown(out, getRepoURL(issue.HTMLURL))
|
||||
}
|
||||
|
||||
func formatReactions(reactions []*gitea.Reaction) string {
|
||||
@ -74,7 +74,7 @@ var IssueFields = []string{
|
||||
|
||||
func printIssues(issues []*gitea.Issue, output string, fields []string) {
|
||||
labelMap := map[int64]string{}
|
||||
var printables = make([]printable, len(issues))
|
||||
printables := make([]printable, len(issues))
|
||||
machineReadable := isMachineReadable(output)
|
||||
|
||||
for i, x := range issues {
|
||||
@ -133,13 +133,13 @@ func (x printableIssue) FormatField(field string, machineReadable bool) string {
|
||||
}
|
||||
return ""
|
||||
case "labels":
|
||||
var labels = make([]string, len(x.Labels))
|
||||
labels := make([]string, len(x.Labels))
|
||||
for i, l := range x.Labels {
|
||||
labels[i] = (*x.formattedLabels)[l.ID]
|
||||
}
|
||||
return strings.Join(labels, " ")
|
||||
case "assignees":
|
||||
var assignees = make([]string, len(x.Assignees))
|
||||
assignees := make([]string, len(x.Assignees))
|
||||
for i, a := range x.Assignees {
|
||||
assignees[i] = formatUserName(a)
|
||||
}
|
||||
|
Reference in New Issue
Block a user