diff --git a/bindings/go/pkg/whisper/context.go b/bindings/go/pkg/whisper/context.go index c3a679a44..9b06b609d 100644 --- a/bindings/go/pkg/whisper/context.go +++ b/bindings/go/pkg/whisper/context.go @@ -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{ diff --git a/bindings/go/whisper_test.go b/bindings/go/whisper_test.go index 5cfc76214..d40becf8c 100644 --- a/bindings/go/whisper_test.go +++ b/bindings/go/whisper_test.go @@ -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