"flag"
"fmt"
"internal/buildcfg"
- "internal/coverage"
+ "internal/coverage/covcmd"
"internal/platform"
"log"
"os"
Patterns map[string][]string
Files map[string]string
}
- ImportDirs []string // appended to by -I
- ImportMap map[string]string // set by -importcfg
- PackageFile map[string]string // set by -importcfg; nil means not in use
- CoverageInfo *coverage.CoverFixupConfig // set by -coveragecfg
- SpectreIndex bool // set by -spectre=index or -spectre=all
+ ImportDirs []string // appended to by -I
+ ImportMap map[string]string // set by -importcfg
+ PackageFile map[string]string // set by -importcfg; nil means not in use
+ CoverageInfo *covcmd.CoverFixupConfig // set by -coveragecfg
+ SpectreIndex bool // set by -spectre=index or -spectre=all
// Whether we are adding any sort of code instrumentation, such as
// when the race detector is enabled.
Instrumenting bool
}
func readCoverageCfg(file string) {
- var cfg coverage.CoverFixupConfig
+ var cfg covcmd.CoverFixupConfig
data, err := os.ReadFile(file)
if err != nil {
log.Fatalf("-coveragecfg: %v", err)
import (
"encoding/json"
"fmt"
- "internal/coverage"
+ "internal/coverage/covcmd"
"internal/testenv"
"os"
"path/filepath"
func writePkgConfig(t *testing.T, outdir, tag, ppath, pname string, gran string) string {
incfg := filepath.Join(outdir, tag+"incfg.txt")
outcfg := filepath.Join(outdir, "outcfg.txt")
- p := coverage.CoverPkgConfig{
+ p := covcmd.CoverPkgConfig{
PkgPath: ppath,
PkgName: pname,
Granularity: gran,
"go/parser"
"go/token"
"internal/coverage"
+ "internal/coverage/covcmd"
"internal/coverage/encodemeta"
"internal/coverage/slicewriter"
"io"
package name, module path, and related info from "go build",
and -outfilelist points to a file containing the filenames
of the instrumented output files (one per input file).
-See https://pkg.go.dev/internal/coverage#CoverPkgConfig for
+See https://pkg.go.dev/internal/coverage/covcmd#CoverPkgConfig for
more on the package config.
`
pkgcfg = flag.String("pkgcfg", "", "enable full-package instrumentation mode using params from specified config file")
)
-var pkgconfig coverage.CoverPkgConfig
+var pkgconfig covcmd.CoverPkgConfig
// outputfiles is the list of *.cover.go instrumented outputs to write,
// one per input (set when -pkgcfg is in use)
}
fmt.Fprintf(w, "}\n")
- fixcfg := coverage.CoverFixupConfig{
+ fixcfg := covcmd.CoverFixupConfig{
Strategy: "normal",
MetaVar: mkMetaVar(),
MetaLen: len(payload),
"go/constant",
"internal/abi",
"internal/coverage",
+ "internal/coverage/covcmd",
"internal/bisect",
"internal/buildcfg",
"internal/goarch",
"errors"
"fmt"
"go/token"
- "internal/coverage"
+ "internal/coverage/covcmd"
"internal/lazyregexp"
"io"
"io/fs"
func (b *Builder) writeCoverPkgInputs(a *Action, pconfigfile string, covoutputsfile string, outfiles []string) error {
p := a.Package
p.Internal.CoverageCfg = a.Objdir + "coveragecfg"
- pcfg := coverage.CoverPkgConfig{
+ pcfg := covcmd.CoverPkgConfig{
PkgPath: p.ImportPath,
PkgName: p.Name,
// Note: coverage granularity is currently hard-wired to
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package coverage
+package covcmd
// CoverPkgConfig is a bundle of information passed from the Go
// command to the cover command during "go build -cover" runs. The
// Counter granularity (perblock or perfunc).
CounterGranularity string
}
-
-// MetaFilePaths contains information generated by the Go command and
-// the read in by coverage test support functions within an executing
-// "go test -cover" binary.
-type MetaFileCollection struct {
- ImportPaths []string
- MetaFileFragments []string
-}
-
-// Name of file within the "go test -cover" temp coverdir directory
-// containing a list of meta-data files for packages being tested
-// in a "go test -coverpkg=... ..." run. This constant is shared
-// by the Go command and by the coverage runtime.
-const MetaFilesFileName = "metafiles.txt"
return "<invalid>"
}
+// Name of file within the "go test -cover" temp coverdir directory
+// containing a list of meta-data files for packages being tested
+// in a "go test -coverpkg=... ..." run. This constant is shared
+// by the Go command and by the coverage runtime.
+const MetaFilesFileName = "metafiles.txt"
+
+// MetaFilePaths contains information generated by the Go command and
+// the read in by coverage test support functions within an executing
+// "go test -cover" binary.
+type MetaFileCollection struct {
+ ImportPaths []string
+ MetaFileFragments []string
+}
+
//.....................................................................
//
// Counter data definitions: