doc/progs: use test/run.go for testing on Windows
cgo[1-4].go, go1.go couldn't be tested now
(cgo[1-4].go can only be tested when cgo is enabled, go1.go
contain a list of filenames in the current directory)
R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6218048
diff --git a/doc/Makefile b/doc/Makefile
index b6e475b..23262da 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -25,3 +25,8 @@
clean:
rm -f $(RAWHTML)
+
+compare:
+ for i in $(RAWHTML); do \
+ godoc -url /doc/$${i/.rawhtml/.html} | diff -u $$i -; \
+ done
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 6cacac6..fc79359 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -2973,7 +2973,7 @@
Here's the complete program.
An explanation follows.
</p>
-{{code "/doc/progs/eff_qr.go"}}
+{{code "/doc/progs/eff_qr.go" `/package/` `$`}}
<p>
The pieces up to <code>main</code> should be easy to follow.
The one flag sets a default HTTP port for our server. The template
diff --git a/doc/progs/cgo1.go b/doc/progs/cgo1.go
index b79ee36..1a2dc6c 100644
--- a/doc/progs/cgo1.go
+++ b/doc/progs/cgo1.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo2.go b/doc/progs/cgo2.go
index f38473b..9999af3 100644
--- a/doc/progs/cgo2.go
+++ b/doc/progs/cgo2.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo3.go b/doc/progs/cgo3.go
index 435fd04..c4f4791 100644
--- a/doc/progs/cgo3.go
+++ b/doc/progs/cgo3.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo4.go b/doc/progs/cgo4.go
index 3808d62..30b8935 100644
--- a/doc/progs/cgo4.go
+++ b/doc/progs/cgo4.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/defer.go b/doc/progs/defer.go
index 2e11020a..006a474 100644
--- a/doc/progs/defer.go
+++ b/doc/progs/defer.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/defer.out b/doc/progs/defer.out
new file mode 100644
index 0000000..0cdf53a
--- /dev/null
+++ b/doc/progs/defer.out
@@ -0,0 +1,3 @@
+0
+3210
+2
diff --git a/doc/progs/defer2.go b/doc/progs/defer2.go
index cad66b0..ff7eaf9 100644
--- a/doc/progs/defer2.go
+++ b/doc/progs/defer2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/defer2.out b/doc/progs/defer2.out
new file mode 100644
index 0000000..6110685
--- /dev/null
+++ b/doc/progs/defer2.out
@@ -0,0 +1,12 @@
+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.
diff --git a/doc/progs/eff_bytesize.go b/doc/progs/eff_bytesize.go
index b459611..a0c3d50 100644
--- a/doc/progs/eff_bytesize.go
+++ b/doc/progs/eff_bytesize.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2009 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.
diff --git a/doc/progs/eff_bytesize.out b/doc/progs/eff_bytesize.out
new file mode 100644
index 0000000..df763f3
--- /dev/null
+++ b/doc/progs/eff_bytesize.out
@@ -0,0 +1 @@
+1.00YB 9.09TB
diff --git a/doc/progs/eff_qr.go b/doc/progs/eff_qr.go
index de96a02..4ac745c 100644
--- a/doc/progs/eff_qr.go
+++ b/doc/progs/eff_qr.go
@@ -1,3 +1,9 @@
+// compile
+
+// Copyright 2009 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.
+
package main
import (
diff --git a/doc/progs/eff_sequence.go b/doc/progs/eff_sequence.go
index 11c885a..c9b18ba 100644
--- a/doc/progs/eff_sequence.go
+++ b/doc/progs/eff_sequence.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2009 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.
diff --git a/doc/progs/eff_sequence.out b/doc/progs/eff_sequence.out
new file mode 100644
index 0000000..fd01a7d
--- /dev/null
+++ b/doc/progs/eff_sequence.out
@@ -0,0 +1 @@
+[-1 2 6 16 44]
diff --git a/doc/progs/error.go b/doc/progs/error.go
index f85a527..f507326 100644
--- a/doc/progs/error.go
+++ b/doc/progs/error.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error2.go b/doc/progs/error2.go
index 2b0e0c3..aad1dc8 100644
--- a/doc/progs/error2.go
+++ b/doc/progs/error2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error3.go b/doc/progs/error3.go
index e4e57e0..9f1b300 100644
--- a/doc/progs/error3.go
+++ b/doc/progs/error3.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error4.go b/doc/progs/error4.go
index 8f35cf7..bf234c9 100644
--- a/doc/progs/error4.go
+++ b/doc/progs/error4.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/go1.go b/doc/progs/go1.go
index 50fd934..a4dc64d 100644
--- a/doc/progs/go1.go
+++ b/doc/progs/go1.go
@@ -1,3 +1,6 @@
+// compile
+// this file will output a list of filenames in cwd, not suitable for cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/gobs1.go b/doc/progs/gobs1.go
index 7077ca1..d95f765 100644
--- a/doc/progs/gobs1.go
+++ b/doc/progs/gobs1.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/gobs2.go b/doc/progs/gobs2.go
index 85bb41c..acd1838 100644
--- a/doc/progs/gobs2.go
+++ b/doc/progs/gobs2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/image_draw.go b/doc/progs/image_draw.go
index bb73c8a..0a1f7ac 100644
--- a/doc/progs/image_draw.go
+++ b/doc/progs/image_draw.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package1.go b/doc/progs/image_package1.go
index c4c401e..d331834 100644
--- a/doc/progs/image_package1.go
+++ b/doc/progs/image_package1.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package1.out b/doc/progs/image_package1.out
new file mode 100644
index 0000000..809b31b
--- /dev/null
+++ b/doc/progs/image_package1.out
@@ -0,0 +1 @@
+X is 2 Y is 1
diff --git a/doc/progs/image_package2.go b/doc/progs/image_package2.go
index fcb5d9f..e5b78b4 100644
--- a/doc/progs/image_package2.go
+++ b/doc/progs/image_package2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package2.out b/doc/progs/image_package2.out
new file mode 100644
index 0000000..616d307
--- /dev/null
+++ b/doc/progs/image_package2.out
@@ -0,0 +1 @@
+3 4 false
diff --git a/doc/progs/image_package3.go b/doc/progs/image_package3.go
index 13d0f08..95d72a0 100644
--- a/doc/progs/image_package3.go
+++ b/doc/progs/image_package3.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package3.out b/doc/progs/image_package3.out
new file mode 100644
index 0000000..3fe35de
--- /dev/null
+++ b/doc/progs/image_package3.out
@@ -0,0 +1 @@
+3 4 true
diff --git a/doc/progs/image_package4.go b/doc/progs/image_package4.go
index c46fddf..ec0e461 100644
--- a/doc/progs/image_package4.go
+++ b/doc/progs/image_package4.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package4.out b/doc/progs/image_package4.out
new file mode 100644
index 0000000..cb1b777
--- /dev/null
+++ b/doc/progs/image_package4.out
@@ -0,0 +1 @@
+image.Point{X:2, Y:1}
diff --git a/doc/progs/image_package5.go b/doc/progs/image_package5.go
index 0bb5c76..b9e27d6 100644
--- a/doc/progs/image_package5.go
+++ b/doc/progs/image_package5.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package5.out b/doc/progs/image_package5.out
new file mode 100644
index 0000000..2da80c1
--- /dev/null
+++ b/doc/progs/image_package5.out
@@ -0,0 +1 @@
+{255 0 0 255}
diff --git a/doc/progs/image_package6.go b/doc/progs/image_package6.go
index 62eeecd..5e6eefa 100644
--- a/doc/progs/image_package6.go
+++ b/doc/progs/image_package6.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package6.out b/doc/progs/image_package6.out
new file mode 100644
index 0000000..fcd13c0
--- /dev/null
+++ b/doc/progs/image_package6.out
@@ -0,0 +1,2 @@
+8 4
+true
diff --git a/doc/progs/interface.go b/doc/progs/interface.go
index c2925d5..6972b72 100644
--- a/doc/progs/interface.go
+++ b/doc/progs/interface.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/interface2.go b/doc/progs/interface2.go
index a541d94..85e7d51 100644
--- a/doc/progs/interface2.go
+++ b/doc/progs/interface2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/interface2.out b/doc/progs/interface2.out
new file mode 100644
index 0000000..085bd01
--- /dev/null
+++ b/doc/progs/interface2.out
@@ -0,0 +1 @@
+type: float64
diff --git a/doc/progs/json1.go b/doc/progs/json1.go
index 9e10f47..887d7d1 100644
--- a/doc/progs/json1.go
+++ b/doc/progs/json1.go
@@ -1,3 +1,5 @@
+// run
+
// Copyright 2012 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.
diff --git a/doc/progs/json2.go b/doc/progs/json2.go
index 6089ae6..f358fea 100644
--- a/doc/progs/json2.go
+++ b/doc/progs/json2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/json2.out b/doc/progs/json2.out
new file mode 100644
index 0000000..8f2dea5
--- /dev/null
+++ b/doc/progs/json2.out
@@ -0,0 +1,2 @@
+the circle's area 24.227111172875365
+the reciprocal of i is 0.3601008282319049
diff --git a/doc/progs/json3.go b/doc/progs/json3.go
index a04fdfa..41eb373 100644
--- a/doc/progs/json3.go
+++ b/doc/progs/json3.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/json4.go b/doc/progs/json4.go
index 4926302..ee38f31 100644
--- a/doc/progs/json4.go
+++ b/doc/progs/json4.go
@@ -1,3 +1,5 @@
+// run
+
// Copyright 2012 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.
diff --git a/doc/progs/json5.go b/doc/progs/json5.go
index 6d7a4ca..9ab972d 100644
--- a/doc/progs/json5.go
+++ b/doc/progs/json5.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/slices.go b/doc/progs/slices.go
index 8e44010..0461684 100644
--- a/doc/progs/slices.go
+++ b/doc/progs/slices.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/timeout1.go b/doc/progs/timeout1.go
index 5221770..fbc39ca 100644
--- a/doc/progs/timeout1.go
+++ b/doc/progs/timeout1.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/timeout2.go b/doc/progs/timeout2.go
index 7145bc9..a12bc2a 100644
--- a/doc/progs/timeout2.go
+++ b/doc/progs/timeout2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/update.bash b/doc/progs/update.bash
new file mode 100755
index 0000000..d4ecfbe
--- /dev/null
+++ b/doc/progs/update.bash
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# Copyright 2012 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.
+
+set -e
+
+rm -f *.out *.rej *.orig [568].out
+
+for i in *.go; do
+ if grep -q '^// cmpout$' $i; then
+ echo $i
+ go run $i &> ${i/.go/.out}
+ fi
+done
diff --git a/src/run.bat b/src/run.bat
index 64398cc..4711926 100644
--- a/src/run.bat
+++ b/src/run.bat
@@ -70,7 +70,10 @@
if errorlevel 1 goto fail
echo.
-:: TODO ..\misc\cgo\stdio
+echo # ..\misc\cgo\stdio
+go run %GOROOT%\test\run.go - ..\misc\cgo\stdio
+if errorlevel 1 goto fail
+echo.
:: TODO(brainman): disabled, because it fails with: mkdir C:\Users\ADMINI~1\AppData\Local\Temp\2.....\go\misc\cgo\: The filename or extension is too long.
::echo # ..\misc\cgo\test
@@ -79,6 +82,11 @@
::echo.
:nocgo
+echo # ..\doc\progs
+go run %GOROOT%\test\run.go - ..\doc\progs
+if errorlevel 1 goto fail
+echo.
+
:: TODO: The other tests in run.bash.
echo # test