X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fhonnef.co%2Fgo%2Ftools%40v0.0.1-2020.1.5%2Fcmd%2Fstructlayout%2FREADME.md;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fhonnef.co%2Fgo%2Ftools%40v0.0.1-2020.1.5%2Fcmd%2Fstructlayout%2FREADME.md;h=0000000000000000000000000000000000000000;hb=3ddadb3c98564791f0ac36cb39771d844a63dc91;hp=5667ed46142e232f84dedeaa3e708542f72aafbc;hpb=5f797af6612ed10887189b47a1efc2f915586e59;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/cmd/structlayout/README.md b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/cmd/structlayout/README.md deleted file mode 100644 index 5667ed46..00000000 --- a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/cmd/structlayout/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# structlayout - -The _structlayout_ utility prints the layout of a struct – that is the -byte offset and size of each field, respecting alignment/padding. - -The information is printed in human-readable form by default, but can -be emitted as JSON with the `-json` flag. This makes it easy to -consume this information in other tools. - -A utility called _structlayout-pretty_ takes this JSON and prints an -ASCII graphic representing the memory layout. - -_structlayout-optimize_ is another tool. Inspired by -[maligned](https://github.com/mdempsky/maligned), it reads -_structlayout_ JSON on stdin and reorders fields to minimize the -amount of padding. The tool can itself emit JSON and feed into e.g. -_structlayout-pretty_. - -_structlayout-svg_ is a third-party tool that, similarly to -_structlayout-pretty_, visualises struct layouts. It does so by -generating a fancy-looking SVG graphic. You can install it via - -``` -go get github.com/ajstarks/svgo/structlayout-svg -``` - -## Installation - -See [the main README](https://github.com/dominikh/go-tools#installation) for installation instructions. - -## Examples - -``` -$ structlayout bufio Reader -Reader.buf []byte: 0-24 (24 bytes) -Reader.rd io.Reader: 24-40 (16 bytes) -Reader.r int: 40-48 (8 bytes) -Reader.w int: 48-56 (8 bytes) -Reader.err error: 56-72 (16 bytes) -Reader.lastByte int: 72-80 (8 bytes) -Reader.lastRuneSize int: 80-88 (8 bytes) -``` - -``` -$ structlayout -json bufio Reader | jq . -[ - { - "name": "Reader.buf", - "type": "[]byte", - "start": 0, - "end": 24, - "size": 24, - "is_padding": false - }, - { - "name": "Reader.rd", - "type": "io.Reader", - "start": 24, - "end": 40, - "size": 16, - "is_padding": false - }, - { - "name": "Reader.r", - "type": "int", - "start": 40, - "end": 48, - "size": 8, - "is_padding": false - }, -... -``` - -``` -$ structlayout -json bufio Reader | structlayout-pretty - +--------+ - 0 | | <- Reader.buf []byte - +--------+ - -........- - +--------+ - 23 | | - +--------+ - 24 | | <- Reader.rd io.Reader - +--------+ - -........- - +--------+ - 39 | | - +--------+ - 40 | | <- Reader.r int - +--------+ - -........- - +--------+ - 47 | | - +--------+ - 48 | | <- Reader.w int - +--------+ - -........- - +--------+ - 55 | | - +--------+ - 56 | | <- Reader.err error - +--------+ - -........- - +--------+ - 71 | | - +--------+ - 72 | | <- Reader.lastByte int - +--------+ - -........- - +--------+ - 79 | | - +--------+ - 80 | | <- Reader.lastRuneSize int - +--------+ - -........- - +--------+ - 87 | | - +--------+ -``` - -``` -$ structlayout -json bytes Buffer | structlayout-svg -t "bytes.Buffer" > /tmp/struct.svg -``` - -![memory layout of bytes.Buffer](/images/screenshots/struct.png)