github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/cover/doc.go (about)

     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は、'go test -coverprofile=cover.out'で生成されるカバレッジプロファイルを解析するためのプログラムです。
     7  
     8  Cover is also used by 'go test -cover' to rewrite the source code with
     9  annotations to track which parts of each function are executed (this
    10  is referred to "instrumentation"). Cover can operate in "legacy mode"
    11  on a single Go source file at a time, or when invoked by the Go tool
    12  it will process all the source files in a single package at a time
    13  (package-scope instrumentation is enabled via "-pkgcfg" option).
    14  
    15  インストゥルメンテーションされたコードを生成する際、カバレッジツールはソースコードを調査しておおよその基本ブロック情報を計算します。したがって、バイナリ書き換えカバレッジツールよりも移植性は高くなりますが、少し機能は制限されます。たとえば、&&および||式の内部にはプローブを挿入せず、単一の文に複数の関数リテラルがある場合には僅かに混乱する可能性があります。
    16  
    17  cgoを使用するパッケージのカバレッジを計算する場合、カバレッジツールは入力ではなく、cgoの前処理の出力に適用する必要があります。なぜなら、カバレッジツールはcgoにとって重要なコメントを削除するからです。
    18  
    19  使用方法については、次を参照してください:
    20  
    21  	go help testflag
    22  	go tool cover -help
    23  */package main