Skip to content

Commit 25663b5

Browse files
appleboylunny
authored andcommitted
refactor: Remove unnecessary type conversions (#772)
1 parent 4faf097 commit 25663b5

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

models/ssh_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func SSHKeyGenParsePublicKey(key string) (string, int, error) {
219219
func SSHNativeParsePublicKey(keyLine string) (string, int, error) {
220220
fields := strings.Fields(keyLine)
221221
if len(fields) < 2 {
222-
return "", 0, fmt.Errorf("not enough fields in public key line: %s", string(keyLine))
222+
return "", 0, fmt.Errorf("not enough fields in public key line: %s", keyLine)
223223
}
224224

225225
raw, err := base64.StdEncoding.DecodeString(fields[1])

modules/lfs/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func GetContentHandler(ctx *context.Context) {
132132
if match != nil && len(match) > 1 {
133133
statusCode = 206
134134
fromByte, _ = strconv.ParseInt(match[1], 10, 32)
135-
ctx.Resp.Header().Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", fromByte, meta.Size-1, int64(meta.Size)-fromByte))
135+
ctx.Resp.Header().Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", fromByte, meta.Size-1, meta.Size-fromByte))
136136
}
137137
}
138138

modules/markdown/markdown.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
301301
if com.StrTo(m).MustInt() > 0 {
302302
return m
303303
}
304-
return fmt.Sprintf(`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, base.ShortSha(string(m)))
304+
return fmt.Sprintf(`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, base.ShortSha(m))
305305
}))
306306
}
307307

modules/templates/helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func NewFuncMap() []template.FuncMap {
121121
var path []string
122122
index := strings.LastIndex(str, "/")
123123
if index != -1 && index != len(str) {
124-
path = append(path, string(str[0:index+1]))
125-
path = append(path, string(str[index+1:]))
124+
path = append(path, str[0:index+1])
125+
path = append(path, str[index+1:])
126126
} else {
127127
path = append(path, str)
128128
}

0 commit comments

Comments
 (0)