func loadCompilerSettings()

in go/base-arm/rootfs/entrypoint.go [126:155]


func loadCompilerSettings(goos, arch string, env map[string]string) error {
	data, err := ioutil.ReadFile("/compilers.yaml")
	if err != nil {
		if os.IsNotExist(err) {
			return nil
		}
		return fmt.Errorf("failed to read /compilers.yaml: %v", err)
	}

	var compilers Compilers
	if err = yaml.Unmarshal(data, &compilers); err != nil {
		return fmt.Errorf("failed to parse /compilers.yaml: %v", err)
	}

	arches, found := compilers.GOOS[goos]
	if !found {
		return fmt.Errorf("%v is not supported by this image", goos)
	}

	settings, found := arches.Arch[arch]
	if !found {
		return fmt.Errorf("%v/%v is not supported by this image", goos, arch)
	}

	for k, v := range settings.Env {
		env[k] = v
	}

	return nil
}