func Merge(existingServices *ServiceConfigs, environmentLookup EnvironmentLookup, resourceLookup ResourceLookup, file string, bytes []byte) (map[string]*ServiceConfig, map[string]*VolumeConfig, map[string]*NetworkConfig, error) {
	var config Config
	if err := yaml.Unmarshal(bytes, &config); err != nil {
		return nil, nil, nil, err
	}
	var serviceConfigs map[string]*ServiceConfig
	var volumeConfigs map[string]*VolumeConfig
	var networkConfigs map[string]*NetworkConfig
	if config.Version == "2" {
		var err error
		serviceConfigs, err = MergeServicesV2(existingServices, environmentLookup, resourceLookup, file, bytes)
		if err != nil {
			return nil, nil, nil, err
		}
		volumeConfigs, err = ParseVolumes(environmentLookup, resourceLookup, file, bytes)
		if err != nil {
			return nil, nil, nil, err
		}
		networkConfigs, err = ParseNetworks(environmentLookup, resourceLookup, file, bytes)
		if err != nil {
			return nil, nil, nil, err
		}
	} else {
		serviceConfigsV1, err := MergeServicesV1(existingServices, environmentLookup, resourceLookup, file, bytes)
		if err != nil {
			return nil, nil, nil, err
		}
		serviceConfigs, err = ConvertV1toV2(serviceConfigsV1, environmentLookup, resourceLookup)
		if err != nil {
			return nil, nil, nil, err
		}
	}
	adjustValues(serviceConfigs)
	return serviceConfigs, volumeConfigs, networkConfigs, nil
}
Merge merges a compose file into an existing set of service configs
package config
import (
	"bufio"
	"bytes"
	"fmt"
	"strings"
	yaml "github.com/cloudfoundry-incubator/candiedyaml"
	"github.com/hyperhq/hypercli/pkg/urlutil"
)
var (
	noMerge = []string{
		"links",
		"volumes_from",
	}
)