test buffer: failed Next advances the read position

Abierto
#2,017 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@Drifter-yh ya está trabajando en esto.

Desde el 30/10/2026.

  • #2018 de @Drifter-yh — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
go
Área
backend

Línea de trabajo

Start by locating the default test ByteBuffer implementation and its Next method; the issue identifies pkg/remote as the package to test. Run go test ./pkg/remote -count=1 and verify that a failed Next leaves ReadLen and ReadableLen unchanged; note that linked pull request #2018 is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

The default remote.ByteBuffer used for tests advances readIdx even when Next(n) fails because fewer than n bytes remain. The failed read changes ReadLen and ReadableLen and prevents a subsequent valid read. This concerns the default test helper; it is not a claim about production transports.

Reproduction

b := remote.NewReaderBuffer([]byte("abc"))
defer b.Release(nil)
b.Next(1)              // reads "a"
_, err := b.Next(3)    // error: only two bytes remain
fmt.Println(err != nil, b.ReadLen(), b.ReadableLen()) // true 4 -1; expected true 1 2

Current main at 30428b5bfae42d334dbc3653e5b59edcf619fc9a, Go 1.26.3 on Windows. A focused regression test fails before changing Next to advance only when Peek succeeds, and go test ./pkg/remote -count=1 passes with that change.

I searched existing issues and pull requests for defaultByteBuffer, Next, readIdx, and read-position failures; I found no corresponding report. I can submit the small fix and regression test if useful.

AI assistance was used to investigate, implement and test this report.

Lenguaje dominante
Go
Estrellas
8.1k
Forks
925
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudwego/kitex

Todos los issues de cloudwego/kitex

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.