I write one go code like this, strconv.Itoa(time.Nanoseconds())
. But, it is giving me this error "cannot use time.Nanoseconds() (type int64) as type int in function argument". How can I solve this ?
For example,
package main
import (
"fmt"
"strconv"
"time"
)
func main() {
t := strconv.FormatInt(time.Nanoseconds(), 10)
fmt.Println(t)
}
Output:
1322756865962046000
if you got an error like this, just cast it the way the compiler told it. i.e.:
strconv.Itoa(int(time.Nanoseconds()))