Skip to content

Commit 8631181

Browse files
committed
remove obsolete functions
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
1 parent 84b7d5a commit 8631181

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

loader/loader.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,6 @@ func WithProfiles(profiles []string) func(*Options) {
257257
}
258258
}
259259

260-
// ParseYAML reads the bytes from a file, parses the bytes into a mapping
261-
// structure, and returns it.
262-
func ParseYAML(source []byte) (map[string]interface{}, error) {
263-
r := bytes.NewReader(source)
264-
decoder := yaml.NewDecoder(r)
265-
m, _, err := parseYAML(decoder)
266-
return m, err
267-
}
268-
269260
// PostProcessor is used to tweak compose model based on metadata extracted during yaml Unmarshal phase
270261
// that hardly can be implemented using go-yaml and mapstructure
271262
type PostProcessor interface {
@@ -275,32 +266,6 @@ type PostProcessor interface {
275266
Apply(interface{}) error
276267
}
277268

278-
func parseYAML(decoder *yaml.Decoder) (map[string]interface{}, PostProcessor, error) {
279-
var cfg interface{}
280-
processor := ResetProcessor{target: &cfg}
281-
282-
if err := decoder.Decode(&processor); err != nil {
283-
return nil, nil, err
284-
}
285-
stringMap, ok := cfg.(map[string]interface{})
286-
if ok {
287-
converted, err := convertToStringKeysRecursive(stringMap, "")
288-
if err != nil {
289-
return nil, nil, err
290-
}
291-
return converted.(map[string]interface{}), &processor, nil
292-
}
293-
cfgMap, ok := cfg.(map[interface{}]interface{})
294-
if !ok {
295-
return nil, nil, errors.New("Top-level object must be a mapping")
296-
}
297-
converted, err := convertToStringKeysRecursive(cfgMap, "")
298-
if err != nil {
299-
return nil, nil, err
300-
}
301-
return converted.(map[string]interface{}), &processor, nil
302-
}
303-
304269
// LoadConfigFiles ingests config files with ResourceLoader and returns config details with paths to local copies
305270
func LoadConfigFiles(ctx context.Context, configFiles []string, workingDir string, options ...func(*Options)) (*types.ConfigDetails, error) {
306271
if len(configFiles) < 1 {
@@ -353,12 +318,6 @@ func LoadConfigFiles(ctx context.Context, configFiles []string, workingDir strin
353318
return config, nil
354319
}
355320

356-
// Load reads a ConfigDetails and returns a fully loaded configuration.
357-
// Deprecated: use LoadWithContext.
358-
func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error) {
359-
return LoadWithContext(context.Background(), configDetails, options...)
360-
}
361-
362321
// LoadWithContext reads a ConfigDetails and returns a fully loaded configuration as a compose-go Project
363322
func LoadWithContext(ctx context.Context, configDetails types.ConfigDetails, options ...func(*Options)) (*types.Project, error) {
364323
opts := toOptions(&configDetails, options)

loader/loader_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,6 @@ var sampleConfig = types.Config{
261261
},
262262
}
263263

264-
func TestParseYAML(t *testing.T) {
265-
dict, err := ParseYAML([]byte(sampleYAML))
266-
assert.NilError(t, err)
267-
assert.Check(t, is.DeepEqual(sampleDict, dict))
268-
}
269-
270264
func TestLoad(t *testing.T) {
271265
actual, err := Load(buildConfigDetails(sampleYAML, nil), func(options *Options) {
272266
options.SkipNormalization = true

0 commit comments

Comments
 (0)