I've used this macro or some variant thereof in C/C++ for years: #define dump(x) printf("%s %d: %s = %d\n", __func__, __LINE__, #x, (int)(x))
The "#x" is the really useful part that lets you print the original expression. For example, if int a = 4 and int b = 10: dump(a + b); // Prints "a + b = 14" Is there a way to do this in Go? -- 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. For more options, visit https://groups.google.com/d/optout.