github.com/nishanths/dedupimport (go): Command dedupimport finds and removes duplicate imports that have the same import path but different import names. See 'dedupimport -h' for usage.  When resolving duplicate imports, by default, it keeps the unnamed import and removes the named imports. This behavior can be customized with the '-keep' flag (described below). After resolving duplicates it updates the rest of the code in the file that may be using the old, removed import identifier to use the new import identifier.  As a special case, the tool never removes side-effect imports ("_") and dot imports ("."); these imports are allowed to coexist with regular imports, even if the import paths are duplicated.  The command exits with exit code 2 if the command was invoked incorrectly; 1 if there was an error while opening, parsing, or rewriting files; and 0 otherwise.  The typical usage is:  Given the file  running dedupimport with default options will produce  The '-keep' flag allows you to choose which import to keep and which ones to remove when resolving duplicates in a file, aka the strategy to use:  Sometimes rewriting a file to use the updated import declaration can be unsafe. In the following example, it is not possible to safely change "u" -> "url" inside fetch because the identifier, url, already exists in the scope and does not refer to the import.  Such contrived scenarios rarely happen in practice.  But if they do, the command prints a warning and skips the file.  For unnamed imports, the command has to guess the import's package name by looking at the import path. The package name is, in most cases, the basename of the import path. The command automatically handles patterns such as these:  To instruct the command on how to handle more complicated patterns, the '-m' flag can be used. The format for the flag is:  The flag can be repeated multiple times to specify multiple mappings. For example:
Keywords: ast|go