go : use range over int

This commit is contained in:
thde 2025-10-07 10:50:40 -04:00
parent 601fac8e3d
commit 21bd348a37
2 changed files with 2 additions and 2 deletions

View File

@ -334,7 +334,7 @@ func toSegment(ctx *whisper.Context, n int) Segment {
func toTokens(ctx *whisper.Context, n int) []Token {
result := make([]Token, ctx.Whisper_full_n_tokens(n))
for i := 0; i < len(result); i++ {
for i := range result {
data := ctx.Whisper_full_get_token_data(n, i)
result[i] = Token{

View File

@ -58,7 +58,7 @@ func Test_Whisper_001(t *testing.T) {
// Print out tokens
num_segments := ctx.Whisper_full_n_segments()
assert.GreaterOrEqual(num_segments, 1)
for i := 0; i < num_segments; i++ {
for i := range num_segments {
str := ctx.Whisper_full_get_segment_text(i)
assert.NotEmpty(str)
t0 := time.Duration(ctx.Whisper_full_get_segment_t0(i)) * time.Millisecond