forked from forgejo/forgejo
Vendor Update (#16121)
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
f088dc4ea1
commit
86e2789960
819 changed files with 38072 additions and 34969 deletions
8
vendor/github.com/prometheus/common/model/labels.go
generated
vendored
8
vendor/github.com/prometheus/common/model/labels.go
generated
vendored
|
@ -45,6 +45,14 @@ const (
|
|||
// scrape a target.
|
||||
MetricsPathLabel = "__metrics_path__"
|
||||
|
||||
// ScrapeIntervalLabel is the name of the label that holds the scrape interval
|
||||
// used to scrape a target.
|
||||
ScrapeIntervalLabel = "__scrape_interval__"
|
||||
|
||||
// ScrapeTimeoutLabel is the name of the label that holds the scrape
|
||||
// timeout used to scrape a target.
|
||||
ScrapeTimeoutLabel = "__scrape_timeout__"
|
||||
|
||||
// ReservedLabelPrefix is a prefix which is not legal in user-supplied
|
||||
// label names.
|
||||
ReservedLabelPrefix = "__"
|
||||
|
|
33
vendor/github.com/prometheus/common/model/time.go
generated
vendored
33
vendor/github.com/prometheus/common/model/time.go
generated
vendored
|
@ -14,6 +14,8 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
|
@ -201,13 +203,23 @@ func ParseDuration(durationStr string) (Duration, error) {
|
|||
|
||||
// Parse the match at pos `pos` in the regex and use `mult` to turn that
|
||||
// into ms, then add that value to the total parsed duration.
|
||||
var overflowErr error
|
||||
m := func(pos int, mult time.Duration) {
|
||||
if matches[pos] == "" {
|
||||
return
|
||||
}
|
||||
n, _ := strconv.Atoi(matches[pos])
|
||||
|
||||
// Check if the provided duration overflows time.Duration (> ~ 290years).
|
||||
if n > int((1<<63-1)/mult/time.Millisecond) {
|
||||
overflowErr = errors.New("duration out of range")
|
||||
}
|
||||
d := time.Duration(n) * time.Millisecond
|
||||
dur += d * mult
|
||||
|
||||
if dur < 0 {
|
||||
overflowErr = errors.New("duration out of range")
|
||||
}
|
||||
}
|
||||
|
||||
m(2, 1000*60*60*24*365) // y
|
||||
|
@ -218,7 +230,7 @@ func ParseDuration(durationStr string) (Duration, error) {
|
|||
m(12, 1000) // s
|
||||
m(14, 1) // ms
|
||||
|
||||
return Duration(dur), nil
|
||||
return Duration(dur), overflowErr
|
||||
}
|
||||
|
||||
func (d Duration) String() string {
|
||||
|
@ -254,6 +266,25 @@ func (d Duration) String() string {
|
|||
return r
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (d Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (d *Duration) UnmarshalJSON(bytes []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(bytes, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
dur, err := ParseDuration(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = dur
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface.
|
||||
func (d *Duration) MarshalText() ([]byte, error) {
|
||||
return []byte(d.String()), nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue