Skip to content

Latest commit

 

History

History
89 lines (62 loc) · 2.13 KB

File metadata and controls

89 lines (62 loc) · 2.13 KB

Go Tests Vercel Deploy tag and release

viztruct

Table of Contents

Image SVG visualization:

Image

CLI installation

Go install

go install github.com/buarki/viztruct/cmd/viztruct@latest

Download binaries

ARCH="arm64" # or amd64
OS="darwin" # or linux

# get latest tag using GitHub API
VERSION=$(curl -s "https://api.github.com/repos/buarki/viztruct/releases/latest" | jq -r .tag_name)

# download binary
BINARY_URL="https://github.com/buarki/viztruct/releases/download/$VERSION/viztruct-$OS-$ARCH"
curl -L "$BINARY_URL" -o viztruct

# install
chmod +x viztruct
sudo mv viztruct /usr/local/bin/

# verify
viztruct --version

Build it locally

Build the CLI:

git clone git@github.com:buarki/viztruct.git
cd viztruct
make build-cli
sudo mv viztruct /usr/local/bin/

Usage:

Analyze structs from a path

viztruct --path ./internal/samples --format=txt

Get JSON output

viztruct --path ./internal/samples --format=json

Generate SVG visualization

viztruct --path ./internal/samples --format=json --svg

Analyze and define the optimization strategy

viztruct --path ./internal/samples --format=txt --strategies=alignment,size,group,greedy

Show help

viztruct --help

The tool will print the struct layout analysis to stdout. Use the --svg flag to generate an SVG visualization.

Minimalist webapp

If you want to use a limited version of viztruct (since it supports only explicitly defined types) in your browser just visit the deployed webapp. You can paste/type your struct in the text input area and get a full padding analysis.