Reputation: 7887
In C/C++ you can use __FILE__
and __LINE__
to get access to the current file and line number.
Does Go provide something similar?
Upvotes: 4
Views: 1849
Reputation: 5147
Indeed it does:
http://golang.org/pkg/runtime/#Caller
runtime.Caller
can also be used to get the file name/line number of calling functions, too.
Upvotes: 9