Skip to content

Commit

Permalink
rename package-local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
vpranckaitis committed Dec 21, 2020
1 parent a050331 commit bb301d7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/x/net/http/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
type ErrorRewriteFn func(error) error

var (
_errorRewriteFn ErrorRewriteFn = func(err error) error { return err }
_errorRewriteFnLock sync.Mutex
errorRewriteFn ErrorRewriteFn = func(err error) error { return err }
errorRewriteFnLock sync.Mutex
)

// Error is an HTTP JSON error that also sets a return status code.
Expand Down Expand Up @@ -102,7 +102,7 @@ func WriteError(w http.ResponseWriter, err error, opts ...WriteErrorOption) {
fn(&o)
}

err = _errorRewriteFn(err)
err = errorRewriteFn(err)

statusCode := getStatusCode(err)
if o.response == nil {
Expand All @@ -117,11 +117,11 @@ func WriteError(w http.ResponseWriter, err error, opts ...WriteErrorOption) {

// SetErrorRewriteFn sets error rewrite function.
func SetErrorRewriteFn(f ErrorRewriteFn) ErrorRewriteFn {
_errorRewriteFnLock.Lock()
defer _errorRewriteFnLock.Unlock()
errorRewriteFnLock.Lock()
defer errorRewriteFnLock.Unlock()

res := _errorRewriteFn
_errorRewriteFn = f
res := errorRewriteFn
errorRewriteFn = f
return res
}

Expand Down

0 comments on commit bb301d7

Please sign in to comment.