Skip to content

Commit

Permalink
Remove a few dead assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Jan 6, 2017
1 parent 88aad03 commit 5edbc04
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions api.go
Expand Up @@ -1020,7 +1020,7 @@ func orgHandler(w http.ResponseWriter, r *http.Request) {
}

func handleOrgAddOrUpdate(keyName string, r *http.Request) ([]byte, int) {
success := true
success := false
decoder := json.NewDecoder(r.Body)
var responseMessage []byte
var newSession SessionState
Expand All @@ -1030,7 +1030,6 @@ func handleOrgAddOrUpdate(keyName string, r *http.Request) ([]byte, int) {
if err != nil {
log.Error("Couldn't decode new session object: ", err)
code = 400
success = false
responseMessage = createError("Request malformed")
} else {
// Update our session object (create it)
Expand Down Expand Up @@ -2029,7 +2028,6 @@ func invalidateCacheHandler(w http.ResponseWriter, r *http.Request) {
"path": "--",
"server_name": "system",
}).Info("Cache invalidated successfully")
code = 200
} else {
// Return Not supported message (and code)
code = 405
Expand Down
2 changes: 1 addition & 1 deletion api_loader.go
Expand Up @@ -204,7 +204,6 @@ func processSpec(referenceSpec *APISpec,
referenceSpec.Init(authStore, sessionStore, healthStore, orgStore)

//Set up all the JSVM middleware
mwPaths := []string{}
var mwAuthCheckFunc tykcommon.MiddlewareDefinition
mwPreFuncs := []tykcommon.MiddlewareDefinition{}
mwPostFuncs := []tykcommon.MiddlewareDefinition{}
Expand All @@ -223,6 +222,7 @@ func processSpec(referenceSpec *APISpec,
"api_name": referenceSpec.APIDefinition.Name,
}).Debug("Loading Middleware")

var mwPaths []string
mwPaths, mwAuthCheckFunc, mwPreFuncs, mwPostFuncs, mwPostAuthCheckFuncs, mwDriver = loadCustomMiddleware(referenceSpec)

if config.EnableJSVM && mwDriver == tykcommon.OttoDriver {
Expand Down
3 changes: 1 addition & 2 deletions batch_requests.go
Expand Up @@ -145,8 +145,7 @@ func (b BatchRequestHandler) MakeRequests(batchRequest BatchRequestStructure, re
}

for i := 0; i < len(batchRequest.Requests); i++ {
val := BatchReplyUnit{}
val = <-replies
val := <-replies

ReplySet = append(ReplySet, val)
}
Expand Down
7 changes: 1 addition & 6 deletions coprocess_bundle.go
Expand Up @@ -9,7 +9,6 @@ import (
"bytes"
"crypto/md5"
b64 "encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -62,10 +61,6 @@ func (b *Bundle) Verify() (err error) {
useSignature = true
}

h := md5.New()
h.Write(b.Data)
checksum := hex.EncodeToString(h.Sum(nil))

var bundleData bytes.Buffer

for _, f := range b.Manifest.FileList {
Expand All @@ -80,7 +75,7 @@ func (b *Bundle) Verify() (err error) {
bundleData.Write(data)
}

checksum = fmt.Sprintf("%x", md5.Sum(bundleData.Bytes()))
checksum := fmt.Sprintf("%x", md5.Sum(bundleData.Bytes()))

if checksum != b.Manifest.Checksum {
err = errors.New("Invalid checksum")
Expand Down

0 comments on commit 5edbc04

Please sign in to comment.