]> Cypherpunks repositories - gostls13.git/commitdiff
bike/shed: new package.
authorDavid Symonds <dsymonds@golang.org>
Fri, 10 Jun 2011 12:32:45 +0000 (22:32 +1000)
committerDavid Symonds <dsymonds@golang.org>
Fri, 10 Jun 2011 12:32:45 +0000 (22:32 +1000)
It comes up often enough that it's time to provide
the utility of a standard package.

R=r, mirtchovski, adg, rsc, n13m3y3r, ality, go.peter.90, lstoakes, iant, jan.mercl, bsiegert, robert.hencke, rogpeppe, befelemepeseveze, kevlar
CC=golang-dev
https://golang.org/cl/4557047

src/pkg/Makefile
src/pkg/bike/shed/Makefile [new file with mode: 0644]
src/pkg/bike/shed/colors.go [new file with mode: 0644]
src/pkg/bike/shed/colors_test.go [new file with mode: 0644]

index 2d6b3d0146d1b9354ae099f782c7a7d9df3e812b..a04ddc110379cc65f9fbc9a0eeb8d05b988deb78 100644 (file)
@@ -18,6 +18,7 @@ DIRS=\
        archive/zip\
        asn1\
        big\
+       bike/shed\
        bufio\
        bytes\
        cmath\
diff --git a/src/pkg/bike/shed/Makefile b/src/pkg/bike/shed/Makefile
new file mode 100644 (file)
index 0000000..a2538a1
--- /dev/null
@@ -0,0 +1,11 @@
+# Copyright 2011 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.
+
+include ../../../Make.inc
+
+TARG=bike/shed
+GOFILES=\
+       colors.go\
+
+include ../../../Make.pkg
diff --git a/src/pkg/bike/shed/colors.go b/src/pkg/bike/shed/colors.go
new file mode 100644 (file)
index 0000000..0466b04
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2011 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.
+
+/*
+Package shed defines colors for bike sheds.
+
+See http://red.bikeshed.org/ for more details.
+
+TODO: More colors, colour support, stripes, methods, ponies.
+*/
+package shed
+
+// A Color represents a color, or a colour if you're colonial enough.
+type Color uint8
+
+const (
+       Red Color = iota
+       Green
+       Yellow
+       Blue
+       Purple
+       Magenta
+       Chartreuse
+       Cyan
+)
diff --git a/src/pkg/bike/shed/colors_test.go b/src/pkg/bike/shed/colors_test.go
new file mode 100644 (file)
index 0000000..b2ac3c1
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2011 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.
+
+package shed
+
+import (
+       "testing"
+)
+
+func TestCompilerIsNotColorBlind(t *testing.T) {
+       if Red == Green {
+               t.Error("Expected Red != Green, but couldn't distinguish them")
+       }
+}