Full Code of AlekSi/gocov-xml for AI

master 7a638c77803c cached
9 files
20.4 KB
6.6k tokens
6 symbols
1 requests
Download .txt
Repository: AlekSi/gocov-xml
Branch: master
Commit: 7a638c77803c
Files: 9
Total size: 20.4 KB

Directory structure:
gitextract_7ylfuv40/

├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── coverage-04.dtd
├── coverage-with-data.xml
├── go.mod
├── go.sum
└── gocov-xml.go

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.json
coverage.xml

gocov-xml


================================================
FILE: LICENSE
================================================
Copyright (c) 2013 Alexey Palazhchenko

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: Makefile
================================================
all: fvb

prepare:
	go get -u github.com/axw/gocov/...
	go get -u github.com/gorilla/mux/...
	gocov test -v github.com/gorilla/mux > mux.json

fvb:
	gofmt -e -s -w .
	go vet .
	go run ./gocov-xml.go < mux.json > coverage.xml
	xmllint --valid --noout coverage.xml


================================================
FILE: README.md
================================================
# gocov XML

A tool to generate Go coverage in XML report for using with tools/plugins like Jenkins/Cobertura.

> Table of Contents

- [gocov XML](#gocov-xml)
  - [Installation](#installation)
  - [Usage](#usage)
    - [Examples](#examples)
      - [Generate coverage by passing `gocov` output as input to `gocov-xml`](#generate-coverage-by-passing-gocov-output-as-input-to-gocov-xml)
      - [Specifying optional source](#specifying-optional-source)
  - [Authors](#authors)

This is a simple helper tool for generating XML output in [Cobertura](http://cobertura.sourceforge.net/) format
for CIs like [Jenkins](https://wiki.jenkins-ci.org/display/JENKINS/Cobertura+Plugin), [vsts](https://www.visualstudio.com/team-services) and others
from [github.com/axw/gocov](https://github.com/axw/gocov) output.
The generated XML output is in the latest [coverage-04.dtd](http://cobertura.sourceforge.net/xml/coverage-04.dtd) schema

## Installation

Just type the following to install the program and its dependencies:

For Go 1.17 and above:

```bash
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
```

For previous Go versions:

```bash
go get github.com/axw/gocov/...
go get github.com/AlekSi/gocov-xml
```

## Usage

> **NOTE**: `gocov-xml` reads data from the standard input.

```bash
gocov [-source <absolute path to source>]
```

Where,

- **`source`**: Absolute path to source. Defaults to the current working directory.

### Examples

#### Generate coverage by passing `gocov` output as input to `gocov-xml`

```bash
gocov test github.com/gorilla/mux | gocov-xml > coverage.xml
```

#### Specifying optional source

```bash
gocov test github.com/gorilla/mux | gocov-xml -source /abs/path/to/source > coverage.xml
```

## Authors

- [Alexey Palazhchenko (AlekSi)](https://github.com/AlekSi)
- [Yukinari Toyota (t-yuki)](https://github.com/t-yuki)
- [Marin Bek (marinbek)](https://github.com/marinbek)
- [Alex Castle (acastle)](https://github.com/acastle)
- [Billy Yao (yaoyaozong)](https://github.com/yaoyaozong)
- [Abhijith DA (abhijithda)](https://github.com/abhijithda)


================================================
FILE: coverage-04.dtd
================================================
<!-- Portions (C) International Organization for Standardization 1986:
     Permission to copy in any form is granted for use with
     conforming SGML systems and applications as defined in
     ISO 8879, provided this notice is included in all copies.
-->

  <!ELEMENT coverage (sources?,packages)>
  <!ATTLIST coverage line-rate        CDATA #REQUIRED>
  <!ATTLIST coverage branch-rate      CDATA #REQUIRED>
  <!ATTLIST coverage lines-covered    CDATA #REQUIRED>
  <!ATTLIST coverage lines-valid      CDATA #REQUIRED>
  <!ATTLIST coverage branches-covered CDATA #REQUIRED>
  <!ATTLIST coverage branches-valid   CDATA #REQUIRED>
  <!ATTLIST coverage complexity       CDATA #REQUIRED>
  <!ATTLIST coverage version          CDATA #REQUIRED>
  <!ATTLIST coverage timestamp        CDATA #REQUIRED>

  <!ELEMENT sources (source*)>

  <!ELEMENT source (#PCDATA)>

  <!ELEMENT packages (package*)>

  <!ELEMENT package (classes)>
  <!ATTLIST package name        CDATA #REQUIRED>
  <!ATTLIST package line-rate   CDATA #REQUIRED>
  <!ATTLIST package branch-rate CDATA #REQUIRED>
  <!ATTLIST package complexity  CDATA #REQUIRED>

  <!ELEMENT classes (class*)>

  <!ELEMENT class (methods,lines)>
  <!ATTLIST class name        CDATA #REQUIRED>
  <!ATTLIST class filename    CDATA #REQUIRED>
  <!ATTLIST class line-rate   CDATA #REQUIRED>
  <!ATTLIST class branch-rate CDATA #REQUIRED>
  <!ATTLIST class complexity  CDATA #REQUIRED>

  <!ELEMENT methods (method*)>

  <!ELEMENT method (lines)>
  <!ATTLIST method name        CDATA #REQUIRED>
  <!ATTLIST method signature   CDATA #REQUIRED>
  <!ATTLIST method line-rate   CDATA #REQUIRED>
  <!ATTLIST method branch-rate CDATA #REQUIRED>
  <!ATTLIST method complexity  CDATA #REQUIRED>

  <!ELEMENT lines (line*)>

  <!ELEMENT line (conditions*)>
  <!ATTLIST line number CDATA #REQUIRED>
  <!ATTLIST line hits   CDATA #REQUIRED>
  <!ATTLIST line branch CDATA "false">
  <!ATTLIST line condition-coverage CDATA "100%">

  <!ELEMENT conditions (condition*)>

  <!ELEMENT condition EMPTY>
  <!ATTLIST condition number CDATA #REQUIRED>
  <!ATTLIST condition type CDATA #REQUIRED>
  <!ATTLIST condition coverage CDATA #REQUIRED>


================================================
FILE: coverage-with-data.xml
================================================
<?xml version="1.0"?>
<!--DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd"-->

<coverage line-rate="0.9" branch-rate="0.75" version="1.9" timestamp="1187350905008">
	<sources>
		<source>C:/local/mvn-coverage-example/src/main/java</source>
		<source>--source</source>
	</sources>
	<packages>
		<package name="" line-rate="1.0" branch-rate="1.0" complexity="1.0">
			<classes>
				<class name="Main" filename="Main.java" line-rate="1.0" branch-rate="1.0" complexity="1.0">
					<methods>
						<method name="&lt;init&gt;" signature="()V" line-rate="1.0" branch-rate="1.0">
							<lines>
								<line number="10" hits="3" branch="false"/>
							</lines>
						</method>
						<method name="doSearch" signature="()V" line-rate="1.0" branch-rate="1.0">
							<lines>
								<line number="23" hits="3" branch="false"/>
								<line number="25" hits="3" branch="false"/>
								<line number="26" hits="3" branch="false"/>
								<line number="28" hits="3" branch="false"/>
								<line number="29" hits="3" branch="false"/>
								<line number="30" hits="3" branch="false"/>
							</lines>
						</method>
						<method name="main" signature="([Ljava/lang/String;)V" line-rate="1.0" branch-rate="1.0">
							<lines>
								<line number="16" hits="3" branch="false"/>
								<line number="17" hits="3" branch="false"/>
								<line number="18" hits="3" branch="false"/>
								<line number="19" hits="3" branch="false"/>
							</lines>
						</method>
					</methods>
					<lines>
						<line number="10" hits="3" branch="false"/>
						<line number="16" hits="3" branch="false"/>
						<line number="17" hits="3" branch="false"/>
						<line number="18" hits="3" branch="false"/>
						<line number="19" hits="3" branch="false"/>
						<line number="23" hits="3" branch="false"/>
						<line number="25" hits="3" branch="false"/>
						<line number="26" hits="3" branch="false"/>
						<line number="28" hits="3" branch="false"/>
						<line number="29" hits="3" branch="false"/>
						<line number="30" hits="3" branch="false"/>
					</lines>
				</class>
			</classes>
		</package>
		<package name="search" line-rate="0.8421052631578947" branch-rate="0.75" complexity="3.25">
			<classes>
				<class name="search.BinarySearch" filename="search/BinarySearch.java" line-rate="0.9166666666666666" branch-rate="0.8333333333333334" complexity="3.0">
					<methods>
						<method name="&lt;init&gt;" signature="()V" line-rate="1.0" branch-rate="1.0">
							<lines>
								<line number="12" hits="3" branch="false"/>
							</lines>
						</method>
						<method name="find" signature="([II)I" line-rate="0.9090909090909091" branch-rate="0.8333333333333334">
							<lines>
								<line number="16" hits="3" branch="false"/>
								<line number="18" hits="12" branch="true" condition-coverage="100% (2/2)">
									<conditions>
										<condition number="0" type="jump" coverage="100%"/>
									</conditions>
								</line>
								<line number="20" hits="9" branch="false"/>
								<line number="21" hits="9" branch="false"/>
								<line number="23" hits="9" branch="true" condition-coverage="50% (1/2)">
									<conditions>
										<condition number="0" type="jump" coverage="50%"/>
									</conditions>
								</line>
								<line number="24" hits="0" branch="false"/>
								<line number="25" hits="9" branch="true" condition-coverage="100% (2/2)">
									<conditions>
										<condition number="0" type="jump" coverage="100%"/>
									</conditions>
								</line>
								<line number="26" hits="6" branch="false"/>
								<line number="28" hits="3" branch="false"/>
								<line number="29" hits="9" branch="false"/>
								<line number="31" hits="3" branch="false"/>
							</lines>
						</method>
					</methods>
					<lines>
						<line number="12" hits="3" branch="false"/>
						<line number="16" hits="3" branch="false"/>
						<line number="18" hits="12" branch="true" condition-coverage="100% (2/2)">
							<conditions>
								<condition number="0" type="jump" coverage="100%"/>
							</conditions>
						</line>
						<line number="20" hits="9" branch="false"/>
						<line number="21" hits="9" branch="false"/>
						<line number="23" hits="9" branch="true" condition-coverage="50% (1/2)">
							<conditions>
								<condition number="0" type="jump" coverage="50%"/>
							</conditions>
						</line>
						<line number="24" hits="0" branch="false"/>
						<line number="25" hits="9" branch="true" condition-coverage="100% (2/2)">
							<conditions>
								<condition number="0" type="jump" coverage="100%"/>
							</conditions>
						</line>
						<line number="26" hits="6" branch="false"/>
						<line number="28" hits="3" branch="false"/>
						<line number="29" hits="9" branch="false"/>
						<line number="31" hits="3" branch="false"/>
					</lines>
				</class>
				<class name="search.ISortedArraySearch" filename="search/ISortedArraySearch.java" line-rate="1.0" branch-rate="1.0" complexity="1.0">
					<methods>
					</methods>
					<lines>
					</lines>
				</class>
				<class name="search.LinearSearch" filename="search/LinearSearch.java" line-rate="0.7142857142857143" branch-rate="0.6666666666666666" complexity="6.0">
					<methods>
						<method name="&lt;init&gt;" signature="()V" line-rate="1.0" branch-rate="1.0">
							<lines>
								<line number="9" hits="3" branch="false"/>
							</lines>
						</method>
						<method name="find" signature="([II)I" line-rate="0.6666666666666666" branch-rate="0.6666666666666666">
							<lines>
								<line number="13" hits="9" branch="true" condition-coverage="50% (1/2)">
									<conditions>
										<condition number="0" type="jump" coverage="50%"/>
									</conditions>
								</line>
								<line number="15" hits="9" branch="true" condition-coverage="100% (2/2)">
									<conditions>
										<condition number="0" type="jump" coverage="100%"/>
									</conditions>
								</line>
								<line number="16" hits="3" branch="false"/>
								<line number="17" hits="6" branch="true" condition-coverage="50% (1/2)">
									<conditions>
										<condition number="0" type="jump" coverage="50%"/>
									</conditions>
								</line>
								<line number="19" hits="0" branch="false"/>
								<line number="24" hits="0" branch="false"/>
							</lines>
						</method>
					</methods>
					<lines>
						<line number="9" hits="3" branch="false"/>
						<line number="13" hits="9" branch="true" condition-coverage="50% (1/2)">
							<conditions>
								<condition number="0" type="jump" coverage="50%"/>
							</conditions>
						</line>
						<line number="15" hits="9" branch="true" condition-coverage="100% (2/2)">
							<conditions>
								<condition number="0" type="jump" coverage="100%"/>
							</conditions>
						</line>
						<line number="16" hits="3" branch="false"/>
						<line number="17" hits="6" branch="true" condition-coverage="50% (1/2)">
							<conditions>
								<condition number="0" type="jump" coverage="50%"/>
							</conditions>
						</line>
						<line number="19" hits="0" branch="false"/>
						<line number="24" hits="0" branch="false"/>
					</lines>
				</class>
			</classes>
		</package>
	</packages>
</coverage>


================================================
FILE: go.mod
================================================
module github.com/AlekSi/gocov-xml

go 1.13

require github.com/axw/gocov v1.1.0


================================================
FILE: go.sum
================================================
github.com/axw/gocov v1.1.0 h1:y5U1krExoJDlb/kNtzxyZQmNRprFOFCutWbNjcQvmVM=
github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=


================================================
FILE: gocov-xml.go
================================================
package main

import (
	"encoding/json"
	"encoding/xml"
	"flag"
	"fmt"
	"go/token"
	"io/ioutil"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"time"

	"github.com/axw/gocov"
)

// Coverage information
type Coverage struct {
	XMLName         xml.Name  `xml:"coverage"`
	LineRate        float32   `xml:"line-rate,attr"`
	BranchRate      float32   `xml:"branch-rate,attr"`
	LinesCovered    float32   `xml:"lines-covered,attr"`
	LinesValid      int64     `xml:"lines-valid,attr"`
	BranchesCovered int64     `xml:"branches-covered,attr"`
	BranchesValid   int64     `xml:"branches-valid,attr"`
	Complexity      float32   `xml:"complexity,attr"`
	Version         string    `xml:"version,attr"`
	Timestamp       int64     `xml:"timestamp,attr"`
	Packages        []Package `xml:"packages>package"`
	Sources         []string  `xml:"sources>source"`
}

// Package information
type Package struct {
	Name       string  `xml:"name,attr"`
	LineRate   float32 `xml:"line-rate,attr"`
	BranchRate float32 `xml:"branch-rate,attr"`
	Complexity float32 `xml:"complexity,attr"`
	Classes    []Class `xml:"classes>class"`
	LineCount  int64   `xml:"line-count,attr"`
	LineHits   int64   `xml:"line-hits,attr"`
}

// Class information
type Class struct {
	Name       string   `xml:"name,attr"`
	Filename   string   `xml:"filename,attr"`
	LineRate   float32  `xml:"line-rate,attr"`
	BranchRate float32  `xml:"branch-rate,attr"`
	Complexity float32  `xml:"complexity,attr"`
	Methods    []Method `xml:"methods>method"`
	Lines      []Line   `xml:"lines>line"`
	LineCount  int64    `xml:"line-count,attr"`
	LineHits   int64    `xml:"line-hits,attr"`
}

// Method information
type Method struct {
	Name       string  `xml:"name,attr"`
	Signature  string  `xml:"signature,attr"`
	LineRate   float32 `xml:"line-rate,attr"`
	BranchRate float32 `xml:"branch-rate,attr"`
	Complexity float32 `xml:"complexity,attr"`
	Lines      []Line  `xml:"lines>line"`
	LineCount  int64   `xml:"line-count,attr"`
	LineHits   int64   `xml:"line-hits,attr"`
}

// Line information
type Line struct {
	Number int   `xml:"number,attr"`
	Hits   int64 `xml:"hits,attr"`
}

func main() {
	sourcePathPtr := flag.String(
		"source",
		"",
		"Absolute path to source. Defaults to current working directory.",
	)

	flag.Parse()

	// Parse the commandline arguments.
	var sourcePath string
	var err error
	if *sourcePathPtr != "" {
		sourcePath = *sourcePathPtr
		if !filepath.IsAbs(sourcePath) {
			panic(fmt.Sprintf("Source path is a relative path: %s", sourcePath))
		}
	} else {
		sourcePath, err = os.Getwd()
		if err != nil {
			panic(err)
		}
	}

	sources := make([]string, 1)
	sources[0] = sourcePath
	var r struct{ Packages []gocov.Package }
	var totalLines, totalHits int64
	err = json.NewDecoder(os.Stdin).Decode(&r)
	if err != nil {
		panic(err)
	}

	fset := token.NewFileSet()
	tokenFiles := make(map[string]*token.File)

	// convert packages
	packages := make([]Package, len(r.Packages))
	for i, gPackage := range r.Packages {
		// group functions by filename and "class" (type)
		files := make(map[string]map[string]*Class)
		for _, gFunction := range gPackage.Functions {
			// get the releative path by base path.
			fpath, err := filepath.Rel(sourcePath, gFunction.File)
			if err != nil {
				panic(err)
			}
			classes := files[fpath]
			if classes == nil {
				// group functions by "class" (type) in a File
				classes = make(map[string]*Class)
				files[fpath] = classes
			}

			s := strings.Split("-."+gFunction.Name, ".") // className is "-" for package-level functions
			className, methodName := s[len(s)-2], s[len(s)-1]
			class := classes[className]
			if class == nil {
				class = &Class{Name: className, Filename: fpath, Methods: []Method{}, Lines: []Line{}}
				classes[className] = class
			}

			// from github.com/axw/gocov /gocov/annotate.go#printFunctionSource
			// Load the file for line information. Probably overkill, maybe
			// just compute the lines from offsets in here.
			setContent := false
			tokenFile := tokenFiles[gFunction.File]
			if tokenFile == nil {
				info, err := os.Stat(gFunction.File)
				if err != nil {
					panic(err)
				}
				tokenFile = fset.AddFile(gFunction.File, fset.Base(), int(info.Size()))
				setContent = true
			}

			tokenData, err := ioutil.ReadFile(gFunction.File)
			if err != nil {
				panic(err)
			}
			if setContent {
				// This processes the content and records line number info.
				tokenFile.SetLinesForContent(tokenData)
			}

			// convert statements to lines
			lines := make([]Line, len(gFunction.Statements))
			var funcHits int
			for i, s := range gFunction.Statements {
				lineno := tokenFile.Line(tokenFile.Pos(s.Start))
				line := Line{Number: lineno, Hits: s.Reached}
				if int(s.Reached) > 0 {
					funcHits++
				}
				lines[i] = line
				class.Lines = append(class.Lines, line)
			}
			lineRate := float32(funcHits) / float32(len(gFunction.Statements))

			class.Methods = append(class.Methods, Method{Name: methodName, Lines: lines, LineRate: lineRate})
			class.LineCount += int64(len(gFunction.Statements))
			class.LineHits += int64(funcHits)
		}

		// fill package with "classes"
		p := Package{Name: gPackage.Name, Classes: []Class{}}
		for _, classes := range files {
			for _, class := range classes {
				p.LineCount += class.LineCount
				p.LineHits += class.LineHits
				class.LineRate = float32(class.LineHits) / float32(class.LineCount)
				p.Classes = append(p.Classes, *class)
				sort.Slice(class.Methods, func(i, j int) bool {
					return class.Methods[i].Name < class.Methods[j].Name
				})
				sort.Slice(class.Lines, func(i, j int) bool {
					return class.Lines[i].Number < class.Lines[j].Number
				})
			}
			p.LineRate = float32(p.LineHits) / float32(p.LineCount)
		}
		sort.Slice(p.Classes, func(i, j int) bool {
			if p.Classes[i].Filename != p.Classes[j].Filename {
				return p.Classes[i].Filename < p.Classes[j].Filename
			}
			return p.Classes[i].Name < p.Classes[j].Name
		})
		packages[i] = p
		totalLines += p.LineCount
		totalHits += p.LineHits
	}

	coverage := Coverage{Sources: sources, Packages: packages, Timestamp: time.Now().UnixNano() / int64(time.Millisecond), LinesCovered: float32(totalHits), LinesValid: int64(totalLines), LineRate: float32(totalHits) / float32(totalLines)}

	fmt.Printf(xml.Header)
	fmt.Printf("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/coverage-04.dtd\">\n")

	encoder := xml.NewEncoder(os.Stdout)
	encoder.Indent("", "\t")
	err = encoder.Encode(coverage)
	if err != nil {
		panic(err)
	}

	fmt.Println()
}
Download .txt
gitextract_7ylfuv40/

├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── coverage-04.dtd
├── coverage-with-data.xml
├── go.mod
├── go.sum
└── gocov-xml.go
Download .txt
SYMBOL INDEX (6 symbols across 1 files)

FILE: gocov-xml.go
  type Coverage (line 20) | type Coverage struct
  type Package (line 36) | type Package struct
  type Class (line 47) | type Class struct
  type Method (line 60) | type Method struct
  type Line (line 72) | type Line struct
  function main (line 77) | func main() {
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (24K chars).
[
  {
    "path": ".gitignore",
    "chars": 31,
    "preview": "*.json\ncoverage.xml\n\ngocov-xml\n"
  },
  {
    "path": "LICENSE",
    "chars": 1063,
    "preview": "Copyright (c) 2013 Alexey Palazhchenko\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\n"
  },
  {
    "path": "Makefile",
    "chars": 263,
    "preview": "all: fvb\n\nprepare:\n\tgo get -u github.com/axw/gocov/...\n\tgo get -u github.com/gorilla/mux/...\n\tgocov test -v github.com/g"
  },
  {
    "path": "README.md",
    "chars": 2116,
    "preview": "# gocov XML\n\nA tool to generate Go coverage in XML report for using with tools/plugins like Jenkins/Cobertura.\n\n> Table "
  },
  {
    "path": "coverage-04.dtd",
    "chars": 2162,
    "preview": "<!-- Portions (C) International Organization for Standardization 1986:\n     Permission to copy in any form is granted fo"
  },
  {
    "path": "coverage-with-data.xml",
    "chars": 7238,
    "preview": "<?xml version=\"1.0\"?>\n<!--DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/coverage-03.dtd\"-->\n\n<coverage l"
  },
  {
    "path": "go.mod",
    "chars": 81,
    "preview": "module github.com/AlekSi/gocov-xml\n\ngo 1.13\n\nrequire github.com/axw/gocov v1.1.0\n"
  },
  {
    "path": "go.sum",
    "chars": 1353,
    "preview": "github.com/axw/gocov v1.1.0 h1:y5U1krExoJDlb/kNtzxyZQmNRprFOFCutWbNjcQvmVM=\ngithub.com/axw/gocov v1.1.0/go.mod h1:H9G4ti"
  },
  {
    "path": "gocov-xml.go",
    "chars": 6539,
    "preview": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"encoding/xml\"\n\t\"flag\"\n\t\"fmt\"\n\t\"go/token\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t"
  }
]

About this extraction

This page contains the full source code of the AlekSi/gocov-xml GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (20.4 KB), approximately 6.6k tokens, and a symbol index with 6 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!