Commit f5a1dd88 authored by Rob Pike's avatar Rob Pike

doc/progs: update for go 1

Fixes #3076.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5727056
parent 2c0a46d6
......@@ -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)
}</pre>
......
......@@ -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
......
......@@ -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)
}
......
......@@ -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"
......@@ -57,3 +57,7 @@ func CopyDigits(filename string) []byte {
}
// STOP OMIT
func main() {
// place holder; no need to run
}
......@@ -72,7 +72,6 @@ $BROKEN ||
./test.bash
) || exit $?
$BROKEN ||
(xcd ../doc/progs
time ./run
) || exit $?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment