title: Can i have custom build flags like os/arch comment directives
body: <p>In golang I am able to set compiler directives in the first line comment of a file to determine whether the code on that file is included in the build based on OS or arch, e.g</p>
  
  <p>to target windows:</p>
  
  <pre><code>// +build windows
  </code></pre>
  
  <p>or non-windows:</p>
  
  <pre><code>// +build !windows
  </code></pre>
  
  <p>Is there any way to pass in my own boolean variable at build time to operate in the same way?</p>
  
  <p>The background is that I would like a boolean debug flag which I can pass in to do a debug build, I don't want my debug code included in the normal build.</p>
  
  <p>I currently do something like this:</p>
  
  <pre><code>go build -ldflags "-X main.Debug=true"
  </code></pre>
  
  <p>but I would prefer to use 1st line comment method particularly as this approach doesn't omit debug code from the build (I presume).</p>
  
  <p>Ideally I want:</p>
  
  <p><em>debug-on.go</em></p>
  
  <pre><code>// +build debug
  
  package debug
  
  func Debug() bool {
      return true
  }
  </code></pre>
  
  <p>and <em>debug-off.go</em></p>
  
  <pre><code>// +build !debug
  
  package debug
  
  func Debug() bool {
      return false
  }
  </code></pre>
  
  <p><strong>Update RE duplicate</strong>
  I accept the related question has the same subject matter but it's really not a duplicate question, that is a question from somebody who already knew about this feature but is struggling with implementation.</p>
  
  <p>My 2 cents is that it seems the equivalent of "What language to people speak in France?" vs "How do you say 'This is not a duplicate' in French?"</p>