mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-10 19:54:08 +02:00
@@ -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 {
|
||||
|
@@ -87,7 +87,6 @@ func TestUnmarshalToInterface(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestUnmarshalStringTo(t *testing.T) {
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user