Skip to content

关于5.3节context的想法 #11

@marjune163

Description

@marjune163

之前读到context的定义,其中嵌入了上级类型,例如cancelCtx 中的Context

type cancelCtx struct {
	Context
        ......
}

我一直以为仅仅是重用了上一级的接口定义,与parent之间的联系由私有成员变量维护,而实际是直接在嵌入类型中存放了parent实例,之前一直没留意到,书中也没重点提及,感觉可以加强一下。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions