format with gofumpt (#18184)

* gofumpt -w -l .

* gofumpt -w -l -extra .

* Add linter

* manual fix

* change make fmt
This commit is contained in:
6543 2022-01-20 18:46:10 +01:00 committed by GitHub
parent 1d98d205f5
commit 54e9ee37a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
423 changed files with 1585 additions and 1758 deletions

View file

@ -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)

View file

@ -13,7 +13,7 @@ import (
)
func TestFileURLToPath(t *testing.T) {
var cases = []struct {
cases := []struct {
url string
expected string
haserror bool

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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) {

View file

@ -46,7 +46,6 @@ func TestURLJoin(t *testing.T) {
}
func TestIsEmptyString(t *testing.T) {
cases := []struct {
s string
expected bool