InDrive - 3
Актуальность: Q3 2025
Questions
Заголовок раздела «Questions»- Standard Go and experience questions.
go/stdlib-tooling
Задача: Write the implementation of request(). go/basics
Заголовок раздела «Задача: Write the implementation of request(). go/basics»func doRequest(addr string, request []byte) ([]byte, error) { resp, err := http.Post(addr, "text/plain ", bytes.NewBuffer(request)) if err != nil { return nil, err } defer resp.Body.Close()
body, err := io.ReadAll(resp.Body) if err != nil { return nil, err }
return body, nil}
type client struct { addrs []string}
func (dc client) request(ctx context.Context, req string) (string, error) { // implementation}