// filename takes a resource or property name (e.g. AWS::CloudFront::Distribution.Restrictions)
// and returns an appropriate filename for the generated struct (e.g. aws-cloudfront-distribution_restrictions.go)
964243
func filename(input string) string {

	// Convert to lowercase
	output := strings.ToLower(input)

	// Replace :: with -
	output = strings.Replace(output, "::", "-", -1)

	// Replace . with _
	output = strings.Replace(output, ".", "_", -1)

	// Suffix with .go
	output += ".go"

	return output

}
758171
func (p *SharedCredentialsProvider) filename() (string, error) {
	if len(p.Filename) != 0 {
		return p.Filename, nil
	}

	if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(p.Filename) != 0 {
		return p.Filename, nil
	}

	if home := shareddefaults.UserHomeDir(); len(home) == 0 {
		// Backwards compatibility of home directly not found error being returned.
		// This error is too verbose, failure when opening the file would of been
		// a better error to return.
		return "", ErrSharedCredentialsHomeNotFound
	}

	p.Filename = shareddefaults.SharedCredentialsFilename()

	return p.Filename, nil
}
198638
func BaseName(path string) string {
	base := filepath.Base(path)
	ext := filepath.Ext(path)

	re := regexp.MustCompile(ext + "$")
	return re.ReplaceAllString(base, "")
}
1101710
func (o *Options) shardName(n int) string {
	abs := url.QueryEscape(o.RepositoryDescription.Name)
	if len(abs) > 200 {
		abs = abs[:200] + hashString(abs)[:8]
	}
	return filepath.Join(o.IndexDir,
		fmt.Sprintf("%s_v%d.%05d.zoekt", abs, zoekt.IndexFormatVersion, n))
}
871701
func (p *PathSpec) URLizeFilename(filename string) string {
	return p.URLEscape(filepath.ToSlash(filename))
}
792186
func (ix *Index) Name(fileid uint32) string {
	return string(ix.NameBytes(fileid))
}
325403
func resourceName(tag names.Tag, envName string) string {
	return fmt.Sprintf("juju-%s-%s", envName, tag)
}
1099941
func fileBase(filePath string) string {
	fileName := path.Base(filePath)
	fileExt := path.Ext(filePath)

	return fileName[:len(fileName)-len(fileExt)]
}
625218
func (v *StorageVol) GetName() (string, error) {
	var err C.virError
	name := C.virStorageVolGetNameWrapper(v.ptr, &err)
	if name == nil {
		return "", makeError(&err)
	}
	return C.GoString(name), nil
}
1056967
func (info *LambdaAWSInfo) LogicalResourceName() string {
	// Per http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html,
	// we can only use alphanumeric, so we'll take the sanitized name and
	// remove all underscores
	// Prefer the user-supplied stable name to the internal one.
	baseName := info.lambdaFunctionName()
	resourceName := strings.Replace(sanitizedName(baseName), "_", "", -1)
	prefix := fmt.Sprintf("%sLambda", resourceName)
	return CloudFormationResourceName(prefix, info.lambdaFunctionName())
}
1306196
func (i Name) CanonicalName() CanonicalName {
	return CanonicalName{
		Name: Name{
			Domain: i.Registry(),
			Image:  i.Repository(),
		},
	}
}
923447
func (c *downloadCommand) ResolveFilename() string {
	filename := c.Filename
	if filename == "" {
		filename = backups.FilenamePrefix + c.ID + ".tar.gz"
	}
	return filename
}
552866
func (r *Resource) resourcePathName() string {
	// remove trailing slash
	uri := strings.TrimSuffix(r.URI, "/")

	if uri != "" && !strings.HasSuffix(uri, "}") {
		// check if it is non-URI params, which ended by "}"
		elems := strings.Split(uri, "/")
		return elems[len(elems)-1]
	}
	if r.Parent == nil {
		return ""
	}
	return r.Parent.resourcePathName()
}
67502
func GetDisplayFilename(filename string) string {
	if absName, err := filepath.Abs(filename); err == nil {
		return absName
	}

	return filename
}
286890
func fileDescriptorClosureVarName(f *protoplugin.File) (string, error) {
	name := f.GetName()
	if name == "" {
		return "", fmt.Errorf("could not create fileDescriptorClosureVarName: %s has no name", f)
	}

	// Use a sha256 of the filename instead of the filename to prevent any characters that are illegal
	// as golang identifiers and to discourage external usage of this constant.
	h := sha256.Sum256([]byte(name))
	return fmt.Sprintf("yarpcFileDescriptorClosure%s", hex.EncodeToString(h[:8])), nil
}
578310
func (s *FileInfo) Name() string {
	s.Lock()
	_, name := filepath.Split(s.name)
	s.Unlock()
	return name
}
375387
func (p *StoragePool) GetName() (string, error) {
	var err C.virError
	name := C.virStoragePoolGetNameWrapper(p.ptr, &err)
	if name == nil {
		return "", makeError(&err)
	}
	return C.GoString(name), nil
}