Features in this release
Logging Enhancements:
- Introduced a new logging mechanism using the
zerolog
package. The logger can be initialized withgosteps.NewGoStepsLogger
and used within the context (go_step_logger.go
). - Added the ability to log messages within step functions using the
ctx.Log()
method (go_step_context.go
). [1] [2]
Error Handling Improvements:
- Replaced the
StepError
type with the standarderror
type for better compatibility and simplicity (README.md
,go_step_result.go
,go_step_types.go
). [1] [2] - Updated the
StepResult
struct and related methods to handle standard errors (go_step_result.go
).
Example Code Updates:
- Enhanced the example in
example/multistep-example/main.go
to demonstrate the new logging and error handling features, including retry logic and logging within steps. [1] [2] [3] [4] [5] [6] [7]
Documentation Updates:
- Updated the
README.md
to reflect the changes in error handling and to include examples of the new logging functionality. [1] [2] [3]
Miscellaneous:
- Updated the
go.mod
file to include thezerolog
package and other dependencies.
This pull request introduces significant changes to the go-steps
library, including updates to the documentation and the addition of new examples, functions, and types for better functionality and error handling. The most important changes include updates to the README.md
, new examples demonstrating the use of the library, and the introduction of new types and constants.
Documentation Updates:
README.md
: Updated the note about breaking changes ingo-steps
v1 and provided guidance on how to continue using v0. Removed the "Help" section. [1] [2]
New Examples:
example/v0/dynamic-steps-example/main.go
: Added a new example demonstrating dynamic step chaining and execution.example/v0/multistep-example/main.go
: Added a new example demonstrating multi-step execution with conditional next steps and error handling.
New Functions and Types:
v0/go_step_types.go
: Introduced new types (StepName
,StepFn
,PossibleNextSteps
,Step
,stepArgChainingType
) to define steps and their configurations.v0/go_steps_constants.go
: Added constants and variables for default and maximum step attempts, and argument chaining types.
Step Execution and Error Handling:
v0/go_steps.go
: Implemented theExecute
method for theStep
type, including logic for step execution, argument resolution, and error handling with retries.v0/go_steps_errors.go
: Added error messages for unresolved steps.
Testing:
v0/go_steps_test.go
: Added tests for step argument resolution, next step resolution, and retry logic.