VOL-3353 Enable Go sec
Change-Id: I22cbec5d0fa8063e22435131804717158e33fdfa
diff --git a/.golangci.yml b/.golangci.yml
index c29226e..0c26f3b 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -41,6 +41,7 @@
- govet
- ineffassign
- misspell
+ - gosec
#- unparam
run:
diff --git a/internal/pkg/olterrors/olterrors.go b/internal/pkg/olterrors/olterrors.go
index 59eaed9..8555cf1 100644
--- a/internal/pkg/olterrors/olterrors.go
+++ b/internal/pkg/olterrors/olterrors.go
@@ -90,17 +90,23 @@
// Error returns a string representation of the error
func (e *ErrAdapter) Error() string {
var buf strings.Builder
- buf.WriteString(e.name)
+ _, er := buf.WriteString(e.name)
+ if er != nil {
+ log.Error(er)
+ }
if len(e.fields) > 0 {
if val, err := json.Marshal(e.fields); err == nil {
- buf.WriteString(": [")
- buf.WriteString(string(val))
- buf.WriteString("]")
+ _, er = buf.WriteString(fmt.Sprintf(": [%s]", string(val)))
+ if er != nil {
+ log.Error(er)
+ }
}
}
if e.wrapped != nil {
- buf.WriteString(": ")
- buf.WriteString(e.wrapped.Error())
+ _, er = buf.WriteString(fmt.Sprintf(": %s", e.wrapped.Error()))
+ if er != nil {
+ log.Error(er)
+ }
}
return buf.String()
}