-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use NewXxx functions instead of struct declarations #2835
Comments
Use stake.NewDescription() to make a new Description - ref #2835
- Replace STDIN/STDOUT redirection in `gaiad gentx` with subcommands command line options to redirect streams to file since viper does not handle redirection well. - Use `BuildCreateValidatorMsg` to build a `MsgCreateValidator` rather than redirecting to `gaiacli tx stake create-validator`. - `PrintUnsignedStdTx` now takes an `io.Writer` object. - Mark `--pubkey`, `--amount` and `--moniker` as required flags instead of validating them manually. - Use stake.NewDescription() to make a new Description - ref #2835
* gaiad gentx subcommands refactoring - Replace STDIN/STDOUT redirection in `gaiad gentx` with subcommands command line options to redirect streams to file since viper does not handle redirection well. - Use `BuildCreateValidatorMsg` to build a `MsgCreateValidator` rather than redirecting to `gaiacli tx stake create-validator`. - `PrintUnsignedStdTx` now takes an `io.Writer` object. - Mark `--pubkey`, `--amount` and `--moniker` as required flags instead of validating them manually. - Use stake.NewDescription() to make a new Description - ref #2835 * Refresh PENDING.md
I'd propose to adopt the func NewThing() *Thing {
return &Thing{}
}
func MakeThing() Thing {
return Thing{}
} |
It went lost in last genesis workflow refactoring. Also address structs initializations as per #2835.
Do we need to have constructors which return pointers? We should generally avoid using pointers. |
It's a case-by-case basis @cwgoes I think. But yes, majority of our types should not return pointers. |
...thus let's use the |
That's fine with me, but it will require changing a lot of current code. @rigelrozanski thoughts? |
@alessio what to go into the thinking of using did a bit of reading on some other's thoughts some of this is a little bit beyond me - but I'm not sure I see a good reason to deviate from just using |
Thanks @rigelrozanski, I thought about it again - we'd better to stick to a single naming convention only for simplicity's sake. Let's go with |
It went lost in last genesis workflow refactoring. Also address structs initializations as per #2835.
Throughout the entire sdk we should switch to using NewXxx functions
instead of allowing for struct definitions this will reduce errors as the compiler
will notify us everytime we update a struct but forget to update an object declaration
of that struct type.
The text was updated successfully, but these errors were encountered: