github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/simple/testdata/src/LintLoopSlide/LintLoopSlide.go (about)

     1  package pkg
     2  
     3  func fn() {
     4  	var n int
     5  	var bs []int
     6  	var offset int
     7  
     8  	for i := 0; i < n; i++ { // MATCH "should use copy(bs[:n], bs[offset:]) instead"
     9  		bs[i] = bs[offset+i]
    10  	}
    11  
    12  	for i := 1; i < n; i++ { // not currently supported
    13  		bs[i] = bs[offset+i]
    14  	}
    15  
    16  	for i := 1; i < n; i++ { // not currently supported
    17  		bs[i] = bs[i+offset]
    18  	}
    19  
    20  	for i := 0; i <= n; i++ {
    21  		bs[i] = bs[offset+i]
    22  	}
    23  }