Skip to content

Commit

Permalink
🔄 Sync from monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mojo-machine[bot] committed May 23, 2024
1 parent 7b667c8 commit 56a736c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ linters:
- ireturn # disagree
- lll # impractical
- maligned # deprecated: replaced by govet
- mnd # disagree
- nlreturn # disagree
- nonamedreturns # disagree
- nosnakecase # deprecated: replaced by revive
Expand All @@ -43,6 +44,9 @@ severity:

issues:
exclude-rules:
- linters:
- contextcheck
source: "ctx, opts, func\\(ctx mongo\\.SessionContext\\)"
- linters:
- gomoddirectives
text: "local replacement are not allowed: github.com/wearemojo/mojo-public-go"
Expand Down
2 changes: 1 addition & 1 deletion lib/cryptorand/cryptorand.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package cryptorand
import (
"crypto/rand"
"encoding/binary"

mathrand "math/rand/v2"
)

// TODO: could this be removed entirely now that we have math/rand/v2?
// the docs do still say "it should not be used for security-sensitive work"

func New() *mathrand.Rand {
//nolint:gosec // this is using crypto/rand
return mathrand.New(NewSource())
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ipcountry/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func Middleware() func(http.Handler) http.Handler {
return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
ctx := req.Context()

ipCountry := req.Header.Get("infra-ip-country")
ipCountry := req.Header.Get("Infra-Ip-Country")

ctx = SetIPCountry(ctx, ipCountry)
req = req.WithContext(ctx)
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/request/client_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func GetClientVersionContext(ctx context.Context) *ClientVersion {
func ParseClientVersion(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
parsedClientVersion, err := parseVersionHeader(ctx, r.Header.Get("infra-client-version"))
parsedClientVersion, err := parseVersionHeader(ctx, r.Header.Get("Infra-Client-Version"))
if err == nil {
r = r.WithContext(context.WithValue(ctx, clientVersionContextKey, parsedClientVersion))
}
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/request/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Logger(log *logrus.Entry) func(http.Handler) http.Handler {
clog.SetFields(ctx, clog.Fields{
"http_remote_addr": r.RemoteAddr,
"http_user_agent": r.UserAgent(),
"http_client_version": r.Header.Get("infra-client-version"),
"http_client_version": r.Header.Get("Infra-Client-Version"),
"http_path": r.URL.Path,
"http_method": r.Method,
"http_proto": r.Proto,
Expand Down

0 comments on commit 56a736c

Please sign in to comment.