Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to use google/wire instead of fx #133

Merged
merged 7 commits into from
Nov 16, 2024

Commits on Nov 14, 2024

  1. Refactor the cmd for custom

    - refactored the custom cmd
    
    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    b4400e5 View commit details
    Browse the repository at this point in the history
  2. Removed the storage from cmd that is not server

    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    8f47231 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2024

  1. Refactor codebase to remove go.uber.org/fx dependency and update st…

    …orage initialization**
    
    - Remove dependency on `go.uber.org/fx` and associated dependency injection setup.
    - Simplify `main.go` by removing `fx.App` and directly executing the root command.
    - Modify `cmd/root/root.go`:
      - Rename `options` struct to `Options` to make it exportable.
      - Update `AddFlags` method to use exported fields.
      - Add `PersistentPreRun` function to start the pprof server if enabled.
      - Change `New` function signature to return `(*cobra.Command, error)` instead of just `*cobra.Command`.
    - Modify `cmd/server/server.go`:
      - Add `StorageType` and `StorageAddr` fields to options.
      - Implement `ProvideStorage` method to initialize storage based on `StorageType`.
      - Update `Run` method to initialize storage via `ProvideStorage`.
      - Remove `storage` parameter from the `New` function.
      - Adjust `New` function accordingly.
    - Update `go.mod` and `go.sum` to remove `fx` and related dependencies.
    - Delete unused `storages` module and its tests.
    - Move storage initialization logic into `cmd/server/server.go`.
    
    This refactoring removes the usage of the `go.uber.org/fx` dependency injection framework, simplifying the application startup process. Storage initialization is now handled within the server command and can be configured via command-line flags. This change streamlines the application and reduces unnecessary complexity.
    
    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    21f6622 View commit details
    Browse the repository at this point in the history
  2. Some code clean up

    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    2a6ab15 View commit details
    Browse the repository at this point in the history
  3. Fixed the codereview issues

    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    c4c1928 View commit details
    Browse the repository at this point in the history
  4. Cleaned up

    Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
    naveensrinivasan committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    7fa336d View commit details
    Browse the repository at this point in the history
  5. Update Makefile

    Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
    naveensrinivasan and coderabbitai[bot] authored Nov 15, 2024
    Configuration menu
    Copy the full SHA
    d547783 View commit details
    Browse the repository at this point in the history