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

     1  package pkg
     2  
     3  func fn(s string) {
     4  	for _, r := range s {
     5  		println(r)
     6  	}
     7  
     8  	for _, r := range []rune(s) { // MATCH "should range over string"
     9  		println(r)
    10  	}
    11  
    12  	for i, r := range []rune(s) {
    13  		println(i)
    14  		println(r)
    15  	}
    16  
    17  	x := []rune(s)
    18  	for _, r := range x { // MATCH "should range over string"
    19  		println(r)
    20  	}
    21  
    22  	y := []rune(s)
    23  	for _, r := range y {
    24  		println(r)
    25  	}
    26  	println(y[0])
    27  }