Skip to content

fix(warning): resolve formatting, unreachable code, and exception logic#2506

Merged
cb-github-robot merged 1 commit into
cloud-barista:mainfrom
yunkon-kim:260521-10
May 21, 2026
Merged

fix(warning): resolve formatting, unreachable code, and exception logic#2506
cb-github-robot merged 1 commit into
cloud-barista:mainfrom
yunkon-kim:260521-10

Conversation

@yunkon-kim
Copy link
Copy Markdown
Member

This PR fixes the warning.

This will help contributors read and review the code in their IDEs and reduce future errors.

Updates

  • Refactored error messages to use consistent formatting with fmt.Errorf
  • Applied proper formatting to log.Error() calls
  • Removed unreachable codeblocks
  • Added missing error checks after file operations (e.g., os.OpenFile)
  • Note
    • Updated multiple files in infra, resource, and interface/rest/server modules
    • Enhanced code readability and maintainability

* Refactored error messages to use consistent formatting with fmt.Errorf
* Applied proper formatting to log.Error() calls
* Removed unreachable codeblocks
* Added missing error checks after file operations (e.g., os.OpenFile)
* Note
  - Updated multiple files in infra, resource, and interface/rest/server modules
  - Enhanced code readability and maintainability
@yunkon-kim yunkon-kim requested a review from seokho-son as a code owner May 21, 2026 05:07
@seokho-son
Copy link
Copy Markdown
Member

Thank you @yunkon-kim !

@yunkon-kim
Copy link
Copy Markdown
Member Author

I'm just sharing one thing I couldn't update.

func UpdateInfraInfo(nsId string, infraInfoData model.InfraInfo) {
infraInfoMutex.Lock()
defer infraInfoMutex.Unlock()
infraInfoData.Node = nil
key := common.GenInfraKey(nsId, infraInfoData.Id, "")
// Check existence of the key. If no key, no update.
keyValue, exists, err := kvstore.GetKv(key)
if !exists || err != nil {
return
}
infraTmp := model.InfraInfo{}
json.Unmarshal([]byte(keyValue.Value), &infraTmp)
if !reflect.DeepEqual(infraTmp, infraInfoData) {
val, _ := json.Marshal(infraInfoData)
err = kvstore.Put(key, string(val))
if err != nil {
log.Error().Err(err).Msg("")
}
}
}

avoid using reflect.DeepEqual with errors in
image

@yunkon-kim
Copy link
Copy Markdown
Member Author

@seokho-son, I will merge it once the ongoing tests (system > global-infra-test) are completed.

@yunkon-kim
Copy link
Copy Markdown
Member Author

image

@yunkon-kim
Copy link
Copy Markdown
Member Author

/approve

@github-actions github-actions Bot added the approved This PR is approved and will be merged soon. label May 21, 2026
@cb-github-robot cb-github-robot merged commit 9e208e1 into cloud-barista:main May 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This PR is approved and will be merged soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants