github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/simple/s1018/testdata/src/example.com/CheckLoopSlide/generics.go (about)

     1  //go:build go1.18
     2  
     3  package pkg
     4  
     5  func tpfn[T []int]() {
     6  	var n int
     7  	var bs T
     8  	var offset int
     9  
    10  	for i := 0; i < n; i++ { //@ diag(`should use copy() instead of loop for sliding slice elements`)
    11  		bs[i] = bs[offset+i]
    12  	}
    13  }