Golang编码/ json Marshaler

As stated in the encoding/json package documentation,

Marshal traverses the value v recursively. If an encountered value implements the Marshaler interface and is not a nil pointer, Marshal calls its MarshalJSON method to produce JSON.

Where exactly in the code is this test performed?

In another terms, how does encoding/json check if a value v of type t implements the Marshaller interface?

Here :

Golang encoding/json Marshaler

if t.Implements(marshalerType) {
    return marshalerEncoder
}

Edit: The link above has been updated to point to a specific version of Go, as @dave-c pointed out in comments below.