support/racy: delete program, inline into article
Change-Id: I1ba0d4aacdf23cf3378c7ab82af78d3940aff136
Reviewed-on: https://go-review.googlesource.com/c/blog/+/321669
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/_content/race-detector.article b/_content/race-detector.article
index 5a9a0a7..657bec4 100644
--- a/_content/race-detector.article
+++ b/_content/race-detector.article
@@ -63,10 +63,27 @@
$ go build -race mycmd // build the command
$ go install -race mypkg // install the package
-To try out the race detector for yourself, fetch and run this example program:
+To try out the race detector for yourself, copy this example program into `racy.go`:
- $ go get -race golang.org/x/blog/support/racy
- $ racy
+ package main
+
+ import "fmt"
+
+ func main() {
+ done := make(chan bool)
+ m := make(map[string]string)
+ m["name"] = "world"
+ go func() {
+ m["name"] = "data race"
+ done <- true
+ }()
+ fmt.Println("Hello,", m["name"])
+ <-done
+ }
+
+Then run it with the race detector enabled:
+
+ $ go run -race racy.go
## Examples
diff --git a/support/racy/racy.go b/support/racy/racy.go
deleted file mode 100644
index e23ba9b..0000000
--- a/support/racy/racy.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2013 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.
-
-// +build !appengine
-
-// This program demonstrates a race condition.
-// To observe the race with the race detector, build with -race.
-package main
-
-import "fmt"
-
-func main() {
- done := make(chan bool)
- m := make(map[string]string)
- m["name"] = "world"
- go func() {
- m["name"] = "data race"
- done <- true
- }()
- fmt.Println("Hello,", m["name"])
- <-done
-}