aboutsummaryrefslogtreecommitdiff
path: root/content/constants/float1.go
diff options
context:
space:
mode:
Diffstat (limited to 'content/constants/float1.go')
-rw-r--r--content/constants/float1.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/content/constants/float1.go b/content/constants/float1.go
new file mode 100644
index 0000000..96b3bb9
--- /dev/null
+++ b/content/constants/float1.go
@@ -0,0 +1,18 @@
+// +build OMIT
+
+package main
+
+import "fmt"
+
+func main() {
+ // START OMIT
+ type MyFloat64 float64
+ const Zero = 0.0
+ const TypedZero float64 = 0.0
+ var mf MyFloat64
+ mf = 0.0 // OK
+ mf = Zero // OK
+ mf = TypedZero // Bad
+ fmt.Println(mf)
+ // STOP OMIT
+}