<pre class="notranslate">The spec does not prohibit multiple integer constant case values from being equal:

var x int
switch x {
case 1:
case 1:
}

is not illegal according to <a href="http://tip.golang.org/ref/spec#Switch_statements" rel="nofollow">http://tip.golang.org/ref/spec#Switch_statements</a> . However,
running this program ( <a href="http://play.golang.org/p/MkI5XjE1TS" rel="nofollow">http://play.golang.org/p/MkI5XjE1TS</a> ) results in:

prog.go:7: duplicate case in switch
    previous case at prog.go:6

using the gc compiler.</pre>
<pre class="notranslate">The makefiles in $(GOROOT)/src/ seem to me structured thus:
Make.$(GOARCH) should have all of the archictecture-dependent flags
Make.{pkg,cmd} never has to care about the system configuration, it expects such
variables to be 
set

The latter is only half-true... it has compiler names, which are a product of the system 
architecture, factored out.  Thus, I think we should also have Make.$(GOOS) that defines
os-
dependent flags.

This would do two things: it would factor out a few of the nastier CGO things in a way
which 
other build tools would be able to pull from without grepping or working around
Make.pkg, and 
it would make it easier for people to see the things which are system dependent and that
which is 
not.  It would, however, require cgo package makefile to include Make.$(GOOS) as well as 
Make.$(GOARCH).  Which I think is legit.  Or, of course, we could automatically include
the GOOS 
one in Make.pkg.

The patch that I included below is the best way I could come up with to make the changes
and 
impact the fewest people... I would prefer moving the _CGO_LDFLAGS_$(GOARCH) variables
to 
simply CGO_LDFLAGS in separate include files, which would require that people either
duplicate 
them or always use += in their makefiles.

I would like people's thoughts on this.  I didn't want to submit a CL about this, as it
seems not 
just a question about whether or not to fix it but a question about just how far the fix
should go.

What is your $GOOS?  $GOARCH?
darwin amd64

Which revision are you using?  (hg identify)
a85ad0a64015 release.2010-05-27/release

diff -r a85ad0a64015 src/Make.386
--- a/src/Make.386  Thu May 27 16:50:31 2010 -0700
+++ b/src/Make.386  Thu Jun 03 15:08:06 2010 -0400
@@ -9,3 +9,4 @@
 LD=${O}l
 OS=568vq
 CFLAGS=-FVw
+_CGO_CFLAGS_386=-m32
diff -r a85ad0a64015 src/Make.amd64
--- a/src/Make.amd64    Thu May 27 16:50:31 2010 -0700
+++ b/src/Make.amd64    Thu Jun 03 15:08:06 2010 -0400
@@ -9,3 +9,5 @@
 LD=${O}l
 OS=568vq
 CFLAGS=-FVw
+_CGO_CFLAGS_amd64=-m64
+RUNTIME_CFLAGS_amd64=-D_64BIT
diff -r a85ad0a64015 src/Make.darwin
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Make.darwin   Thu Jun 03 15:08:06 2010 -0400
@@ -0,0 +1,5 @@
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+_CGO_LDFLAGS_darwin=-dynamiclib -Wl,-undefined,dynamic_lookup
diff -r a85ad0a64015 src/Make.freebsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Make.freebsd  Thu Jun 03 15:08:06 2010 -0400
@@ -0,0 +1,1 @@
+_CGO_LDFLAGS_freebsd=-shared -lpthread -lm
diff -r a85ad0a64015 src/Make.linux
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Make.linux    Thu Jun 03 15:08:06 2010 -0400
@@ -0,0 +1,1 @@
+_CGO_LDFLAGS_linux=-shared -lpthread -lm
diff -r a85ad0a64015 src/Make.pkg
--- a/src/Make.pkg  Thu May 27 16:50:31 2010 -0700
+++ b/src/Make.pkg  Thu Jun 03 15:08:06 2010 -0400
@@ -126,17 +126,8 @@
 # added _cgo_defun.$O to $OFILES, and added the installed copy of
 # package_x.so (built from x.cgo2.c) to $(INSTALLFILES).
 
-RUNTIME_CFLAGS_amd64=-D_64BIT
 RUNTIME_CFLAGS=-I"$(GOROOT)/src/pkg/runtime" $(RUNTIME_CFLAGS_$(GOARCH))
 
-# Have to run gcc with the right size argument on hybrid 32/64 machines.
-_CGO_CFLAGS_386=-m32
-_CGO_CFLAGS_amd64=-m64
-_CGO_LDFLAGS_freebsd=-shared -lpthread -lm
-_CGO_LDFLAGS_linux=-shared -lpthread -lm
-_CGO_LDFLAGS_darwin=-dynamiclib -Wl,-undefined,dynamic_lookup
-
-
 # Compile x.cgo4.c with gcc to make package_x.so.
 
 # Compile _cgo_defun.c with 6c; needs access to the runtime headers.</pre>