Skip to content

Fix lint error - #7

Merged
QUBITABHAY merged 7 commits into
mainfrom
fix/lint-err
Mar 26, 2026
Merged

Fix lint error#7
QUBITABHAY merged 7 commits into
mainfrom
fix/lint-err

Conversation

@QUBITABHAY

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and refactorings across the authentication, configuration, database, migration, and CI/CD workflow areas of the codebase. The main highlights are a significant refactor of the Google OAuth login flow for clarity and maintainability, improved error handling and logging, modularization of Echo middleware and route setup, and enhanced migration tooling. Additionally, the CI workflow now includes a linting step before build. Below are the most important changes grouped by theme:

Authentication and OAuth Refactor:

  • Refactored the Google OAuth login and callback flow in internal/auth/google_login.go to extract logic into helper methods (getUserOrCreateFromOAuth, updateUserOAuthTokens, linkExistingUserToOAuth, createNewOAuthUser), improving readability and maintainability. Also introduced a googleProvider constant and updated token/cookie handling.
  • Standardized session and token expiry durations with named constants in internal/auth/providers.go and internal/auth/service.go.

API Server Structure and Error Handling:

  • Modularized Echo server setup in cmd/api/main.go by moving middleware and route setup to setupMiddleware and setupRoutes functions. Improved error handling by logging errors and returning early instead of panicking or calling log.Fatal.

Migration Tooling:

  • Refactored cmd/migrate/main.go to use structured logging (zap), modularized migration command execution into separate functions (runUp, runDown, etc.), and improved resource cleanup with deferred closures and error handling.

Codebase Documentation and Linting:

  • Added package-level documentation comments to internal/auth/google_login.go, internal/config/config.go, and internal/database/connection.go for improved code clarity and maintainability.
  • Introduced a lint job to the GitHub Actions workflow (.github/workflows/go.yml) to ensure code quality before building.

Minor Cleanups:

  • Minor import ordering and code style improvements throughout several files to align with Go conventions.

…ved maintainability; update context usage in response service
…d improve type consistency; enhance error handling in database initialization
…res to use pointers for improved consistency; streamline migration command flags and response handling
@QUBITABHAY
QUBITABHAY merged commit 5abf7f1 into main Mar 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant