1
0
Fork 0

[golang] fix lint warnings

This commit is contained in:
Julien Dessaux 2025-03-28 22:03:37 +01:00
parent befa188552
commit e3541e4e7f
Signed by: adyxax
GPG key ID: F92E51B86E07177E
4 changed files with 7 additions and 16 deletions

View file

@ -196,7 +196,7 @@ func (c *Client) sendOne(method string, uri *url.URL, payload any) (*APIMessage,
select {
case <-c.ctx.Done():
return nil, fmt.Errorf("failed to sendOne: ctx cancelled")
case <-time.After(e.RetryAfter.Duration() * time.Second):
case <-time.After(time.Until(e.Reset)):
}
return c.sendOne(method, uri, payload)
}

View file

@ -19,7 +19,7 @@ type RateLimitError struct {
func decodeRateLimitError(msg json.RawMessage) RateLimitError {
var e RateLimitError
if err := json.Unmarshal(msg, &e); err != nil {
panic(fmt.Errorf("Failed to decode iapi error code 429 RateLimitError: %v, %w", msg, err))
panic(fmt.Errorf("failed to decode iapi error code 429 RateLimitError: %v, %w", msg, err))
}
return e
}
@ -36,7 +36,7 @@ type ShipInTransitError struct {
func decodeShipInTransitError(msg json.RawMessage) ShipInTransitError {
var e ShipInTransitError
if err := json.Unmarshal(msg, &e); err != nil {
panic(fmt.Errorf("Failed to decode api error code 4214 ShipInTransitError: %v, %w", msg, err))
panic(fmt.Errorf("failed to decode api error code 4214 ShipInTransitError: %v, %w", msg, err))
}
return e
}

View file

@ -59,7 +59,7 @@ func (c *Client) Navigate(s *model.Ship, waypointSymbol string) error {
select {
case <-c.ctx.Done():
return fmt.Errorf("failed: context cancelled")
case <-time.After(s.Nav.Route.Arrival.Sub(time.Now())):
case <-time.After(time.Until(s.Nav.Route.Arrival)):
}
s.Nav.Status = "IN_ORBIT"
return nil