From ea78a4a7a27e96a5de269a29d08530228cb8a1bf Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Thu, 12 Sep 2013 16:46:08 +1000 Subject: [PATCH] doc/go1.2.html: cover, template, vet R=golang-dev, adg CC=golang-dev https://golang.org/cl/13373053 --- doc/go1.2.html | 147 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 27 deletions(-) diff --git a/doc/go1.2.html b/doc/go1.2.html index 1fe616a6d3..ec1c0259f9 100644 --- a/doc/go1.2.html +++ b/doc/go1.2.html @@ -142,13 +142,16 @@ go/build: support including C++ code with cgo (CL 8248043). -

Godoc moved to the go.tools subrepository

+

Godoc and vet moved to the go.tools subrepository

-A binary is still included with the distribution, but the source code for the -godoc command has moved to the +Both binaries are still included with the distribution, but the source code for the +godoc and vet commands has moved to the go.tools subrepository. -The core of the program has been split into a +

+ +

+Also, the core of the godoc program has been split into a library, while the command itself is in a separate directory. @@ -158,29 +161,24 @@ makes it easier to construct custom binaries for local sites and different deplo

Updating: -Since godoc was not part of the library, -no client code depends on the godoc sources and no updating is required. +Since godoc and vet are not part of the library, +no client Go code depends on the their source and no updating is required.

The binary distributions available from golang.org -include a godoc binary, so users of these distributions are unaffected. +include these binaries, so users of these distributions are unaffected.

-When building from source, users must use "go get" to install godoc. +When building from source, users must use "go get" to install godoc and vet.

 $ go get code.google.com/p/go.tools/cmd/godoc
+$ go get code.google.com/p/go.tools/cmd/vet
 
-

The vet tool moved to the go.tools subrepository

- -

-TODO -

-

Status of gccgo

@@ -212,19 +210,88 @@ TODO: write prose -

Changes to the go command

+

Test coverage

- +

+The cover tool does two things. +First, when "go test" is given the -cover flag, it is run automatically +to rewrite the source for the package and insert instrumentation statements. +The test is then compiled and run as usual, and basic coverage statistics are reported: +

+ +
+$ go test -cover fmt
+ok  	fmt	0.060s	coverage: 91.4% of statements
+$
+
+ +

+Second, for more detailed reports, different flags to "go test" can create a coverage profile file, +which the cover program, invoked with "go tool cover", can then analyze. +

+ +

+Details on how to generate and analyze coverage statistics can be found by running the commands +

+ +
+$ go help testflag
+$ go tool cover -help
+
+ +

The go doc command is deleted

+ +

+The "go doc" command is deleted. +Note that the godoc tool itself is not deleted, +just the wrapping of it by the go command. +All it did was show the documents for a package by package path, +which godoc itself already does with more flexibility. +It has therefore been deleted to reduce the number of documentation tools and, +as part of the restructuring of godoc, encourage better options in future. +

+ +

+Updating: For those who still need the precise functionality of running +

+ +
+$ go doc
+
+ +

+in a directory, the behavior is identical to running +

+ +
+$ godoc .
+
+ +

Changes to the go command

+ +

+The go get command +now has a -t flag that causes it to download the dependencies +of the tests run by the package, not just those of the package itself. +By default, as before, dependencies of the tests are not downloaded. +

Additional platforms

@@ -429,10 +496,20 @@ The two forms are identical in effect; the difference is just in the syntax.

-Updating: Neither change affects existing programs. Those that +Finally, the package +now correctly diagnoses unmatched right delimiters. +They were accepted without complaint before, and templates that had them +will now fail to parse. +

+ +

+Updating: Neither the "else if" change nor the comparison functions +affect existing programs. Those that already define functions called eq and so on through a function map are unaffected because the associated function map will override the new default function definitions. +Templates with unmatched right delimiters will now fail to parse and will need +to be fixed by hand.

Minor changes to the library

@@ -471,11 +548,22 @@ can now decompress concatenated archives. The compress/flate package adds a Reset method on the Writer, -allowing compression of one file to start with another's dictionary. +to make it possible to reduce allocation when, for instance, constructing an +archive to hold multiple compressed files. + + +
  • +The compress/gzip package's +Writer type adds a +Reset +so it may be reused.
  • -compress/gzip: add Reset method on Writer (CL 13435043). +The compress/zlib package's +Writer type adds a +Reset +so it may be reused.
  • @@ -644,7 +732,12 @@ so that less intermediate buffering is required in general.
  • -net: TODO new build tag netgo for building a pure Go net package (CL 7100050). +The net package requires cgo by default +because the host operating system must in general mediate network call setup. +On some systems, though, it is possible to use the network without cgo, and useful +to do so, for instance to avoid dynamic linking. +The new build tag netgo (off by default) allows the construction of a +net package in pure Go on those systems where it is possible.
  • -- 2.48.1