github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/govet_fieldalignment.go (about)

     1  //golangcitest:args -Egovet
     2  //golangcitest:config_path testdata/configs/govet_fieldalignment.yml
     3  package testdata
     4  
     5  type gvfaGood struct {
     6  	y int32
     7  	x byte
     8  	z byte
     9  }
    10  
    11  type gvfaBad struct { // want "struct of size 12 could be 8"
    12  	x byte
    13  	y int32
    14  	z byte
    15  }
    16  
    17  type gvfaPointerGood struct {
    18  	P   *int
    19  	buf [1000]uintptr
    20  }
    21  
    22  type gvfaPointerBad struct { // want "struct with 8008 pointer bytes could be 8"
    23  	buf [1000]uintptr
    24  	P   *int
    25  }
    26  
    27  type gvfaPointerSorta struct {
    28  	a struct {
    29  		p *int
    30  		q uintptr
    31  	}
    32  	b struct {
    33  		p *int
    34  		q [2]uintptr
    35  	}
    36  }
    37  
    38  type gvfaPointerSortaBad struct { // want "struct with 32 pointer bytes could be 24"
    39  	a struct {
    40  		p *int
    41  		q [2]uintptr
    42  	}
    43  	b struct {
    44  		p *int
    45  		q uintptr
    46  	}
    47  }
    48  
    49  type gvfaZeroGood struct {
    50  	a [0]byte
    51  	b uint32
    52  }
    53  
    54  type gvfaZeroBad struct { // want "struct of size 8 could be 4"
    55  	a uint32
    56  	b [0]byte
    57  }