Skip to content

Commit

Permalink
OPTIM/MINOR: go: Optimize struct field alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorunic authored and mjuraga committed Apr 4, 2024
1 parent 5b87cee commit be62090
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 36 deletions.
26 changes: 13 additions & 13 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ import (

// ClientParams is just a placeholder for all client options
type ClientParams struct {
ConfigurationFile string
Haproxy string
TransactionDir string
ConfigurationFile string
Haproxy string
TransactionDir string

// ValidateCmd allows specifying a custom script to validate the transaction file.
// The injected environment variable DATAPLANEAPI_TRANSACTION_FILE must be used to get the location of the file.
ValidateCmd string
ValidateConfigFilesBefore []string
ValidateConfigFilesAfter []string
BackupsNumber int
UseValidation bool
PersistentTransactions bool
ValidateConfigurationFile bool
MasterWorker bool
SkipFailedTransactions bool
UseMd5Hash bool

// ValidateCmd allows specifying a custom script to validate the transaction file.
// The injected environment variable DATAPLANEAPI_TRANSACTION_FILE must be used to get the location of the file.
ValidateCmd string
ValidateConfigFilesBefore []string
ValidateConfigFilesAfter []string
}

// Client configuration client
Expand All @@ -63,10 +63,10 @@ type ClientParams struct {
// transaction files on StartTransaction, and deletes on CommitTransaction. We save
// data to file on every change for persistence.
type client struct {
Transaction
parser parser.Parser
parsers map[string]parser.Parser
services map[string]*Service
parser parser.Parser
Transaction
clientMu sync.Mutex
}

Expand Down Expand Up @@ -240,9 +240,9 @@ func NewParseSection(section parser.Section, pName string, p parser.Parser) *Sec
// SectionParser is used set fields of a section based on the provided parser
type SectionParser struct {
Object interface{}
Parser parser.Parser
Section parser.Section
Name string
Parser parser.Parser
}

// Parse parses the sections fields and sets their values with the data from the parser
Expand Down Expand Up @@ -1454,9 +1454,9 @@ func (s *SectionParser) originalto() interface{} {
// SectionObject represents a configuration section
type SectionObject struct {
Object interface{}
Parser parser.Parser
Section parser.Section
Name string
Parser parser.Parser
// In the context of the deprecation of the fields:
// HTTPKeepAlive, HTTPServerClose and Httpclose.
// This flag is used to set a priority on HTTPConnectionMode field over
Expand Down
22 changes: 11 additions & 11 deletions configuration/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ limitations under the License.
package options

type ConfigurationOptions struct {
ConfigurationFile string
Haproxy string
TransactionDir string
BackupsDir string
ConfigurationFile string
Haproxy string
TransactionDir string
BackupsDir string

// ValidateCmd allows specifying a custom script to validate the transaction file.
// The injected environment variable DATAPLANEAPI_TRANSACTION_FILE must be used to get the location of the file.
ValidateCmd string
ValidateConfigFilesBefore []string
ValidateConfigFilesAfter []string
BackupsNumber int
PersistentTransactions bool
SkipFailedTransactions bool
BackupsNumber int
UseModelsValidation bool
SkipConfigurationFileValidation bool // opposite of previously available ValidateConfigurationFile
MasterWorker bool
UseMd5Hash bool

// ValidateCmd allows specifying a custom script to validate the transaction file.
// The injected environment variable DATAPLANEAPI_TRANSACTION_FILE must be used to get the location of the file.
ValidateCmd string
ValidateConfigFilesBefore []string
ValidateConfigFilesAfter []string
}

type ConfigurationOption interface {
Expand Down
4 changes: 2 additions & 2 deletions configuration/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type ServiceServer struct {

type serviceNode struct {
address string
port int64
name string
port int64
disabled bool
modified bool
}
Expand All @@ -59,8 +59,8 @@ type ServiceI interface {

// ScalingParams defines parameter for dynamic server scaling of the Service backend.
type ScalingParams struct {
BaseSlots int
SlotsGrowthType string
BaseSlots int
SlotsIncrement int
}

Expand Down
4 changes: 2 additions & 2 deletions configuration/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ type TransactionClient interface {
type transactionCleanerHandler func(transactionId, configurationFile string)

type Transaction struct {
TransactionClient TransactionClient
options.ConfigurationOptions
noNamedDefaultsFrom bool
TransactionClient TransactionClient
mu sync.Mutex
noNamedDefaultsFrom bool
}

type Transactions interface {
Expand Down
2 changes: 1 addition & 1 deletion runtime/crt-lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type CrtList struct {
type CrtListEntries []*CrtListEntry

type CrtListEntry struct {
LineNumber int
File string
SSLBindConfig string
SNIFilter []string
LineNumber int
}

// ShowCrtLists returns CrtList files description from runtime
Expand Down
2 changes: 1 addition & 1 deletion runtime/haproxy_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
// HAProxyMock - Mock HAProxy Server for testing the socket communication
type HAProxyMock struct {
net.Listener
running bool
responses map[string]string
t *testing.T
running bool
}

// NewHAProxyMock - create new haproxy mock
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime_single_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ type socketType string

// TaskResponse ...
type TaskResponse struct {
result string
err error
result string
}

// Task has command to execute on runtime api, and response channel for result
Expand Down
4 changes: 2 additions & 2 deletions runtime/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
)

type HAProxyVersion struct {
Commit string
Version string
Major int
Minor int
Patch int
Commit string
Version string
}

func (v *HAProxyVersion) ParseHAProxyVersion(version string) error {
Expand Down
4 changes: 2 additions & 2 deletions spoe/spoe_single_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ type SingleSpoe struct {
}

type Params struct {
SpoeDir string
UseValidation *bool
PersistentTransactions *bool
SkipFailedTransactions *bool
SpoeDir string
TransactionDir string
BackupsNumber int
ConfigurationFile string
BackupsNumber int
}

// newSingleSpoe returns Spoe with default options
Expand Down
2 changes: 1 addition & 1 deletion test/HAProxyMock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
// HAProxyMock - Mock HAProxy Server for testing the socket communication
type HAProxyMock struct {
net.Listener
running bool
responses map[string]string
t *testing.T
running bool
}

// NewHAProxyMock - create new haproxy mock
Expand Down

0 comments on commit be62090

Please sign in to comment.