Source file src/cmd/cover/doc.go
1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 Cover is a program for analyzing the coverage profiles generated by 7 'go test -coverprofile=cover.out'. 8 9 Cover is also used by 'go test -cover' to rewrite the source code with 10 annotations to track which parts of each function are executed (this 11 is referred to "instrumentation"). Cover can operate in "legacy mode" 12 on a single Go source file at a time, or when invoked by the Go tool 13 it will process all the source files in a single package at a time 14 (package-scope instrumentation is enabled via "-pkgcfg" option). 15 16 When generated instrumented code, the cover tool computes approximate 17 basic block information by studying the source. It is thus more 18 portable than binary-rewriting coverage tools, but also a little less 19 capable. For instance, it does not probe inside && and || expressions, 20 and can be mildly confused by single statements with multiple function 21 literals. 22 23 When computing coverage of a package that uses cgo, the cover tool 24 must be applied to the output of cgo preprocessing, not the input, 25 because cover deletes comments that are significant to cgo. 26 27 For usage information, please see: 28 29 go help testflag 30 go tool cover -help 31 */ 32 package main 33