github.com/cockroachdb/tools@v0.0.0-20230222021103-a6d27438930d/go/analysis/passes/fieldalignment/testdata/src/a/a_386.go (about)

     1  package a
     2  
     3  type PointerGood struct {
     4  	P   *int
     5  	buf [1000]uintptr
     6  }
     7  
     8  type PointerBad struct { // want "struct with 4004 pointer bytes could be 4"
     9  	buf [1000]uintptr
    10  	P   *int
    11  }
    12  
    13  type PointerSorta struct {
    14  	a struct {
    15  		p *int
    16  		q uintptr
    17  	}
    18  	b struct {
    19  		p *int
    20  		q [2]uintptr
    21  	}
    22  }
    23  
    24  type PointerSortaBad struct { // want "struct with 16 pointer bytes could be 12"
    25  	a struct {
    26  		p *int
    27  		q [2]uintptr
    28  	}
    29  	b struct {
    30  		p *int
    31  		q uintptr
    32  	}
    33  }
    34  
    35  type MultiField struct { // want "struct of size 20 could be 12"
    36  	b      bool
    37  	i1, i2 int
    38  	a3     [3]bool
    39  	_      [0]func()
    40  }