Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/app/ops/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func groupApplicationCounts(counts []model.InsightApplicationCount) (total int,
for _, c := range counts {
total += int(c.Count)
kind := c.Labels[model.InsightApplicationCountLabelKey_KIND.String()]
groups[kind] = groups[kind] + int(c.Count)
groups[kind] += int(c.Count)
}
return
}
6 changes: 3 additions & 3 deletions pkg/app/server/httpapi/httpapimetrics/delegator.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type pusherDelegator struct{ *responseWriterDelegator }

func (d closeNotifierDelegator) CloseNotify() <-chan bool {
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
// remove support from client_golang yet.
return d.ResponseWriter.(http.CloseNotifier).CloseNotify()
}
func (d flusherDelegator) Flush() {
Expand Down Expand Up @@ -278,7 +278,7 @@ func init() {
http.Flusher
}{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
}
pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23
pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 23
return struct {
*responseWriterDelegator
http.Pusher
Expand Down Expand Up @@ -365,7 +365,7 @@ func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) deleg

id := 0
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
// remove support from client_golang yet.
if _, ok := w.(http.CloseNotifier); ok {
id += closeNotifier
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,5 @@ func (t Input) CustomMetricsHandlerFor(reg prometheus.Gatherer, mb MetricsBuilde
}

func extractServiceName(cmd *cobra.Command) string {
return strings.Replace(cmd.CommandPath(), " ", ".", -1)
return strings.ReplaceAll(cmd.CommandPath(), " ", ".")
}
2 changes: 1 addition & 1 deletion pkg/config/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (f *ControlPlaneFileStore) UnmarshalJSON(data []byte) error {
}
default:
// Left comment out for mock response.
//err = fmt.Errorf("unsupported filestore type: %s", f.Type)
// err = fmt.Errorf("unsupported filestore type: %s", f.Type)
err = nil
}
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/datastore/mysql/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func buildWhereClause(filters []datastore.ListFilter) (string, error) {
conds[i] = fmt.Sprintf("%s %s ?", filter.Field, op)
}
}
return fmt.Sprintf("WHERE %s", strings.Join(conds[:], " AND ")), nil
return fmt.Sprintf("WHERE %s", strings.Join(conds, " AND ")), nil
}

func buildPaginationCondition(opts datastore.ListOptions) string {
Expand Down Expand Up @@ -165,7 +165,7 @@ func buildOrderByClause(orders []datastore.Order) (string, error) {
return "", fmt.Errorf("id field is required as ordering field")
}

return fmt.Sprintf("ORDER BY %s", strings.Join(conds[:], ", ")), nil
return fmt.Sprintf("ORDER BY %s", strings.Join(conds, ", ")), nil
}

func buildLimitClause(limit int) string {
Expand Down
11 changes: 6 additions & 5 deletions pkg/filematcher/filematcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ func (p *Pattern) regexpString() string {
for scan.Peek() != scanner.EOF {
ch := scan.Next()

if ch == '*' {
switch ch {
case '*':
if scan.Peek() == '*' {
// Is some flavor of "**".
scan.Next()
Expand All @@ -207,14 +208,14 @@ func (p *Pattern) regexpString() string {
// Is "*" so map it to anything but "/".
regStr += "[^" + escSL + "]*"
}
} else if ch == '?' {
case '?':
// "?" is any char except "/".
regStr += "[^" + escSL + "]"
} else if ch == '.' || ch == '$' {
case '.', '$':
// Escape some regexp special chars that have no meaning
// in golang's filepath.Match.
regStr += `\` + string(ch)
} else if ch == '\\' {
case '\\':
// Escape next char. Note that a trailing \ in the pattern
// will be left alone (but need to escape it).
if sl == `\` {
Expand All @@ -229,7 +230,7 @@ func (p *Pattern) regexpString() string {
} else {
regStr += `\`
}
} else {
default:
regStr += string(ch)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/insight/insightmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func groupApplicationCounts(counts []model.InsightApplicationCount) map[string]i
groups := make(map[string]int, len(counts))
for _, c := range counts {
kind := c.Labels[model.InsightApplicationCountLabelKey_KIND.String()]
groups[kind] = groups[kind] + int(c.Count)
groups[kind] += int(c.Count)
}
return groups
}