diff --git a/doc/go1.html b/doc/go1.html
index 83a7653c40e..8b67cd3aa07 100644
--- a/doc/go1.html
+++ b/doc/go1.html
@@ -953,7 +953,7 @@ func sleepUntil(wakeup time.Time) {
return
}
delta := wakeup.Sub(now) // A Duration.
- log.Printf("Sleeping for %.3fs", delta.Seconds())
+ fmt.Printf("Sleeping for %.3fs\n", delta.Seconds())
time.Sleep(delta)
}
diff --git a/doc/progs/error.go b/doc/progs/error.go
index ffa7ec1ccae..f85a5273a45 100644
--- a/doc/progs/error.go
+++ b/doc/progs/error.go
@@ -102,7 +102,10 @@ func decodeError(dec *json.Decoder, val struct{}) error { // OMIT
return nil
}
-func findLine(os.FileInfo, int64) (int, int)
+func findLine(os.FileInfo, int64) (int, int) {
+ // place holder; no need to run
+ return 0, 0
+}
func netError(err error) { // OMIT
for { // OMIT
diff --git a/doc/progs/go1.go b/doc/progs/go1.go
index 1507d5b33b5..50fd93441f4 100644
--- a/doc/progs/go1.go
+++ b/doc/progs/go1.go
@@ -35,6 +35,11 @@ func main() {
var timeout = flag.Duration("timeout", 30*time.Second, "how long to wait for completion")
+func init() {
+ // canonicalize the logging
+ log.SetFlags(0)
+}
+
func mapDelete() {
m := map[string]int{"7": 7, "23": 23}
k := "7"
@@ -177,7 +182,7 @@ func sleepUntil(wakeup time.Time) {
return
}
delta := wakeup.Sub(now) // A Duration.
- log.Printf("Sleeping for %.3fs", delta.Seconds())
+ fmt.Printf("Sleeping for %.3fs\n", delta.Seconds())
time.Sleep(delta)
}
diff --git a/doc/progs/run b/doc/progs/run
index 2470d5e8e02..e3d5c128c8c 100755
--- a/doc/progs/run
+++ b/doc/progs/run
@@ -5,63 +5,49 @@
set -e
-eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
-
-if [ -z "$O" ]; then
- echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
- exit 1
-fi
-
-rm -f *.$O
-
defer_panic_recover="
- defer.go
- defer2.go
+ defer
+ defer2
"
effective_go="
- eff_bytesize.go
- eff_qr.go
- eff_sequence.go
+ eff_bytesize
+ eff_qr
+ eff_sequence
"
error_handling="
- error.go
- error2.go
- error3.go
- error4.go
+ error
+ error2
+ error3
+ error4
"
-for i in \
- $defer_panic_recover \
- $effective_go \
- $error_handling \
- slices.go \
- go1.go \
-; do
- $GC $i
+all=$(echo $defer_panic_recover $effective_go $error_handling slices go1)
+
+for i in $all; do
+ go build $i.go
done
# Write to temporary file to avoid mingw bash bug.
TMPFILE="/tmp/gotest3.$USER"
function testit {
- $LD $1.$O
- ./$O.out $2 2>&1 >"$TMPFILE" || true
+ ./$1 >"$TMPFILE" 2>&1 || true
x=$(echo $(cat "$TMPFILE")) # extra echo canonicalizes
- if [ "$x" != "$3" ]
+ if ! echo "$x" | grep "$2" > /dev/null
then
- echo $1 failed: '"'$x'"' is not '"'$3'"'
+ echo $1 failed: '"'$x'"' is not '"'$2'"'
fi
}
-testit defer "" "0 3210 2"
-testit defer2 "" "Calling g. Printing in g 0 Printing in g 1 Printing in g 2 Printing in g 3 Panicking! Defer in g 3 Defer in g 2 Defer in g 1 Defer in g 0 Recovered in f 4 Returned normally from f."
+testit defer '^0 3210 2$'
+testit defer2 '^Calling g. Printing in g 0 Printing in g 1 Printing in g 2 Printing in g 3 Panicking! Defer in g 3 Defer in g 2 Defer in g 1 Defer in g 0 Recovered in f 4 Returned normally from f.$'
-testit eff_bytesize "" "1.00YB 9.09TB"
-testit eff_sequence "" "[-1 2 6 16 44]"
+testit eff_bytesize '^1.00YB 9.09TB$'
+testit eff_sequence '^\[-1 2 6 16 44\]$'
-testit go1 "" "Christmas is a holiday: true"
+testit go1 '^Christmas is a holiday: true Sleeping for 0.123s.*go1.go already exists$'
-rm -f $O.out $O.out.exe *.$O "$TMPFILE"
+rm -f $all "$TMPFILE"
diff --git a/doc/progs/slices.go b/doc/progs/slices.go
index 72fb4b7c17b..8e440103efc 100644
--- a/doc/progs/slices.go
+++ b/doc/progs/slices.go
@@ -57,3 +57,7 @@ func CopyDigits(filename string) []byte {
}
// STOP OMIT
+
+func main() {
+ // place holder; no need to run
+}
diff --git a/src/run.bash b/src/run.bash
index d818751b2c6..fd3b1f27b7c 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -72,7 +72,6 @@ $BROKEN ||
./test.bash
) || exit $?
-$BROKEN ||
(xcd ../doc/progs
time ./run
) || exit $?