Skip to content

Possible defect on malaligned calc #9

@thomasmodeneis

Description

@thomasmodeneis

Given the code:

model.go

package addrs

// ASDExchanger bla bla
type ASDExchanger struct {
	ASDBtcExchangeRate    string `mapstructure:"asd_btc_exchange_rate"`
	ASDBtcExchangeRateUSD string `mapstructure:"asd_btc_exchange_rate_usd"`
	ASDBtcExchangeLabel   string `mapstructure:"asd_btc_exchange_label"`
	ASDBtcExchangeEnabled bool   `mapstructure:"asd_btc_exchange_enabled"`

	ASDEthExchangeRate    string `mapstructure:"asd_eth_exchange_rate"`
	ASDEthExchangeRateUSD string `mapstructure:"asd_eth_exchange_rate_usd"`
	ASDEthExchangeLabel   string `mapstructure:"asd_eth_exchange_label"`
	ASDEthExchangeEnabled bool   `mapstructure:"asd_eth_exchange_enabled"`

	ASDSkyExchangeRate    string `mapstructure:"asd_sky_exchange_rate"`
	ASDSkyExchangeRateUSD string `mapstructure:"asd_sky_exchange_rate_usd"`
	ASDSkyExchangeLabel   string `mapstructure:"asd_sky_exchange_label"`
	ASDSkyExchangeEnabled bool   `mapstructure:"asd_sky_exchange_enabled"`

	ASDWavesExchangeRate    string `mapstructure:"asd_waves_exchange_rate"`
	ASDWavesExchangeRateUSD string `mapstructure:"asd_waves_exchange_rate_usd"`
	ASDWavesExchangeLabel   string `mapstructure:"asd_waves_exchange_label"`
	ASDWavesExchangeEnabled bool   `mapstructure:"asd_waves_exchange_enabled"`

	ASDWavesASDExchangeRate    string `mapstructure:"asd_waves_asd_exchange_rate"`
	ASDWavesASDExchangeRateUSD string `mapstructure:"asd_waves_asd_exchange_rate_usd"`
	ASDWavesASDExchangeLabel   string `mapstructure:"asd_waves_asd_exchange_label"`
	ASDWavesASDExchangeEnabled bool   `mapstructure:"asd_waves_asd_exchange_enabled"`
}

When I run gometalinter and maligned:

gometalinter --deadline=3m -j 2 --disable-all --tests --vendor \                                                                                             
        -E maligned \       
        ./...

Then throws me err:

model.go:4:19:warning: struct of size 280 could be 248 (maligned)

When I remove the bool and or replace with string, it works with no errs.

Any ideas ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions