diff --git a/doc/Makefile b/doc/Makefile index b6e475b84e9..23262da944d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -25,3 +25,8 @@ all: $(RAWHTML) 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 6cacac6303a..fc793591b55 100644 --- a/doc/effective_go.html +++ b/doc/effective_go.html @@ -2973,7 +2973,7 @@ for instance, a URL, saving you typing the URL into the phone's tiny keyboard. Here's the complete program. An explanation follows.

-{{code "/doc/progs/eff_qr.go"}} +{{code "/doc/progs/eff_qr.go" `/package/` `$`}}

The pieces up to main 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 b79ee368a46..1a2dc6c964d 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 f38473b13e5..9999af344b9 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 435fd0402d4..c4f4791e8c7 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 3808d62179c..30b8935723c 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 2e11020abf5..006a474b5d0 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 00000000000..0cdf53a2713 --- /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 cad66b0702b..ff7eaf9d890 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 00000000000..6110685cd8b --- /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 b45961114dd..a0c3d505850 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 00000000000..df763f3b301 --- /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 de96a0208f4..4ac745c9307 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 11c885abf82..c9b18ba9354 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 00000000000..fd01a7d47ce --- /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 f85a5273a45..f5073266525 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 2b0e0c3563a..aad1dc8e8ef 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 e4e57e077b5..9f1b3007279 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 8f35cf74bb8..bf234c98f8b 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 50fd93441f4..a4dc64d4696 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 7077ca159f9..d95f765d811 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 85bb41cdca7..acd18382f71 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 bb73c8a714f..0a1f7acb1a6 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 c4c401e729e..d331834fc6b 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 00000000000..809b31bf60e --- /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 fcb5d9fd039..e5b78b48521 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 00000000000..616d3078b46 --- /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 13d0f08079c..95d72a0b2e3 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 00000000000..3fe35dea550 --- /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 c46fddf07a1..ec0e4613d5d 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 00000000000..cb1b7776b5b --- /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 0bb5c7608e1..b9e27d6dad5 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 00000000000..2da80c1fb93 --- /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 62eeecdb923..5e6eefa04a5 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 00000000000..fcd13c0c083 --- /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 c2925d590d5..6972b728714 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 a541d94e483..85e7d516364 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 00000000000..085bd017ad3 --- /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 9e10f4743df..887d7d18307 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 6089ae6710c..f358feaa299 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 00000000000..8f2dea57df2 --- /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 a04fdfa506a..41eb3730c51 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 49263022065..ee38f31ad96 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 6d7a4ca8c47..9ab972df89a 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 8e440103efc..0461684b705 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 5221770ec6b..fbc39caac21 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 7145bc93e18..a12bc2ab1c8 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 00000000000..d4ecfbeba79 --- /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 64398ccc5fa..47119266233 100644 --- a/src/run.bat +++ b/src/run.bat @@ -70,7 +70,10 @@ go run %GOROOT%\test\run.go - ..\misc\cgo\life 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. ::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