all: make fmt via the upcoming Go1.19

This commit is contained in:
Aliaksandr Valialkin 2022-07-11 19:21:59 +03:00
parent 8851cf68e1
commit 5c8eee26bf
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
12 changed files with 43 additions and 40 deletions

View file

@ -63,8 +63,9 @@ type Config struct {
}
// StaticConfig contains list of static targets in the following form:
// targets:
// [ - '<host>' ]
//
// targets:
// [ - '<host>' ]
type StaticConfig struct {
Targets []string `yaml:"targets"`
}

View file

@ -74,9 +74,10 @@ var (
// Init returns a function for retrieving actual list of Notifier objects.
// Init works in two mods:
// * configuration via flags (for backward compatibility). Is always static
// - configuration via flags (for backward compatibility). Is always static
// and don't support live reloads.
// * configuration via file. Supports live reloads and service discovery.
// - configuration via file. Supports live reloads and service discovery.
//
// Init returns an error if both mods are used.
func Init(gen AlertURLGenerator, extLabels map[string]string, extURL string) (func() []Notifier, error) {
if externalLabels != nil || externalURL != "" {

View file

@ -54,7 +54,7 @@ func (cw *cWriter) printf(format string, args ...interface{}) {
cw.err = err
}
//"{"metric":{"__name__":"cpu_usage_guest","arch":"x64","hostname":"host_19",},"timestamps":[1567296000000,1567296010000],"values":[1567296000000,66]}
// "{"metric":{"__name__":"cpu_usage_guest","arch":"x64","hostname":"host_19",},"timestamps":[1567296000000,1567296010000],"values":[1567296000000,66]}
func (ts *TimeSeries) write(w io.Writer) (int, error) {
timestamps := ts.Timestamps
values := ts.Values

View file

@ -1036,7 +1036,6 @@ func (cp *commonParams) IsDefaultTimeRange() bool {
// - match[]
// - extra_label
// - extra_filters[]
//
func getExportParams(r *http.Request, startTime time.Time) (*commonParams, error) {
cp, err := getCommonParams(r, startTime, true)
if err != nil {
@ -1054,7 +1053,6 @@ func getExportParams(r *http.Request, startTime time.Time) (*commonParams, error
// - match[]
// - extra_label
// - extra_filters[]
//
func getCommonParams(r *http.Request, startTime time.Time, requireNonEmptyMatch bool) (*commonParams, error) {
deadline := searchutils.GetDeadlineForQuery(r, startTime)
start, err := searchutils.GetTime(r, "start", 0)

View file

@ -219,10 +219,13 @@ func (d *Deadline) String() string {
//
// Label filters can be present in extra_label and extra_filters[] query args.
// They are combined. For example, the following query args:
// extra_label=t1=v1&extra_label=t2=v2&extra_filters[]={env="prod",team="devops"}&extra_filters={env=~"dev|staging",team!="devops"}
//
// extra_label=t1=v1&extra_label=t2=v2&extra_filters[]={env="prod",team="devops"}&extra_filters={env=~"dev|staging",team!="devops"}
//
// should be translated to the following filters joined with "or":
// {env="prod",team="devops",t1="v1",t2="v2"}
// {env=~"dev|staging",team!="devops",t1="v1",t2="v2"}
//
// {env="prod",team="devops",t1="v1",t2="v2"}
// {env=~"dev|staging",team!="devops",t1="v1",t2="v2"}
func GetExtraTagFilters(r *http.Request) ([][]storage.TagFilter, error) {
var tagFilters []storage.TagFilter
for _, match := range r.Form["extra_label"] {

View file

@ -8,8 +8,9 @@ import (
)
// specific files
//go:embed favicon-32x32.png robots.txt index.html manifest.json asset-manifest.json
// static content
//
//go:embed favicon-32x32.png robots.txt index.html manifest.json asset-manifest.json
//go:embed static
var files embed.FS

View file

@ -51,13 +51,12 @@ func NewArrayInt(name string, description string) *ArrayInt {
//
// The following example sets equivalent flag array with two items (value1, value2):
//
// -foo=value1 -foo=value2
// -foo=value1,value2
// -foo=value1 -foo=value2
// -foo=value1,value2
//
// Flag values may be quoted. For instance, the following arg creates an array of ("a", "b, c") items:
//
// -foo='a,"b, c"'
//
// -foo='a,"b, c"'
type Array []string
// String implements flag.Value interface

View file

@ -9,11 +9,11 @@ import (
// pools contains pools for byte slices of various capacities.
//
// pools[0] is for capacities from 0 to 8
// pools[1] is for capacities from 9 to 16
// pools[2] is for capacities from 17 to 32
// ...
// pools[n] is for capacities from 2^(n+2)+1 to 2^(n+3)
// pools[0] is for capacities from 0 to 8
// pools[1] is for capacities from 9 to 16
// pools[2] is for capacities from 17 to 32
// ...
// pools[n] is for capacities from 2^(n+2)+1 to 2^(n+3)
//
// Limit the maximum capacity to 2^18, since there are no performance benefits
// in caching byte slices with bigger capacities.

View file

@ -1,3 +1,2 @@
// Package metricsql has been moved to https://github.com/VictoriaMetrics/metricsql .
//
package metricsql

View file

@ -34,19 +34,19 @@ const maxColumnsPerRow = 64 * 1024
//
// s must have comma-separated list of the following entries:
//
// <column_pos>:<column_type>:<extension>
// <column_pos>:<column_type>:<extension>
//
// Where:
//
// - <column_pos> is numeric csv column position. The first column has position 1.
// - <column_type> is one of the following types:
// - time - the corresponding column contains timestamp. Timestamp format is determined by <extension>. The following formats are supported:
// - unix_s - unix timestamp in seconds
// - unix_ms - unix timestamp in milliseconds
// - unix_ns - unix_timestamp in nanoseconds
// - rfc3339 - RFC3339 format in the form `2006-01-02T15:04:05Z07:00`
// - label - the corresponding column contains metric label with the name set in <extension>.
// - metric - the corresponding column contains metric value with the name set in <extension>.
// - time - the corresponding column contains timestamp. Timestamp format is determined by <extension>. The following formats are supported:
// - - unix_s - unix timestamp in seconds
// - - unix_ms - unix timestamp in milliseconds
// - - unix_ns - unix_timestamp in nanoseconds
// - - rfc3339 - RFC3339 format in the form `2006-01-02T15:04:05Z07:00`
// - label - the corresponding column contains metric label with the name set in <extension>.
// - metric - the corresponding column contains metric value with the name set in <extension>.
//
// s must contain at least a single 'metric' column and no more than a single `time` column.
func ParseColumnDescriptors(s string) ([]ColumnDescriptor, error) {

View file

@ -58,7 +58,7 @@ func (pts *partitionSearch) reset() {
// tsids must be sorted.
// tsids cannot be modified after the Init call, since it is owned by pts.
//
/// MustClose must be called when partition search is done.
// MustClose must be called when partition search is done.
func (pts *partitionSearch) Init(pt *partition, tsids []TSID, tr TimeRange) {
if pts.needClosing {
logger.Panicf("BUG: missing partitionSearch.MustClose call before the next call to Init")

View file

@ -567,16 +567,17 @@ func newMatchFuncForOrSuffixes(orValues []string) (reMatch func(b []byte) bool,
}
// getOptimizedReMatchFunc tries returning optimized function for matching the given expr.
// '.*'
// '.+'
// 'literal.*'
// 'literal.+'
// '.*literal'
// '.+literal
// '.*literal.*'
// '.*literal.+'
// '.+literal.*'
// '.+literal.+'
//
// '.*'
// '.+'
// 'literal.*'
// 'literal.+'
// '.*literal'
// '.+literal
// '.*literal.*'
// '.*literal.+'
// '.+literal.*'
// '.+literal.+'
//
// It returns reMatch if it cannot find optimized function.
//