forgejo/models
Jason Song 9607750b5e
Replace fmt.Sprintf with hex.EncodeToString (#21960)
`hex.EncodeToString` has better performance than `fmt.Sprintf("%x",
[]byte)`, we should use it as much as possible.

I'm not an extreme fan of performance, so I think there are some
exceptions:

- `fmt.Sprintf("%x", func(...)[N]byte())`
- We can't slice the function return value directly, and it's not worth
adding lines.
    ```diff
    func A()[20]byte { ... }
    - a := fmt.Sprintf("%x", A())
    - a := hex.EncodeToString(A()[:]) // invalid
    + tmp := A()
    + a := hex.EncodeToString(tmp[:])
    ```
- `fmt.Sprintf("%X", []byte)`
- `strings.ToUpper(hex.EncodeToString(bytes))` has even worse
performance.
2022-11-28 11:19:18 +00:00
..
activities Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
admin Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
asymkey Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
auth Replace fmt.Sprintf with hex.EncodeToString (#21960) 2022-11-28 11:19:18 +00:00
avatars Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
db Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fixtures Record OAuth client type at registration (#21316) 2022-10-24 15:59:24 +08:00
foreignreference Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
git Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
issues Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
migrations Replace fmt.Sprintf with hex.EncodeToString (#21960) 2022-11-28 11:19:18 +00:00
organization Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
packages Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
perm Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
project Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
pull Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
system Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
unit Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
unittest Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
user Replace fmt.Sprintf with hex.EncodeToString (#21960) 2022-11-28 11:19:18 +00:00
webhook Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
error.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fixture_generation.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fixture_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
main_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
migrate.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
migrate_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org_team.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org_team_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
org_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_collaboration.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_collaboration_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_transfer.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
repo_transfer_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
user.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00