// CleanRepoURL returns the RepoURL but ensures it ends with a trailing slash
184086
func (s RepoChartSource) CleanRepoURL() string {
	cleanURL := strings.TrimRight(s.RepoURL, "/")
	return cleanURL + "/"
}
317413
func (v *VaultProvider) Cleanup() error {
	return v.client.Sys().Unmount(v.config.IntermediatePKIPath)
}
813169
func cleanReturnedArray(newObj, obj []interface{}) []interface{} {
	arrayToReturn := newObj
	for i := range newObj {
		switch newValue := newObj[i].(type) {
		case map[string]interface{}:
			if oldValue, ok := obj[i].(map[string]interface{}); ok {
				convertedMap := cleanReturnedObj(newValue, oldValue)
				arrayToReturn[i] = convertedMap
			}
		case []interface{}:
			if oldValue, ok := obj[i].([]interface{}); ok {
				convertedMap := cleanReturnedArray(newValue, oldValue)
				arrayToReturn[i] = convertedMap
			}
		}
	}
	return arrayToReturn
}
1204893
func CleanFilePath(dirtyPath string) string {
	var windowsReplacements = []string{"<", "_", ">", "_", ":", "_", "?", "_", "*", "_", "?", "_", "|", "_"}
	replacer := strings.NewReplacer(windowsReplacements...)
	return filepath.Clean(replacer.Replace(dirtyPath))
}
1224641
func (p *Pruner) flushRemovals() error {
	if len(p.toRemove) == 0 {
		return nil
	}
	matched, err := p.beingsC.RemoveAll(bson.M{"_id": bson.M{"$in": p.toRemove}})
	if err != nil {
		return err
	}
	p.toRemove = p.toRemove[:0]
	if matched.Removed > 0 {
		p.removedCount += uint64(matched.Removed)
	}
	return err
}
1129970
func cleanPath(p string) string {
	p = filepath.ToSlash(p)
	if !filepath.IsAbs(p) {
		p = "/" + p
	}
	return path.Clean(p)
}
10596
func (d *Driver) Cleanup() error {
	err := d.subvolDisableQuota()
	umountErr := mount.Unmount(d.home)

	// in case we have two errors, prefer the one from disableQuota()
	if err != nil {
		return err
	}

	if umountErr != nil {
		return umountErr
	}

	return nil
}
403890
func (f *FileStorage) Clean() error {
	f.subscription.WaitAll() // Wait until every subscriber ends waiting every result
	return os.Remove(f.file.Name())
}
99585
func (as *AgentServer) Cleanup(ctx context.Context, cleanupRequest *pb.CleanupRequest) (*pb.CleanupResponse, error) {

	log.Println("cleaning up", cleanupRequest.GetFlowHashCode())
	dir := path.Join(*as.Option.Dir, fmt.Sprintf("%d", cleanupRequest.GetFlowHashCode()))
	os.RemoveAll(dir)

	return &pb.CleanupResponse{}, nil
}
506123
func (mgr *Manager) CleanupNotRunningTunnels() error {
	tunnels, err := mgr.registry.List()
	if err != nil {
		return fmt.Errorf("error listing tunnels from registry: %s", err)
	}

	for _, tunnel := range tunnels {
		isRunning, err := checkIfRunning(tunnel.Pid)
		glog.Infof("%v is running: %t", tunnel, isRunning)
		if err != nil {
			return fmt.Errorf("error checking if tunnel is running: %s", err)
		}
		if !isRunning {
			err = mgr.router.Cleanup(tunnel.Route)
			if err != nil {
				return err
			}
			err = mgr.registry.Remove(tunnel.Route)
			if err != nil {
				return err
			}
		}
	}
	return nil
}
479208
func (c *Cleaner) cleanBr(doc *goquery.Document) *goquery.Document {
	linebreaks := doc.Find("br")
	linebreaks.Each(func(i int, br *goquery.Selection) {
		node := br.Get(0)
		node.Data = "\n\n"
		node.Type = html.TextNode
		node.Attr = []html.Attribute{}
		node.DataAtom = 0
		node.FirstChild = nil
		node.LastChild = nil
	})
	return doc
}
969866
func (p *Pruner) queueRemoval(seq int64) {
	p.toRemove = append(p.toRemove, docIDInt64(p.modelUUID, seq))
}
95267
func (c *Client) Rel(name string, m map[string]interface{}) (*url.URL, error) {
	if c.rootRels == nil || len(c.rootRels) == 0 {
		u, _ := url.Parse("/")
		root, res := c.Root(u).One()
		if res.HasError() {
			return nil, res
		}
		c.rootRels = root.Rels()
	}

	return c.rootRels.Rel(name, m)
}
936321
func (c *Client) CleanVMReservations(p *CleanVMReservationsParameter) (*Result, error) {
	obj, err := c.Request("cleanVMReservations", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
787140
func (tlf *TLF) Cleanup(ctx context.Context, fi *dokan.FileInfo) {
	var err error
	if fi != nil && fi.IsDeleteOnClose() {
		tlf.folder.handleMu.Lock()
		fav := tlf.folder.h.ToFavorite()
		tlf.folder.handleMu.Unlock()
		tlf.folder.fs.vlog.CLogf(
			ctx, libkb.VLog1, "TLF Removing favorite %q", fav.Name)
		defer func() {
			tlf.folder.reportErr(ctx, libkbfs.WriteMode, err)
		}()
		err = tlf.folder.fs.config.KBFSOps().DeleteFavorite(ctx, fav)
	}

	if tlf.refcount.Decrease() {
		dir := tlf.getStoredDir()
		if dir == nil {
			return
		}
		dir.Cleanup(ctx, fi)
	}
}
459366
func cleanPath(p string) string {
	if p == "" {
		return "/"
	}
	if p[0] != '/' {
		p = "/" + p
	}
	np := path.Clean(p)
	// path.Clean removes trailing slash except for root;
	// put the trailing slash back if necessary.
	if p[len(p)-1] == '/' && np != "/" {
		np += "/"
	}
	return np
}
120446
func (l *Logger) CleanExit(format string, v ...interface{}) {
	l.Info(format, v...)
	os.Exit(0)
}