@@ -145,7 +145,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
145145 op (opts )
146146 }
147147
148- configs := []* types.Config {}
148+ var configs []* types.Config
149149 for i , file := range configDetails .ConfigFiles {
150150 configDict := file .Config
151151 if configDict == nil {
@@ -222,14 +222,14 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
222222}
223223
224224func parseConfig (b []byte , opts * Options ) (map [string ]interface {}, error ) {
225- yaml , err := ParseYAML (b )
225+ yml , err := ParseYAML (b )
226226 if err != nil {
227227 return nil , err
228228 }
229229 if ! opts .SkipInterpolation {
230- return interp .Interpolate (yaml , * opts .Interpolate )
230+ return interp .Interpolate (yml , * opts .Interpolate )
231231 }
232- return yaml , err
232+ return yml , err
233233}
234234
235235func groupXFieldsIntoExtensions (dict map [string ]interface {}) map [string ]interface {} {
@@ -372,7 +372,7 @@ func createTransformHook(additionalTransformers ...Transformer) mapstructure.Dec
372372 }
373373}
374374
375- // keys needs to be converted to strings for jsonschema
375+ // keys need to be converted to strings for jsonschema
376376func convertToStringKeysRecursive (value interface {}, keyPrefix string ) (interface {}, error ) {
377377 if mapping , ok := value .(map [interface {}]interface {}); ok {
378378 dict := make (map [string ]interface {})
@@ -396,7 +396,7 @@ func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interfac
396396 return dict , nil
397397 }
398398 if list , ok := value .([]interface {}); ok {
399- convertedList := []interface {} {}
399+ var convertedList []interface {}
400400 for index , entry := range list {
401401 newKeyPrefix := fmt .Sprintf ("%s[%d]" , keyPrefix , index )
402402 convertedEntry , err := convertToStringKeysRecursive (entry , newKeyPrefix )
@@ -532,7 +532,7 @@ func LoadService(name string, serviceDict map[string]interface{}, workingDir str
532532 }
533533
534534 for i , volume := range serviceConfig .Volumes {
535- if volume .Type != "bind" {
535+ if volume .Type != types . VolumeTypeBind {
536536 continue
537537 }
538538
@@ -552,8 +552,8 @@ func resolveEnvironment(serviceConfig *types.ServiceConfig, workingDir string, l
552552 environment := types.MappingWithEquals {}
553553
554554 if len (serviceConfig .EnvFile ) > 0 {
555- for _ , file := range serviceConfig .EnvFile {
556- filePath := absPath (workingDir , file )
555+ for _ , envFile := range serviceConfig .EnvFile {
556+ filePath := absPath (workingDir , envFile )
557557 file , err := os .Open (filePath )
558558 if err != nil {
559559 return err
@@ -797,7 +797,7 @@ var transformServicePort TransformerFunc = func(data interface{}) (interface{},
797797 // We process the list instead of individual items here.
798798 // The reason is that one entry might be mapped to multiple ServicePortConfig.
799799 // Therefore we take an input of a list and return an output of a list.
800- ports := []interface {} {}
800+ var ports []interface {}
801801 for _ , entry := range entries {
802802 switch value := entry .(type ) {
803803 case int :
@@ -971,7 +971,7 @@ func transformMappingOrList(mappingOrList interface{}, sep string, allowNil bool
971971 switch value := mappingOrList .(type ) {
972972 case map [string ]interface {}:
973973 return toMapStringString (value , allowNil )
974- case ( []interface {}) :
974+ case []interface {}:
975975 result := make (map [string ]interface {})
976976 for _ , value := range value {
977977 parts := strings .SplitN (value .(string ), sep , 2 )
@@ -1054,7 +1054,7 @@ func toString(value interface{}, allowNil bool) interface{} {
10541054}
10551055
10561056func toStringList (value map [string ]interface {}, separator string , allowNil bool ) []string {
1057- output := []string {}
1057+ var output []string
10581058 for key , value := range value {
10591059 if value == nil && ! allowNil {
10601060 continue
0 commit comments