Skip to content

refactor: simplify build flags and update command-line options in main.go - #17

Merged
kazeburo merged 1 commit into
mainfrom
feat/flagrun
Sep 6, 2026
Merged

kazeburo merged 1 commit into
mainfrom
feat/flagrun

Conversation

@kazeburo

@kazeburo kazeburo commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

PR Type

Enhancement


Description

  • Adopt flagrun for standardized CLI execution

  • Delegate plugin startup through Opt.Run

  • Simplify build metadata to version only

  • Document generated help output


Diagram Walkthrough

flowchart LR
  Main["main function"]
  Flagrun["flagrun Ship"]
  Options["Opt Run handler"]
  Plugin["Mackerel memory plugin"]
  Main -- "starts" --> Flagrun
  Flagrun -- "invokes" --> Options
  Options -- "runs" --> Plugin
Loading

File Walkthrough

Relevant files
Enhancement
main.go
Use flagrun for CLI lifecycle handling                                     

main.go

  • Replace manual go-flags parsing with flagrun.Ship
  • Move plugin execution into Opt.Run
  • Delegate version and help handling to flagrun
  • Remove commit, runtime, and executable metadata output
+6/-30   
Configuration changes
Makefile
Simplify build metadata linker flags                                         

Makefile

  • Stop embedding the Git commit in linker flags
  • Retain version injection through main.version
  • Correct and expand .PHONY targets
+2/-3     
Documentation
README.md
Document generated command-line help output                           

README.md

  • Replace version-output example with CLI usage output
  • Document version and help command-line options
+8/-3     
Dependencies
go.mod
Add flagrun command-line dependency                                           

go.mod

  • Add the github.com/monitoring-forge/flagrun dependency
  • Reclassify go-flags as an indirect dependency
  • Add indirect dependencies required by flagrun
+6/-1     

@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@kazeburo
kazeburo merged commit f5850a4 into main Sep 6, 2026
3 checks passed
@kazeburo
kazeburo deleted the feat/flagrun branch September 6, 2026 12:32
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant