The error is self explanatory. You define variable "kk" but never use it.
If you don't care about the return value of io.Writer() simply omit the
assignment; just call the function. Or explicitly assign to the special "_"
placeholder var to show that you know the function returns a value and you
are deliberately ignoring it. Beyond that the statement doesn't make any
sense since io.Writer is an interface type. Not a function you call. Also,
bytes.NewBuffer() returns an object which implements the io.Writer
interface. You don't need to do anything else to turn it intoan  io.Writer.

On Thu, Jul 8, 2021 at 10:54 AM LetGo <non3co...@gmail.com> wrote:

> I thought that after getting the bytes, chunk the data, I need to have the
> io.writer back before send the chunked data
> So far I came up with this:
>
> ...
> cmd.Stdin = conn
>                 buf := new(bytes.Buffer)
>                 cmd.Stdout = buf
>
>                 bizz := buf.Bytes()
>
>         var i int
>     for {
>     n := int(math.Min(float64(rand.Intn(len(bizz))), float64(len(bizz))))
>     d := bizz[i : i+n]
>     i += n
>
>
>                     z := bytes.NewBuffer(d)
>
>                     kk := io.Writer(z)
>      //this line creates the error
>
>       time.Sleep(400 * time.Millisecond)
>
>                     kk = conn
>
>
>         if i >= len(bizz) {
>     break
>         }
>             }
> cmd.Stderr = conn
> cmd.Run()
> .....
>
> But know I get this error:
>
> conn.go:95:21: kk declared but not used
>

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-8kT%3DNuAJxyFL22CE1QNC1LLwm2X5dtXA-erifVeaZ9g%40mail.gmail.com.

Reply via email to