feat: refactor KsDecode to handle stringData and data nodes #543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to improve code readability, enhance error handling, and update functionality in the
cmd/vals
,pkg/log
, andpkg/providers/vault
packages. The most important changes include updating variable names for clarity, adding error handling forfmt.Fprintln
andfmt.Fprintf
, and modifying theKsDecode
function to handle bothdata
andstringData
nodes.Improvements to readability and error handling:
cmd/vals/main.go
: Updated variable names in theKsDecode
function to make the code more understandable and added comments to explain the logic. [1] [2] [3]cmd/vals/main.go
: Added error handling forfmt.Fprintln
to ignore returned values.io.go
: Added error handling forfmt.Fprintln
to ignore returned values. [1] [2]pkg/log/log.go
: Added error handling forfmt.Fprintf
to ignore returned values.Functional updates:
cmd/vals/main.go
: Modified theKsDecode
function to handle bothdata
andstringData
nodes, ensuring proper decoding and merging of these nodes. [1] [2]cmd/vals/main_test.go
: Updated test cases to includestringData
nodes, ensuring the new functionality is tested.Other changes:
pkg/providers/vault/kv_helper.go
: Replaced hardcoded status code404
withhttp.StatusNotFound
for better readability and maintainability.pkg/providers/vault/kv_helper.go
: Addednet/http
import to support the status code change.