Slice graph uses graphviz in order to pretty print slices for you.

Overview

slicegraph

Slice graph uses graphviz in order to make you understand what happens underneath your slices.

How to use that?

package main

import (
	"bytes"
	"fmt"

	"github.com/jbszczepaniak/slicegraph/slicegraph"
)

func main() {
	var a []int
	b := []int{1, 2, 3, 4, 5, 6, 7, 8}
	c := b[4:6]
	d := b[6:]
	e := make([]int, len(b))
	copy(e, b)

	var by []byte
	buff := bytes.NewBuffer(by)
	err := slicegraph.AsGraph(map[string][]int{
		"a": a,
		"b": b,
		"c": c,
		"d": d,
		"e": e,
	}, buff)
	if err != nil {
		panic(err)
	}

	fmt.Println(buff)
}

Run above program and redirect the output to the file

go run main.go > example.svg
open example.svg

Examine the results 🕵🏼‍♂️

slices

You might also like...
Visualize call graph of a Go program using Graphviz
Visualize call graph of a Go program using Graphviz

go-callvis go-callvis is a development tool to help visualize call graph of a Go program using interactive view. Introduction The purpose of this tool

🍕 Enjoy a slice! A utility library for dealing with slices and maps that focuses on type safety and performance.

🍕 github.com/elliotchance/pie Enjoy a slice! pie is a library of utility functions for common operations on slices and maps. Quick Start FAQ What are

Gotabulate - Easily pretty-print your tabular data with Go

Gotabulate - Easily pretty-print tabular data Summary Go-Tabulate - Generic Go Library for easy pretty-printing of tabular data. Installation go get g

A command-line tool to pretty print your system's PATH environment variable.
A command-line tool to pretty print your system's PATH environment variable.

Description A command-line tool to pretty print your system's PATH environment variable. The output paths are colorized if they have special associati

🎨 Terminal color rendering tool library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染
Courier Order Provider is a service that receives signals from core server in order to emit this orders to courier groups.

Courier Order Provider Courier Order Provider is a service that receives signals(messages) from core server in order to emit this orders to courier gr

Andrews-monitor - A Go program to monitor when times were available to order for Brown's Andrews dining hall. Used during the portion of the pandemic when the dining hall was only available for online order.

Andrews Dining Hall Monitor A Go program to monitor when times were available to order for Brown's Andrews dining hall. Used during the portion of the

Limit-order-book - Limit order books keep records of orders for a given symbol to be traded

Limit Order Book Limit order books keep records of orders for a given symbol to

Loc2Midi - This project uses realtime location data to control audio effects plugins in order to simulate movement throughout a virtual soundscape
JSONL graph tools - Graph is represented as JSONL of nodes and edges.

JSONL graph tools - Graph is represented as JSONL of nodes and edges.

The DGL Operator makes it easy to run Deep Graph Library (DGL) graph neural network training on Kubernetes

DGL Operator The DGL Operator makes it easy to run Deep Graph Library (DGL) graph neural network distributed or non-distributed training on Kubernetes

Package httpretty prints the HTTP requests you make with Go pretty on your terminal.

httpretty Package httpretty prints the HTTP requests of your Go programs pretty on your terminal screen. It is mostly inspired in curl's --verbose mod

Package httpretty prints the HTTP requests you make with Go pretty on your terminal.

httpretty Package httpretty prints the HTTP requests of your Go programs pretty on your terminal screen. It is mostly inspired in curl's --verbose mod

Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Visualize your Go data structures using graphviz

memviz How would you rather debug a data structure? "Pretty" printed Visual graph (*test.fib)(0xc04204a5a0)({ index: (int) 5, prev: (*test.fib)(0xc0

Ltree Visualizer - A golang library to visualize postgres ltree type data using DOT language and Graphviz
Ltree Visualizer - A golang library to visualize postgres ltree type data using DOT language and Graphviz

Ltree Visualizer A golang library to visualize postgres ltree type data using DOT language and Graphviz What is Ltree? Ltree is a data type which is u

Go package for writing descriptions using the Graphviz DOT language
Go package for writing descriptions using the Graphviz DOT language

dot - little helper package in Go for the graphviz dot language

An ease to use finit state machine golang implementation.Turn any struct to a fsm with graphviz visualization supported.

go-fsm An ease to use finit state machine golang implementation.Turn any struct to a fsm with graphviz visualization supported. usage import github.co

Owner
Jędrzej
Jędrzej
Go package for writing descriptions using the Graphviz DOT language

dot - little helper package in Go for the graphviz dot language

Ernest Micklei 234 Nov 30, 2022
yml2dot - Turn YAML into beautiful Graph

yml2dot - Turn YAML into beautiful Graph Use Cases Visualize your YAML files as Graph Generate additional info from your source code

Luca Sepe 107 Nov 21, 2022
entviz is an ent extension that provides visualization of the schema graph

entviz entviz is an ent extension that creates visual graph (html file) of your ent's schema. install go get github.com/hedwigz/entviz add this exten

Amit Shani 82 Nov 8, 2022
Graph a histogram from a stream of timestamps 📈📊

Histogram Timestamps You ever find yourself working with a dataset and you want to graph a particular aspect of that data over time, but because you'r

Leland Batey 2 Dec 4, 2021
Tool to visualize the graph of embedded structs in Go projects

Visualize a hierarchy of embedded Go structs This tool scans a directory of Go source code files to create a visualization of struct embedding in the

David Schlachter 215 Nov 27, 2022
Interactive dependency graph visualization tool for golang

Interactive dependency graph visualization tool for golang using the awesome cytoscape graph visualizer.

Armin Becher 6 Sep 1, 2022
💻 PTerm | Pretty Terminal Printer A golang module to print pretty text

✨ PTerm is a modern go module to beautify console output. Featuring charts, progressbars, tables, trees, and many more ?? It's completely configurable and 100% cross-platform compatible.

null 3.1k Nov 29, 2022
sleuth checks that you declared a slice with length and you are trying append to the slice.

sleuth sleuth detects when an append is used on a slice with an initial size. Instruction go install github.com/sivchari/sleuth/cmd/sleuth Usage packa

sivchari 11 Sep 15, 2021
Visualize call graph of a Go program using Graphviz

go-callvis go-callvis is a development tool to help visualize call graph of a Go program using interactive view. Introduction The purpose of this tool

Ondrej Fabry 4.5k Dec 2, 2022
Converts 'go mod graph' output into Graphviz's DOT language

modgv Converts 'go mod graph' output into GraphViz's DOT language. takes no options or arguments it reads the output generated by “go mod graph” on st

Luca Sepe 443 Nov 8, 2022