Skip to content

Code reorg#6

Merged
rm-hull merged 3 commits into
mainfrom
refactor/add-cmd
Jun 25, 2025
Merged

Code reorg#6
rm-hull merged 3 commits into
mainfrom
refactor/add-cmd

Conversation

@rm-hull

@rm-hull rm-hull commented Jun 25, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary of Changes

Hello @rm-hull, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly reorganizes the codebase to improve modularity and maintainability. It transforms the application into a multi-command CLI tool, separating the HTTP API server and data extraction processes into distinct, manageable units. Furthermore, common file handling operations for GeoJSON data have been extracted into a reusable internal package, streamlining data processing workflows.

Highlights

  • Application Structure Refactoring: The application's main entry point (main.go) has been refactored to use Cobra commands, enabling distinct api-server and extract-data functionalities, moving away from a single default execution path.
  • Code Modularization: Core logic for the HTTP API server and data extraction has been moved into dedicated files (cmd/api_server.go and cmd/extract_data.go respectively) within a new cmd package, significantly improving separation of concerns and code organization.
  • Reusable File Operations: A new internal/file_operations.go package has been introduced to centralize common file compression and decompression logic for GeoJSON feature collections, reducing code duplication and promoting reusability across the codebase.
  • Developer Experience Improvements: VS Code launch configurations (.vscode/launch.json) and the README.md have been updated to reflect the new command-line interface, simplifying local development setup and usage instructions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Jun 25, 2025

Copy link
Copy Markdown
TestsPassed ❌️SkippedFailed
JUnit Test Report0 ran0 passed0 skipped0 failed
TestResult
No test annotations available

@coveralls

coveralls commented Jun 25, 2025

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 15889588508

Details

  • 0 of 127 (0.0%) changed or added relevant lines in 5 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
routes/search.go 0 2 0.0%
cmd/extract_data.go 0 13 0.0%
main.go 0 25 0.0%
cmd/api_server.go 0 43 0.0%
internal/file_operations.go 0 44 0.0%
Files with Coverage Reduction New Missed Lines %
main.go 3 0.0%
Totals Coverage Status
Change from base Build 15887673281: 0.0%
Covered Lines: 0
Relevant Lines: 428

💛 - Coveralls

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the application to support multiple commands (api-server and extract-data) using the cobra library, which is a great improvement for maintainability. The code is now better organized into cmd and internal packages. The changes are generally good, but I've identified a couple of high-severity issues related to a potential race condition and incorrect server shutdown handling, plus a minor documentation typo. Please review my comments for details and suggestions.

Comment thread cmd/api_server.go
addr := fmt.Sprintf(":%d", port)
log.Printf("Starting HTTP API Server on port %d...", port)
err = r.Run(addr)
log.Fatalf("HTTP API Server failed to start on port %d: %v", port, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This log.Fatalf call is problematic. r.Run() can return http.ErrServerClosed on a graceful shutdown, which should not be treated as a fatal error. Additionally, for other startup errors, Gin's Run method already calls log.Fatalf, making this line unreachable in those cases. This line should only be executed for unexpected errors.

if err != nil && err.Error() != "http: Server closed" {
		log.Fatalf("HTTP API Server failed to start on port %d: %v", port, err)
	}

Comment thread internal/file_operations.go Outdated
Comment thread main.go Outdated
@rm-hull
rm-hull merged commit a81cb17 into main Jun 25, 2025
3 checks passed
@rm-hull
rm-hull deleted the refactor/add-cmd branch June 25, 2025 23:54
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.

2 participants