diff --git a/git/common.go b/git/common.go index eeb63abc5..a288ba76e 100644 --- a/git/common.go +++ b/git/common.go @@ -42,8 +42,5 @@ func (p *WriteParams) Validate() error { return errors.InvalidArgument("RepoUID is mandatory field") } - if err := p.Actor.Validate(); err != nil { - return err - } - return nil + return p.Actor.Validate() } diff --git a/git/diff.go b/git/diff.go index 8af618575..8ea391dfd 100644 --- a/git/diff.go +++ b/git/diff.go @@ -49,11 +49,7 @@ func (p DiffParams) Validate() error { } func (s *Service) RawDiff(ctx context.Context, params *DiffParams, out io.Writer) error { - if err := s.rawDiff(ctx, params, out); err != nil { - return err - } - - return nil + return s.rawDiff(ctx, params, out) } func (s *Service) rawDiff(ctx context.Context, params *DiffParams, w io.Writer) error { diff --git a/git/env.go b/git/env.go index 3af0eed25..cff198f3d 100644 --- a/git/env.go +++ b/git/env.go @@ -21,7 +21,7 @@ import ( const ( EnvActorName = "GITNESS_HOOK_ACTOR_NAME" - EnvActorEmail = "GITNESS_HOOK_ACTOR_EMAIL" + EnvActorEmail = "GITNESS_HOOK_ACTOR_EMAIL" //#nosec EnvRepoUID = "GITNESS_HOOK_REPO_UID" EnvRequestID = "GITNESS_HOOK_REQUEST_ID" ) diff --git a/git/operations.go b/git/operations.go index 0bd1e24fa..1b97f0d94 100644 --- a/git/operations.go +++ b/git/operations.go @@ -83,11 +83,7 @@ type CommitFilesParams struct { } func (p *CommitFilesParams) Validate() error { - if err := p.WriteParams.Validate(); err != nil { - return err - } - - return nil + return p.WriteParams.Validate() } type CommitFilesResponse struct { diff --git a/git/repo.go b/git/repo.go index b52234688..d02f2e17d 100644 --- a/git/repo.go +++ b/git/repo.go @@ -83,10 +83,7 @@ type CreateRepositoryParams struct { } func (p *CreateRepositoryParams) Validate() error { - if err := p.Actor.Validate(); err != nil { - return err - } - return nil + return p.Actor.Validate() } type CreateRepositoryOutput struct { @@ -118,10 +115,7 @@ type HashRepositoryParams struct { } func (p *HashRepositoryParams) Validate() error { - if err := p.ReadParams.Validate(); err != nil { - return err - } - return nil + return p.ReadParams.Validate() } type HashRepositoryOutput struct { @@ -204,11 +198,7 @@ func (s *Service) DeleteRepository(ctx context.Context, params *DeleteRepository return fmt.Errorf("failed to check the status of the repository %v: %w", repoPath, err) } - if err := s.DeleteRepositoryBestEffort(ctx, params.RepoUID); err != nil { - return err - } - - return nil + return s.DeleteRepositoryBestEffort(ctx, params.RepoUID) } func (s *Service) DeleteRepositoryBestEffort(ctx context.Context, repoUID string) error {