Skip to content

Embed FuncService for Lifecycle#2

Merged
molon merged 2 commits intomainfrom
lifecycle
Aug 1, 2025
Merged

Embed FuncService for Lifecycle#2
molon merged 2 commits intomainfrom
lifecycle

Conversation

@molon
Copy link
Copy Markdown
Contributor

@molon molon commented Aug 1, 2025

Type of change

Description

Related issues

Notes for reviewer

@molon molon requested a review from Copilot August 1, 2025 04:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the lifecycle package to embed FuncService within both Lifecycle and SignalService types, creating a more consistent service architecture. The changes also standardize error handling by wrapping context errors with stack traces throughout the codebase.

  • Embed FuncService in Lifecycle and SignalService structs to provide consistent service behavior
  • Add interface compliance assertions and method overrides for embedded service functionality
  • Standardize error handling by wrapping context errors with stack traces using errors.WithStack

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lifecycle/lifecycle.go Embeds FuncService in Lifecycle struct and adds service interface methods
lifecycle/signal.go Adds service interface methods to SignalService and wraps context errors
lifecycle/func.go Adds interface compliance assertions and wraps context errors with stack traces
lifecycle/func_test.go Updates test code to wrap context errors with stack traces
lifecycle/lifecycle_test.go Changes error equality checks to use ErrorIs for wrapped errors
.github/workflows/go.yml Adds GitHub Actions workflow for CI/CD pipeline


// WithStop is not supported for SignalService.
func (s *SignalService) WithStop(stop func(ctx context.Context) error) *SignalService {
panic("this method is not supported for SignalService")
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panic message should be more descriptive and follow Go conventions. Consider: "SignalService does not support WithStop method" or "WithStop is not supported on SignalService".

Suggested change
panic("this method is not supported for SignalService")
panic("SignalService does not support WithStop method")

Copilot uses AI. Check for mistakes.
func (lc *Lifecycle) WithStopTimeout(timeout time.Duration) *Lifecycle {
// WithStop is not supported for Lifecycle.
func (lc *Lifecycle) WithStop(stop func(ctx context.Context) error) *Lifecycle {
panic("this method is not supported for Lifecycle")
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panic message should be more descriptive and follow Go conventions. Consider: "Lifecycle does not support WithStop method" or "WithStop is not supported on Lifecycle".

Suggested change
panic("this method is not supported for Lifecycle")
panic("WithStop is not supported on Lifecycle")

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@molon molon merged commit 699b151 into main Aug 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants