Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-laterman committed Jun 20, 2024
1 parent 2c6b178 commit 82c16d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions x-pack/elastic-agent/pkg/agent/cmd/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package cmd
import (
"bytes"
"context"
stderror "errors"
goerrors "errors"
"fmt"
"io"
"math/rand"
Expand Down Expand Up @@ -602,7 +602,9 @@ func (c *enrollCmd) startAgent(ctx context.Context) (<-chan *os.ProcessState, er

func (c *enrollCmd) stopAgent() {
if c.agentProc != nil {
c.agentProc.StopWait() //nolint:errcheck // no error check here
if err := c.agentProc.StopWait(); err != nil {
c.log.Warnf("Error stopping agent: %v", err)
}
c.agentProc = nil
}
}
Expand Down Expand Up @@ -664,7 +666,7 @@ func waitForAgent(ctx context.Context, timeout time.Duration) error {
for {
backOff.Wait()
_, err := getDaemonStatus(innerCtx)
if stderror.Is(err, context.Canceled) {
if goerrors.Is(err, context.Canceled) {
resChan <- waitResult{err: err}
return
}
Expand Down Expand Up @@ -714,7 +716,7 @@ func waitForFleetServer(ctx context.Context, agentSubproc <-chan *os.ProcessStat
for {
backExp.Wait()
status, err := getDaemonStatus(innerCtx)
if stderror.Is(err, context.Canceled) {
if goerrors.Is(err, context.Canceled) {
resChan <- waitResult{err: err}
return
}
Expand Down Expand Up @@ -827,7 +829,7 @@ func safelyStoreAgentInfo(s saver, reader io.Reader) error {
for i := 0; i <= maxRetriesstoreAgentInfo; i++ {
backExp.Wait()
err = storeAgentInfo(s, reader)
if !stderror.Is(err, filelock.ErrAppAlreadyRunning) {
if !goerrors.Is(err, filelock.ErrAppAlreadyRunning) {
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/agent/control/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (s *Server) ProcMeta(ctx context.Context, _ *cproto.Empty) (*cproto.ProcMet
endpoint = "npipe"
}

req, err := http.NewRequestWithContext(ctx, "GET", "http://"+endpoint+"/", nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGET, "http://"+endpoint+"/", nil)
if err != nil {
procMeta.Error = err.Error()
resp.Procs = append(resp.Procs, procMeta)
Expand Down
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/core/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (s *Server) Start() error {
if ok := certPool.AppendCertsFromPEM(s.ca.Crt()); !ok {
return errors.New("failed to append root CA", errors.TypeSecurity)
}
//nolint:gosec // G402: TLS MinVersion too low.
//nolint:gosec // FIXME: https://github.com/elastic/ingest-dev/issues/3474
creds := credentials.NewTLS(&tls.Config{
ClientAuth: tls.RequireAndVerifyClientCert,
ClientCAs: certPool,
Expand Down

0 comments on commit 82c16d7

Please sign in to comment.