chore: update linter configuration and enhance CI workflow

- Replaced 'exportloopref' with 'copyloopvar' in .golangci.yml for improved linting accuracy.
- Updated 'goerr113' to 'err113' for consistency in linter naming.
- Added Go setup step in the GitHub Actions workflow to specify Go version 1.23.
- Enhanced the gosec report upload process and added a step to display scan results in the CI workflow.
- Improved error handling in the unmarshalBody function to provide clearer error messages.
This commit is contained in:
0x524a
2025-12-02 01:06:28 -05:00
parent 3498b7d3a8
commit 808498d1a0
3 changed files with 25 additions and 7 deletions
+2 -2
View File
@@ -369,14 +369,14 @@ func (s *Server) HandleGetVideoSources(body interface{}) (interface{}, error) {
func unmarshalBody(body interface{}, target interface{}) error {
var bodyXML []byte
var err error
// If body is already []byte, use it directly
if b, ok := body.([]byte); ok {
bodyXML = b
} else {
bodyXML, err = xml.Marshal(body)
if err != nil {
return err
return fmt.Errorf("failed to marshal XML: %w", err)
}
}
return xml.Unmarshal(bodyXML, target)