You're right, that's something to consider before submitting such a code.
But yeah as it was a "tricks" post I thought that might be interesting :)
I also use it when in a function, I need to do a pre and post action: go.dev/play/p/J31oyRhJzQ- It's pretty handy during testing, for example.
Oh shoot, I see the benefit of this Teiva, it's really great for handling actions both before and after a function, could I possibly include this tip in the post?
By the way, do you think this trick can be safely applied in production?
could I possibly include this tip in the post?
Sure, please
do you think this trick can be safely applied in production
Yes, there's nothing unsafe. The only caveat is that Go devs might be slightly confused at first when reading the code.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're right, that's something to consider before submitting such a code.
But yeah as it was a "tricks" post I thought that might be interesting :)
I also use it when in a function, I need to do a pre and post action: go.dev/play/p/J31oyRhJzQ-
It's pretty handy during testing, for example.
Oh shoot, I see the benefit of this Teiva, it's really great for handling actions both before and after a function, could I possibly include this tip in the post?
By the way, do you think this trick can be safely applied in production?
Sure, please
Yes, there's nothing unsafe. The only caveat is that Go devs might be slightly confused at first when reading the code.