title: Golang conditional compilation
body: <p>I've got a trouble with conditional compilation in Go 1.</p>
  
  <p>Here is my test code. Is there anything I misunderstand about the "// +build" constraint and the "-tags" flag?</p>
  
  <p>main1.go</p>
  
  <pre><code>// +build main1
  package main
  
  import (
      "fmt"
  )
  
  func main() {
      fmt.Println("This is main 1")
  }
  </code></pre>
  
  <p>main2.go</p>
  
  <pre><code>// +build main2
  package main
  
  import (
      "fmt"
  )
  
  func main() {
      fmt.Println("This is main 2")
  }
  </code></pre>
  
  <p>when running "go build", I still got compile error</p>
  
  <pre><code>$ go build -tags 'main1'
  # test
  ./main2.go:8: main redeclared in this block
          previous declaration at ./main1.go:8
  </code></pre>