Skip to content

如果结构体中带有time.Timer类型的字段,无论是否可导出都无法Marshal #174

@zdt3476

Description

@zdt3476
type Test struct {
	t time.Timer
}

func main() {
	t := new(Test)
	data, err := jsoniter.Marshal(t)
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error:", err)
		return
	}

	fmt.Println(string(data))
}

output

Error: [optional]: [main.Test]: [time.Timer]: unsupported type: <-chan time.Time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions