• Stars
    star
    484
  • Rank 90,873 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐ŸŽ„ Go code coverage to SVG treemap

๐ŸŽ„ Go cover to Treemap

go-recipes

Useful when you have large project with lots of files and packages

New! Now available at https://go-cover-treemap.io ๐ŸŽ‰

$ go install github.com/nikolaydubina/go-cover-treemap@latest
$ go test -coverprofile cover.out ./...
$ go-cover-treemap -coverprofile cover.out > out.svg

github.com/gohugoio/hugo

example-hugo

..also available in 1080x360

example-hugo-small

..and even 1080x180

example-hugo-small

github.com/gin-gonic/gin

example-gin

github.com/go-chi/chi

example-chi

github.com/nikolaydubina/treemap

example-treemap

github.com/nikolaydubina/go-featureprocessing

example-go-featureprocessing

Disclaimer

In all examples above I run go test -coverprofile <my-file> ./.... I did not do any special setup. Some projects may require additional steps to properly run test and generate full coverprofile. What you see is "lower bound" of coverage for those projects. All profiles generated on main branch of each project in GitHub on 2021-12-07.

Contributions

Welcomed! Add pretty color palettes! Add interesting examples!

Reference

Appendix A: Statements vs File for Size

You can see that structure and heat changes for github.com/gohugoio/hugo. Subtrees that look bad for files no longer look as bad for statements. Lots of red boxes for files become very small and unnoticeable. This can be because they contain non-testable constructs like constants. It is more accurate to use statments, since heat is percentage of covered statements, and we compute heat by weighting sum by sizes of children. In short, you are more likely want to use statements for size.

files example-hugo-files

statements example-hugo

Appendix B: Long Roots

It is common to have root and first few children to have only one child. Each takes margin and wastes space. We can collapse these into longer name, and use that space for visualizing higher depth of boxes. This is particularly useful for narrow dimensions, which makes feasible useful narrow dimension.

1080x360 with root collapsing example-long-root-med-collapsed

1080x360 without root collapse example-long-root-med-no-collapse

1080x180 with root collapsing example-long-root-med-collapsed

1080x180 without root collapse example-long-root-med-no-collapse

Appendix C: Web UI

Web UI is maintained in dedicated repository: https://github.com/nikolaydubina/go-cover-treemap-web

This is to isolate web (WASM/JS/HTML) needed dependencies, like syscall/js from minimal CLI package.

It turns out interactive UI is very helpful. Brower can be utilized as effective input source for:

  • changing dimensions of window -> changing dimensions of SVG
  • drag and drop file
  • slider to increase granularity of treemap

Appendix D: Only Folders

Projects that have lots of files may benefit from not displaying files but only folders. This is also useful when you want to see impact of immediate files in folder to overall folder heat. Hierarchical properties of size (sum of sizes of children) and heat (weighted heat of children) are preserved. Immediate children .go files in folder are aggregated into single child *. If there is only one * child, then it is skipped โ€” suggested by herlon214

files example-hugo

only folders example-hugo-files

only folders without aggregation (heat and size property not preserved) example-hugo-files

More Repositories

1

go-recipes

๐Ÿฆฉ Tools for Go projects
Go
4,036
star
2

go-binsize-treemap

๐Ÿ” Go binary size SVG treemap
Go
444
star
3

calendarheatmap

๐Ÿ“… Calendar heatmap inspired by GitHub contribution activity
Go
393
star
4

llama2.go

LLaMA-2 in native Go
Go
187
star
5

go-instrument

โšก๏ธ Automatically add Trace Spans to Go methods and functions
Go
163
star
6

treemap

๐Ÿฌ Pretty Treemaps
Go
149
star
7

go-featureprocessing

๐Ÿ”ฅ Fast, simple sklearn-like feature processing for Go
Go
116
star
8

go-hackers-delight

"Hacker's Delight" in Go
Go
85
star
9

go-graph-layout

๐Ÿ”ฎ Graph Layout Algorithms in Go
Go
85
star
10

go-cover-treemap-web

Go
78
star
11

jsonl-graph

๐Ÿ JSONL Graph Tools
Go
72
star
12

import-graph

Collect data about your dependencies
Go
40
star
13

twitter-remover

Remove twitter likes, posts, retweets, replies, followers
38
star
14

watchhttp

๐ŸŒบ Run command periodically and expose latest STDOUT as HTTP endpoint
Go
32
star
15

go-ml-benchmarks

โฑ Benchmarks of machine learning inference for Go
Go
30
star
16

fpdecimal

๐Ÿ›ซ Fixed-Point Decimals
Go
29
star
17

fpmoney

๐Ÿงง Fixed-Point Decimal Money
Go
25
star
18

validate

๐Ÿฅฌ validate. simply.
Go
19
star
19

hq

๐Ÿ happy little queue
Go
16
star
20

smrcptr

detect mixing pointer and value method receivers
Go
13
star
21

neuroscience-landscape

๐ŸŒŒ Resources on Neuroscience
12
star
22

vertfn

Go linter for Vertical Function Ordering
Go
12
star
23

go-enum-encoding

Generate Go enum encoding
Go
12
star
24

go-enum-example

Go Enum: benchmarks, examples, analysis
Go
8
star
25

htmljson

๐Ÿซ Rich rendering of JSON as HTML in Go
Go
7
star
26

multiline-jsonl

Read and write multiline JSONL in Go
Go
6
star
27

openapi-inline-examples

๐ŸŒ Inline OpenAPI JSON examples from filenames
Go
6
star
28

htmlyaml

๐Ÿน render YAML as HTML in Go
Go
4
star
29

go-commentage

How far Go comments drifting behind?
Go
4
star
30

rchan

Go channel through Redis List
Go
4
star
31

mini-awesome-cv

๐Ÿ“ LaTeX Awesome-CV under 200LOC
TeX
4
star
32

go-instrument-example

Go
3
star
33

svgpan

Pan and Zoom of SVG in your Go front-end app in browser.
Go
3
star
34

go-bench-errors

Benchmarking Go errors
Go
3
star
35

mdpage

one-pager Markdown list from YAML
Go
3
star
36

consistentimports

Detect inconsistent import aliases
Go
2
star
37

go-callsite-stats

analyse function callsites
Go
2
star
38

read-seek-peeker

Go Reader that can Seek() and Peek()
Go
2
star
39

go-bench-stream

๐ŸŒŠ Go Benchmarks for Stream Processing
Go
2
star
40

go-bitset-example

Go Bitset: benchmarks, examples, analysis
Go
1
star
41

aws-s3-reader

Efficient Go Reader for large AWS S3 Objects
Go
1
star
42

go-bench-receiver

Which is more efficient value or pointer method receivers in Go?
Go
1
star
43

totp

TOTP (RFC-6238) and HOTP (RFC-4226)
Go
1
star
44

dotfiles

macOS, Linux
Vim Script
1
star
45

presentations

1
star
46

PINTOS

C
1
star
47

ARIA

C++
1
star
48

mini-blog

JavaScript
1
star
49

graph-tools-gallery

Inspiration gallery of graph tools
1
star