github.com/moreal/bencodex-go@v0.0.0-20231021172012-18277a477d15/internal/encoder/list.go (about)

     1  package encoder
     2  
     3  func (e *Encoder) encodeList(data []interface{}) error {
     4  	e.grow(1)
     5  	e.writeByte('l')
     6  	for _, data := range data {
     7  		err := e.encode(data)
     8  		if err != nil {
     9  			return err
    10  		}
    11  	}
    12  	e.grow(1)
    13  	e.writeByte('e')
    14  	return nil
    15  }