github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1031/testdata/src/example.com/CheckEncodingAscii85/CheckEncodingAscii85.go (about)

     1  package pkg
     2  
     3  import (
     4  	"encoding/ascii85"
     5  )
     6  
     7  func fn() {
     8  	ascii85.Encode(nil, nil)
     9  	ascii85.Encode(make([]byte, 0), nil)
    10  	sliceA := make([]byte, 8)
    11  	sliceB := make([]byte, 8)
    12  	ascii85.Encode(sliceA, sliceB)
    13  	ascii85.Encode(sliceA, sliceA) //@ diag(`overlapping dst and src`)
    14  	ascii85.Encode(sliceA[1:], sliceA[2:])
    15  	ascii85.Encode(sliceA[1:], sliceA[1:]) //@ diag(`overlapping dst and src`)
    16  	sliceC := sliceA
    17  	ascii85.Encode(sliceA, sliceC) //@ diag(`overlapping dst and src`)
    18  	if true {
    19  		ascii85.Encode(sliceA, sliceC) //@ diag(`overlapping dst and src`)
    20  	}
    21  	sliceD := sliceA[1:]
    22  	sliceE := sliceA[1:]
    23  	if true {
    24  		ascii85.Encode(sliceD, sliceE) //@ diag(`overlapping dst and src`)
    25  	}
    26  }
    27  
    28  func fooSigmaA(a *[4]byte) {
    29  	low := 2
    30  	x := a[low:]
    31  
    32  	if true {
    33  		y := a[low:]
    34  		ascii85.Encode(x, y) //@ diag(`overlapping dst and src`)
    35  	}
    36  }
    37  
    38  func fooSigmaB(a *[4]byte) {
    39  	x := a[:]
    40  
    41  	if true {
    42  		y := a[:]
    43  		ascii85.Encode(x, y) //@ diag(`overlapping dst and src`)
    44  	}
    45  }