You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: name.go
    path of file: ./repos/juju/core/lxdprofile
    
    the code of the file until where you have to start completion: // Copyright 2018 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package lxdprofile

import (
	"fmt"
	"sort"
	"strconv"
	"strings"

	"github.com/juju/errors"
)

// AppName here is used as the application prefix name. We can't use names.Juju
// as that changes 
    
func MatchProfileNameByAppName(names []string, appName string) (string, error) {
	if appName == "" {
		return "", errors.BadRequestf("no application name specified")
	}
	var foundProfile string
	for _, p := range LXDProfileNames(names) {
		rev, err := ProfileRevision(p)
		if err != nil {
			// "Shouldn't" happen since we used LXDProfileNames...
			if errors.IsBadRequest(err) {
				continue
			}
			return "", err
		}
		if strings.HasSuffix(p, fmt.Sprintf("-%s-%d", appName, rev)) {
			foundProfile = p
			break
		}
	}
	return foundProfile, nil
}