mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	update github.com/compose-spec/compose-go to v1.0.8
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										2
									
								
								vendor/github.com/compose-spec/compose-go/loader/full-example.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/compose-spec/compose-go/loader/full-example.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -268,7 +268,7 @@ services: | ||||
|       - .:/code | ||||
|       - ./static:/var/www/html | ||||
|       # User-relative path | ||||
|       - ~/configs:/etc/configs/:ro | ||||
|       - ~/configs:/etc/configs:ro | ||||
|       # Named volume | ||||
|       - datavolume:/var/lib/mysql | ||||
|       - type: bind | ||||
|   | ||||
							
								
								
									
										54
									
								
								vendor/github.com/compose-spec/compose-go/loader/loader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										54
									
								
								vendor/github.com/compose-spec/compose-go/loader/loader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -145,7 +145,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types. | ||||
| 		op(opts) | ||||
| 	} | ||||
|  | ||||
| 	configs := []*types.Config{} | ||||
| 	var configs []*types.Config | ||||
| 	for i, file := range configDetails.ConfigFiles { | ||||
| 		configDict := file.Config | ||||
| 		if configDict == nil { | ||||
| @@ -222,14 +222,14 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types. | ||||
| } | ||||
|  | ||||
| func parseConfig(b []byte, opts *Options) (map[string]interface{}, error) { | ||||
| 	yaml, err := ParseYAML(b) | ||||
| 	yml, err := ParseYAML(b) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if !opts.SkipInterpolation { | ||||
| 		return interp.Interpolate(yaml, *opts.Interpolate) | ||||
| 		return interp.Interpolate(yml, *opts.Interpolate) | ||||
| 	} | ||||
| 	return yaml, err | ||||
| 	return yml, err | ||||
| } | ||||
|  | ||||
| func groupXFieldsIntoExtensions(dict map[string]interface{}) map[string]interface{} { | ||||
| @@ -342,8 +342,8 @@ func createTransformHook(additionalTransformers ...Transformer) mapstructure.Dec | ||||
| 		reflect.TypeOf(types.UlimitsConfig{}):                    transformUlimits, | ||||
| 		reflect.TypeOf(types.UnitBytes(0)):                       transformSize, | ||||
| 		reflect.TypeOf([]types.ServicePortConfig{}):              transformServicePort, | ||||
| 		reflect.TypeOf(types.ServiceSecretConfig{}):              transformStringSourceMap, | ||||
| 		reflect.TypeOf(types.ServiceConfigObjConfig{}):           transformStringSourceMap, | ||||
| 		reflect.TypeOf(types.ServiceSecretConfig{}):              transformFileReferenceConfig, | ||||
| 		reflect.TypeOf(types.ServiceConfigObjConfig{}):           transformFileReferenceConfig, | ||||
| 		reflect.TypeOf(types.StringOrNumberList{}):               transformStringOrNumberList, | ||||
| 		reflect.TypeOf(map[string]*types.ServiceNetworkConfig{}): transformServiceNetworkMap, | ||||
| 		reflect.TypeOf(types.Mapping{}):                          transformMappingOrListFunc("=", false), | ||||
| @@ -372,7 +372,7 @@ func createTransformHook(additionalTransformers ...Transformer) mapstructure.Dec | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // keys needs to be converted to strings for jsonschema | ||||
| // keys need to be converted to strings for jsonschema | ||||
| func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interface{}, error) { | ||||
| 	if mapping, ok := value.(map[interface{}]interface{}); ok { | ||||
| 		dict := make(map[string]interface{}) | ||||
| @@ -396,7 +396,7 @@ func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interfac | ||||
| 		return dict, nil | ||||
| 	} | ||||
| 	if list, ok := value.([]interface{}); ok { | ||||
| 		convertedList := []interface{}{} | ||||
| 		var convertedList []interface{} | ||||
| 		for index, entry := range list { | ||||
| 			newKeyPrefix := fmt.Sprintf("%s[%d]", keyPrefix, index) | ||||
| 			convertedEntry, err := convertToStringKeysRecursive(entry, newKeyPrefix) | ||||
| @@ -532,7 +532,7 @@ func LoadService(name string, serviceDict map[string]interface{}, workingDir str | ||||
| 	} | ||||
|  | ||||
| 	for i, volume := range serviceConfig.Volumes { | ||||
| 		if volume.Type != "bind" { | ||||
| 		if volume.Type != types.VolumeTypeBind { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -552,14 +552,14 @@ func resolveEnvironment(serviceConfig *types.ServiceConfig, workingDir string, l | ||||
| 	environment := types.MappingWithEquals{} | ||||
|  | ||||
| 	if len(serviceConfig.EnvFile) > 0 { | ||||
| 		for _, file := range serviceConfig.EnvFile { | ||||
| 			filePath := absPath(workingDir, file) | ||||
| 		for _, envFile := range serviceConfig.EnvFile { | ||||
| 			filePath := absPath(workingDir, envFile) | ||||
| 			file, err := os.Open(filePath) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			defer file.Close() | ||||
| 			fileVars, err := godotenv.Parse(file) | ||||
| 			fileVars, err := godotenv.ParseWithLookup(file, godotenv.LookupFn(lookupEnv)) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| @@ -797,7 +797,7 @@ var transformServicePort TransformerFunc = func(data interface{}) (interface{}, | ||||
| 		// We process the list instead of individual items here. | ||||
| 		// The reason is that one entry might be mapped to multiple ServicePortConfig. | ||||
| 		// Therefore we take an input of a list and return an output of a list. | ||||
| 		ports := []interface{}{} | ||||
| 		var ports []interface{} | ||||
| 		for _, entry := range entries { | ||||
| 			switch value := entry.(type) { | ||||
| 			case int: | ||||
| @@ -852,17 +852,27 @@ var transformServiceDeviceRequest TransformerFunc = func(data interface{}) (inte | ||||
| 	} | ||||
| } | ||||
|  | ||||
| var transformStringSourceMap TransformerFunc = func(data interface{}) (interface{}, error) { | ||||
| var transformFileReferenceConfig TransformerFunc = func(data interface{}) (interface{}, error) { | ||||
| 	switch value := data.(type) { | ||||
| 	case string: | ||||
| 		return map[string]interface{}{"source": value}, nil | ||||
| 	case map[string]interface{}: | ||||
| 		return groupXFieldsIntoExtensions(data.(map[string]interface{})), nil | ||||
| 		if target, ok := value["target"]; ok { | ||||
| 			value["target"] = cleanTarget(target.(string)) | ||||
| 		} | ||||
| 		return groupXFieldsIntoExtensions(value), nil | ||||
| 	default: | ||||
| 		return data, errors.Errorf("invalid type %T for secret", value) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func cleanTarget(target string) string { | ||||
| 	if target == "" { | ||||
| 		return "" | ||||
| 	} | ||||
| 	return path.Clean(target) | ||||
| } | ||||
|  | ||||
| var transformBuildConfig TransformerFunc = func(data interface{}) (interface{}, error) { | ||||
| 	switch value := data.(type) { | ||||
| 	case string: | ||||
| @@ -906,9 +916,15 @@ var transformExtendsConfig TransformerFunc = func(data interface{}) (interface{} | ||||
| var transformServiceVolumeConfig TransformerFunc = func(data interface{}) (interface{}, error) { | ||||
| 	switch value := data.(type) { | ||||
| 	case string: | ||||
| 		return ParseVolume(value) | ||||
| 		volume, err := ParseVolume(value) | ||||
| 		volume.Target = cleanTarget(volume.Target) | ||||
| 		return volume, err | ||||
| 	case map[string]interface{}: | ||||
| 		return groupXFieldsIntoExtensions(data.(map[string]interface{})), nil | ||||
| 		data := groupXFieldsIntoExtensions(data.(map[string]interface{})) | ||||
| 		if target, ok := data["target"]; ok { | ||||
| 			data["target"] = cleanTarget(target.(string)) | ||||
| 		} | ||||
| 		return data, nil | ||||
| 	default: | ||||
| 		return data, errors.Errorf("invalid type %T for service volume", value) | ||||
| 	} | ||||
| @@ -971,7 +987,7 @@ func transformMappingOrList(mappingOrList interface{}, sep string, allowNil bool | ||||
| 	switch value := mappingOrList.(type) { | ||||
| 	case map[string]interface{}: | ||||
| 		return toMapStringString(value, allowNil) | ||||
| 	case ([]interface{}): | ||||
| 	case []interface{}: | ||||
| 		result := make(map[string]interface{}) | ||||
| 		for _, value := range value { | ||||
| 			parts := strings.SplitN(value.(string), sep, 2) | ||||
| @@ -1054,7 +1070,7 @@ func toString(value interface{}, allowNil bool) interface{} { | ||||
| } | ||||
|  | ||||
| func toStringList(value map[string]interface{}, separator string, allowNil bool) []string { | ||||
| 	output := []string{} | ||||
| 	var output []string | ||||
| 	for key, value := range value { | ||||
| 		if value == nil && !allowNil { | ||||
| 			continue | ||||
|   | ||||
							
								
								
									
										25
									
								
								vendor/github.com/compose-spec/compose-go/loader/merge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								vendor/github.com/compose-spec/compose-go/loader/merge.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -114,6 +114,11 @@ func _merge(baseService *types.ServiceConfig, overrideService *types.ServiceConf | ||||
| 	if overrideService.Entrypoint != nil { | ||||
| 		baseService.Entrypoint = overrideService.Entrypoint | ||||
| 	} | ||||
| 	if baseService.Environment != nil { | ||||
| 		baseService.Environment.OverrideBy(overrideService.Environment) | ||||
| 	} else { | ||||
| 		baseService.Environment = overrideService.Environment | ||||
| 	} | ||||
| 	return baseService, nil | ||||
| } | ||||
|  | ||||
| @@ -179,7 +184,7 @@ func toServiceVolumeConfigsMap(s interface{}) (map[interface{}]interface{}, erro | ||||
| } | ||||
|  | ||||
| func toServiceSecretConfigsSlice(dst reflect.Value, m map[interface{}]interface{}) error { | ||||
| 	s := []types.ServiceSecretConfig{} | ||||
| 	var s []types.ServiceSecretConfig | ||||
| 	for _, v := range m { | ||||
| 		s = append(s, v.(types.ServiceSecretConfig)) | ||||
| 	} | ||||
| @@ -189,7 +194,7 @@ func toServiceSecretConfigsSlice(dst reflect.Value, m map[interface{}]interface{ | ||||
| } | ||||
|  | ||||
| func toSServiceConfigObjConfigsSlice(dst reflect.Value, m map[interface{}]interface{}) error { | ||||
| 	s := []types.ServiceConfigObjConfig{} | ||||
| 	var s []types.ServiceConfigObjConfig | ||||
| 	for _, v := range m { | ||||
| 		s = append(s, v.(types.ServiceConfigObjConfig)) | ||||
| 	} | ||||
| @@ -199,7 +204,7 @@ func toSServiceConfigObjConfigsSlice(dst reflect.Value, m map[interface{}]interf | ||||
| } | ||||
|  | ||||
| func toServicePortConfigsSlice(dst reflect.Value, m map[interface{}]interface{}) error { | ||||
| 	s := []types.ServicePortConfig{} | ||||
| 	var s []types.ServicePortConfig | ||||
| 	for _, v := range m { | ||||
| 		s = append(s, v.(types.ServicePortConfig)) | ||||
| 	} | ||||
| @@ -220,7 +225,7 @@ func toServicePortConfigsSlice(dst reflect.Value, m map[interface{}]interface{}) | ||||
| } | ||||
|  | ||||
| func toServiceVolumeConfigsSlice(dst reflect.Value, m map[interface{}]interface{}) error { | ||||
| 	s := []types.ServiceVolumeConfig{} | ||||
| 	var s []types.ServiceVolumeConfig | ||||
| 	for _, v := range m { | ||||
| 		s = append(s, v.(types.ServiceVolumeConfig)) | ||||
| 	} | ||||
| @@ -229,7 +234,7 @@ func toServiceVolumeConfigsSlice(dst reflect.Value, m map[interface{}]interface{ | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| type tomapFn func(s interface{}) (map[interface{}]interface{}, error) | ||||
| type toMapFn func(s interface{}) (map[interface{}]interface{}, error) | ||||
| type writeValueFromMapFn func(reflect.Value, map[interface{}]interface{}) error | ||||
|  | ||||
| func safelyMerge(mergeFn func(dst, src reflect.Value) error) func(dst, src reflect.Value) error { | ||||
| @@ -245,13 +250,13 @@ func safelyMerge(mergeFn func(dst, src reflect.Value) error) func(dst, src refle | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func mergeSlice(tomap tomapFn, writeValue writeValueFromMapFn) func(dst, src reflect.Value) error { | ||||
| func mergeSlice(toMap toMapFn, writeValue writeValueFromMapFn) func(dst, src reflect.Value) error { | ||||
| 	return func(dst, src reflect.Value) error { | ||||
| 		dstMap, err := sliceToMap(tomap, dst) | ||||
| 		dstMap, err := sliceToMap(toMap, dst) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		srcMap, err := sliceToMap(tomap, src) | ||||
| 		srcMap, err := sliceToMap(toMap, src) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| @@ -262,12 +267,12 @@ func mergeSlice(tomap tomapFn, writeValue writeValueFromMapFn) func(dst, src ref | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func sliceToMap(tomap tomapFn, v reflect.Value) (map[interface{}]interface{}, error) { | ||||
| func sliceToMap(toMap toMapFn, v reflect.Value) (map[interface{}]interface{}, error) { | ||||
| 	// check if valid | ||||
| 	if !v.IsValid() { | ||||
| 		return nil, errors.Errorf("invalid value : %+v", v) | ||||
| 	} | ||||
| 	return tomap(v.Interface()) | ||||
| 	return toMap(v.Interface()) | ||||
| } | ||||
|  | ||||
| func mergeLoggingConfig(dst, src reflect.Value) error { | ||||
|   | ||||
							
								
								
									
										6
									
								
								vendor/github.com/compose-spec/compose-go/loader/volume.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/compose-spec/compose-go/loader/volume.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -36,11 +36,11 @@ func ParseVolume(spec string) (types.ServiceVolumeConfig, error) { | ||||
| 		return volume, errors.New("invalid empty volume spec") | ||||
| 	case 1, 2: | ||||
| 		volume.Target = spec | ||||
| 		volume.Type = string(types.VolumeTypeVolume) | ||||
| 		volume.Type = types.VolumeTypeVolume | ||||
| 		return volume, nil | ||||
| 	} | ||||
|  | ||||
| 	buffer := []rune{} | ||||
| 	var buffer []rune | ||||
| 	for _, char := range spec + string(endOfSpec) { | ||||
| 		switch { | ||||
| 		case isWindowsDrive(buffer, char): | ||||
| @@ -50,7 +50,7 @@ func ParseVolume(spec string) (types.ServiceVolumeConfig, error) { | ||||
| 				populateType(&volume) | ||||
| 				return volume, errors.Wrapf(err, "invalid spec: %s", spec) | ||||
| 			} | ||||
| 			buffer = []rune{} | ||||
| 			buffer = nil | ||||
| 		default: | ||||
| 			buffer = append(buffer, char) | ||||
| 		} | ||||
|   | ||||
							
								
								
									
										32
									
								
								vendor/github.com/compose-spec/compose-go/template/template.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								vendor/github.com/compose-spec/compose-go/template/template.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -26,7 +26,7 @@ import ( | ||||
|  | ||||
| var delimiter = "\\$" | ||||
| var substitutionNamed = "[_a-z][_a-z0-9]*" | ||||
| var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-?][^}]*)?" | ||||
| var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-?](.*}|[^}]*))?" | ||||
|  | ||||
| var patternString = fmt.Sprintf( | ||||
| 	"%s(?i:(?P<escaped>%s)|(?P<named>%s)|{(?P<braced>%s)}|(?P<invalid>))", | ||||
| @@ -35,14 +35,6 @@ var patternString = fmt.Sprintf( | ||||
|  | ||||
| var defaultPattern = regexp.MustCompile(patternString) | ||||
|  | ||||
| // DefaultSubstituteFuncs contains the default SubstituteFunc used by the docker cli | ||||
| var DefaultSubstituteFuncs = []SubstituteFunc{ | ||||
| 	softDefault, | ||||
| 	hardDefault, | ||||
| 	requiredNonEmpty, | ||||
| 	required, | ||||
| } | ||||
|  | ||||
| // InvalidTemplateError is returned when a variable template is not in a valid | ||||
| // format | ||||
| type InvalidTemplateError struct { | ||||
| @@ -67,6 +59,14 @@ type SubstituteFunc func(string, Mapping) (string, bool, error) | ||||
| // SubstituteWith substitute variables in the string with their values. | ||||
| // It accepts additional substitute function. | ||||
| func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, subsFuncs ...SubstituteFunc) (string, error) { | ||||
| 	if len(subsFuncs) == 0 { | ||||
| 		subsFuncs = []SubstituteFunc{ | ||||
| 			softDefault, | ||||
| 			hardDefault, | ||||
| 			requiredNonEmpty, | ||||
| 			required, | ||||
| 		} | ||||
| 	} | ||||
| 	var err error | ||||
| 	result := pattern.ReplaceAllStringFunc(template, func(substring string) string { | ||||
| 		matches := pattern.FindStringSubmatch(substring) | ||||
| @@ -116,7 +116,7 @@ func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, su | ||||
|  | ||||
| // Substitute variables in the string with their values | ||||
| func Substitute(template string, mapping Mapping) (string, error) { | ||||
| 	return SubstituteWith(template, mapping, defaultPattern, DefaultSubstituteFuncs...) | ||||
| 	return SubstituteWith(template, mapping, defaultPattern) | ||||
| } | ||||
|  | ||||
| // ExtractVariables returns a map of all the variables defined in the specified | ||||
| @@ -215,6 +215,10 @@ func softDefault(substitution string, mapping Mapping) (string, bool, error) { | ||||
| 		return "", false, nil | ||||
| 	} | ||||
| 	name, defaultValue := partition(substitution, sep) | ||||
| 	defaultValue, err := Substitute(defaultValue, mapping) | ||||
| 	if err != nil { | ||||
| 		return "", false, err | ||||
| 	} | ||||
| 	value, ok := mapping(name) | ||||
| 	if !ok || value == "" { | ||||
| 		return defaultValue, true, nil | ||||
| @@ -229,6 +233,10 @@ func hardDefault(substitution string, mapping Mapping) (string, bool, error) { | ||||
| 		return "", false, nil | ||||
| 	} | ||||
| 	name, defaultValue := partition(substitution, sep) | ||||
| 	defaultValue, err := Substitute(defaultValue, mapping) | ||||
| 	if err != nil { | ||||
| 		return "", false, err | ||||
| 	} | ||||
| 	value, ok := mapping(name) | ||||
| 	if !ok { | ||||
| 		return defaultValue, true, nil | ||||
| @@ -249,6 +257,10 @@ func withRequired(substitution string, mapping Mapping, sep string, valid func(s | ||||
| 		return "", false, nil | ||||
| 	} | ||||
| 	name, errorMessage := partition(substitution, sep) | ||||
| 	errorMessage, err := Substitute(errorMessage, mapping) | ||||
| 	if err != nil { | ||||
| 		return "", false, err | ||||
| 	} | ||||
| 	value, ok := mapping(name) | ||||
| 	if !ok || !valid(value) { | ||||
| 		return "", true, &InvalidTemplateError{ | ||||
|   | ||||
							
								
								
									
										17
									
								
								vendor/github.com/compose-spec/compose-go/types/project.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/compose-spec/compose-go/types/project.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -46,7 +46,7 @@ type Project struct { | ||||
|  | ||||
| // ServiceNames return names for all services in this Compose config | ||||
| func (p Project) ServiceNames() []string { | ||||
| 	names := []string{} | ||||
| 	var names []string | ||||
| 	for _, s := range p.Services { | ||||
| 		names = append(names, s.Name) | ||||
| 	} | ||||
| @@ -56,7 +56,7 @@ func (p Project) ServiceNames() []string { | ||||
|  | ||||
| // VolumeNames return names for all volumes in this Compose config | ||||
| func (p Project) VolumeNames() []string { | ||||
| 	names := []string{} | ||||
| 	var names []string | ||||
| 	for k := range p.Volumes { | ||||
| 		names = append(names, k) | ||||
| 	} | ||||
| @@ -66,7 +66,7 @@ func (p Project) VolumeNames() []string { | ||||
|  | ||||
| // NetworkNames return names for all volumes in this Compose config | ||||
| func (p Project) NetworkNames() []string { | ||||
| 	names := []string{} | ||||
| 	var names []string | ||||
| 	for k := range p.Networks { | ||||
| 		names = append(names, k) | ||||
| 	} | ||||
| @@ -76,7 +76,7 @@ func (p Project) NetworkNames() []string { | ||||
|  | ||||
| // SecretNames return names for all secrets in this Compose config | ||||
| func (p Project) SecretNames() []string { | ||||
| 	names := []string{} | ||||
| 	var names []string | ||||
| 	for k := range p.Secrets { | ||||
| 		names = append(names, k) | ||||
| 	} | ||||
| @@ -86,7 +86,7 @@ func (p Project) SecretNames() []string { | ||||
|  | ||||
| // ConfigNames return names for all configs in this Compose config | ||||
| func (p Project) ConfigNames() []string { | ||||
| 	names := []string{} | ||||
| 	var names []string | ||||
| 	for k := range p.Configs { | ||||
| 		names = append(names, k) | ||||
| 	} | ||||
| @@ -179,12 +179,12 @@ func (p *Project) RelativePath(path string) string { | ||||
| } | ||||
|  | ||||
| // HasProfile return true if service has no profile declared or has at least one profile matching | ||||
| func (service ServiceConfig) HasProfile(profiles []string) bool { | ||||
| 	if len(service.Profiles) == 0 { | ||||
| func (s ServiceConfig) HasProfile(profiles []string) bool { | ||||
| 	if len(s.Profiles) == 0 { | ||||
| 		return true | ||||
| 	} | ||||
| 	for _, p := range profiles { | ||||
| 		for _, sp := range service.Profiles { | ||||
| 		for _, sp := range s.Profiles { | ||||
| 			if sp == p { | ||||
| 				return true | ||||
| 			} | ||||
| @@ -327,7 +327,6 @@ func (p *Project) ResolveImages(resolver func(named reference.Named) (digest.Dig | ||||
| 				if err != nil { | ||||
| 					return err | ||||
| 				} | ||||
|  | ||||
| 				named, err = reference.WithDigest(named, digest) | ||||
| 				if err != nil { | ||||
| 					return err | ||||
|   | ||||
							
								
								
									
										16
									
								
								vendor/github.com/compose-spec/compose-go/types/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/compose-spec/compose-go/types/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -33,7 +33,7 @@ func (d Duration) String() string { | ||||
| 	return time.Duration(d).String() | ||||
| } | ||||
|  | ||||
| // ConvertDurationPtr converts a typedefined Duration pointer to a time.Duration pointer with the same value. | ||||
| // ConvertDurationPtr converts a type defined Duration pointer to a time.Duration pointer with the same value. | ||||
| func ConvertDurationPtr(d *Duration) *time.Duration { | ||||
| 	if d == nil { | ||||
| 		return nil | ||||
| @@ -121,7 +121,7 @@ type ServiceConfig struct { | ||||
| 	Extends         ExtendsConfig                    `yaml:"extends,omitempty" json:"extends,omitempty"` | ||||
| 	ExternalLinks   []string                         `mapstructure:"external_links" yaml:"external_links,omitempty" json:"external_links,omitempty"` | ||||
| 	ExtraHosts      HostsList                        `mapstructure:"extra_hosts" yaml:"extra_hosts,omitempty" json:"extra_hosts,omitempty"` | ||||
| 	GroupAdd        []string                         `mapstructure:"group_app" yaml:"group_add,omitempty" json:"group_add,omitempty"` | ||||
| 	GroupAdd        []string                         `mapstructure:"group_add" yaml:"group_add,omitempty" json:"group_add,omitempty"` | ||||
| 	Hostname        string                           `yaml:",omitempty" json:"hostname,omitempty"` | ||||
| 	HealthCheck     *HealthCheckConfig               `yaml:",omitempty" json:"healthcheck,omitempty"` | ||||
| 	Image           string                           `yaml:",omitempty" json:"image,omitempty"` | ||||
| @@ -208,7 +208,7 @@ const ( | ||||
| 	PullPolicyNever = "never" | ||||
| 	//PullPolicyIfNotPresent pull missing images | ||||
| 	PullPolicyIfNotPresent = "if_not_present" | ||||
| 	//PullPolicyIfNotPresent pull missing images | ||||
| 	//PullPolicyMissing pull missing images | ||||
| 	PullPolicyMissing = "missing" | ||||
| 	//PullPolicyBuild force building images | ||||
| 	PullPolicyBuild = "build" | ||||
| @@ -611,7 +611,7 @@ func ParsePortConfig(value string) ([]ServicePortConfig, error) { | ||||
| } | ||||
|  | ||||
| func convertPortToPortConfig(port nat.Port, portBindings map[nat.Port][]nat.PortBinding) ([]ServicePortConfig, error) { | ||||
| 	portConfigs := []ServicePortConfig{} | ||||
| 	var portConfigs []ServicePortConfig | ||||
| 	for _, binding := range portBindings[port] { | ||||
| 		startHostPort, endHostPort, err := nat.ParsePortRange(binding.HostPort) | ||||
|  | ||||
| @@ -647,13 +647,13 @@ type ServiceVolumeConfig struct { | ||||
| } | ||||
|  | ||||
| const ( | ||||
| 	// TypeBind is the type for mounting host dir | ||||
| 	// VolumeTypeBind is the type for mounting host dir | ||||
| 	VolumeTypeBind = "bind" | ||||
| 	// TypeVolume is the type for remote storage volumes | ||||
| 	// VolumeTypeVolume is the type for remote storage volumes | ||||
| 	VolumeTypeVolume = "volume" | ||||
| 	// TypeTmpfs is the type for mounting tmpfs | ||||
| 	// VolumeTypeTmpfs is the type for mounting tmpfs | ||||
| 	VolumeTypeTmpfs = "tmpfs" | ||||
| 	// TypeNamedPipe is the type for mounting Windows named pipes | ||||
| 	// VolumeTypeNamedPipe is the type for mounting Windows named pipes | ||||
| 	VolumeTypeNamedPipe = "npipe" | ||||
| ) | ||||
|  | ||||
|   | ||||
							
								
								
									
										10
									
								
								vendor/github.com/compose-spec/godotenv/godotenv.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/compose-spec/godotenv/godotenv.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -266,12 +266,12 @@ func parseLineWithLookup(line string, envMap map[string]string, lookupFn LookupF | ||||
| 	firstColon := strings.Index(line, ":") | ||||
| 	splitString := strings.SplitN(line, "=", 2) | ||||
| 	if firstColon != -1 && (firstColon < firstEquals || firstEquals == -1) { | ||||
| 		//this is a yaml-style line | ||||
| 		// This is a yaml-style line | ||||
| 		splitString = strings.SplitN(line, ":", 2) | ||||
| 	} | ||||
|  | ||||
| 	if len(splitString) != 2 { | ||||
| 		err = errors.New("Can't separate key from value") | ||||
| 		err = errors.New("can't separate key from value") | ||||
| 		return | ||||
| 	} | ||||
| 	key = exportRegex.ReplaceAllString(splitString[0], "$1") | ||||
| @@ -341,15 +341,15 @@ func expandVariables(v string, envMap map[string]string, lookupFn LookupFn) stri | ||||
| 		if submatch[1] == "\\" || submatch[2] == "(" { | ||||
| 			return submatch[0][1:] | ||||
| 		} else if submatch[4] != "" { | ||||
| 			//first check if we have defined this already earlier | ||||
| 			// first check if we have defined this already earlier | ||||
| 			if envMap[submatch[4]] != "" { | ||||
| 				return envMap[submatch[4]] | ||||
| 			} | ||||
| 			if lookupFn == nil { | ||||
| 				return "" | ||||
| 			} | ||||
| 			//if we have not defined it, check the lookup function provided | ||||
| 			//by the user | ||||
| 			// if we have not defined it, check the lookup function provided | ||||
| 			// by the user | ||||
| 			s2, ok := lookupFn(submatch[4]) | ||||
| 			if ok { | ||||
| 				return s2 | ||||
|   | ||||
							
								
								
									
										28
									
								
								vendor/github.com/compose-spec/godotenv/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								vendor/github.com/compose-spec/godotenv/parser.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -127,15 +127,21 @@ loop: | ||||
|  | ||||
| // extractVarValue extracts variable value and returns rest of slice | ||||
| func extractVarValue(src []byte, envMap map[string]string, lookupFn LookupFn) (value string, rest []byte, err error) { | ||||
| 	quote, hasPrefix := hasQuotePrefix(src) | ||||
| 	if !hasPrefix { | ||||
| 		// unquoted value - read until whitespace | ||||
| 		end := bytes.IndexFunc(src, unicode.IsSpace) | ||||
| 		if end == -1 { | ||||
| 			return expandVariables(string(src), envMap, lookupFn), nil, nil | ||||
| 	quote, isQuoted := hasQuotePrefix(src) | ||||
| 	if !isQuoted { | ||||
| 		// unquoted value - read until new line | ||||
| 		end := bytes.IndexFunc(src, isNewLine) | ||||
| 		var rest []byte | ||||
| 		var value string | ||||
| 		if end < 0 { | ||||
| 			value := strings.TrimRightFunc(string(src), unicode.IsSpace) | ||||
| 			rest = nil | ||||
| 			return expandVariables(value, envMap, lookupFn), rest, nil | ||||
| 		} | ||||
|  | ||||
| 		return expandVariables(string(src[0:end]), envMap, lookupFn), src[end:], nil | ||||
| 		value = strings.TrimRightFunc(string(src[0:end]), unicode.IsSpace) | ||||
| 		rest = src[end:] | ||||
| 		return expandVariables(value, envMap, lookupFn), rest, nil | ||||
| 	} | ||||
|  | ||||
| 	// lookup quoted string terminator | ||||
| @@ -192,7 +198,7 @@ func indexOfNonSpaceChar(src []byte) int { | ||||
| } | ||||
|  | ||||
| // hasQuotePrefix reports whether charset starts with single or double quote and returns quote character | ||||
| func hasQuotePrefix(src []byte) (prefix byte, isQuored bool) { | ||||
| func hasQuotePrefix(src []byte) (quote byte, isQuoted bool) { | ||||
| 	if len(src) == 0 { | ||||
| 		return 0, false | ||||
| 	} | ||||
| @@ -221,3 +227,9 @@ func isSpace(r rune) bool { | ||||
| 	} | ||||
| 	return false | ||||
| } | ||||
|  | ||||
|  | ||||
| // isNewLine reports whether the rune is a new line character | ||||
| func isNewLine(r rune) bool { | ||||
| 	return r == '\n' | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CrazyMax
					CrazyMax