strings.Replace(it.line, lineValue, "((redacted))", -1)
455 lineValue = strings.TrimSpace(lineValue)
456 // Don't consider a single char as a secret.
457 if len(lineValue) > 1 {
458 it.line = strings.Replace(it.line, lineValue, "((redacted))", -1)459 }
460 }
461}
strings.Replace(strings.ToLower(event.Name), " ", "_", -1)
63var specialChars = regexp.MustCompile("[^a-zA-Z0-9_]+")
64
65func (emitter *DogstatsdEmitter) Emit(logger lager.Logger, event metric.Event) {
66 name := specialChars.ReplaceAllString(strings.Replace(strings.ToLower(event.Name), " ", "_", -1), "")67
68 tags := []string{
69 fmt.Sprintf("event_host:%s", event.Host),
strings.Replace(event.Name, " ", "_", -1)
168func (emitter *NewRelicEmitter) transformToNewRelicEvent(event metric.Event, nameOverride string) NewRelicEvent {
169 name := nameOverride
170 if name == "" {
171 name = strings.Replace(event.Name, " ", "_", -1)172 }
173
174 eventType := emitter.prefix + name
strings.Replace(strings.ToLower(env), "_", "-", -1)
196}
197
198func flagify(env string) string {
199 return strings.Replace(strings.ToLower(env), "_", "-", -1)200}
201
202func getGdnFlagsFromConfig(configPath string) (GdnBinaryFlags, error) {
strings.Replace(k, "_", "-", -1)
32
33 for k, v := range event.Attributes {
34 // normalize on foo-bar rather than foo_bar
35 lagerKey := strings.Replace(k, "_", "-", -1)36 data[lagerKey] = v
37 }
38
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")