all: Format code with gofumpt

See https://github.com/mvdan/gofumpt
This commit is contained in:
Bjørn Erik Pedersen
2020-12-02 13:23:25 +01:00
parent 32471b57bd
commit d90e37e0c6
442 changed files with 1426 additions and 2254 deletions

View File

@@ -119,7 +119,6 @@ func (d Decoder) Unmarshal(data []byte, f Format) (interface{}, error) {
default:
return make(map[string]interface{}), nil
}
}
var v interface{}
err := d.UnmarshalTo(data, f, &v)
@@ -129,7 +128,6 @@ func (d Decoder) Unmarshal(data []byte, f Format) (interface{}, error) {
// UnmarshalTo unmarshals data in format f into v.
func (d Decoder) UnmarshalTo(data []byte, f Format, v interface{}) error {
var err error
switch f {
@@ -181,7 +179,6 @@ func (d Decoder) UnmarshalTo(data []byte, f Format, v interface{}) error {
}
return toFileError(f, errors.Wrap(err, "unmarshal failed"))
}
func (d Decoder) unmarshalCSV(data []byte, v interface{}) error {
@@ -203,7 +200,6 @@ func (d Decoder) unmarshalCSV(data []byte, v interface{}) error {
}
return nil
}
func parseORGDate(s string) string {
@@ -255,7 +251,6 @@ func toFileError(f Format, err error) error {
//
// Inspired by https://github.com/stripe/stripe-mock, MIT licensed
func stringifyMapKeys(in interface{}) (interface{}, bool) {
switch in := in.(type) {
case []interface{}:
for i, v := range in {

View File

@@ -87,7 +87,6 @@ func TestUnmarshalToInterface(t *testing.T) {
}
}
}
func TestUnmarshalStringTo(t *testing.T) {

View File

@@ -39,7 +39,6 @@ func FormatFromString(formatStr string) Format {
if strings.Contains(formatStr, ".") {
// Assume a filename
formatStr = strings.TrimPrefix(filepath.Ext(formatStr), ".")
}
switch formatStr {
case "yaml", "yml":
@@ -55,7 +54,6 @@ func FormatFromString(formatStr string) Format {
}
return ""
}
// FormatFromMediaType gets the Format given a MIME type, empty string