Closed tegk closed 4 years ago
config.go:36:19: struct of size 256 bytes could be of size 248 bytes (maligned) type ServerConfig struct {
256 bytes:
// ServerConfig specifies config options for a single server
type ServerConfig struct {
// IsEnabled set to true to start the server, false will ignore it
IsEnabled bool `json:"is_enabled"`
// Hostname will be used in the server's reply to HELO/EHLO. If TLS enabled
// make sure that the Hostname matches the cert. Defaults to os.Hostname()
Hostname string `json:"host_name"`
// MaxSize is the maximum size of an email that will be accepted for delivery.
// Defaults to 10 Mebibytes
MaxSize int64 `json:"max_size"`
// TLS Configuration
TLS ServerTLSConfig `json:"tls,omitempty"`
// Timeout specifies the connection timeout in seconds. Defaults to 30
Timeout int `json:"timeout"`
// Listen interface specified in <ip>:<port> - defaults to 127.0.0.1:2525
ListenInterface string `json:"listen_interface"`
// MaxClients controls how many maximum clients we can handle at once.
// Defaults to defaultMaxClients
MaxClients int `json:"max_clients"`
// LogFile is where the logs go. Use path to file, or "stderr", "stdout" or "off".
// defaults to AppConfig.Log file setting
LogFile string `json:"log_file,omitempty"`
// XClientOn when using a proxy such as Nginx, XCLIENT command is used to pass the
// original client's IP address & client's HELO
XClientOn bool `json:"xclient_on,omitempty"`
}
248 bytes:
// ServerConfig specifies config options for a single server
type ServerConfig struct {
// TLS Configuration
TLS ServerTLSConfig `json:"tls,omitempty"`
// Hostname will be used in the server's reply to HELO/EHLO. If TLS enabled
// make sure that the Hostname matches the cert. Defaults to os.Hostname()
Hostname string `json:"host_name"`
// MaxSize is the maximum size of an email that will be accepted for delivery.
// Defaults to 10 Mebibytes
// LogFile is where the logs go. Use path to file, or "stderr", "stdout" or "off".
// defaults to AppConfig.Log file setting
LogFile string `json:"log_file,omitempty"`
MaxSize int64 `json:"max_size"`
// Listen interface specified in <ip>:<port> - defaults to 127.0.0.1:2525
ListenInterface string `json:"listen_interface"`
// Timeout specifies the connection timeout in seconds. Defaults to 30
Timeout int `json:"timeout"`
// MaxClients controls how many maximum clients we can handle at once.
// Defaults to defaultMaxClients
MaxClients int `json:"max_clients"`
// XClientOn when using a proxy such as Nginx, XCLIENT command is used to pass the
// original client's IP address & client's HELO
XClientOn bool `json:"xclient_on,omitempty"`
// IsEnabled set to true to start the server, false will ignore it
IsEnabled bool `json:"is_enabled"`
}
Wow! Interesting. Never considered that one, thought that it was the compiler's job to align them, guess it was the wrong assumption.
In this situation, the struts are just json config mappings, so probably not necessary to align them, as the savings would be insignificant.
Thanks for the other code reviews. There are some donated Ether (Ethereum) funds that we'd like to distribute as rewards, and code review is one of them. Just submit your ETH address using the "Contact Support" form here https://guerrillamail.uservoice.com/ and we'll work out what the reward shall be.
Thanks, I will submit a PR in the next days.
Anybody that wants to save some bytes? :-)