Skip to main content

Print

printf

  • printf(format, arguments…​)
    • golang’s printf format
    • if format is not given, will default to string
    • format specifiers:
      • %v : formats the value in a default format
      • %d : formats decimal integers
      • %f : formats the floating-point numbers
      • %g : formats the floating-point numbers and removes trailing zeros
      • %b : formats base 2 numbers
      • %o : formats base 8 numbers
      • %t : formats true or false values
      • %s : formats string values
printf("%d", 2) // prints 2 as a string to traces
printf(2) // ERROR: expected string but int64 given
printf("2") // prints the string 2 to traces