goyaml: fix printing of bare hyphens

related to bug #1227952. Quote a bare hypen rather than treating it as
the start of a block.

R=wallyworld, jameinel
CC=
https://codereview.appspot.com/26430043
diff --git a/decode_test.go b/decode_test.go
index 5d12196..83696b5 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -402,6 +402,7 @@
 	{"v:\n- [A,", "YAML error: line 2: did not find expected node content"},
 	{"a: *b\n", "YAML error: Unknown anchor 'b' referenced"},
 	{"a: &a\n  b: *a\n", "YAML error: Anchor 'a' value contains itself"},
+	{"value: -", "YAML error: block sequence entries are not allowed in this context"},
 }
 
 func (s *S) TestUnmarshalErrors(c *C) {
diff --git a/emitterc.go b/emitterc.go
index ac63f28..8fe2363 100644
--- a/emitterc.go
+++ b/emitterc.go
@@ -1012,7 +1012,7 @@
 		return true
 	}
 
-	if (value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.') {
+	if len(value) == 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) {
 		block_indicators = true
 		flow_indicators = true
 	}
diff --git a/encode_test.go b/encode_test.go
index 5d16426..2887466 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -93,6 +93,9 @@
 	}, {
 		map[string]interface{}{"a": map[interface{}]interface{}{"b": "c"}},
 		"a:\n  b: c\n",
+	}, {
+		map[string]interface{}{"a": "-"},
+		"a: '-'\n",
 	},
 
 	// Simple values.