Skip to content

Break#6

Merged
emicklei merged 11 commits intomainfrom
break
Oct 4, 2025
Merged

Break#6
emicklei merged 11 commits intomainfrom
break

Conversation

@emicklei
Copy link
Owner

@emicklei emicklei commented Oct 1, 2025

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 23.43750% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.40%. Comparing base (4c28558) to head (c1b36c7).

Files with missing lines Patch % Lines
service.go 17.07% 32 Missing and 2 partials ⚠️
open.go 0.00% 10 Missing ⚠️
explorer.go 63.63% 3 Missing and 1 partial ⚠️
explore_options.go 50.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #6      +/-   ##
==========================================
- Coverage   74.37%   72.40%   -1.97%     
==========================================
  Files           7        8       +1     
  Lines         804      859      +55     
==========================================
+ Hits          598      622      +24     
- Misses        175      204      +29     
- Partials       31       33       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emicklei emicklei requested a review from Copilot October 4, 2025 11:35
Copy link

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 adds a "Break" functionality to the struct explorer, which provides debugging breakpoint capabilities by starting an HTTP server that blocks execution until manually resumed through a web interface.

  • Adds Break() functions for temporary runtime inspection with automatic browser opening
  • Enhances Dump() method to accept optional filename parameter
  • Implements resume functionality through web UI button and server shutdown mechanism

Reviewed Changes

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

Show a summary per file
File Description
service.go Core implementation of Break/resume functionality and Dump enhancement
script.js JavaScript resume function for web UI interaction
open.go Cross-platform browser opening utility
index_tmpl.html Resume button UI element
index_data.go Data structure to track breaking state
index_builder.go Builder field for breaking state
explorer.go Integration of breaking state into index data
examples/break/ Example usage of Break functionality
README.md Documentation updates for new features
CHANGES.md Version changelog entry

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

s.httpServer = server
open(fmt.Sprintf("http://localhost:%d", port))
// this blocks until server is closed by resume operation.
server.ListenAndServe()
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

The return value of ListenAndServe() should be checked. If the server fails to start, the error will be ignored and the function will return silently, potentially leaving the caller in an unexpected state.

Suggested change
server.ListenAndServe()
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
slog.Error("server failed", "err", err)
}

Copilot uses AI. Check for mistakes.
Handler: serveMux,
}
s.httpServer = server
open(fmt.Sprintf("http://localhost:%d", port))
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

The error return value from open() is ignored. If opening the browser fails, the user won't be notified, which could be confusing since they might expect a browser window to appear.

Suggested change
open(fmt.Sprintf("http://localhost:%d", port))
if err := open(fmt.Sprintf("http://localhost:%d", port)); err != nil {
slog.Error("failed to open browser", "err", err)
}

Copilot uses AI. Check for mistakes.
case "linux" == runtime.GOOS:
return exec.Command("xdg-open", uri).Start()
default:
return fmt.Errorf("unable to open uri:%v on:%v", uri, runtime.GOOS)
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Missing space in error message format string.

Suggested change
return fmt.Errorf("unable to open uri:%v on:%v", uri, runtime.GOOS)
return fmt.Errorf("unable to open uri: %v on: %v", uri, runtime.GOOS)

Copilot uses AI. Check for mistakes.
function resume() {
const xhr = new XMLHttpRequest();
xhr.open("POST", window.location.href);
xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8")
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Missing semicolon at end of statement. This is inconsistent with the coding style used elsewhere in the file.

Suggested change
xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8")
xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");

Copilot uses AI. Check for mistakes.
@emicklei emicklei merged commit 5fe98a5 into main Oct 4, 2025
1 check passed
@emicklei emicklei deleted the break branch October 4, 2025 17:09
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