Skip to content

Commit

Permalink
correctly check if metadata file does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Bond <danbond@protonmail.com>
  • Loading branch information
loshz committed May 10, 2023
1 parent 4d52023 commit 03adbe2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -4588,7 +4589,7 @@ func (a *Agent) checkServerLastSeen() error {
md, err := consul.ReadServerMetadata(filename)
if err != nil {
// Return early if it doesn't as this indicates the server is starting for the first time.
if err == os.ErrNotExist {
if errors.Is(err, os.ErrNotExist) {
return nil
}
return fmt.Errorf("error reading server metadata: %w", err)
Expand Down

0 comments on commit 03adbe2

Please sign in to comment.