<commit_before>package imageClient

import (
	"encoding/xml"
	"errors"
	"fmt"
	azure "github.com/MSOpenTech/azure-sdk-for-go"
)

const (
	azureImageListURL    = "services/images"
	invalidLocationError = "Error: Can not find image %s in specified subscription, please specify another image name \n"
)

func GetImageList() (ImageList, error) {
	imageList := ImageList{}

	response, err := azure.SendAzureGetRequest(azureImageListURL)
	if err != nil {
		return imageList, err
	}

	err = xml.Unmarshal(response, &imageList)
	return imageList, err
}

func ResolveImageName(imageName string) error {
	if len(imageName) == 0 {
		return fmt.Errorf(azure.ParamNotSpecifiedError, "imageName")
	}

	imageList, err := GetImageList()
	if err != nil {
		return err
	}

	for _, image := range imageList.OSImages {
		if image.Name != imageName {
			continue
		}

		return nil
	}

	return errors.New(fmt.Sprintf(invalidLocationError, imageName))
}<commit_msg>Fixed ResolveImageName method in imageClient.go<commit_after>package imageClient

import (
	"encoding/xml"
	"errors"
	"fmt"
	azure "github.com/MSOpenTech/azure-sdk-for-go"
)

const (
	azureImageListURL    = "services/images"
	invalidImageError = "Error: Can not find image %s in specified subscription, please specify another image name \n"
)

func GetImageList() (ImageList, error) {
	imageList := ImageList{}

	response, err := azure.SendAzureGetRequest(azureImageListURL)
	if err != nil {
		return imageList, err
	}

	err = xml.Unmarshal(response, &imageList)
	return imageList, err
}

func ResolveImageName(imageName string) error {
	if len(imageName) == 0 {
		return fmt.Errorf(azure.ParamNotSpecifiedError, "imageName")
	}

	imageList, err := GetImageList()
	if err != nil {
		return err
	}

	for _, image := range imageList.OSImages {
		if image.Name != imageName && image.Label != imageName {
			continue
		}

		return nil
	}

	return errors.New(fmt.Sprintf(invalidImageError, imageName))
}
{'fraction_non_alphanumeric': 0.11237113402061856, 'fraction_numerical': 0.0010309278350515464, 'mean_word_length': 4.436974789915967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4103595', 'n_tokens_mistral': 670, 'n_tokens_neox': 634, 'n_words': 164}