mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
This commit is contained in:
parent
1d98d205f5
commit
54e9ee37a7
423 changed files with 1585 additions and 1758 deletions
|
@ -36,7 +36,7 @@ func TestPaginateSlice(t *testing.T) {
|
|||
Val int
|
||||
}
|
||||
|
||||
var testVar = []*Test{{Val: 2}, {Val: 3}, {Val: 4}}
|
||||
testVar := []*Test{{Val: 2}, {Val: 3}, {Val: 4}}
|
||||
testVar, ok = PaginateSlice(testVar, 1, 50).([]*Test)
|
||||
assert.True(t, ok)
|
||||
assert.EqualValues(t, []*Test{{Val: 2}, {Val: 3}, {Val: 4}}, testVar)
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestFileURLToPath(t *testing.T) {
|
||||
var cases = []struct {
|
||||
cases := []struct {
|
||||
url string
|
||||
expected string
|
||||
haserror bool
|
||||
|
|
|
@ -9,8 +9,10 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const userPlaceholder = "sanitized-credential"
|
||||
const unparsableURL = "(unparsable url)"
|
||||
const (
|
||||
userPlaceholder = "sanitized-credential"
|
||||
unparsableURL = "(unparsable url)"
|
||||
)
|
||||
|
||||
type sanitizedError struct {
|
||||
err error
|
||||
|
|
|
@ -16,7 +16,7 @@ func TestNewSanitizedError(t *testing.T) {
|
|||
err2 := NewSanitizedError(err)
|
||||
assert.Equal(t, err.Error(), err2.Error())
|
||||
|
||||
var cases = []struct {
|
||||
cases := []struct {
|
||||
input error
|
||||
oldnew []string
|
||||
expected string
|
||||
|
@ -43,7 +43,7 @@ func TestNewSanitizedError(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNewStringURLSanitizer(t *testing.T) {
|
||||
var cases = []struct {
|
||||
cases := []struct {
|
||||
input string
|
||||
placeholder bool
|
||||
expected string
|
||||
|
@ -101,7 +101,7 @@ func TestNewStringURLSanitizer(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNewStringURLSanitizedError(t *testing.T) {
|
||||
var cases = []struct {
|
||||
cases := []struct {
|
||||
input string
|
||||
placeholder bool
|
||||
expected string
|
||||
|
|
|
@ -41,9 +41,11 @@ const (
|
|||
needsSingleQuote = "!\n"
|
||||
)
|
||||
|
||||
var doubleQuoteEscaper = strings.NewReplacer(`$`, `\$`, "`", "\\`", `"`, `\"`, `\`, `\\`)
|
||||
var singleQuoteEscaper = strings.NewReplacer(`'`, `'\''`)
|
||||
var singleQuoteCoalescer = strings.NewReplacer(`''\'`, `\'`, `\'''`, `\'`)
|
||||
var (
|
||||
doubleQuoteEscaper = strings.NewReplacer(`$`, `\$`, "`", "\\`", `"`, `\"`, `\`, `\\`)
|
||||
singleQuoteEscaper = strings.NewReplacer(`'`, `'\''`)
|
||||
singleQuoteCoalescer = strings.NewReplacer(`''\'`, `\'`, `\'''`, `\'`)
|
||||
)
|
||||
|
||||
// ShellEscape will escape the provided string.
|
||||
// We can't just use go-shellquote here because our preferences for escaping differ from those in that we want:
|
||||
|
|
|
@ -7,8 +7,10 @@ package util
|
|||
import "unicode/utf8"
|
||||
|
||||
// in UTF8 "…" is 3 bytes so doesn't really gain us anything...
|
||||
const utf8Ellipsis = "…"
|
||||
const asciiEllipsis = "..."
|
||||
const (
|
||||
utf8Ellipsis = "…"
|
||||
asciiEllipsis = "..."
|
||||
)
|
||||
|
||||
// SplitStringAtByteN splits a string at byte n accounting for rune boundaries. (Combining characters are not accounted for.)
|
||||
func SplitStringAtByteN(input string, n int) (left, right string) {
|
||||
|
|
|
@ -46,7 +46,6 @@ func TestURLJoin(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIsEmptyString(t *testing.T) {
|
||||
|
||||
cases := []struct {
|
||||
s string
|
||||
expected bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue