Skip to content

javiercbk/impack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Impack

Imperfect memory packer for Go

Features

impack will grab every struct in a package and order the fields by lower size to higher size. When sizes match it will order alphabetically.

This is an imperfect memory packer since it does not maximize memory efficiency by packing structs perfectly, it attempts to minimize memory footprint but trying to remain as human readable as possible.

Install

go install github.com/javiercbk/impack/cmd/impack@latest

Usage

impack will lint a whole package, and re-order every struct's fields in the package.

impack --compiler gc --arch amd64 /home/user/path/to/go/package/folder1 /home/user/path/to/go/package/folder2
  • The first unnammed parameter will be considered as the package path. By default it will be the current folder
  • --compiler defaults to gc. Affects the size and the alignment values of types.
  • --arch defaults to amd64. Also affects the size and the alignment values of types.