Enable golangci linter stylecheck (#3167)

This PR only fixes error string formatting, log message strings are
still mixed upper/lowercase (see
https://github.com/woodpecker-ci/woodpecker/pull/3161#issuecomment-1885140649)
and I'm not aware of a linter to enforce it.
This commit is contained in:
Robert Kaussow
2024-01-10 22:56:42 +01:00
committed by GitHub
parent 00df53e941
commit 7756c60a33
58 changed files with 126 additions and 129 deletions

View File

@@ -41,7 +41,7 @@ func NewWoodpeckerAuthServer(jwtManager *JWTManager, agentMasterToken string, st
func (s *WoodpeckerAuthServer) Auth(_ context.Context, req *proto.AuthRequest) (*proto.AuthResponse, error) {
agent, err := s.getAgent(req.AgentId, req.AgentToken)
if err != nil {
return nil, fmt.Errorf("Agent could not auth: %w", err)
return nil, fmt.Errorf("agent could not auth: %w", err)
}
accessToken, err := s.jwtManager.Generate(agent.ID)

View File

@@ -139,7 +139,7 @@ func (s *RPC) Update(_ context.Context, id string, state rpc.State) error {
}
if currentPipeline.Workflows, err = s.store.WorkflowGetTree(currentPipeline); err != nil {
log.Error().Err(err).Msg("can not build tree from step list")
log.Error().Err(err).Msg("cannot build tree from step list")
return err
}
message := pubsub.Message{
@@ -269,7 +269,7 @@ func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
var queueErr error
if workflow.Failing() {
queueErr = s.queue.Error(c, id, fmt.Errorf("Step finished with exit code %d, %s", state.ExitCode, state.Error))
queueErr = s.queue.Error(c, id, fmt.Errorf("step finished with exit code %d, %s", state.ExitCode, state.Error))
} else {
queueErr = s.queue.Done(c, id, workflow.State)
}
@@ -388,6 +388,7 @@ func (s *RPC) ReportHealth(ctx context.Context, status string) error {
}
if status != "I am alive!" {
//nolint:stylecheck
return errors.New("Are you alive?")
}
@@ -409,7 +410,7 @@ func (s *RPC) completeChildrenIfParentCompleted(completedWorkflow *model.Workflo
func (s *RPC) updateForgeStatus(ctx context.Context, repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) {
user, err := s.store.GetUser(repo.UserID)
if err != nil {
log.Error().Err(err).Msgf("can not get user with id '%d'", repo.UserID)
log.Error().Err(err).Msgf("cannot get user with id '%d'", repo.UserID)
return
}