gitlab.com/evatix-go/core@v1.3.55/errcore/PanicOnIndexOutOfRange.go (about)

     1  package errcore
     2  
     3  func PanicOnIndexOutOfRange(length int, indexes []int) {
     4  	lastIndex := length - 1
     5  
     6  	//goland:noinspection GoNilness
     7  	for _, indexValue := range indexes {
     8  		if indexValue > lastIndex {
     9  			OutOfRangeType.
    10  				HandleUsingPanic(
    11  					"Index cannot be out of range, error is not ignored",
    12  					indexValue)
    13  		}
    14  	}
    15  }