structsorter

package module
v0.0.0-...-d2990de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 11 Imported by: 0

README

Fork: fieldalignment

Added sorting of fields in alphabetical order when the size of the fields is the same

Install

go install github.com/AlexanderMint/structsorter/cmd/structsorter

Example

// test/in_file.go
type A struct {
	cc *int
	b  string
	i  int
	a  string
	z  int64
	aa bool
	c  string
	bb *int
}
structsorter --fix ./test/in_file.go

result:

type A struct {
    bb *int
    cc *int
    a  string
    b  string
    c  string
    i  int
    z  int64
    aa bool
}

Documentation

Overview

Package structsorter defines an Analyzer that detects structs that would use less memory if their fields were sorted.

Index

Constants

View Source
const Doc = `` /* 1052-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "fielder",
	Doc:      Doc,
	URL:      "https://github.com/AlexanderMint/structsorter",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL