Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/javiercbk/impack

Imperfect memory packer for Go
https://github.com/javiercbk/impack

Last synced: about 2 months ago
JSON representation

Imperfect memory packer for Go

Awesome Lists containing this project

README

        

# 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

```sh
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.

```sh
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.