Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 537 for funcMap (2.02 sec)

  1. src/html/template/clone_test.go

    	if err == nil {
    		t.Error("expected 'no such template' error")
    	}
    }
    
    // https://golang.org/issue/5980
    func TestFuncMapWorksAfterClone(t *testing.T) {
    	funcs := FuncMap{"customFunc": func() (string, error) {
    		return "", errors.New("issue5980")
    	}}
    
    	// get the expected error output (no clone)
    	uncloned := Must(New("").Funcs(funcs).Parse("{{customFunc}}"))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 8K bytes
    - Viewed (0)
  2. src/cmd/trace/goroutines.go

    	case "Syscall execution time":
    		color = "#7b3294"
    	case "Execution time":
    		color = "#d7191c"
    	}
    	return color
    }
    
    var templGoroutine = template.Must(template.New("").Funcs(template.FuncMap{
    	"percent": func(dividend, divisor time.Duration) template.HTML {
    		if divisor == 0 {
    			return ""
    		}
    		return template.HTML(fmt.Sprintf("(%.1f%%)", float64(dividend)/float64(divisor)*100))
    	},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  3. src/cmd/trace/tasks.go

    			http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
    			return
    		}
    	}
    }
    
    var templUserTaskType = template.Must(template.New("userTask").Funcs(template.FuncMap{
    	"elapsed":       elapsed,
    	"asMillisecond": asMillisecond,
    	"trimSpace":     strings.TrimSpace,
    }).Parse(`
    <!DOCTYPE html>
    <title>Tasks: {{.Name}}</title>
    <style>` + traceviewer.CommonStyle + `
    body {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  4. src/html/template/exec_test.go

    	return s.String()
    }
    
    func mapOfThree() any {
    	return map[string]int{"three": 3}
    }
    
    func testExecute(execTests []execTest, template *Template, t *testing.T) {
    	b := new(strings.Builder)
    	funcs := FuncMap{
    		"add":         add,
    		"count":       count,
    		"dddArg":      dddArg,
    		"echo":        echo,
    		"makemap":     makemap,
    		"mapOfThree":  mapOfThree,
    		"oneArg":      oneArg,
    		"returnInt":   returnInt,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 57.6K bytes
    - Viewed (0)
  5. pkg/kube/inject/inject.go

    	if err := json.Unmarshal(statusBytes, &iStatus); err != nil {
    		return nil
    	}
    	return &iStatus
    }
    
    func parseDryTemplate(tmplStr string, funcMap map[string]any) (*template.Template, error) {
    	temp := template.New("inject")
    	t, err := temp.Funcs(sprig.TxtFuncMap()).Funcs(funcMap).Parse(tmplStr)
    	if err != nil {
    		log.Infof("Failed to parse template: %v %v\n", err, tmplStr)
    		return nil, err
    	}
    
    	return t, nil
    }
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 31 20:35:11 UTC 2024
    - 28.8K bytes
    - Viewed (1)
  6. src/cmd/trace/regions.go

    		if err != nil {
    			http.Error(w, fmt.Sprintf("failed to execute template: %v", err), http.StatusInternalServerError)
    			return
    		}
    	}
    }
    
    var templUserRegionType = template.Must(template.New("").Funcs(template.FuncMap{
    	"headerStyle": func(statName string) template.HTMLAttr {
    		return template.HTMLAttr(fmt.Sprintf("style=\"background-color: %s;\"", stat2Color(statName)))
    	},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 14.3K bytes
    - Viewed (0)
  7. src/html/template/escape_test.go

    		JS(`c && alert("Hello, World!");`),
    		JSStr(`Hello, World & O'Reilly\x21`),
    		URL(`greeting=H%69&addressee=(World)`),
    	}
    
    	for n0, m := range redundantFuncs {
    		f0 := funcMap[n0].(func(...any) string)
    		for n1 := range m {
    			f1 := funcMap[n1].(func(...any) string)
    			for _, input := range inputs {
    				want := f0(input)
    				if got := f1(want); want != got {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 16 03:29:27 UTC 2023
    - 56.2K bytes
    - Viewed (0)
  8. src/text/template/exec_test.go

    	return s.String()
    }
    
    func mapOfThree() any {
    	return map[string]int{"three": 3}
    }
    
    func testExecute(execTests []execTest, template *Template, t *testing.T) {
    	b := new(strings.Builder)
    	funcs := FuncMap{
    		"add":         add,
    		"count":       count,
    		"dddArg":      dddArg,
    		"die":         func() bool { panic("die") },
    		"echo":        echo,
    		"makemap":     makemap,
    		"mapOfThree":  mapOfThree,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 60.1K bytes
    - Viewed (0)
  9. api/except.txt

    pkg unicode, const Version = "6.3.0"
    pkg unicode, const Version = "7.0.0"
    pkg unicode, const Version = "8.0.0"
    pkg unicode, const Version = "9.0.0"
    pkg html/template, method (*Template) Funcs(FuncMap) *Template
    pkg html/template, type FuncMap map[string]interface{}
    pkg syscall (freebsd-386), const SYS_FSTAT = 189
    pkg syscall (freebsd-386), const SYS_FSTATAT = 493
    pkg syscall (freebsd-386), const SYS_FSTATFS = 397
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 25 00:13:30 UTC 2023
    - 34.6K bytes
    - Viewed (0)
  10. src/cmd/go/internal/list/list.go

    		}
    	} else {
    		var cachedCtxt *Context
    		context := func() *Context {
    			if cachedCtxt == nil {
    				cachedCtxt = newContext(&cfg.BuildContext)
    			}
    			return cachedCtxt
    		}
    		fm := template.FuncMap{
    			"join":    strings.Join,
    			"context": context,
    			"module":  func(path string) *modinfo.ModulePublic { return modload.ModuleInfo(ctx, path) },
    		}
    		tmpl, err := template.New("main").Funcs(fm).Parse(*listFmt)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 16 16:56:39 UTC 2024
    - 33.3K bytes
    - Viewed (0)
Back to top