title: Is it possible to write a 'fluent' style api in go?
body: <p>Several other languages have a 'fluent' or chained-invokation style of api, which allows you to do calls like this:</p>
  
  <pre><code>public class CatMap : ClassMap&lt;Cat&gt;
  {
    public CatMap()
    {
      Id(x =&gt; x.Id);
      Map(x =&gt; x.Name)
        .Length(16)
        .Not.Nullable();
      Map(x =&gt; x.Sex);
      References(x =&gt; x.Mate);
      HasMany(x =&gt; x.Kittens);
    }
  }
  </code></pre>
  
  <p>Notable examples include fluent nhibernate, jquery method chaining, etc. It's a common (and I'd say quite well loved) api design pattern.</p>
  
  <p>Problem: The go syntax doesn't seem to support this.</p>
  
  <p>You can do this in go:</p>
  
  <pre><code>var blah = X().Y().Thing().OtherThing()
  </code></pre>
  
  <p>...but this:</p>
  
  <pre><code>package main
  
  import "n"
  
  func main() {
      n.Log(":D")
      .Example()
      .Example
  }
  </code></pre>
  
  <p>Results in:</p>
  
  <pre><code>&gt; command-line-arguments
  &gt; ./app.go:7: syntax error: unexpected .
  </code></pre>
  
  <p>...basically, because go automatically inserts ;'s at the end of a line.</p>
  
  <p>Anyone know if there's a way around this?</p>
  
  <p>Can you disable the auto-; in a block somehow?</p>
  
  <p>Or is this sort of api just not possible in go?</p>