-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: add compiling time constants like __FUNC__, __LINE__, __FILE__
of cpp in Golang
#27329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Like this?
|
yes, but those are constant which are already known at the compiling time. It's better to express them as some constant rather than to evaluate them at the runtime for the sake of simplicity. @AlexRouSg |
Note that we already have constants in the log package which does this - https://golang.org/pkg/log/#pkg-constants. Or are you saying you want more flexibility in the constants ? Like you want to print only line, or only filename ? In that case, I would request you to use the runtime package directly. Or create a separate package. The bar to include more API in standard library is pretty high. In any case, this proposal needs more information for what precisely do you want, and where do you want those constants to be. |
Preferably in my opinion |
FTR, IINM |
__FUNC__, __LINE__, __FILE__
of cpp in Golang__FUNC__, __LINE__, __FILE__
of cpp in Golang
Is |
My bad, I haven't noticed that I was thinking in a cpp way, which brought me to an idea that I could print I have noticed that there are some hacky ways to get the goroutine ID which don't appeal to me much cause of their complexities. And one big thing that really bothers developers much would be having no enough clear logs to debug, especially in a high concurrency situation as in Golang @agnivade |
So it seems you have now changed the proposal to trying to get a goroutine ID. Please see this - https://golang.org/doc/faq#no_goroutine_id. If you still believe you need a goroutine ID, I would request you to open a new proposal with the required details that outshine the reasoning in the faq article. Thank you. |
Considering a trace log with line no and func name, we would be able to locate the problem more quickly.
The text was updated successfully, but these errors were encountered: