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 .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ linters:
- revive
- sloglint
- testifylint
#- unconvert
- unconvert
- unused
#- usestdlibvars
- whitespace
Expand Down
6 changes: 3 additions & 3 deletions config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var TLSVersions = map[string]TLSVersion{

func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
err := unmarshal((*string)(&s))
err := unmarshal(&s)
if err != nil {
return err
}
Expand Down Expand Up @@ -363,7 +363,7 @@ func (c *HTTPClientConfig) Validate() error {
if (c.BasicAuth != nil || c.OAuth2 != nil) && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
return errors.New("at most one of basic_auth, oauth2, bearer_token & bearer_token_file must be configured")
}
if c.BasicAuth != nil && nonZeroCount(string(c.BasicAuth.Username) != "", c.BasicAuth.UsernameFile != "", c.BasicAuth.UsernameRef != "") > 1 {
if c.BasicAuth != nil && nonZeroCount(c.BasicAuth.Username != "", c.BasicAuth.UsernameFile != "", c.BasicAuth.UsernameRef != "") > 1 {
return errors.New("at most one of basic_auth username, username_file & username_ref must be configured")
}
if c.BasicAuth != nil && nonZeroCount(string(c.BasicAuth.Password) != "", c.BasicAuth.PasswordFile != "", c.BasicAuth.PasswordRef != "") > 1 {
Expand Down Expand Up @@ -1224,7 +1224,7 @@ func (c *TLSConfig) getClientCertificate(ctx context.Context, secretManager Secr
}
}

keySecret, err := toSecret(secretManager, Secret(c.Key), c.KeyFile, c.KeyRef)
keySecret, err := toSecret(secretManager, c.Key, c.KeyFile, c.KeyRef)
if err != nil {
return nil, fmt.Errorf("unable to use client key: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion model/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestValidationScheme_IsMetricNameValid(t *testing.T) {
if LegacyValidation.IsValidMetricName(s.mn) != s.legacyValid {
t.Errorf("Expected %v for %q using LegacyValidation.IsValidMetricName", s.legacyValid, s.mn)
}
if MetricNameRE.MatchString(string(s.mn)) != s.legacyValid {
if MetricNameRE.MatchString(s.mn) != s.legacyValid {
t.Errorf("Expected %v for %q using regexp matching", s.legacyValid, s.mn)
}
if UTF8Validation.IsValidMetricName(s.mn) != s.utf8Valid {
Expand Down
4 changes: 2 additions & 2 deletions model/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ func (t *Time) UnmarshalJSON(b []byte) error {
p := strings.Split(string(b), ".")
switch len(p) {
case 1:
v, err := strconv.ParseInt(string(p[0]), 10, 64)
v, err := strconv.ParseInt(p[0], 10, 64)
if err != nil {
return err
}
*t = Time(v * second)

case 2:
v, err := strconv.ParseInt(string(p[0]), 10, 64)
v, err := strconv.ParseInt(p[0], 10, 64)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion model/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (s Scalar) String() string {
// MarshalJSON implements json.Marshaler.
func (s Scalar) MarshalJSON() ([]byte, error) {
v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64)
return json.Marshal([...]interface{}{s.Timestamp, string(v)})
return json.Marshal([...]interface{}{s.Timestamp, v})
}

// UnmarshalJSON implements json.Unmarshaler.
Expand Down
Loading