Skip to content

Refactor almost using gonp repository and transfer ownership#3

Merged
kazeburo merged 7 commits into
masterfrom
feat/rewrite-almost
Jul 18, 2026
Merged

Refactor almost using gonp repository and transfer ownership#3
kazeburo merged 7 commits into
masterfrom
feat/rewrite-almost

Conversation

@kazeburo

@kazeburo kazeburo commented Jul 17, 2026

Copy link
Copy Markdown
Member

This pull request introduces several significant improvements and updates to the project, focusing on modernization, security, and maintainability. The main highlights include a major refactor of main.go for better code clarity and testability, the addition of comprehensive unit tests, dependency updates, and enhanced CI/CD automation. The project is also migrated to a new GitHub organization and now supports more secure file handling across platforms.

Refactor and Feature Enhancements:

  • Major refactor of main.go:

    • Simplifies and clarifies command execution and diff logic.
    • Switches from md5 to sha256 for hashing identifiers.
    • Replaces shelling out to diff with a pure Go implementation using gonp for unified diffs.
    • Adds support for custom working directories and improved version output including commit hash.
    • Improves error handling and output formatting for differences and no-difference cases. [1] [2] [3]
  • Adds platform-specific secure file opening:

    • Introduces open_unix.go (uses O_NOFOLLOW to prevent symlink attacks).
    • Introduces open_windows.go for compatibility. [1] [2]

Testing Improvements:

  • Adds a comprehensive test suite in main_test.go to cover command execution, diffing, and edge cases, significantly improving reliability.

Dependency and Ownership Updates:

  • Updates dependencies in go.mod and migrates the module path and ownership from kazeburo to monitoring-forge. [1] [2]
  • Updates Makefile and .goreleaser.yml for new module path, improved build flags (including commit hash), and modern Go versions. [1] [2]

CI/CD and Automation:

  • Adds .github/dependabot.yml for automated dependency updates.
  • Refactors GitHub Actions workflows:
    • Modernizes actions and pins versions.
    • Adds permissions and uses tagpr for release tagging.
    • Integrates GoReleaser snapshot builds in CI. [1] [2] [3]

Most Important Changes

1. Core Refactor and Feature Enhancements

  • Refactored main.go for improved structure, replaced shell diff with Go-based diffing, switched to sha256 for hashing, added working directory support, and improved output messages. [1] [2] [3]
  • Added platform-specific secure file opening with open_unix.go and open_windows.go to prevent symlink attacks and ensure compatibility. [1] [2]

2. Testing

  • Introduced a comprehensive test suite in main_test.go covering command execution, diffing, and edge cases.

3. Dependency and Ownership Modernization

  • Updated dependencies, switched Go module path and ownership to monitoring-forge, and updated documentation and build configuration accordingly. [1] [2] [3] [4]

4. CI/CD Automation

  • Added Dependabot for automated dependency updates and refactored GitHub Actions workflows for modern Go versions, improved permissions, and automated releases with tagpr. [1] [2] [3]

5. Build Improvements

  • Enhanced Makefile to inject commit hash into binaries and improved test output verbosity.

These changes collectively modernize the codebase, improve security and maintainability, and streamline development and release processes.

Copilot AI 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.

Pull request overview

This PR transfers the project’s module/release ownership to the monitoring-forge organization and refactors the diff-check implementation to use an in-process diff (gonp) plus OS-specific safe file opening.

Changes:

  • Migrate module path/org references (go.mod, README, GoReleaser config).
  • Refactor runtime behavior: SHA-256 keying, workdir support, gonp-based diff generation, and embed commit info via ldflags.
  • Add Go unit tests and update CI/release workflows (plus Dependabot config).

Reviewed changes

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

Show a summary per file
File Description
README.md Updates install instructions to new org/repo path.
open_windows.go Adds Windows-specific openRD implementation.
open_unix.go Adds Unix openRD with O_NOFOLLOW for safer reads.
Makefile Adds commit ldflags; adjusts build/test targets.
main.go Refactors option parsing + diff logic to use gonp; adds workdir/commit version output.
main_test.go Adds tests for command execution and diff/message helpers.
go.mod Updates module path and dependencies (adds gonp, updates checkers/go-flags).
go.sum Updates dependency checksums accordingly.
.goreleaser.yml Updates release owner and adjusts build matrix.
.github/workflows/test.yml Pins actions, uses go-version-file, adds snapshot GoReleaser build.
.github/workflows/release.yml Switches to Tagpr-driven release flow + pinned actions.
.github/dependabot.yml Adds Dependabot for GitHub Actions and Go modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go
Comment thread main_test.go
kazeburo and others added 4 commits July 18, 2026 00:58
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@kazeburo kazeburo changed the title Refactor with gonp repository and transfer ownership Refactor using gonp repository and transfer ownership Jul 18, 2026
@kazeburo kazeburo changed the title Refactor using gonp repository and transfer ownership Refactor almost using gonp repository and transfer ownership Jul 18, 2026
@kazeburo
kazeburo merged commit d56eb84 into master Jul 18, 2026
2 checks passed
@kazeburo
kazeburo deleted the feat/rewrite-almost branch July 18, 2026 07:47
@github-actions github-actions Bot mentioned this pull request Jul 18, 2026
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