This question already has an answer here:
"I'm trying to output the values of a channel , which received values from a struct, which should be a string and time. It outputs those two, but then it includes this strange line " +0300 +03 m=+0.001997101" after the time."
Tried many other things from fmt package, but still no help. Tried things from the time package too
package main
import (
"fmt"
"os"
"os/signal"
"sync"
"syscall"
"time"
)
var wg sync.WaitGroup
type widget struct {
Label string
Time time.Time
}
func main() {
c := make(chan widget)
sc := make(chan os.Signal, 1)
done := make(chan bool, 1)
signal.Notify(sc, syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGHUP,
syscall.SIGKILL,
syscall.SIGSEGV,
)
go func() {
sig := <-sc
fmt.Println()
fmt.Println(sig)
done <- true
}()
go send(c)
go receive(c)
<-done
fmt.Println("Program exited")
}
func send(p chan<- widget) {
producer := widget{
"widget_id_34",
time.Now(),
}
p <- producer
}
//where im grtting the problem from i beilieve
func receive(c <-chan widget) {
out := <-c
fmt.Printf("%v", out)
//fmt.Fprintln(os.Stdout, <-c)
}
</div>