[Solved] Go Error: continue is not in a loop


Your problem is here:

//push single code on the block
func (s *SmartContract) pushCode(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {

    hsCode := args[0]
    lenChk := checkHashLen(hsCode)
    if lenChk == false {
        fmt.Println("Length should be 32")
        continue
    }
    codeBytes, _ := json.Marshal(hsCode)
    APIstub.PutState(strconv.FormatInt(makeTimestamp(), 10), codeBytes)
    return shim.Success(nil)
}

The error explains what is going wrong. You’re using the keyword continue when not in a for loop, this function doesn’t contain a for loop.

initCodeLedger contains a for loop, so you are getting distracted by that, but that’s not the line no given in the error which is around line 86/87/88. Ideally post code on play.golang.org if asking a question like this.

3

solved Go Error: continue is not in a loop