Skip to content

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented Mar 19, 2025

This pull request introduces changes to the handling of checksums in the gh package, including the addition of checksum verification for release assets and the removal of redundant checksum code from the setup package. The most important changes include the addition of a new checksum function, modifications to the AssetOption struct, and updates to the tests to cover the new checksum functionality.

Checksum verification:

  • Added checksum verification in the GetReleaseAsset function to validate the integrity of downloaded assets. (gh/gh.go, gh/gh.goR86-R92)
  • Introduced a new checksum function to handle various checksum algorithms and formats. (gh/gh.go, gh/gh.goR291-R349)

Struct and flag updates:

  • Added a Checksum field to the AssetOption struct to store the checksum value for verification. (gh/gh.go, gh/gh.goR66)
  • Updated the rootCmd flags to use the correct Checksum field from the opt struct. (cmd/root.go, cmd/root.goL120-R120)

Test enhancements:

  • Added comprehensive tests for the new checksum functionality, covering various algorithms and scenarios. (gh/gh_test.go, gh/gh_test.goR50-R236)
  • Modified existing tests to include the new Checksum field in the AssetOption struct. (gh/gh_test.go, gh/gh_test.goL25-R29)

Code cleanup:

  • Removed redundant checksum-related code from the setup package, as it is now handled in the gh package. (setup/setup.go, [1] [2] [3] [4]
  • Removed the old checksum tests from the setup package. (setup/setup_test.go, setup/setup_test.goL34-L220)

@k1LoW k1LoW added the bug Something isn't working label Mar 19, 2025
@k1LoW k1LoW self-assigned this Mar 19, 2025
Copy link
Contributor

Code Metrics Report

main (065bc93) #128 (5ff7504) +/-
Coverage 52.2% 53.0% +0.7%
Code to Test Ratio 1:0.4 1:0.4 +0.0
Test Execution Time 36s 36s 0s
Details
  |                     | main (065bc93) | #128 (5ff7504) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          52.2% |          53.0% | +0.7% |
  |   Files             |              5 |              5 |     0 |
  |   Lines             |            442 |            443 |    +1 |
+ |   Covered           |            231 |            235 |    +4 |
+ | Code to Test Ratio  |          1:0.4 |          1:0.4 |  +0.0 |
  |   Code              |            643 |            645 |    +2 |
+ |   Test              |            259 |            260 |    +1 |
  | Test Execution Time |            36s |            36s |    0s |

Code coverage of files in pull request scope (37.1% → 38.4%)

Files Coverage +/-
cmd/root.go 0.0% 0.0%
gh/gh.go 62.0% +11.1%
setup/setup.go 18.9% -18.4%

Reported by octocov

@k1LoW k1LoW merged commit 57b14bb into main Mar 19, 2025
6 checks passed
@k1LoW k1LoW deleted the fix-chechsum branch March 19, 2025 09:52
@github-actions github-actions bot mentioned this pull request Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant