From 01eb87f06aa87b7a2d11b8031f51649ba60375aa Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Mon, 25 Aug 2014 11:43:57 +1000 Subject: go.blog: constants LGTM=gri, adg, rsc R=gri, adg, rsc CC=golang-codereviews https://golang.org/cl/125540043 --- content/constants/string2.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 content/constants/string2.go (limited to 'content/constants/string2.go') diff --git a/content/constants/string2.go b/content/constants/string2.go new file mode 100644 index 0000000..362b484 --- /dev/null +++ b/content/constants/string2.go @@ -0,0 +1,16 @@ +// +build OMIT + +package main + +import "fmt" + +const typedHello string = "Hello, 世界" + +func main() { + // START OMIT + type MyString string + var m MyString + m = typedHello // Type error + fmt.Println(m) + // STOP OMIT +} -- cgit v1.2.3