func compareState(txn *pb.TxnRequest, r *bufio.Reader) stateFunc { fmt.Println("entry comparison[key target expected_result compare_value] (end with empty line):") line, err := r.ReadString('\n') if err != nil { ExitWithError(ExitInvalidInput, err) } if len(line) == 1 { return successState } // remove trialling \n line = line[:len(line)-1] c, err := parseCompare(line) if err != nil { ExitWithError(ExitInvalidInput, err) } txn.Compare = append(txn.Compare, c) return compareState }