关于Go语言的语法? [重复]

if logic, ok := p.(LogicalPlan); ok {
    return doOptimize(builder.optFlag, logic)
}

LocalPlan is an excuse. What does the syntax p.(LogicalPlan) mean

</div>

The Go syntax is defined in the Go specification.

The Go Programming Language Specification

Type assertions

For an expression x of interface type and a type T, the primary expression

x.(T)

asserts that x is not nil and that the value stored in x is of type T. The notation x.(T) is called a type assertion.

A type assertion used in an assignment or initialization of the special form

v, ok = x.(T)
v, ok := x.(T)
var v, ok = x.(T)
var v, ok T1 = x.(T)

yields an additional untyped boolean value. The value of ok is true if the assertion holds. Otherwise it is false and the value of v is the zero value for type T. No run-time panic occurs in this case.