2 ms·
This is why I think it's a good idea for languages to have two print functions, one of them specifically intended for temporary debugging, the other for cases w
by miki123211 2y ago
This is why I think it's a good idea for languages to have two print functions, one of them specifically intended for temporary debugging, the other for cases where you genuinely want to print to the console, e.g. in some utility script. This way, you can have a linting rule that prevents any "debug prints" from being committed to your repository.
Go kind of works that way, there are the "official" printing functions in fmt, and there's also a pretty much unused builtin println which works well enough for this use case.
I find that it's also a good idea to do this with comments, I personally prefer using TODO and/or FIXME for things that should be fixed eventually but don't deserve a ticket, and using XXX for things I want to remember about fixing before I commit. In the heat of coding, you can write something like `// XXX: handle errors` without breaking out of the flow, like you would with a separate todo list.