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

@ -17,8 +17,10 @@ import (
"code.gitea.io/gitea/modules/util"
)
const maxLines = 10
const guessSampleSize = 1e4 // 10k
const (
maxLines = 10
guessSampleSize = 1e4 // 10k
)
// CreateReader creates a csv.Reader with the given delimiter.
func CreateReader(input io.Reader, delimiter rune) *stdcsv.Reader {
@ -35,7 +37,7 @@ func CreateReader(input io.Reader, delimiter rune) *stdcsv.Reader {
// CreateReaderAndDetermineDelimiter tries to guess the field delimiter from the content and creates a csv.Reader.
// Reads at most guessSampleSize bytes.
func CreateReaderAndDetermineDelimiter(ctx *markup.RenderContext, rd io.Reader) (*stdcsv.Reader, error) {
var data = make([]byte, guessSampleSize)
data := make([]byte, guessSampleSize)
size, err := util.ReadAtMost(rd, data)
if err != nil {
return nil, err

View file

@ -31,7 +31,7 @@ func decodeSlashes(t *testing.T, s string) string {
}
func TestCreateReaderAndDetermineDelimiter(t *testing.T) {
var cases = []struct {
cases := []struct {
csv string
expectedRows [][]string
expectedDelimiter rune
@ -135,7 +135,7 @@ func TestDetermineDelimiterReadAllError(t *testing.T) {
}
func TestDetermineDelimiter(t *testing.T) {
var cases = []struct {
cases := []struct {
csv string
filename string
expectedDelimiter rune
@ -236,7 +236,7 @@ John Doe john@doe.com This,note,had,a,lot,of,commas,to,test,delimiters`,
}
func TestRemoveQuotedString(t *testing.T) {
var cases = []struct {
cases := []struct {
text string
expectedText string
}{
@ -301,7 +301,7 @@ abc | |123
}
func TestGuessDelimiter(t *testing.T) {
var cases = []struct {
cases := []struct {
csv string
expectedDelimiter rune
}{
@ -456,7 +456,7 @@ jkl`,
}
func TestGuessFromBeforeAfterQuotes(t *testing.T) {
var cases = []struct {
cases := []struct {
csv string
expectedDelimiter rune
}{
@ -562,7 +562,7 @@ func (l mockLocale) TrN(_cnt interface{}, key1, _keyN string, _args ...interface
}
func TestFormatError(t *testing.T) {
var cases = []struct {
cases := []struct {
err error
expectedMessage string
expectsError bool