mirror of https://github.com/grafana/loki
Bump go modules GitHub.com prometheus alertmanager 0.25.0 (#8100)
This PR required some code changes: https://github.com/grafana/loki/pull/8095 We have all the information, it's just plumbed in a little different now. Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>pull/8124/head
parent
431534f0a3
commit
4a3e6f9d95
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@ |
||||
#!/bin/bash |
||||
set -eu -o pipefail |
||||
|
||||
# Small convenience script for running the tests with various combinations of |
||||
# arch/tags. This assumes we're running on amd64 and have qemu available. |
||||
|
||||
go test ./... |
||||
go test -tags purego ./... |
||||
GOARCH=arm64 go test |
||||
GOARCH=arm64 go test -tags purego |
||||
@ -1,215 +1,209 @@ |
||||
//go:build !appengine && gc && !purego |
||||
// +build !appengine |
||||
// +build gc |
||||
// +build !purego |
||||
|
||||
#include "textflag.h" |
||||
|
||||
// Register allocation: |
||||
// AX h |
||||
// SI pointer to advance through b |
||||
// DX n |
||||
// BX loop end |
||||
// R8 v1, k1 |
||||
// R9 v2 |
||||
// R10 v3 |
||||
// R11 v4 |
||||
// R12 tmp |
||||
// R13 prime1v |
||||
// R14 prime2v |
||||
// DI prime4v |
||||
|
||||
// round reads from and advances the buffer pointer in SI. |
||||
// It assumes that R13 has prime1v and R14 has prime2v. |
||||
#define round(r) \ |
||||
MOVQ (SI), R12 \ |
||||
ADDQ $8, SI \ |
||||
IMULQ R14, R12 \ |
||||
ADDQ R12, r \ |
||||
ROLQ $31, r \ |
||||
IMULQ R13, r |
||||
|
||||
// mergeRound applies a merge round on the two registers acc and val. |
||||
// It assumes that R13 has prime1v, R14 has prime2v, and DI has prime4v. |
||||
#define mergeRound(acc, val) \ |
||||
IMULQ R14, val \ |
||||
ROLQ $31, val \ |
||||
IMULQ R13, val \ |
||||
XORQ val, acc \ |
||||
IMULQ R13, acc \ |
||||
ADDQ DI, acc |
||||
// Registers: |
||||
#define h AX |
||||
#define d AX |
||||
#define p SI // pointer to advance through b |
||||
#define n DX |
||||
#define end BX // loop end |
||||
#define v1 R8 |
||||
#define v2 R9 |
||||
#define v3 R10 |
||||
#define v4 R11 |
||||
#define x R12 |
||||
#define prime1 R13 |
||||
#define prime2 R14 |
||||
#define prime4 DI |
||||
|
||||
#define round(acc, x) \ |
||||
IMULQ prime2, x \ |
||||
ADDQ x, acc \ |
||||
ROLQ $31, acc \ |
||||
IMULQ prime1, acc |
||||
|
||||
// round0 performs the operation x = round(0, x). |
||||
#define round0(x) \ |
||||
IMULQ prime2, x \ |
||||
ROLQ $31, x \ |
||||
IMULQ prime1, x |
||||
|
||||
// mergeRound applies a merge round on the two registers acc and x. |
||||
// It assumes that prime1, prime2, and prime4 have been loaded. |
||||
#define mergeRound(acc, x) \ |
||||
round0(x) \ |
||||
XORQ x, acc \ |
||||
IMULQ prime1, acc \ |
||||
ADDQ prime4, acc |
||||
|
||||
// blockLoop processes as many 32-byte blocks as possible, |
||||
// updating v1, v2, v3, and v4. It assumes that there is at least one block |
||||
// to process. |
||||
#define blockLoop() \ |
||||
loop: \ |
||||
MOVQ +0(p), x \ |
||||
round(v1, x) \ |
||||
MOVQ +8(p), x \ |
||||
round(v2, x) \ |
||||
MOVQ +16(p), x \ |
||||
round(v3, x) \ |
||||
MOVQ +24(p), x \ |
||||
round(v4, x) \ |
||||
ADDQ $32, p \ |
||||
CMPQ p, end \ |
||||
JLE loop |
||||
|
||||
// func Sum64(b []byte) uint64 |
||||
TEXT ·Sum64(SB), NOSPLIT, $0-32 |
||||
TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 |
||||
// Load fixed primes. |
||||
MOVQ ·prime1v(SB), R13 |
||||
MOVQ ·prime2v(SB), R14 |
||||
MOVQ ·prime4v(SB), DI |
||||
MOVQ ·primes+0(SB), prime1 |
||||
MOVQ ·primes+8(SB), prime2 |
||||
MOVQ ·primes+24(SB), prime4 |
||||
|
||||
// Load slice. |
||||
MOVQ b_base+0(FP), SI |
||||
MOVQ b_len+8(FP), DX |
||||
LEAQ (SI)(DX*1), BX |
||||
MOVQ b_base+0(FP), p |
||||
MOVQ b_len+8(FP), n |
||||
LEAQ (p)(n*1), end |
||||
|
||||
// The first loop limit will be len(b)-32. |
||||
SUBQ $32, BX |
||||
SUBQ $32, end |
||||
|
||||
// Check whether we have at least one block. |
||||
CMPQ DX, $32 |
||||
CMPQ n, $32 |
||||
JLT noBlocks |
||||
|
||||
// Set up initial state (v1, v2, v3, v4). |
||||
MOVQ R13, R8 |
||||
ADDQ R14, R8 |
||||
MOVQ R14, R9 |
||||
XORQ R10, R10 |
||||
XORQ R11, R11 |
||||
SUBQ R13, R11 |
||||
|
||||
// Loop until SI > BX. |
||||
blockLoop: |
||||
round(R8) |
||||
round(R9) |
||||
round(R10) |
||||
round(R11) |
||||
|
||||
CMPQ SI, BX |
||||
JLE blockLoop |
||||
|
||||
MOVQ R8, AX |
||||
ROLQ $1, AX |
||||
MOVQ R9, R12 |
||||
ROLQ $7, R12 |
||||
ADDQ R12, AX |
||||
MOVQ R10, R12 |
||||
ROLQ $12, R12 |
||||
ADDQ R12, AX |
||||
MOVQ R11, R12 |
||||
ROLQ $18, R12 |
||||
ADDQ R12, AX |
||||
|
||||
mergeRound(AX, R8) |
||||
mergeRound(AX, R9) |
||||
mergeRound(AX, R10) |
||||
mergeRound(AX, R11) |
||||
MOVQ prime1, v1 |
||||
ADDQ prime2, v1 |
||||
MOVQ prime2, v2 |
||||
XORQ v3, v3 |
||||
XORQ v4, v4 |
||||
SUBQ prime1, v4 |
||||
|
||||
blockLoop() |
||||
|
||||
MOVQ v1, h |
||||
ROLQ $1, h |
||||
MOVQ v2, x |
||||
ROLQ $7, x |
||||
ADDQ x, h |
||||
MOVQ v3, x |
||||
ROLQ $12, x |
||||
ADDQ x, h |
||||
MOVQ v4, x |
||||
ROLQ $18, x |
||||
ADDQ x, h |
||||
|
||||
mergeRound(h, v1) |
||||
mergeRound(h, v2) |
||||
mergeRound(h, v3) |
||||
mergeRound(h, v4) |
||||
|
||||
JMP afterBlocks |
||||
|
||||
noBlocks: |
||||
MOVQ ·prime5v(SB), AX |
||||
MOVQ ·primes+32(SB), h |
||||
|
||||
afterBlocks: |
||||
ADDQ DX, AX |
||||
|
||||
// Right now BX has len(b)-32, and we want to loop until SI > len(b)-8. |
||||
ADDQ $24, BX |
||||
|
||||
CMPQ SI, BX |
||||
JG fourByte |
||||
|
||||
wordLoop: |
||||
// Calculate k1. |
||||
MOVQ (SI), R8 |
||||
ADDQ $8, SI |
||||
IMULQ R14, R8 |
||||
ROLQ $31, R8 |
||||
IMULQ R13, R8 |
||||
|
||||
XORQ R8, AX |
||||
ROLQ $27, AX |
||||
IMULQ R13, AX |
||||
ADDQ DI, AX |
||||
|
||||
CMPQ SI, BX |
||||
JLE wordLoop |
||||
|
||||
fourByte: |
||||
ADDQ $4, BX |
||||
CMPQ SI, BX |
||||
JG singles |
||||
|
||||
MOVL (SI), R8 |
||||
ADDQ $4, SI |
||||
IMULQ R13, R8 |
||||
XORQ R8, AX |
||||
|
||||
ROLQ $23, AX |
||||
IMULQ R14, AX |
||||
ADDQ ·prime3v(SB), AX |
||||
|
||||
singles: |
||||
ADDQ $4, BX |
||||
CMPQ SI, BX |
||||
ADDQ n, h |
||||
|
||||
ADDQ $24, end |
||||
CMPQ p, end |
||||
JG try4 |
||||
|
||||
loop8: |
||||
MOVQ (p), x |
||||
ADDQ $8, p |
||||
round0(x) |
||||
XORQ x, h |
||||
ROLQ $27, h |
||||
IMULQ prime1, h |
||||
ADDQ prime4, h |
||||
|
||||
CMPQ p, end |
||||
JLE loop8 |
||||
|
||||
try4: |
||||
ADDQ $4, end |
||||
CMPQ p, end |
||||
JG try1 |
||||
|
||||
MOVL (p), x |
||||
ADDQ $4, p |
||||
IMULQ prime1, x |
||||
XORQ x, h |
||||
|
||||
ROLQ $23, h |
||||
IMULQ prime2, h |
||||
ADDQ ·primes+16(SB), h |
||||
|
||||
try1: |
||||
ADDQ $4, end |
||||
CMPQ p, end |
||||
JGE finalize |
||||
|
||||
singlesLoop: |
||||
MOVBQZX (SI), R12 |
||||
ADDQ $1, SI |
||||
IMULQ ·prime5v(SB), R12 |
||||
XORQ R12, AX |
||||
loop1: |
||||
MOVBQZX (p), x |
||||
ADDQ $1, p |
||||
IMULQ ·primes+32(SB), x |
||||
XORQ x, h |
||||
ROLQ $11, h |
||||
IMULQ prime1, h |
||||
|
||||
ROLQ $11, AX |
||||
IMULQ R13, AX |
||||
|
||||
CMPQ SI, BX |
||||
JL singlesLoop |
||||
CMPQ p, end |
||||
JL loop1 |
||||
|
||||
finalize: |
||||
MOVQ AX, R12 |
||||
SHRQ $33, R12 |
||||
XORQ R12, AX |
||||
IMULQ R14, AX |
||||
MOVQ AX, R12 |
||||
SHRQ $29, R12 |
||||
XORQ R12, AX |
||||
IMULQ ·prime3v(SB), AX |
||||
MOVQ AX, R12 |
||||
SHRQ $32, R12 |
||||
XORQ R12, AX |
||||
|
||||
MOVQ AX, ret+24(FP) |
||||
MOVQ h, x |
||||
SHRQ $33, x |
||||
XORQ x, h |
||||
IMULQ prime2, h |
||||
MOVQ h, x |
||||
SHRQ $29, x |
||||
XORQ x, h |
||||
IMULQ ·primes+16(SB), h |
||||
MOVQ h, x |
||||
SHRQ $32, x |
||||
XORQ x, h |
||||
|
||||
MOVQ h, ret+24(FP) |
||||
RET |
||||
|
||||
// writeBlocks uses the same registers as above except that it uses AX to store |
||||
// the d pointer. |
||||
|
||||
// func writeBlocks(d *Digest, b []byte) int |
||||
TEXT ·writeBlocks(SB), NOSPLIT, $0-40 |
||||
TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 |
||||
// Load fixed primes needed for round. |
||||
MOVQ ·prime1v(SB), R13 |
||||
MOVQ ·prime2v(SB), R14 |
||||
MOVQ ·primes+0(SB), prime1 |
||||
MOVQ ·primes+8(SB), prime2 |
||||
|
||||
// Load slice. |
||||
MOVQ b_base+8(FP), SI |
||||
MOVQ b_len+16(FP), DX |
||||
LEAQ (SI)(DX*1), BX |
||||
SUBQ $32, BX |
||||
MOVQ b_base+8(FP), p |
||||
MOVQ b_len+16(FP), n |
||||
LEAQ (p)(n*1), end |
||||
SUBQ $32, end |
||||
|
||||
// Load vN from d. |
||||
MOVQ d+0(FP), AX |
||||
MOVQ 0(AX), R8 // v1 |
||||
MOVQ 8(AX), R9 // v2 |
||||
MOVQ 16(AX), R10 // v3 |
||||
MOVQ 24(AX), R11 // v4 |
||||
MOVQ s+0(FP), d |
||||
MOVQ 0(d), v1 |
||||
MOVQ 8(d), v2 |
||||
MOVQ 16(d), v3 |
||||
MOVQ 24(d), v4 |
||||
|
||||
// We don't need to check the loop condition here; this function is
|
||||
// always called with at least one block of data to process. |
||||
blockLoop: |
||||
round(R8) |
||||
round(R9) |
||||
round(R10) |
||||
round(R11) |
||||
|
||||
CMPQ SI, BX |
||||
JLE blockLoop |
||||
blockLoop() |
||||
|
||||
// Copy vN back to d. |
||||
MOVQ R8, 0(AX) |
||||
MOVQ R9, 8(AX) |
||||
MOVQ R10, 16(AX) |
||||
MOVQ R11, 24(AX) |
||||
|
||||
// The number of bytes written is SI minus the old base pointer. |
||||
SUBQ b_base+8(FP), SI |
||||
MOVQ SI, ret+32(FP) |
||||
MOVQ v1, 0(d) |
||||
MOVQ v2, 8(d) |
||||
MOVQ v3, 16(d) |
||||
MOVQ v4, 24(d) |
||||
|
||||
// The number of bytes written is p minus the old base pointer. |
||||
SUBQ b_base+8(FP), p |
||||
MOVQ p, ret+32(FP) |
||||
|
||||
RET |
||||
|
||||
@ -0,0 +1,183 @@ |
||||
//go:build !appengine && gc && !purego |
||||
// +build !appengine |
||||
// +build gc |
||||
// +build !purego |
||||
|
||||
#include "textflag.h" |
||||
|
||||
// Registers: |
||||
#define digest R1 |
||||
#define h R2 // return value |
||||
#define p R3 // input pointer |
||||
#define n R4 // input length |
||||
#define nblocks R5 // n / 32 |
||||
#define prime1 R7 |
||||
#define prime2 R8 |
||||
#define prime3 R9 |
||||
#define prime4 R10 |
||||
#define prime5 R11 |
||||
#define v1 R12 |
||||
#define v2 R13 |
||||
#define v3 R14 |
||||
#define v4 R15 |
||||
#define x1 R20 |
||||
#define x2 R21 |
||||
#define x3 R22 |
||||
#define x4 R23 |
||||
|
||||
#define round(acc, x) \ |
||||
MADD prime2, acc, x, acc \ |
||||
ROR $64-31, acc \ |
||||
MUL prime1, acc |
||||
|
||||
// round0 performs the operation x = round(0, x). |
||||
#define round0(x) \ |
||||
MUL prime2, x \ |
||||
ROR $64-31, x \ |
||||
MUL prime1, x |
||||
|
||||
#define mergeRound(acc, x) \ |
||||
round0(x) \ |
||||
EOR x, acc \ |
||||
MADD acc, prime4, prime1, acc |
||||
|
||||
// blockLoop processes as many 32-byte blocks as possible, |
||||
// updating v1, v2, v3, and v4. It assumes that n >= 32. |
||||
#define blockLoop() \ |
||||
LSR $5, n, nblocks \ |
||||
PCALIGN $16 \ |
||||
loop: \ |
||||
LDP.P 16(p), (x1, x2) \ |
||||
LDP.P 16(p), (x3, x4) \ |
||||
round(v1, x1) \ |
||||
round(v2, x2) \ |
||||
round(v3, x3) \ |
||||
round(v4, x4) \ |
||||
SUB $1, nblocks \ |
||||
CBNZ nblocks, loop |
||||
|
||||
// func Sum64(b []byte) uint64 |
||||
TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 |
||||
LDP b_base+0(FP), (p, n) |
||||
|
||||
LDP ·primes+0(SB), (prime1, prime2) |
||||
LDP ·primes+16(SB), (prime3, prime4) |
||||
MOVD ·primes+32(SB), prime5 |
||||
|
||||
CMP $32, n |
||||
CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } |
||||
BLT afterLoop |
||||
|
||||
ADD prime1, prime2, v1 |
||||
MOVD prime2, v2 |
||||
MOVD $0, v3 |
||||
NEG prime1, v4 |
||||
|
||||
blockLoop() |
||||
|
||||
ROR $64-1, v1, x1 |
||||
ROR $64-7, v2, x2 |
||||
ADD x1, x2 |
||||
ROR $64-12, v3, x3 |
||||
ROR $64-18, v4, x4 |
||||
ADD x3, x4 |
||||
ADD x2, x4, h |
||||
|
||||
mergeRound(h, v1) |
||||
mergeRound(h, v2) |
||||
mergeRound(h, v3) |
||||
mergeRound(h, v4) |
||||
|
||||
afterLoop: |
||||
ADD n, h |
||||
|
||||
TBZ $4, n, try8 |
||||
LDP.P 16(p), (x1, x2) |
||||
|
||||
round0(x1) |
||||
|
||||
// NOTE: here and below, sequencing the EOR after the ROR (using a |
||||
// rotated register) is worth a small but measurable speedup for small |
||||
// inputs. |
||||
ROR $64-27, h |
||||
EOR x1 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h |
||||
|
||||
round0(x2) |
||||
ROR $64-27, h |
||||
EOR x2 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h |
||||
|
||||
try8: |
||||
TBZ $3, n, try4 |
||||
MOVD.P 8(p), x1 |
||||
|
||||
round0(x1) |
||||
ROR $64-27, h |
||||
EOR x1 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h |
||||
|
||||
try4: |
||||
TBZ $2, n, try2 |
||||
MOVWU.P 4(p), x2 |
||||
|
||||
MUL prime1, x2 |
||||
ROR $64-23, h |
||||
EOR x2 @> 64-23, h, h
|
||||
MADD h, prime3, prime2, h |
||||
|
||||
try2: |
||||
TBZ $1, n, try1 |
||||
MOVHU.P 2(p), x3 |
||||
AND $255, x3, x1 |
||||
LSR $8, x3, x2 |
||||
|
||||
MUL prime5, x1 |
||||
ROR $64-11, h |
||||
EOR x1 @> 64-11, h, h
|
||||
MUL prime1, h |
||||
|
||||
MUL prime5, x2 |
||||
ROR $64-11, h |
||||
EOR x2 @> 64-11, h, h
|
||||
MUL prime1, h |
||||
|
||||
try1: |
||||
TBZ $0, n, finalize |
||||
MOVBU (p), x4 |
||||
|
||||
MUL prime5, x4 |
||||
ROR $64-11, h |
||||
EOR x4 @> 64-11, h, h
|
||||
MUL prime1, h |
||||
|
||||
finalize: |
||||
EOR h >> 33, h |
||||
MUL prime2, h |
||||
EOR h >> 29, h |
||||
MUL prime3, h |
||||
EOR h >> 32, h |
||||
|
||||
MOVD h, ret+24(FP) |
||||
RET |
||||
|
||||
// func writeBlocks(d *Digest, b []byte) int |
||||
TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 |
||||
LDP ·primes+0(SB), (prime1, prime2) |
||||
|
||||
// Load state. Assume v[1-4] are stored contiguously. |
||||
MOVD d+0(FP), digest |
||||
LDP 0(digest), (v1, v2) |
||||
LDP 16(digest), (v3, v4) |
||||
|
||||
LDP b_base+8(FP), (p, n) |
||||
|
||||
blockLoop() |
||||
|
||||
// Store updated state. |
||||
STP (v1, v2), 0(digest) |
||||
STP (v3, v4), 16(digest) |
||||
|
||||
BIC $31, n |
||||
MOVD n, ret+32(FP) |
||||
RET |
||||
@ -1,3 +1,5 @@ |
||||
//go:build (amd64 || arm64) && !appengine && gc && !purego
|
||||
// +build amd64 arm64
|
||||
// +build !appengine
|
||||
// +build gc
|
||||
// +build !purego
|
||||
@ -1,31 +0,0 @@ |
||||
after_success: |
||||
- bash <(curl -s https://codecov.io/bash) |
||||
go: |
||||
- 1.16.x |
||||
- 1.x |
||||
arch: |
||||
- amd64 |
||||
jobs: |
||||
include: |
||||
# only run fast tests on ppc64le |
||||
- go: 1.x |
||||
arch: ppc64le |
||||
script: |
||||
- gotestsum -f short-verbose -- ./... |
||||
|
||||
# include linting job, but only for latest go version and amd64 arch |
||||
- go: 1.x |
||||
arch: amd64 |
||||
install: |
||||
go get github.com/golangci/golangci-lint/cmd/golangci-lint |
||||
script: |
||||
- golangci-lint run --new-from-rev master |
||||
|
||||
install: |
||||
- GO111MODULE=off go get -u gotest.tools/gotestsum |
||||
language: go |
||||
notifications: |
||||
slack: |
||||
secure: QUWvCkBBK09GF7YtEvHHVt70JOkdlNBG0nIKu/5qc4/nW5HP8I2w0SEf/XR2je0eED1Qe3L/AfMCWwrEj+IUZc3l4v+ju8X8R3Lomhme0Eb0jd1MTMCuPcBT47YCj0M7RON7vXtbFfm1hFJ/jLe5+9FXz0hpXsR24PJc5ZIi/ogNwkaPqG4BmndzecpSh0vc2FJPZUD9LT0I09REY/vXR0oQAalLkW0asGD5taHZTUZq/kBpsNxaAFrLM23i4mUcf33M5fjLpvx5LRICrX/57XpBrDh2TooBU6Qj3CgoY0uPRYUmSNxbVx1czNzl2JtEpb5yjoxfVPQeg0BvQM00G8LJINISR+ohrjhkZmAqchDupAX+yFrxTtORa78CtnIL6z/aTNlgwwVD8kvL/1pFA/JWYmKDmz93mV/+6wubGzNSQCstzjkFA4/iZEKewKUoRIAi/fxyscP6L/rCpmY/4llZZvrnyTqVbt6URWpopUpH4rwYqreXAtJxJsfBJIeSmUIiDIOMGkCTvyTEW3fWGmGoqWtSHLoaWDyAIGb7azb+KvfpWtEcoPFWfSWU+LGee0A/YsUhBl7ADB9A0CJEuR8q4BPpKpfLwPKSiKSAXL7zDkyjExyhtgqbSl2jS+rKIHOZNL8JkCcTP2MKMVd563C5rC5FMKqu3S9m2b6380E= |
||||
script: |
||||
- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... |
||||
@ -0,0 +1,8 @@ |
||||
//go:build !go1.19
|
||||
// +build !go1.19
|
||||
|
||||
package spec |
||||
|
||||
import "net/url" |
||||
|
||||
var parseURL = url.Parse |
||||
@ -0,0 +1,14 @@ |
||||
//go:build go1.19
|
||||
// +build go1.19
|
||||
|
||||
package spec |
||||
|
||||
import "net/url" |
||||
|
||||
func parseURL(s string) (*url.URL, error) { |
||||
u, err := url.Parse(s) |
||||
if err == nil { |
||||
u.OmitHost = false |
||||
} |
||||
return u, err |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
linters: |
||||
enable: |
||||
- megacheck |
||||
- revive |
||||
- govet |
||||
- unconvert |
||||
- megacheck |
||||
- gas |
||||
- gocyclo |
||||
- dupl |
||||
- misspell |
||||
- unparam |
||||
- unused |
||||
- typecheck |
||||
- ineffassign |
||||
- stylecheck |
||||
- exportloopref |
||||
- gocritic |
||||
- nakedret |
||||
- gosimple |
||||
- prealloc |
||||
fast: false |
||||
disable-all: true |
||||
|
||||
issues: |
||||
exclude-rules: |
||||
- path: _test\.go |
||||
linters: |
||||
- dupl |
||||
exclude-use-default: false |
||||
@ -0,0 +1,16 @@ |
||||
package lru |
||||
|
||||
import ( |
||||
"crypto/rand" |
||||
"math" |
||||
"math/big" |
||||
"testing" |
||||
) |
||||
|
||||
func getRand(tb testing.TB) int64 { |
||||
out, err := rand.Int(rand.Reader, big.NewInt(math.MaxInt64)) |
||||
if err != nil { |
||||
tb.Fatal(err) |
||||
} |
||||
return out.Int64() |
||||
} |
||||
78
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_status.go
generated
vendored
78
vendor/github.com/prometheus/alertmanager/api/v2/models/alertmanager_status.go
generated
vendored
File diff suppressed because it is too large
Load Diff
60
vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go
generated
vendored
60
vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go
generated
vendored
@ -0,0 +1,60 @@ |
||||
// Copyright (c) 2015 Björn Rabenstein
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// The code in this package is copy/paste to avoid a dependency. Hence this file
|
||||
// carries the copyright of the original repo.
|
||||
// https://github.com/beorn7/floats
|
||||
package internal |
||||
|
||||
import ( |
||||
"math" |
||||
) |
||||
|
||||
// minNormalFloat64 is the smallest positive normal value of type float64.
|
||||
var minNormalFloat64 = math.Float64frombits(0x0010000000000000) |
||||
|
||||
// AlmostEqualFloat64 returns true if a and b are equal within a relative error
|
||||
// of epsilon. See http://floating-point-gui.de/errors/comparison/ for the
|
||||
// details of the applied method.
|
||||
func AlmostEqualFloat64(a, b, epsilon float64) bool { |
||||
if a == b { |
||||
return true |
||||
} |
||||
absA := math.Abs(a) |
||||
absB := math.Abs(b) |
||||
diff := math.Abs(a - b) |
||||
if a == 0 || b == 0 || absA+absB < minNormalFloat64 { |
||||
return diff < epsilon*minNormalFloat64 |
||||
} |
||||
return diff/math.Min(absA+absB, math.MaxFloat64) < epsilon |
||||
} |
||||
|
||||
// AlmostEqualFloat64s is the slice form of AlmostEqualFloat64.
|
||||
func AlmostEqualFloat64s(a, b []float64, epsilon float64) bool { |
||||
if len(a) != len(b) { |
||||
return false |
||||
} |
||||
for i := range a { |
||||
if !AlmostEqualFloat64(a[i], b[i], epsilon) { |
||||
return false |
||||
} |
||||
} |
||||
return true |
||||
} |
||||
4
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
generated
vendored
4
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
generated
vendored
24
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
generated
vendored
24
vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
generated
vendored
@ -0,0 +1,21 @@ |
||||
// Copyright 2022 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package version |
||||
|
||||
func getRevision() string { |
||||
return Revision |
||||
} |
||||
@ -0,0 +1,58 @@ |
||||
// Copyright 2022 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package version |
||||
|
||||
import "runtime/debug" |
||||
|
||||
var computedRevision string |
||||
|
||||
func getRevision() string { |
||||
if Revision != "" { |
||||
return Revision |
||||
} |
||||
return computedRevision |
||||
} |
||||
|
||||
func init() { |
||||
computedRevision = computeRevision() |
||||
} |
||||
|
||||
func computeRevision() string { |
||||
var ( |
||||
rev = "unknown" |
||||
modified bool |
||||
) |
||||
|
||||
buildInfo, ok := debug.ReadBuildInfo() |
||||
if !ok { |
||||
return rev |
||||
} |
||||
for _, v := range buildInfo.Settings { |
||||
if v.Key == "vcs.revision" { |
||||
rev = v.Value |
||||
} |
||||
if v.Key == "vcs.modified" { |
||||
if v.Value == "true" { |
||||
modified = true |
||||
} |
||||
} |
||||
} |
||||
if modified { |
||||
return rev + "-modified" |
||||
} |
||||
return rev |
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue