github.com/be-b10g/golangci-lint@v1.17.2/test/testdata/gocritic.go (about)

     1  //args: -Egocritic
     2  //config_path: testdata/configs/gocritic.yml
     3  package testdata
     4  
     5  import (
     6  	"flag"
     7  	"log"
     8  )
     9  
    10  var _ = *flag.Bool("global1", false, "") // ERROR "flagDeref: immediate deref in \*flag.Bool\(.global1., false, ..\) is most likely an error; consider using flag\.BoolVar"
    11  
    12  type size1 struct {
    13  	a bool
    14  }
    15  
    16  type size2 struct {
    17  	size1
    18  	b bool
    19  }
    20  
    21  func gocriticRangeValCopySize1(ss []size1) {
    22  	for _, s := range ss {
    23  		log.Print(s)
    24  	}
    25  }
    26  
    27  func gocriticRangeValCopySize2(ss []size2) {
    28  	for _, s := range ss { // ERROR "rangeValCopy: each iteration copies 2 bytes.*"
    29  		log.Print(s)
    30  	}
    31  }