This is horrible.

The 'declared but not used' error saved me hundreds of times, 
and for experimenting, adding a "_ = notUsed" or hide the whole part behind 
an "if false" is not a burden.

george...@gmail.com a következőt írta (2022. augusztus 6., szombat, 
16:26:33 UTC+2):

> Hi everyone!
>
> I created a CLI tool for toggling ‘declared but not used’ errors by using 
> idiomatic ‘_ = notUsedVar’ and leaving a TODO comment to make sure you 
> haven’t forgotten to remove fake usages. Serves best as back end for some 
> wrapper in form of extension for an IDE or an editor. Easily integratable 
> into Vim. There is also VS Code extension 
> <https://marketplace.visualstudio.com/items?itemName=looshch.gouse>. Will 
> be glad if someone will make a wrapper for GoLand.
>
> Example:
> var (
>     notUsed0 = false
>     used0    bool
> )
> notUsed1, used1 := "", ""
> _, _ = used0, used1
>
> turns into
> var (
>     notUsed0 = false; _ = notUsed0 /* TODO: gouse */
>     used0    bool
> )
> notUsed1, used1 := "", ""; _ = notUsed1 /* TODO: gouse */
>     _, _ = used0, used1
>
> On the next call, gouse will return everything back to the initial state.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0bc57678-c86a-4769-8135-d4ccf6c1c0ean%40googlegroups.com.

Reply via email to