Skip to content

Commit

Permalink
envconfig: sort struct fields to reduce memory (#51)
Browse files Browse the repository at this point in the history
Sort struct fields suggested by fieldalignment. But continue to sort
alphabetical order as much as possible.

$ go vet -vettool=$(which fieldalignment) ./...
./envconfig.go:188:21: struct with 32 pointer bytes could be 24
./envconfig.go:222:14: struct of size 80 could be 72

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Apr 11, 2022
1 parent 76d89c2 commit 0c8b803
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions envconfig.go
Expand Up @@ -186,8 +186,8 @@ func PrefixLookuper(prefix string, l Lookuper) Lookuper {
}

type prefixLookuper struct {
prefix string
l Lookuper
prefix string
}

func (p *prefixLookuper) Lookup(key string) (string, bool) {
Expand Down Expand Up @@ -222,11 +222,11 @@ type MutatorFunc func(ctx context.Context, k, v string) (string, error)
type options struct {
Default string
Delimiter string
Prefix string
Separator string
NoInit bool
Overwrite bool
Prefix string
Required bool
Separator string
}

// Process processes the struct using the environment. See ProcessWith for a
Expand Down

0 comments on commit 0c8b803

Please sign in to comment.