alias-generator
The goal of this utility is to generate and update the alias.go files that are used through-out the Cosmos-SDK codebase.
The output is modelled on the output generated by Multitool utility.
Installation
- Clone this repository.
- Invoke
go build to create a local binary. Invoke go install to install command in path.
Usage
The alias-generator has two modes: create and update.
The create command is used to create a new alias.go file in one or more packages. It will recurse through sub-packages and create aliases for any type, variable, constant or function that is not explicitly annotated with a noalias comment.
The update command will recursively search for existing alias.go files and update them.
There are two ways to prevent an entire package from being aliased:
- Annotate the package with a
// noalias comment at the top of every file
- Remove the package from the import list in the
alias.go file and update the file
Examples
create a new alias.go file for the inflation module. Will overwrite an existing file.
alias-generator create ./x/inflation
Update all alias.go files in a project. Searches recursively below current directory for files to update.
alias-generator update .