Added source and user marks to opportunities type. Any ignored errors are deferred to //nolint with a comment instead of being silently dropped
This commit is contained in:
1 parent
6e6dec68c0
commit
9b0e6dccfe
7 files changed
+65
-4
No files matched your search
@@ -185,7 +185,7 @@ func clone[T any](v T) T {
|
||||
var out T
|
||||
b, err := json.Marshal(v)
|
||||
if err == nil {
|
||||
_ = json.Unmarshal(b, &out)
|
||||
json.Unmarshal(b, &out) //nolint:errcheck,gosec // b was just marshalled from a T
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -287,6 +287,6 @@ func ensurePartyID(p *ocds.Organization) {
|
||||
return
|
||||
}
|
||||
h := fnv.New32a()
|
||||
_, _ = h.Write([]byte(p.Name)) // never fails
|
||||
h.Write([]byte(p.Name)) //nolint:gosec // never fails
|
||||
p.ID = fmt.Sprintf("GB-FTS-%d", h.Sum32()%1000000)
|
||||
}
|
||||
@@ -65,7 +65,8 @@ func decodeCursor(c string) (int, error) {
|
||||
func badRequest(w http.ResponseWriter, msg string) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"error": msg}) // the client has gone
|
||||
body := map[string]string{"error": msg}
|
||||
json.NewEncoder(w).Encode(body) //nolint:errcheck,gosec // the client may have gone; nothing to do
|
||||
}
|
||||
|
||||
// parseTime reads a query timestamp. Values without an offset (the documented
|
||||
|
||||
@@ -114,7 +114,7 @@ func (rl *RateLimiter) Middleware(next http.HandlerFunc) http.HandlerFunc {
|
||||
w.Header().Set("Retry-After", strconv.Itoa(retry))
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(http.StatusTooManyRequests)
|
||||
_, _ = fmt.Fprintf(
|
||||
fmt.Fprintf( //nolint:errcheck // the client may have gone; nothing to do
|
||||
w, "Rate limit of %d exceeded. Please retry after %d seconds.",
|
||||
rl.limit, retry,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user