Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no <code>make()</code> as such. Simply put, this is happening:</p> <ol> <li>go code: <code>make(chan int)</code></li> <li>symbol substitution: <code>OMAKE</code></li> <li>symbol typechecking: <code>OMAKECHAN</code></li> <li>code generation: <code>runtime·makechan</code></li> </ol> <p><code>gc</code>, which is a go flavoured C parser, parses the <code>make</code> call according to context (for easier type checking). </p> <p>This conversion is done in <a href="https://github.com/golang/go/blob/go1.10/src/cmd/compile/internal/gc/typecheck.go#L1831" rel="nofollow noreferrer">cmd/compile/internal/gc/typecheck.go</a>.</p> <p>After that, depending on what symbol there is (e.g., <code>OMAKECHAN</code> for <code>make(chan ...)</code>), the appropriate runtime call is substituted in <a href="https://github.com/golang/go/blob/go1.10/src/cmd/compile/internal/gc/walk.go#L1417" rel="nofollow noreferrer">cmd/compile/internal/gc/walk.go</a>. In case of <code>OMAKECHAN</code> this would be <code>makechan64</code> or <code>makechan</code>.</p> <p>Finally, when running the code, said substituted function <a href="https://github.com/golang/go/blob/go1.10/src/runtime/chan.go#L70" rel="nofollow noreferrer">in pkg/runtime</a> is called.</p> <h3>How do you find this</h3> <p>I tend to find such things mostly by imagining in which stage of the process this particular thing may happen. In case of <code>make</code>, with the knowledge that there's no definition of <code>make</code> in <code>pkg/runtime</code> (the most basic package), it has to be on compiler level and is likely to be substituted to something else.</p> <p>You then have to search the various compiler stages (gc, *g, *l) and in time you'll find the definitions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload