strings.Replace(s, fmt.Sprintf("$%s", k), v, -1)
771func replaceEnv(s string, env map[string]string) string {
772 for k, v := range env {
773 s = strings.Replace(s, fmt.Sprintf("${%s}", k), v, -1)
774 s = strings.Replace(s, fmt.Sprintf("$%s", k), v, -1)775 }
776
777 return s
strings.Replace(s, fmt.Sprintf("${%s}", k), v, -1)
770
771func replaceEnv(s string, env map[string]string) string {
772 for k, v := range env {
773 s = strings.Replace(s, fmt.Sprintf("${%s}", k), v, -1)774 s = strings.Replace(s, fmt.Sprintf("$%s", k), v, -1)
775 }
776
strings.Replace(strings.ToUpper(r.Name), "-", "_", -1)
29type Resources []Resource
30
31func (r Resource) DefaultEnv() string {
32 return fmt.Sprintf("%s_URL", strings.Replace(strings.ToUpper(r.Name), "-", "_", -1))33}
34
35func (r Resource) LoadEnv() []string {
bytes.Replace(data, []byte("\n\n\tr.Route"), []byte("\n\tr.Route"), -1)
16
17 data = bytes.Replace(data, []byte("{\n\n"), []byte("{\n"), -1)
18 data = bytes.Replace(data, []byte("\n\n}"), []byte("\n}"), -1)
19 data = bytes.Replace(data, []byte("\n\n\tr.Route"), []byte("\n\tr.Route"), -1)20
21 return data, nil
22}
bytes.Replace(data, []byte("\n\n}"), []byte("\n}"), -1)
15 }
16
17 data = bytes.Replace(data, []byte("{\n\n"), []byte("{\n"), -1)
18 data = bytes.Replace(data, []byte("\n\n}"), []byte("\n}"), -1)19 data = bytes.Replace(data, []byte("\n\n\tr.Route"), []byte("\n\tr.Route"), -1)
20
21 return data, nil
Certain functions, for a particular set of arguments, have shorthands (helpers) that can be used instead.
We currently support Autofix for, Format: x => y where "x" is recommended to be replaced with "y" helper function.
Supported Autofix for the following: strings.SplitN(s, ".", -1) => strings.Split(s, ".") strings.Map(unicode.ToTitle, s) => strings.ToTitle(s) strings.Replace(s, "a", "b", -1) => strings.ReplaceAll(s, "a", "b") bytes.SplitN(b, []byte("."), -1) => bytes.Split(b, []byte(".")) bytes.Map(unicode.ToUpper, b) => bytes.ToUpper(b) bytes.Map(unicode.ToLower, b) => bytes.ToLower(b) bytes.Map(unicode.ToTitle, b) => bytes.ToTitle(b) bytes.Replace(b, b, b, -1) => bytes.ReplaceAll(b, b, b) http.HandlerFunc(http.NotFound) => http.NotFoundHandler() draw.DrawMask(i, r, i, p, nil, image.Point{}, o) => draw.Draw(i, r, i, p, o)
wg.Add(1)
// some code
wg.Add(-1)
wg.Add(1)
// some code
wg.Done()
strings.SplitN(str, splitChar, -1)
strings.Split(str, splitChar)
http.HandlerFunc("/non-existent", http404)
http.NotFoundHandler("/non-existent")