print readable variables with golang

后端 未结 6 522

How to print a map, struct or whatever in a readable way?

With PHP you can to this

echo \'
\';
print_r($var);
echo \'
\';

6条回答
  •  -上瘾入骨i
    2021-02-04 03:15

    fmt.Printf("%v", whatever) 
    

    In Go is like print_r(), var_dump(), var_export() in PHP. (The %v is the important part.)

    Good Luck

提交回复
热议问题