[
  {
    "path": ".gitignore",
    "content": ".idea/*\npkg/*\nbin/game.exe\nbin/game\n"
  },
  {
    "path": "README.md",
    "content": "# 德州扑克服务器Go实现\n\n## 核心算法：\n```go\ntype Cards []byte\n// todo 两对和四张起脚牌的判定\nvar StraightMask = []uint16{15872, 7936, 3968, 1984, 992, 496, 248, 124, 62, 31}\n//顺子（Straight，亦称“蛇”）\n//此牌由五张顺序扑克牌组成。\n//平手牌：如果不止一人抓到此牌，则五张牌中点数最大的赢得此局，\n// 如果所有牌点数都相同，平分彩池。\nfunc (this *Cards) straight() uint32 {\n\tvar handvalue uint16\n\tfor _, v := range (*this) {\n\t\tvalue := v & 0xF\n\t\tif value == 0xE {\n\t\t\thandvalue |= 1\n\t\t}\n\t\thandvalue |= (1 << (value - 1 ) )\n\t}\n\n\tfor i := uint8(0); i < 10; i++ {\n\t\tif handvalue&StraightMask[i] == StraightMask[i] {\n\t\t\treturn En(STRAIGHT, uint32(10-i+4))\n\t\t}\n\t}\n\treturn 0\n}\n\n//同花顺（Straight Flush）\n//五张同花色的连续牌。\n//平手牌：如果摊牌时有两副或多副同花顺，连续牌的头张牌大的获得筹码。\n//如果是两副或多副相同的连续牌，平分筹码。\nfunc (this *Cards) straightFlush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar handvalue uint16\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tvalue := v & 0xF\n\t\t\t\tif value == 0xE {\n\t\t\t\t\thandvalue |= 1\n\t\t\t\t}\n\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\t\t\t}\n\t\t}\n\n\t\tfor i := uint8(0); i < 10; i++ {\n\t\t\tif handvalue&StraightMask[i] == StraightMask[i] {\n\t\t\t\treturn En(STRAIGHT_FLUSH, uint32(10-i+4))\n\t\t\t}\n\t\t}\n\t}\n\treturn 0\n}\n\n//皇家同花顺（Royal Flush）\n//同花色的A, K, Q, J和10。\n//平手牌：在摊牌的时候有两副多副皇家同花顺时，平分筹码。\nfunc (this *Cards) royalFlush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar handvalue uint16\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tvalue := v & 0xF\n\t\t\t\tif value == 0xE {\n\t\t\t\t\thandvalue |= 1\n\t\t\t\t}\n\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\n\t\t\t}\n\t\t}\n\n\t\tif handvalue&StraightMask[0] == StraightMask[0] {\n\t\t\treturn En(ROYAL_FLUSH, 0)\n\t\t}\n\t}\n\treturn 0\n}\n\n//四条（Four of a Kind，亦称“铁支”、“四张”或“炸弹”）\n//其中四张是相同点数但不同花的扑克牌，第五张是随意的一张牌。\n//平手牌：如果两组或者更多组摊牌，则四张牌中的最大者赢局，如果一组人持有的四张牌是一样的，\n//那么第五张牌最大者赢局（起脚牌,2张起手牌中小的那张就叫做起脚牌）。如果起脚牌也一样，平分彩池。\nfunc (this *Cards) four(counter *ValueCounter) uint32 {\n\tcards := *this\n\tif counter.Get(cards[len(cards)-1]) == 4 {\n\t\treturn En(FOUR, ToValue(cards))\n\t}\n\treturn 0\n}\n\n//满堂彩（Fullhouse，葫芦，三带二）\n//由三张相同点数及任何两张其他相同点数的扑克牌组成。\n//平手牌：如果两组或者更多组摊牌，那么三张相同点数中较大者赢局。\n//如果三张牌都一样，则两张牌中点数较大者赢局，如果所有的牌都一样，则平分彩池。\nfunc (this *Cards) fullFouse(counter *ValueCounter) uint32 {\n\tcards := *this\n\tlength := len(cards)\n\n\tif length >= 5 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF &&\n\t\t\tcards[length-3]&0xF == cards[length-1]&0xF &&\n\t\t\tcards[length-4]&0xF == cards[length-5]&0xF {\n\n\t\t\treturn En(FULL_HOUSE, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\n//同花（Flush，简称“花”）\n//此牌由五张不按顺序但相同花的扑克牌组成。\n//平手牌：如果不止一人抓到此牌相，则牌点最高的人赢得该局，\n//如果最大点相同，则由第二、第三、第四或者第五张牌来决定胜负，如果所有的牌都相同，平分彩池。\nfunc (this *Cards) flush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar count uint8\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tcount ++\n\t\t\t\tif count == 5 {\n\t\t\t\t\tvar handvalue uint16\n\t\t\t\t\tfor _, v1 := range cards {\n\t\t\t\t\t\tif (v1 >> 4) == i {\n\t\t\t\t\t\t\tvalue := v1 & 0xF\n\t\t\t\t\t\t\tif value == 0xE {\n\t\t\t\t\t\t\t\thandvalue |= 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn En(FLUSH, uint32(handvalue))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn 0\n}\n\n//三条（Three of a kind，亦称“三张”）\n//由三张相同点数和两张不同点数的扑克组成。\n//平手牌：如果不止一人抓到此牌，则三张牌中最大点数者赢局，\n//如果三张牌都相同，比较第四张牌，必要时比较第五张，点数大的人赢局。如果所有牌都相同，则平分彩池。\nfunc (this *Cards) three(counter *ValueCounter) uint32 {\n\tcards := *this\n\tif counter.Get(cards[len(cards)-1]) == 3 {\n\t\treturn En(THREE, ToValue(cards))\n\t}\n\treturn 0\n}\n\n//两对（Two Pairs）\n//两对点数相同但两两不同的扑克和随意的一张牌组成。\n//平手牌：如果不止一人抓大此牌相，牌点比较大的人赢，如果比较大的牌点相同，那么较小牌点中的较大者赢，\n//如果两对牌点相同，那么第五张牌点较大者赢（起脚牌,2张起手牌中小的那张就叫做起脚牌）。如果起脚牌也相同，则平分彩池。\nfunc (this *Cards) twoPair() uint32 {\n\tcards := *this\n\tlength := len(cards)\n\tif length >= 4 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF &&\n\t\t\tcards[length-3]&0xF == cards[length-4]&0xF {\n\t\t\treturn En(TWO_PAIR, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\n//一对（One Pair）\n//由两张相同点数的扑克牌和另三张随意的牌组成。\n//平手牌：如果不止一人抓到此牌，则两张牌中点数大的赢，如果对牌都一样，则比较另外三张牌中大的赢，\n//如果另外三张牌中较大的也一样则比较第二大的和第三大的，如果所有的牌都一样，则平分彩池。\nfunc (this *Cards) onePair() uint32 {\n\tcards := *this\n\tlength := len(cards)\n\tif length >= 2 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF {\n\t\t\treturn En(ONE_PAIR, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\nfunc ToValue(cards []byte) uint32 {\n\tvar res uint32\n\tfor i := len(cards) - 1; i >= 0; i-- {\n\t\tres *= 10\n\t\tres += uint32(cards[i] & 0xF)\n\t}\n\treturn res\n}\n\nfunc De(v uint32) (uint8, uint32) {\n\treturn uint8(v >> 24), v & 0xFFFFFF\n}\n\nfunc En(t uint8, v uint32) uint32 {\n\tv1 := v | ( uint32(t) << 24)\n\treturn v1\n}\n```\n"
  },
  {
    "path": "bin/build-linux.sh",
    "content": "#!/bin/bash\n# usage ./build-linux.sh 1.0.13\ncurDir=`pwd`\nGREEN=\"\\e[1;32m\"\nRESET=\"\\e[0m\"\necho -e \"${GREEN} current dir is $curDir ${RESET}\"\n\nd=`date \"+%Y-%m-%d-%H-%M-%S\"`\necho -e \"${GREEN} mkpkg_time is $d ${RESET}\"\n\npkg_version=$1\necho -e \"${GREEN} pkg_version is $pkg_version ${RESET}\" \n\ncd   $curDir/..\nSTRING_GAME=`git log | head -n 1 | awk '{print $2}'`\necho -e \"${GREEN} game commit is $STRING_GAME ${RESET}\" \n\ncd   $curDir/..\necho `pwd`\n\ncd   $curDir/..\n\nexport GOPATH=`pwd`\nexport GOARCH=amd64\nexport GOOS=linux\ncd bin\n\n\ngo build  -o game -ldflags \"-X main.Commit=$STRING_GAME -X 'main.BUILD_TIME=`date`' -X main.VERSION=$1 -s -w\"  ../src/main.go\n\n\nread -p \"Press any key to continue.\" var"
  },
  {
    "path": "bin/build-win.sh",
    "content": "#!/bin/bash\n# usage ./build-linux.sh 1.0.13\ncurDir=`pwd`\nGREEN=\"\\e[1;32m\"\nRESET=\"\\e[0m\"\necho -e \"${GREEN} current dir is $curDir ${RESET}\"\n\nd=`date \"+%Y-%m-%d-%H-%M-%S\"`\necho -e \"${GREEN} mkpkg_time is $d ${RESET}\"\n\npkg_version=$1\necho -e \"${GREEN} pkg_version is $pkg_version ${RESET}\" \n\ncd   $curDir/..\nSTRING_GAME=`git log | head -n 1 | awk '{print $2}'`\necho -e \"${GREEN} game commit is $STRING_GAME ${RESET}\" \n\ncd   $curDir/..\necho `pwd`\n\ncd   $curDir/..\n\nexport GOPATH=`pwd`\n#export GOARCH=amd64\n#export GOOS=linux\ncd bin\n\n\ngo build  -o game.exe -ldflags \"-X main.Commit=$STRING_GAME -X 'main.BUILD_TIME=`date`' -X main.VERSION=$1 -s -w\"  ../src/main.go\n\n\nread -p \"Press any key to continue.\" var"
  },
  {
    "path": "bin/client/.gitignore",
    "content": "#IDE\n/library\n/local\n/build\n/temp\n/.idea\n/settings\n"
  },
  {
    "path": "bin/client/README.md",
    "content": "# Cocos Creator 写的一个德州扑克的游戏回放，仅供参考\n"
  },
  {
    "path": "bin/client/assets/Scene/main.fire",
    "content": "[\n  {\n    \"__type__\": \"cc.SceneAsset\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"_rawFiles\": null,\n    \"scene\": {\n      \"__id__\": 1\n    }\n  },\n  {\n    \"__type__\": \"cc.Scene\",\n    \"_name\": \"main\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": null,\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [\n      {\n        \"__id__\": 2\n      }\n    ],\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"b1a3242c-6595-42df-a0fc-e177f727763d\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"Canvas\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 1\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 1000,\n      \"height\": 1560\n    },\n    \"_children\": [\n      {\n        \"__id__\": 3\n      },\n      {\n        \"__id__\": 113\n      },\n      {\n        \"__id__\": 114\n      },\n      {\n        \"__id__\": 115\n      },\n      {\n        \"__id__\": 116\n      },\n      {\n        \"__id__\": 117\n      },\n      {\n        \"__id__\": 118\n      },\n      {\n        \"__id__\": 124\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 500,\n      \"y\": 780\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"87318gAtAVE5YV5wEAYBbcX\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 126\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"table_bg\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 1130,\n      \"height\": 1560\n    },\n    \"_children\": [\n      {\n        \"__id__\": 4\n      },\n      {\n        \"__id__\": 14\n      },\n      {\n        \"__id__\": 23\n      },\n      {\n        \"__id__\": 33\n      },\n      {\n        \"__id__\": 43\n      },\n      {\n        \"__id__\": 53\n      },\n      {\n        \"__id__\": 63\n      },\n      {\n        \"__id__\": 73\n      },\n      {\n        \"__id__\": 83\n      },\n      {\n        \"__id__\": 93\n      },\n      {\n        \"__id__\": 96\n      },\n      {\n        \"__id__\": 99\n      },\n      {\n        \"__id__\": 102\n      },\n      {\n        \"__id__\": 103\n      },\n      {\n        \"__id__\": 104\n      },\n      {\n        \"__id__\": 105\n      },\n      {\n        \"__id__\": 106\n      },\n      {\n        \"__id__\": 107\n      },\n      {\n        \"__id__\": 108\n      },\n      {\n        \"__id__\": 109\n      },\n      {\n        \"__id__\": 110\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"6a97a8/GAFHTrJP5XWtPkx+\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 111\n      },\n      {\n        \"__id__\": 112\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_0\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 5\n      },\n      {\n        \"__id__\": 6\n      },\n      {\n        \"__id__\": 9\n      },\n      {\n        \"__id__\": 12\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -400\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"a77cbKPk7hJC4cLSMT0rUGm\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 13\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 4\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 126,\n      \"height\": 66\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"e6321VmItNCOq39iH20y4D0\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 4\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"b5985lBCBtArp9Et9uVxeuV\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 7\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 8\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 6\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 6\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 4\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d7f9ekaZJNIPrjltUVmLBBo\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 10\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 11\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 9\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 9\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 4\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"79758mNFOpDLrMwtBnAvIg+\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 4\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_1\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 15\n      },\n      {\n        \"__id__\": 16\n      },\n      {\n        \"__id__\": 19\n      },\n      {\n        \"__id__\": 21\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -390,\n      \"y\": -150\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"8eaf6bTIINJz4hs4ELd7LIC\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 22\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 14\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"962c2ULwpBJaoIwjW1zWooB\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 14\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"177242DBgJOW5LB5ocvKbHd\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 17\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 18\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 16\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 16\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 14\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"c4e04pvk+1AQZ3b+Qo5WlBj\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 20\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 19\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 14\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"fff0dgsq5dCCYzVoSa0NLFH\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 14\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_2\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 24\n      },\n      {\n        \"__id__\": 25\n      },\n      {\n        \"__id__\": 28\n      },\n      {\n        \"__id__\": 31\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -390,\n      \"y\": 130\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d4dacl6zv5Ow4WGZ2PaTaKH\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 32\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 23\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"c0373XWaEZKVoEMveh6Byv0\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 23\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"c4a51CETARKJ7Hupl1PiIH3\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 26\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 27\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 25\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 25\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 23\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d7e1eLUZwBPQKIq6c+a2ZtB\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 29\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 30\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 28\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 28\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 23\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"fa223AJdGpFGoH5iZ35SGZp\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 23\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_3\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 34\n      },\n      {\n        \"__id__\": 35\n      },\n      {\n        \"__id__\": 38\n      },\n      {\n        \"__id__\": 41\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -390,\n      \"y\": 390\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"a16d3140NtLsrxjigsyOQfh\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 42\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 33\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 45,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"95104GXzj9EvI7iZP12FXqA\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 33\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d74793N9JZJsaBnAMHgCIPx\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 36\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 37\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 35\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 35\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 33\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"27356QU50RDEouIwSE8tKuc\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 39\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 40\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 38\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 38\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 33\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d3c63DFPAhEvb5HPeZXBiqq\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 33\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_4\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 44\n      },\n      {\n        \"__id__\": 45\n      },\n      {\n        \"__id__\": 48\n      },\n      {\n        \"__id__\": 51\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -175,\n      \"y\": 620\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"bf93f39ZKVKzLx2Z0FUAVUV\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 52\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 43\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d4efaYy8DxK47KmObsV2Zv0\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 43\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"0f71a4d0ihDMJd9Iv/1UQyb\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 46\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 47\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 45\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 45\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 43\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"65c4a5Jz9JJl45WlN4LSGiY\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 49\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 50\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 48\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 48\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 43\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 70,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"45095damKtPRJVVq1Ng0pCF\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 43\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_5\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 54\n      },\n      {\n        \"__id__\": 55\n      },\n      {\n        \"__id__\": 58\n      },\n      {\n        \"__id__\": 61\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 175,\n      \"y\": 620\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"7be73w6tbdBNo4WHG0mlL7U\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 62\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 53\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"6f98bsA9AxN84J5Aqf7k9ge\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 53\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"7b5f9DG+iJCE51ng0jOR4Ph\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 56\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 57\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 55\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 55\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 53\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 30\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"d9410bRjjNBIpapyHQeAgXY\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 59\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 60\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 58\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 30,\n    \"_lineHeight\": 30,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 58\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 53\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 70,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"65249M1zoNCuLBfLiaGQ14t\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 53\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_6\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 64\n      },\n      {\n        \"__id__\": 65\n      },\n      {\n        \"__id__\": 68\n      },\n      {\n        \"__id__\": 71\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 390,\n      \"y\": 370\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"8b241vXXqhO4J9ETIF7kyNs\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 72\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 63\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"13e059qeMhMJoGCrpG7TOQ5\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 63\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"75b76qW2hVKyr4u0xEL5p8N\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 66\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 67\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 65\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 65\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 63\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"101aeHhphhCuY3xCjkDA5Qy\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 69\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 70\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 68\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 68\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 63\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"ce9bbv6DkhHnpGLs0p3Ryj8\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 63\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_7\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 74\n      },\n      {\n        \"__id__\": 75\n      },\n      {\n        \"__id__\": 78\n      },\n      {\n        \"__id__\": 81\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 390,\n      \"y\": 120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"84471vfDJxDVpxYeb5w9SYZ\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 82\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 73\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"4bfd5Oguv1GFoP0ZH9zZDwt\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 73\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"eea181g0MBJK7pCa4i8LrUI\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 76\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 77\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 75\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 75\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 73\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"b5df1+V6p1B6qQHct0iNb5x\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 79\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 80\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 78\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 78\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 73\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"a8f09ejpfZMz7MVBhrBTSd9\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 73\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"seat_8\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 120,\n      \"height\": 120\n    },\n    \"_children\": [\n      {\n        \"__id__\": 84\n      },\n      {\n        \"__id__\": 85\n      },\n      {\n        \"__id__\": 88\n      },\n      {\n        \"__id__\": 91\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 390,\n      \"y\": -150\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"db9baRfhdhG2Jd+E6yd9PLS\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 92\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"game_tip\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 83\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 84,\n      \"height\": 44\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -57,\n      \"y\": 25\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"fd559/cArpGureRfY2KpGUM\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"nick\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 83\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"93285anWC9B3o8gQVYDumlQ\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 86\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 87\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 85\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 85\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 83\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 30\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -80\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"70704I7fddPjrHX0g2pZ0jM\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 89\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 90\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 88\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 30,\n    \"_lineHeight\": 30,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 88\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"dealer\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 83\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 49,\n      \"height\": 49\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"30296IaWKZCgZQC5QW9wx2Q\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 83\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"table_name\",\n    \"_objFlags\": 0,\n    \"_opacity\": 100,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 0,\n      \"g\": 0,\n      \"b\": 0,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -90\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"97213vbSklNu5yDYLowSVHv\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 94\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 95\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 93\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 93\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"table_sb\",\n    \"_objFlags\": 0,\n    \"_opacity\": 100,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 0,\n      \"g\": 0,\n      \"b\": 0,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"761e9iWpWlKpZWglCafBzGB\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 97\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 98\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 96\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 96\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"table_code\",\n    \"_objFlags\": 0,\n    \"_opacity\": 100,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 0,\n      \"g\": 0,\n      \"b\": 0,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -150\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"595b9sZGmZJVIz744IUjFK1\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 100\n      }\n    ],\n    \"_prefab\": {\n      \"__id__\": 101\n    },\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 99\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": false,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.PrefabInfo\",\n    \"root\": {\n      \"__id__\": 99\n    },\n    \"asset\": {\n      \"__uuid__\": \"27756ebb-3d33-44b0-9b96-e858fadd4dd4\"\n    },\n    \"fileId\": \"d1cddH/doRNQ4Aodz8556bh\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_0\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": -200\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"b34b8yrHDNM3qON31vbAbb6\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_1\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -250,\n      \"y\": -150\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"10b5d6zB5VOFJ8CtGl8Nd0z\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_2\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -250,\n      \"y\": 120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"a7165YJkzBHoKvKHWXyh5jz\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_3\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -250,\n      \"y\": 370\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"b95fbuF4plGLa8acAbzF7kj\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_4\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -175,\n      \"y\": 450\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"fb9a2suBehPNqtNzkQdCIWY\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_5\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 175,\n      \"y\": 450\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"dfcd4NG8nxAsJ4ulKgUoEfq\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_6\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 250,\n      \"y\": 370\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"1875bUQ1ltHIrDDTG0+Y3oP\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_7\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 250,\n      \"y\": 120\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"f939fyrLvNHcb1o/S68syx+\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"chip_8\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 3\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 39,\n      \"height\": 41\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 250,\n      \"y\": -150\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"c29a0hhCtFOtLyKhsq0nHax\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 3\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"d5e079ed-488b-4fd5-8bc3-b3e082b34d96\"\n    },\n    \"_type\": 1,\n    \"_sizeMode\": 0,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": null\n  },\n  {\n    \"__type__\": \"cc.Layout\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 3\n    },\n    \"_enabled\": true,\n    \"_layoutSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 1130,\n      \"height\": 1560\n    },\n    \"_resize\": 0,\n    \"_N$layoutType\": 0,\n    \"_N$cellSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 40,\n      \"height\": 40\n    },\n    \"_N$startAxis\": 0,\n    \"_N$padding\": 0,\n    \"_N$spacingX\": 0,\n    \"_N$spacingY\": 0,\n    \"_N$verticalDirection\": 1,\n    \"_N$horizontalDirection\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"card0\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -170,\n      \"y\": -10\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"ca588XWyEVDIK8moOgxwnrm\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"card1\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -170,\n      \"y\": -10\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"3cbe6OFjcNHK7fXsno5sXom\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"card2\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -170,\n      \"y\": -10\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"167adzrdW5BM7Yx0rxc2ABx\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"card3\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 101,\n      \"y\": -10\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"417c4ciIrxAYI2qbNu25uRY\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"card4\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 192,\n      \"y\": -10\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"c8528G8OaZH4qY7cTUAxkwB\",\n    \"_active\": true,\n    \"_components\": [],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"sound\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 128,\n      \"height\": 128\n    },\n    \"_children\": [\n      {\n        \"__id__\": 119\n      }\n    ],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": -377,\n      \"y\": -607\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"f13a5PxN+tM0LRToQ5jBGcA\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 121\n      },\n      {\n        \"__id__\": 122\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"sound_tips\",\n    \"_objFlags\": 0,\n    \"_opacity\": 0,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 220,\n      \"g\": 238,\n      \"b\": 11,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 118\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 25\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 88\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"daabcnNxuJMuIwLimc6980Z\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 120\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"cc.Label\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 119\n    },\n    \"_enabled\": true,\n    \"_useOriginalSize\": false,\n    \"_actualFontSize\": 40,\n    \"_fontSize\": 25,\n    \"_lineHeight\": 25,\n    \"_enableWrapText\": true,\n    \"_N$file\": null,\n    \"_isSystemFontUsed\": true,\n    \"_N$string\": \"\",\n    \"_N$horizontalAlign\": 1,\n    \"_N$verticalAlign\": 1,\n    \"_N$overflow\": 0\n  },\n  {\n    \"__type__\": \"cc.Sprite\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 118\n    },\n    \"_enabled\": true,\n    \"_spriteFrame\": {\n      \"__uuid__\": \"78f76275-b201-4017-8f0f-70664c14a542\"\n    },\n    \"_type\": 0,\n    \"_sizeMode\": 1,\n    \"_fillType\": 0,\n    \"_fillCenter\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_fillStart\": 0,\n    \"_fillRange\": 0,\n    \"_isTrimmedMode\": true,\n    \"_srcBlendFactor\": 770,\n    \"_dstBlendFactor\": 771,\n    \"_atlas\": {\n      \"__uuid__\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\"\n    }\n  },\n  {\n    \"__type__\": \"cc.Button\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 118\n    },\n    \"_enabled\": true,\n    \"transition\": 0,\n    \"pressedColor\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 211,\n      \"g\": 211,\n      \"b\": 211,\n      \"a\": 255\n    },\n    \"hoverColor\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"duration\": 0.1,\n    \"pressedSprite\": null,\n    \"hoverSprite\": null,\n    \"clickEvents\": [\n      {\n        \"__id__\": 123\n      }\n    ],\n    \"_N$interactable\": true,\n    \"_N$normalColor\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 214,\n      \"g\": 214,\n      \"b\": 214,\n      \"a\": 255\n    },\n    \"_N$disabledColor\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 124,\n      \"g\": 124,\n      \"b\": 124,\n      \"a\": 255\n    },\n    \"_N$normalSprite\": null,\n    \"_N$disabledSprite\": null,\n    \"_N$target\": {\n      \"__id__\": 118\n    }\n  },\n  {\n    \"__type__\": \"cc.ClickEvent\",\n    \"target\": {\n      \"__id__\": 124\n    },\n    \"component\": \"main\",\n    \"handler\": \"set_mute\"\n  },\n  {\n    \"__type__\": \"cc.Node\",\n    \"_name\": \"Main\",\n    \"_objFlags\": 0,\n    \"_opacity\": 255,\n    \"_color\": {\n      \"__type__\": \"cc.Color\",\n      \"r\": 255,\n      \"g\": 255,\n      \"b\": 255,\n      \"a\": 255\n    },\n    \"_cascadeOpacityEnabled\": true,\n    \"_parent\": {\n      \"__id__\": 2\n    },\n    \"_anchorPoint\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0.5,\n      \"y\": 0.5\n    },\n    \"_contentSize\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 0,\n      \"height\": 0\n    },\n    \"_children\": [],\n    \"_rotationX\": 0,\n    \"_rotationY\": 0,\n    \"_scaleX\": 1,\n    \"_scaleY\": 1,\n    \"_position\": {\n      \"__type__\": \"cc.Vec2\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    \"_skewX\": 0,\n    \"_skewY\": 0,\n    \"_localZOrder\": 0,\n    \"_globalZOrder\": 0,\n    \"_tag\": -1,\n    \"_opacityModifyRGB\": false,\n    \"_reorderChildDirty\": false,\n    \"_id\": \"7d6b9Jtb9RNbbKkh4/IG5cv\",\n    \"_active\": true,\n    \"_components\": [\n      {\n        \"__id__\": 125\n      }\n    ],\n    \"_prefab\": null,\n    \"groupIndex\": 0\n  },\n  {\n    \"__type__\": \"ba49cogWFZADYkzvB39Ug3B\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 124\n    },\n    \"_enabled\": true,\n    \"seat\": [],\n    \"Lang\": null,\n    \"SourceSuffix\": null,\n    \"GameMain\": null,\n    \"GameCards\": null,\n    \"audio_chipsToTable\": null,\n    \"audio_check\": null,\n    \"audio_fold\": null,\n    \"audio_distributeCard\": null,\n    \"open_fixedThinkTime\": 0,\n    \"fixedThinkTime\": 2,\n    \"open_mute\": 0,\n    \"is_mobile\": 0,\n    \"fontStyle\": null,\n    \"countdown_execution_interval\": 0.1,\n    \"countdown_repeat_num\": 0,\n    \"countdown_long_time\": 0,\n    \"countdown_cycle_time\": 15,\n    \"countdown_node\": null,\n    \"countdown_task\": null,\n    \"countdown_over_task\": null,\n    \"actions\": null,\n    \"i\": 0,\n    \"ws\": null,\n    \"hand_data\": null,\n    \"data\": null,\n    \"card\": [\n      {\n        \"__id__\": 113\n      },\n      {\n        \"__id__\": 114\n      },\n      {\n        \"__id__\": 115\n      },\n      {\n        \"__id__\": 116\n      },\n      {\n        \"__id__\": 117\n      }\n    ],\n    \"inpot\": null,\n    \"table_chips_inpot\": 0,\n    \"table_chips\": [],\n    \"table_tips\": [],\n    \"game_card_turn\": 0,\n    \"game_card_river\": 0,\n    \"cleanNode\": [],\n    \"cleanSp\": [],\n    \"game_start\": 0\n  },\n  {\n    \"__type__\": \"cc.Canvas\",\n    \"_name\": \"\",\n    \"_objFlags\": 0,\n    \"node\": {\n      \"__id__\": 2\n    },\n    \"_enabled\": true,\n    \"_designResolution\": {\n      \"__type__\": \"cc.Size\",\n      \"width\": 1000,\n      \"height\": 1560\n    },\n    \"_fitWidth\": false,\n    \"_fitHeight\": true\n  }\n]"
  },
  {
    "path": "bin/client/assets/Scene/main.fire.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"b1a3242c-6595-42df-a0fc-e177f727763d\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Scene.meta",
    "content": "{\n  \"ver\": \"1.0.1\",\n  \"uuid\": \"a6716ca2-df58-41aa-b8d3-8ca203720a85\",\n  \"isGroup\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Script/Common.js",
    "content": "cc.Class({\n    extends:  cc.Component,\n\n    properties: {\n        seat:{\n            default:[],\n            type:cc.Node\n        },\n        Lang:null,//语言版本\n        SourceSuffix:null,//资源后缀\n        GameMain:null,//游戏资源\n        GameCards:null,//游戏的牌中的资源\n        audio_chipsToTable:null,//下注的音频\n        audio_check:null,//check的音频\n        audio_fold:null,//fold的音频\n        audio_distributeCard:null,//翻牌的声音\n        open_fixedThinkTime:0,//开启固定思考时间的设置0-否1-开启\n        fixedThinkTime:2,//固定思考时间，配合open_fixedThinkTime使用，单位：秒\n        open_mute:0,//是否开启静音模式0-否1-是\n        is_mobile:0,//是否是手机访问0-否1-是\n        fontStyle:null,//字体样式\n        //websocket\n        ws:null,\n    },\n    //web socket连接\n    wsstart:function(){\n        var me=this;\n        var ws = new WebSocket(\"ws://127.0.0.1:3564\");\n        ws.binaryType = \"arraybuffer\" ;\n        var decoder = new TextDecoder('utf-8')\n\n\n        ws.onopen = function (event) {\n            me.ws = ws;\n            console.log(\"Send Text WS was opened.\");\n        };\n\n        ws.onmessage = function (event) {\n            console.log(\"response text msg: \" + event.data);\n\n            var input = event.data;\n\n            var data = JSON.parse(decoder.decode(event.data));\n            console.log(\"server response\");\n\n            console.log(data);\n\n        };\n        ws.onerror = function (event) {\n            console.log(\"Send Text fired an error\");\n        };\n        ws.onclose = function (event) {\n            console.log(\"WebSocket instance closed.\");\n        };\n\n        //setTimeout(function () {\n        //    if(me.ws!=null){\n        //        cc.log(me.ws.readyState);\n        //        if (me.ws.readyState === WebSocket.OPEN) {\n        //            cc.log(\"send message to server3000\");\n        //            me.ws.send(JSON.stringify({Ai: {\n        //                Ai_id: '123456',\n        //                Hand:[1,2]\n        //            }}))\n        //        }\n        //        else {\n        //            console.log(\"WebSocket instance wasn't ready...\");\n        //        }\n        //    }else{\n        //        cc.log(\"ws is null\");\n        //    }\n        //}, 3000);\n\n    },\n    sit_down:function(){\n        //加载游戏资源图片\n        var me = this;\n        me.is_mobile = this.isMobile();\n        if(me.is_mobile == 1){\n            me.fontStyle={\n                \"table_name\":{\"fontSize\":30,\"lineHeight\":30},\n                \"table_sb\":{\"fontSize\":30,\"lineHeight\":30},\n                \"table_code\":{\"fontSize\":30,\"lineHeight\":30},\n                \"nick\":{\"fontSize\":30,\"lineHeight\":30},\n                \"chips\":{\"fontSize\":30,\"lineHeight\":30},\n                \"chip\":{\"fontSize\":30,\"lineHeight\":30},\n                \"pot\":{\"fontSize\":30,\"lineHeight\":30}\n            };\n        }else{\n            me.fontStyle={\n                \"table_name\":{\"fontSize\":25,\"lineHeight\":25},\n                \"table_sb\":{\"fontSize\":25,\"lineHeight\":25},\n                \"table_code\":{\"fontSize\":25,\"lineHeight\":25},\n                \"nick\":{\"fontSize\":25,\"lineHeight\":25},\n                \"chips\":{\"fontSize\":25,\"lineHeight\":25},\n                \"chip\":{\"fontSize\":25,\"lineHeight\":25},\n                \"pot\":{\"fontSize\":25,\"lineHeight\":25}\n            };\n        }\n        cc.loader.loadRes(\"game_cards\",cc.SpriteAtlas,function(err,atlas){\n            me.GameCards = atlas;\n        });\n        //加载游戏音频\n        if(this.open_mute == 0){\n            cc.loader.loadRes(\"audio/audio_chipsToTable\", function (err, assets) {\n                me.audio_chipsToTable = assets;\n            });\n            cc.loader.loadRes(\"audio/audio_check\", function (err, assets) {\n                me.audio_check = assets;\n            });\n            cc.loader.loadRes(\"audio/audio_fold\", function (err, assets) {\n                me.audio_fold = assets;\n            });\n            cc.loader.loadRes(\"audio/audio_distributeCard\", function (err, assets) {\n                me.audio_distributeCard = assets;\n            });\n        }\n\n        var table_data = this.hand_data;\n        table_data['table_name']=table_data['table_name']?table_data['table_name']:\"\";\n        table_data['table_code']=table_data['table_code']?table_data['table_code']:\"\";\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n\n        //异步加载头像，不能放在循环内\n        var load_avatar = function(url,sprite_user){\n            cc.loader.load(url,function(err,tex){\n                var frame  = new cc.SpriteFrame(tex,cc.Rect(0, 0, 87, 123));\n                sprite_user.spriteFrame = frame;\n            });\n        };\n        cc.loader.loadRes(\"GameMain_6p\",cc.SpriteAtlas,function(err,atlas){\n            me.GameMain = atlas;\n            var sb_data = null;//小盲的数据\n            var bb_data = null;//大盲的数据\n            //坐下\n            for(var k in table_data['players']){\n                var v = table_data['players'][k];\n                var seat_node = node_table_bg.getChildByName(\"seat_\"+v['chair_id']);\n                var node_size = seat_node.getContentSize();//获取node的尺寸\n                //名字\n                var label_nick = seat_node.getChildByName(\"nick\").getComponent(cc.Label);\n                label_nick.string = me.getLength(v['nick'])>10?me.cutStr(v['nick'],7):v['nick'];\n                label_nick.fontSize = me.fontStyle['nick']['fontSize'];\n                label_nick.lineHeight = me.fontStyle['nick']['lineHeight'];\n\n                //带入的筹码\n                var label_chips = seat_node.getChildByName(\"chips\").getComponent(cc.Label);\n                label_chips.string = v['remain_chip']+v['table_chip'];\n                label_chips.fontSize = me.fontStyle['chips']['fontSize'];\n                label_chips.lineHeight = me.fontStyle['chips']['lineHeight'];\n                //头像\n                var node_mark = new cc.Node();\n                node_mark.name='avatar';\n                var mask_user = node_mark.addComponent(cc.Mask);\n                mask_user.type = cc.Mask.ELLIPSE;\n                node_mark.width = node_size['width']-15;\n                node_mark.height = node_size['height']-15;\n                node_mark.setPosition(0.5,0.5);\n                node_mark.parent =  seat_node;\n                \n                var node_user = new cc.Node();\n                var sprite_user = node_user.addComponent(cc.Sprite);\n                node_user.parent = node_mark;\n                if(v['avatar'] != null && v['avatar']!=\"\"){\n                    node_user.scale = (node_size['width']-15)/120;\n                    load_avatar(v['avatar'],sprite_user);\n                }else{\n                    sprite_user.spriteFrame =  me.GameMain.getSpriteFrame(\"game_seat_valid\");\n                }\n\n                seat_node.getChildByName(\"game_tip\").setLocalZOrder(2);\n\n                if(v['chair_id'] == table_data['start']['sb_chair']){\n                    sb_data = v;\n                }else if(v['chair_id'] == table_data['start']['bb_chair']){\n                    bb_data = v;\n                }\n            }\n            //牌局名字\n            var label = node_table_bg.getChildByName(\"table_name\").getComponent(cc.Label);\n            label.string = \"§ \" + table_data['table_name'] + \" §\";\n            label.fontSize = me.fontStyle['table_name']['fontSize'];\n            label.lineHeight = me.fontStyle['table_name']['lineHeight'];\n\n            //牌局号,如果是快速牌局显示牌局号，如果是俱乐部牌局，显示盲注\n            if(parseInt(table_data['table_code'])!=0){\n                var label_table_code = node_table_bg.getChildByName(\"table_code\").getComponent(cc.Label);\n                label_table_code.string = table_data['table_code'];\n                label_table_code.fontSize = me.fontStyle['table_code']['fontSize'];\n                label_table_code.lineHeight = me.fontStyle['table_code']['lineHeight'];\n            }\n            //盲注\n            var label_table_sb = node_table_bg.getChildByName(\"table_sb\").getComponent(cc.Label);\n            label_table_sb.string = me.ConvertLang(\"blind\")+\" \"+sb_data['table_chip']+\"/\"+bb_data['table_chip'];\n            label_table_sb.fontSize = me.fontStyle['table_sb']['fontSize'];\n            label_table_sb.lineHeight = me.fontStyle['table_sb']['lineHeight'];\n\n            //删除加载图片\n            var splash = document.getElementById('splash');\n            if(undefined!=splash){\n                splash.style.display = 'none';\n            }\n        });\n\n    },\n    //监听座位点击事件\n    onSeat:function(){\n        cc.log(\"onSeat init\");\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n        for(var i=0;i<9;i++){\n            //var v = table_data['players'][k];\n            var seat_node = node_table_bg.getChildByName(\"seat_\"+i);\n            seat_node.on(\"mouseup\",function(event){\n                this.seatClick (event);\n            },this);\n        }\n    },\n    //点击座位坐下 未完成\n    seatClick:function(e){\n        var me = this;\n\n        var rName = cc.random0To1();\n        var v={};\n        v[\"nick\"]   =   \"波霸\"+rName;\n        v[\"remain_chip\"]    =   \"1000\";\n        v[\"table_chip\"]     =   \"10\";\n        //v[\"avatar\"]         =   \"/1_5734451068aaa.jpg\";\n        v[\"avatar\"]         =   \"\";\n\n\n        if(me.ws){\n            //请求后台坐下\n            if (me.ws.readyState === WebSocket.OPEN) {\n                cc.log(\"send message to server3000\");\n                me.ws.send(JSON.stringify({C2S_Join: {\n                                    UserId: '123456',\n                                    UserName:v[\"nick\"],\n                                    TableId:'22222',\n                                    UserToken:'33333',\n                                }}));\n                me.ws.send(JSON.stringify({C2S_Login: {\n                    UserAccount: \"tian\",\n                    UserName: \"nick\",\n                    UserPassword: \"123456\",\n                }}));\n            }\n            else {\n                this.wsstart();\n                console.log(\"WebSocket instance wasn't ready...\");\n            }\n        };\n        var seatName = e.currentTarget._name;\n\n\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n        var seat_node = node_table_bg.getChildByName(seatName);\n        var node_size = seat_node.getContentSize();//获取node的尺寸\n        //名字\n        var label_nick = seat_node.getChildByName(\"nick\").getComponent(cc.Label);\n        label_nick.string = me.getLength(v['nick'])>10?me.cutStr(v['nick'],7):v['nick'];\n        label_nick.fontSize = 30;\n        label_nick.lineHeight = 30;\n\n        //带入的筹码\n        var label_chips = seat_node.getChildByName(\"chips\").getComponent(cc.Label);\n        label_chips.string = v['remain_chip']+v['table_chip'];\n        label_chips.fontSize = 30;\n        label_chips.lineHeight = 30;\n\n        //头像\n        var node_mark = new cc.Node();\n        node_mark.name='avatar';\n        var mask_user = node_mark.addComponent(cc.Mask);\n        mask_user.type = cc.Mask.ELLIPSE;\n        node_mark.width = node_size['width']-15;\n        node_mark.height = node_size['height']-15;\n        node_mark.setPosition(0.5,0.5);\n        node_mark.parent =  seat_node;\n\n        var node_user = new cc.Node();\n        var sprite_user = node_user.addComponent(cc.Sprite);\n        node_user.parent = node_mark;\n        if(v['avatar'] != null && v['avatar']!=\"\"){\n            //异步加载头像，不能放在循环内\n            var load_avatar = function(url,sprite_user){\n                cc.loader.load(url,function(err,tex){\n                    var frame  = new cc.SpriteFrame(tex,cc.Rect(0, 0, 87, 123));\n                    sprite_user.spriteFrame = frame;\n                });\n            };\n            node_user.scale = (node_size['width']-15)/120;\n            load_avatar(v['avatar'],sprite_user);\n        }else{\n            if(this.GameMain == null){\n                cc.loader.loadRes(\"GameMain_6p\",cc.SpriteAtlas,function(err,atlas){\n                    this.GameMain = atlas;\n                    sprite_user.spriteFrame =  this.GameMain.getSpriteFrame(\"game_seat_valid\");\n                });\n            }else{\n                sprite_user.spriteFrame =  this.GameMain.getSpriteFrame(\"game_seat_valid\");\n            }\n        }\n        seat_node.getChildByName(\"game_tip\").setLocalZOrder(2);\n    },\n    //js获取当前url的参数\n    getQueryString:function(name){\n        if(undefined==window.location){\n            return null;\n        };\n        var reg = new RegExp(\"(^|&)\"+ name +\"=([^&]*)(&|$)\");\n        var r = window.location.search.substr(1).match(reg);\n        if(r!=null){\n            return  unescape(r[2]);\n        }else{\n            return null;\n        }\n    },\n    //获取字符串长度\n    getLength:function (str) {\n        ///<summary>获得字符串实际长度，中文2，英文1</summary>\n        ///<param name=\"str\">要获得长度的字符串</param>\n        var realLength = 0, len = str.length, charCode = -1;\n        for (var i = 0; i < len; i++) {\n            charCode = str.charCodeAt(i);\n            if (charCode >= 0 && charCode <= 128) realLength += 1;\n            else realLength += 2;\n        }\n        return realLength;\n    },\n    //s截取字符串，中英文都能用@param str：需要截取的字符串@param len: 需要截取的长度\n    cutStr:function (str, len) {\n        var str_length = 0;\n        var str_len = str.length;\n        var str_cut = new String();\n        for (var i = 0; i < str_len; i++) {\n            var a = str.charAt(i);\n            str_length++;\n            if (escape(a).length > 4) {\n                //中文字符的长度经编码之后大于4\n                str_length++;\n            }\n            str_cut = str_cut.concat(a);\n            if (str_length >= len) {\n                str_cut = str_cut.concat(\"...\");\n                return str_cut;\n            }\n        }\n        //如果给定字符串小于指定长度，则返回源字符串；\n        if (str_length < len) {\n            return str;\n        }\n    },\n\n    //开启静音模式status:0-关闭1-开启\n    set_mute:function(){\n        var sprite_url = \"\";\n        if(this.open_mute == 1){\n            this.open_mute = 0;\n            sprite_url='open_audio';\n        }else{\n            this.open_mute = 1;\n            sprite_url='close_audio';\n        }\n        var fast_forward =cc.find(\"Canvas/sound\");\n        var sprite = fast_forward.getComponent(cc.Sprite);\n        sprite.spriteFrame = this.GameMain.getSpriteFrame(sprite_url);\n    },\n    //判断是否是手机访问\n    isMobile:function(){\n        var ua = navigator.userAgent;\n        var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/),\n        isIphone = !ipad && ua.match(/(iPhone\\sOS)\\s([\\d_]+)/),\n        isAndroid = ua.match(/(Android)\\s+([\\d.]+)/),\n        isMobile = isIphone || isAndroid;\n        var bool = isMobile === null?0:1;\n        return bool;\n    },\n    //语言翻译\n    ConvertLang:function(key){\n        var config_lang={};\n        config_lang['zh-cn']={\"pot\":\"底池\",\"blind\":\"盲注\",\"mute\":\"静音\",\"no_think\":\"忽略思考时间\"};\n        config_lang['zh-tw']={\"pot\":\"底池\",\"blind\":\"盲注\",\"mute\":\"靜音\",\"no_think\":\"忽略思考時間\"};\n        config_lang['thai-th']={\"pot\":\"กองกลาง\",\"blind\":\"Stakes\",\"mute\":\"ปิดเสียง\",\"no_think\":\"fast-forwward\"};\n        config_lang['en-us']={\"pot\":\"Pot\",\"blind\":\"Stakes\",\"mute\":\"Mute\",\"no_think\":\"fast-forwward\"};\n        config_lang['ko']={\"pot\":\"바닥풀 \",\"blind\":\"맹주\",\"mute\":\"정음 \",\"no_think\":\"忽略思考时间\"};\n        return config_lang[this.Lang][key];\n    },\n    //多语言替换座位\n    //ReplaceSeat:function(){\n    //    if(this.Lang == 'thai-th'){\n    //        for(var i=0;i<9;i++){\n    //            cc.find(\"Canvas/table_bg/seat_\"+i).getComponent(cc.Sprite).setVisible(false);\n    //        }\n    //        cc.loader.loadRes(\"GameMain_th_6p\",cc.SpriteAtlas,function(err,atlas){\n    //            var game_seat_empty = atlas.getSpriteFrame(\"game_seat_empty\");\n    //            for(var i=0;i<9;i++){\n    //                var sprite = cc.find(\"Canvas/table_bg/seat_\"+i).getComponent(cc.Sprite)\n    //                sprite.spriteFrame = game_seat_empty;\n    //                sprite.setVisible(true);\n    //            }\n    //        });\n    //    }\n    //}\n});"
  },
  {
    "path": "bin/client/assets/Script/Common.js.meta",
    "content": "{\n  \"ver\": \"1.0.2\",\n  \"uuid\": \"b91d4d1c-d6e8-4abe-8ab4-226f9e1dce57\",\n  \"isPlugin\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Script/CountDown.js",
    "content": "var Common = require('Common');\ncc.Class({\n    extends: Common,\n    properties: {\n        //倒计时\n        countdown_execution_interval:0.1,//执行间隔\n        countdown_repeat_num:0,//重复了多少次\n        countdown_long_time:0,//倒计时时长，单位:秒\n        countdown_cycle_time:15,//倒计时一圈的时间，单位:秒\n        countdown_node:{\n            default:null,\n            type:cc.Node\n        },//倒计时，遮罩层所在的node\n        countdown_task:null,//倒计时执行任务,是一个function，方便销毁定时器\n        countdown_over_task:null,//倒计时结束，是一个function，执行完毕，最后会执行这个\n        //动作列表\n        actions:null,\n        //正在进行的动作\n        i:0,\n        //该牌局的是数据\n        hand_data:null\n    },\n    //添加倒计时的进度条\n    add_countdown:function(seat_number,long_time){\n        var me = this;\n        var action_num = this.i-1;//当前第几个动作\n        if(parseInt(long_time) == 0 ){\n            this.scheduleOnce(function(){\n                me.scheduleOnce(this.countdown_over_task,0);\n            },1);\n            var action_type = this.open_fixedThinkTime == 1?1:0;//动作状态 0-正常1-快进\n            //判断是否有正在进行的其他动作\n            this.scheduleOnce(function(){\n                this.start_others(action_type,0,action_num);\n            },0.5);\n            return false;\n        }else{\n            //判断是否开启固定思考模式\n            if(me.open_fixedThinkTime == 1){\n                long_time = me.fixedThinkTime;\n            }\n        }\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n        //初始化\n        this.countdown_repeat_num = 0;\n        this.countdown_long_time = 0;\n        this.countdown_cycle_time = 15;\n        if(this.countdown_task!= null){\n            this.unschedule(this.countdown_task);//删除定时任务\n            this.countdown_node.destroy();//删除该节点\n        }\n        var seat = node_table_bg.getChildByName(\"seat_\"+seat_number);//获取该作为的节点\n\n        //倒计时遮罩层\n        var node = new cc.Node();\n        node.scale = 0.85;\n        //node.setPosition(seat_position);\n        //node.parent = node_table_bg;\n        node.parent = seat;\n        node.setPosition(0.5,0.5);\n        node.setLocalZOrder(3);\n        var sprite = node.addComponent(cc.Sprite);\n        sprite.type = cc.Sprite.Type.FILLED;\n        sprite.fillType = cc.Sprite.FillType.RADIAL;\n        sprite.fillCenter = new cc.Vec2(0.5,0.5);\n        sprite.fillStart = 0.25;\n        sprite.fillRange = 0;\n        var frame = this.GameMain.getSpriteFrame(\"game_progress_frame\");\n        sprite.spriteFrame = frame;\n        //倒计时文字\n        var node2 = new cc.Node();\n        node2.name = \"time\";\n        var label = node2.addComponent(cc.Label);\n        label.string = this.countdown_cycle_time + \"s\";\n        label.fontSize = 30;//设置字体大小\n        node2.parent = node;\n        //node2.color = new cc.Color(0, 0, 0);//设置字体颜色\n        node2.setPosition(0,-10);\n\n        this.countdown_node = node;\n        this.countdown_long_time = long_time;//执行时长\n        this.countdown_task = function(){\n            this.start_countdown(1,action_num);\n        };\n        this.schedule(this.countdown_task,this.countdown_execution_interval);\n    },\n    //倒计时开始 direction(方向):1-顺时针2-逆时针\n    start_countdown:function(direction,action_num){\n        this.countdown_repeat_num++;//已经执行了多少次\n        var full_cycle = 1;//一个整圈\n        var speed = full_cycle / this.countdown_cycle_time;//速度\n\n        var sprite = this.countdown_node.getComponent(cc.Sprite);\n        var fillRange = sprite.fillRange;\n        var cost_time = this.countdown_execution_interval * this.countdown_repeat_num;//耗时\n        if(parseInt(cost_time) == cost_time ){\n            var time_node = this.countdown_node.getChildByName(\"time\");\n            var time_label = time_node.getComponent(cc.Label);\n            time_label.string =  (parseInt(time_label.string) - 1)+\"s\";\n        }\n\n        if(direction == 2){\n            //逆时针\n            fillRange = cost_time < this.countdown_long_time ? fillRange += (this.countdown_execution_interval * speed):0;\n        }else{\n            //顺时针\n            fillRange = cost_time < this.countdown_long_time ? fillRange -= (this.countdown_execution_interval * speed):0;\n        }\n        sprite.fillRange = fillRange;\n        //如果开启固定思考时间的设置，并且这个过程的执行时间大于思考时间时，直接结束倒计时\n        var action_type = 0;//动作状态 0-正常1-快进\n        if(this.open_fixedThinkTime == 1 && this.countdown_long_time >= this.fixedThinkTime){\n            fillRange = 0;\n            action_type = 1;\n        }\n        //判断是否有正在进行的其他动作\n        this.start_others(action_type,cost_time,action_num);\n\n        if(fillRange == 0){\n            this.unschedule(this.countdown_task);//删除定时任务\n            this.countdown_node.destroy();//删除该节点\n            this.countdown_task = null;\n            //如果执行完毕，判断是否有下一步动作，如果有，执行下一步\n            if(this.countdown_over_task != null){\n                this.scheduleOnce(this.countdown_over_task,0);\n            }\n        }\n    },\n    //延长时间\n    delay_countdown:function(seat_number,duration){\n        var remain_time = parseInt(this.countdown_cycle_time - duration);//剩余的时间\n        var total_time = 15 + remain_time;\n        this.countdown_cycle_time = total_time; //一圈的总耗时\n        this.countdown_repeat_num = 0; //已经执行了多少\n        if(this.countdown_task!= null){\n            this.unschedule(this.countdown_task);//删除定时任务\n            this.countdown_node.destroy();//删除该节点\n        }\n        //延时\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n        var seat = node_table_bg.getChildByName(\"seat_\"+seat_number);//获取该作为的节点\n        //倒计时遮罩层\n        var node = new cc.Node();\n        node.scale = 0.85;\n        node.parent = seat;\n        node.setPosition(0.5,0.5);\n        node.setLocalZOrder(3);\n        var sprite = node.addComponent(cc.Sprite);\n        sprite.type = cc.Sprite.Type.FILLED;\n        sprite.fillType = cc.Sprite.FillType.RADIAL;\n        sprite.fillCenter = new cc.Vec2(0.5,0.5);\n        sprite.fillStart = 0.25;\n        sprite.fillRange = 0;\n        var frame = this.GameMain.getSpriteFrame(\"game_progress_frame\");\n        sprite.spriteFrame = frame;\n        //倒计时文字\n        var node2 = new cc.Node();\n        node2.name = \"time\";\n        var label = node2.addComponent(cc.Label);\n        label.string = this.countdown_cycle_time + \"s\";\n        label.fontSize = 30;//设置字体大小\n        node2.parent = node;\n        node2.setPosition(0,-10);\n\n        this.countdown_node = node;\n        this.countdown_task = function(){\n            this.start_countdown(1);\n        };\n        this.schedule(this.countdown_task,this.countdown_execution_interval);\n        var me = this;\n        this.countdown_over_task = function(){\n            me.actionend();\n        };\n    },\n    //开始执行其他动作:type:0-正常1-快进 cost：已经执行了多少秒,action_num是之前的this.i-1\n    start_others:function(type,cost_time,action_num){\n        //判断等待动作时，是否有其他人进行的动作\n        var current_action = this.actions[action_num];\n        if(current_action!=undefined && current_action['others']!=undefined && current_action['others']!=null){\n            for(var key in current_action['others']){\n                var other_key = current_action['others'][key];\n                var duration = current_action['duration']-(current_action['timestamp']-this.hand_data['others'][other_key]['timestamp']);\n                if(duration<0){\n                    cc.log(\"时间间隔为负，请检查数据\");\n                }\n                if(type == 0 && parseInt(cost_time) == cost_time && cost_time == duration){\n                    //正常流程，待到整点时，进行判断是否有其他的动作\n                    this.other_quit(this.hand_data['others'][other_key]['chair_id']);\n                }\n                //duration<cost_time表示如果已经执行过了，不再执行\n                if(type == 1 && duration>=cost_time){\n                    //快进时，判断等待动作时，是否有其他人进行的动作(未执行过的)\n                    this.other_quit(this.hand_data['others'][other_key]['chair_id']);\n                }\n            }\n        }\n    },\n    //ajax 请求\n    reqstart:function(){\n        var hand_id = this.getQueryString(\"hand_id\");\n        var url=\"\";\n        //hand_id = 32634;\n        //hand_id = 32928;\n        //hand_id = 33305;\n        //hand_id = 33308;\n        //hand_id=33310;\n        //hand_id=33509;\n        if(hand_id != null){\n            var host_name = window.location.host;\n            var reg = /^localhost:/;\n            if(reg.test(host_name)==true){\n                url = \"http://qa-api.kkpoker.com:8090/Html/get_mongo_data/hand_id/\"+hand_id;\n            }else{\n                url = \"http://\" + host_name + \"/Html/get_mongo_data/hand_id/\"+hand_id;\n            }\n        }else{\n            //测试数据\n            url=\"http://172.16.0.210:2016/info.php\";\n         }\n\n\n        var xhr = new XMLHttpRequest();\n        xhr.open(\"GET\", url, true);\n        xhr.send();\n        var me=this;\n        xhr.onreadystatechange = function () {\n            if (xhr.readyState == 4) {\n                if (xhr.status == 200) {\n                    var response = eval('(' + xhr.responseText + ')');\n                    response = me.sorting_data(response);\n                    var len = response[\"actions\"].length;\n                    for(var i=0;i<len;i++){\n                        if(i==0){\n                            response[\"actions\"][i][\"duration\"]=response[\"actions\"][i][\"timestamp\"]-response[\"start\"][\"timestamp\"];\n                        }else{\n                            if(response[\"actions\"][i-1]['CMD'] == 19){\n                                response[\"actions\"][i][\"duration\"] = 0;\n                            }else{\n                                response[\"actions\"][i][\"duration\"]=response[\"actions\"][i][\"timestamp\"]-response[\"actions\"][i-1][\"timestamp\"];\n                            }\n                        }\n                    }\n                    //初始化动作属性\n                    me.actions = response[\"actions\"];\n                    me.i=0;\n                    me.hand_data = response;\n                    cc.log(JSON.stringify(response));\n                    me.sit_down();//坐下\n                } else {\n\n                }\n            }\n        }\n    },\n\n    //组装action和other\n    sorting_data:function(hand_data){\n        //过滤掉无用的others动作\n        if(hand_data['others']!=undefined){\n            var others_data=[];\n            for(var key in hand_data['others']){\n                if(hand_data['others'][key]['CMD'] == 5 ){\n                    hand_data['others'][key]['type']='others';\n                    others_data.push(hand_data['others'][key]);\n                }\n            }\n            hand_data['others']=others_data;\n        }\n        var action_data=[];\n        if(hand_data['actions']!=undefined){\n            action_data = action_data.concat(hand_data['actions']);\n        }\n        if(hand_data['others']!=undefined){\n            action_data = action_data.concat(hand_data['others']);\n        }\n        var action_data_len = action_data.length;\n        //按时间排序\n        for(var i=0;i<action_data_len-1;i++){\n           for(var j=i+1;j<action_data_len;j++){\n               if(parseInt(action_data[j]['timestamp'])<parseInt(action_data[i]['timestamp'])){\n                    var a = action_data[i];\n                    action_data[i]=action_data[j];\n                    action_data[j]=a;\n               }\n           }\n        }\n        //找到同时进行的工作\n        var action_result=[];//动作列表\n        var other_result=[];//同时进行的动作\n        for(var i=0;i<action_data_len;i++){\n            var other_is_sum_up=0;//是否需要归纳0-否1-是\n            var data = null;//命令数据\n            if(action_data[i]['type'] == \"others\"){\n                data={\"CMD\":9999,\"chair_id\":action_data[i]['current_action_chair'],\"chip\":0,\"pot\":0,\"timestamp\":action_data[i]['timestamp']}\n                other_result.push(action_data[i]);//把同时进行的动作存起来\n                other_is_sum_up=1;\n            }else{\n                data = action_data[i];\n            }\n            var action_result_len = action_result.length;\n            if(action_result_len>0 && data['CMD']==9999 && data['chair_id'] == action_result[action_result_len-1]['chair_id']){\n                action_result[action_result_len-1]['timestamp']=data['timestamp'];\n                data = null;\n            }\n            //有可能同时做的动作，其他人都没正在做动作\n            if(data != null && data['chair_id']!=0){\n                action_result.push(data);\n            }\n            if(other_is_sum_up == 1){\n                var sort_num = action_result.length - 1;\n                //把other动作绑定到action动作当中\n                if(action_result[sort_num]['others']==undefined){\n                    action_result[sort_num]['others']=[other_result.length-1];\n                }else{\n                    action_result[sort_num]['others'].push(other_result.length-1);\n                }\n            }\n        }\n        //再次归纳action动作\n        var action_result2 = [];\n        for(var i=0;i<action_result.length;i++){\n            var is_in=1;//是否放入action_result2\n            if(action_result[i+1]!=undefined && action_result[i+1]!=null){\n                //如果该动作与下一个动作都是9999，且chair_id相等的话，归纳到一起，或者下一个正在进行的是99的话，修改下一个的chair_id为上一个\n                if(action_result[i]['CMD']==9999 && (action_result[i]['chair_id'] == action_result[i+1]['chair_id'] ||  action_result[i+1]['chair_id']==99)){\n                    action_result[i+1]['chair_id']=action_result[i+1]['chair_id']==99?action_result[i]['chair_id']:action_result[i+1]['chair_id'];\n                    action_result[i+1]['others']=action_result[i+1]['others']?action_result[i+1]['others']:[];\n                    action_result[i+1]['others']=action_result[i]['others'].concat(action_result[i+1]['others']);\n                    is_in=0;\n                }\n            }else if(action_result[i]['CMD']==9999 && action_result[i]['chair_id']==99 & i>0){\n                if(action_result2.length>0){\n                    action_result[i]['chair_id'] = action_result2[action_result2.length-1]['current_action_chair'];\n                    //修正：如果发现chair_id=99，无效的操作人，找到这个命令的其他操作的人，座位为当前这个人\n                    if(action_result[i]['chair_id']==99 && action_result[i]['others']!=undefined){\n                        action_result[i]['chair_id'] = hand_data['others'][action_result[i]['others'][0]]['chair_id'];\n                    }\n                }\n            }else if(action_result[i]['CMD']==9999 && action_result[i]['chair_id']==99 & action_result.length == 1){\n                //修正：当只有一个9999的动作时，当时正在进行的动作是小盲在思考\n                action_result[i]['chair_id'] = hand_data['start']['sb_chair'];\n            }\n\n            if(is_in==1){\n                action_result2.push(action_result[i]);\n            }\n        }\n        hand_data['actions']=action_result2;\n        hand_data['others']=other_result;\n        return hand_data;\n    }\n});\n"
  },
  {
    "path": "bin/client/assets/Script/CountDown.js.meta",
    "content": "{\n  \"ver\": \"1.0.2\",\n  \"uuid\": \"ac50a2dc-5c7b-450e-8387-93e1500ca396\",\n  \"isPlugin\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Script/Encoding.js",
    "content": "// This is free and unencumbered software released into the public domain.\n// See LICENSE.md for more information.\n\n// If we're in node require encoding-indexes and attach it to the global.\n/**\n * @fileoverview Global |this| required for resolving indexes in node.\n * @suppress {globalThis}\n */\nif (typeof module !== \"undefined\" && module.exports) {\n    this[\"encoding-indexes\"] =\n        require(\"./encoding-indexes.js\")[\"encoding-indexes\"];\n}\n\n(function(global) {\n    'use strict';\n\n    //\n    // Utilities\n    //\n\n    /**\n     * @param {number} a The number to test.\n     * @param {number} min The minimum value in the range, inclusive.\n     * @param {number} max The maximum value in the range, inclusive.\n     * @return {boolean} True if a >= min and a <= max.\n     */\n    function inRange(a, min, max) {\n        return min <= a && a <= max;\n    }\n\n    /**\n     * @param {number} n The numerator.\n     * @param {number} d The denominator.\n     * @return {number} The result of the integer division of n by d.\n     */\n    function div(n, d) {\n        return Math.floor(n / d);\n    }\n\n    /**\n     * @param {*} o\n     * @return {Object}\n     */\n    function ToDictionary(o) {\n        if (o === undefined) return {};\n        if (o === Object(o)) return o;\n        throw TypeError('Could not convert argument to dictionary');\n    }\n\n    /**\n     * @param {string} string Input string of UTF-16 code units.\n     * @return {!Array.<number>} Code points.\n     */\n    function stringToCodePoints(string) {\n        // https://heycam.github.io/webidl/#dfn-obtain-unicode\n\n        // 1. Let S be the DOMString value.\n        var s = String(string);\n\n        // 2. Let n be the length of S.\n        var n = s.length;\n\n        // 3. Initialize i to 0.\n        var i = 0;\n\n        // 4. Initialize U to be an empty sequence of Unicode characters.\n        var u = [];\n\n        // 5. While i < n:\n        while (i < n) {\n\n            // 1. Let c be the code unit in S at index i.\n            var c = s.charCodeAt(i);\n\n            // 2. Depending on the value of c:\n\n            // c < 0xD800 or c > 0xDFFF\n            if (c < 0xD800 || c > 0xDFFF) {\n                // Append to U the Unicode character with code point c.\n                u.push(c);\n            }\n\n            // 0xDC00 ≤ c ≤ 0xDFFF\n            else if (0xDC00 <= c && c <= 0xDFFF) {\n                // Append to U a U+FFFD REPLACEMENT CHARACTER.\n                u.push(0xFFFD);\n            }\n\n            // 0xD800 ≤ c ≤ 0xDBFF\n            else if (0xD800 <= c && c <= 0xDBFF) {\n                // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT\n                // CHARACTER.\n                if (i === n - 1) {\n                    u.push(0xFFFD);\n                }\n                // 2. Otherwise, i < n−1:\n                else {\n                    // 1. Let d be the code unit in S at index i+1.\n                    var d = string.charCodeAt(i + 1);\n\n                    // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:\n                    if (0xDC00 <= d && d <= 0xDFFF) {\n                        // 1. Let a be c & 0x3FF.\n                        var a = c & 0x3FF;\n\n                        // 2. Let b be d & 0x3FF.\n                        var b = d & 0x3FF;\n\n                        // 3. Append to U the Unicode character with code point\n                        // 2^16+2^10*a+b.\n                        u.push(0x10000 + (a << 10) + b);\n\n                        // 4. Set i to i+1.\n                        i += 1;\n                    }\n\n                    // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a\n                    // U+FFFD REPLACEMENT CHARACTER.\n                    else  {\n                        u.push(0xFFFD);\n                    }\n                }\n            }\n\n            // 3. Set i to i+1.\n            i += 1;\n        }\n\n        // 6. Return U.\n        return u;\n    }\n\n    /**\n     * @param {!Array.<number>} code_points Array of code points.\n     * @return {string} string String of UTF-16 code units.\n     */\n    function codePointsToString(code_points) {\n        var s = '';\n        for (var i = 0; i < code_points.length; ++i) {\n            var cp = code_points[i];\n            if (cp <= 0xFFFF) {\n                s += String.fromCharCode(cp);\n            } else {\n                cp -= 0x10000;\n                s += String.fromCharCode((cp >> 10) + 0xD800,\n                    (cp & 0x3FF) + 0xDC00);\n            }\n        }\n        return s;\n    }\n\n\n    //\n    // Implementation of Encoding specification\n    // https://encoding.spec.whatwg.org/\n    //\n\n    //\n    // 3. Terminology\n    //\n\n    /**\n     * End-of-stream is a special token that signifies no more tokens\n     * are in the stream.\n     * @const\n     */ var end_of_stream = -1;\n\n    /**\n     * A stream represents an ordered sequence of tokens.\n     *\n     * @constructor\n     * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide the\n     * stream.\n     */\n    function Stream(tokens) {\n        /** @type {!Array.<number>} */\n        this.tokens = [].slice.call(tokens);\n    }\n\n    Stream.prototype = {\n        /**\n         * @return {boolean} True if end-of-stream has been hit.\n         */\n        endOfStream: function() {\n            return !this.tokens.length;\n        },\n\n        /**\n         * When a token is read from a stream, the first token in the\n         * stream must be returned and subsequently removed, and\n         * end-of-stream must be returned otherwise.\n         *\n         * @return {number} Get the next token from the stream, or\n         * end_of_stream.\n         */\n        read: function() {\n            if (!this.tokens.length)\n                return end_of_stream;\n            return this.tokens.shift();\n        },\n\n        /**\n         * When one or more tokens are prepended to a stream, those tokens\n         * must be inserted, in given order, before the first token in the\n         * stream.\n         *\n         * @param {(number|!Array.<number>)} token The token(s) to prepend to the stream.\n         */\n        prepend: function(token) {\n            if (Array.isArray(token)) {\n                var tokens = /**@type {!Array.<number>}*/(token);\n                while (tokens.length)\n                    this.tokens.unshift(tokens.pop());\n            } else {\n                this.tokens.unshift(token);\n            }\n        },\n\n        /**\n         * When one or more tokens are pushed to a stream, those tokens\n         * must be inserted, in given order, after the last token in the\n         * stream.\n         *\n         * @param {(number|!Array.<number>)} token The tokens(s) to prepend to the stream.\n         */\n        push: function(token) {\n            if (Array.isArray(token)) {\n                var tokens = /**@type {!Array.<number>}*/(token);\n                while (tokens.length)\n                    this.tokens.push(tokens.shift());\n            } else {\n                this.tokens.push(token);\n            }\n        }\n    };\n\n    //\n    // 4. Encodings\n    //\n\n    // 4.1 Encoders and decoders\n\n    /** @const */\n    var finished = -1;\n\n    /**\n     * @param {boolean} fatal If true, decoding errors raise an exception.\n     * @param {number=} opt_code_point Override the standard fallback code point.\n     * @return {number} The code point to insert on a decoding error.\n     */\n    function decoderError(fatal, opt_code_point) {\n        if (fatal)\n            throw TypeError('Decoder error');\n        return opt_code_point || 0xFFFD;\n    }\n\n    /**\n     * @param {number} code_point The code point that could not be encoded.\n     * @return {number} Always throws, no value is actually returned.\n     */\n    function encoderError(code_point) {\n        throw TypeError('The code point ' + code_point + ' could not be encoded.');\n    }\n\n    /** @interface */\n    function Decoder() {}\n    Decoder.prototype = {\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point, or |finished|.\n         */\n        handler: function(stream, bite) {}\n    };\n\n    /** @interface */\n    function Encoder() {}\n    Encoder.prototype = {\n        /**\n         * @param {Stream} stream The stream of code points being encoded.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit, or |finished|.\n         */\n        handler: function(stream, code_point) {}\n    };\n\n    // 4.2 Names and labels\n\n    // TODO: Define @typedef for Encoding: {name:string,labels:Array.<string>}\n    // https://github.com/google/closure-compiler/issues/247\n\n    /**\n     * @param {string} label The encoding label.\n     * @return {?{name:string,labels:Array.<string>}}\n     */\n    function getEncoding(label) {\n        // 1. Remove any leading and trailing ASCII whitespace from label.\n        label = String(label).trim().toLowerCase();\n\n        // 2. If label is an ASCII case-insensitive match for any of the\n        // labels listed in the table below, return the corresponding\n        // encoding, and failure otherwise.\n        if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {\n            return label_to_encoding[label];\n        }\n        return null;\n    }\n\n    /**\n     * Encodings table: https://encoding.spec.whatwg.org/encodings.json\n     * @const\n     * @type {!Array.<{\n   *          heading: string,\n   *          encodings: Array.<{name:string,labels:Array.<string>}>\n   *        }>}\n     */\n    var encodings = [\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"unicode-1-1-utf-8\",\n                        \"utf-8\",\n                        \"utf8\"\n                    ],\n                    \"name\": \"utf-8\"\n                }\n            ],\n            \"heading\": \"The Encoding\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"866\",\n                        \"cp866\",\n                        \"csibm866\",\n                        \"ibm866\"\n                    ],\n                    \"name\": \"ibm866\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatin2\",\n                        \"iso-8859-2\",\n                        \"iso-ir-101\",\n                        \"iso8859-2\",\n                        \"iso88592\",\n                        \"iso_8859-2\",\n                        \"iso_8859-2:1987\",\n                        \"l2\",\n                        \"latin2\"\n                    ],\n                    \"name\": \"iso-8859-2\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatin3\",\n                        \"iso-8859-3\",\n                        \"iso-ir-109\",\n                        \"iso8859-3\",\n                        \"iso88593\",\n                        \"iso_8859-3\",\n                        \"iso_8859-3:1988\",\n                        \"l3\",\n                        \"latin3\"\n                    ],\n                    \"name\": \"iso-8859-3\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatin4\",\n                        \"iso-8859-4\",\n                        \"iso-ir-110\",\n                        \"iso8859-4\",\n                        \"iso88594\",\n                        \"iso_8859-4\",\n                        \"iso_8859-4:1988\",\n                        \"l4\",\n                        \"latin4\"\n                    ],\n                    \"name\": \"iso-8859-4\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatincyrillic\",\n                        \"cyrillic\",\n                        \"iso-8859-5\",\n                        \"iso-ir-144\",\n                        \"iso8859-5\",\n                        \"iso88595\",\n                        \"iso_8859-5\",\n                        \"iso_8859-5:1988\"\n                    ],\n                    \"name\": \"iso-8859-5\"\n                },\n                {\n                    \"labels\": [\n                        \"arabic\",\n                        \"asmo-708\",\n                        \"csiso88596e\",\n                        \"csiso88596i\",\n                        \"csisolatinarabic\",\n                        \"ecma-114\",\n                        \"iso-8859-6\",\n                        \"iso-8859-6-e\",\n                        \"iso-8859-6-i\",\n                        \"iso-ir-127\",\n                        \"iso8859-6\",\n                        \"iso88596\",\n                        \"iso_8859-6\",\n                        \"iso_8859-6:1987\"\n                    ],\n                    \"name\": \"iso-8859-6\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatingreek\",\n                        \"ecma-118\",\n                        \"elot_928\",\n                        \"greek\",\n                        \"greek8\",\n                        \"iso-8859-7\",\n                        \"iso-ir-126\",\n                        \"iso8859-7\",\n                        \"iso88597\",\n                        \"iso_8859-7\",\n                        \"iso_8859-7:1987\",\n                        \"sun_eu_greek\"\n                    ],\n                    \"name\": \"iso-8859-7\"\n                },\n                {\n                    \"labels\": [\n                        \"csiso88598e\",\n                        \"csisolatinhebrew\",\n                        \"hebrew\",\n                        \"iso-8859-8\",\n                        \"iso-8859-8-e\",\n                        \"iso-ir-138\",\n                        \"iso8859-8\",\n                        \"iso88598\",\n                        \"iso_8859-8\",\n                        \"iso_8859-8:1988\",\n                        \"visual\"\n                    ],\n                    \"name\": \"iso-8859-8\"\n                },\n                {\n                    \"labels\": [\n                        \"csiso88598i\",\n                        \"iso-8859-8-i\",\n                        \"logical\"\n                    ],\n                    \"name\": \"iso-8859-8-i\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatin6\",\n                        \"iso-8859-10\",\n                        \"iso-ir-157\",\n                        \"iso8859-10\",\n                        \"iso885910\",\n                        \"l6\",\n                        \"latin6\"\n                    ],\n                    \"name\": \"iso-8859-10\"\n                },\n                {\n                    \"labels\": [\n                        \"iso-8859-13\",\n                        \"iso8859-13\",\n                        \"iso885913\"\n                    ],\n                    \"name\": \"iso-8859-13\"\n                },\n                {\n                    \"labels\": [\n                        \"iso-8859-14\",\n                        \"iso8859-14\",\n                        \"iso885914\"\n                    ],\n                    \"name\": \"iso-8859-14\"\n                },\n                {\n                    \"labels\": [\n                        \"csisolatin9\",\n                        \"iso-8859-15\",\n                        \"iso8859-15\",\n                        \"iso885915\",\n                        \"iso_8859-15\",\n                        \"l9\"\n                    ],\n                    \"name\": \"iso-8859-15\"\n                },\n                {\n                    \"labels\": [\n                        \"iso-8859-16\"\n                    ],\n                    \"name\": \"iso-8859-16\"\n                },\n                {\n                    \"labels\": [\n                        \"cskoi8r\",\n                        \"koi\",\n                        \"koi8\",\n                        \"koi8-r\",\n                        \"koi8_r\"\n                    ],\n                    \"name\": \"koi8-r\"\n                },\n                {\n                    \"labels\": [\n                        \"koi8-ru\",\n                        \"koi8-u\"\n                    ],\n                    \"name\": \"koi8-u\"\n                },\n                {\n                    \"labels\": [\n                        \"csmacintosh\",\n                        \"mac\",\n                        \"macintosh\",\n                        \"x-mac-roman\"\n                    ],\n                    \"name\": \"macintosh\"\n                },\n                {\n                    \"labels\": [\n                        \"dos-874\",\n                        \"iso-8859-11\",\n                        \"iso8859-11\",\n                        \"iso885911\",\n                        \"tis-620\",\n                        \"windows-874\"\n                    ],\n                    \"name\": \"windows-874\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1250\",\n                        \"windows-1250\",\n                        \"x-cp1250\"\n                    ],\n                    \"name\": \"windows-1250\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1251\",\n                        \"windows-1251\",\n                        \"x-cp1251\"\n                    ],\n                    \"name\": \"windows-1251\"\n                },\n                {\n                    \"labels\": [\n                        \"ansi_x3.4-1968\",\n                        \"ascii\",\n                        \"cp1252\",\n                        \"cp819\",\n                        \"csisolatin1\",\n                        \"ibm819\",\n                        \"iso-8859-1\",\n                        \"iso-ir-100\",\n                        \"iso8859-1\",\n                        \"iso88591\",\n                        \"iso_8859-1\",\n                        \"iso_8859-1:1987\",\n                        \"l1\",\n                        \"latin1\",\n                        \"us-ascii\",\n                        \"windows-1252\",\n                        \"x-cp1252\"\n                    ],\n                    \"name\": \"windows-1252\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1253\",\n                        \"windows-1253\",\n                        \"x-cp1253\"\n                    ],\n                    \"name\": \"windows-1253\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1254\",\n                        \"csisolatin5\",\n                        \"iso-8859-9\",\n                        \"iso-ir-148\",\n                        \"iso8859-9\",\n                        \"iso88599\",\n                        \"iso_8859-9\",\n                        \"iso_8859-9:1989\",\n                        \"l5\",\n                        \"latin5\",\n                        \"windows-1254\",\n                        \"x-cp1254\"\n                    ],\n                    \"name\": \"windows-1254\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1255\",\n                        \"windows-1255\",\n                        \"x-cp1255\"\n                    ],\n                    \"name\": \"windows-1255\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1256\",\n                        \"windows-1256\",\n                        \"x-cp1256\"\n                    ],\n                    \"name\": \"windows-1256\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1257\",\n                        \"windows-1257\",\n                        \"x-cp1257\"\n                    ],\n                    \"name\": \"windows-1257\"\n                },\n                {\n                    \"labels\": [\n                        \"cp1258\",\n                        \"windows-1258\",\n                        \"x-cp1258\"\n                    ],\n                    \"name\": \"windows-1258\"\n                },\n                {\n                    \"labels\": [\n                        \"x-mac-cyrillic\",\n                        \"x-mac-ukrainian\"\n                    ],\n                    \"name\": \"x-mac-cyrillic\"\n                }\n            ],\n            \"heading\": \"Legacy single-byte encodings\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"chinese\",\n                        \"csgb2312\",\n                        \"csiso58gb231280\",\n                        \"gb2312\",\n                        \"gb_2312\",\n                        \"gb_2312-80\",\n                        \"gbk\",\n                        \"iso-ir-58\",\n                        \"x-gbk\"\n                    ],\n                    \"name\": \"gbk\"\n                },\n                {\n                    \"labels\": [\n                        \"gb18030\"\n                    ],\n                    \"name\": \"gb18030\"\n                }\n            ],\n            \"heading\": \"Legacy multi-byte Chinese (simplified) encodings\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"big5\",\n                        \"big5-hkscs\",\n                        \"cn-big5\",\n                        \"csbig5\",\n                        \"x-x-big5\"\n                    ],\n                    \"name\": \"big5\"\n                }\n            ],\n            \"heading\": \"Legacy multi-byte Chinese (traditional) encodings\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"cseucpkdfmtjapanese\",\n                        \"euc-jp\",\n                        \"x-euc-jp\"\n                    ],\n                    \"name\": \"euc-jp\"\n                },\n                {\n                    \"labels\": [\n                        \"csiso2022jp\",\n                        \"iso-2022-jp\"\n                    ],\n                    \"name\": \"iso-2022-jp\"\n                },\n                {\n                    \"labels\": [\n                        \"csshiftjis\",\n                        \"ms932\",\n                        \"ms_kanji\",\n                        \"shift-jis\",\n                        \"shift_jis\",\n                        \"sjis\",\n                        \"windows-31j\",\n                        \"x-sjis\"\n                    ],\n                    \"name\": \"shift_jis\"\n                }\n            ],\n            \"heading\": \"Legacy multi-byte Japanese encodings\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"cseuckr\",\n                        \"csksc56011987\",\n                        \"euc-kr\",\n                        \"iso-ir-149\",\n                        \"korean\",\n                        \"ks_c_5601-1987\",\n                        \"ks_c_5601-1989\",\n                        \"ksc5601\",\n                        \"ksc_5601\",\n                        \"windows-949\"\n                    ],\n                    \"name\": \"euc-kr\"\n                }\n            ],\n            \"heading\": \"Legacy multi-byte Korean encodings\"\n        },\n        {\n            \"encodings\": [\n                {\n                    \"labels\": [\n                        \"csiso2022kr\",\n                        \"hz-gb-2312\",\n                        \"iso-2022-cn\",\n                        \"iso-2022-cn-ext\",\n                        \"iso-2022-kr\"\n                    ],\n                    \"name\": \"replacement\"\n                },\n                {\n                    \"labels\": [\n                        \"utf-16be\"\n                    ],\n                    \"name\": \"utf-16be\"\n                },\n                {\n                    \"labels\": [\n                        \"utf-16\",\n                        \"utf-16le\"\n                    ],\n                    \"name\": \"utf-16le\"\n                },\n                {\n                    \"labels\": [\n                        \"x-user-defined\"\n                    ],\n                    \"name\": \"x-user-defined\"\n                }\n            ],\n            \"heading\": \"Legacy miscellaneous encodings\"\n        }\n    ];\n\n    // Label to encoding registry.\n    /** @type {Object.<string,{name:string,labels:Array.<string>}>} */\n    var label_to_encoding = {};\n    encodings.forEach(function(category) {\n        category.encodings.forEach(function(encoding) {\n            encoding.labels.forEach(function(label) {\n                label_to_encoding[label] = encoding;\n            });\n        });\n    });\n\n    // Registry of of encoder/decoder factories, by encoding name.\n    /** @type {Object.<string, function({fatal:boolean}): Encoder>} */\n    var encoders = {};\n    /** @type {Object.<string, function({fatal:boolean}): Decoder>} */\n    var decoders = {};\n\n    //\n    // 5. Indexes\n    //\n\n    /**\n     * @param {number} pointer The |pointer| to search for.\n     * @param {(!Array.<?number>|undefined)} index The |index| to search within.\n     * @return {?number} The code point corresponding to |pointer| in |index|,\n     *     or null if |code point| is not in |index|.\n     */\n    function indexCodePointFor(pointer, index) {\n        if (!index) return null;\n        return index[pointer] || null;\n    }\n\n    /**\n     * @param {number} code_point The |code point| to search for.\n     * @param {!Array.<?number>} index The |index| to search within.\n     * @return {?number} The first pointer corresponding to |code point| in\n     *     |index|, or null if |code point| is not in |index|.\n     */\n    function indexPointerFor(code_point, index) {\n        var pointer = index.indexOf(code_point);\n        return pointer === -1 ? null : pointer;\n    }\n\n    /**\n     * @param {string} name Name of the index.\n     * @return {(!Array.<number>|!Array.<Array.<number>>)}\n     *  */\n    function index(name) {\n        if (!('encoding-indexes' in global)) {\n            throw Error(\"Indexes missing.\" +\n                \" Did you forget to include encoding-indexes.js?\");\n        }\n        return global['encoding-indexes'][name];\n    }\n\n    /**\n     * @param {number} pointer The |pointer| to search for in the gb18030 index.\n     * @return {?number} The code point corresponding to |pointer| in |index|,\n     *     or null if |code point| is not in the gb18030 index.\n     */\n    function indexGB18030RangesCodePointFor(pointer) {\n        // 1. If pointer is greater than 39419 and less than 189000, or\n        // pointer is greater than 1237575, return null.\n        if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575))\n            return null;\n\n        // 2. Let offset be the last pointer in index gb18030 ranges that\n        // is equal to or less than pointer and let code point offset be\n        // its corresponding code point.\n        var offset = 0;\n        var code_point_offset = 0;\n        var idx = index('gb18030');\n        var i;\n        for (i = 0; i < idx.length; ++i) {\n            /** @type {!Array.<number>} */\n            var entry = idx[i];\n            if (entry[0] <= pointer) {\n                offset = entry[0];\n                code_point_offset = entry[1];\n            } else {\n                break;\n            }\n        }\n\n        // 3. Return a code point whose value is code point offset +\n        // pointer − offset.\n        return code_point_offset + pointer - offset;\n    }\n\n    /**\n     * @param {number} code_point The |code point| to locate in the gb18030 index.\n     * @return {number} The first pointer corresponding to |code point| in the\n     *     gb18030 index.\n     */\n    function indexGB18030RangesPointerFor(code_point) {\n        // 1. Let offset be the last code point in index gb18030 ranges\n        // that is equal to or less than code point and let pointer offset\n        // be its corresponding pointer.\n        var offset = 0;\n        var pointer_offset = 0;\n        var idx = index('gb18030');\n        var i;\n        for (i = 0; i < idx.length; ++i) {\n            /** @type {!Array.<number>} */\n            var entry = idx[i];\n            if (entry[1] <= code_point) {\n                offset = entry[1];\n                pointer_offset = entry[0];\n            } else {\n                break;\n            }\n        }\n\n        // 2. Return a pointer whose value is pointer offset + code point\n        // − offset.\n        return pointer_offset + code_point - offset;\n    }\n\n    /**\n     * @param {number} code_point The |code_point| to search for in the shift_jis index.\n     * @return {?number} The code point corresponding to |pointer| in |index|,\n     *     or null if |code point| is not in the shift_jis index.\n     */\n    function indexShiftJISPointerFor(code_point) {\n        // 1. Let index be index jis0208 excluding all pointers in the\n        // range 8272 to 8835.\n        var pointer = indexPointerFor(code_point, index('jis0208'));\n        if (pointer === null || inRange(pointer, 8272, 8835))\n            return null;\n\n        // 2. Return the index pointer for code point in index.\n        return pointer;\n    }\n\n    /**\n     * @param {number} code_point The |code_point| to search for in the big5 index.\n     * @return {?number} The code point corresponding to |pointer| in |index|,\n     *     or null if |code point| is not in the big5 index.\n     */\n    function indexBig5PointerFor(code_point) {\n\n        // 1. Let index be index big5.\n        var index_ = index('big5');\n\n        // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or\n        // U+5345, return the last pointer corresponding to code point in\n        // index.\n        if (code_point === 0x2550 || code_point === 0x255E ||\n            code_point === 0x2561 || code_point === 0x256A ||\n            code_point === 0x5341 || code_point === 0x5345) {\n            return index.lastIndexOf(code_point);\n        }\n\n        // 3. Return the index pointer for code point in index.\n        return indexPointerFor(code_point, index_);\n    }\n\n    //\n    // 7. API\n    //\n\n    /** @const */ var DEFAULT_ENCODING = 'utf-8';\n\n    // 7.1 Interface TextDecoder\n\n    /**\n     * @constructor\n     * @param {string=} encoding The label of the encoding;\n     *     defaults to 'utf-8'.\n     * @param {Object=} options\n     */\n    function TextDecoder(encoding, options) {\n        if (!(this instanceof TextDecoder)) {\n            return new TextDecoder(encoding, options);\n        }\n        encoding = encoding !== undefined ? String(encoding) : DEFAULT_ENCODING;\n        options = ToDictionary(options);\n        /** @private */\n        this._encoding = getEncoding(encoding);\n        if (this._encoding === null || this._encoding.name === 'replacement')\n            throw RangeError('Unknown encoding: ' + encoding);\n\n        if (!decoders[this._encoding.name]) {\n            throw Error('Decoder not present.' +\n                ' Did you forget to include encoding-indexes.js?');\n        }\n\n        /** @private @type {boolean} */\n        this._streaming = false;\n        /** @private @type {boolean} */\n        this._BOMseen = false;\n        /** @private @type {?Decoder} */\n        this._decoder = null;\n        /** @private @type {boolean} */\n        this._fatal = Boolean(options['fatal']);\n        /** @private @type {boolean} */\n        this._ignoreBOM = Boolean(options['ignoreBOM']);\n\n        if (Object.defineProperty) {\n            Object.defineProperty(this, 'encoding', {value: this._encoding.name});\n            Object.defineProperty(this, 'fatal', {value: this._fatal});\n            Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});\n        } else {\n            this.encoding = this._encoding.name;\n            this.fatal = this._fatal;\n            this.ignoreBOM = this._ignoreBOM;\n        }\n\n        return this;\n    }\n\n    TextDecoder.prototype = {\n        /**\n         * @param {ArrayBufferView=} input The buffer of bytes to decode.\n         * @param {Object=} options\n         * @return {string} The decoded string.\n         */\n        decode: function decode(input, options) {\n            var bytes;\n            if (typeof input === 'object' && input instanceof ArrayBuffer) {\n                bytes = new Uint8Array(input);\n            } else if (typeof input === 'object' && 'buffer' in input &&\n                input.buffer instanceof ArrayBuffer) {\n                bytes = new Uint8Array(input.buffer,\n                    input.byteOffset,\n                    input.byteLength);\n            } else {\n                bytes = new Uint8Array(0);\n            }\n\n            options = ToDictionary(options);\n\n            if (!this._streaming) {\n                this._decoder = decoders[this._encoding.name]({fatal: this._fatal});\n                this._BOMseen = false;\n            }\n            this._streaming = Boolean(options['stream']);\n\n            var input_stream = new Stream(bytes);\n\n            var code_points = [];\n\n            /** @type {?(number|!Array.<number>)} */\n            var result;\n\n            while (!input_stream.endOfStream()) {\n                result = this._decoder.handler(input_stream, input_stream.read());\n                if (result === finished)\n                    break;\n                if (result === null)\n                    continue;\n                if (Array.isArray(result))\n                    code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));\n                else\n                    code_points.push(result);\n            }\n            if (!this._streaming) {\n                do {\n                    result = this._decoder.handler(input_stream, input_stream.read());\n                    if (result === finished)\n                        break;\n                    if (result === null)\n                        continue;\n                    if (Array.isArray(result))\n                        code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));\n                    else\n                        code_points.push(result);\n                } while (!input_stream.endOfStream());\n                this._decoder = null;\n            }\n\n            if (code_points.length) {\n                // If encoding is one of utf-8, utf-16be, and utf-16le, and\n                // ignore BOM flag and BOM seen flag are unset, run these\n                // subsubsteps:\n                if (['utf-8', 'utf-16le', 'utf-16be'].indexOf(this.encoding) !== -1 &&\n                    !this._ignoreBOM && !this._BOMseen) {\n                    // If token is U+FEFF, set BOM seen flag.\n                    if (code_points[0] === 0xFEFF) {\n                        this._BOMseen = true;\n                        code_points.shift();\n                    } else {\n                        // Otherwise, if token is not end-of-stream, set BOM seen\n                        // flag and append token to output.\n                        this._BOMseen = true;\n                    }\n                }\n            }\n\n            return codePointsToString(code_points);\n        }\n    };\n\n    // 7.2 Interface TextEncoder\n\n    /**\n     * @constructor\n     * @param {string=} encoding The label of the encoding;\n     *     defaults to 'utf-8'.\n     * @param {Object=} options\n     */\n    function TextEncoder(encoding, options) {\n        if (!(this instanceof TextEncoder))\n            return new TextEncoder(encoding, options);\n        encoding = encoding !== undefined ? String(encoding) : DEFAULT_ENCODING;\n        options = ToDictionary(options);\n        /** @private */\n        this._encoding = getEncoding(encoding);\n        if (this._encoding === null || this._encoding.name === 'replacement')\n            throw RangeError('Unknown encoding: ' + encoding);\n\n        var allowLegacyEncoding =\n            Boolean(options['NONSTANDARD_allowLegacyEncoding']);\n        var isLegacyEncoding = (this._encoding.name !== 'utf-8' &&\n        this._encoding.name !== 'utf-16le' &&\n        this._encoding.name !== 'utf-16be');\n        if (this._encoding === null || (isLegacyEncoding && !allowLegacyEncoding))\n            throw RangeError('Unknown encoding: ' + encoding);\n\n        if (!encoders[this._encoding.name]) {\n            throw Error('Encoder not present.' +\n                ' Did you forget to include encoding-indexes.js?');\n        }\n\n        /** @private @type {boolean} */\n        this._streaming = false;\n        /** @private @type {?Encoder} */\n        this._encoder = null;\n        /** @private @type {{fatal: boolean}} */\n        this._options = {fatal: Boolean(options['fatal'])};\n\n        if (Object.defineProperty)\n            Object.defineProperty(this, 'encoding', {value: this._encoding.name});\n        else\n            this.encoding = this._encoding.name;\n\n        return this;\n    }\n\n    TextEncoder.prototype = {\n        /**\n         * @param {string=} opt_string The string to encode.\n         * @param {Object=} options\n         * @return {Uint8Array} Encoded bytes, as a Uint8Array.\n         */\n        encode: function encode(opt_string, options) {\n            opt_string = opt_string ? String(opt_string) : '';\n            options = ToDictionary(options);\n\n            // NOTE: This option is nonstandard. None of the encodings\n            // permitted for encoding (i.e. UTF-8, UTF-16) are stateful,\n            // so streaming is not necessary.\n            if (!this._streaming)\n                this._encoder = encoders[this._encoding.name](this._options);\n            this._streaming = Boolean(options['stream']);\n\n            var bytes = [];\n            var input_stream = new Stream(stringToCodePoints(opt_string));\n            /** @type {?(number|!Array.<number>)} */\n            var result;\n            while (!input_stream.endOfStream()) {\n                result = this._encoder.handler(input_stream, input_stream.read());\n                if (result === finished)\n                    break;\n                if (Array.isArray(result))\n                    bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));\n                else\n                    bytes.push(result);\n            }\n            if (!this._streaming) {\n                while (true) {\n                    result = this._encoder.handler(input_stream, input_stream.read());\n                    if (result === finished)\n                        break;\n                    if (Array.isArray(result))\n                        bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));\n                    else\n                        bytes.push(result);\n                }\n                this._encoder = null;\n            }\n            return new Uint8Array(bytes);\n        }\n    };\n\n\n    //\n    // 8. The encoding\n    //\n\n    // 8.1 utf-8\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function UTF8Decoder(options) {\n        var fatal = options.fatal;\n\n        // utf-8's decoder's has an associated utf-8 code point, utf-8\n        // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8\n        // lower boundary (initially 0x80), and a utf-8 upper boundary\n        // (initially 0xBF).\n        var /** @type {number} */ utf8_code_point = 0,\n            /** @type {number} */ utf8_bytes_seen = 0,\n            /** @type {number} */ utf8_bytes_needed = 0,\n            /** @type {number} */ utf8_lower_boundary = 0x80,\n            /** @type {number} */ utf8_upper_boundary = 0xBF;\n\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,\n            // set utf-8 bytes needed to 0 and return error.\n            if (bite === end_of_stream && utf8_bytes_needed !== 0) {\n                utf8_bytes_needed = 0;\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream, return finished.\n            if (bite === end_of_stream)\n                return finished;\n\n            // 3. If utf-8 bytes needed is 0, based on byte:\n            if (utf8_bytes_needed === 0) {\n\n                // 0x00 to 0x7F\n                if (inRange(bite, 0x00, 0x7F)) {\n                    // Return a code point whose value is byte.\n                    return bite;\n                }\n\n                // 0xC2 to 0xDF\n                if (inRange(bite, 0xC2, 0xDF)) {\n                    // Set utf-8 bytes needed to 1 and utf-8 code point to byte\n                    // − 0xC0.\n                    utf8_bytes_needed = 1;\n                    utf8_code_point = bite - 0xC0;\n                }\n\n                // 0xE0 to 0xEF\n                else if (inRange(bite, 0xE0, 0xEF)) {\n                    // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.\n                    if (bite === 0xE0)\n                        utf8_lower_boundary = 0xA0;\n                    // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.\n                    if (bite === 0xED)\n                        utf8_upper_boundary = 0x9F;\n                    // 3. Set utf-8 bytes needed to 2 and utf-8 code point to\n                    // byte − 0xE0.\n                    utf8_bytes_needed = 2;\n                    utf8_code_point = bite - 0xE0;\n                }\n\n                // 0xF0 to 0xF4\n                else if (inRange(bite, 0xF0, 0xF4)) {\n                    // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.\n                    if (bite === 0xF0)\n                        utf8_lower_boundary = 0x90;\n                    // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.\n                    if (bite === 0xF4)\n                        utf8_upper_boundary = 0x8F;\n                    // 3. Set utf-8 bytes needed to 3 and utf-8 code point to\n                    // byte − 0xF0.\n                    utf8_bytes_needed = 3;\n                    utf8_code_point = bite - 0xF0;\n                }\n\n                // Otherwise\n                else {\n                    // Return error.\n                    return decoderError(fatal);\n                }\n\n                // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code\n                // point to utf-8 code point << (6 × utf-8 bytes needed) and\n                // return continue.\n                utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed);\n                return null;\n            }\n\n            // 4. If byte is not in the range utf-8 lower boundary to utf-8\n            // upper boundary, run these substeps:\n            if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {\n\n                // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8\n                // bytes seen to 0, set utf-8 lower boundary to 0x80, and set\n                // utf-8 upper boundary to 0xBF.\n                utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n                utf8_lower_boundary = 0x80;\n                utf8_upper_boundary = 0xBF;\n\n                // 2. Prepend byte to stream.\n                stream.prepend(bite);\n\n                // 3. Return error.\n                return decoderError(fatal);\n            }\n\n            // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary\n            // to 0xBF.\n            utf8_lower_boundary = 0x80;\n            utf8_upper_boundary = 0xBF;\n\n            // 6. Increase utf-8 bytes seen by one and set utf-8 code point\n            // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes\n            // needed − utf-8 bytes seen)).\n            utf8_bytes_seen += 1;\n            utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen));\n\n            // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed,\n            // continue.\n            if (utf8_bytes_seen !== utf8_bytes_needed)\n                return null;\n\n            // 8. Let code point be utf-8 code point.\n            var code_point = utf8_code_point;\n\n            // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes\n            // seen to 0.\n            utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n\n            // 10. Return a code point whose value is code point.\n            return code_point;\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function UTF8Encoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007f))\n                return code_point;\n\n            // 3. Set count and offset based on the range code point is in:\n            var count, offset;\n            // U+0080 to U+07FF:    1 and 0xC0\n            if (inRange(code_point, 0x0080, 0x07FF)) {\n                count = 1;\n                offset = 0xC0;\n            }\n            // U+0800 to U+FFFF:    2 and 0xE0\n            else if (inRange(code_point, 0x0800, 0xFFFF)) {\n                count = 2;\n                offset = 0xE0;\n            }\n            // U+10000 to U+10FFFF: 3 and 0xF0\n            else if (inRange(code_point, 0x10000, 0x10FFFF)) {\n                count = 3;\n                offset = 0xF0;\n            }\n\n            // 4.Let bytes be a byte sequence whose first byte is (code\n            // point >> (6 × count)) + offset.\n            var bytes = [(code_point >> (6 * count)) + offset];\n\n            // 5. Run these substeps while count is greater than 0:\n            while (count > 0) {\n\n                // 1. Set temp to code point >> (6 × (count − 1)).\n                var temp = code_point >> (6 * (count - 1));\n\n                // 2. Append to bytes 0x80 | (temp & 0x3F).\n                bytes.push(0x80 | (temp & 0x3F));\n\n                // 3. Decrease count by one.\n                count -= 1;\n            }\n\n            // 6. Return bytes bytes, in order.\n            return bytes;\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['utf-8'] = function(options) {\n        return new UTF8Encoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['utf-8'] = function(options) {\n        return new UTF8Decoder(options);\n    };\n\n    //\n    // 9. Legacy single-byte encodings\n    //\n\n    // 9.1 single-byte decoder\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {!Array.<number>} index The encoding index.\n     * @param {{fatal: boolean}} options\n     */\n    function SingleByteDecoder(index, options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream, return finished.\n            if (bite === end_of_stream)\n                return finished;\n\n            // 2. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 3. Let code point be the index code point for byte − 0x80 in\n            // index single-byte.\n            var code_point = index[bite - 0x80];\n\n            // 4. If code point is null, return error.\n            if (code_point === null)\n                return decoderError(fatal);\n\n            // 5. Return a code point whose value is code point.\n            return code_point;\n        };\n    }\n\n    // 9.2 single-byte encoder\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {!Array.<?number>} index The encoding index.\n     * @param {{fatal: boolean}} options\n     */\n    function SingleByteEncoder(index, options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 3. Let pointer be the index pointer for code point in index\n            // single-byte.\n            var pointer = indexPointerFor(code_point, index);\n\n            // 4. If pointer is null, return error with code point.\n            if (pointer === null)\n                encoderError(code_point);\n\n            // 5. Return a byte whose value is pointer + 0x80.\n            return pointer + 0x80;\n        };\n    }\n\n    (function() {\n        if (!('encoding-indexes' in global))\n            return;\n        encodings.forEach(function(category) {\n            if (category.heading !== 'Legacy single-byte encodings')\n                return;\n            category.encodings.forEach(function(encoding) {\n                var name = encoding.name;\n                var idx = index(name);\n                /** @param {{fatal: boolean}} options */\n                decoders[name] = function(options) {\n                    return new SingleByteDecoder(idx, options);\n                };\n                /** @param {{fatal: boolean}} options */\n                encoders[name] = function(options) {\n                    return new SingleByteEncoder(idx, options);\n                };\n            });\n        });\n    }());\n\n    //\n    // 10. Legacy multi-byte Chinese (simplified) encodings\n    //\n\n    // 10.1 gbk\n\n    // 10.1.1 gbk decoder\n    // gbk's decoder is gb18030's decoder.\n    /** @param {{fatal: boolean}} options */\n    decoders['gbk'] = function(options) {\n        return new GB18030Decoder(options);\n    };\n\n    // 10.1.2 gbk encoder\n    // gbk's encoder is gb18030's encoder with its gbk flag set.\n    /** @param {{fatal: boolean}} options */\n    encoders['gbk'] = function(options) {\n        return new GB18030Encoder(options, true);\n    };\n\n    // 10.2 gb18030\n\n    // 10.2.1 gb18030 decoder\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function GB18030Decoder(options) {\n        var fatal = options.fatal;\n        // gb18030's decoder has an associated gb18030 first, gb18030\n        // second, and gb18030 third (all initially 0x00).\n        var /** @type {number} */ gb18030_first = 0x00,\n            /** @type {number} */ gb18030_second = 0x00,\n            /** @type {number} */ gb18030_third = 0x00;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and gb18030 first, gb18030\n            // second, and gb18030 third are 0x00, return finished.\n            if (bite === end_of_stream && gb18030_first === 0x00 &&\n                gb18030_second === 0x00 && gb18030_third === 0x00) {\n                return finished;\n            }\n            // 2. If byte is end-of-stream, and gb18030 first, gb18030\n            // second, or gb18030 third is not 0x00, set gb18030 first,\n            // gb18030 second, and gb18030 third to 0x00, and return error.\n            if (bite === end_of_stream &&\n                (gb18030_first !== 0x00 || gb18030_second !== 0x00 || gb18030_third !== 0x00)) {\n                gb18030_first = 0x00;\n                gb18030_second = 0x00;\n                gb18030_third = 0x00;\n                decoderError(fatal);\n            }\n            var code_point;\n            // 3. If gb18030 third is not 0x00, run these substeps:\n            if (gb18030_third !== 0x00) {\n                // 1. Let code point be null.\n                code_point = null;\n                // 2. If byte is in the range 0x30 to 0x39, set code point to\n                // the index gb18030 ranges code point for (((gb18030 first −\n                // 0x81) × 10 + gb18030 second − 0x30) × 126 + gb18030 third −\n                // 0x81) × 10 + byte − 0x30.\n                if (inRange(bite, 0x30, 0x39)) {\n                    code_point = indexGB18030RangesCodePointFor(\n                        (((gb18030_first - 0x81) * 10 + (gb18030_second - 0x30)) * 126 +\n                        (gb18030_third - 0x81)) * 10 + bite - 0x30);\n                }\n\n                // 3. Let buffer be a byte sequence consisting of gb18030\n                // second, gb18030 third, and byte, in order.\n                var buffer = [gb18030_second, gb18030_third, bite];\n\n                // 4. Set gb18030 first, gb18030 second, and gb18030 third to\n                // 0x00.\n                gb18030_first = 0x00;\n                gb18030_second = 0x00;\n                gb18030_third = 0x00;\n\n                // 5. If code point is null, prepend buffer to stream and\n                // return error.\n                if (code_point === null) {\n                    stream.prepend(buffer);\n                    return decoderError(fatal);\n                }\n\n                // 6. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 4. If gb18030 second is not 0x00, run these substeps:\n            if (gb18030_second !== 0x00) {\n\n                // 1. If byte is in the range 0x81 to 0xFE, set gb18030 third\n                // to byte and return continue.\n                if (inRange(bite, 0x81, 0xFE)) {\n                    gb18030_third = bite;\n                    return null;\n                }\n\n                // 2. Prepend gb18030 second followed by byte to stream, set\n                // gb18030 first and gb18030 second to 0x00, and return error.\n                stream.prepend([gb18030_second, bite]);\n                gb18030_first = 0x00;\n                gb18030_second = 0x00;\n                return decoderError(fatal);\n            }\n\n            // 5. If gb18030 first is not 0x00, run these substeps:\n            if (gb18030_first !== 0x00) {\n\n                // 1. If byte is in the range 0x30 to 0x39, set gb18030 second\n                // to byte and return continue.\n                if (inRange(bite, 0x30, 0x39)) {\n                    gb18030_second = bite;\n                    return null;\n                }\n\n                // 2. Let lead be gb18030 first, let pointer be null, and set\n                // gb18030 first to 0x00.\n                var lead = gb18030_first;\n                var pointer = null;\n                gb18030_first = 0x00;\n\n                // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41\n                // otherwise.\n                var offset = bite < 0x7F ? 0x40 : 0x41;\n\n                // 4. If byte is in the range 0x40 to 0x7E or 0x80 to 0xFE,\n                // set pointer to (lead − 0x81) × 190 + (byte − offset).\n                if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE))\n                    pointer = (lead - 0x81) * 190 + (bite - offset);\n\n                // 5. Let code point be null if pointer is null and the index\n                // code point for pointer in index gb18030 otherwise.\n                code_point = pointer === null ? null :\n                    indexCodePointFor(pointer, index('gb18030'));\n\n                // 6. If code point is null and byte is in the range 0x00 to\n                // 0x7F, prepend byte to stream.\n                if (code_point === null && inRange(bite, 0x00, 0x7F))\n                    stream.prepend(bite);\n\n                // 7. If code point is null, return error.\n                if (code_point === null)\n                    return decoderError(fatal);\n\n                // 8. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 6. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 7. If byte is 0x80, return code point U+20AC.\n            if (bite === 0x80)\n                return 0x20AC;\n\n            // 8. If byte is in the range 0x81 to 0xFE, set gb18030 first to\n            // byte and return continue.\n            if (inRange(bite, 0x81, 0xFE)) {\n                gb18030_first = bite;\n                return null;\n            }\n\n            // 9. Return error.\n            return decoderError(fatal);\n        };\n    }\n\n    // 10.2.2 gb18030 encoder\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     * @param {boolean=} gbk_flag\n     */\n    function GB18030Encoder(options, gbk_flag) {\n        var fatal = options.fatal;\n        // gb18030's decoder has an associated gbk flag (initially unset).\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F)) {\n                return code_point;\n            }\n\n            // 3. If the gbk flag is set and code point is U+20AC, return\n            // byte 0x80.\n            if (gbk_flag && code_point === 0x20AC)\n                return 0x80;\n\n            // 4. Let pointer be the index pointer for code point in index\n            // gb18030.\n            var pointer = indexPointerFor(code_point, index('gb18030'));\n\n            // 5. If pointer is not null, run these substeps:\n            if (pointer !== null) {\n\n                // 1. Let lead be pointer / 190 + 0x81.\n                var lead = div(pointer, 190) + 0x81;\n\n                // 2. Let trail be pointer % 190.\n                var trail = pointer % 190;\n\n                // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.\n                var offset = trail < 0x3F ? 0x40 : 0x41;\n\n                // 4. Return two bytes whose values are lead and trail + offset.\n                return [lead, trail + offset];\n            }\n\n            // 6. If gbk flag is set, return error with code point.\n            if (gbk_flag)\n                return encoderError(code_point);\n\n            // 7. Set pointer to the index gb18030 ranges pointer for code\n            // point.\n            pointer = indexGB18030RangesPointerFor(code_point);\n\n            // 8. Let byte1 be pointer / 10 / 126 / 10.\n            var byte1 = div(div(div(pointer, 10), 126), 10);\n\n            // 9. Set pointer to pointer − byte1 × 10 × 126 × 10.\n            pointer = pointer - byte1 * 10 * 126 * 10;\n\n            // 10. Let byte2 be pointer / 10 / 126.\n            var byte2 = div(div(pointer, 10), 126);\n\n            // 11. Set pointer to pointer − byte2 × 10 × 126.\n            pointer = pointer - byte2 * 10 * 126;\n\n            // 12. Let byte3 be pointer / 10.\n            var byte3 = div(pointer, 10);\n\n            // 13. Let byte4 be pointer − byte3 × 10.\n            var byte4 = pointer - byte3 * 10;\n\n            // 14. Return four bytes whose values are byte1 + 0x81, byte2 +\n            // 0x30, byte3 + 0x81, byte4 + 0x30.\n            return [byte1 + 0x81,\n                byte2 + 0x30,\n                byte3 + 0x81,\n                byte4 + 0x30];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['gb18030'] = function(options) {\n        return new GB18030Encoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['gb18030'] = function(options) {\n        return new GB18030Decoder(options);\n    };\n\n\n    //\n    // 11. Legacy multi-byte Chinese (traditional) encodings\n    //\n\n    // 11.1 big5\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function Big5Decoder(options) {\n        var fatal = options.fatal;\n        // big5's decoder has an associated big5 lead (initially 0x00).\n        var /** @type {number} */ big5_lead = 0x00;\n\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and big5 lead is not 0x00, set\n            // big5 lead to 0x00 and return error.\n            if (bite === end_of_stream && big5_lead !== 0x00) {\n                big5_lead = 0x00;\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream and big5 lead is 0x00, return\n            // finished.\n            if (bite === end_of_stream && big5_lead === 0x00)\n                return finished;\n\n            // 3. If big5 lead is not 0x00, let lead be big5 lead, let\n            // pointer be null, set big5 lead to 0x00, and then run these\n            // substeps:\n            if (big5_lead !== 0x00) {\n                var lead = big5_lead;\n                var pointer = null;\n                big5_lead = 0x00;\n\n                // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62\n                // otherwise.\n                var offset = bite < 0x7F ? 0x40 : 0x62;\n\n                // 2. If byte is in the range 0x40 to 0x7E or 0xA1 to 0xFE,\n                // set pointer to (lead − 0x81) × 157 + (byte − offset).\n                if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE))\n                    pointer = (lead - 0x81) * 157 + (bite - offset);\n\n                // 3. If there is a row in the table below whose first column\n                // is pointer, return the two code points listed in its second\n                // column\n                // Pointer | Code points\n                // --------+--------------\n                // 1133    | U+00CA U+0304\n                // 1135    | U+00CA U+030C\n                // 1164    | U+00EA U+0304\n                // 1166    | U+00EA U+030C\n                switch (pointer) {\n                    case 1133: return [0x00CA, 0x0304];\n                    case 1135: return [0x00CA, 0x030C];\n                    case 1164: return [0x00EA, 0x0304];\n                    case 1166: return [0x00EA, 0x030C];\n                }\n\n                // 4. Let code point be null if pointer is null and the index\n                // code point for pointer in index big5 otherwise.\n                var code_point = (pointer === null) ? null :\n                    indexCodePointFor(pointer, index('big5'));\n\n                // 5. If code point is null and byte is in the range 0x00 to\n                // 0x7F, prepend byte to stream.\n                if (code_point === null && inRange(bite, 0x00, 0x7F))\n                    stream.prepend(bite);\n\n                // 6. If code point is null, return error.\n                if (code_point === null)\n                    return decoderError(fatal);\n\n                // 7. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 4. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 5. If byte is in the range 0x81 to 0xFE, set big5 lead to\n            // byte and return continue.\n            if (inRange(bite, 0x81, 0xFE)) {\n                big5_lead = bite;\n                return null;\n            }\n\n            // 6. Return error.\n            return decoderError(fatal);\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function Big5Encoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 3. Let pointer be the index big5 pointer for code point.\n            var pointer = indexBig5PointerFor(code_point, index('big5'));\n\n            // 4. If pointer is null, return error with code point.\n            if (pointer === null)\n                return encoderError(code_point);\n\n            // 5. Let lead be pointer / 157 + 0x81.\n            var lead = div(pointer, 157) + 0x81;\n\n            // 6. If lead is less than 0xA1, return error with code point.\n            if (lead < 0xA1)\n                return encoderError(code_point);\n\n            // 7. Let trail be pointer % 157.\n            var trail = pointer % 157;\n\n            // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62\n            // otherwise.\n            var offset = trail < 0x3F ? 0x40 : 0x62;\n\n            // Return two bytes whose values are lead and trail + offset.\n            return [lead, trail + offset];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['big5'] = function(options) {\n        return new Big5Encoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['big5'] = function(options) {\n        return new Big5Decoder(options);\n    };\n\n\n    //\n    // 12. Legacy multi-byte Japanese encodings\n    //\n\n    // 12.1 euc-jp\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function EUCJPDecoder(options) {\n        var fatal = options.fatal;\n\n        // euc-jp's decoder has an associated euc-jp jis0212 flag\n        // (initially unset) and euc-jp lead (initially 0x00).\n        var /** @type {boolean} */ eucjp_jis0212_flag = false,\n            /** @type {number} */ eucjp_lead = 0x00;\n\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set\n            // euc-jp lead to 0x00, and return error.\n            if (bite === end_of_stream && eucjp_lead !== 0x00) {\n                eucjp_lead = 0x00;\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream and euc-jp lead is 0x00, return\n            // finished.\n            if (bite === end_of_stream && eucjp_lead === 0x00)\n                return finished;\n\n            // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to\n            // 0xDF, set euc-jp lead to 0x00 and return a code point whose\n            // value is 0xFF61 + byte − 0xA1.\n            if (eucjp_lead === 0x8E && inRange(bite, 0xA1, 0xDF)) {\n                eucjp_lead = 0x00;\n                return 0xFF61 + bite - 0xA1;\n            }\n\n            // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to\n            // 0xFE, set the euc-jp jis0212 flag, set euc-jp lead to byte,\n            // and return continue.\n            if (eucjp_lead === 0x8F && inRange(bite, 0xA1, 0xFE)) {\n                eucjp_jis0212_flag = true;\n                eucjp_lead = bite;\n                return null;\n            }\n\n            // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set\n            // euc-jp lead to 0x00, and run these substeps:\n            if (eucjp_lead !== 0x00) {\n                var lead = eucjp_lead;\n                eucjp_lead = 0x00;\n\n                // 1. Let code point be null.\n                var code_point = null;\n\n                // 2. If lead and byte are both in the range 0xA1 to 0xFE, set\n                // code point to the index code point for (lead − 0xA1) × 94 +\n                // byte − 0xA1 in index jis0208 if the euc-jp jis0212 flag is\n                // unset and in index jis0212 otherwise.\n                if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {\n                    code_point = indexCodePointFor(\n                        (lead - 0xA1) * 94 + (bite - 0xA1),\n                        index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212'));\n                }\n\n                // 3. Unset the euc-jp jis0212 flag.\n                eucjp_jis0212_flag = false;\n\n                // 4. If byte is not in the range 0xA1 to 0xFE, prepend byte\n                // to stream.\n                if (!inRange(bite, 0xA1, 0xFE))\n                    stream.prepend(bite);\n\n                // 5. If code point is null, return error.\n                if (code_point === null)\n                    return decoderError(fatal);\n\n                // 6. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 6. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE, set\n            // euc-jp lead to byte and return continue.\n            if (bite === 0x8E || bite === 0x8F || inRange(bite, 0xA1, 0xFE)) {\n                eucjp_lead = bite;\n                return null;\n            }\n\n            // 8. Return error.\n            return decoderError(fatal);\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function EUCJPEncoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 3. If code point is U+00A5, return byte 0x5C.\n            if (code_point === 0x00A5)\n                return 0x5C;\n\n            // 4. If code point is U+203E, return byte 0x7E.\n            if (code_point === 0x203E)\n                return 0x7E;\n\n            // 5. If code point is in the range U+FF61 to U+FF9F, return two\n            // bytes whose values are 0x8E and code point − 0xFF61 + 0xA1.\n            if (inRange(code_point, 0xFF61, 0xFF9F))\n                return [0x8E, code_point - 0xFF61 + 0xA1];\n\n            // 6. If code point is U+2022, set it to U+FF0D.\n            if (code_point === 0x2022)\n                code_point = 0xFF0D;\n\n            // 7. Let pointer be the index pointer for code point in index\n            // jis0208.\n            var pointer = indexPointerFor(code_point, index('jis0208'));\n\n            // 8. If pointer is null, return error with code point.\n            if (pointer === null)\n                return encoderError(code_point);\n\n            // 9. Let lead be pointer / 94 + 0xA1.\n            var lead = div(pointer, 94) + 0xA1;\n\n            // 10. Let trail be pointer % 94 + 0xA1.\n            var trail = pointer % 94 + 0xA1;\n\n            // 11. Return two bytes whose values are lead and trail.\n            return [lead, trail];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['euc-jp'] = function(options) {\n        return new EUCJPEncoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['euc-jp'] = function(options) {\n        return new EUCJPDecoder(options);\n    };\n\n    // 12.2 iso-2022-jp\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function ISO2022JPDecoder(options) {\n        var fatal = options.fatal;\n        /** @enum */\n        var states = {\n            ASCII: 0,\n            Roman: 1,\n            Katakana: 2,\n            LeadByte: 3,\n            TrailByte: 4,\n            EscapeStart: 5,\n            Escape: 6\n        };\n        // iso-2022-jp's decoder has an associated iso-2022-jp decoder\n        // state (initially ASCII), iso-2022-jp decoder output state\n        // (initially ASCII), iso-2022-jp lead (initially 0x00), and\n        // iso-2022-jp output flag (initially unset).\n        var /** @type {number} */ iso2022jp_decoder_state = states.ASCII,\n            /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII,\n            /** @type {number} */ iso2022jp_lead = 0x00,\n            /** @type {boolean} */ iso2022jp_output_flag = false;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // switching on iso-2022-jp decoder state:\n            switch (iso2022jp_decoder_state) {\n                default:\n                case states.ASCII:\n                    // ASCII\n                    // Based on byte:\n\n                    // 0x1B\n                    if (bite === 0x1B) {\n                        // Set iso-2022-jp decoder state to escape start and return\n                        // continue.\n                        iso2022jp_decoder_state = states.EscapeStart;\n                        return null;\n                    }\n\n                    // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B\n                    if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E\n                        && bite !== 0x0F && bite !== 0x1B) {\n                        // Unset the iso-2022-jp output flag and return a code point\n                        // whose value is byte.\n                        iso2022jp_output_flag = false;\n                        return bite;\n                    }\n\n                    // end-of-stream\n                    if (bite === end_of_stream) {\n                        // Return finished.\n                        return finished;\n                    }\n\n                    // Otherwise\n                    // Unset the iso-2022-jp output flag and return error.\n                    iso2022jp_output_flag = false;\n                    return decoderError(fatal);\n\n                case states.Roman:\n                    // Roman\n                    // Based on byte:\n\n                    // 0x1B\n                    if (bite === 0x1B) {\n                        // Set iso-2022-jp decoder state to escape start and return\n                        // continue.\n                        iso2022jp_decoder_state = states.EscapeStart;\n                        return null;\n                    }\n\n                    // 0x5C\n                    if (bite === 0x5C) {\n                        // Unset the iso-2022-jp output flag and return code point\n                        // U+00A5.\n                        iso2022jp_output_flag = false;\n                        return 0x00A5;\n                    }\n\n                    // 0x7E\n                    if (bite === 0x7E) {\n                        // Unset the iso-2022-jp output flag and return code point\n                        // U+203E.\n                        iso2022jp_output_flag = false;\n                        return 0x203E;\n                    }\n\n                    // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E\n                    if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E && bite !== 0x0F\n                        && bite !== 0x1B && bite !== 0x5C && bite !== 0x7E) {\n                        // Unset the iso-2022-jp output flag and return a code point\n                        // whose value is byte.\n                        iso2022jp_output_flag = false;\n                        return bite;\n                    }\n\n                    // end-of-stream\n                    if (bite === end_of_stream) {\n                        // Return finished.\n                        return finished;\n                    }\n\n                    // Otherwise\n                    // Unset the iso-2022-jp output flag and return error.\n                    iso2022jp_output_flag = false;\n                    return decoderError(fatal);\n\n                case states.Katakana:\n                    // Katakana\n                    // Based on byte:\n\n                    // 0x1B\n                    if (bite === 0x1B) {\n                        // Set iso-2022-jp decoder state to escape start and return\n                        // continue.\n                        iso2022jp_decoder_state = states.EscapeStart;\n                        return null;\n                    }\n\n                    // 0x21 to 0x5F\n                    if (inRange(bite, 0x21, 0x5F)) {\n                        // Unset the iso-2022-jp output flag and return a code point\n                        // whose value is 0xFF61 + byte − 0x21.\n                        iso2022jp_output_flag = false;\n                        return 0xFF61 + bite - 0x21;\n                    }\n\n                    // end-of-stream\n                    if (bite === end_of_stream) {\n                        // Return finished.\n                        return finished;\n                    }\n\n                    // Otherwise\n                    // Unset the iso-2022-jp output flag and return error.\n                    iso2022jp_output_flag = false;\n                    return decoderError(fatal);\n\n                case states.LeadByte:\n                    // Lead byte\n                    // Based on byte:\n\n                    // 0x1B\n                    if (bite === 0x1B) {\n                        // Set iso-2022-jp decoder state to escape start and return\n                        // continue.\n                        iso2022jp_decoder_state = states.EscapeStart;\n                        return null;\n                    }\n\n                    // 0x21 to 0x7E\n                    if (inRange(bite, 0x21, 0x7E)) {\n                        // Unset the iso-2022-jp output flag, set iso-2022-jp lead\n                        // to byte, iso-2022-jp decoder state to trail byte, and\n                        // return continue.\n                        iso2022jp_output_flag = false;\n                        iso2022jp_lead = bite;\n                        iso2022jp_decoder_state = states.TrailByte;\n                        return null;\n                    }\n\n                    // end-of-stream\n                    if (bite === end_of_stream) {\n                        // Return finished.\n                        return finished;\n                    }\n\n                    // Otherwise\n                    // Unset the iso-2022-jp output flag and return error.\n                    iso2022jp_output_flag = false;\n                    return decoderError(fatal);\n\n                case states.TrailByte:\n                    // Trail byte\n                    // Based on byte:\n\n                    // 0x1B\n                    if (bite === 0x1B) {\n                        // Set iso-2022-jp decoder state to escape start and return\n                        // continue.\n                        iso2022jp_decoder_state = states.EscapeStart;\n                        return decoderError(fatal);\n                    }\n\n                    // 0x21 to 0x7E\n                    if (inRange(bite, 0x21, 0x7E)) {\n                        // 1. Set the iso-2022-jp decoder state to lead byte.\n                        iso2022jp_decoder_state = states.LeadByte;\n\n                        // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.\n                        var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;\n\n                        // 3. Let code point be the index code point for pointer in index jis0208.\n                        var code_point = indexCodePointFor(pointer, index('jis0208'));\n\n                        // 4. If code point is null, return error.\n                        if (code_point === null)\n                            return decoderError(fatal);\n\n                        // 5. Return a code point whose value is code point.\n                        return code_point;\n                    }\n\n                    // end-of-stream\n                    if (bite === end_of_stream) {\n                        // Set the iso-2022-jp decoder state to lead byte, prepend\n                        // byte to stream, and return error.\n                        iso2022jp_decoder_state = states.LeadByte;\n                        stream.prepend(bite);\n                        return decoderError(fatal);\n                    }\n\n                    // Otherwise\n                    // Set iso-2022-jp decoder state to lead byte and return\n                    // error.\n                    iso2022jp_decoder_state = states.LeadByte;\n                    return decoderError(fatal);\n\n                case states.EscapeStart:\n                    // Escape start\n\n                    // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to\n                    // byte, iso-2022-jp decoder state to escape, and return\n                    // continue.\n                    if (bite === 0x24 || bite === 0x28) {\n                        iso2022jp_lead = bite;\n                        iso2022jp_decoder_state = states.Escape;\n                        return null;\n                    }\n\n                    // 2. Prepend byte to stream.\n                    stream.prepend(bite);\n\n                    // 3. Unset the iso-2022-jp output flag, set iso-2022-jp\n                    // decoder state to iso-2022-jp decoder output state, and\n                    // return error.\n                    iso2022jp_output_flag = false;\n                    iso2022jp_decoder_state = iso2022jp_decoder_output_state;\n                    return decoderError(fatal);\n\n                case states.Escape:\n                    // Escape\n\n                    // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to\n                    // 0x00.\n                    var lead = iso2022jp_lead;\n                    iso2022jp_lead = 0x00;\n\n                    // 2. Let state be null.\n                    var state = null;\n\n                    // 3. If lead is 0x28 and byte is 0x42, set state to ASCII.\n                    if (lead === 0x28 && bite === 0x42)\n                        state = states.ASCII;\n\n                    // 4. If lead is 0x28 and byte is 0x4A, set state to Roman.\n                    if (lead === 0x28 && bite === 0x4A)\n                        state = states.Roman;\n\n                    // 5. If lead is 0x28 and byte is 0x49, set state to Katakana.\n                    if (lead === 0x28 && bite === 0x49)\n                        state = states.Katakana;\n\n                    // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set\n                    // state to lead byte.\n                    if (lead === 0x24 && (bite === 0x40 || bite === 0x42))\n                        state = states.LeadByte;\n\n                    // 7. If state is non-null, run these substeps:\n                    if (state !== null) {\n                        // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder\n                        // output state to states.\n                        iso2022jp_decoder_state = iso2022jp_decoder_state = state;\n\n                        // 2. Let output flag be the iso-2022-jp output flag.\n                        var output_flag = iso2022jp_output_flag;\n\n                        // 3. Set the iso-2022-jp output flag.\n                        iso2022jp_output_flag = true;\n\n                        // 4. Return continue, if output flag is unset, and error\n                        // otherwise.\n                        return !output_flag ? null : decoderError(fatal);\n                    }\n\n                    // 8. Prepend lead and byte to stream.\n                    stream.prepend([lead, bite]);\n\n                    // 9. Unset the iso-2022-jp output flag, set iso-2022-jp\n                    // decoder state to iso-2022-jp decoder output state and\n                    // return error.\n                    iso2022jp_output_flag = false;\n                    iso2022jp_decoder_state = iso2022jp_decoder_output_state;\n                    return decoderError(fatal);\n            }\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function ISO2022JPEncoder(options) {\n        var fatal = options.fatal;\n        // iso-2022-jp's encoder has an associated iso-2022-jp encoder\n        // state which is one of ASCII, Roman, and jis0208 (initially\n        // ASCII).\n        /** @enum */\n        var states = {\n            ASCII: 0,\n            Roman: 1,\n            jis0208: 2\n        };\n        var /** @type {number} */ iso2022jp_state = states.ASCII;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream and iso-2022-jp encoder\n            // state is not ASCII, prepend code point to stream, set\n            // iso-2022-jp encoder state to ASCII, and return three bytes\n            // 0x1B 0x28 0x42.\n            if (code_point === end_of_stream &&\n                iso2022jp_state !== states.ASCII) {\n                stream.prepend(code_point);\n                return [0x1B, 0x28, 0x42];\n            }\n\n            // 2. If code point is end-of-stream and iso-2022-jp encoder\n            // state is ASCII, return finished.\n            if (code_point === end_of_stream && iso2022jp_state === states.ASCII)\n                return finished;\n\n            // 3. If iso-2022-jp encoder state is ASCII and code point is in\n            // the range U+0000 to U+007F, return a byte whose value is code\n            // point.\n            if (iso2022jp_state === states.ASCII &&\n                inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 4. If iso-2022-jp encoder state is Roman and code point is in\n            // the range U+0000 to U+007F, excluding U+005C and U+007E, or\n            // is U+00A5 or U+203E, run these substeps:\n            if (iso2022jp_state === states.Roman &&\n                inRange(code_point, 0x0000, 0x007F) &&\n                code_point !== 0x005C && code_point !== 0x007E) {\n\n                // 1. If code point is in the range U+0000 to U+007F, return a\n                // byte whose value is code point.\n                if (inRange(code_point, 0x0000, 0x007F))\n                    return code_point;\n\n                // 2. If code point is U+00A5, return byte 0x5C.\n                if (code_point === 0x00A5)\n                    return 0x5C;\n\n                // 3. If code point is U+203E, return byte 0x7E.\n                if (code_point === 0x203E)\n                    return 0x7E;\n            }\n\n            // 5. If code point is in the range U+0000 to U+007F, and\n            // iso-2022-jp encoder state is not ASCII, prepend code point to\n            // stream, set iso-2022-jp encoder state to ASCII, and return\n            // three bytes 0x1B 0x28 0x42.\n            if (inRange(code_point, 0x0000, 0x007F) &&\n                iso2022jp_state !== states.ASCII) {\n                stream.prepend(code_point);\n                iso2022jp_state = states.ASCII;\n                return [0x1B, 0x28, 0x42];\n            }\n\n            // 6. If code point is either U+00A5 or U+203E, and iso-2022-jp\n            // encoder state is not Roman, prepend code point to stream, set\n            // iso-2022-jp encoder state to Roman, and return three bytes\n            // 0x1B 0x28 0x4A.\n            if ((code_point === 0x00A5 || code_point === 0x203E) &&\n                iso2022jp_state !== states.Roman) {\n                stream.prepend(code_point);\n                iso2022jp_state = states.Roman;\n                return [0x1B, 0x28, 0x4A];\n            }\n\n            // 7. If code point is U+2022, set it to U+FF0D.\n            if (code_point === 0x2022)\n                code_point = 0xFF0D;\n\n            // 8. Let pointer be the index pointer for code point in index\n            // jis0208.\n            var pointer = indexPointerFor(code_point, index('jis0208'));\n\n            // 9. If pointer is null, return error with code point.\n            if (pointer === null)\n                return encoderError(code_point);\n\n            // 10. If iso-2022-jp encoder state is not jis0208, prepend code\n            // point to stream, set iso-2022-jp encoder state to jis0208,\n            // and return three bytes 0x1B 0x24 0x42.\n            if (iso2022jp_state !== states.jis0208) {\n                stream.prepend(code_point);\n                iso2022jp_state = states.jis0208;\n                return [0x1B, 0x24, 0x42];\n            }\n\n            // 11. Let lead be pointer / 94 + 0x21.\n            var lead = div(pointer, 94) + 0x21;\n\n            // 12. Let trail be pointer % 94 + 0x21.\n            var trail = pointer % 94 + 0x21;\n\n            // 13. Return two bytes whose values are lead and trail.\n            return [lead, trail];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['iso-2022-jp'] = function(options) {\n        return new ISO2022JPEncoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['iso-2022-jp'] = function(options) {\n        return new ISO2022JPDecoder(options);\n    };\n\n    // 12.3 shift_jis\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function ShiftJISDecoder(options) {\n        var fatal = options.fatal;\n        // shift_jis's decoder has an associated shift_jis lead (initially\n        // 0x00).\n        var /** @type {number} */ shiftjis_lead = 0x00;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and shift_jis lead is not 0x00,\n            // set shift_jis lead to 0x00 and return error.\n            if (bite === end_of_stream && shiftjis_lead !== 0x00) {\n                shiftjis_lead = 0x00;\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream and shift_jis lead is 0x00,\n            // return finished.\n            if (bite === end_of_stream && shiftjis_lead === 0x00)\n                return finished;\n\n            // 3. If shift_jis lead is not 0x00, let lead be shift_jis lead,\n            // let pointer be null, set shift_jis lead to 0x00, and then run\n            // these substeps:\n            if (shiftjis_lead !== 0x00) {\n                var lead = shiftjis_lead;\n                var pointer = null;\n                shiftjis_lead = 0x00;\n\n                // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41\n                // otherwise.\n                var offset = (bite < 0x7F) ? 0x40 : 0x41;\n\n                // 2. Let lead offset be 0x81, if lead is less than 0xA0, and\n                // 0xC1 otherwise.\n                var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;\n\n                // 3. If byte is in the range 0x40 to 0x7E or 0x80 to 0xFC,\n                // set pointer to (lead − lead offset) × 188 + byte − offset.\n                if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC))\n                    pointer = (lead - lead_offset) * 188 + bite - offset;\n\n                // 4. Let code point be null, if pointer is null, and the\n                // index code point for pointer in index jis0208 otherwise.\n                var code_point = (pointer === null) ? null :\n                    indexCodePointFor(pointer, index('jis0208'));\n\n                // 5. If code point is null and pointer is in the range 8836\n                // to 10528, return a code point whose value is 0xE000 +\n                // pointer − 8836.\n                if (code_point === null && pointer !== null &&\n                    inRange(pointer, 8836, 10528))\n                    return 0xE000 + pointer - 8836;\n\n                // 6. If code point is null and byte is in the range 0x00 to\n                // 0x7F, prepend byte to stream.\n                if (code_point === null && inRange(bite, 0x00, 0x7F))\n                    stream.prepend(bite);\n\n                // 7. If code point is null, return error.\n                if (code_point === null)\n                    return decoderError(fatal);\n\n                // 8. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 4. If byte is in the range 0x00 to 0x80, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x80))\n                return bite;\n\n            // 5. If byte is in the range 0xA1 to 0xDF, return a code point\n            // whose value is 0xFF61 + byte − 0xA1.\n            if (inRange(bite, 0xA1, 0xDF))\n                return 0xFF61 + bite - 0xA1;\n\n            // 6. If byte is in the range 0x81 to 0x9F or 0xE0 to 0xFC, set\n            // shift_jis lead to byte and return continue.\n            if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {\n                shiftjis_lead = bite;\n                return null;\n            }\n\n            // 7. Return error.\n            return decoderError(fatal);\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function ShiftJISEncoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+0080, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x0080))\n                return code_point;\n\n            // 3. If code point is U+00A5, return byte 0x5C.\n            if (code_point === 0x00A5)\n                return 0x5C;\n\n            // 4. If code point is U+203E, return byte 0x7E.\n            if (code_point === 0x203E)\n                return 0x7E;\n\n            // 5. If code point is in the range U+FF61 to U+FF9F, return a\n            // byte whose value is code point − 0xFF61 + 0xA1.\n            if (inRange(code_point, 0xFF61, 0xFF9F))\n                return code_point - 0xFF61 + 0xA1;\n\n            // 6. If code point is U+2022, set it to U+FF0D.\n            if (code_point === 0x2022)\n                code_point = 0xFF0D;\n\n            // 7. Let pointer be the index shift_jis pointer for code point.\n            var pointer = indexShiftJISPointerFor(code_point);\n\n            // 8. If pointer is null, return error with code point.\n            if (pointer === null)\n                return encoderError(code_point);\n\n            // 9. Let lead be pointer / 188.\n            var lead = div(pointer, 188);\n\n            // 10. Let lead offset be 0x81, if lead is less than 0x1F, and\n            // 0xC1 otherwise.\n            var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1;\n\n            // 11. Let trail be pointer % 188.\n            var trail = pointer % 188;\n\n            // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41\n            // otherwise.\n            var offset = (trail < 0x3F) ? 0x40 : 0x41;\n\n            // 13. Return two bytes whose values are lead + lead offset and\n            // trail + offset.\n            return [lead + lead_offset, trail + offset];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['shift_jis'] = function(options) {\n        return new ShiftJISEncoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['shift_jis'] = function(options) {\n        return new ShiftJISDecoder(options);\n    };\n\n    //\n    // 13. Legacy multi-byte Korean encodings\n    //\n\n    // 13.1 euc-kr\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function EUCKRDecoder(options) {\n        var fatal = options.fatal;\n\n        // euc-kr's decoder has an associated euc-kr lead (initially 0x00).\n        var /** @type {number} */ euckr_lead = 0x00;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set\n            // euc-kr lead to 0x00 and return error.\n            if (bite === end_of_stream && euckr_lead !== 0) {\n                euckr_lead = 0x00;\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream and euc-kr lead is 0x00, return\n            // finished.\n            if (bite === end_of_stream && euckr_lead === 0)\n                return finished;\n\n            // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let\n            // pointer be null, set euc-kr lead to 0x00, and then run these\n            // substeps:\n            if (euckr_lead !== 0x00) {\n                var lead = euckr_lead;\n                var pointer = null;\n                euckr_lead = 0x00;\n\n                // 1. If byte is in the range 0x41 to 0xFE, set pointer to\n                // (lead − 0x81) × 190 + (byte − 0x41).\n                if (inRange(bite, 0x41, 0xFE))\n                    pointer = (lead - 0x81) * 190 + (bite - 0x41);\n\n                // 2. Let code point be null, if pointer is null, and the\n                // index code point for pointer in index euc-kr otherwise.\n                var code_point = (pointer === null) ? null : indexCodePointFor(pointer, index('euc-kr'));\n\n                // 3. If code point is null and byte is in the range 0x00 to\n                // 0x7F, prepend byte to stream.\n                if (pointer === null && inRange(bite, 0x00, 0x7F))\n                    stream.prepend(bite);\n\n                // 4. If code point is null, return error.\n                if (code_point === null)\n                    return decoderError(fatal);\n\n                // 5. Return a code point whose value is code point.\n                return code_point;\n            }\n\n            // 4. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 5. If byte is in the range 0x81 to 0xFE, set euc-kr lead to\n            // byte and return continue.\n            if (inRange(bite, 0x81, 0xFE)) {\n                euckr_lead = bite;\n                return null;\n            }\n\n            // 6. Return error.\n            return decoderError(fatal);\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function EUCKREncoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 3. Let pointer be the index pointer for code point in index\n            // euc-kr.\n            var pointer = indexPointerFor(code_point, index('euc-kr'));\n\n            // 4. If pointer is null, return error with code point.\n            if (pointer === null)\n                return encoderError(code_point);\n\n            // 5. Let lead be pointer / 190 + 0x81.\n            var lead = div(pointer, 190) + 0x81;\n\n            // 6. Let trail be pointer % 190 + 0x41.\n            var trail = (pointer % 190) + 0x41;\n\n            // 7. Return two bytes whose values are lead and trail.\n            return [lead, trail];\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['euc-kr'] = function(options) {\n        return new EUCKREncoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['euc-kr'] = function(options) {\n        return new EUCKRDecoder(options);\n    };\n\n\n    //\n    // 14. Legacy miscellaneous encodings\n    //\n\n    // 14.1 replacement\n\n    // Not needed - API throws RangeError\n\n    // 14.2 utf-16\n\n    /**\n     * @param {number} code_unit\n     * @param {boolean} utf16be\n     * @return {!Array.<number>} bytes\n     */\n    function convertCodeUnitToBytes(code_unit, utf16be) {\n        // 1. Let byte1 be code unit >> 8.\n        var byte1 = code_unit >> 8;\n\n        // 2. Let byte2 be code unit & 0x00FF.\n        var byte2 = code_unit & 0x00FF;\n\n        // 3. Then return the bytes in order:\n        // utf-16be flag is set: byte1, then byte2.\n        if (utf16be)\n            return [byte1, byte2];\n        // utf-16be flag is unset: byte2, then byte1.\n        return [byte2, byte1];\n    }\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {boolean} utf16_be True if big-endian, false if little-endian.\n     * @param {{fatal: boolean}} options\n     */\n    function UTF16Decoder(utf16_be, options) {\n        var fatal = options.fatal;\n        var /** @type {?number} */ utf16_lead_byte = null,\n            /** @type {?number} */ utf16_lead_surrogate = null;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream and either utf-16 lead byte or\n            // utf-16 lead surrogate is not null, set utf-16 lead byte and\n            // utf-16 lead surrogate to null, and return error.\n            if (bite === end_of_stream && (utf16_lead_byte !== null ||\n                utf16_lead_surrogate !== null)) {\n                return decoderError(fatal);\n            }\n\n            // 2. If byte is end-of-stream and utf-16 lead byte and utf-16\n            // lead surrogate are null, return finished.\n            if (bite === end_of_stream && utf16_lead_byte === null &&\n                utf16_lead_surrogate === null) {\n                return finished;\n            }\n\n            // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte\n            // and return continue.\n            if (utf16_lead_byte === null) {\n                utf16_lead_byte = bite;\n                return null;\n            }\n\n            // 4. Let code unit be the result of:\n            var code_unit;\n            if (utf16_be) {\n                // utf-16be decoder flag is set\n                //   (utf-16 lead byte << 8) + byte.\n                code_unit = (utf16_lead_byte << 8) + bite;\n            } else {\n                // utf-16be decoder flag is unset\n                //   (byte << 8) + utf-16 lead byte.\n                code_unit = (bite << 8) + utf16_lead_byte;\n            }\n            // Then set utf-16 lead byte to null.\n            utf16_lead_byte = null;\n\n            // 5. If utf-16 lead surrogate is not null, let lead surrogate\n            // be utf-16 lead surrogate, set utf-16 lead surrogate to null,\n            // and then run these substeps:\n            if (utf16_lead_surrogate !== null) {\n                var lead_surrogate = utf16_lead_surrogate;\n                utf16_lead_surrogate = null;\n\n                // 1. If code unit is in the range U+DC00 to U+DFFF, return a\n                // code point whose value is 0x10000 + ((lead surrogate −\n                // 0xD800) << 10) + (code unit − 0xDC00).\n                if (inRange(code_unit, 0xDC00, 0xDFFF)) {\n                    return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +\n                        (code_unit - 0xDC00);\n                }\n\n                // 2. Prepend the sequence resulting of converting code unit\n                // to bytes using utf-16be decoder flag to stream and return\n                // error.\n                stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));\n                return decoderError(fatal);\n            }\n\n            // 6. If code unit is in the range U+D800 to U+DBFF, set utf-16\n            // lead surrogate to code unit and return continue.\n            if (inRange(code_unit, 0xD800, 0xDBFF)) {\n                utf16_lead_surrogate = code_unit;\n                return null;\n            }\n\n            // 7. If code unit is in the range U+DC00 to U+DFFF, return\n            // error.\n            if (inRange(code_unit, 0xDC00, 0xDFFF))\n                return decoderError(fatal);\n\n            // 8. Return code point code unit.\n            return code_unit;\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {boolean} utf16_be True if big-endian, false if little-endian.\n     * @param {{fatal: boolean}} options\n     */\n    function UTF16Encoder(utf16_be, options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1. If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+FFFF, return the\n            // sequence resulting of converting code point to bytes using\n            // utf-16be encoder flag.\n            if (inRange(code_point, 0x0000, 0xFFFF))\n                return convertCodeUnitToBytes(code_point, utf16_be);\n\n            // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,\n            // converted to bytes using utf-16be encoder flag.\n            var lead = convertCodeUnitToBytes(\n                ((code_point - 0x10000) >> 10) + 0xD800, utf16_be);\n\n            // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,\n            // converted to bytes using utf-16be encoder flag.\n            var trail = convertCodeUnitToBytes(\n                ((code_point - 0x10000) & 0x3FF) + 0xDC00, utf16_be);\n\n            // 5. Return a byte sequence of lead followed by trail.\n            return lead.concat(trail);\n        };\n    }\n\n    // 14.3 utf-16be\n    /** @param {{fatal: boolean}} options */\n    encoders['utf-16be'] = function(options) {\n        return new UTF16Encoder(true, options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['utf-16be'] = function(options) {\n        return new UTF16Decoder(true, options);\n    };\n\n    // 14.4 utf-16le\n    /** @param {{fatal: boolean}} options */\n    encoders['utf-16le'] = function(options) {\n        return new UTF16Encoder(false, options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['utf-16le'] = function(options) {\n        return new UTF16Decoder(false, options);\n    };\n\n    // 14.5 x-user-defined\n\n    /**\n     * @constructor\n     * @implements {Decoder}\n     * @param {{fatal: boolean}} options\n     */\n    function XUserDefinedDecoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream The stream of bytes being decoded.\n         * @param {number} bite The next byte read from the stream.\n         * @return {?(number|!Array.<number>)} The next code point(s)\n         *     decoded, or null if not enough data exists in the input\n         *     stream to decode a complete code point.\n         */\n        this.handler = function(stream, bite) {\n            // 1. If byte is end-of-stream, return finished.\n            if (bite === end_of_stream)\n                return finished;\n\n            // 2. If byte is in the range 0x00 to 0x7F, return a code point\n            // whose value is byte.\n            if (inRange(bite, 0x00, 0x7F))\n                return bite;\n\n            // 3. Return a code point whose value is 0xF780 + byte − 0x80.\n            return 0xF780 + bite - 0x80;\n        };\n    }\n\n    /**\n     * @constructor\n     * @implements {Encoder}\n     * @param {{fatal: boolean}} options\n     */\n    function XUserDefinedEncoder(options) {\n        var fatal = options.fatal;\n        /**\n         * @param {Stream} stream Input stream.\n         * @param {number} code_point Next code point read from the stream.\n         * @return {(number|!Array.<number>)} Byte(s) to emit.\n         */\n        this.handler = function(stream, code_point) {\n            // 1.If code point is end-of-stream, return finished.\n            if (code_point === end_of_stream)\n                return finished;\n\n            // 2. If code point is in the range U+0000 to U+007F, return a\n            // byte whose value is code point.\n            if (inRange(code_point, 0x0000, 0x007F))\n                return code_point;\n\n            // 3. If code point is in the range U+F780 to U+F7FF, return a\n            // byte whose value is code point − 0xF780 + 0x80.\n            if (inRange(code_point, 0xF780, 0xF7FF))\n                return code_point - 0xF780 + 0x80;\n\n            // 4. Return error with code point.\n            return encoderError(code_point);\n        };\n    }\n\n    /** @param {{fatal: boolean}} options */\n    encoders['x-user-defined'] = function(options) {\n        return new XUserDefinedEncoder(options);\n    };\n    /** @param {{fatal: boolean}} options */\n    decoders['x-user-defined'] = function(options) {\n        return new XUserDefinedDecoder(options);\n    };\n\n    if (!global['TextEncoder'])\n        global['TextEncoder'] = TextEncoder;\n    if (!global['TextDecoder'])\n        global['TextDecoder'] = TextDecoder;\n}(this));\n"
  },
  {
    "path": "bin/client/assets/Script/Encoding.js.meta",
    "content": "{\n  \"ver\": \"1.0.2\",\n  \"uuid\": \"2d3ef493-9e65-47f1-a3cc-c30517fcd563\",\n  \"isPlugin\": true,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Script/main.js",
    "content": "var CountDown = require('CountDown');\ncc.Class({\n    extends: CountDown,\n\n    properties: {\n\n        data:null,\n\n        card:{\n            default:[],\n            type:cc.Node\n        },\n        inpot:{\n            default: null,\n            type: cc.Node\n        },\n        //桌子上的筹码数量\n        table_chips_inpot:0,\n        //桌子上需要收入底池的筹码节点\n        table_chips:{\n            default:[],\n            type:[cc.Node]\n        },\n\n        table_tips:{\n            default:[],\n            type:[cc.Node]\n        },\n\n        game_card_turn:0,\n        game_card_river:0,\n\n        cleanNode:{\n            default:[],\n            type:cc.Node\n        },\n        cleanSp:{\n            default:[],\n            type:cc.Sprite\n        },\n        //游戏是否在播放 0-未播放 1-正在播放 2-播放完毕\n        game_start:0,\n\n        //t_sprite:{//定义一个cc的类型，并定义上常用属性\n        //    default:null,\n        //    type:cc.SpriteFrame,//类型的定义\n        //    url:cc.Texture2D, //Raw Asset(cc.Texture2D, cc.Font, cc.AudioClip)\n        //    enabled:true,//属性检查器中是否可见\n        //    displayName:'himi',//属性检查器中属性的名字\n        //    tooltip:\"测试脚本\",//属性检查器中停留此属性名称显示的提示文字\n        //    readonly:false,//属性检查器中显示（readonly）且不可修改[当前有bug，设定只读也能修改]\n        //    serializable:true,//设置false就是临时变量\n        //    editorOnly:false//导出项目前剔除此属性\n        //},\n\n        ////可以只定义 get 方法，这样相当于一份 readonly 的属性。[当前有bug，只设定get也能修改]\n        //t_getSet:{\n        //    default:12,\n        //    get:function(){return this.t_getSet},//get\n        //    set:function(value){this.t_getSet =value;}//set\n        //},\n\n\n    },\n\n    // use this for initialization\n    onLoad: function () {\n        var me = this;\n        me.is_mobile = this.isMobile();\n        if(me.is_mobile == 0){\n            var canvas = cc.find(\"Canvas\");\n            canvas.width = 418;\n            canvas.height = 738;\n        }\n        cc.game.config.showFPS=false;\n\n        cc.director.setDisplayStats(false);\n\n        this.eventListen();\n\n        //资源的后缀,方便加载不同资源\n        var lang = this.getQueryString(\"lang\");\n        lang = lang?lang:\"zh-cn\";\n        //lang = 'en-us';\n        var config_lang = {\"zh-cn\":\"cn\",\"thai-th\":\"th\",\"en-us\":\"en\",\"zh-tw\":\"tw\",\"ko\":\"ko\"};\n        if(config_lang[lang] == null || config_lang[lang] == undefined){\n            lang = \"zh-cn\";\n        }\n        this.Lang = lang;\n        this.SourceSuffix = config_lang[lang];\n        //按钮的提示\n        var sound_tip = cc.find(\"Canvas/sound/sound_tips\");\n        sound_tip.getComponent(cc.Label).string=this.ConvertLang(\"mute\");//静音\n\n        //多语言替换座位\n        //this.ReplaceSeat();\n\n\n\n        //4. 先获取目标组件所在的节点，然后通过getComponent获取目标组件\n        //var _label = cc.find(\"Canvas/label\").getComponent(cc.Label);\n\n        //var _label = cc.find(\"Canvas/card_49\").getComponent(cc.Sprite);\n\n        //cc.log(_label instanceof cc.Sprite);       // true\n\n\n        // //--->>>复制节点/或者复制 prefab\n        // //复制节点\n        // var lLabel = cc.instantiate(this.label);\n        // lLabel.node.parent = this.node;\n        // lLabel.node.setPosition(-200,0);\n        // //复制prefab\n        // var tPrefab = cc.instantiate(this.t_prefab);\n        // tPrefab.parent = this.node;\n        // tPrefab.setPosition(-210,100);\n\n        \n\n        // //--->>> 发射事件（事件手动触发)\n        // this.node.on(\"tEmitFun\",function (event){\n        //     console.log(\"tEmitFun event:\"+event.detail.himi+\"|\"+event.detail.say);\n\n        //     //-->>> 事件中断,如下函数阻止事件向当前父级进行事件传递\n        //     // event.stopPropagation();\n        // });\n        // this.node.emit(\"tEmitFun\",{himi:27,say:\"hello,cc!\"});\n\n        //牌局回放加载数据\n        //this.reqstart();\n\n        //websocket请求\n        this.wsstart();\n\n        this.onSeat();\n\n\n    },\n\n    eventListen:function(){\n\n        //当手指触点落在目标节点区域内时\n        var sound=cc.find(\"Canvas/sound\");\n\n        sound.on(\"mouseenter\",function(event){\n            sound.getChildByName(\"sound_tips\").opacity=255;\n        });\n        sound.on(\"mouseleave\",function(event){\n            sound.getChildByName(\"sound_tips\").opacity=0;\n        });\n\n        sound.on(\"touchstart\",function(event){\n            sound.getChildByName(\"sound_tips\").opacity=255;\n        });\n\n        sound.on(\"touchend\",function(event){\n            sound.getChildByName(\"sound_tips\").opacity=0;\n        });\n    },\n\n\n    //    站起\t\t\t\t\t\t\t5\n    //    离开房间\t\t\t\t\t\t6\n    //    flop发牌命令\t\t\t\t\t9\n    //    turn发牌命令\t\t\t\t\t10\n    //    river发牌命令\t\t\t\t\t11\n    //    check\t\t\t\t\t\t    12\n    //    call\t\t\t\t\t\t\t13\n    //    raise\t\t\t\t\t\t    14\n    //    fold\t\t\t\t\t\t\t15\n    //    一手结束数据    \t\t\t\t16\n    //    发表情    \t\t\t\t\t    17\n    //    发道具  \t\t\t\t\t\t18\n    //    延时操作\t\t\t\t\t\t19\n    //    主动亮牌\t\t\t\t\t\t24\n    //    牌局结束                       25\n    //    发道具（可连发和群发）           35\n    //    聊天消息                       36\n\n    //    \"CMD\" : 13,\n    //    \"chair_id\" : 3,\n    //    \"chip\" : 1,\n    //    \"current_action_chair\" : 4,\n    //    \"current_pot\" : 4,\n    //    \"pot\" : 4,\n    //    \"timestamp\" : 1466422796,\n\n    actionend:function(){\n        var i  = this.i;\n        this.i=i+1;\n\n        if(i<this.actions.length){\n            switch(this.actions[i][\"CMD\"]){\n                case 5:\n                    this.quit(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 6:\n                    this.quit(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 9:\n                    //\"CMD\" : 9,\n                    //\"common_card\" : [41, 40, 54],\n                    //\"current_action_chair\" : 4,\n                    //\"current_pot\" : 76,\n                    //\"pot\" : 76,\n                    //\"timestamp\" : 1466422815\n                    this.scheduleOnce(function(){\n                        this.table_chips_inpot=0;\n                        this.tableToPot(this.actions[i][\"current_pot\"],this.actions[i][\"pot\"]);\n                    },1);\n                    this.scheduleOnce(function(){\n                        this.flopstart(this.actions[i][\"common_card\"]);\n                    },2);\n\n                    break;\n                case 10:\n                    //\"CMD\" : 10,\n                    //\"common_card\" : [29],\n                    //\"current_action_chair\" : 4,\n                    //\"current_pot\" : 76,\n                    //\"pot\" : 76,\n                    //\"timestamp\" : 1466422848\n                    this.scheduleOnce(function(){\n                        this.table_chips_inpot=0;\n                        this.tableToPot(this.actions[i][\"current_pot\"],this.actions[i][\"pot\"]);\n                    },1);\n                    this.scheduleOnce(function(){\n                        this.turnstart(this.actions[i][\"common_card\"]);\n                    },2);\n\n                    break;\n                case 11:\n                    //\"CMD\" : 11,\n                    //\"common_card\" : [12],\n                    //\"current_action_chair\" : 4,\n                    //\"current_pot\" : 228,\n                    //\"pot\" : 228,\n                    //\"timestamp\" : 1466422859\n                    this.scheduleOnce(function(){\n                        this.table_chips_inpot=0;\n                        this.tableToPot(this.actions[i][\"current_pot\"],this.actions[i][\"pot\"]);\n                    },1);\n                    this.scheduleOnce(function(){\n                        this.riverstart(this.actions[i][\"common_card\"]);\n                    },2);\n                    break;\n                case 12:\n                    this.check(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 13:\n                    this.call(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"],this.actions[i][\"current_pot\"],this.actions[i][\"pot\"],this.actions[i][\"chip\"]);\n                    break;\n                case 14:\n                    this.raise(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"],this.actions[i][\"current_pot\"],this.actions[i][\"pot\"],this.actions[i][\"chip\"]);\n                    break;\n                case 15:\n                    this.fold(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 16:\n                    //this.fold(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 19:\n                    //延时\n                    this.delay_think(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    break;\n                case 9999:\n                    //正在等待\n                    this.add_countdown(this.actions[i][\"chair_id\"],this.actions[i][\"duration\"]);\n                    this.countdown_over_task = function(){\n                        this.actionend();\n                    };\n                    break;\n                default:\n                    this.actionend();\n                    break;\n            };\n        }else {\n            if (i == this.actions.length) {\n                this.endshow();\n            }\n        };\n    },\n    //初始化小盲位，大盲位\n    initsb:function(){\n        var table_data = this.hand_data;\n        var node_table_bg = cc.find(\"Canvas/table_bg\");\n        //dealer位\n        var dealer_node = cc.find(\"Canvas/table_bg/seat_\"+table_data['start']['d_chair']+\"/dealer\");\n        var dealer_sprite = dealer_node.getComponent(cc.Sprite);\n        if(dealer_sprite == null){\n            var dealer_sprite = dealer_node.addComponent(cc.Sprite);\n        }else{\n            //如果存在，设置可见\n            dealer_sprite.setVisible(true);\n        }\n        //大盲位\n        var big_blind_node = node_table_bg.getChildByName(\"chip_\"+table_data['start']['bb_chair']);\n        var big_blind_sprite = big_blind_node.getComponent(cc.Sprite);\n        if(big_blind_sprite == null){\n            var big_blind_sprite = big_blind_node.addComponent(cc.Sprite);\n        }\n        //小盲位\n        var small_blind_node = node_table_bg.getChildByName(\"chip_\"+table_data['start']['sb_chair']);\n        var small_blind_sprite = small_blind_node.getComponent(cc.Sprite);\n        if(small_blind_sprite == null){\n            var small_blind_sprite = small_blind_node.addComponent(cc.Sprite);\n        }\n\n        //dealer位的图片加载\n        var dealer_frame = this.GameMain.getSpriteFrame(\"game_dealer_tip\");\n        dealer_sprite.spriteFrame = dealer_frame;\n        //大盲位的图片加载\n        var big_blind_frame = this.GameMain.getSpriteFrame(\"game_bigBlind_tip\");\n        big_blind_sprite.spriteFrame = big_blind_frame;\n        //小盲位的图片加载\n        var small_blind_frame = this.GameMain.getSpriteFrame(\"game_smallBlind_tip\");\n        small_blind_sprite.spriteFrame = small_blind_frame;\n        this.scheduleOnce(this.start_game,1);\n    },\n    //牌局开始，小盲和大盲下注\n    start_game:function(){\n        var hand_data = this.hand_data;\n        var me = this;\n        //加载手牌图片\n        var frame = this.GameMain.getSpriteFrame(\"game_handCard_cover_tip\");\n        var sb_data = null;//小盲的数据\n        var bb_data = null;//大盲的数据\n        //发牌\n        for(var k in hand_data['players']){\n            var v = hand_data['players'][k];\n            var seat_node =  cc.find(\"Canvas/table_bg\").getChildByName(\"seat_\"+v['chair_id']);\n            var node_hand_card = new cc.Node();\n            var sprite_hand_card = node_hand_card.addComponent(cc.Sprite);\n            node_hand_card.scale = 1;\n            node_hand_card.name = \"hand_card\";\n            node_hand_card.parent = seat_node;\n            node_hand_card.setPosition(20,-30);\n            seat_node.getChildByName(\"hand_card\").setLocalZOrder(1);\n            sprite_hand_card.spriteFrame = frame;\n            if(v['chair_id'] == hand_data['start']['sb_chair']){\n                sb_data = v;\n            }else if(v['chair_id'] == hand_data['start']['bb_chair']){\n                bb_data = v;\n            }\n        }\n        me.scheduleOnce(function(){\n            me.chipsToTable(sb_data['chair_id'],sb_data['table_chip'],0,sb_data['table_chip']);\n            me.chipsToTable(bb_data['chair_id'],bb_data['table_chip']+sb_data['table_chip'],0,bb_data['table_chip']);\n        },1);\n        //必须等小盲大盲下注以后，再执行其他动作\n        me.scheduleOnce(function(){\n            me.actionend();\n        },2);\n    },\n    mainstart:function(){\n        if(this.GameMain==null){\n            //资源未加载成功，不能点击\n            return false;\n        };\n\n        if(this.game_start==1){\n            if(cc.director.isPaused()){\n                cc.director.resume();\n                this.buttonPause();\n            }else{\n                this.buttonResume();\n                cc.director.pause();\n            };\n        }else{\n            this.buttonPause();\n            this.game_start=1;\n            if(this.game_start==0){\n                //this.game_start=1;\n            }else{\n                //当游戏播放完毕 重置游戏场景\n                this.resetGame();\n                //this.game_start=0;\n            };\n            this.initsb();\n        };\n    },\n    buttonResume:function(){\n        var btsp=this.node.parent.getChildByName(\"game_table_start_normal\").getComponent(cc.Sprite);\n        if(this.GameMain == null){\n            cc.loader.loadRes(\"GameMain_6p\",cc.SpriteAtlas,function(err,atlas){\n                me.GameMain = atlas;\n                btsp.spriteFrame = this.GameMain.getSpriteFrame(\"game_table_start_normal\");\n            });\n        }else{\n            btsp.spriteFrame = this.GameMain.getSpriteFrame(\"game_table_start_normal\");\n        }\n    },\n    buttonPause:function(){\n        var btsp=this.node.parent.getChildByName(\"game_table_start_normal\").getComponent(cc.Sprite);\n        if(this.GameMain == null){\n            cc.loader.loadRes(\"GameMain\",cc.SpriteAtlas,function(err,atlas){\n                this.GameMain = atlas;\n                btsp.spriteFrame = this.GameMain.getSpriteFrame(\"game_table_start_pause\");\n            });\n        }else{\n            btsp.spriteFrame = this.GameMain.getSpriteFrame(\"game_table_start_pause\");\n        }\n    },\n    buttonDisable:function(){\n        if(this.GameMain==null){\n            //资源未加载成功，不能点击\n            return false;\n        };\n        var b=this.node.parent.getChildByName(\"game_table_start_normal\");\n        b.getComponent(cc.Button).interactable=false;\n    },\n    buttonenable:function(){\n        var b=this.node.parent.getChildByName(\"game_table_start_normal\");\n        b.getComponent(cc.Button).interactable=true;\n    },\n    //显示操作提示\n    game_tip:function(sit,url,clean){\n        var game_tip=this.node.parent.getChildByName(\"table_bg\").getChildByName(\"seat_\"+sit).getChildByName(\"game_tip\");\n        //var pos=table_bg.getChildByName(\"seat_\"+sit).getPosition();//获取坐标\n        var sp=game_tip.getComponent(cc.Sprite);\n        if(cc.isValid(sp)){\n            //sp.destroy();\n        }else{\n            sp=game_tip.addComponent(cc.Sprite);\n        }\n\n        if(url == 'game_allIn_tip'){\n            var me = this;\n            if(this.GameMain == null){\n                cc.loader.loadRes(\"GameMain_6p\",cc.SpriteAtlas,function(err,atlas){\n                    me.GameMain = atlas;\n                    sp.spriteFrame = me.GameMain.getSpriteFrame(url);\n                });\n            }else{\n                sp.spriteFrame = me.GameMain.getSpriteFrame(url);\n            }\n        }else{\n            cc.loader.loadRes(\"GameMain_\"+this.SourceSuffix+\"_6p\", cc.SpriteAtlas, function (err, atlas) {\n                sp.spriteFrame = atlas.getSpriteFrame(url);\n            });\n        }\n        if(clean){\n            this.table_tips.push(game_tip);\n        }else{\n            this.cleanSp.push(sp);\n        };\n        //当前动作结束\n        this.actionend();\n    },\n    //check\n    check:function(sit,duration){\n        this.countdown_over_task=null;\n        this.add_countdown(sit,duration);\n        //var turn = cc.callFunc(this.showriver, this, node);\n\n        var url=\"game_check_tip\";\n        var me = this;\n        var finished=function(){\n            // play audioSource\n            if(me.open_mute == 0){\n                if(me.audio_check == null ){\n                    cc.loader.loadRes(\"audio/audio_check\", function (err, assets) {\n                        me.audio_check = assets;\n                        cc.audioEngine.playEffect(assets);\n                    });\n                }else{\n                    cc.audioEngine.playEffect(me.audio_check);\n                }\n            }\n            this.game_tip(sit,url,true);\n        };\n        this.countdown_over_task=finished;\n\n    },\n    //弃牌\n    fold:function(sit,duration){\n        this.countdown_over_task=null;\n\n        this.add_countdown(sit,duration);\n\n        var url=\"game_fold_tip\";\n        var me = this;\n        var finished = function(){\n            if(me.open_mute == 0){\n                if(me.audio_fold == null ){\n                    cc.loader.loadRes(\"audio/audio_fold\", function (err, assets) {\n                        me.audio_fold = assets;\n                        cc.audioEngine.playEffect(assets);\n                    });\n                }else{\n                    cc.audioEngine.playEffect(me.audio_fold);\n                }\n            }\n            me.game_tip(sit,url,false);\n        };\n        this.countdown_over_task=finished;\n\n    },\n    bet:function(sit,duration,pot,inpot,handChips){\n        this.countdown_over_task=null;\n\n        var url=\"game_bet_tip\";\n        this.add_countdown(sit,duration);\n\n        var finished=function(){\n            this.game_tip(sit,url,true);\n            this.chipsToTable(sit,pot,inpot,handChips);\n        };\n        this.countdown_over_task=finished;\n    },\n    call:function(sit,duration,pot,inpot,handChips){\n        this.countdown_over_task=null;\n\n        var url=\"game_call_tip\";\n        this.add_countdown(sit,duration);\n\n        var finished=function(){\n            var seat_node = cc.find(\"Canvas/table_bg/seat_\"+sit+\"/chips\");\n            var seat_lable = seat_node.getComponent(cc.Label);\n            var seat_chips = parseInt(seat_lable.string);\n            if(seat_chips <= handChips){\n                url = 'game_allIn_tip';\n            }\n            this.game_tip(sit,url,true);\n            this.chipsToTable(sit,pot,inpot,handChips);\n        };\n        this.countdown_over_task=finished;\n\n    },\n\n    raise:function(sit,duration,pot,inpot,handChips){\n        this.countdown_over_task=null;\n\n        var url=\"game_raise_tip\";\n        this.add_countdown(sit,duration);\n\n        var finished=function(){\n            var seat_node = cc.find(\"Canvas/table_bg/seat_\"+sit+\"/chips\");\n            var seat_lable = seat_node.getComponent(cc.Label);\n            var seat_chips = parseInt(seat_lable.string);\n            if(seat_chips <= handChips){\n                url = 'game_allIn_tip';\n            }\n            this.game_tip(sit,url,true);\n            this.chipsToTable(sit,pot,inpot,handChips);\n        };\n        this.countdown_over_task=finished;\n\n    },\n    /**\n     * 结束比牌\n     \"end\" : [{\n\t\t\t\"chair_id\" : 3,\n\t\t\t\"change_chip\" : 114,\n\t\t\t\"hand_poker_0\" : 13,\n\t\t\t\"hand_poker_1\" : 43,\n\t\t\t\"new_chip\" : 314,\n\t\t\t\"user_id\" : 145\n\t\t}, {\n\t\t\t\"chair_id\" : 4,\n\t\t\t\"change_chip\" : -114,\n\t\t\t\"hand_poker_0\" : 57,\n\t\t\t\"hand_poker_1\" : 52,\n\t\t\t\"new_chip\" : 86,\n\t\t\t\"user_id\" : 138\n\t\t}\n     ],\n     */\n    end:function(){\n        var data=this.hand_data[\"end\"];\n        if(data){\n            var cardType={\n                \"1\":\"高牌\",          //1 高牌\n                \"2\":\"一对\",          //2 一对\n                \"3\":\"两对\",          //3 两对\n                \"4\":\"三条\",          //4 三张\n                \"5\":\"顺子\",          //5 顺子\n                \"6\":\"同花\",          //6 同花\n                \"7\":\"葫芦\",          //7 葫芦\n                \"8\":\"金刚\",          //8 四张\n                \"9\":\"同花顺\",        //9 同花顺\n                \"10\":\"皇家同花顺\",    //10 皇家同花顺\n            };\n            var len=data.length;\n            for(var i=0;i<len;i++){\n                this.endtip(data[i][\"chair_id\"],data[i][\"change_chip\"],data[i][\"hand_poker_0\"],data[i][\"hand_poker_1\"],cardType[data[i][\"card_type\"]],data[i][\"new_chip\"]);\n            };\n            //游戏播放完毕\n            this.game_start=2;\n            this.buttonResume();\n        };\n    },\n    //亮出所有剩余公牌，准备比牌\n    endshow:function(){\n        //cards = [44,11,22,33,23];\n        //cards = [44,23];\n        //cards = [23];\n        //var cards=[];\n        if(\"undefined\" != typeof this.hand_data[\"common_card\"]){\n            var cards=this.hand_data[\"common_card\"];\n        }else{\n            var cards=[];\n        }\n        var len = cards.length?cards.length:0;\n\n        var duration=0;\n        //桌子上有筹码时才再回收一次\n        if(this.table_chips_inpot>0){\n            duration=duration+1;\n            this.scheduleOnce(function(){\n                this.tableToPot(0,0,this.table_chips_inpot);\n            },duration);\n        }\n        switch(len) {\n            case 1:\n                duration=duration+1;\n                var rivercard=[cards[0]];\n                this.scheduleOnce(function(){\n                    this.riverstart(rivercard);\n                },duration);\n\n                break;\n            case 2:\n                duration=duration+1;\n                var turnpcard=[cards[0]];\n                this.scheduleOnce(function(){\n                    this.turnstart(turnpcard);\n                },duration);\n\n                duration=duration+2;\n                var rivercard=[cards[1]];\n                this.scheduleOnce(function(){\n                    this.riverstart(rivercard);\n                },duration);\n\n                break;\n            case 5:\n                duration=duration+1;\n                var flopcard=[cards[0],cards[1],cards[2]];\n                this.scheduleOnce(function(){\n                    this.flopstart(flopcard);\n                },duration);\n\n                duration=duration+3;\n                var turnpcard=[cards[3]];\n                this.scheduleOnce(function(){\n                    this.turnstart(turnpcard);\n                },duration);\n\n                duration=duration+1;\n                var rivercard=[cards[4]];\n                this.scheduleOnce(function(){\n                    this.riverstart(rivercard);\n                },7);\n\n                break;\n            default:\n\n                break;\n        }\n        duration=duration+1;\n        this.scheduleOnce(function(){\n            this.end();\n            this.buttonenable();\n        },duration);\n    },\n    //比牌结束显示输赢详情\n    endtip:function(sit,chips,card1,card2,cardType,new_chips) {\n        var table_bg = this.node.parent.getChildByName(\"table_bg\");\n        var pos = table_bg.getChildByName(\"seat_\" + sit).getPosition();\n\n        var node = new cc.Node();\n        this.cleanNode.push(node);\n        var lo = node.addComponent(cc.Layout);\n\n        node.parent = this.node.parent;\n        node.setPosition(pos);\n        //node.setPosition(x,y);\n\n        var font = 20;//上下label字体大小\n        var color = new cc.Color(0, 0, 0);//上下字体颜色\n\n        //牌型cardType\n        var ctNode = new cc.Node();\n        var ctChip = ctNode.addComponent(cc.Sprite);\n        ctNode.parent = node;\n        ctNode.setPosition(0, -80);\n\n        //显示当前的筹码数\n        var seat_chips_node = cc.find(\"Canvas/table_bg/seat_\"+sit+\"/chips\");\n        var seat_chips_lable = seat_chips_node.getComponent(cc.Label);\n        seat_chips_lable.string = new_chips;\n        if (chips > 0) {\n            this.potToWinner(pos);\n            var lbNode = new cc.Node();\n            var lbChip = lbNode.addComponent(cc.Sprite);\n            lbChip.spriteFrame = this.GameMain.getSpriteFrame('game_endhand');\n            lbNode.parent = node;\n            lbNode.setPosition(0, 80);\n            //营收文字\n            var lbbNode = new cc.Node();\n            var lbb = lbbNode.addComponent(cc.Label);\n            lbb.string = \"+\" + chips;\n            lbbNode.parent = lbNode;\n            lbb.fontSize = font;\n            lbbNode.color = color;\n            lbbNode.setPosition(0, -10);\n        }\n        //2牌都亮时显示牌型\n        if (card1 > 0 && card2 > 0) {\n            ctChip.spriteFrame =  this.GameMain.getSpriteFrame('game_endhand');\n            //牌型文字\n            var ctlNode = new cc.Node();\n            var ctl = ctlNode.addComponent(cc.Label);\n            ctl.string = cardType;\n            ctlNode.parent = ctNode;\n            ctl.fontSize = font;\n            ctlNode.color = color;\n            ctlNode.setPosition(0, -10);\n        };\n        if (card1 == 0 && card2 == 0) {\n            //不显示底牌\n            return false;\n        };\n        //底牌\n        var c1Node = new cc.Node();\n        var c2Node = new cc.Node();\n        var c1Chip = c1Node.addComponent(cc.Sprite);\n        var c2Chip = c2Node.addComponent(cc.Sprite);\n        c1Node.scale = 0.6;\n        c2Node.scale = 0.6;\n        c1Node.parent = node;\n        c2Node.parent = node;\n        c1Node.setPosition(-28, 0);\n        c2Node.setPosition(28, 0);\n\n        if (card1 > 0 && card2 > 0) {\n            if (card1 < 10) {\n                var card_1 = 'card_0' + card1;\n            } else {\n                var card_1 = 'card_' + card1;\n            }\n\n            if(card2<10){\n                var card_2='card_0'+card2;\n            }else{\n                var card_2='card_'+card2;\n            }\n\n            c1Chip.spriteFrame = this.GameCards.getSpriteFrame(card_1);\n            c2Chip.spriteFrame = this.GameCards.getSpriteFrame(card_2);\n\n        } else {\n            if(card1 > 0 ){\n                //显示牌背\n                c1Chip.spriteFrame = this.GameCards.getSpriteFrame(card_1);\n                //显示牌背\n                c2Chip.spriteFrame = this.GameMain.getSpriteFrame('game_card_reverse');\n            }else{\n                c2Chip.spriteFrame = this.GameCards.getSpriteFrame(card_2);\n                //显示牌背\n                c1Chip.spriteFrame = this.GameMain.getSpriteFrame('game_card_reverse');\n            }\n        }\n    },\n    resetGame:function(){\n        //cc.game.restart();\n        this.resetSeat();\n\n\n        this.card[0].removeAllChildren(true);\n        this.card[1].removeAllChildren(true);\n        this.card[2].removeAllChildren(true);\n        this.card[3].removeAllChildren(true);\n        this.card[4].removeAllChildren(true);\n\n        if(\"undefined\" != typeof this.cleanNode){\n            var len=this.cleanNode.length;\n            if(len>0){\n                for(var i=0;i<len;i++){\n                    if(cc.isValid(this.cleanNode[i])){\n                        this.cleanNode[i].destroy();\n                    };\n                };\n            }\n        };\n\n        if(\"undefined\" != typeof this.cleanSp){\n            var len=this.cleanSp.length;\n            if(len>0){\n                for(var i=0;i<len;i++){\n                    if(cc.isValid(this.cleanSp[i])){\n                        this.cleanSp[i].destroy();\n                    };\n                };\n            }\n        };\n\n        if(\"undefined\" != typeof this.inpot){\n            if(cc.isValid(this.inpot)){\n                this.inpot.destroy();\n            };\n        };\n\n        //清理所有的最后的tips\n        if(this.table_tips){\n            for(var i=0;i<this.table_tips.length;i++){\n                var sp=this.table_tips[i].getComponent(cc.Sprite);\n                if(cc.isValid(sp)){\n                    sp.destroy();\n                };\n            }\n            this.table_tips=[];\n        }\n        //清理dealer\n        var dealer_node = cc.find(\"Canvas/table_bg/seat_\"+this.hand_data['start']['d_chair']+\"/dealer\");\n        if(dealer_node.getComponent(cc.Sprite) != null){\n            dealer_node.getComponent(cc.Sprite).setVisible(false);\n            //dealer_node.getComponent(cc.Sprite).destroy();\n        }\n        this.table_chips_inpot=0;\n\n        this.i = 0;\n\n        //this.game_start=0;\n    },\n    //站起\n    quit:function(sit,duration){\n        var me=this;\n\n        me.countdown_over_task=null;\n\n        var finished = function(){\n            var table_bg = cc.find(\"Canvas/table_bg\");\n            var seat=table_bg.getChildByName(\"seat_\"+sit);\n            //seat.enabled=false;\n            //隐藏图像\n            seat.getChildByName(\"avatar\").setOpacity(0);\n            seat.getChildByName(\"nick\").setOpacity(0);\n            seat.getChildByName(\"chips\").setOpacity(0);\n            seat.getChildByName(\"hand_card\").setOpacity(0);\n            if(seat.getChildByName(\"game_tip\").getComponent(cc.Sprite)!=null){\n                seat.getChildByName(\"game_tip\").getComponent(cc.Sprite).destroy();\n            }\n            //当前动作结束\n            me.actionend();\n        };\n        me.add_countdown(sit,duration);\n        this.countdown_over_task = finished;\n    },\n\n    //底池的筹码分给赢的人 pos赢钱的人的座位位置\n    potToWinner:function(pos){\n\n        var destorySelf=function(node){\n            if(cc.isValid(node)){\n                node.destroy();\n            }\n        };\n        var num=5;//生成多少筹码\n        for(var i=0;i<num;i++){\n            var node=new cc.Node();\n            node.parent=this.node.parent;\n            node.setPosition(0,200);\n            var sp = node.addComponent(cc.Sprite);\n            sp.spriteFrame = this.GameMain.getSpriteFrame('game_chip_tip');\n            var action=cc.moveTo(0.1*i, pos);\n            var hide = cc.callFunc(destorySelf, this, node);\n            var seq=cc.sequence(action,hide);\n            node.runAction(seq);\n        }\n\n    },\n    //桌子上的筹码进入底池\n    tableToPot:function(pot,inpot,addNum){\n\n        if(this.table_tips){\n            for(var i=0;i<this.table_tips.length;i++){\n                var sp=this.table_tips[i].getComponent(cc.Sprite);\n                if(cc.isValid(sp)){\n                    sp.destroy();\n                }\n            }\n            this.table_tips=[];\n        };\n\n        var destorySelf=function(node){\n            if(cc.isValid(node)){\n                node.destroy();\n            }\n        };\n        var destroyChips=function(sp){\n            var action=cc.moveTo(0.5, cc.p(0, 200));\n            var hide = cc.callFunc(destorySelf, this, sp);\n            var seq=cc.sequence(action,hide);\n            //sp.runAction(action);\n            sp.runAction(seq);\n        };\n        var len=this.table_chips.length;\n        if(len>0){\n            for(var i=0;i<this.table_chips.length;i++){\n                this.table_chips[i].removeAllChildren(true);\n                destroyChips(this.table_chips[i]);\n            }\n        }else{\n            return false;\n        }\n        this.inpottop(inpot,addNum);\n        ////底池筹码变化\n        //var inpotNode=this.inpot.getChildByName(\"inpot\");\n        //if(inpotNode!=null){\n        //    var inpotObj=inpotNode.getComponent(cc.Label);\n        //    inpotObj.string = inpot;\n        //}else{\n        //    this.inpottop(inpot,0);\n        //}\n        this.table_chips=[];\n    },\n\n\n    //筹码下注到桌子\n    chipsToTable:function(sit,pot,inpot,handPot){\n        pot=Number(pot);\n        inpot=Number(inpot);\n        //var chips=\"game_chip_tip\";\n        var table_bg=this.node.parent.getChildByName(\"table_bg\");\n        var chipNode=table_bg.getChildByName(\"chip_\"+sit);\n\n        var chipSp=chipNode.getComponent(cc.Sprite);\n        if(cc.isValid(chipSp)){\n            chipSp.destroy();\n        };\n        var pos=table_bg.getChildByName(\"seat_\"+sit).getPosition();//获取坐标\n        var chipPos=chipNode.getPosition();//获取坐标\n\n        var node = new cc.Node();\n        node.name='table_chip_'+sit;\n\n        var sp = node.addComponent(cc.Sprite);\n        sp.spriteFrame = this.GameMain.getSpriteFrame('game_chip_tip');\n\n        var action = cc.moveTo(0.2,chipPos);\n\n        var showLabel=function(node){\n            var node_name = node.name;//找到这个节点\n            var node = cc.find(\"Canvas/table_bg/\"+node_name);//用这个方法找到节点，重新赋值，否则无法找到该节点的子节点\n            var table_chips_node = node.getChildByName(\"table_chip\");\n            if(table_chips_node == null){\n                var cn = new cc.Node();\n                var chipLabel = cn.addComponent(cc.Label);\n                cn.name = \"table_chip\";\n                cn.parent = node;\n                chipLabel.fontSize = this.fontStyle['chip']['fontSize'];\n                chipLabel.lineHeight = this.fontStyle['chip']['lineHeight'];\n                cn.color = new cc.Color(0,0,0);\n                cn.opacity = 100;\n                cn.setPosition(0,-40);\n                chipLabel.string = handPot;\n            }else{\n                var chipLabel = table_chips_node.getComponent(cc.Label);\n                chipLabel.string = parseInt(chipLabel.string) + handPot;\n            }\n            //桌子上总筹码数量\n            this.table_chips_inpot=this.table_chips_inpot+handPot;\n\n            //剩余的筹码变化\n            var seat_node = table_bg.getChildByName(\"seat_\"+sit);\n            var seat_chips_node = seat_node.getChildByName(\"chips\");\n            var seat_chips_label = seat_chips_node.getComponent(cc.Label);\n            seat_chips_label.string = parseInt(seat_chips_label.string) - handPot;\n        };\n        var showSelf = cc.callFunc(showLabel, this, node);\n\n        var seq=cc.sequence(action,showSelf);\n\n        this.table_chips.push(node);\n\n        //先把节点enable=false，加载完声音，把节点显示出来，接着做动作\n        node.parent = table_bg;\n        node.setPosition(pos);\n        node.enabled=false;\n\n        // play audioSource播放下注的声音\n        var me = this;\n        if(me.open_mute == 0){\n            if(me.audio_chipsToTable == null){\n                cc.loader.loadRes(\"audio/audio_chipsToTable\", function (err, assets) {\n                    me.audio_chipsToTable = assets;\n                    cc.audioEngine.playEffect(assets);\n                    //把节点显示出来，接着做动作\n                    node.enabled=true;\n                    node.runAction(seq);\n                });\n            }else{\n                cc.audioEngine.playEffect(this.audio_chipsToTable);\n                //把节点显示出来，接着做动作\n                node.enabled=true;\n                node.runAction(seq);\n            }\n        }else{\n            //把节点显示出来，接着做动作\n            node.enabled=true;\n            node.runAction(seq);\n        }\n        this.inpotstart(pot);\n    },\n\n    //inpot 底池筹码变化\n    inpotstart:function(pot){\n        pot = parseInt(pot);\n        pot = isNaN(pot)== true?0:pot;\n        if(pot == 0){\n            return false;\n        };\n        if(\"undefined\" != typeof this.inpot){\n            if(cc.isValid(this.inpot)){\n                var potObj=this.inpot.getChildByName(\"pot\").getComponent(cc.Label);\n                potObj.string=this.ConvertLang(\"pot\")+\"：\" + pot;\n            }else{\n                this.inpot = new cc.Node();\n                //this.cleanNode.push(this.inpot);\n                this.inpot.parent=this.node.parent;\n                this.inpot.setPosition(0,250);\n                var potNode=new cc.Node();\n                var plb = potNode.addComponent(cc.Label);\n                plb.fontSize = this.fontStyle['pot']['fontSize'];\n                plb.lineHeight = this.fontStyle['pot']['lineHeight'];\n                potNode.color = new cc.Color(0,0,0);\n                potNode.opacity = 100;\n                potNode.name=\"pot\";\n                potNode.parent=this.inpot;\n                potNode.setPosition(0,-60);\n                plb.string=this.ConvertLang(\"pot\")+\"：\" + pot;\n            }\n        }\n    },\n    //底池 最终结果生成 inpot 总底池   addNum 新增加了多少 默认0 当传递第二个参数时，第一个参数可以传0\n    inpottop:function(inpot,addNum){\n        inpot = parseInt(inpot);\n        inpot = isNaN(inpot)== true?0:inpot;\n\n        addNum = parseInt(addNum);\n        addNum = isNaN(addNum)== true?0:addNum;\n\n        //底池筹码变化\n        var inpotNode=this.inpot.getChildByName(\"inpot\");\n        if(inpotNode!=null){\n            var inpotObj=inpotNode.getComponent(cc.Label);\n            if(addNum>0){\n                inpot=parseInt(inpotObj.string)+addNum;\n            };\n            inpotObj.string = inpot;\n        }else{\n            var sp = this.inpot.addComponent(cc.Sprite);\n            sp.spriteFrame = this.GameMain.getSpriteFrame('game_inPot_frame');\n            var node=new cc.Node();\n            var lb = node.addComponent(cc.Label);\n            lb.fontSize=25;\n            if(addNum>0){\n                inpot = inpot+addNum;\n            };\n            lb.string=inpot;\n            //node.color = new cc.Color(0, 0, 0);\n            node.name=\"inpot\";\n            node.parent=this.inpot;\n            node.setPosition(0,-12);\n        }\n    },\n\n    /**\n     *  说明：flop三张牌移动效果\n     *  card 公牌数组\n     */\n    flopstart:function(card){\n        var card1;\n        if(card[0]<10){\n            card1='card_0'+card[0];\n        }else{\n            card1='card_'+card[0];\n        }\n        var card2;\n        if(card[1]<10){\n            card2='card_0'+card[1];\n        }else{\n            card2='card_'+card[1];\n        }\n        var card3;\n        if(card[2]<10){\n            card3='card_0'+card[2];\n        }else{\n            card3='card_'+card[2];\n        }\n        var node1=new cc.Node();\n        //var node1=new cc.Node();\n        var mSf1 = node1.addComponent(cc.Sprite);\n\n        var node2=new cc.Node();\n        var mSf2 = node2.addComponent(cc.Sprite);\n\n        var node3=new cc.Node();\n        var mSf3 = node3.addComponent(cc.Sprite);\n\n        mSf1.spriteFrame = this.GameCards.getSpriteFrame(card1);\n        mSf2.spriteFrame = this.GameCards.getSpriteFrame(card2);\n        mSf3.spriteFrame = this.GameCards.getSpriteFrame(card3);\n\n        mSf1.enabled=true;\n        //node1.active=true;\n        //node1.parent = this.node.parent;\n        //node1.setPosition(-200,50);\n\n\n        mSf2.enabled=true;\n        //node2.active=true;\n        //node2.parent = this.node.parent;\n        //node2.setPosition(-200,50);\n\n\n        mSf3.enabled=true;\n        //node3.active=true;\n        //node3.parent = this.node.parent;\n        //node3.setPosition(-200,50);\n\n\n        //var action1=cc.moveTo(1, cc.p(-100, 50));\n        //var action2=cc.moveTo(2, cc.p(0, 50));\n        var action1=cc.moveTo(1, cc.p(90, 0));\n        var action2=cc.moveTo(2, cc.p(180, 0));\n        var action3=cc.callFunc(function(){\n            //flop结束\n            this.actionend();\n        },this);\n\n        var seq=cc.sequence(action2,action3);\n\n        var me = this;\n        if(me.open_mute == 0){\n            if(me.audio_distributeCard == null){\n                cc.loader.loadRes(\"audio/audio_distributeCard\", function (err, assets) {\n                    me.audio_distributeCard = assets;\n                    cc.audioEngine.playEffect(assets);\n                    node1.parent=this.card[0];\n                    node2.parent=this.card[1];\n                    node3.parent=this.card[2];\n                    node1.runAction(action1);\n                    node2.runAction(seq);\n                });\n            }else{\n                cc.audioEngine.playEffect(this.audio_distributeCard);\n                node1.parent=this.card[0];\n                node2.parent=this.card[1];\n                node3.parent=this.card[2];\n                node1.runAction(action1);\n                node2.runAction(seq);\n            }\n        }else{\n            node1.parent=this.card[0];\n            node2.parent=this.card[1];\n            node3.parent=this.card[2];\n            node1.runAction(action1);\n            node2.runAction(seq);\n        }\n    },\n    /**\n    *  说明：翻牌效果\n    *  card 公牌数组\n    */\n    turnstart:function(card){\n        this.game_card_turn=card[0];\n        var node=new cc.Node();\n        var mSf = node.addComponent(cc.Sprite);\n        var frame = this.GameMain.getSpriteFrame('game_card_reverse');\n        mSf.spriteFrame = frame;\n\n        mSf.enabled=true;\n        node.active=true;\n        node.parent = this.node.parent;\n        node.setPosition(101,-10);\n\n        var turn = cc.callFunc(this.showturn, this, node);\n\n        var action1=cc.rotateTo(0.3, 0, 180);\n\n        var seq=cc.sequence(action1,turn);\n        var me = this;\n        if(me.open_mute == 0){\n            if(me.audio_distributeCard == null){\n                cc.loader.loadRes(\"audio/audio_distributeCard\", function (err, assets) {\n                    me.audio_distributeCard = assets;\n                    node.runAction(seq);\n                    cc.audioEngine.playEffect(assets);\n                });\n            }else{\n                node.runAction(seq);\n                cc.audioEngine.playEffect(this.audio_distributeCard);\n            }\n        }else{\n            node.runAction(seq);\n        }\n    },\n    /**\n     *  说明：翻牌效果 回调\n     *  node 牌背节点\n     */\n    showturn:function(node){\n        var card1;\n        if(this.game_card_turn<10){\n            card1='card_0'+this.game_card_turn;\n        }else{\n            card1='card_'+this.game_card_turn;\n        }\n        var node1=new cc.Node();\n        node1.parent=this.card[3];\n        var mSf = node1.addComponent(cc.Sprite);\n        mSf.spriteFrame = this.GameCards.getSpriteFrame(card1);\n        if(cc.isValid(node)){\n            node.destroy();\n        }\n        this.actionend();\n\n    },\n    //翻牌效果\n    riverstart:function(card){\n        this.game_card_river=card[0];\n        var node=new cc.Node();\n        var mSf = node.addComponent(cc.Sprite);\n        var frame = this.GameMain.getSpriteFrame('game_card_reverse');\n        mSf.spriteFrame = frame;\n\n        mSf.enabled=true;\n        node.active=true;\n        //node.parent = this.card[4];\n        node.parent=this.node.parent;\n        node.setPosition(192,-10);\n\n        var turn = cc.callFunc(this.showriver, this, node);\n\n        var action1=cc.rotateTo(0.3, 0, 180);\n\n        var seq=cc.sequence(action1,turn);\n\n        var me = this;\n        if(me.open_mute == 0){\n            if(me.audio_distributeCard == null){\n                cc.loader.loadRes(\"audio/audio_distributeCard\", function (err, assets) {\n                    me.audio_distributeCard = assets;\n                    node.runAction(seq);\n                    cc.audioEngine.playEffect(assets);\n                });\n            }else{\n                node.runAction(seq);\n                cc.audioEngine.playEffect(this.audio_distributeCard);\n            }\n        }else{\n            node.runAction(seq);\n        }\n    },\n    //翻牌效果 回调\n    showriver:function(node){\n        var card1;\n        if(this.game_card_river<10){\n            card1='card_0'+this.game_card_river;\n        }else{\n            card1='card_'+this.game_card_river;\n        }\n\n        var node1=new cc.Node();\n        node1.parent=this.card[4];\n        var mSf = node1.addComponent(cc.Sprite);\n        mSf.spriteFrame = this.GameCards.getSpriteFrame(card1);\n        if(cc.isValid(node)){\n            node.destroy();\n        }\n\n        this.actionend();\n\n    },\n\n\n    timestart:function(pos){\n        this.timer=new cc.Node();\n\n        this.timer.scale=1.2;\n\n        var sp = this.timer.addComponent(cc.Sprite);\n        sp.type = cc.Sprite.Type.FILLED;\n        sp.fillType = cc.Sprite.FillType.RADIAL;\n        sp.fillCenter = new cc.Vec2(0.5, 0.5);\n        sp.fillStart = 0;\n        sp.fillRange = 0;\n        var frame1 = this.GameMain.getSpriteFrame('game_progress_frame');\n        sp.spriteFrame = frame1;\n        this.timersp=sp;\n        this.timer.parent=this.node.parent;\n        this.timer.position=pos;\n        this.timing=true;\n    },\n    //延时操作\n    delay_think:function(seat_number,duration){\n        this.add_countdown(seat_number,duration);\n        var me = this;\n        var finished = function(){\n            me.delay_countdown(seat_number,duration);\n        };\n        this.countdown_over_task = finished;\n    },\n    update: function (dt) {\n\n    },\n    //别人正在操作时，站起\n    other_quit:function(sit){\n        var finished = function(){\n            var table_bg = cc.find(\"Canvas/table_bg\");\n            var seat=table_bg.getChildByName(\"seat_\"+sit);\n            //seat.enabled=false;\n            //隐藏图像\n            seat.getChildByName(\"avatar\").setOpacity(0);\n            seat.getChildByName(\"nick\").setOpacity(0);\n            seat.getChildByName(\"chips\").setOpacity(0);\n            seat.getChildByName(\"hand_card\").setOpacity(0);\n            if(seat.getChildByName(\"game_tip\").getComponent(cc.Sprite)!=null){\n                seat.getChildByName(\"game_tip\").getComponent(cc.Sprite).destroy();\n            }\n        };\n        finished();\n    },\n});\n\n"
  },
  {
    "path": "bin/client/assets/Script/main.js.meta",
    "content": "{\n  \"ver\": \"1.0.2\",\n  \"uuid\": \"ba49ca20-5856-400d-8933-bc1dfd520dc1\",\n  \"isPlugin\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/Script.meta",
    "content": "{\n  \"ver\": \"1.0.1\",\n  \"uuid\": \"3af1e10d-442f-4956-9f83-2dec73688db7\",\n  \"isGroup\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/GameMain_6p.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n    <dict>\n        <key>frames</key>\n        <dict>\n            <key>close_audio.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1331,132},{128,128}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{128,128}}</string>\n                <key>sourceSize</key>\n                <string>{128,128}</string>\n            </dict>\n            <key>forward_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1219,2},{128,128}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{128,128}}</string>\n                <key>sourceSize</key>\n                <string>{128,128}</string>\n            </dict>\n            <key>forward_unnormal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1216,356},{128,128}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{128,128}}</string>\n                <key>sourceSize</key>\n                <string>{128,128}</string>\n            </dict>\n            <key>game_addFriend_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1517,2},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_addFriend_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1417,2},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_addFriend_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1032,513},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_allIn_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{848,198},{156,157}}</string>\n                <key>offset</key>\n                <string>{0,19}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{156,157}}</string>\n                <key>sourceSize</key>\n                <string>{156,195}</string>\n            </dict>\n            <key>game_allIn_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{690,199},{156,157}}</string>\n                <key>offset</key>\n                <string>{0,19}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{156,157}}</string>\n                <key>sourceSize</key>\n                <string>{156,195}</string>\n            </dict>\n            <key>game_allIn_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1349,2},{126,66}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{126,66}}</string>\n                <key>sourceSize</key>\n                <string>{126,66}</string>\n            </dict>\n            <key>game_arrow_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{294,826},{18,24}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{18,24}}</string>\n                <key>sourceSize</key>\n                <string>{18,24}</string>\n            </dict>\n            <key>game_audioPlaying_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{202,687},{120,40}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{120,40}}</string>\n                <key>sourceSize</key>\n                <string>{120,40}</string>\n            </dict>\n            <key>game_audioProgress.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{240,373},{312,36}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{312,36}}</string>\n                <key>sourceSize</key>\n                <string>{312,36}</string>\n            </dict>\n            <key>game_audioProgress_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{202,373},{312,36}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{312,36}}</string>\n                <key>sourceSize</key>\n                <string>{312,36}</string>\n            </dict>\n            <key>game_bigBlind_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1538,297},{58,61}}</string>\n                <key>offset</key>\n                <string>{-2,6}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{8,4},{58,61}}</string>\n                <key>sourceSize</key>\n                <string>{78,81}</string>\n            </dict>\n            <key>game_cardHighlight_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{893,2},{134,184}}</string>\n                <key>offset</key>\n                <string>{-2,8}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{134,184}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>game_cardType_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{396,977},{32,32}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{32,32}}</string>\n                <key>sourceSize</key>\n                <string>{34,34}</string>\n            </dict>\n            <key>game_card_mask.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{720,358},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>game_card_reverse.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{753,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>game_cartType_bg.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1029,2},{150,45}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{150,45}}</string>\n                <key>sourceSize</key>\n                <string>{150,45}</string>\n            </dict>\n            <key>game_chat_bg.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1018},{756,921}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{756,921}}</string>\n                <key>sourceSize</key>\n                <string>{756,921}</string>\n            </dict>\n            <key>game_chat_button_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{651,1941},{210,105}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{210,105}}</string>\n                <key>sourceSize</key>\n                <string>{210,105}</string>\n            </dict>\n            <key>game_chat_button_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{439,1941},{210,105}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{210,105}}</string>\n                <key>sourceSize</key>\n                <string>{210,105}</string>\n            </dict>\n            <key>game_chat_emotion_noraml.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{568,2},{369,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{369,120}}</string>\n                <key>sourceSize</key>\n                <string>{369,120}</string>\n            </dict>\n            <key>game_chat_emotion_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{446,2},{369,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{369,120}}</string>\n                <key>sourceSize</key>\n                <string>{369,120}</string>\n            </dict>\n            <key>game_chat_icon_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1889,159},{87,81}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{87,81}}</string>\n                <key>sourceSize</key>\n                <string>{87,81}</string>\n            </dict>\n            <key>game_chat_icon_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1889,76},{87,81}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{87,81}}</string>\n                <key>sourceSize</key>\n                <string>{87,81}</string>\n            </dict>\n            <key>game_chat_text_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{324,2},{369,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{369,120}}</string>\n                <key>sourceSize</key>\n                <string>{369,120}</string>\n            </dict>\n            <key>game_chat_text_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{202,2},{369,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{369,120}}</string>\n                <key>sourceSize</key>\n                <string>{369,120}</string>\n            </dict>\n            <key>game_checkBox_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1372,339},{57,57}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{57,57}}</string>\n                <key>sourceSize</key>\n                <string>{57,57}</string>\n            </dict>\n            <key>game_checkBox_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1449,316},{57,57}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{57,57}}</string>\n                <key>sourceSize</key>\n                <string>{57,57}</string>\n            </dict>\n            <key>game_chip_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1610,234},{60,63}}</string>\n                <key>offset</key>\n                <string>{-1,5}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{8,4},{60,63}}</string>\n                <key>sourceSize</key>\n                <string>{78,81}</string>\n            </dict>\n            <key>game_close_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1799,71},{88,88}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,88}}</string>\n                <key>sourceSize</key>\n                <string>{88,88}</string>\n            </dict>\n            <key>game_close_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{446,887},{88,88}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,88}}</string>\n                <key>sourceSize</key>\n                <string>{88,88}</string>\n            </dict>\n            <key>game_dealer_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1781,303},{49,49}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{49,49}}</string>\n                <key>sourceSize</key>\n                <string>{51,51}</string>\n            </dict>\n            <key>game_decrease_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1762,232},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_decrease_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1691,227},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_decrease_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1762,161},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_delay_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1613,156},{76,76}}</string>\n                <key>offset</key>\n                <string>{0,-22}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{22,44},{76,76}}</string>\n                <key>sourceSize</key>\n                <string>{120,120}</string>\n            </dict>\n            <key>game_delay_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1461,161},{76,76}}</string>\n                <key>offset</key>\n                <string>{0,-22}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{22,44},{76,76}}</string>\n                <key>sourceSize</key>\n                <string>{120,120}</string>\n            </dict>\n            <key>game_delay_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1294,277},{76,76}}</string>\n                <key>offset</key>\n                <string>{0,-22}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{22,44},{76,76}}</string>\n                <key>sourceSize</key>\n                <string>{120,120}</string>\n            </dict>\n            <key>game_dialogCancel_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{400,373},{300,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{300,120}}</string>\n                <key>sourceSize</key>\n                <string>{300,120}</string>\n            </dict>\n            <key>game_dialogOK_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{324,675},{300,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{300,120}}</string>\n                <key>sourceSize</key>\n                <string>{300,120}</string>\n            </dict>\n            <key>game_dialogRetry_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{278,373},{300,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{300,120}}</string>\n                <key>sourceSize</key>\n                <string>{300,120}</string>\n            </dict>\n            <key>game_dialog_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{522,571},{100,100}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{100,100}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_editbox_bg.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1941},{435,105}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{435,105}}</string>\n                <key>sourceSize</key>\n                <string>{435,105}</string>\n            </dict>\n            <key>game_emotion_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1372,262},{75,75}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{75,75}}</string>\n                <key>sourceSize</key>\n                <string>{75,75}</string>\n            </dict>\n            <key>game_emotion_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1461,239},{75,75}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{75,75}}</string>\n                <key>sourceSize</key>\n                <string>{75,75}</string>\n            </dict>\n            <key>game_endhand.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1006,188},{150,45}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{150,45}}</string>\n                <key>sourceSize</key>\n                <string>{150,45}</string>\n            </dict>\n            <key>game_female_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1833,273},{54,54}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{54,54}}</string>\n                <key>sourceSize</key>\n                <string>{56,56}</string>\n            </dict>\n            <key>game_handCard_cover_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1207,277},{85,77}}</string>\n                <key>offset</key>\n                <string>{0,-1}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,2},{85,77}}</string>\n                <key>sourceSize</key>\n                <string>{85,79}</string>\n            </dict>\n            <key>game_handChips_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{952,357},{140,154}}</string>\n                <key>offset</key>\n                <string>{-2,-1}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{64,60},{140,154}}</string>\n                <key>sourceSize</key>\n                <string>{272,272}</string>\n            </dict>\n            <key>game_header_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1053,154},{144,144}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{144,144}}</string>\n                <key>sourceSize</key>\n                <string>{144,144}</string>\n            </dict>\n            <key>game_inPot_extra_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1910,2},{72,90}}</string>\n                <key>offset</key>\n                <string>{-88,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{10,1},{72,90}}</string>\n                <key>sourceSize</key>\n                <string>{268,98}</string>\n            </dict>\n            <key>game_inPot_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{194,730},{268,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{268,98}}</string>\n                <key>sourceSize</key>\n                <string>{268,98}</string>\n            </dict>\n            <key>game_increase_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1691,156},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_increase_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1539,226},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_increase_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1542,155},{69,69}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{69,69}}</string>\n                <key>sourceSize</key>\n                <string>{69,69}</string>\n            </dict>\n            <key>game_male_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1889,242},{54,54}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{54,54}}</string>\n                <key>sourceSize</key>\n                <string>{56,56}</string>\n            </dict>\n            <key>game_microPhone_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{933,633},{77,138}}</string>\n                <key>offset</key>\n                <string>{-1,-36}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{58,72},{77,138}}</string>\n                <key>sourceSize</key>\n                <string>{195,210}</string>\n            </dict>\n            <key>game_microPhone_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{446,675},{195,210}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{195,210}}</string>\n                <key>sourceSize</key>\n                <string>{195,210}</string>\n            </dict>\n            <key>game_money_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1995,289},{48,48}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{48,48}}</string>\n                <key>sourceSize</key>\n                <string>{48,48}</string>\n            </dict>\n            <key>game_note_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1094,357},{135,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{135,120}}</string>\n                <key>sourceSize</key>\n                <string>{135,120}</string>\n            </dict>\n            <key>game_note_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1012,633},{135,120}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{135,120}}</string>\n                <key>sourceSize</key>\n                <string>{135,120}</string>\n            </dict>\n            <key>game_owner_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{362,977},{32,32}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{32,32}}</string>\n                <key>sourceSize</key>\n                <string>{34,34}</string>\n            </dict>\n            <key>game_playerAudioSwitch_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{932,533},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_playerAudioSwitch_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{832,554},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_playerAudioSwitch_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{732,554},{98,98}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{98,98}}</string>\n                <key>sourceSize</key>\n                <string>{100,100}</string>\n            </dict>\n            <key>game_popProgressClose_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{933,773},{94,94}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{94,94}}</string>\n                <key>sourceSize</key>\n                <string>{94,94}</string>\n            </dict>\n            <key>game_preRecord_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1708,68},{86,89}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{86,89}}</string>\n                <key>sourceSize</key>\n                <string>{86,89}</string>\n            </dict>\n            <key>game_preRecord_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1617,68},{86,89}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{86,89}}</string>\n                <key>sourceSize</key>\n                <string>{86,89}</string>\n            </dict>\n            <key>game_progress_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1076,2},{141,141}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{141,141}}</string>\n                <key>sourceSize</key>\n                <string>{141,141}</string>\n            </dict>\n            <key>game_progress_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{732,2},{195,19}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{195,19}}</string>\n                <key>sourceSize</key>\n                <string>{195,19}</string>\n            </dict>\n            <key>game_progress_range.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{711,2},{195,19}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{195,19}}</string>\n                <key>sourceSize</key>\n                <string>{195,19}</string>\n            </dict>\n            <key>game_progress_yellow.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{690,2},{195,19}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{195,19}}</string>\n                <key>sourceSize</key>\n                <string>{195,19}</string>\n            </dict>\n            <key>game_property_01.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1542,102},{51,73}}</string>\n                <key>offset</key>\n                <string>{3,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{28,14},{51,73}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_property_02.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1978,228},{59,65}}</string>\n                <key>offset</key>\n                <string>{2,1}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{23,17},{59,65}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_property_03.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1130,300},{75,55}}</string>\n                <key>offset</key>\n                <string>{4,-3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{17,26},{75,55}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_property_03_disable.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1053,300},{75,55}}</string>\n                <key>offset</key>\n                <string>{4,-3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{17,26},{75,55}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_property_04.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1815,2},{67,93}}</string>\n                <key>offset</key>\n                <string>{3,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{20,1},{67,93}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_property_05.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1461,102},{57,79}}</string>\n                <key>offset</key>\n                <string>{3,1}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{25,10},{57,79}}</string>\n                <key>sourceSize</key>\n                <string>{101,101}</string>\n            </dict>\n            <key>game_quit_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{328,977},{32,32}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{32,32}}</string>\n                <key>sourceSize</key>\n                <string>{34,34}</string>\n            </dict>\n            <key>game_raise_allin.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{841,654},{174,90}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{174,90}}</string>\n                <key>sourceSize</key>\n                <string>{174,90}</string>\n            </dict>\n            <key>game_rebuy_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{294,977},{32,32}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{32,32}}</string>\n                <key>sourceSize</key>\n                <string>{34,34}</string>\n            </dict>\n            <key>game_red_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{194,1000},{8,8}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{8,8}}</string>\n                <key>sourceSize</key>\n                <string>{8,8}</string>\n            </dict>\n            <key>game_resume_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{643,672},{196,196}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{196,196}}</string>\n                <key>sourceSize</key>\n                <string>{198,198}</string>\n            </dict>\n            <key>game_resume_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{522,373},{196,196}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{196,196}}</string>\n                <key>sourceSize</key>\n                <string>{198,198}</string>\n            </dict>\n            <key>game_seat_empty.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{812,870},{144,144}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{144,144}}</string>\n                <key>sourceSize</key>\n                <string>{144,144}</string>\n            </dict>\n            <key>game_seat_valid.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{666,870},{144,144}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{144,144}}</string>\n                <key>sourceSize</key>\n                <string>{144,144}</string>\n            </dict>\n            <key>game_showCard_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2002,58},{54,40}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{54,40}}</string>\n                <key>sourceSize</key>\n                <string>{54,40}</string>\n            </dict>\n            <key>game_sliderChip_frame.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{760,1016},{174,90}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{174,90}}</string>\n                <key>sourceSize</key>\n                <string>{174,90}</string>\n            </dict>\n            <key>game_sliderThumb_icon.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1673,298},{55,55}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{55,55}}</string>\n                <key>sourceSize</key>\n                <string>{57,57}</string>\n            </dict>\n            <key>game_sliderThumb_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{624,571},{99,106}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{99,106}}</string>\n                <key>sourceSize</key>\n                <string>{99,106}</string>\n            </dict>\n            <key>game_sliderTrack_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{294,846},{73,20}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{1,0},{73,20}}</string>\n                <key>sourceSize</key>\n                <string>{75,20}</string>\n            </dict>\n            <key>game_slider_mask.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,2},{190,1014}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{190,1014}}</string>\n                <key>sourceSize</key>\n                <string>{190,1014}</string>\n            </dict>\n            <key>game_slider_thumb.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{860,357},{174,90}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{174,90}}</string>\n                <key>sourceSize</key>\n                <string>{174,90}</string>\n            </dict>\n            <key>game_slider_track.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{194,2},{6,726}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{6,726}}</string>\n                <key>sourceSize</key>\n                <string>{6,726}</string>\n            </dict>\n            <key>game_smallBlind_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1610,296},{58,61}}</string>\n                <key>offset</key>\n                <string>{-2,6}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{8,4},{58,61}}</string>\n                <key>sourceSize</key>\n                <string>{78,81}</string>\n            </dict>\n            <key>game_standUp_tip.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{294,792},{32,24}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{1,5},{32,24}}</string>\n                <key>sourceSize</key>\n                <string>{34,34}</string>\n            </dict>\n            <key>game_store_chips_icon.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1730,303},{49,49}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{1,1},{49,49}}</string>\n                <key>sourceSize</key>\n                <string>{51,51}</string>\n            </dict>\n            <key>game_store_diamond_icon.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2002,2},{54,42}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{54,42}}</string>\n                <key>sourceSize</key>\n                <string>{54,42}</string>\n            </dict>\n            <key>game_store_gold_icon.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1945,289},{48,48}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{48,48}}</string>\n                <key>sourceSize</key>\n                <string>{48,48}</string>\n            </dict>\n            <key>game_switchRect_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1833,217},{54,54}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{54,54}}</string>\n                <key>sourceSize</key>\n                <string>{54,54}</string>\n            </dict>\n            <key>game_switchRect_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1833,161},{54,54}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{54,54}}</string>\n                <key>sourceSize</key>\n                <string>{54,54}</string>\n            </dict>\n            <key>game_switch_off.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1717,2},{96,64}}</string>\n                <key>offset</key>\n                <string>{-3,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{96,64}}</string>\n                <key>sourceSize</key>\n                <string>{102,64}</string>\n            </dict>\n            <key>game_switch_on.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1617,2},{98,64}}</string>\n                <key>offset</key>\n                <string>{2,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{4,0},{98,64}}</string>\n                <key>sourceSize</key>\n                <string>{102,64}</string>\n            </dict>\n            <key>game_tab_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1978,171},{66,55}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{66,55}}</string>\n                <key>sourceSize</key>\n                <string>{66,55}</string>\n            </dict>\n            <key>game_tab_press.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1978,114},{66,55}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{66,55}}</string>\n                <key>sourceSize</key>\n                <string>{66,55}</string>\n            </dict>\n            <key>game_table_start_normal.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1199,145},{130,130}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{130,130}}</string>\n                <key>sourceSize</key>\n                <string>{130,130}</string>\n            </dict>\n            <key>game_table_start_pause.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{1132,494},{130,130}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{130,130}}</string>\n                <key>sourceSize</key>\n                <string>{130,130}</string>\n            </dict>\n            <key>ic_device_energy.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{294,729},{61,24}}</string>\n                <key>offset</key>\n                <string>{-4,1}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{3,2},{61,24}}</string>\n                <key>sourceSize</key>\n                <string>{75,30}</string>\n            </dict>\n            <key>ic_device_energy_mask.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{430,977},{73,30}}</string>\n                <key>offset</key>\n                <string>{-1,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{73,30}}</string>\n                <key>sourceSize</key>\n                <string>{75,30}</string>\n            </dict>\n            <key>open_audio.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{536,887},{128,128}}</string>\n                <key>offset</key>\n                <string>{0,0}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{128,128}}</string>\n                <key>sourceSize</key>\n                <string>{128,128}</string>\n            </dict>\n        </dict>\n        <key>metadata</key>\n        <dict>\n            <key>format</key>\n            <integer>2</integer>\n            <key>realTextureFileName</key>\n            <string>GameMain_6p.png</string>\n            <key>size</key>\n            <string>{2048,2048}</string>\n            <key>smartupdate</key>\n            <string>$TexturePacker:SmartUpdate:33c271ffe64f3100c9c9165a96400da3:1/1$</string>\n            <key>textureFileName</key>\n            <string>GameMain_6p.png</string>\n        </dict>\n    </dict>\n</plist>\n"
  },
  {
    "path": "bin/client/assets/resources/GameMain_6p.plist.meta",
    "content": "{\n  \"ver\": \"1.2.4\",\n  \"uuid\": \"aae22d42-a9cf-43f5-8c35-5348d3f98f75\",\n  \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n  \"size\": {\n    \"width\": 2048,\n    \"height\": 2048\n  },\n  \"type\": \"Texture Packer\",\n  \"subMetas\": {\n    \"close_audio.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5a6d9eac-2049-40cf-8f6b-4aed0edf810e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1331,\n      \"trimY\": 132,\n      \"width\": 128,\n      \"height\": 128,\n      \"rawWidth\": 128,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"forward_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"918886d9-7513-4688-88c8-5dc9b0f3d6bc\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1219,\n      \"trimY\": 2,\n      \"width\": 128,\n      \"height\": 128,\n      \"rawWidth\": 128,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"forward_unnormal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6f2efdbb-ef50-4a3e-bbeb-d2c71bb48420\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1216,\n      \"trimY\": 356,\n      \"width\": 128,\n      \"height\": 128,\n      \"rawWidth\": 128,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_addFriend_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"06fa1d03-1dad-4ed0-98b7-c4d5d24241e0\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1517,\n      \"trimY\": 2,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_addFriend_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6eb025b5-2a6b-4c08-8d01-605e9eedd25e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1417,\n      \"trimY\": 2,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_addFriend_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"547f41ec-dbf0-48d6-9cee-f7dc1fc610f3\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1032,\n      \"trimY\": 513,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_allIn_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f16f71f5-4198-4a9f-829c-0e94fc9ca51d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 19,\n      \"trimX\": 848,\n      \"trimY\": 198,\n      \"width\": 156,\n      \"height\": 157,\n      \"rawWidth\": 156,\n      \"rawHeight\": 195,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_allIn_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7be574fd-64fb-492c-848c-15d442fbb7a2\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 19,\n      \"trimX\": 690,\n      \"trimY\": 199,\n      \"width\": 156,\n      \"height\": 157,\n      \"rawWidth\": 156,\n      \"rawHeight\": 195,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_allIn_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"13276540-7890-400f-8ca7-5a7b1b5a6975\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1349,\n      \"trimY\": 2,\n      \"width\": 126,\n      \"height\": 66,\n      \"rawWidth\": 126,\n      \"rawHeight\": 66,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_arrow_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"71587064-bf47-4803-983a-1d9b215d0383\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 294,\n      \"trimY\": 826,\n      \"width\": 18,\n      \"height\": 24,\n      \"rawWidth\": 18,\n      \"rawHeight\": 24,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_audioPlaying_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f079d6dd-1b4f-4f6c-a84f-493ae0f0dc84\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 202,\n      \"trimY\": 687,\n      \"width\": 120,\n      \"height\": 40,\n      \"rawWidth\": 120,\n      \"rawHeight\": 40,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_audioProgress.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fb98a33f-373f-4a61-be0d-61f33899c886\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 240,\n      \"trimY\": 373,\n      \"width\": 312,\n      \"height\": 36,\n      \"rawWidth\": 312,\n      \"rawHeight\": 36,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_audioProgress_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"00d38cb1-7cce-42c3-ab58-cc7cfc371425\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 202,\n      \"trimY\": 373,\n      \"width\": 312,\n      \"height\": 36,\n      \"rawWidth\": 312,\n      \"rawHeight\": 36,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_bigBlind_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"283bcf52-e007-4892-83d8-03789e33756f\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": -2,\n      \"offsetY\": 6,\n      \"trimX\": 1538,\n      \"trimY\": 297,\n      \"width\": 58,\n      \"height\": 61,\n      \"rawWidth\": 78,\n      \"rawHeight\": 81,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_cardHighlight_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f6344e10-a3e4-41dd-ac61-5cce915849de\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -2,\n      \"offsetY\": 8,\n      \"trimX\": 893,\n      \"trimY\": 2,\n      \"width\": 134,\n      \"height\": 184,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_cardType_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9222fa1e-ab4f-4202-b245-e4a16f53dc10\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 396,\n      \"trimY\": 977,\n      \"width\": 32,\n      \"height\": 32,\n      \"rawWidth\": 34,\n      \"rawHeight\": 34,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_card_mask.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2d18d9bc-f051-4e7d-9d24-efde56b8041a\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 720,\n      \"trimY\": 358,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_card_reverse.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b0711d0f-2165-46f4-8765-2c039b5c22df\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 753,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_cartType_bg.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"88364851-5792-4ad7-b3f9-104fa4f9053e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1029,\n      \"trimY\": 2,\n      \"width\": 150,\n      \"height\": 45,\n      \"rawWidth\": 150,\n      \"rawHeight\": 45,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_bg.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"14d267be-fab9-4b57-8e94-1f7b9d4bd7ab\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 2,\n      \"trimY\": 1018,\n      \"width\": 756,\n      \"height\": 921,\n      \"rawWidth\": 756,\n      \"rawHeight\": 921,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_button_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5a2671f0-8d3c-4f36-aaa5-86bc8484fc0a\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 651,\n      \"trimY\": 1941,\n      \"width\": 210,\n      \"height\": 105,\n      \"rawWidth\": 210,\n      \"rawHeight\": 105,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_button_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6fe48cd7-ea25-4083-9611-a6dae9eb3853\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 439,\n      \"trimY\": 1941,\n      \"width\": 210,\n      \"height\": 105,\n      \"rawWidth\": 210,\n      \"rawHeight\": 105,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_emotion_noraml.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"0bbcd985-ffb1-4381-950a-c1436b045949\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 568,\n      \"trimY\": 2,\n      \"width\": 369,\n      \"height\": 120,\n      \"rawWidth\": 369,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_emotion_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7e1c3e98-9e45-45f3-9774-f1cd71531f26\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 446,\n      \"trimY\": 2,\n      \"width\": 369,\n      \"height\": 120,\n      \"rawWidth\": 369,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_icon_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1a94cf27-128a-4e4e-8f9c-46f77ec8fc10\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1889,\n      \"trimY\": 159,\n      \"width\": 87,\n      \"height\": 81,\n      \"rawWidth\": 87,\n      \"rawHeight\": 81,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_icon_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"30775f52-ba79-4b08-8c38-f82d441d5f9d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1889,\n      \"trimY\": 76,\n      \"width\": 87,\n      \"height\": 81,\n      \"rawWidth\": 87,\n      \"rawHeight\": 81,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_text_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f11495e9-1d7c-4406-a4b7-dba4245e698f\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 324,\n      \"trimY\": 2,\n      \"width\": 369,\n      \"height\": 120,\n      \"rawWidth\": 369,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chat_text_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"21e416a1-052c-4a0b-b888-ce37a53db25b\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 202,\n      \"trimY\": 2,\n      \"width\": 369,\n      \"height\": 120,\n      \"rawWidth\": 369,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_checkBox_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c03ccda2-e561-42c9-8b3a-05393df80825\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1372,\n      \"trimY\": 339,\n      \"width\": 57,\n      \"height\": 57,\n      \"rawWidth\": 57,\n      \"rawHeight\": 57,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_checkBox_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"cf6adc50-f489-40c9-98a8-666d74b286d3\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1449,\n      \"trimY\": 316,\n      \"width\": 57,\n      \"height\": 57,\n      \"rawWidth\": 57,\n      \"rawHeight\": 57,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_chip_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"bc5a9397-64cb-4152-92af-32ba9b4b71ee\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": -1,\n      \"offsetY\": 5,\n      \"trimX\": 1610,\n      \"trimY\": 234,\n      \"width\": 60,\n      \"height\": 63,\n      \"rawWidth\": 78,\n      \"rawHeight\": 81,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_close_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c7ac034b-afed-4b4c-a9c6-23a1894fcff6\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1799,\n      \"trimY\": 71,\n      \"width\": 88,\n      \"height\": 88,\n      \"rawWidth\": 88,\n      \"rawHeight\": 88,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_close_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"34f42c53-775a-4140-b359-0fe0fcd50e9d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 446,\n      \"trimY\": 887,\n      \"width\": 88,\n      \"height\": 88,\n      \"rawWidth\": 88,\n      \"rawHeight\": 88,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_dealer_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6f3f5919-3a90-418c-89d2-7c679b25c21c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1781,\n      \"trimY\": 303,\n      \"width\": 49,\n      \"height\": 49,\n      \"rawWidth\": 51,\n      \"rawHeight\": 51,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_decrease_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1131c21e-95cf-4252-aea4-0b2600b70aa7\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1762,\n      \"trimY\": 232,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_decrease_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"973521a3-02cb-4006-9ed4-3154a563def1\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1691,\n      \"trimY\": 227,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_decrease_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d481b983-1876-45b5-90c8-c46e12a8d83d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1762,\n      \"trimY\": 161,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_delay_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"0615d0dc-8c59-489e-8354-1e3c0af03c2c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": -22,\n      \"trimX\": 1613,\n      \"trimY\": 156,\n      \"width\": 76,\n      \"height\": 76,\n      \"rawWidth\": 120,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_delay_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"8245fc9c-f676-4df6-b475-0506a122699f\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": -22,\n      \"trimX\": 1461,\n      \"trimY\": 161,\n      \"width\": 76,\n      \"height\": 76,\n      \"rawWidth\": 120,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_delay_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"99dc418a-dcf0-414e-abef-4c780f833593\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": -22,\n      \"trimX\": 1294,\n      \"trimY\": 277,\n      \"width\": 76,\n      \"height\": 76,\n      \"rawWidth\": 120,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_dialogCancel_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"249728b2-4a24-434d-a519-690cb6868af4\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 400,\n      \"trimY\": 373,\n      \"width\": 300,\n      \"height\": 120,\n      \"rawWidth\": 300,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_dialogOK_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2ebbea07-b637-4ada-a38b-32d269074e4a\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 324,\n      \"trimY\": 675,\n      \"width\": 300,\n      \"height\": 120,\n      \"rawWidth\": 300,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_dialogRetry_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"76c490fa-8ea1-4185-a8dc-01e496ad82c0\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 278,\n      \"trimY\": 373,\n      \"width\": 300,\n      \"height\": 120,\n      \"rawWidth\": 300,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_dialog_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e8a8ec4e-6c81-4c2a-a324-a41dc7f2a266\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 522,\n      \"trimY\": 571,\n      \"width\": 100,\n      \"height\": 100,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_editbox_bg.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"22d4037c-dbce-4c66-a5ea-d515eff4ec33\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 2,\n      \"trimY\": 1941,\n      \"width\": 435,\n      \"height\": 105,\n      \"rawWidth\": 435,\n      \"rawHeight\": 105,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_emotion_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6ea645c5-9508-4cdd-81c9-83f9b01f997c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1372,\n      \"trimY\": 262,\n      \"width\": 75,\n      \"height\": 75,\n      \"rawWidth\": 75,\n      \"rawHeight\": 75,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_emotion_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6c2343a8-000b-4874-9980-3c648c03a962\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1461,\n      \"trimY\": 239,\n      \"width\": 75,\n      \"height\": 75,\n      \"rawWidth\": 75,\n      \"rawHeight\": 75,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_endhand.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"54f2fb6c-5068-4940-a76f-9687546eba8a\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1006,\n      \"trimY\": 188,\n      \"width\": 150,\n      \"height\": 45,\n      \"rawWidth\": 150,\n      \"rawHeight\": 45,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_female_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6ebafffd-11eb-4240-af02-b65ea110ac3a\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1833,\n      \"trimY\": 273,\n      \"width\": 54,\n      \"height\": 54,\n      \"rawWidth\": 56,\n      \"rawHeight\": 56,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_handCard_cover_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"698b0be6-5b7c-4a87-9410-d28619128f96\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": -1,\n      \"trimX\": 1207,\n      \"trimY\": 277,\n      \"width\": 85,\n      \"height\": 77,\n      \"rawWidth\": 85,\n      \"rawHeight\": 79,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_handChips_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"183885c2-3206-4280-99cb-17033ea59e72\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -2,\n      \"offsetY\": -1,\n      \"trimX\": 952,\n      \"trimY\": 357,\n      \"width\": 140,\n      \"height\": 154,\n      \"rawWidth\": 272,\n      \"rawHeight\": 272,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_header_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2a2afb82-8e79-446d-9991-ece530ae026f\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1053,\n      \"trimY\": 154,\n      \"width\": 144,\n      \"height\": 144,\n      \"rawWidth\": 144,\n      \"rawHeight\": 144,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_inPot_extra_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"652fe52f-be3b-490e-bf4e-a8f2f10e3be9\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": -88,\n      \"offsetY\": 3,\n      \"trimX\": 1910,\n      \"trimY\": 2,\n      \"width\": 72,\n      \"height\": 90,\n      \"rawWidth\": 268,\n      \"rawHeight\": 98,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_inPot_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"dc4ba3f6-7f90-47a7-a28d-ee2dc5d0a289\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 194,\n      \"trimY\": 730,\n      \"width\": 268,\n      \"height\": 98,\n      \"rawWidth\": 268,\n      \"rawHeight\": 98,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_increase_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6f139db2-5df9-4aa6-9ea7-0e1aa9344e7b\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1691,\n      \"trimY\": 156,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_increase_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e98567f9-65ea-4ebe-9465-657dd9bcb043\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1539,\n      \"trimY\": 226,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_increase_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7eadc868-ed59-4d33-999b-dee048659d53\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1542,\n      \"trimY\": 155,\n      \"width\": 69,\n      \"height\": 69,\n      \"rawWidth\": 69,\n      \"rawHeight\": 69,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_male_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fefe8553-fcd8-4e0f-bcb3-03c8d578afbd\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1889,\n      \"trimY\": 242,\n      \"width\": 54,\n      \"height\": 54,\n      \"rawWidth\": 56,\n      \"rawHeight\": 56,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_microPhone_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d0b919d9-45cb-48b0-97bf-16a4787f0ee5\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -1,\n      \"offsetY\": -36,\n      \"trimX\": 933,\n      \"trimY\": 633,\n      \"width\": 77,\n      \"height\": 138,\n      \"rawWidth\": 195,\n      \"rawHeight\": 210,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_microPhone_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d1a8b5d7-bfe1-44ee-a27b-d048691b5ff9\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 446,\n      \"trimY\": 675,\n      \"width\": 195,\n      \"height\": 210,\n      \"rawWidth\": 195,\n      \"rawHeight\": 210,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_money_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1f50c13d-5579-4262-a6fb-9344f23af9c2\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1995,\n      \"trimY\": 289,\n      \"width\": 48,\n      \"height\": 48,\n      \"rawWidth\": 48,\n      \"rawHeight\": 48,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_note_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fc7b5f4a-203f-43f3-baae-b6ef3d051bbc\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1094,\n      \"trimY\": 357,\n      \"width\": 135,\n      \"height\": 120,\n      \"rawWidth\": 135,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_note_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e410d477-1a87-41e5-8975-c021ec14003d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1012,\n      \"trimY\": 633,\n      \"width\": 135,\n      \"height\": 120,\n      \"rawWidth\": 135,\n      \"rawHeight\": 120,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_owner_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"37403df3-8929-4da4-8dd0-2495c44e2556\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 362,\n      \"trimY\": 977,\n      \"width\": 32,\n      \"height\": 32,\n      \"rawWidth\": 34,\n      \"rawHeight\": 34,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_playerAudioSwitch_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9c8be3a6-f43e-4434-b568-137928be2df0\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 932,\n      \"trimY\": 533,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_playerAudioSwitch_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"959dfdbb-ae5a-41e5-a9cd-65d7819b0725\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 832,\n      \"trimY\": 554,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_playerAudioSwitch_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"cefa671e-c8e0-454d-80e1-50828abc6630\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 732,\n      \"trimY\": 554,\n      \"width\": 98,\n      \"height\": 98,\n      \"rawWidth\": 100,\n      \"rawHeight\": 100,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_popProgressClose_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c2d04227-02ab-4893-8a57-ab4312ace2ff\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 933,\n      \"trimY\": 773,\n      \"width\": 94,\n      \"height\": 94,\n      \"rawWidth\": 94,\n      \"rawHeight\": 94,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_preRecord_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9048139c-dfdd-4f72-bb79-4d0dc9204e5e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1708,\n      \"trimY\": 68,\n      \"width\": 86,\n      \"height\": 89,\n      \"rawWidth\": 86,\n      \"rawHeight\": 89,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_preRecord_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"dc7ebbfe-df79-4f95-9afa-658aee791add\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1617,\n      \"trimY\": 68,\n      \"width\": 86,\n      \"height\": 89,\n      \"rawWidth\": 86,\n      \"rawHeight\": 89,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_progress_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2b265350-b7b8-417d-a0db-d029bca9a934\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1076,\n      \"trimY\": 2,\n      \"width\": 141,\n      \"height\": 141,\n      \"rawWidth\": 141,\n      \"rawHeight\": 141,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_progress_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f010326a-0696-46ba-a65a-e594b1b3d15e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 732,\n      \"trimY\": 2,\n      \"width\": 195,\n      \"height\": 19,\n      \"rawWidth\": 195,\n      \"rawHeight\": 19,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_progress_range.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6e0679bf-4e65-49a3-980f-7045f76ed82f\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 711,\n      \"trimY\": 2,\n      \"width\": 195,\n      \"height\": 19,\n      \"rawWidth\": 195,\n      \"rawHeight\": 19,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_progress_yellow.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"11c0bc5f-7864-44d7-b452-392ef8384c29\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 690,\n      \"trimY\": 2,\n      \"width\": 195,\n      \"height\": 19,\n      \"rawWidth\": 195,\n      \"rawHeight\": 19,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_01.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a5a2f46c-ce35-4c74-9a1f-3e8671244c50\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 3,\n      \"offsetY\": 0,\n      \"trimX\": 1542,\n      \"trimY\": 102,\n      \"width\": 51,\n      \"height\": 73,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_02.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"14ea34a2-a2e8-4944-a4ef-e1114ad6a696\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 2,\n      \"offsetY\": 1,\n      \"trimX\": 1978,\n      \"trimY\": 228,\n      \"width\": 59,\n      \"height\": 65,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_03.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"0117f7b2-c358-4e07-b70d-8e5ca6d077e6\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 4,\n      \"offsetY\": -3,\n      \"trimX\": 1130,\n      \"trimY\": 300,\n      \"width\": 75,\n      \"height\": 55,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_03_disable.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a69d6003-8bf3-4975-9a5a-e9f91f07f3c5\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 4,\n      \"offsetY\": -3,\n      \"trimX\": 1053,\n      \"trimY\": 300,\n      \"width\": 75,\n      \"height\": 55,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_04.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"8796db4e-e6f3-45a4-bd68-905fd7f75774\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 3,\n      \"offsetY\": 3,\n      \"trimX\": 1815,\n      \"trimY\": 2,\n      \"width\": 67,\n      \"height\": 93,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_property_05.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"646cd28c-29ea-4fda-9524-558664afd764\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 3,\n      \"offsetY\": 1,\n      \"trimX\": 1461,\n      \"trimY\": 102,\n      \"width\": 57,\n      \"height\": 79,\n      \"rawWidth\": 101,\n      \"rawHeight\": 101,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_quit_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"4090107f-680a-4a63-a8cf-dfe6efe40cd8\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 328,\n      \"trimY\": 977,\n      \"width\": 32,\n      \"height\": 32,\n      \"rawWidth\": 34,\n      \"rawHeight\": 34,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_raise_allin.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c0674d04-0da4-4771-ae5d-f6ab5ce1b424\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 841,\n      \"trimY\": 654,\n      \"width\": 174,\n      \"height\": 90,\n      \"rawWidth\": 174,\n      \"rawHeight\": 90,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_rebuy_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f66d9267-0912-4c25-97cf-9638f7413f9e\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 294,\n      \"trimY\": 977,\n      \"width\": 32,\n      \"height\": 32,\n      \"rawWidth\": 34,\n      \"rawHeight\": 34,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_red_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ee123787-dc9e-40c1-8c8d-0ae950ded83d\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 194,\n      \"trimY\": 1000,\n      \"width\": 8,\n      \"height\": 8,\n      \"rawWidth\": 8,\n      \"rawHeight\": 8,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_resume_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"202b0bea-bf32-460d-926a-1b1789ba5470\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 643,\n      \"trimY\": 672,\n      \"width\": 196,\n      \"height\": 196,\n      \"rawWidth\": 198,\n      \"rawHeight\": 198,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_resume_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"28835667-1a62-4c4e-8848-1ea884858444\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 522,\n      \"trimY\": 373,\n      \"width\": 196,\n      \"height\": 196,\n      \"rawWidth\": 198,\n      \"rawHeight\": 198,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_seat_empty.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d79f84c5-d5e1-4aad-b902-431289fb7b91\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 812,\n      \"trimY\": 870,\n      \"width\": 144,\n      \"height\": 144,\n      \"rawWidth\": 144,\n      \"rawHeight\": 144,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_seat_valid.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"33ad800b-2555-495c-8f08-dc28d28c8556\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 666,\n      \"trimY\": 870,\n      \"width\": 144,\n      \"height\": 144,\n      \"rawWidth\": 144,\n      \"rawHeight\": 144,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_showCard_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"97acef63-cca8-4ccd-b4d3-86c0116e0a8c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 2002,\n      \"trimY\": 58,\n      \"width\": 54,\n      \"height\": 40,\n      \"rawWidth\": 54,\n      \"rawHeight\": 40,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_sliderChip_frame.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5c7a6c0c-b522-405f-a8c7-f37e796a4cd9\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 760,\n      \"trimY\": 1016,\n      \"width\": 174,\n      \"height\": 90,\n      \"rawWidth\": 174,\n      \"rawHeight\": 90,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_sliderThumb_icon.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a7228bc8-15e3-4b48-9728-9e20f0b09add\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1673,\n      \"trimY\": 298,\n      \"width\": 55,\n      \"height\": 55,\n      \"rawWidth\": 57,\n      \"rawHeight\": 57,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_sliderThumb_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d259e938-c0fe-4757-aa32-06f8dfca2246\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 624,\n      \"trimY\": 571,\n      \"width\": 99,\n      \"height\": 106,\n      \"rawWidth\": 99,\n      \"rawHeight\": 106,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_sliderTrack_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"789d2a9c-9b96-4ef6-a9e3-dcfdb6884cc2\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 294,\n      \"trimY\": 846,\n      \"width\": 73,\n      \"height\": 20,\n      \"rawWidth\": 75,\n      \"rawHeight\": 20,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_slider_mask.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"12a2d043-d9f2-42dd-9952-e4ee561316bb\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 190,\n      \"height\": 1014,\n      \"rawWidth\": 190,\n      \"rawHeight\": 1014,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_slider_thumb.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"553eba4b-d913-477c-96b4-32ccb14241e3\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 860,\n      \"trimY\": 357,\n      \"width\": 174,\n      \"height\": 90,\n      \"rawWidth\": 174,\n      \"rawHeight\": 90,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_slider_track.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b7bce690-1405-4d5f-bc17-5d1892f822ba\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 194,\n      \"trimY\": 2,\n      \"width\": 6,\n      \"height\": 726,\n      \"rawWidth\": 6,\n      \"rawHeight\": 726,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_smallBlind_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a2137fb8-a257-4bc4-ace1-93a9ad42b937\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": -2,\n      \"offsetY\": 6,\n      \"trimX\": 1610,\n      \"trimY\": 296,\n      \"width\": 58,\n      \"height\": 61,\n      \"rawWidth\": 78,\n      \"rawHeight\": 81,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_standUp_tip.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"84625048-3af3-4f05-b099-981a1f5499e3\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 294,\n      \"trimY\": 792,\n      \"width\": 32,\n      \"height\": 24,\n      \"rawWidth\": 34,\n      \"rawHeight\": 34,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_store_chips_icon.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1e3171c6-07cb-47f7-8922-1b7c481c0083\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1730,\n      \"trimY\": 303,\n      \"width\": 49,\n      \"height\": 49,\n      \"rawWidth\": 51,\n      \"rawHeight\": 51,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_store_diamond_icon.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"812e8587-6dec-4d6e-8236-5f3ea0f34844\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 2002,\n      \"trimY\": 2,\n      \"width\": 54,\n      \"height\": 42,\n      \"rawWidth\": 54,\n      \"rawHeight\": 42,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_store_gold_icon.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5e76cd28-d620-4c08-a314-edd662be61e1\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1945,\n      \"trimY\": 289,\n      \"width\": 48,\n      \"height\": 48,\n      \"rawWidth\": 48,\n      \"rawHeight\": 48,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_switchRect_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"99b03be5-a2a7-403d-b1e1-7244500910b3\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1833,\n      \"trimY\": 217,\n      \"width\": 54,\n      \"height\": 54,\n      \"rawWidth\": 54,\n      \"rawHeight\": 54,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_switchRect_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9165111e-4866-48ff-9bb4-2c02e8c8abcd\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1833,\n      \"trimY\": 161,\n      \"width\": 54,\n      \"height\": 54,\n      \"rawWidth\": 54,\n      \"rawHeight\": 54,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_switch_off.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"87a15f39-7074-4454-9c14-bf525bc2f77b\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -3,\n      \"offsetY\": 0,\n      \"trimX\": 1717,\n      \"trimY\": 2,\n      \"width\": 96,\n      \"height\": 64,\n      \"rawWidth\": 102,\n      \"rawHeight\": 64,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_switch_on.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e1835cbc-b99b-4c8f-ba65-3063b30ee96c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 2,\n      \"offsetY\": 0,\n      \"trimX\": 1617,\n      \"trimY\": 2,\n      \"width\": 98,\n      \"height\": 64,\n      \"rawWidth\": 102,\n      \"rawHeight\": 64,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_tab_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"71f41efc-d2ba-4cba-90fe-1c64b663e0b0\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1978,\n      \"trimY\": 171,\n      \"width\": 66,\n      \"height\": 55,\n      \"rawWidth\": 66,\n      \"rawHeight\": 55,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_tab_press.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1b8b2a8e-bff4-4557-ae68-fc077493afc8\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1978,\n      \"trimY\": 114,\n      \"width\": 66,\n      \"height\": 55,\n      \"rawWidth\": 66,\n      \"rawHeight\": 55,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_table_start_normal.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1eaed224-281e-4973-af0f-02f2016578a1\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1199,\n      \"trimY\": 145,\n      \"width\": 130,\n      \"height\": 130,\n      \"rawWidth\": 130,\n      \"rawHeight\": 130,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"game_table_start_pause.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b3fda84e-ccf0-427b-a482-6cffb33001f7\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 1132,\n      \"trimY\": 494,\n      \"width\": 130,\n      \"height\": 130,\n      \"rawWidth\": 130,\n      \"rawHeight\": 130,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"ic_device_energy.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"78824c80-c288-435d-907a-41cb5ac5b5e5\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": -4,\n      \"offsetY\": 1,\n      \"trimX\": 294,\n      \"trimY\": 729,\n      \"width\": 61,\n      \"height\": 24,\n      \"rawWidth\": 75,\n      \"rawHeight\": 30,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"ic_device_energy_mask.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6602686c-37ec-486c-a3b1-1bc814ac470c\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -1,\n      \"offsetY\": 0,\n      \"trimX\": 430,\n      \"trimY\": 977,\n      \"width\": 73,\n      \"height\": 30,\n      \"rawWidth\": 75,\n      \"rawHeight\": 30,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"open_audio.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"78f76275-b201-4017-8f0f-70664c14a542\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 536,\n      \"trimY\": 887,\n      \"width\": 128,\n      \"height\": 128,\n      \"rawWidth\": 128,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/GameMain_6p.png.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"GameMain_6p\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2bd24592-8fab-4bf3-bb32-5774b2b60782\",\n      \"rawTextureUuid\": \"9645f4c7-099e-4bac-9779-ac372a798d1b\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -1,\n      \"offsetY\": 0,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 2042,\n      \"height\": 2044,\n      \"rawWidth\": 2048,\n      \"rawHeight\": 2048,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_allinWin.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"0dd8cf6f-e146-4622-8b8e-7c9dc5f77a48\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_check.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"ae2e6fb2-2be9-4ced-a4e9-2ee56c9667ed\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_chipsToPot.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"97c76f08-6b20-4757-aefb-5a95e710cb13\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_chipsToTable.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"2773b2b7-4482-4133-9900-7fdcd308d2f9\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_distributeCard.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"0b5c008e-cf15-4b8c-be63-8b1197cb1789\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_fold.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"87dcf996-d47c-4b0e-a821-a1d034aad12b\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_normalWin.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"e32b382b-4248-4a95-9c83-6e170adb4aa4\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_pokerClick.caf.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"2f80411a-9257-4450-aa30-4e860f2ff54b\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_pokerClick.mp3.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"b3e3bc15-0e5e-4d16-932c-08651a89045d\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_timeout.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"3ef5c879-e7cd-4121-be05-a98fa397e548\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio/audio_yourTurn.wav.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"85960017-45b4-40f2-a17e-75cdfda31054\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/audio.meta",
    "content": "{\n  \"ver\": \"1.0.1\",\n  \"uuid\": \"0a834482-9f57-4f53-af0e-98a99ad7438a\",\n  \"isGroup\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/game_cards.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n    <dict>\n        <key>frames</key>\n        <dict>\n            <key>card_01.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{488,362},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_02.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{362,362},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_03.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,812},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_04.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,686},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_05.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,560},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_06.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,434},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_07.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{902,308},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_08.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{776,272},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_09.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{650,272},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_10.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{524,272},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_11.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{398,272},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_12.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,272},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_13.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{902,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_17.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{776,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_18.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{650,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_19.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{524,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_20.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{398,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_21.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{272,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_22.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,812},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_23.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,686},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_24.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,560},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_25.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,434},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_26.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,308},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_27.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,182},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_28.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{812,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_29.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{686,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_33.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{560,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_34.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{434,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_35.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{308,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_36.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{182,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_37.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,848},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_38.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,722},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_39.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,596},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_40.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,470},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_41.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,344},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_42.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,218},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_43.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,92},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_44.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{848,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_45.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{722,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_49.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{596,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_50.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{470,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_51.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{344,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_52.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{218,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_53.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{92,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_54.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,884},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_55.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,758},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_56.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,632},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_57.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,506},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_58.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,380},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_59.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,254},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_60.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,128},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n            <key>card_61.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,2},{88,124}}</string>\n                <key>offset</key>\n                <string>{0,2}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{88,124}}</string>\n                <key>sourceSize</key>\n                <string>{88,128}</string>\n            </dict>\n        </dict>\n        <key>metadata</key>\n        <dict>\n            <key>format</key>\n            <integer>2</integer>\n            <key>realTextureFileName</key>\n            <string>game_cards.png</string>\n            <key>size</key>\n            <string>{1024,1024}</string>\n            <key>smartupdate</key>\n            <string>$TexturePacker:SmartUpdate:ca57ba6848db9930558064399bf24524:1/1$</string>\n            <key>textureFileName</key>\n            <string>game_cards.png</string>\n        </dict>\n    </dict>\n</plist>\n"
  },
  {
    "path": "bin/client/assets/resources/game_cards.plist.meta",
    "content": "{\n  \"ver\": \"1.2.4\",\n  \"uuid\": \"24cba613-120c-4b54-8d58-0423cdcb5f42\",\n  \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n  \"size\": {\n    \"width\": 1024,\n    \"height\": 1024\n  },\n  \"type\": \"Texture Packer\",\n  \"subMetas\": {\n    \"card_01.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"710fd9e1-424c-4e26-b6f8-6bf5cddcc88f\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 488,\n      \"trimY\": 362,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_02.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"60021324-38c4-4e2d-b476-bddf71440b6f\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 362,\n      \"trimY\": 362,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_03.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ca65478e-4be2-4b27-92bf-59f6d7ccc943\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 812,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_04.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ad70143d-10ba-4433-af53-399b18937dac\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 686,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_05.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5d0dccb1-3013-4513-885a-6d198ecd6251\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 560,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_06.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"56493729-68bc-44ce-83bf-edb99aa5b34c\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 434,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_07.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1de8516b-2df4-4b99-a99f-cba2a689bc4b\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 902,\n      \"trimY\": 308,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_08.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"19067e80-90a9-4011-901b-48b0ef454fea\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 776,\n      \"trimY\": 272,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_09.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5fa37595-0f18-4bf0-bb60-bfc195b829f1\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 650,\n      \"trimY\": 272,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_10.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5177086e-3b04-4e1a-b5ea-f45a0ae17d10\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 524,\n      \"trimY\": 272,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_11.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9f07ce45-6288-4e58-a6bd-f9698f91b578\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 398,\n      \"trimY\": 272,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_12.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a48065ab-695b-4002-9cfa-fc91ce203730\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 272,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_13.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"14a9ba6b-3c77-458d-8e17-52755be3f38d\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 902,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_17.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6bf29666-2801-4cee-a868-bf5aeddba1a5\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 776,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_18.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9803d74f-41e4-465f-8eef-b37e6b1ac678\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 650,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_19.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fe62f56b-458d-47f9-9900-8970cf698f09\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 524,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_20.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"3dc76ec1-8260-41a6-b765-92924bb7b85a\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 398,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_21.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"75d40a23-bfb5-4c5b-8047-58877391c739\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 272,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_22.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5e49eec7-5e0e-4c79-b062-a75bd567e23c\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 812,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_23.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"967eb70c-f36c-4d33-8745-9bc4bdb91175\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 686,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_24.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b9008395-f202-4684-b72c-84d36c18fd66\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 560,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_25.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2d646166-2154-40e0-84e0-dff694bed6ba\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 434,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_26.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fb1f07c3-ff9e-4600-8262-737bd7f456f4\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 308,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_27.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d23c78e7-03c8-4eae-8f28-0db8d19fed57\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 182,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_28.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2e73f328-d817-4466-ad8a-9cb8c78d3114\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 812,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_29.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7519f3d1-7a77-4210-a8fa-b762ac843541\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 686,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_33.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b502c26b-5442-4837-8c49-f7a89c674bc4\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 560,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_34.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"cf13e52f-5553-458a-96e0-50fc091af3a2\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 434,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_35.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"cbb802f3-84b7-439f-81ad-dc9bd5788ca7\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 308,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_36.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6461f6f1-206e-48a8-82a1-4e55d6e20188\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 182,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_37.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9c1c98c8-104e-476a-97bf-052637cbf352\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 848,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_38.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6e3d5190-a98f-461e-a824-be5f1289542a\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 722,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_39.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7ec5d482-5ce6-4f02-8052-6c879143dba9\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 596,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_40.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c825c6db-d5dc-408b-9548-68de826d4cb8\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 470,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_41.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"19e96350-ed5f-4e87-a52c-94b23ddc4605\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 344,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_42.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"cfd4425b-f703-4032-b457-4e5106396241\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 218,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_43.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"47ec5277-48cc-4ce8-9ff6-2e0023923792\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 92,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_44.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"28cd5893-be20-42e9-aedd-d681625b30a1\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 848,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_45.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"3ff81b67-3bc6-4e62-b5be-fa0dd489168c\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 722,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_49.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b80de904-3b0a-4efc-896f-60d8a9223c07\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 596,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_50.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"896edd88-678f-4240-87c9-6f887b4d0331\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 470,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_51.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1fb0a065-d936-43bf-9390-3b2f5e11e95a\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 344,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_52.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a54562da-2f7c-441a-9529-6c0674893df7\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 218,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_53.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"bdfadbd6-b0d3-432a-949d-bfae11184783\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 92,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_54.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1dc2818d-cd21-46cf-8fcd-1c16984a0dbd\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 884,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_55.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"70a818fd-dbb1-4cd8-847e-4dfa6aae16e3\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 758,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_56.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2aeb81c3-c3e3-4cb4-bb18-0b0072014d82\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 632,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_57.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"63d5b6aa-b83d-4f16-8e26-ec6c34b59df6\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 506,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_58.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e361aec7-044f-4706-9c5e-0258e755afa1\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 380,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_59.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1efde8df-77e3-405b-af3c-63096abfa0b2\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 254,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_60.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9e315073-086b-453e-812d-48d97211a2a6\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 128,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_61.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"0332df8f-a661-449a-941a-b0bd45cdb434\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 2,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 88,\n      \"height\": 124,\n      \"rawWidth\": 88,\n      \"rawHeight\": 128,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/game_cards.png.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"game_cards\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6d4aeaa5-b8e2-498e-9abc-f59b2acf5d75\",\n      \"rawTextureUuid\": \"24e07000-e189-4c09-8859-47cc25581533\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -16.5,\n      \"offsetY\": 7.5,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 987,\n      \"height\": 1005,\n      \"rawWidth\": 1024,\n      \"rawHeight\": 1024,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/game_cards_6p.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n    <dict>\n        <key>frames</key>\n        <dict>\n            <key>card_01.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,1122},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_02.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,1122},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_03.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,1906},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_04.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{142,1710},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_05.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{142,1514},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_06.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{142,1318},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_07.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{142,1122},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_08.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1906},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_09.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1710},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_10.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1514},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_11.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1318},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_12.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,1122},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <false/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_13.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,982},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_17.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,982},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_18.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,982},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_19.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,982},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_20.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,982},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_21.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,842},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_22.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,842},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_23.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,842},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_24.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,842},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_25.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,842},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_26.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,702},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_27.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,702},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_28.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,702},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_29.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,702},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_33.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,702},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_34.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,562},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_35.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,562},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_36.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,562},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_37.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,562},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_38.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,562},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_39.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,422},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_40.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,422},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_41.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,422},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_42.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,422},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_43.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,422},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_44.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,282},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_45.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,282},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_49.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,282},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_50.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,282},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_51.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,282},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_52.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,142},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_53.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,142},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_54.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,142},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_55.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,142},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_56.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,142},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_57.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{786,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_58.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{590,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_59.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{394,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_60.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{198,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n            <key>card_61.png</key>\n            <dict>\n                <key>frame</key>\n                <string>{{2,2},{138,194}}</string>\n                <key>offset</key>\n                <string>{0,3}</string>\n                <key>rotated</key>\n                <true/>\n                <key>sourceColorRect</key>\n                <string>{{0,0},{138,194}}</string>\n                <key>sourceSize</key>\n                <string>{138,200}</string>\n            </dict>\n        </dict>\n        <key>metadata</key>\n        <dict>\n            <key>format</key>\n            <integer>2</integer>\n            <key>realTextureFileName</key>\n            <string>game_cards_6p.png</string>\n            <key>size</key>\n            <string>{1024,2048}</string>\n            <key>smartupdate</key>\n            <string>$TexturePacker:SmartUpdate:78966e46f3c199dd5c77bd88fd0bd2d5:1/1$</string>\n            <key>textureFileName</key>\n            <string>game_cards_6p.png</string>\n        </dict>\n    </dict>\n</plist>\n"
  },
  {
    "path": "bin/client/assets/resources/game_cards_6p.plist.meta",
    "content": "{\n  \"ver\": \"1.2.4\",\n  \"uuid\": \"2f6611b7-f699-4bc8-b740-5e5eb6600610\",\n  \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n  \"size\": {\n    \"width\": 1024,\n    \"height\": 2048\n  },\n  \"type\": \"Texture Packer\",\n  \"subMetas\": {\n    \"card_01.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"54e8dc54-b596-477c-a504-69542f80d305\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 1122,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_02.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9187bd61-15fb-4d99-9a64-2b1f63946ce1\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 1122,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_03.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ce2cdfd1-a75d-4739-acf7-583106f66ea7\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 1906,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_04.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d701842c-c8ac-4d41-879b-a1a0c8265b86\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 142,\n      \"trimY\": 1710,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_05.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ac2e1783-1776-4e70-bf9d-dfde578fe2d0\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 142,\n      \"trimY\": 1514,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_06.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c78c71d2-f681-4882-98f3-4e7131a080ad\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 142,\n      \"trimY\": 1318,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_07.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c3e79061-7ee3-4c80-8ee1-804d59df0c34\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 142,\n      \"trimY\": 1122,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_08.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"0447dc10-5d83-4940-9912-45afbb8fce89\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 1906,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_09.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fa1e219c-daec-4000-8dc1-2a308d64cfbb\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 1710,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_10.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9de98e7b-ba17-48ba-8ba1-34ad8c834f72\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 1514,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_11.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2825cc16-297b-4baa-a21f-ccfe5548b7e2\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 1318,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_12.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7ba9526c-45c5-4ceb-8d4f-317e4eedeebb\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 1122,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_13.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"03f80e2b-d85a-46c5-8615-584c266a65b0\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 982,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_17.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a4f47186-c450-4cc5-8922-98ed2c3fc6ca\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 982,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_18.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"8214d788-91c8-4184-a431-b74fa2c7f41f\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 982,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_19.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d381ee2b-de98-4c6d-bb16-38d26cb96805\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 982,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_20.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7180543b-8b7f-4bef-8cb7-e53fef3da82c\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 982,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_21.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"84900ca8-de55-43cf-ba60-dff4a1b8df78\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 842,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_22.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"391bd8c6-8048-4363-8ec5-53e17d214138\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 842,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_23.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f96c6fd8-ef92-4767-823c-9362885476cf\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 842,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_24.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"3e6c9875-47cb-455f-b0e1-96e47b047a3b\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 842,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_25.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"2f376a1c-2ef7-421e-a65c-8f5c2fcae6c1\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 842,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_26.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a73192cc-cf13-4d97-bed9-509837813210\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 702,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_27.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"3814f894-9818-4288-841e-b1b91d4b05bb\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 702,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_28.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e0349bdf-6d11-4d09-a164-ecb8f12bfcca\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 702,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_29.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"fad556ea-2052-4814-9010-59181a2cf99a\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 702,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_33.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7355604b-898d-4e62-9bcd-6d637c79a69b\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 702,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_34.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"77163266-f626-405b-83cb-ca583444071c\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 562,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_35.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f31ff1b6-be45-4007-a21d-ebc623ffa369\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 562,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_36.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"12e7acef-a761-477b-9195-56a24c8e2ed2\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 562,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_37.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"668bb150-6d54-45c9-8683-031335be773a\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 562,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_38.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ce892dc4-8503-41ea-8319-08092895c18b\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 562,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_39.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"9b516a7d-3fad-47c1-82fc-a6b569d33e95\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 422,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_40.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"48a6d833-306b-4ecb-95af-29f2eb1d5e8e\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 422,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_41.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a6bfa8b1-750a-4146-a764-5f5fdd1c1586\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 422,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_42.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"e09ecadf-506d-4066-bb94-4b20b4946b81\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 422,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_43.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"c84fa538-8c0e-46ea-a32b-4e376cb0e6cb\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 422,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_44.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7527f58f-4a59-4bf3-b769-670ad8d0f170\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 282,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_45.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"4725b771-72c8-4e5f-934b-9dd2075f96e4\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 282,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_49.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5e3c4a6b-f21d-4e55-a856-71461d266645\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 282,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_50.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"b15773a0-f63b-42fb-b6d3-bd7320e98eb3\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 282,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_51.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"03629d4b-187e-47bc-ab84-8a654241d691\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 282,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_52.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"35aa265b-e57d-4e13-b024-101f83f780dd\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 142,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_53.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"f2adb59d-9f54-4235-91c1-9b488062dc59\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 142,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_54.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"6f1d6b2b-a250-42e8-8133-6a310f155470\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 142,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_55.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"365b41d0-80b2-47ba-87af-310144f7ab7f\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 142,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_56.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"1f4feb1b-b0f7-43fd-b650-43cbdf5e1352\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 142,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_57.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"7180fd78-73ea-4de9-a90e-6a7da12a4587\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 786,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_58.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"679cd96c-8a90-4b50-a6a8-dd9266202c3c\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 590,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_59.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"5e393008-0af4-4d68-a464-36e9f5877bfb\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 394,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_60.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"8fdc8eea-0724-4846-8e0b-0870895ba155\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 198,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    },\n    \"card_61.png\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d1a1f943-b5cf-499b-adcc-73f618c548df\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": true,\n      \"offsetX\": 0,\n      \"offsetY\": 3,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 138,\n      \"height\": 194,\n      \"rawWidth\": 138,\n      \"rawHeight\": 200,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"spriteType\": \"normal\",\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/game_cards_6p.png.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"game_cards_6p\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"a559bb08-bc8b-4bfb-b05b-c571d3af1144\",\n      \"rawTextureUuid\": \"d3175df2-92cf-41d8-9e71-1fd53833ccb5\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": -21,\n      \"offsetY\": 1.5,\n      \"trimX\": 2,\n      \"trimY\": 2,\n      \"width\": 978,\n      \"height\": 2041,\n      \"rawWidth\": 1024,\n      \"rawHeight\": 2048,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/game_desk_bg.jpg.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"e1084d70-0b00-4041-8ccc-62b69fbf1716\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"game_desk_bg\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"433c3791-25ed-4e94-8894-72e7dad6af14\",\n      \"rawTextureUuid\": \"e1084d70-0b00-4041-8ccc-62b69fbf1716\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 0,\n      \"trimY\": 0,\n      \"width\": 750,\n      \"height\": 1334,\n      \"rawWidth\": 750,\n      \"rawHeight\": 1334,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/game_desk_bg_6p.jpg.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"8eb63dd6-6d9b-47d8-8021-077beaf0c174\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"game_desk_bg_6p\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"d5e079ed-488b-4fd5-8bc3-b3e082b34d96\",\n      \"rawTextureUuid\": \"8eb63dd6-6d9b-47d8-8021-077beaf0c174\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 0,\n      \"trimY\": 0,\n      \"width\": 1242,\n      \"height\": 2208,\n      \"rawWidth\": 1242,\n      \"rawHeight\": 2208,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources/splash.gif.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"14855b17-56e8-473b-8923-ebbe56d4cc81\",\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/assets/resources/splash.png.meta",
    "content": "{\n  \"ver\": \"1.0.0\",\n  \"uuid\": \"ac7ab283-08d2-456d-b2fc-0a9ffe60330e\",\n  \"type\": \"sprite\",\n  \"wrapMode\": \"clamp\",\n  \"filterMode\": \"bilinear\",\n  \"subMetas\": {\n    \"splash\": {\n      \"ver\": \"1.0.3\",\n      \"uuid\": \"ff6660f1-fbd2-4dad-901b-ba8dd3fe5acc\",\n      \"rawTextureUuid\": \"ac7ab283-08d2-456d-b2fc-0a9ffe60330e\",\n      \"trimType\": \"auto\",\n      \"trimThreshold\": 1,\n      \"rotated\": false,\n      \"offsetX\": 0,\n      \"offsetY\": 0,\n      \"trimX\": 0,\n      \"trimY\": 0,\n      \"width\": 687,\n      \"height\": 324,\n      \"rawWidth\": 687,\n      \"rawHeight\": 324,\n      \"borderTop\": 0,\n      \"borderBottom\": 0,\n      \"borderLeft\": 0,\n      \"borderRight\": 0,\n      \"subMetas\": {}\n    }\n  }\n}"
  },
  {
    "path": "bin/client/assets/resources.meta",
    "content": "{\n  \"ver\": \"1.0.1\",\n  \"uuid\": \"1b5c7d50-37bb-4fb6-9e86-28af5dde70ef\",\n  \"isGroup\": false,\n  \"subMetas\": {}\n}"
  },
  {
    "path": "bin/client/creator.d.ts",
    "content": "\n/** !#en\nThe main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.\n!#zh\nCocos 引擎的主要命名空间，引擎代码中所有的类，函数，属性和常量都在这个命名空间中定义。 */\ndeclare module cc {\t\n\t/** !#en Init Debug setting.\n\t!#zh 设置调试模式。 \n\t*/\n\texport function _initDebugSetting(mode : DebugMode) : void;\t\n\t/** !#en\n\tOutputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>\n\t- In Cocos Creator, error is red.<br/>\n\t- In Chrome, error have a red icon along with red message text.<br/>\n\t!#zh\n\t输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>\n\t- 在 Cocos Creator 中，错误信息显示是红色的。<br/>\n\t- 在 Chrome 中，错误信息有红色的图标以及红色的消息文本。<br/>\n\t@param obj A JavaScript string containing zero or more substitution strings.\n\t@param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. \n\t*/\n\texport function error(obj : Any, subst : Any) : void;\t\n\t/** !#en\n\tOutputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).\n\t- In Cocos Creator, warning is yellow.\n\t- In Chrome, warning have a yellow warning icon with the message text.\n\t!#zh\n\t输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>\n\t- 在 Cocos Creator 中，警告信息显示是黄色的。<br/>\n\t- 在 Chrome 中，警告信息有着黄色的图标以及黄色的消息文本。<br/>\n\t@param obj A JavaScript string containing zero or more substitution strings.\n\t@param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. \n\t*/\n\texport function warn(obj : Any, subst : Any) : void;\t\n\t/** !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).\n\t!#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。\n\t@param obj A JavaScript string containing zero or more substitution strings.\n\t@param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. \n\t*/\n\texport function log(obj : Any, subst : Any) : void;\t\n\t/** !#en\n\tOutputs an informational message to the Cocos Creator Console (editor) or Web Console (runtime).\n\t- In Cocos Creator, info is blue.\n\t- In Firefox and Chrome, a small \"i\" icon is displayed next to these items in the Web Console's log.\n\t!#zh\n\t输出一条信息消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。\n\t- 在 Cocos Creator 中，Info 信息显示是蓝色的。<br/>\n\t- 在 Firefox 和  Chrome 中，Info 信息有着小 “i” 图标。\n\t@param obj A JavaScript string containing zero or more substitution strings.\n\t@param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. \n\t*/\n\texport function info(obj : any, subst : any) : void;\t\n\t/** !#en Creates an action with a Cardinal Spline array of points and tension.\n\t!#zh 按基数样条曲线轨迹移动到目标位置。\n\t@param points array of control points\n\t\n\t@example \n\t```js\n\t//create a cc.CardinalSplineTo\n\tvar action1 = cc.cardinalSplineTo(3, array, 0);\n\t``` \n\t*/\n\texport function cardinalSplineTo(duration : number, points : any[], tension : number) : ActionInterval;\t\n\t/** !#en Creates an action with a Cardinal Spline array of points and tension.\n\t!#zh 按基数样条曲线轨迹移动指定的距离。 \n\t*/\n\texport function cardinalSplineBy(duration : number, points : any[], tension : number) : ActionInterval;\t\n\t/** !#en Creates an action with a Cardinal Spline array of points and tension.\n\t!#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。\n\t\n\t@example \n\t```js\n\tvar action1 = cc.catmullRomTo(3, array);\n\t``` \n\t*/\n\texport function catmullRomTo(dt : number, points : any[]) : ActionInterval;\t\n\t/** !#en Creates an action with a Cardinal Spline array of points and tension.\n\t!#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。\n\t\n\t@example \n\t```js\n\tvar action1 = cc.catmullRomBy(3, array);\n\t``` \n\t*/\n\texport function catmullRomBy(dt : number, points : any[]) : ActionInterval;\t\n\t/** !#en\n\tCreates the speed action which changes the speed of an action, making it take longer (speed > 1)\n\tor less (speed < 1) time. <br/>\n\tUseful to simulate 'slow motion' or 'fast forward' effect.\n\t!#zh 修改目标动作的速率。\n\t\n\t@example \n\t```js\n\t// change the target action speed;\n\tvar action = cc.scaleTo(0.2, 1, 0.6);\n\tvar newAction = cc.speed(action, 0.5);\n\t``` \n\t*/\n\texport function speed(action : ActionInterval, speed : number) : Action;\t\n\t/** !#en Create a follow action which makes its target follows another node.\n\t!#zh 追踪目标节点的位置。\n\t\n\t@example \n\t```js\n\t// example\n\t// creates the action with a set boundary\n\tvar followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight));\n\tnode.runAction(followAction);\n\t\n\t// creates the action with no boundary set\n\tvar followAction = cc.follow(targetNode);\n\tnode.runAction(followAction);\n\t``` \n\t*/\n\texport function follow(followedNode : Node, rect : Rect) : Action;\t\n\t/** !#en\n\tCreates the action easing object with the rate parameter. <br />\n\tFrom slow to fast.\n\t!#zh 创建 easeIn 缓动对象，由慢到快。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeIn(3.0));\n\t``` \n\t*/\n\texport function easeIn(rate : number) : any;\t\n\t/** !#en\n\tCreates the action easing object with the rate parameter. <br />\n\tFrom fast to slow.\n\t!#zh 创建 easeOut 缓动对象，由快到慢。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeOut(3.0));\n\t``` \n\t*/\n\texport function easeOut(rate : number) : any;\t\n\t/** !#en\n\tCreates the action easing object with the rate parameter. <br />\n\tSlow to fast then to slow.\n\t!#zh 创建 easeInOut 缓动对象，慢到快，然后慢。\n\t\n\t@example \n\t```js\n\t//The new usage\n\taction.easing(cc.easeInOut(3.0));\n\t``` \n\t*/\n\texport function easeInOut(rate : number) : any;\t\n\t/** !#en\n\tCreates the action easing object with the rate parameter. <br />\n\tReference easeInExpo: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeExponentialIn 缓动对象。<br />\n\tEaseExponentialIn 是按指数函数缓动进入的动作。<br />\n\t参考 easeInExpo：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeExponentialIn());\n\t``` \n\t*/\n\texport function easeExponentialIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutExpo: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeExponentialOut 缓动对象。<br />\n\tEaseExponentialOut 是按指数函数缓动退出的动作。<br />\n\t参考 easeOutExpo：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeExponentialOut());\n\t``` \n\t*/\n\texport function easeExponentialOut() : any;\t\n\t/** !#en\n\tCreates an EaseExponentialInOut action easing object. <br />\n\tReference easeInOutExpo: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeExponentialInOut 缓动对象。<br />\n\tEaseExponentialInOut 是按指数函数缓动进入并退出的动作。<br />\n\t参考 easeInOutExpo：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeExponentialInOut());\n\t``` \n\t*/\n\texport function easeExponentialInOut() : any;\t\n\t/** !#en\n\tCreates an EaseSineIn action. <br />\n\tReference easeInSine: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 EaseSineIn 缓动对象。<br />\n\tEaseSineIn 是按正弦函数缓动进入的动作。<br />\n\t参考 easeInSine：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeSineIn());\n\t``` \n\t*/\n\texport function easeSineIn() : any;\t\n\t/** !#en\n\tCreates an EaseSineOut action easing object. <br />\n\tReference easeOutSine: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 EaseSineOut 缓动对象。<br />\n\tEaseSineIn 是按正弦函数缓动退出的动作。<br />\n\t参考 easeOutSine：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeSineOut());\n\t``` \n\t*/\n\texport function easeSineOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInOutSine: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeSineInOut 缓动对象。<br />\n\tEaseSineIn 是按正弦函数缓动进入并退出的动作。<br />\n\t参考 easeInOutSine：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeSineInOut());\n\t``` \n\t*/\n\texport function easeSineInOut() : any;\t\n\t/** !#en\n\tCreates the action easing obejct with the period in radians (default is 0.3). <br />\n\tReference easeInElastic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeElasticIn 缓动对象。<br />\n\tEaseElasticIn 是按弹性曲线缓动进入的动作。<br />\n\t参数 easeInElastic：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeElasticIn(3.0));\n\t``` \n\t*/\n\texport function easeElasticIn(period : number) : any;\t\n\t/** !#en\n\tCreates the action easing object with the period in radians (default is 0.3). <br />\n\tReference easeOutElastic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeElasticOut 缓动对象。<br />\n\tEaseElasticOut 是按弹性曲线缓动退出的动作。<br />\n\t参考 easeOutElastic：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeElasticOut(3.0));\n\t``` \n\t*/\n\texport function easeElasticOut(period : number) : any;\t\n\t/** !#en\n\tCreates the action easing object with the period in radians (default is 0.3). <br />\n\tReference easeInOutElastic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeElasticInOut 缓动对象。<br />\n\tEaseElasticInOut 是按弹性曲线缓动进入并退出的动作。<br />\n\t参考 easeInOutElastic：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeElasticInOut(3.0));\n\t``` \n\t*/\n\texport function easeElasticInOut(period : number) : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tEased bounce effect at the beginning.\n\t!#zh\n\t创建 easeBounceIn 缓动对象。<br />\n\tEaseBounceIn 是按弹跳动作缓动进入的动作。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBounceIn());\n\t``` \n\t*/\n\texport function easeBounceIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tEased bounce effect at the ending.\n\t!#zh\n\t创建 easeBounceOut 缓动对象。<br />\n\tEaseBounceOut 是按弹跳动作缓动退出的动作。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBounceOut());\n\t``` \n\t*/\n\texport function easeBounceOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tEased bounce effect at the begining and ending.\n\t!#zh\n\t创建 easeBounceInOut 缓动对象。<br />\n\tEaseBounceInOut 是按弹跳动作缓动进入并退出的动作。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBounceInOut());\n\t``` \n\t*/\n\texport function easeBounceInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tIn the opposite direction to move slowly, and then accelerated to the right direction.\n\t!#zh\n\t创建 easeBackIn 缓动对象。<br />\n\teaseBackIn 是在相反的方向缓慢移动，然后加速到正确的方向。<br />\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBackIn());\n\t``` \n\t*/\n\texport function easeBackIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tFast moving more than the finish, and then slowly back to the finish.\n\t!#zh\n\t创建 easeBackOut 缓动对象。<br />\n\teaseBackOut 快速移动超出目标，然后慢慢回到目标点。\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBackOut());\n\t``` \n\t*/\n\texport function easeBackOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tBegining of cc.EaseBackIn. Ending of cc.EaseBackOut.\n\t!#zh\n\t创建 easeBackInOut 缓动对象。<br />\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBackInOut());\n\t``` \n\t*/\n\texport function easeBackInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tInto the 4 reference point. <br />\n\tTo calculate the motion curve.\n\t!#zh\n\t创建 easeBezierAction 缓动对象。<br />\n\tEaseBezierAction 是按贝塞尔曲线缓动的动作。\n\t@param p0 The first bezier parameter\n\t@param p1 The second bezier parameter\n\t@param p2 The third bezier parameter\n\t@param p3 The fourth bezier parameter\n\t\n\t@example \n\t```js\n\t// example\n\taction.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));\n\t``` \n\t*/\n\texport function easeBezierAction(p0 : number, p1 : number, p2 : number, p3 : number) : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInQuad: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuadraticActionIn 缓动对象。<br />\n\tEaseQuadraticIn是按二次函数缓动进入的动作。<br />\n\t参考 easeInQuad：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuadraticActionIn());\n\t``` \n\t*/\n\texport function easeQuadraticActionIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutQuad: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuadraticActionOut 缓动对象。<br />\n\tEaseQuadraticOut 是按二次函数缓动退出的动作。<br />\n\t参考 easeOutQuad：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuadraticActionOut());\n\t``` \n\t*/\n\texport function easeQuadraticActionOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInOutQuad: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuadraticActionInOut 缓动对象。<br />\n\tEaseQuadraticInOut 是按二次函数缓动进入并退出的动作。<br />\n\t参考 easeInOutQuad：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuadraticActionInOut());\n\t``` \n\t*/\n\texport function easeQuadraticActionInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeIntQuart: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuarticActionIn 缓动对象。<br />\n\tEaseQuarticIn 是按四次函数缓动进入的动作。<br />\n\t参考 easeIntQuart：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuarticActionIn());\n\t``` \n\t*/\n\texport function easeQuarticActionIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutQuart: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuarticActionOut 缓动对象。<br />\n\tEaseQuarticOut 是按四次函数缓动退出的动作。<br />\n\t参考 easeOutQuart：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.QuarticActionOut());\n\t``` \n\t*/\n\texport function easeQuarticActionOut() : any;\t\n\t/** !#en\n\tCreates the action easing object.  <br />\n\tReference easeInOutQuart: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuarticActionInOut 缓动对象。<br />\n\tEaseQuarticInOut 是按四次函数缓动进入并退出的动作。<br />\n\t参考 easeInOutQuart：http://www.zhihu.com/question/21981571/answer/19925418 \n\t*/\n\texport function easeQuarticActionInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInQuint: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuinticActionIn 缓动对象。<br />\n\tEaseQuinticIn 是按五次函数缓动进的动作。<br />\n\t参考 easeInQuint：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuinticActionIn());\n\t``` \n\t*/\n\texport function easeQuinticActionIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutQuint: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuinticActionOut 缓动对象。<br />\n\tEaseQuinticOut 是按五次函数缓动退出的动作\n\t参考 easeOutQuint：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuadraticActionOut());\n\t``` \n\t*/\n\texport function easeQuinticActionOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInOutQuint: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeQuinticActionInOut 缓动对象。<br />\n\tEaseQuinticInOut是按五次函数缓动进入并退出的动作。<br />\n\t参考 easeInOutQuint：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeQuinticActionInOut());\n\t``` \n\t*/\n\texport function easeQuinticActionInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInCirc: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCircleActionIn 缓动对象。<br />\n\tEaseCircleIn是按圆形曲线缓动进入的动作。<br />\n\t参考 easeInCirc：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeCircleActionIn());\n\t``` \n\t*/\n\texport function easeCircleActionIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutCirc: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCircleActionOut 缓动对象。<br />\n\tEaseCircleOut是按圆形曲线缓动退出的动作。<br />\n\t参考 easeOutCirc：http://www.zhihu.com/question/21981571/answer/19925418 \n\t*/\n\texport function easeCircleActionOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInOutCirc: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCircleActionInOut 缓动对象。<br />\n\tEaseCircleInOut 是按圆形曲线缓动进入并退出的动作。<br />\n\t参考 easeInOutCirc：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeCircleActionInOut());\n\t``` \n\t*/\n\texport function easeCircleActionInOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInCubic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCubicActionIn 缓动对象。<br />\n\tEaseCubicIn 是按三次函数缓动进入的动作。<br />\n\t参考 easeInCubic：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeCubicActionIn());\n\t``` \n\t*/\n\texport function easeCubicActionIn() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeOutCubic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCubicActionOut 缓动对象。<br />\n\tEaseCubicOut 是按三次函数缓动退出的动作。<br />\n\t参考 easeOutCubic：http://www.zhihu.com/question/21981571/answer/19925418\n\t\n\t@example \n\t```js\n\t//example\n\taction.easing(cc.easeCubicActionOut());\n\t``` \n\t*/\n\texport function easeCubicActionOut() : any;\t\n\t/** !#en\n\tCreates the action easing object. <br />\n\tReference easeInOutCubic: <br />\n\thttp://www.zhihu.com/question/21981571/answer/19925418\n\t!#zh\n\t创建 easeCubicActionInOut 缓动对象。<br />\n\tEaseCubicInOut是按三次函数缓动进入并退出的动作。<br />\n\t参考 easeInOutCubic：http://www.zhihu.com/question/21981571/answer/19925418 \n\t*/\n\texport function easeCubicActionInOut() : any;\t\n\t/** !#en Show the Node.\n\t!#zh 立即显示。\n\t\n\t@example \n\t```js\n\t// example\n\tvar showAction = cc.show();\n\t``` \n\t*/\n\texport function show() : ActionInstant;\t\n\t/** !#en Hide the node.\n\t!#zh 立即隐藏。\n\t\n\t@example \n\t```js\n\t// example\n\tvar hideAction = cc.hide();\n\t``` \n\t*/\n\texport function hide() : ActionInstant;\t\n\t/** !#en Toggles the visibility of a node.\n\t!#zh 显隐状态切换。\n\t\n\t@example \n\t```js\n\t// example\n\tvar toggleVisibilityAction = cc.toggleVisibility();\n\t``` \n\t*/\n\texport function toggleVisibility() : ActionInstant;\t\n\t/** !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.\n\t!#zh 从父节点移除自身。\n\t\n\t@example \n\t```js\n\t// example\n\tvar removeSelfAction = cc.removeSelf();\n\t``` \n\t*/\n\texport function removeSelf(isNeedCleanUp : boolean) : ActionInstant;\t\n\t/** !#en Create a FlipX action to flip or unflip the target.\n\t!#zh X轴翻转。\n\t@param flip Indicate whether the target should be flipped or not\n\t\n\t@example \n\t```js\n\tvar flipXAction = cc.flipX(true);\n\t``` \n\t*/\n\texport function flipX(flip : boolean) : ActionInstant;\t\n\t/** !#en Create a FlipY action to flip or unflip the target.\n\t!#zh Y轴翻转。\n\t\n\t@example \n\t```js\n\tvar flipYAction = cc.flipY(true);\n\t``` \n\t*/\n\texport function flipY(flip : boolean) : ActionInstant;\t\n\t/** !#en Creates a Place action with a position.\n\t!#zh 放置在目标位置。\n\t\n\t@example \n\t```js\n\t// example\n\tvar placeAction = cc.place(cc.p(200, 200));\n\tvar placeAction = cc.place(200, 200);\n\t``` \n\t*/\n\texport function place(pos : Vec2|number, y? : number) : ActionInstant;\t\n\t/** !#en Creates the action with the callback.\n\t!#zh 执行回调函数。\n\t@param data data for function, it accepts all data types.\n\t\n\t@example \n\t```js\n\t// example\n\t// CallFunc without data\n\tvar finish = cc.callFunc(this.removeSprite, this);\n\t\n\t// CallFunc with data\n\tvar finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini,  true);\n\t``` \n\t*/\n\texport function callFunc(selector : Function, selectorTarget? : any|void, data? : any|void) : ActionInstant;\t\n\t/** !#en\n\tHelper constructor to create an array of sequenceable actions\n\tThe created action will run actions sequentially, one after another.\n\t!#zh 顺序执行动作，创建的动作将按顺序依次运行。\n\t\n\t@example \n\t```js\n\t// example\n\t// create sequence with actions\n\tvar seq = cc.sequence(act1, act2);\n\t\n\t// create sequence with array\n\tvar seq = cc.sequence(actArray);\n\t``` \n\t*/\n\texport function sequence(tempArray : any[]|FiniteTimeAction) : ActionInterval;\t\n\t/** !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)\n\t!#zh 重复动作，可以按一定次数重复一个动，如果想永远重复一个动作请使用 repeatForever 动作来完成。\n\t\n\t@example \n\t```js\n\t// example\n\tvar rep = cc.repeat(cc.sequence(jump2, jump1), 5);\n\t``` \n\t*/\n\texport function repeat(action : FiniteTimeAction, times : number) : ActionInterval;\t\n\t/** !#en Create a acton which repeat forever\n\t!#zh 永远地重复一个动作，有限次数内重复一个动作请使用 repeat 动作。\n\t\n\t@example \n\t```js\n\t// example\n\tvar repeat = cc.repeatForever(cc.rotateBy(1.0, 360));\n\t``` \n\t*/\n\texport function repeatForever(action : FiniteTimeAction) : ActionInterval;\t\n\t/** !#en Create a spawn action which runs several actions in parallel.\n\t!#zh 同步执行动作，同步执行一组动作。\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720));\n\ttodo:It should be the direct use new\n\t``` \n\t*/\n\texport function spawn(tempArray : any[]|FiniteTimeAction) : FiniteTimeAction;\t\n\t/** !#en\n\tRotates a Node object to a certain angle by modifying its rotation property. <br/>\n\tThe direction will be decided by the shortest angle.\n\t!#zh 旋转到目标角度，通过逐帧修改它的 rotation 属性，旋转方向将由最短的角度决定。\n\t@param duration duration in seconds\n\t@param deltaAngleX deltaAngleX in degrees.\n\t@param deltaAngleY deltaAngleY in degrees.\n\t\n\t@example \n\t```js\n\t// example\n\tvar rotateTo = cc.rotateTo(2, 61.0);\n\t``` \n\t*/\n\texport function rotateTo(duration : number, deltaAngleX : number, deltaAngleY? : number) : ActionInterval;\t\n\t/** !#en\n\tRotates a Node object clockwise a number of degrees by modifying its rotation property.\n\tRelative to its properties to modify.\n\t!#zh 旋转指定的角度。\n\t@param duration duration in seconds\n\t@param deltaAngleX deltaAngleX in degrees\n\t@param deltaAngleY deltaAngleY in degrees\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionBy = cc.rotateBy(2, 360);\n\t``` \n\t*/\n\texport function rotateBy(duration : number, deltaAngleX : number, deltaAngleY? : number) : ActionInterval;\t\n\t/** !#en\n\tMoves a Node object x,y pixels by modifying its position property.                                  <br/>\n\tx and y are relative to the position of the object.                                                     <br/>\n\tSeveral MoveBy actions can be concurrently called, and the resulting                                  <br/>\n\tmovement will be the sum of individual movements.\n\t!#zh 移动指定的距离。\n\t@param duration duration in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40));\n\t``` \n\t*/\n\texport function moveBy(duration : number, deltaPos : Vec2|number, deltaY : number) : ActionInterval;\t\n\t/** !#en\n\tMoves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property. <br/>\n\tSeveral MoveTo actions can be concurrently called, and the resulting                                            <br/>\n\tmovement will be the sum of individual movements.\n\t!#zh 移动到目标位置。\n\t@param duration duration in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionBy = cc.moveTo(2, cc.p(80, 80));\n\t``` \n\t*/\n\texport function moveTo(duration : number, position : Vec2, y : number) : ActionInterval;\t\n\t/** !#en\n\tCreate a action which skews a Node object to given angles by modifying its skewX and skewY properties.\n\tChanges to the specified value.\n\t!#zh 偏斜到目标角度。\n\t@param t time in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionTo = cc.skewTo(2, 37.2, -37.2);\n\t``` \n\t*/\n\texport function skewTo(t : number, sx : number, sy : number) : ActionInterval;\t\n\t/** !#en\n\tSkews a Node object by skewX and skewY degrees. <br />\n\tRelative to its property modification.\n\t!#zh 偏斜指定的角度。\n\t@param t time in seconds\n\t@param sx sx skew in degrees for X axis\n\t@param sy sy skew in degrees for Y axis\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionBy = cc.skewBy(2, 0, -90);\n\t``` \n\t*/\n\texport function skewBy(t : number, sx : number, sy : number) : ActionInterval;\t\n\t/** !#en\n\tMoves a Node object simulating a parabolic jump movement by modifying it's position property.\n\tRelative to its movement.\n\t!#zh 用跳跃的方式移动指定的距离。\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionBy = cc.jumpBy(2, cc.p(300, 0), 50, 4);\n\tvar actionBy = cc.jumpBy(2, 300, 0, 50, 4);\n\t``` \n\t*/\n\texport function jumpBy(duration : number, position : Vec2|number, y? : number, height : number, jumps : number) : ActionInterval;\t\n\t/** !#en\n\tMoves a Node object to a parabolic position simulating a jump movement by modifying its position property. <br />\n\tJump to the specified location.\n\t!#zh 用跳跃的方式移动到目标位置。\n\t\n\t@example \n\t```js\n\t// example\n\tvar actionTo = cc.jumpTo(2, cc.p(300, 300), 50, 4);\n\tvar actionTo = cc.jumpTo(2, 300, 300, 50, 4);\n\t``` \n\t*/\n\texport function jumpTo(duration : number, position : Vec2|number, y? : number, height : number, jumps : number) : ActionInterval;\t\n\t/** !#en\n\tAn action that moves the target with a cubic Bezier curve by a certain distance.\n\tRelative to its movement.\n\t!#zh 按贝赛尔曲线轨迹移动指定的距离。\n\t@param t time in seconds\n\t@param c Array of points\n\t\n\t@example \n\t```js\n\t// example\n\tvar bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];\n\tvar bezierForward = cc.bezierBy(3, bezier);\n\t``` \n\t*/\n\texport function bezierBy(t : number, c : any[]) : ActionInterval;\t\n\t/** !#en An action that moves the target with a cubic Bezier curve to a destination point.\n\t!#zh 按贝赛尔曲线轨迹移动到目标位置。\n\t@param c array of points\n\t\n\t@example \n\t```js\n\t// example\n\tvar bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];\n\tvar bezierTo = cc.bezierTo(2, bezier);\n\t``` \n\t*/\n\texport function bezierTo(t : number, c : any[]) : ActionInterval;\t\n\t/** !#en Scales a Node object to a zoom factor by modifying it's scale property.\n\t!#zh 将节点大小缩放到指定的倍数。\n\t@param sx scale parameter in X\n\t@param sy scale parameter in Y, if Null equal to sx\n\t\n\t@example \n\t```js\n\t// example\n\t// It scales to 0.5 in both X and Y.\n\tvar actionTo = cc.scaleTo(2, 0.5);\n\t\n\t// It scales to 0.5 in x and 2 in Y\n\tvar actionTo = cc.scaleTo(2, 0.5, 2);\n\t``` \n\t*/\n\texport function scaleTo(duration : number, sx : number, sy? : number) : ActionInterval;\t\n\t/** !#en\n\tScales a Node object a zoom factor by modifying it's scale property.\n\tRelative to its changes.\n\t!#zh 按指定的倍数缩放节点大小。\n\t@param duration duration in seconds\n\t@param sx sx  scale parameter in X\n\t@param sy sy scale parameter in Y, if Null equal to sx\n\t\n\t@example \n\t```js\n\t// example without sy, it scales by 2 both in X and Y\n\tvar actionBy = cc.scaleBy(2, 2);\n\t\n\t//example with sy, it scales by 0.25 in X and 4.5 in Y\n\tvar actionBy2 = cc.scaleBy(2, 0.25, 4.5);\n\t``` \n\t*/\n\texport function scaleBy(duration : number, sx : number, sy? : number|void) : ActionInterval;\t\n\t/** !#en Blinks a Node object by modifying it's visible property.\n\t!#zh 闪烁（基于透明度）。\n\t@param duration duration in seconds\n\t@param blinks blinks in times\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.blink(2, 10);\n\t``` \n\t*/\n\texport function blink(duration : number, blinks : number) : ActionInterval;\t\n\t/** !#en\n\tFades an object that implements the cc.RGBAProtocol protocol.\n\tIt modifies the opacity from the current value to a custom one.\n\t!#zh 修改透明度到指定值。\n\t@param opacity 0-255, 0 is transparent\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.fadeTo(1.0, 0);\n\t``` \n\t*/\n\texport function fadeTo(duration : number, opacity : number) : ActionInterval;\t\n\t/** !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.\n\t!#zh 渐显效果。\n\t@param duration duration in seconds\n\t\n\t@example \n\t```js\n\t//example\n\tvar action = cc.fadeIn(1.0);\n\t``` \n\t*/\n\texport function fadeIn(duration : number) : ActionInterval;\t\n\t/** !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.\n\t!#zh 渐隐效果。\n\t@param d duration in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.fadeOut(1.0);\n\t``` \n\t*/\n\texport function fadeOut(d : number) : ActionInterval;\t\n\t/** !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.\n\t!#zh 修改颜色到指定值。\n\t@param red 0-255\n\t@param green 0-255\n\t@param blue 0-255\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.tintTo(2, 255, 0, 255);\n\t``` \n\t*/\n\texport function tintTo(duration : number, red : number, green : number, blue : number) : ActionInterval;\t\n\t/** !#en\n\tTints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.\n\tRelative to their own color change.\n\t!#zh 按照指定的增量修改颜色。\n\t@param duration duration in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar action = cc.tintBy(2, -127, -255, -127);\n\t``` \n\t*/\n\texport function tintBy(duration : number, deltaRed : number, deltaGreen : number, deltaBlue : number) : ActionInterval;\t\n\t/** !#en Delays the action a certain amount of seconds.\n\t!#en 延迟指定的时间量。\n\t@param d duration in seconds\n\t\n\t@example \n\t```js\n\t// example\n\tvar delay = cc.delayTime(1);\n\t``` \n\t*/\n\texport function delayTime(d : number) : ActionInterval;\t\n\t/** !#en Executes an action in reverse order, from time=duration to time=0.\n\t!#zh 反转目标动作的时间轴。\n\t\n\t@example \n\t```js\n\t// example\n\t var reverse = cc.reverseTime(this);\n\t``` \n\t*/\n\texport function reverseTime(action : FiniteTimeAction) : ActionInterval;\t\n\t/** !#en Create an action with the specified action and forced target.\n\t!#zh 用已有动作和一个新的目标节点创建动作。 \n\t*/\n\texport function targetedAction(target : Node, action : FiniteTimeAction) : ActionInterval;\t\n\t/** Constructor \n\t*/\n\texport function HashElement() : void;\t\n\t/** !#en cc.view is the shared view object.\n\t!#zh cc.view 是全局的视图对象。 */\n\texport var view : View;\t\n\t/** !#en Director\n\t!#zh 导演类。 */\n\texport var director : Director;\t\n\t/** !#en cc.winSize is the alias object for the size of the current game window.\n\t!#zh cc.winSize 为当前的游戏窗口的大小。 */\n\texport var winSize : Size;\t\n\texport var game : Game;\t\n\t/** Checks whether subclass is child of superclass or equals to superclass \n\t*/\n\texport function isChildClassOf(subclass : Function, superclass : Function) : boolean;\t\n\t/** !#en Defines a CCClass using the given specification, please see [Class](/en/scripting/class/) for details.\n\t!#zh 定义一个 CCClass，传入参数必须是一个包含类型参数的字面量对象，具体用法请查阅[类型定义](/zh/scripting/class/)。\n\t\n\t@example \n\t```js\n\t// define base class\n\tvar Node = cc.Class();\n\t\n\t// define sub class\n\tvar Sprite = cc.Class({\n\tname: 'Sprite',\n\textends: Node,\n\tctor: function () {\n\tthis.url = \"\";\n\tthis.id = 0;\n\t},\n\t\n\tproperties {\n\twidth: {\n\tdefault: 128,\n\ttype: 'Integer',\n\ttooltip: 'The width of sprite'\n\t},\n\theight: 128,\n\tsize: {\n\tget: function () {\n\treturn cc.v2(this.width, this.height);\n\t}\n\t}\n\t},\n\t\n\tload: function () {\n\t// load this.url\n\t};\n\t});\n\t\n\t// instantiate\n\t\n\tvar obj = new Sprite();\n\tobj.url = 'sprite.png';\n\tobj.load();\n\t\n\t// define static member\n\t\n\tSprite.count = 0;\n\tSprite.getBounds = function (spriteList) {\n\t// ...\n\t};\n\t``` \n\t*/\n\texport function Class(options : { name? : string; extends? : Function; ctor? : Function; properties? : any; statics? : any; mixins? : Function[]; editor? : any; update? : Function; lateUpdate? : Function; onLoad? : Function; start? : Function; onEnable? : Function; onDisable? : Function; onDestroy? : Function; onFocusInEditor? : Function; onLostFocusInEditor? : Function; onRestore? : Function; _getLocalBounds? : Function; }) : Function;\t\n\t/** whether enable accelerometer event \n\t*/\n\texport function setAccelerometerEnabled(isEnable : boolean) : void;\t\n\t/** set accelerometer interval value \n\t*/\n\texport function setAccelerometerInterval(interval : number) : void;\t\n\t/** !#en Checks whether the object is non-nil and not yet destroyed.\n\t!#zh 检查该对象是否不为 null 并且尚未销毁。\n\t\n\t@example \n\t```js\n\tcc.log(cc.isValid(target));\n\t``` \n\t*/\n\texport function isValid(value : any) : boolean;\t\n\t/** Specify that the input value must be integer in Inspector.\n\tAlso used to indicates that the elements in array should be type integer. */\n\texport var Integer : string;\t\n\t/** Indicates that the elements in array should be type double. */\n\texport var Float : string;\t\n\t/** Indicates that the elements in array should be type boolean. */\n\texport var Boolean : string;\t\n\t/** Indicates that the elements in array should be type string. */\n\texport var String : string;\t\n\t/** !#en Deserialize json to cc.Asset\n\t!#zh 将 JSON 反序列化为对象实例。\n\t\n\t当指定了 target 选项时，如果 target 引用的其它 asset 的 uuid 不变，则不会改变 target 对 asset 的引用，\n\t也不会将 uuid 保存到 result 对象中。\n\t@param data the serialized cc.Asset json string or json object.\n\t@param result additional loading result \n\t*/\n\texport function deserialize(data : string|any, result? : Details, options? : any) : any;\t\n\t/** !#en Clones the object original and returns the clone.\n\t\n\tSee [Clone exists Entity](/en/scripting/create-destroy-entities/#instantiate)\n\t\n\t!#zh 复制给定的对象\n\t\n\t详细用法可参考[复制已有Entity](/zh/scripting/create-destroy-entities/#instantiate)\n\t\n\tInstantiate 时，function 和 dom 等非可序列化对象会直接保留原有引用，Asset 会直接进行浅拷贝，可序列化类型会进行深拷贝。\n\t<del>对于 Entity / Component 等 Scene Object，如果对方也会被一起 Instantiate，则重定向到新的引用，否则保留为原来的引用。</del>\n\t@param original An existing object that you want to make a copy of. \n\t*/\n\texport function instantiate(original : any) : any;\t\n\t/** Finds a node by hierarchy path, the path is case-sensitive.\n\tIt will traverse the hierarchy by splitting the path using '/' character.\n\tThis function will still returns the node even if it is inactive.\n\tIt is recommended to not use this function every frame instead cache the result at startup. \n\t*/\n\texport function find(path : string, referenceNode? : Node) : Node;\t\n\t/** !#en\n\tThe convenience method to create a new {{#crossLink \"Color/Color:method\"}}cc.Color{{/crossLink}}\n\tAlpha channel is optional. Default value is 255.\n\t\n\t!#zh\n\t通过该方法来创建一个新的 {{#crossLink \"Color/Color:method\"}}cc.Color{{/crossLink}} 对象。\n\tAlpha 通道是可选的。默认值是 255。\n\t\n\t@example \n\t```js\n\t-----------------------\n\t// 1. All channels seperately as parameters\n\tvar color1 = new cc.Color(255, 255, 255, 255);\n\t// 2. Convert a hex string to a color\n\tvar color2 = new cc.Color(\"#000000\");\n\t// 3. An color object as parameter\n\tvar color3 = new cc.Color({r: 255, g: 255, b: 255, a: 255});\n\t\n\t``` \n\t*/\n\texport function color(r? : number, g? : number, b? : number, a? : number) : Color;\t\n\t/** !#en returns true if both ccColor3B are equal. Otherwise it returns false.\n\t!#zh 判断两个颜色对象的 RGB 部分是否相等，不比较透明度。\n\t\n\t@example \n\t```js\n\tcc.log(cc.colorEqual(cc.Color.RED, new cc.Color(255, 0, 0))); // true\n\t``` \n\t*/\n\texport function colorEqual(color1: (r: number, g: number, b: number, a: number) => void, color2: (r: number, g: number, b: number, a: number) => void) : boolean;\t\n\t/** !#en\n\tconvert a string of color for style to Color.\n\te.g. \"#ff06ff\"  to : cc.color(255,6,255)。\n\t!#zh 16 进制转换为 Color\n\t\n\t@example \n\t```js\n\tcc.hexToColor(\"#FFFF33\"); // Color {r: 255, g: 255, b: 51, a: 255};\n\t``` \n\t*/\n\texport function hexToColor(hex : string) : Color;\t\n\t/** !#en\n\tconvert Color to a string of color for style.\n\te.g.  cc.color(255,6,255)  to : \"#ff06ff\"\n\t!#zh Color 转换为 16进制。\n\t\n\t@example \n\t```js\n\tvar color = new cc.Color(255, 6, 255)\n\tcc.colorToHex(color); // #ff06ff;\n\t``` \n\t*/\n\texport function colorToHex(color: (r: number, g: number, b: number, a: number) => void) : string;\t\n\t/** !#en\n\tDefine an enum type. <br/>\n\tIf a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>\n\tOtherwise it will use the value specified by user who writes the enum definition.\n\t\n\t!#zh\n\t定义一个枚举类型。<br/>\n\t用户可以把枚举值设为任意的整数，如果设为 -1，系统将会分配为上一个枚举值 + 1。\n\t@param obj a JavaScript literal object containing enum names and values\n\t\n\t@example \n\t```js\n\tvar WrapMode = cc.Enum({\n\t    Repeat: -1,\n\t    Clamp: -1\n\t});\n\t\n\t// Texture.WrapMode.Repeat == 0\n\t// Texture.WrapMode.Clamp == 1\n\t// Texture.WrapMode[0] == \"Repeat\"\n\t// Texture.WrapMode[1] == \"Clamp\"\n\t\n\tvar FlagType = cc.Enum({\n\t    Flag1: 1,\n\t    Flag2: 2,\n\t    Flag3: 4,\n\t    Flag4: 8,\n\t});\n\t\n\tvar AtlasSizeList = cc.Enum({\n\t    128: 128,\n\t    256: 256,\n\t    512: 512,\n\t    1024: 1024,\n\t});\n\t``` \n\t*/\n\texport function Enum(obj : any) : any;\t\n\t/** !#en Returns opposite of Vec2.\n\t!#zh 返回相反的向量。\n\t\n\t@example \n\t```js\n\tcc.pNeg(cc.v2(10, 10));// Vec2 {x: -10, y: -10};\n\t``` \n\t*/\n\texport function pNeg(point : Vec2) : Vec2;\t\n\t/** !#en Calculates sum of two points.\n\t!#zh 返回两个向量的和。\n\t\n\t@example \n\t```js\n\tcc.pAdd(cc.v2(1, 1), cc.v2(2, 2));// Vec2 {x: 3, y: 3};\n\t``` \n\t*/\n\texport function pAdd(v1 : Vec2, v2 : Vec2) : Vec2;\t\n\t/** !#en Calculates difference of two points.\n\t!#zh 返回两个向量的差。\n\t\n\t@example \n\t```js\n\tcc.pSub(cc.v2(20, 20), cc.v2(5, 5)); // Vec2 {x: 15, y: 15};\n\t``` \n\t*/\n\texport function pSub(v1 : Vec2, v2 : Vec2) : Vec2;\t\n\t/** !#en Returns point multiplied by given factor.\n\t!#zh 向量缩放。\n\t\n\t@example \n\t```js\n\tcc.pMult(cc.v2(5, 5), 4); // Vec2 {x: 20, y: 20};\n\t``` \n\t*/\n\texport function pMult(point : Vec2, floatVar : number) : Vec2;\t\n\t/** !#en Calculates midpoint between two points.\n\t!#zh 两个向量之间的中心点。\n\t\n\t@example \n\t```js\n\tcc.pMidpoint(cc.v2(10, 10), cc.v2(5, 5)); // Vec2 {x: 7.5, y: 7.5};\n\t``` \n\t*/\n\texport function pMidpoint(v1 : Vec2, v2 : Vec2) : Vec2;\t\n\t/** !#en Calculates dot product of two points.\n\t!#zh 两个向量之间进行点乘。\n\t\n\t@example \n\t```js\n\tcc.pDot(cc.v2(20, 20), cc.v2(5, 5)); // 200;\n\t``` \n\t*/\n\texport function pDot(v1 : Vec2, v2 : Vec2) : number;\t\n\t/** !#en Calculates cross product of two points.\n\t!#zh 两个向量之间进行叉乘。\n\t\n\t@example \n\t```js\n\tcc.pCross(cc.v2(20, 20), cc.v2(5, 5)); // 0;\n\t``` \n\t*/\n\texport function pCross(v1 : Vec2, v2 : Vec2) : number;\t\n\t/** !#en Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) greater than 0.\n\t!#zh 返回逆时针旋转 90 度后的新向量。\n\t\n\t@example \n\t```js\n\tcc.pPerp(cc.v2(20, 20)); // Vec2 {x: -20, y: 20};\n\t``` \n\t*/\n\texport function pPerp(point : Vec2) : Vec2;\t\n\t/** !#en Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) smaller than 0.\n\t!#zh 将指定向量顺时针旋转 90 度并返回。\n\t\n\t@example \n\t```js\n\tcc.pRPerp(cc.v2(20, 20)); // Vec2 {x: 20, y: -20};\n\t``` \n\t*/\n\texport function pRPerp(point : Vec2) : Vec2;\t\n\t/** !#en Calculates the projection of v1 over v2.\n\t!#zh 返回 v1 在 v2 上的投影向量。\n\t\n\t@example \n\t```js\n\tvar v1 = cc.v2(20, 20);\n\tvar v2 = cc.v2(5, 5);\n\tcc.pProject(v1, v2); // Vec2 {x: 20, y: 20};\n\t``` \n\t*/\n\texport function pProject(v1 : Vec2, v2 : Vec2) : Vec2;\t\n\t/** !#en Calculates the square length of a cc.Vec2 (not calling sqrt() ).\n\t!#zh 返回指定向量长度的平方。\n\t\n\t@example \n\t```js\n\tcc.pLengthSQ(cc.v2(20, 20)); // 800;\n\t``` \n\t*/\n\texport function pLengthSQ(v : Vec2) : number;\t\n\t/** !#en Calculates the square distance between two points (not calling sqrt() ).\n\t!#zh 返回两个点之间距离的平方。\n\t\n\t@example \n\t```js\n\tvar point1 = cc.v2(20, 20);\n\tvar point2 = cc.v2(5, 5);\n\tcc.pDistanceSQ(point1, point2); // 450;\n\t``` \n\t*/\n\texport function pDistanceSQ(point1 : Vec2, point2 : Vec2) : number;\t\n\t/** !#en Calculates distance between point an origin.\n\t!#zh 返回指定向量的长度.\n\t\n\t@example \n\t```js\n\tcc.pLength(cc.v2(20, 20)); // 28.284271247461902;\n\t``` \n\t*/\n\texport function pLength(v : Vec2) : number;\t\n\t/** !#en Calculates the distance between two points.\n\t!#zh 返回指定 2 个向量之间的距离。\n\t\n\t@example \n\t```js\n\tvar v1 = cc.v2(20, 20);\n\tvar v2 = cc.v2(5, 5);\n\tcc.pDistance(v1, v2); // 21.213203435596427;\n\t``` \n\t*/\n\texport function pDistance(v1 : Vec2, v2 : Vec2) : number;\t\n\t/** !#en Returns this vector with a magnitude of 1.\n\t!#zh 返回一个长度为 1 的标准化过后的向量。\n\t\n\t@example \n\t```js\n\tcc.pNormalize(cc.v2(20, 20)); // Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};\n\t``` \n\t*/\n\texport function pNormalize(v : Vec2) : Vec2;\t\n\t/** !#en Converts radians to a normalized vector.\n\t!#zh 将弧度转换为一个标准化后的向量，返回坐标 x = cos(a) , y = sin(a)。\n\t\n\t@example \n\t```js\n\tcc.pForAngle(20); // Vec2 {x: 0.40808206181339196, y: 0.9129452507276277};\n\t``` \n\t*/\n\texport function pForAngle(a : number) : Vec2;\t\n\t/** !#en Converts a vector to radians.\n\t!#zh 返回指定向量的弧度。\n\t\n\t@example \n\t```js\n\tcc.pToAngle(cc.v2(20, 20)); // 0.7853981633974483;\n\t``` \n\t*/\n\texport function pToAngle(v : Vec2) : number;\t\n\t/** !#en Clamp a value between from and to.\n\t!#zh\n\t限定浮点数的最大最小值。<br/>\n\t数值大于 max_inclusive 则返回 max_inclusive。<br/>\n\t数值小于 min_inclusive 则返回 min_inclusive。<br/>\n\t否则返回自身。\n\t\n\t@example \n\t```js\n\tvar v1 = cc.clampf(20, 0, 20); // 20;\n\tvar v2 = cc.clampf(-1, 0, 20); //  0;\n\tvar v3 = cc.clampf(10, 0, 20); // 10;\n\t``` \n\t*/\n\texport function clampf(value : number, min_inclusive : number, max_inclusive : number) : number;\t\n\t/** !#en Clamp a value between 0 and 1.\n\t!#zh 限定浮点数的取值范围为 0 ~ 1 之间。\n\t\n\t@example \n\t```js\n\tvar v1 = cc.clampf(20);  // 1;\n\tvar v2 = cc.clampf(-1);  // 0;\n\tvar v3 = cc.clampf(0.5); // 0.5;\n\t``` \n\t*/\n\texport function clamp01(value : number) : number;\t\n\t/** !#en Clamp a point between from and to.\n\t!#zh\n\t返回指定限制区域后的向量。<br/>\n\t向量大于 max_inclusive 则返回 max_inclusive。<br/>\n\t向量小于 min_inclusive 则返回 min_inclusive。<br/>\n\t否则返回自身。\n\t\n\t@example \n\t```js\n\tvar min_inclusive = cc.v2(0, 0);\n\tvar max_inclusive = cc.v2(20, 20);\n\tvar v1 = cc.pClamp(cc.v2(20, 20), min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};\n\tvar v2 = cc.pClamp(cc.v2(0, 0), min_inclusive, max_inclusive);   // Vec2 {x: 0, y: 0};\n\tvar v3 = cc.pClamp(cc.v2(10, 10), min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};\n\t``` \n\t*/\n\texport function pClamp(p : Vec2, min_inclusive : Vec2, max_inclusive : Vec2) : Vec2;\t\n\t/** !#en Quickly convert cc.Size to a cc.Vec2.\n\t!#zh 快速转换 cc.Size 为 cc.Vec2。\n\t\n\t@example \n\t```js\n\tcc.pFromSize(new cc.size(20, 20)); // Vec2 {x: 20, y: 20};\n\t``` \n\t*/\n\texport function pFromSize(s : Size) : Vec2;\t\n\t/** !#en\n\tRun a math operation function on each point component <br />\n\tMath.abs, Math.fllor, Math.ceil, Math.round.\n\t!#zh 通过运行指定的数学运算函数来计算指定的向量。\n\t\n\t@example \n\t```js\n\tcc.pCompOp(cc.p(-10, -10), Math.abs); // Vec2 {x: 10, y: 10};\n\t``` \n\t*/\n\texport function pCompOp(p : Vec2, opFunc : Function) : Vec2;\t\n\t/** !#en\n\tLinear Interpolation between two points a and b.<br />\n\talpha == 0 ? a <br />\n\talpha == 1 ? b <br />\n\totherwise a value between a..b.\n\t!#zh\n\t两个点 A 和 B 之间的线性插值。 <br />\n\talpha == 0 ? a <br />\n\talpha == 1 ? b <br />\n\t否则这个数值在 a ~ b 之间。\n\t\n\t@example \n\t```js\n\tcc.pLerp(cc.v2(20, 20), cc.v2(5, 5), 0.5); // Vec2 {x: 12.5, y: 12.5};\n\t``` \n\t*/\n\texport function pLerp(a : Vec2, b : Vec2, alpha : number) : Vec2;\t\n\t/** !#en TODO\n\t!#zh\n\t近似判断两个点是否相等。<br/>\n\t判断 2 个向量是否在指定数值的范围之内，如果在则返回 true，反之则返回 false。\n\t\n\t@example \n\t```js\n\tvar a = cc.v2(20, 20);\n\tvar b = cc.v2(5, 5);\n\tvar b1 = cc.pFuzzyEqual(a, b, 10); // false;\n\tvar b2 = cc.pFuzzyEqual(a, b, 18); // true;\n\t``` \n\t*/\n\texport function pFuzzyEqual(a : Vec2, b : Vec2, variance : number) : boolean;\t\n\t/** !#en Multiplies a nd b components, a.x*b.x, a.y*b.y.\n\t!#zh 计算两个向量的每个分量的乘积， a.x * b.x, a.y * b.y。\n\t\n\t@example \n\t```js\n\tcc.pCompMult(acc.v2(20, 20), cc.v2(5, 5)); // Vec2 {x: 100, y: 100};\n\t``` \n\t*/\n\texport function pCompMult(a : Vec2, b : Vec2) : Vec2;\t\n\t/** !#en TODO\n\t!#zh 返回两个向量之间带正负号的弧度。 \n\t*/\n\texport function pAngleSigned(a : Vec2, b : Vec2) : number;\t\n\t/** !#en TODO\n\t!#zh 获取当前向量与指定向量之间的弧度角。 \n\t*/\n\texport function pAngle(a : Vec2, b : Vec2) : number;\t\n\t/** !#en Rotates a point counter clockwise by the angle around a pivot.\n\t!#zh 返回给定向量围绕指定轴心顺时针旋转一定弧度后的结果。\n\t@param v v is the point to rotate\n\t@param pivot pivot is the pivot, naturally\n\t@param angle angle is the angle of rotation cw in radians \n\t*/\n\texport function pRotateByAngle(v : Vec2, pivot : Vec2, angle : number) : Vec2;\t\n\t/** !#en\n\tA general line-line intersection test\n\tindicating successful intersection of a line<br />\n\tnote that to truly test intersection for segments we have to make<br />\n\tsure that s & t lie within [0..1] and for rays, make sure s & t > 0<br />\n\tthe hit point is        p3 + t * (p4 - p3);<br />\n\tthe hit point also is    p1 + s * (p2 - p1);\n\t!#zh\n\t返回 A 为起点 B 为终点线段 1 所在直线和 C 为起点 D 为终点线段 2 所在的直线是否相交，<br />\n\t如果相交返回 true，反之则为 false，参数 retP 是返回交点在线段 1、线段 2 上的比例。\n\t@param A A is the startpoint for the first line P1 = (p1 - p2).\n\t@param B B is the endpoint for the first line P1 = (p1 - p2).\n\t@param C C is the startpoint for the second line P2 = (p3 - p4).\n\t@param D D is the endpoint for the second line P2 = (p3 - p4).\n\t@param retP retP.x is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1)), <br />\n\tretP.y is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3)). \n\t*/\n\texport function pLineIntersect(A : Vec2, B : Vec2, C : Vec2, D : Vec2, retP : Vec2) : boolean;\t\n\t/** !#en ccpSegmentIntersect return YES if Segment A-B intersects with segment C-D.\n\t!#zh 返回线段 A - B 和线段 C - D 是否相交。 \n\t*/\n\texport function pSegmentIntersect(A : Vec2, B : Vec2, C : Vec2, D : Vec2) : boolean;\t\n\t/** !#en ccpIntersectPoint return the intersection point of line A-B, C-D.\n\t!#zh 返回线段 A - B 和线段 C - D 的交点。 \n\t*/\n\texport function pIntersectPoint(A : Vec2, B : Vec2, C : Vec2, D : Vec2) : Vec2;\t\n\t/** !#en check to see if both points are equal.\n\t!#zh 检查指定的 2 个向量是否相等。\n\t@param A A ccp a\n\t@param B B ccp b to be compared \n\t*/\n\texport function pSameAs(A : Vec2, B : Vec2) : boolean;\t\n\t/** !#en sets the position of the point to 0.\n\t!#zh 设置指定向量归 0。 \n\t*/\n\texport function pZeroIn(v : Vec2) : void;\t\n\t/** !#en copies the position of one point to another.\n\t!#zh 令 v1 向量等同于 v2。 \n\t*/\n\texport function pIn(v1 : Vec2, v2 : Vec2) : void;\t\n\t/** !#en multiplies the point with the given factor (inplace).\n\t!#zh 向量缩放，结果保存到第一个向量。 \n\t*/\n\texport function pMultIn(point : Vec2, floatVar : number) : void;\t\n\t/** !#en subtracts one point from another (inplace).\n\t!#zh 向量减法，结果保存到第一个向量。 \n\t*/\n\texport function pSubIn(v1 : Vec2, v2 : Vec2) : void;\t\n\t/** !#en adds one point to another (inplace).\n\t!#zh 向量加法，结果保存到第一个向量。 \n\t*/\n\texport function pAddIn(v1 : Vec2, v2 : Vec2) : void;\t\n\t/** !#en normalizes the point (inplace).\n\t!#zh 规范化 v 向量，设置 v 向量长度为 1。 \n\t*/\n\texport function pNormalizeIn(v : Vec2) : void;\t\n\t/** !#en\n\tThe convenience method to create a new Rect.\n\tsee {{#crossLink \"Rect/Rect:method\"}}cc.Rect{{/crossLink}}\n\t!#zh\n\t该方法用来快速创建一个新的矩形。{{#crossLink \"Rect/Rect:method\"}}cc.Rect{{/crossLink}}\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0 , 0, 10, 0);\n\t``` \n\t*/\n\texport function rect(x? : Number[]|number, y? : number, w? : number, h? : number) : Rect;\t\n\t/** !#en Check whether a rect's value equals to another.\n\t!#zh 判断两个矩形是否相等。\n\t@param rect1 !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rect2 !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 0, 10, 10);\n\tvar b = new cc.rect(0, 0, 5, 5);\n\tcc.rectEqualToRect(a, b); // false;\n\tvar c = new cc.rect(0, 0, 5, 5);\n\tcc.rectEqualToRect(b, c); // true;\n\t``` \n\t*/\n\texport function rectEqualToRect(rect1: (x: number, y: number, w: number, h: number) => void, rect2: (x: number, y: number, w: number, h: number) => void) : boolean;\t\n\t/** !#en Check whether the rect1 contains rect2.\n\t!#zh\n\t检查 rect1 矩形是否包含 rect2 矩形。 <br/>\n\t注意：如果要允许 rect1 和 rect2 的边界重合，应该用 cc.rectOverlapsRect\n\t@param rect1 !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rect2 !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 0, 20, 20);\n\tvar b = new cc.rect(10, 10, 20, 20);\n\tcc.rectContainsRect(a, b); // true;\n\t``` \n\t*/\n\texport function rectContainsRect(rect1: (x: number, y: number, w: number, h: number) => void, rect2: (x: number, y: number, w: number, h: number) => void) : boolean;\t\n\t/** !#en Returns the rightmost x-value of a rect.\n\t!#zh 返回矩形在 x 轴上的最大值\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(10, 0, 20, 20);\n\tcc.rectGetMaxX(a); // 30;\n\t``` \n\t*/\n\texport function rectGetMaxX(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Return the midpoint x-value of a rect.\n\t!#zh 返回矩形在 x 轴上的中点。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(10, 0, 20, 20);\n\tcc.rectGetMidX(a); // 20;\n\t``` \n\t*/\n\texport function rectGetMidX(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Returns the leftmost x-value of a rect.\n\t!#zh 返回矩形在 x 轴上的最小值。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(10, 0, 20, 20);\n\tcc.rectGetMinX(a); // 10;\n\t``` \n\t*/\n\texport function rectGetMinX(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Return the topmost y-value of a rect.\n\t!#zh 返回矩形在 y 轴上的最大值。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tcc.rectGetMaxY(a); // 30;\n\t``` \n\t*/\n\texport function rectGetMaxY(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Return the midpoint y-value of `rect'.\n\t!#zh 返回矩形在 y 轴上的中点。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tcc.rectGetMidY(a); // 20;\n\t``` \n\t*/\n\texport function rectGetMidY(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Return the bottommost y-value of a rect.\n\t!#zh 返回矩形在 y 轴上的最小值。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tcc.rectGetMinY(a); // 10;\n\t``` \n\t*/\n\texport function rectGetMinY(rect: (x: number, y: number, w: number, h: number) => void) : number;\t\n\t/** !#en Check whether a rect contains a point.\n\t!#zh 检查一个矩形是否包含某个坐标点。\n\t@param rect !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tvar b = cc.v2(0, 10, 10, 10);\n\tcc.rectContainsPoint(a, b); // true;\n\t``` \n\t*/\n\texport function rectContainsPoint(rect: (x: number, y: number, w: number, h: number) => void, point : Vec2) : boolean;\t\n\t/** !#en Check whether a rect intersect with another.\n\t!#zh 检查一个矩形是否与另一个相交。\n\t@param rectA !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rectB !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tvar b = new cc.rect(0, 10, 10, 10);\n\tcc.rectIntersectsRect(a, b); // true;\n\t``` \n\t*/\n\texport function rectIntersectsRect(rectA: (x: number, y: number, w: number, h: number) => void, rectB: (x: number, y: number, w: number, h: number) => void) : boolean;\t\n\t/** !#en Check whether a rect overlaps another.\n\t!#zh 检查一个矩形是否重叠另一个。\n\t@param rectA !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rectB !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tvar b = new cc.rect(0, 10, 10, 10);\n\tcc.rectOverlapsRect(a, b); // true;\n\t``` \n\t*/\n\texport function rectOverlapsRect(rectA: (x: number, y: number, w: number, h: number) => void, rectB: (x: number, y: number, w: number, h: number) => void) : boolean;\t\n\t/** !#en Returns the smallest rectangle that contains the two source rectangles.\n\t!#zh 返回一个包含两个指定矩形的最小矩形。\n\t@param rectA !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rectB !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tvar b = new cc.rect(0, 10, 10, 10);\n\tcc.rectUnion(a, b); // Rect {x: 0, y: 10, width: 20, height: 20};\n\t``` \n\t*/\n\texport function rectUnion(rectA: (x: number, y: number, w: number, h: number) => void, rectB: (x: number, y: number, w: number, h: number) => void) : Rect;\t\n\t/** !#en Returns the overlapping portion of 2 rectangles.\n\t!#zh 返回 2 个矩形重叠的部分。\n\t@param rectA !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t@param rectB !#en\n\tConstructor of cc.Rect class.\n\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t!#zh\n\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\n\t@example \n\t```js\n\tvar a = new cc.rect(0, 10, 20, 20);\n\tvar b = new cc.rect(0, 10, 10, 10);\n\tcc.rectIntersection(a, b); // Rect {x: 0, y: 10, width: 10, height: 10};\n\t``` \n\t*/\n\texport function rectIntersection(rectA: (x: number, y: number, w: number, h: number) => void, rectB: (x: number, y: number, w: number, h: number) => void) : Rect;\t\n\texport function V3F_C4B_T2F_QuadZero() : V3F_C4B_T2F_Quad;\t\n\t/**  \n\t*/\n\texport function V3F_C4B_T2F_QuadCopy(sourceQuad: (tl: V3F_C4B_T2F, bl: V3F_C4B_T2F, tr: V3F_C4B_T2F, br: V3F_C4B_T2F, arrayBuffer: any[], offset: number) => void) : V3F_C4B_T2F_Quad;\t\n\t/**  \n\t*/\n\texport function V3F_C4B_T2F_QuadsCopy(sourceQuads : any[]) : any[];\t\n\t/** !#en The convenience method to create a new {{#crossLink \"Vec2\"}}cc.Vec2{{/crossLink}}.\n\t!#zh 通过该简便的函数进行创建 {{#crossLink \"Vec2\"}}cc.Vec2{{/crossLink}} 对象。\n\t\n\t@example \n\t```js\n\tvar v1 = cc.v2();\n\tvar v2 = cc.v2(0, 0);\n\tvar v3 = cc.v2(v2);\n\tvar v4 = cc.v2({x: 100, y: 100});\n\t``` \n\t*/\n\texport function v2(x? : number|any, y? : number) : Vec2;\t\n\t/** !#en The convenience method to creates a new {{#crossLink \"Vec2\"}}cc.Vec2{{/crossLink}}.\n\t!#zh 通过该简便的函数进行创建 {{#crossLink \"Vec2\"}}cc.Vec2{{/crossLink}} 对象。\n\t@param x a Number or a size object\n\t\n\t@example \n\t```js\n\tvar point1 = cc.p();\n\tvar point2 = cc.p(100, 100);\n\tvar point3 = cc.p(point2);\n\tvar point4 = cc.p({x: 100, y: 100});\n\t``` \n\t*/\n\texport function p(x? : number|any, y? : number) : Vec2;\t\n\t/** !#en Check whether a point's value equals to another.\n\t!#zh 判断两个向量是否相等。\n\t@param point1 !#en\n\tConstructor\n\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t!#zh\n\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t@param point2 !#en\n\tConstructor\n\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t!#zh\n\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}} \n\t*/\n\texport function pointEqualToPoint(point1: (x: number, y: number) => void, point2: (x: number, y: number) => void) : boolean;\t\n\t/** !#en Enum for debug modes.\n\t!#zh 调试模式 */\n\texport enum DebugMode {\t\t\n\t\tNONE. = 0,\n\t\tINFO = 0,\n\t\tWARN = 0,\n\t\tERROR = 0,\n\t\tINFO_FOR_WEB_PAGE = 0,\n\t\tWARN_FOR_WEB_PAGE = 0,\n\t\tERROR_FOR_WEB_PAGE = 0,\t\n\t}\t\t\n\t\t/** !#en cc.audioEngine is the singleton object, it provide simple audio APIs.\n\t\t!#zn\n\t\tcc.audioengine是单例对象。<br/>\n\t\t主要用来播放背景音乐和音效，背景音乐同一时间只能播放一个，而音效则可以同时播放多个。<br/>\n\t\t注意：<br/>\n\t\t在 Android 系统浏览器上，不同浏览器，不同版本的效果不尽相同。<br/>\n\t\t比如说：大多数浏览器都需要用户物理交互才可以开始播放音效，有一些不支持 WebAudio，<br/>\n\t\t有一些不支持多音轨播放。总之如果对音乐依赖比较强，请做尽可能多的测试。 */\n\t\texport class audioEngine {\t\t\n\t\t/** !#en Play music.\n\t\t!#zh\n\t\t播放指定音乐，并可以设置是否循环播放。<br/>\n\t\t注意：音乐播放接口不支持多音轨，同一时间只能播放一个音乐。\n\t\t@param url The path of the music file without filename extension.\n\t\t@param loop Whether the music loop or not.\n\t\t@param immediate Whether immediately play music.\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.playMusic(path, false);\n\t\t``` \n\t\t*/\n\t\tplayMusic(url : string, loop : boolean, immediate : boolean) : void;\t\t\n\t\t/** !#en Stop playing music.\n\t\t!#zh 停止当前音乐。\n\t\t@param releaseData If release the music data or not.As default value is false.\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.stopMusic();\n\t\t``` \n\t\t*/\n\t\tstopMusic(releaseData? : boolean) : void;\t\t\n\t\t/** !#en Pause playing music.\n\t\t!#zh 暂停正在播放音乐。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.pauseMusic();\n\t\t``` \n\t\t*/\n\t\tpauseMusic() : void;\t\t\n\t\t/** !#en Resume playing music.\n\t\t!#zh 恢复音乐播放。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.resumeMusic();\n\t\t``` \n\t\t*/\n\t\tresumeMusic() : void;\t\t\n\t\t/** !#en Rewind playing music.\n\t\t!#zh 从头开始重新播放当前音乐。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.rewindMusic();\n\t\t``` \n\t\t*/\n\t\trewindMusic() : void;\t\t\n\t\t/** !#en The volume of the music max value is 1.0,the min value is 0.0 .\n\t\t!#zh 获取音量（0.0 ~ 1.0）。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tvar volume = cc.audioEngine.getMusicVolume();\n\t\t``` \n\t\t*/\n\t\tgetMusicVolume() : number;\t\t\n\t\t/** !#en Set the volume of music.\n\t\t!#zh 设置音量（0.0 ~ 1.0）。\n\t\t@param volume Volume must be in 0.0~1.0 .\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.setMusicVolume(0.5);\n\t\t``` \n\t\t*/\n\t\tsetMusicVolume(volume : number) : void;\t\t\n\t\t/** !#en Whether the music is playing.\n\t\t!#zh 音乐是否正在播放。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\t if (cc.audioEngine.isMusicPlaying()) {\n\t\t     cc.log(\"music is playing\");\n\t\t }\n\t\t else {\n\t\t     cc.log(\"music is not playing\");\n\t\t }\n\t\t``` \n\t\t*/\n\t\tisMusicPlaying() : boolean;\t\t\n\t\t/** !#en Play sound effect.\n\t\t!#zh\n\t\t播放指定音效，并可以设置是否循环播放。<br/>\n\t\t注意：在部分不支持多音轨的浏览器上，这个接口会失效，请使用 playMusic\n\t\t@param url The path of the sound effect with filename extension.\n\t\t@param loop Whether to loop the effect playing, default value is false\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tvar soundId = cc.audioEngine.playEffect(path);\n\t\t``` \n\t\t*/\n\t\tplayEffect(url : string, loop : boolean, volume : boolean) : number;\t\t\n\t\t/** !#en Set the volume of sound effects.\n\t\t!#zh 设置音效音量（0.0 ~ 1.0）。\n\t\t@param volume Volume must be in 0.0~1.0 .\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.setEffectsVolume(0.5);\n\t\t``` \n\t\t*/\n\t\tsetEffectsVolume(volume : number) : void;\t\t\n\t\t/** !#en The volume of the effects max value is 1.0,the min value is 0.0 .\n\t\t!#zh 获取音效音量（0.0 ~ 1.0）。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tvar effectVolume = cc.audioEngine.getEffectsVolume();\n\t\t``` \n\t\t*/\n\t\tgetEffectsVolume() : number;\t\t\n\t\t/** !#en Pause playing sound effect.\n\t\t!#zh 暂停指定的音效。\n\t\t@param audio The return value of function playEffect.\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.pauseEffect(audioID);\n\t\t``` \n\t\t*/\n\t\tpauseEffect(audio : number) : void;\t\t\n\t\t/** !#en Pause all playing sound effect.\n\t\t!#zh 暂停现在正在播放的所有音效。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.pauseAllEffects();\n\t\t``` \n\t\t*/\n\t\tpauseAllEffects() : void;\t\t\n\t\t/** !#en Resume playing sound effect.\n\t\t!#zh 恢复播放指定的音效。\n\t\t@param audioID The return value of function playEffect. \n\t\t*/\n\t\tresumeEffect(audioID : number) : void;\t\t\n\t\t/** !#en Resume all playing sound effect.\n\t\t!#zh 恢复播放所有之前暂停的所有音效。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.resumeAllEffects();\n\t\t``` \n\t\t*/\n\t\tresumeAllEffects() : void;\t\t\n\t\t/** !#en Stop playing sound effect.\n\t\t!#zh 停止播放指定音效。\n\t\t@param audioID The return value of function playEffect.\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.stopEffect(audioID);\n\t\t``` \n\t\t*/\n\t\tstopEffect(audioID : number) : void;\t\t\n\t\t/** !#en Stop all playing sound effects.\n\t\t!#zh 停止正在播放的所有音效。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.stopAllEffects();\n\t\t``` \n\t\t*/\n\t\tstopAllEffects() : void;\t\t\n\t\t/** !#en Unload the preloaded effect from internal buffer.\n\t\t!#zh 卸载预加载的音效。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//example\n\t\tcc.audioEngine.unloadEffect(EFFECT_FILE);\n\t\t``` \n\t\t*/\n\t\tunloadEffect(url : string) : void;\t\t\n\t\t/** !#en End music and effects.\n\t\t!#zh 停止所有音乐和音效的播放。 \n\t\t*/\n\t\tend() : void;\t\n\t}\t\t\n\t\t/** !#en Class for animation data handling.\n\t\t!#zh 动画剪辑，用于存储动画数据。 */\n\t\texport class AnimationClip extends Asset {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en Duration of this animation.\n\t\t!#zh 动画的持续时间。 */\n\t\tduration : number;\t\t\n\t\t/** !#en FrameRate of this animation.\n\t\t!#zh 动画的帧速率。 */\n\t\tsample : number;\t\t\n\t\t/** !#en Speed of this animation.\n\t\t!#zh 动画的播放速度。 */\n\t\tspeed : number;\t\t\n\t\t/** !#en WrapMode of this animation.\n\t\t!#zh 动画的循环模式。 */\n\t\twrapMode : WrapMode;\t\t\n\t\t/** !#en Curve data.\n\t\t!#zh 曲线数据。 */\n\t\tcurveData : any;\t\t\n\t\t/** !#en Event data.\n\t\t!#zh 事件数据。 */\n\t\tevents : any[];\t\t\n\t\t/** !#en Crate clip with a set of sprite frames\n\t\t!#zh 使用一组序列帧图片来创建动画剪辑 */\n\t\tsample : number;\t\n\t}\t\t\n\t\t/** !#en\n\t\tThe AnimationState gives full control over animation playback process.\n\t\tIn most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.\n\t\t!#zh\n\t\tAnimationState 完全控制动画播放过程。<br/>\n\t\t大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口，请使用 AnimationState。 */\n\t\texport class AnimationState extends AnimationNode {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tAnimationState(clip : AnimationClip, name? : string) : AnimationState;\t\t\n\t\t/** !#en The clip that is being played by this animation state.\n\t\t!#zh 此动画状态正在播放的剪辑。 */\n\t\tclip : AnimationClip;\t\t\n\t\t/** !#en The name of the playing animation.\n\t\t!#zh 动画的名字 */\n\t\tname : string;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Playable {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en Is playing or paused in play mode?\n\t\t!#zh 当前是否正在播放。 */\n\t\tisPlaying : boolean;\t\t\n\t\t/** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).\n\t\t!#zh 当前是否正在暂停 */\n\t\tisPaused : boolean;\t\t\n\t\t/** !#en Play this animation.\n\t\t!#zh 播放动画。 \n\t\t*/\n\t\tplay() : void;\t\t\n\t\t/** !#en Stop this animation.\n\t\t!#zh 停止动画播放。 \n\t\t*/\n\t\tstop() : void;\t\t\n\t\t/** !#en Pause this animation.\n\t\t!#zh 暂停动画。 \n\t\t*/\n\t\tpause() : void;\t\t\n\t\t/** !#en Resume this animation.\n\t\t!#zh 重新播放动画。 \n\t\t*/\n\t\tresume() : void;\t\t\n\t\t/** !#en Perform a single frame step.\n\t\t!#zh 执行一帧动画。 \n\t\t*/\n\t\tstep() : void;\t\n\t}\t\n\t/** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.\n\t!#zh 动画使用的循环模式。 */\n\texport enum WrapMode {\t\t\n\t\tDefault = 0,\n\t\tNormal = 0,\n\t\tReverse = 0,\n\t\tLoop = 0,\n\t\tLoopReverse = 0,\n\t\tPingPong = 0,\n\t\tPingPongReverse = 0,\t\n\t}\t\t\n\t\t/** !#en The abstract interface for all playing animation.\n\t\t!#zh 所有播放动画的抽象接口。 */\n\t\texport class AnimationNodeBase extends Playable {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en The curves list.\n\t\t!#zh 曲线列表。 */\n\t\tcurves : AnimCurve[];\t\t\n\t\t/** !#en The start delay which represents the number of seconds from an animation's start time to the start of\n\t\tthe active interval.\n\t\t!#zh 延迟多少秒播放。 */\n\t\tdelay : number;\t\t\n\t\t/** !#en The animation's iteration count property.\n\t\t\n\t\tA real number greater than or equal to zero (including positive infinity) representing the number of times\n\t\tto repeat the animation node.\n\t\t\n\t\tValues less than zero and NaN values are treated as the value 1.0 for the purpose of timing model\n\t\tcalculations.\n\t\t\n\t\t!#zh 迭代次数，指动画播放多少次后结束, normalize time。 如 2.5（2次半） */\n\t\trepeatCount : number;\t\t\n\t\t/** !#en The iteration duration of this animation in seconds. (length)\n\t\t!#zh 单次动画的持续时间，秒。 */\n\t\tduration : number;\t\t\n\t\t/** !#en The animation's playback speed. 1 is normal playback speed.\n\t\t!#zh 播放速率。 */\n\t\tspeed : number;\t\t\n\t\t/** !#en Wrapping mode of the playing animation.\n\t\t!#zh 动画循环方式。 */\n\t\twrapMode : WrapMode;\t\t\n\t\t/** !#en The current time of this animation in seconds.\n\t\t!#zh 动画当前的时间，秒。 */\n\t\ttime : number;\t\n\t}\t\t\n\t\t/** !#en Base class cc.Action for action classes.\n\t\t!#zh Action 类是所有动作类型的基类。 */\n\t\texport class Action {\t\t\n\t\t/** !#en\n\t\tto copy object with deep copy.\n\t\treturns a clone of action.\n\t\t!#zh 返回一个克隆的动作。 \n\t\t*/\n\t\tclone() : Action;\t\t\n\t\t/** !#en\n\t\treturn true if the action has finished.\n\t\t!#zh 如果动作已完成就返回 true。 \n\t\t*/\n\t\tisDone() : boolean;\t\t\n\t\t/** !#en get the target.\n\t\t!#zh 获取当前目标节点。 \n\t\t*/\n\t\tgetTarget() : Node;\t\t\n\t\t/** !#en The action will modify the target properties.\n\t\t!#zh 设置目标节点。 \n\t\t*/\n\t\tsetTarget(target : Node) : void;\t\t\n\t\t/** !#en get the original target.\n\t\t!#zh 获取原始目标节点。 \n\t\t*/\n\t\tgetOriginalTarget() : Node;\t\t\n\t\t/** !#en get tag number.\n\t\t!#zh 获取用于识别动作的标签。 \n\t\t*/\n\t\tgetTag() : number;\t\t\n\t\t/** !#en set tag number.\n\t\t!#zh 设置标签，用于识别动作。 \n\t\t*/\n\t\tsetTag(tag : number) : void;\t\t\n\t\t/** !#en Default Action tag.\n\t\t!#zh 默认动作标签。 */\n\t\tTAG_INVALID : number;\t\n\t}\t\t\n\t\t/** !#en\n\t\tBase class actions that do have a finite time duration. <br/>\n\t\tPossible actions: <br/>\n\t\t- An action with a duration of 0 seconds. <br/>\n\t\t- An action with a duration of 35.5 seconds.\n\t\t\n\t\tInfinite time actions are valid\n\t\t!#zh 有限时间动作，这种动作拥有时长 duration 属性。 */\n\t\texport class FiniteTimeAction extends Action {\t\t\n\t\t/** !#en get duration of the action. (seconds).\n\t\t!#zh 获取动作以秒为单位的持续时间。 \n\t\t*/\n\t\tgetDuration() : number;\t\t\n\t\t/** !#en set duration of the action. (seconds).\n\t\t!#zh 设置动作以秒为单位的持续时间。 \n\t\t*/\n\t\tsetDuration(duration : number) : void;\t\t\n\t\t/** !#en\n\t\tReturns a reversed action. <br />\n\t\tFor example: <br />\n\t\t- The action will be x coordinates of 0 move to 100. <br />\n\t\t- The reversed action will be x of 100 move to 0.\n\t\t- Will be rewritten\n\t\t!#zh 返回一个新的动作，执行与原动作完全相反的动作。 \n\t\t*/\n\t\treverse() : void;\t\t\n\t\t/** !#en\n\t\tto copy object with deep copy.\n\t\treturns a clone of action.\n\t\t!#zh 返回一个克隆的动作。 \n\t\t*/\n\t\tclone() : FiniteTimeAction;\t\n\t}\t\t\n\t\t/** !#en Base class for Easing actions.\n\t\t!#zh 所有缓动动作基类，用于修饰 ActionInterval。 */\n\t\texport class ActionEase extends ActionInterval {\t\n\t}\t\t\n\t\t/** !#en Base class for Easing actions with rate parameters\n\t\t!#zh 拥有速率属性的缓动动作基类。 */\n\t\texport class EaseRateAction extends ActionEase {\t\n\t}\t\t\n\t\t/** !#en Ease Elastic abstract class.\n\t\t!#zh 弹性缓动动作基类。 */\n\t\texport class EaseElastic extends ActionEase {\t\n\t}\t\t\n\t\t/** !#en cc.EaseBounce abstract class.\n\t\t!#zh 反弹缓动动作基类。 */\n\t\texport class EaseBounce extends ActionEase {\t\n\t}\t\t\n\t\t/** !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions.\n\t\t!#zh 即时动作，这种动作立即就会执行，继承自 FiniteTimeAction。 */\n\t\texport class ActionInstant extends FiniteTimeAction {\t\n\t}\t\t\n\t\t/** !#en\n\t\t<p> An interval action is an action that takes place within a certain period of time. <br/>\n\t\tIt has an start time, and a finish time. The finish time is the parameter<br/>\n\t\tduration plus the start time.</p>\n\t\t\n\t\t<p>These CCActionInterval actions have some interesting properties, like:<br/>\n\t\t- They can run normally (default)  <br/>\n\t\t- They can run reversed with the reverse method   <br/>\n\t\t- They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>\n\t\t\n\t\t<p>For example, you can simulate a Ping Pong effect running the action normally and<br/>\n\t\tthen running it again in Reverse mode. </p>\n\t\t!#zh 时间间隔动作，这种动作在已定时间内完成，继承 FiniteTimeAction。 */\n\t\texport class ActionInterval extends FiniteTimeAction {\t\t\n\t\t/** !#en Implementation of ease motion.\n\t\t!#zh 缓动运动。\n\t\t\n\t\t@example \n\t\t\n\t\taction.easeing(cc.easeIn(3.0));,```js\n\t\taction.easeing(cc.easeIn(3.0));\n\t\t``` \n\t\t*/\n\t\teasing(easeObj : any) : ActionInterval;\t\t\n\t\t/** !#en\n\t\tRepeats an action a number of times.\n\t\tTo repeat an action forever use the CCRepeatForever action.\n\t\t!#zh 重复动作可以按一定次数重复一个动作，使用 RepeatForever 动作来永远重复一个动作。 \n\t\t*/\n\t\trepeat(times : void) : ActionInterval;\t\t\n\t\t/** !#en\n\t\tRepeats an action for ever.  <br/>\n\t\tTo repeat the an action for a limited number of times use the Repeat action. <br/>\n\t\t!#zh 永远地重复一个动作，有限次数内重复一个动作请使用 Repeat 动作。 \n\t\t*/\n\t\trepeatForever() : ActionInterval;\t\n\t}\t\t\n\t\t/** !#en\n\t\tcc.MotionStreak manages a Ribbon based on it's motion in absolute space.                 <br/>\n\t\tYou construct it with a fadeTime, minimum segment size, texture path, texture            <br/>\n\t\tlength and color. The fadeTime controls how long it takes each vertex in                 <br/>\n\t\tthe streak to fade out, the minimum segment size it how many pixels the                  <br/>\n\t\tstreak will move before adding a new ribbon segment, and the texture                     <br/>\n\t\tlength is the how many pixels the texture is stretched across. The texture               <br/>\n\t\tis vertically aligned along the streak segment.\n\t\t!#zh 运动轨迹，用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */\n\t\texport class MotionStreak extends Component {\t\t\n\t\t/** !#en\n\t\t!#zh 在编辑器模式下预览拖尾效果。 */\n\t\tpreview : boolean;\t\t\n\t\t/** !#en The fade time to fade.\n\t\t!#zh 拖尾的渐隐时间，以秒为单位。 */\n\t\tfadeTime : number;\t\t\n\t\t/** !#en The minimum segment size.\n\t\t!#zh 拖尾之间最小距离。 */\n\t\tminSeg : number;\t\t\n\t\t/** !#en The stroke's width.\n\t\t!#zh 拖尾的宽度。 */\n\t\tstroke : number;\t\t\n\t\t/** !#en The texture of the MotionStreak.\n\t\t!#zh 拖尾的贴图。 */\n\t\ttexture : Texture2D;\t\t\n\t\t/** !#en The color of the MotionStreak.\n\t\t!#zh 拖尾的颜色 */\n\t\tcolor : Color;\t\t\n\t\t/** !#en The fast Mode.\n\t\t!#zh 是否启用了快速模式。当启用快速模式，新的点会被更快地添加，但精度较低。 */\n\t\tfastMode : boolean;\t\t\n\t\t/** !#en Remove all living segments of the ribbon.\n\t\t!#zh 删除当前所有的拖尾片段。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// stop particle system.\n\t\tmyParticleSystem.stopSystem();\n\t\t``` \n\t\t*/\n\t\treset() : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tcc.ActionManager is a class that can manage actions.<br/>\n\t\tNormally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,\n\t\twhich uses this class's singleton object.\n\t\tBut there are some cases where you might need to use this class. <br/>\n\t\tExamples:<br/>\n\t\t- When you want to run an action where the target is different from a CCNode.<br/>\n\t\t- When you want to pause / resume the actions<br/>\n\t\t!#zh\n\t\tcc.ActionManager 是可以管理动作的单例类。<br/>\n\t\t通常你并不需要直接使用这个类，99%的情况您将使用 CCNode 的接口。<br/>\n\t\t但也有一些情况下，您可能需要使用这个类。 <br/>\n\t\t例如：\n\t\t - 当你想要运行一个动作，但目标不是 CCNode 类型时。 <br/>\n\t\t - 当你想要暂停/恢复动作时。 <br/> */\n\t\texport class ActionManager {\t\t\n\t\t/** !#en\n\t\tAdds an action with a target.<br/>\n\t\tIf the target is already present, then the action will be added to the existing target.\n\t\tIf the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.\n\t\tWhen the target is paused, the queued actions won't be 'ticked'.\n\t\t!#zh\n\t\t增加一个动作，同时还需要提供动作的目标对象，目标对象是否暂停作为参数。<br/>\n\t\t如果目标已存在，动作将会被直接添加到现有的节点中。<br/>\n\t\t如果目标不存在，将为这一目标创建一个新的实例，并将动作添加进去。<br/>\n\t\t当目标状态的 paused 为 true，动作将不会被执行 \n\t\t*/\n\t\taddAction(action : Action, target : Node, paused : boolean) : void;\t\t\n\t\t/** !#en Removes all actions from all the targets.\n\t\t!#zh 移除所有对象的所有动作。 \n\t\t*/\n\t\tremoveAllActions() : void;\t\t\n\t\t/** !#en\n\t\tRemoves all actions from a certain target. <br/>\n\t\tAll the actions that belongs to the target will be removed.\n\t\t!#zh\n\t\t移除指定对象上的所有动作。<br/>\n\t\t属于该目标的所有的动作将被删除。 \n\t\t*/\n\t\tremoveAllActionsFromTarget(target : any, forceDelete : boolean) : void;\t\t\n\t\t/** !#en Removes an action given an action reference.\n\t\t!#zh 移除指定的动作。 \n\t\t*/\n\t\tremoveAction(action : Action) : void;\t\t\n\t\t/** !#en Removes an action given its tag and the target.\n\t\t!#zh 删除指定对象下特定标签的一个动作，将删除首个匹配到的动作。 \n\t\t*/\n\t\tremoveActionByTag(tag : number, target : any) : void;\t\t\n\t\t/** !#en Gets an action given its tag an a target.\n\t\t!#zh 通过目标对象和标签获取一个动作。 \n\t\t*/\n\t\tgetActionByTag(tag : number, target : any) : Action;\t\t\n\t\t/** !#en\n\t\tReturns the numbers of actions that are running in a certain target. <br/>\n\t\tComposable actions are counted as 1 action. <br/>\n\t\tExample: <br/>\n\t\t- If you are running 1 Sequence of 7 actions, it will return 1. <br/>\n\t\t- If you are running 7 Sequences of 2 actions, it will return 7.\n\t\t!#zh\n\t\t返回指定对象下所有正在运行的动作数量。 <br/>\n\t\t组合动作被算作一个动作。<br/>\n\t\t例如：<br/>\n\t\t - 如果您正在运行 7 个动作组成的序列动作（Sequence），这个函数将返回 1。<br/>\n\t\t - 如果你正在运行 2 个序列动作（Sequence）和 5 个普通动作，这个函数将返回 7。<br/> \n\t\t*/\n\t\tnumberOfRunningActionsInTarget(target : any) : number;\t\t\n\t\t/** !#en Pauses the target: all running actions and newly added actions will be paused.\n\t\t!#zh 暂停指定对象：所有正在运行的动作和新添加的动作都将会暂停。 \n\t\t*/\n\t\tpauseTarget(target : any) : void;\t\t\n\t\t/** !#en Resumes the target. All queued actions will be resumed.\n\t\t!#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。 \n\t\t*/\n\t\tresumeTarget(target : any) : void;\t\t\n\t\t/** !#en Pauses all running actions, returning a list of targets whose actions were paused.\n\t\t!#zh 暂停所有正在运行的动作，返回一个包含了那些动作被暂停了的目标对象的列表。 \n\t\t*/\n\t\tpauseAllRunningActions() : any[];\t\t\n\t\t/** !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).\n\t\t!#zh 让一组指定对象恢复运行（用来逆转 pauseAllRunningActions 效果的便捷函数）。 \n\t\t*/\n\t\tresumeTargets(targetsToResume : any[]) : void;\t\t\n\t\t/** !#en Pause a set of targets.\n\t\t!#zh 暂停一组指定对象。 \n\t\t*/\n\t\tpauseTargets(targetsToPause : any[]) : void;\t\t\n\t\t/** !#en\n\t\tpurges the shared action manager. It releases the retained instance. <br/>\n\t\tbecause it uses this, so it can not be static.\n\t\t!#zh\n\t\t清除共用的动作管理器。它释放了持有的实例。 <br/>\n\t\t因为它使用 this，因此它不能是静态的。 \n\t\t*/\n\t\tpurgeSharedManager() : void;\t\t\n\t\t/** !#en The ActionManager update。\n\t\t!#zh ActionManager 主循环。\n\t\t@param dt delta time in seconds \n\t\t*/\n\t\tupdate(dt : number) : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\t<p>\n\t\t   ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>\n\t\t   cc.director is a singleton object which manage your game's logic flow.<br/>\n\t\t   Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>\n\t\t   the standard way to use it is by calling:<br/>\n\t\t     - cc.director.methodName(); <br/>\n\t\t\n\t\t   It creates and handle the main Window and manages how and when to execute the Scenes.<br/>\n\t\t   <br/>\n\t\t   The cc.director is also responsible for:<br/>\n\t\t     - initializing the OpenGL context<br/>\n\t\t     - setting the OpenGL pixel format (default on is RGB565)<br/>\n\t\t     - setting the OpenGL buffer depth (default on is 0-bit)<br/>\n\t\t     - setting the color for clear screen (default one is BLACK)<br/>\n\t\t     - setting the projection (default one is 3D)<br/>\n\t\t     - setting the orientation (default one is Portrait)<br/>\n\t\t     <br/>\n\t\t   <br/>\n\t\t   The cc.director also sets the default OpenGL context:<br/>\n\t\t     - GL_TEXTURE_2D is enabled<br/>\n\t\t     - GL_VERTEX_ARRAY is enabled<br/>\n\t\t     - GL_COLOR_ARRAY is enabled<br/>\n\t\t     - GL_TEXTURE_COORD_ARRAY is enabled<br/>\n\t\t</p>\n\t\t<p>\n\t\t  cc.director also synchronizes timers with the refresh rate of the display.<br/>\n\t\t  Features and Limitations:<br/>\n\t\t     - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>\n\t\t     - Only supports animation intervals of 1/60 1/30 & 1/15<br/>\n\t\t</p>\n\t\t\n\t\t!#zh\n\t\t<p>\n\t\t    注意：用 cc.director 代替 cc.Director。<br/>\n\t\t    cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>\n\t\t    由于 cc.director 是一个单例，你不需要调用任何构造函数或创建函数，<br/>\n\t\t    使用它的标准方法是通过调用：<br/>\n\t\t      - cc.director.methodName();\n\t\t    <br/>\n\t\t    它创建和处理主窗口并且管理什么时候执行场景。<br/>\n\t\t    <br/>\n\t\t    cc.director 还负责：<br/>\n\t\t     - 初始化 OpenGL 环境。<br/>\n\t\t     - 设置OpenGL像素格式。(默认是 RGB565)<br/>\n\t\t     - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>\n\t\t     - 设置空白场景的颜色 (默认是 黑色)<br/>\n\t\t     - 设置投影 (默认是 3D)<br/>\n\t\t     - 设置方向 (默认是 Portrait)<br/>\n\t\t   <br/>\n\t\t   cc.director 设置了 OpenGL 默认环境 <br/>\n\t\t     - GL_TEXTURE_2D   启用。<br/>\n\t\t     - GL_VERTEX_ARRAY 启用。<br/>\n\t\t     - GL_COLOR_ARRAY  启用。<br/>\n\t\t     - GL_TEXTURE_COORD_ARRAY 启用。<br/>\n\t\t</p>\n\t\t<p>\n\t\t  cc.director 也同步定时器与显示器的刷新速率。\n\t\t  <br/>\n\t\t  特点和局限性: <br/>\n\t\t     - 将计时器 & 渲染与显示器的刷新频率同步。<br/>\n\t\t     - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>\n\t\t</p> */\n\t\texport class Director {\t\t\n\t\t/** !#en\n\t\tConverts an OpenGL coordinate to a view coordinate<br/>\n\t\tUseful to convert node points to window points for calls such as glScissor<br/>\n\t\tImplementation can be found in CCDirectorWebGL.\n\t\t!#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。 \n\t\t*/\n\t\tconvertToUI(glPoint : Vec2) : Vec2;\t\t\n\t\t/** !#en\n\t\tReturns the size of the WebGL view in points.<br/>\n\t\tIt takes into account any possible rotation (device orientation) of the window.\n\t\t!#zh 获取视图的大小，以点为单位。 \n\t\t*/\n\t\tgetWinSize() : Size;\t\t\n\t\t/** !#en\n\t\tReturns the size of the OpenGL view in pixels.<br/>\n\t\tIt takes into account any possible rotation (device orientation) of the window.<br/>\n\t\tOn Mac winSize and winSizeInPixels return the same value.\n\t\t!#zh 获取视图大小，以像素为单位。 \n\t\t*/\n\t\tgetWinSizeInPixels() : Size;\t\t\n\t\t/** !#en Returns the visible size of the running scene.\n\t\t!#zh 获取运行场景的可见大小。 \n\t\t*/\n\t\tgetVisibleSize() : Size;\t\t\n\t\t/** !#en Returns the visible origin of the running scene.\n\t\t!#zh 获取视图在游戏内容中的坐标原点。 \n\t\t*/\n\t\tgetVisibleOrigin() : Vec2;\t\t\n\t\t/** !#en Pause the director's ticker.\n\t\t!#zh 暂停正在运行的场景，该暂停只会停止 Scheduler，但是不会停止渲染和 UI 响应。 \n\t\t*/\n\t\tpause() : void;\t\t\n\t\t/** !#en\n\t\tRun a scene. Replaces the running scene with a new one or enter the first scene.<br/>\n\t\tThe new scene will be launched immediately.\n\t\t!#zh 立刻切换指定场景。\n\t\t@param scene The need run scene.\n\t\t@param onBeforeLoadScene The function invoked at the scene before loading.\n\t\t@param onLaunched The function invoked at the scene after launch. \n\t\t*/\n\t\trunSceneImmediate(scene : Scene, onBeforeLoadScene? : Function, onLaunched? : Function) : void;\t\t\n\t\t/** !#en\n\t\tRun a scene. Replaces the running scene with a new one or enter the first scene.\n\t\tThe new scene will be launched at the end of the current frame.\n\t\t!#zh 运行指定场景。\n\t\t@param scene The need run scene.\n\t\t@param onBeforeLoadScene The function invoked at the scene before loading.\n\t\t@param onLaunched The function invoked at the scene after launch. \n\t\t*/\n\t\trunScene(scene : Scene, onBeforeLoadScene? : Function, onLaunched? : Function) : void;\t\t\n\t\t/** !#en Loads the scene by its name.\n\t\t!#zh 通过场景名称进行加载场景。\n\t\t@param sceneName The name of the scene to load.\n\t\t@param onLaunched callback, will be called after scene launched. \n\t\t*/\n\t\tloadScene(sceneName : string, onLaunched? : Function) : boolean;\t\t\n\t\t/** !#en\n\t\tPreloads the scene to reduces loading time. You can call this method at any time you want.\n\t\tAfter calling this method, you still need to launch the scene by `cc.director.loadScene`.\n\t\tIt will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not\n\t\tyet finished, the scene will be launched after loaded automatically.\n\t\t!#zh 预加载场景，你可以在任何时候调用这个方法。\n\t\t调用完后，你仍然需要通过 `cc.director.loadScene` 来启动场景，因为这个方法不会执行场景加载操作。\n\t\t就算预加载还没完成，你也可以直接调用 `cc.director.loadScene`，加载完成后场景就会启动。\n\t\t@param sceneName The name of the scene to preload.\n\t\t@param onLoaded callback, will be called after scene loaded. \n\t\t*/\n\t\tpreloadScene(sceneName : string, onLoaded: (error: Error) => void) : void;\t\t\n\t\t/** !#en Resume director after pause, if the current scene is not paused, nothing will happen.\n\t\t!#zh 恢复暂停场景，恢复 Scheduler，如果当前场景没有暂停将没任何事情发生。 \n\t\t*/\n\t\tresume() : void;\t\t\n\t\t/** !#en\n\t\tEnables or disables WebGL depth test.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js\n\t\t!#zh 启用/禁用深度测试（在 Canvas 渲染模式下不会生效）。 \n\t\t*/\n\t\tsetDepthTest(on : boolean) : void;\t\t\n\t\t/** !#en\n\t\tset color for clear screen.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js\n\t\t!#zh 设置场景的默认擦除颜色（支持白色全透明，但不支持透明度为中间值）。 \n\t\t*/\n\t\tsetClearColor(clearColor : Color) : void;\t\t\n\t\t/** !#en\n\t\tSets an OpenGL projection.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js.\n\t\t!#zh 设置 OpenGL 投影。 \n\t\t*/\n\t\tsetProjection(projection : number) : void;\t\t\n\t\t/** !#en\n\t\tUpdate the view port.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js.\n\t\t!#zh 设置视窗（请不要主动调用这个接口，除非你知道你在做什么）。 \n\t\t*/\n\t\tsetViewport() : void;\t\t\n\t\t/** !#en\n\t\tSets an OpenGL projection.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js.\n\t\t!#zh 获取 OpenGL 投影。 \n\t\t*/\n\t\tgetProjection() : number;\t\t\n\t\t/** !#en\n\t\tEnables/disables OpenGL alpha blending.<br/>\n\t\tImplementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js.\n\t\t!#zh 启用/禁用 透明度融合。 \n\t\t*/\n\t\tsetAlphaBlending(on : boolean) : void;\t\t\n\t\t/** !#en\n\t\tReturns whether or not the replaced scene will receive the cleanup message.<br/>\n\t\tIf the new scene is pushed, then the old scene won't receive the \"cleanup\" message.<br/>\n\t\tIf the new scene replaces the old one, the it will receive the \"cleanup\" message.\n\t\t!#zh\n\t\t更换场景时是否接收清理消息。<br>\n\t\t如果新场景是采用 push 方式进入的，那么旧的场景将不会接收到 “cleanup” 消息。<br/>\n\t\t如果新场景取代旧的场景，它将会接收到 “cleanup” 消息。</br> \n\t\t*/\n\t\tisSendCleanupToScene() : boolean;\t\t\n\t\t/** !#en Returns current logic Scene.\n\t\t!#zh 获取当前逻辑场景。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// This will help you to get the Canvas node in scene\n\t\t cc.director.getScene().getChildByName('Canvas');\n\t\t``` \n\t\t*/\n\t\tgetScene() : Scene;\t\t\n\t\t/** !#en Returns the FPS value.\n\t\t!#zh 获取单位帧执行时间。 \n\t\t*/\n\t\tgetAnimationInterval() : number;\t\t\n\t\t/** !#en Returns whether or not to display the FPS informations.\n\t\t!#zh 获取是否显示 FPS 信息。 \n\t\t*/\n\t\tisDisplayStats() : boolean;\t\t\n\t\t/** !#en Sets whether display the FPS on the bottom-left corner.\n\t\t!#zh 设置是否在左下角显示 FPS。 \n\t\t*/\n\t\tsetDisplayStats(displayStats : boolean) : void;\t\t\n\t\t/** !#en Returns seconds per frame.\n\t\t!#zh 获取实际记录的上一帧执行时间，可能与单位帧执行时间（AnimationInterval）有出入。 \n\t\t*/\n\t\tgetSecondsPerFrame() : number;\t\t\n\t\t/** !#en Returns whether next delta time equals to zero.\n\t\t!#zh 返回下一个 “delta time” 是否等于零。 \n\t\t*/\n\t\tisNextDeltaTimeZero() : boolean;\t\t\n\t\t/** !#en Returns whether or not the Director is paused.\n\t\t!#zh 是否处于暂停状态。 \n\t\t*/\n\t\tisPaused() : boolean;\t\t\n\t\t/** !#en Returns how many frames were called since the director started.\n\t\t!#zh 获取 director 启动以来游戏运行的总帧数。 \n\t\t*/\n\t\tgetTotalFrames() : number;\t\t\n\t\t/** !#en Returns the cc.Scheduler associated with this director.\n\t\t!#zh 获取和 director 相关联的 cc.Scheduler。 \n\t\t*/\n\t\tgetScheduler() : Scheduler;\t\t\n\t\t/** !#en Sets the cc.Scheduler associated with this director.\n\t\t!#zh 设置和 director 相关联的 cc.Scheduler。 \n\t\t*/\n\t\tsetScheduler(scheduler : Scheduler) : void;\t\t\n\t\t/** !#en Returns the cc.ActionManager associated with this director.\n\t\t!#zh 获取和 director 相关联的 cc.ActionManager（动作管理器）。 \n\t\t*/\n\t\tgetActionManager() : ActionManager;\t\t\n\t\t/** !#en Sets the cc.ActionManager associated with this director.\n\t\t!#zh 设置和 director 相关联的 cc.ActionManager（动作管理器）。 \n\t\t*/\n\t\tsetActionManager(actionManager : ActionManager) : void;\t\t\n\t\t/** Returns the cc.CollisionManager associated with this director. \n\t\t*/\n\t\tgetCollisionManager() : CollisionManager;\t\t\n\t\t/** !#en Returns the delta time since last frame.\n\t\t!#zh 获取上一帧的 “delta time”。 \n\t\t*/\n\t\tgetDeltaTime() : number;\t\n\t}\t\t\n\t\t/** !#en cc.game is the singleton object for game related functions.\n\t\t!#zh cc.game 是 Game 的实例，用来驱动整个游戏。 */\n\t\texport class Game {\t\t\n\t\t/** !#en The outer frame of the game canvas, parent of cc.container.\n\t\t!#zh 游戏画布的外框，cc.container 的父类。 */\n\t\tframe : any;\t\t\n\t\t/** !#en The container of game canvas, equals to cc.container.\n\t\t!#zh 游戏画布的容器。 */\n\t\tcontainer : any;\t\t\n\t\t/** !#en The canvas of the game, equals to cc._canvas.\n\t\t!#zh 游戏的画布。 */\n\t\tcanvas : any;\t\t\n\t\t/** !#en\n\t\tThe current game configuration, including:<br/>\n\t\t1. debugMode<br/>\n\t\t     \"debugMode\" possible values :<br/>\n\t\t     0 - No message will be printed.                                                      <br/>\n\t\t     1 - cc.error, cc.assert, cc.warn, cc.log will print in console.                      <br/>\n\t\t     2 - cc.error, cc.assert, cc.warn will print in console.                              <br/>\n\t\t     3 - cc.error, cc.assert will print in console.                                       <br/>\n\t\t     4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>\n\t\t     5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.        <br/>\n\t\t     6 - cc.error, cc.assert will print on canvas, available only on web.                 <br/>\n\t\t2. showFPS<br/>\n\t\t     Left bottom corner fps information will show when \"showFPS\" equals true, otherwise it will be hide.<br/>\n\t\t3. frameRate<br/>\n\t\t     \"frameRate\" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>\n\t\t4. id<br/>\n\t\t     \"gameCanvas\" sets the id of your canvas element on the web page, it's useful only on web.<br/>\n\t\t5. renderMode<br/>\n\t\t     \"renderMode\" sets the renderer type, only useful on web :<br/>\n\t\t     0 - Automatically chosen by engine<br/>\n\t\t     1 - Forced to use canvas renderer<br/>\n\t\t     2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>\n\t\t6. scenes<br/>\n\t\t     \"scenes\" include available scenes in the current bundle.<br/>\n\t\t<br/>\n\t\tPlease DO NOT modify this object directly, it won't have any effect.<br/>\n\t\t!#zh\n\t\t当前的游戏配置，包括：                                                                  <br/>\n\t\t1. debugMode（debug 模式，但是在浏览器中这个选项会被忽略）                                <br/>\n\t\t     \"debugMode\" 各种设置选项的意义。                                                   <br/>\n\t\t         0 - 没有消息被打印出来。                                                       <br/>\n\t\t         1 - cc.error，cc.assert，cc.warn，cc.log 将打印在 console 中。                  <br/>\n\t\t         2 - cc.error，cc.assert，cc.warn 将打印在 console 中。                          <br/>\n\t\t         3 - cc.error，cc.assert 将打印在 console 中。                                   <br/>\n\t\t         4 - cc.error，cc.assert，cc.warn，cc.log 将打印在 canvas 中（仅适用于 web 端）。 <br/>\n\t\t         5 - cc.error，cc.assert，cc.warn 将打印在 canvas 中（仅适用于 web 端）。         <br/>\n\t\t         6 - cc.error，cc.assert 将打印在 canvas 中（仅适用于 web 端）。                  <br/>\n\t\t2. showFPS（显示 FPS）                                                            <br/>\n\t\t     当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息，否则被隐藏。              <br/>\n\t\t3. frameRate (帧率)                                                              <br/>\n\t\t     “frameRate” 设置想要的帧率你的游戏，但真正的FPS取决于你的游戏实现和运行环境。      <br/>\n\t\t4. id                                                                            <br/>\n\t\t     \"gameCanvas\" Web 页面上的 Canvas Element ID，仅适用于 web 端。                         <br/>\n\t\t5. renderMode（渲染模式）                                                         <br/>\n\t\t     “renderMode” 设置渲染器类型，仅适用于 web 端：                              <br/>\n\t\t         0 - 通过引擎自动选择。                                                     <br/>\n\t\t         1 - 强制使用 canvas 渲染。\n\t\t         2 - 强制使用 WebGL 渲染，但是在部分 Android 浏览器中这个选项会被忽略。     <br/>\n\t\t6. scenes                                                                         <br/>\n\t\t     “scenes” 当前包中可用场景。                                                   <br/>\n\t\t<br/>\n\t\t注意：请不要直接修改这个对象，它不会有任何效果。 */\n\t\tconfig : any;\t\t\n\t\t/** !#en Callback when the scripts of engine have been load.\n\t\t!#zh 当引擎完成启动后的回调函数。 \n\t\t*/\n\t\tonStart() : void;\t\t\n\t\t/** !#en Callback when game exits.\n\t\t!#zh 当游戏结束后的回调函数。 \n\t\t*/\n\t\tonStop() : void;\t\t\n\t\t/** !#en Set frameRate of game.\n\t\t!#zh 设置游戏帧率。 \n\t\t*/\n\t\tsetFrameRate(frameRate : number) : void;\t\t\n\t\t/** !#en Run the game frame by frame.\n\t\t!#zh 执行一帧游戏循环。 \n\t\t*/\n\t\tstep() : void;\t\t\n\t\t/** !#en Pause the game，pause main loop.\n\t\t!#zh 暂停游戏，暂停的是整个主循环。 \n\t\t*/\n\t\tpause() : void;\t\t\n\t\t/** !#en Resume the game from pause.\n\t\t!#zh 继续游戏，继续的是整个主循环。 \n\t\t*/\n\t\tresume() : void;\t\t\n\t\t/** !#en Check whether the game is paused.\n\t\t!#zh 判断游戏是否暂停。 \n\t\t*/\n\t\tisPaused() : boolean;\t\t\n\t\t/** !#en Restart game.\n\t\t!#zh 重新开始游戏 \n\t\t*/\n\t\trestart() : void;\t\t\n\t\t/** !#en Prepare game.\n\t\t!#zh 准备引擎，请不要直接调用这个函数。 \n\t\t*/\n\t\tprepare(cb : Function) : void;\t\t\n\t\t/** !#en Run game with configuration object and onStart function.\n\t\t!#zh 运行游戏，并且指定引擎配置和 onStart 的回调。\n\t\t@param config Pass configuration object or onStart function\n\t\t@param onStart function to be executed after game initialized \n\t\t*/\n\t\trun(config? : any|Function, onStart? : Function) : void;\t\t\n\t\t/** !#en\n\t\tAdd a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>\n\t\tThe target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.\n\t\t!#zh\n\t\t声明常驻根节点，该节点不会被在场景切换中被销毁。<br/>\n\t\t目标节点必须位于为层级的根节点，否则无效。\n\t\t@param node The node to be made persistent \n\t\t*/\n\t\taddPersistRootNode(node : Node) : void;\t\t\n\t\t/** !#en Remove a persistent root node.\n\t\t!#zh 取消常驻根节点。\n\t\t@param node The node to be removed from persistent node list \n\t\t*/\n\t\tremovePersistRootNode(node : Node) : void;\t\t\n\t\t/** !#en Check whether the node is a persistent root node.\n\t\t!#zh 检查节点是否是常驻根节点。\n\t\t@param node The node to be checked \n\t\t*/\n\t\tisPersistRootNode(node : Node) : boolean;\t\n\t}\t\t\n\t\t/** !#en\n\t\tClass of all entities in Cocos Creator scenes.<br/>\n\t\tNode also inherits from {{#crossLink \"EventTarget\"}}Event Target{{/crossLink}}, it permits Node to dispatch events.\n\t\tFor events supported by Node, please refer to {{#crossLink \"Node.EventType\"}}{{/crossLink}}\n\t\t!#zh\n\t\tCocos Creator 场景中的所有节点类。节点也继承了 {{#crossLink \"EventTarget\"}}EventTarget{{/crossLink}}，它允许节点发送事件。<br/>\n\t\t支持的节点事件，请参阅 {{#crossLink \"Node.EventType\"}}{{/crossLink}}。 */\n\t\texport class Node extends _BaseNode {\t\t\n\t\t/** !#en\n\t\tThe local active state of this node.<br/>\n\t\tNote that a Node may be inactive because a parent is not active, even if this returns true.<br/>\n\t\tUse {{#crossLink \"Node/activeInHierarchy:property\"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.\n\t\t!#zh\n\t\t当前节点的自身激活状态。<br/>\n\t\t值得注意的是，一个节点的父节点如果不被激活，那么即使它自身设为激活，它仍然无法激活。<br/>\n\t\t如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink \"Node/activeInHierarchy:property\"}}{{/crossLink}}。 */\n\t\tactive : boolean;\t\t\n\t\t/** !#en Indicates whether this node is active in the scene.\n\t\t!#zh 表示此节点是否在场景中激活。 */\n\t\tactiveInHierarchy : boolean;\t\t\n\t\t/** !#en\n\t\tGroup index of node.<br/>\n\t\tWhich Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>\n\t\t!#zh\n\t\t节点的分组索引。<br/>\n\t\t节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */\n\t\tgroupIndex : Integer;\t\t\n\t\t/** !#en\n\t\tGroup of node.<br/>\n\t\tWhich Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>\n\t\t!#zh\n\t\t节点的分组。<br/>\n\t\t节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */\n\t\tgroup : string;\t\t\n\t\t/** !#en\n\t\tReturns the component of supplied type if the node has one attached, null if it doesn't.<br/>\n\t\tYou can also get component in the node by passing in the name of the script.\n\t\t!#zh\n\t\t获取节点上指定类型的组件，如果节点有附加指定类型的组件，则返回，如果没有则为空。<br/>\n\t\t传入参数也可以是脚本的名称。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// get sprite component.\n\t\tvar sprite = node.getComponent(cc.Sprite);\n\t\t// get custom test calss.\n\t\tvar test = node.getComponent(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponent(typeOrClassName : Function|string) : Component;\t\t\n\t\t/** !#en Returns all components of supplied type in the node.\n\t\t!#zh 返回节点上指定类型的所有组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprites = node.getComponents(cc.Sprite);\n\t\tvar tests = node.getComponents(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponents(typeOrClassName : Function|string) : Component[];\t\t\n\t\t/** !#en Returns the component of supplied type in any of its children using depth first search.\n\t\t!#zh 递归查找所有子节点中第一个匹配指定类型的组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprite = node.getComponentInChildren(cc.Sprite);\n\t\tvar Test = node.getComponentInChildren(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponentInChildren(typeOrClassName : Function|string) : Component;\t\t\n\t\t/** !#en Returns all components of supplied type in any of its children.\n\t\t!#zh 递归查找所有子节点中指定类型的组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprites = node.getComponentsInChildren(cc.Sprite);\n\t\tvar tests = node.getComponentsInChildren(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponentsInChildren(typeOrClassName : Function|string) : Component[];\t\t\n\t\t/** !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.\n\t\t!#zh 向节点添加一个指定类型的组件类，你还可以通过传入脚本的名称来添加组件。\n\t\t@param typeOrClassName The constructor or the class name of the component to add\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprite = node.addComponent(cc.Sprite);\n\t\tvar test = node.addComponent(\"Test\");\n\t\t``` \n\t\t*/\n\t\taddComponent(typeOrClassName : Function|string) : Component;\t\t\n\t\t/** !#en\n\t\tRemoves a component identified by the given name or removes the component object given.\n\t\tYou can also use component.destroy() if you already have the reference.\n\t\t!#zh\n\t\t删除节点上的指定组件，传入参数可以是一个组件构造函数或组件名，也可以是已经获得的组件引用。\n\t\t如果你已经获得组件引用，你也可以直接调用 component.destroy()\n\t\t@param component The need remove component.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.removeComponent(cc.Sprite);\n\t\tvar Test = require(\"Test\");\n\t\tnode.removeComponent(Test);\n\t\t``` \n\t\t*/\n\t\tremoveComponent(component : string|Function|Component) : void;\t\t\n\t\t/** !#en\n\t\tRegister a callback of a specific event type on Node.<br/>\n\t\tUse this method to register touch or mouse event permit propagation based on scene graph,\n\t\tyou can propagate the event to the parents or swallow it by calling stopPropagation on the event.<br/>\n\t\tIt's the recommended way to register touch/mouse event for Node,\n\t\tplease do not use cc.eventManager directly for Node.\n\t\t!#zh\n\t\t在节点上注册指定类型的回调函数，也可以设置 target 用于绑定响应函数的调用者。<br/>\n\t\t同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>\n\t\t推荐使用这种方式来监听节点上的触摸或鼠标事件，请不要在节点上直接使用 cc.eventManager。\n\t\t@param type A string representing the event type to listen for.\n\t\t@param callback The callback that will be invoked when the event is dispatched.\n\t\t                             The callback is ignored if it is a duplicate (the callbacks are unique).\n\t\t@param target The target to invoke the callback, can be null\n\t\t@param useCapture When set to true, the capture argument prevents callback\n\t\t                             from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.\n\t\t                             When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.\n\t\t                             Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// add Node Touch Event\n\t\tnode.on(cc.Node.EventType.TOUCH_START, callback, this.node);\n\t\tnode.on(cc.Node.EventType.TOUCH_MOVE, callback, this.node);\n\t\tnode.on(cc.Node.EventType.TOUCH_END, callback, this.node);\n\t\tnode.on(cc.Node.EventType.TOUCH_CANCEL, callback, this.node);\n\t\t``` \n\t\t*/\n\t\ton(type : string, callback: (param: Event) => void, target? : any, useCapture : boolean) : Function;\t\t\n\t\t/** !#en\n\t\tRemoves the callback previously registered with the same type, callback, target and or useCapture.\n\t\tThis method is merely an alias to removeEventListener.\n\t\t!#zh 删除之前与同类型，回调，目标或 useCapture 注册的回调。\n\t\t@param type A string representing the event type being removed.\n\t\t@param callback The callback to remove.\n\t\t@param target The target to invoke the callback, if it's not given, only callback without target will be removed\n\t\t@param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.\n\t\t                             If not specified, useCapture defaults to false. If a callback was registered twice,\n\t\t                             one with capture and one without, each must be removed separately. Removal of a capturing callback\n\t\t                             does not affect a non-capturing version of the same listener, and vice versa.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// remove Node TOUCH_START Event.\n\t\tnode.on(cc.Node.EventType.TOUCH_START, callback, this.node);\n\t\tnode.off(cc.Node.EventType.TOUCH_START, callback, this.node);\n\t\t``` \n\t\t*/\n\t\toff(type : string, callback : Function, target? : any, useCapture : boolean) : void;\t\t\n\t\t/** !#en Removes all callbacks previously registered with the same target.\n\t\t!#zh 移除目标上的所有注册事件。\n\t\t@param target The target to be searched for all related callbacks\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.targetOff(target);\n\t\t``` \n\t\t*/\n\t\ttargetOff(target : any) : void;\t\t\n\t\t/** !#en\n\t\tExecutes an action, and returns the action that is executed.<br/>\n\t\tThe node becomes the action's target. Refer to cc.Action's getTarget()<br/>\n\t\tCalling runAction while the node is not active won't have any effect.\n\t\t!#zh\n\t\t执行并返回该执行的动作。该节点将会变成动作的目标。<br/>\n\t\t调用 runAction 时，节点自身处于不激活状态将不会有任何效果。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar action = cc.scaleTo(0.2, 1, 0.6);\n\t\tnode.runAction(action);\n\t\t``` \n\t\t*/\n\t\trunAction(action : Action) : Action;\t\t\n\t\t/** !#en Stops and removes all actions from the running action list .\n\t\t!#zh 停止并且移除所有正在运行的动作列表。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.stopAllActions();\n\t\t``` \n\t\t*/\n\t\tstopAllActions() : void;\t\t\n\t\t/** !#en Stops and removes an action from the running action list.\n\t\t!#zh 停止并移除指定的动作。\n\t\t@param action An action object to be removed.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar action = cc.scaleTo(0.2, 1, 0.6);\n\t\tnode.stopAction(action);\n\t\t``` \n\t\t*/\n\t\tstopAction(action : Action) : void;\t\t\n\t\t/** !#en Removes an action from the running action list by its tag.\n\t\t!#zh 停止并且移除指定标签的动作。\n\t\t@param tag A tag that indicates the action to be removed.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.stopAction(1);\n\t\t``` \n\t\t*/\n\t\tstopActionByTag(tag : number) : void;\t\t\n\t\t/** !#en Returns an action from the running action list by its tag.\n\t\t!#zh 通过标签获取指定动作。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar action = node.getActionByTag(1);\n\t\t``` \n\t\t*/\n\t\tgetActionByTag(tag : number) : Action;\t\t\n\t\t/** !#en\n\t\tReturns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>\n\t\t   Composable actions are counted as 1 action. Example:<br/>\n\t\t   If you are running 1 Sequence of 7 actions, it will return 1. <br/>\n\t\t   If you are running 7 Sequences of 2 actions, it will return 7.</p>\n\t\t!#zh\n\t\t获取运行着的动作加上正在调度运行的动作的总数。<br/>\n\t\t例如：<br/>\n\t\t- 如果你正在运行 7 个动作中的 1 个 Sequence，它将返回 1。<br/>\n\t\t- 如果你正在运行 2 个动作中的 7 个 Sequence，它将返回 7。<br/>\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar count = node.getNumberOfRunningActions();\n\t\tcc.log(\"Running Action Count: \" + count);\n\t\t``` \n\t\t*/\n\t\tgetNumberOfRunningActions() : number;\t\n\t}\t\t\n\t\t/** !#en\n\t\tcc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>\n\t\tcc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.\n\t\t!#zh\n\t\tcc.Scene 是 cc.Node 的子类，仅作为一个抽象的概念。<br/>\n\t\tcc.Scene 和 cc.Node 有点不同，用户不应直接修改 cc.Scene。 */\n\t\texport class Scene extends _BaseNode {\t\n\t}\t\t\n\t\t/** !#en\n\t\tScheduler is responsible of triggering the scheduled callbacks.<br/>\n\t\tYou should not use NSTimer. Instead use this class.<br/>\n\t\t<br/>\n\t\tThere are 2 different types of callbacks (selectors):<br/>\n\t\t    - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>\n\t\t    - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>\n\t\t<br/>\n\t\tThe 'custom selectors' should be avoided when possible. It is faster,\n\t\tand consumes less memory to use the 'update callback'. *\n\t\t!#zh\n\t\tScheduler 是负责触发回调函数的类。<br/>\n\t\t通常情况下，建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>\n\t\t有两种不同类型的定时器：<br/>\n\t\t    - update 定时器：每一帧都会触发。您可以自定义优先级。<br/>\n\t\t    - 自定义定时器：自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>\n\t\t如果希望每帧都触发，应该使用 update 定时器，使用 update 定时器更快，而且消耗更少的内存。 */\n\t\texport class Scheduler {\t\t\n\t\t/** !#en\n\t\tModifies the time of all scheduled callbacks.<br/>\n\t\tYou can use this property to create a 'slow motion' or 'fast forward' effect.<br/>\n\t\tDefault is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>\n\t\tTo create a 'fast forward' effect, use values higher than 1.0.<br/>\n\t\tNote：It will affect EVERY scheduled selector / action.\n\t\t!#zh\n\t\t设置时间间隔的缩放比例。<br/>\n\t\t您可以使用这个方法来创建一个 “slow motion（慢动作）” 或 “fast forward（快进）” 的效果。<br/>\n\t\t默认是 1.0。要创建一个 “slow motion（慢动作）” 效果,使用值低于 1.0。<br/>\n\t\t要使用 “fast forward（快进）” 效果，使用值大于 1.0。<br/>\n\t\t注意：它影响该 Scheduler 下管理的所有定时器。 \n\t\t*/\n\t\tsetTimeScale(timeScale : number) : void;\t\t\n\t\t/** !#en Returns time scale of scheduler.\n\t\t!#zh 获取时间间隔的缩放比例。 \n\t\t*/\n\t\tgetTimeScale() : number;\t\t\n\t\t/** !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)\n\t\t!#zh update 调度函数。(不应该直接调用这个方法，除非完全了解这么做的结果)\n\t\t@param dt delta time \n\t\t*/\n\t\tupdate(dt : number) : void;\t\t\n\t\t/** !#en\n\t\t<p>\n\t\t  The scheduled method will be called every 'interval' seconds.</br>\n\t\t  If paused is YES, then it won't be called until it is resumed.<br/>\n\t\t  If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>\n\t\t  If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>\n\t\t  repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>\n\t\t  delay is the amount of time the action will wait before it'll start<br/>\n\t\t</p>\n\t\t!#zh\n\t\t指定回调函数，调用对象等信息来添加一个新的定时器。</br>\n\t\t当时间间隔达到指定值时，设置的回调函数将会被调用。</br>\n\t\t如果 paused 值为 true，那么直到 resume 被调用才开始计时。</br>\n\t\t如果 interval 值为 0，那么回调函数每一帧都会被调用，但如果是这样，\n\t\t建议使用 scheduleUpdateForTarget 代替。</br>\n\t\t如果回调函数已经被定时器使用，那么只会更新之前定时器的时间间隔参数，不会设置新的定时器。<br/>\n\t\trepeat 值可以让定时器触发 repeat + 1 次，使用 cc.macro.REPEAT_FOREVER\n\t\t可以让定时器一直循环触发。<br/>\n\t\tdelay 值指定延迟时间，定时器会在延迟指定的时间之后开始计时。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//register a schedule to scheduler\n\t\tvar scheduler = cc.director.getScheduler();\n\t\tscheduler.scheduleCallbackForTarget(this, function, interval, repeat, delay, !this._isRunning);\n\t\t\n\t\t``` \n\t\t*/\n\t\tscheduleCallbackForTarget(target : any, callback_fn : Function, interval : number, repeat : number, delay : number, paused : boolean) : void;\t\t\n\t\t/** !#en The schedule\n\t\t!#zh 定时器\n\t\t\n\t\t@example \n\t\t```js\n\t\t//register a schedule to scheduler\n\t\tcc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);\n\t\t\n\t\t``` \n\t\t*/\n\t\tschedule(callback : Function, target : any, interval : number, repeat : number, delay : number, paused : boolean) : void;\t\t\n\t\t/** !#en\n\t\tSchedules the update callback for a given target,\n\t\tthe callback will be invoked every frame after schedule started.\n\t\t!#zh\n\t\t使用指定的优先级为指定的对象设置 update 定时器。\n\t\tupdate 定时器每一帧都会被触发。优先级的值越低，定时器被触发的越早。 \n\t\t*/\n\t\tscheduleUpdate(target : any, priority : number, paused : boolean, updateFunc : Function) : void;\t\t\n\t\t/** !#en\n\t\tUnschedules a callback for a callback and a given target.\n\t\tIf you want to unschedule the \"update\", use `unscheduleUpdate()`\n\t\t!#zh\n\t\t根据指定的回调函数和调用对象。\n\t\t如果需要取消 update 定时器，请使用 unscheduleUpdate()。\n\t\t@param callback The callback to be unscheduled\n\t\t@param target The target bound to the callback. \n\t\t*/\n\t\tunschedule(callback : Function, target : any) : void;\t\t\n\t\t/** !#en Unschedules the update callback for a given target.\n\t\t!#zh 取消指定对象的 update 定时器。\n\t\t@param target The target to be unscheduled. \n\t\t*/\n\t\tunscheduleUpdate(target : any) : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all scheduled callbacks for a given target.\n\t\tThis also includes the \"update\" callback.\n\t\t!#zh 取消指定对象的所有定时器，包括 update 定时器。\n\t\t@param target The target to be unscheduled. \n\t\t*/\n\t\tunscheduleAllForTarget(target : any) : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all scheduled callbacks from all targets including the system callbacks.<br/>\n\t\tYou should NEVER call this method, unless you know what you are doing.\n\t\t!#zh\n\t\t取消所有对象的所有定时器，包括系统定时器。<br/>\n\t\t不用调用此函数，除非你确定你在做什么。 \n\t\t*/\n\t\tunscheduleAll() : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all callbacks from all targets with a minimum priority.<br/>\n\t\tYou should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.\n\t\t!#zh\n\t\t取消所有优先级的值大于指定优先级的定时器。<br/>\n\t\t你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。\n\t\t@param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which\n\t\t       priority is higher than minPriority will be unscheduled. \n\t\t*/\n\t\tunscheduleAllWithMinPriority(minPriority : number) : void;\t\t\n\t\t/** !#en Checks whether a callback for a given target is scheduled.\n\t\t!#zh 检查指定的回调函数和回调对象组合是否存在定时器。\n\t\t@param callback The callback to check.\n\t\t@param target The target of the callback. \n\t\t*/\n\t\tisScheduled(callback : Function, target : any) : boolean;\t\t\n\t\t/** !#en\n\t\tPause all selectors from all targets.<br/>\n\t\tYou should NEVER call this method, unless you know what you are doing.\n\t\t!#zh\n\t\t暂停所有对象的所有定时器。<br/>\n\t\t不要调用这个方法，除非你知道你正在做什么。 \n\t\t*/\n\t\tpauseAllTargets() : void;\t\t\n\t\t/** !#en\n\t\tPause all selectors from all targets with a minimum priority. <br/>\n\t\tYou should only call this with kCCPriorityNonSystemMin or higher.\n\t\t!#zh\n\t\t暂停所有优先级的值大于指定优先级的定时器。<br/>\n\t\t你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。 \n\t\t*/\n\t\tpauseAllTargetsWithMinPriority(minPriority : number) : void;\t\t\n\t\t/** !#en\n\t\tResume selectors on a set of targets.<br/>\n\t\tThis can be useful for undoing a call to pauseAllCallbacks.\n\t\t!#zh\n\t\t恢复指定数组中所有对象的定时器。<br/>\n\t\t这个函数是 pauseAllCallbacks 的逆操作。 \n\t\t*/\n\t\tresumeTargets(targetsToResume : any[]) : void;\t\t\n\t\t/** !#en\n\t\tPauses the target.<br/>\n\t\tAll scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>\n\t\tIf the target is not present, nothing happens.\n\t\t!#zh\n\t\t暂停指定对象的定时器。<br/>\n\t\t指定对象的所有定时器都会被暂停。<br/>\n\t\t如果指定的对象没有定时器，什么也不会发生。 \n\t\t*/\n\t\tpauseTarget(target : any) : void;\t\t\n\t\t/** !#en\n\t\tResumes the target.<br/>\n\t\tThe 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>\n\t\tIf the target is not present, nothing happens.\n\t\t!#zh\n\t\t恢复指定对象的所有定时器。<br/>\n\t\t指定对象的所有定时器将继续工作。<br/>\n\t\t如果指定的对象没有定时器，什么也不会发生。 \n\t\t*/\n\t\tresumeTarget(target : any) : void;\t\t\n\t\t/** !#en Returns whether or not the target is paused.\n\t\t!#zh 返回指定对象的定时器是否暂停了。 \n\t\t*/\n\t\tisTargetPaused(target : any) : boolean;\t\t\n\t\t/** !#en\n\t\tSchedules the 'update' callback_fn for a given target with a given priority.<br/>\n\t\tThe 'update' callback_fn will be called every frame.<br/>\n\t\tThe lower the priority, the earlier it is called.\n\t\t!#zh\n\t\t为指定对象设置 update 定时器。<br/>\n\t\tupdate 定时器每一帧都会被调用。<br/>\n\t\t优先级的值越低，越早被调用。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//register this object to scheduler\n\t\tvar scheduler = cc.director.getScheduler();\n\t\tscheduler.scheduleUpdateForTarget(this, priority, !this._isRunning );\n\t\t\n\t\t``` \n\t\t*/\n\t\tscheduleUpdateForTarget(target : any, priority : number, paused : boolean) : void;\t\t\n\t\t/** !#en\n\t\tUnschedule a callback function for a given target.<br/>\n\t\tIf you want to unschedule the \"update\", use unscheduleUpdateForTarget.\n\t\t!#zh\n\t\t根据指定的回调函数和调用对象对象取消相应的定时器。<br/>\n\t\t如果需要取消 update 定时器，请使用 unscheduleUpdateForTarget()。\n\t\t@param callback callback[Function] or key[String]\n\t\t\n\t\t@example \n\t\t```js\n\t\t//unschedule a callback of target\n\t\tvar scheduler = cc.director.getScheduler();\n\t\tscheduler.unscheduleCallbackForTarget(this, callback);\n\t\t\n\t\t``` \n\t\t*/\n\t\tunscheduleCallbackForTarget(target : any, callback : Function) : void;\t\t\n\t\t/** !#en Unschedules the update callback function for a given target.\n\t\t!#zh 取消指定对象的所有定时器。\n\t\t\n\t\t@example \n\t\t```js\n\t\t//unschedules the \"update\" method.\n\t\tvar scheduler = cc.director.getScheduler();\n\t\tscheduler.unscheduleUpdateForTarget(this);\n\t\t\n\t\t``` \n\t\t*/\n\t\tunscheduleUpdateForTarget(target : any) : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all function callbacks for a given target.<br/>\n\t\tThis also includes the \"update\" callback function.\n\t\t!#zh 取消指定对象的所有定时器，包括 update 定时器。 \n\t\t*/\n\t\tunscheduleAllCallbacksForTarget(target : any) : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all function callbacks from all targets. <br/>\n\t\tYou should NEVER call this method, unless you know what you are doing.\n\t\t!#zh\n\t\t取消所有对象的所有定时器。<br/>\n\t\t不要调用这个方法，除非你知道你正在做什么。 \n\t\t*/\n\t\tunscheduleAllCallbacks() : void;\t\t\n\t\t/** !#en\n\t\tUnschedules all function callbacks from all targets with a minimum priority.<br/>\n\t\tYou should only call this with kCCPriorityNonSystemMin or higher.\n\t\t!#zh\n\t\t取消所有优先级的值大于指定优先级的所有对象的所有定时器。<br/>\n\t\t你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。 \n\t\t*/\n\t\tunscheduleAllCallbacksWithMinPriority(minPriority : number) : void;\t\t\n\t\t/** !#en Priority level reserved for system services.\n\t\t!#zh 系统服务的优先级。 */\n\t\tPRIORITY_SYSTEM : number;\t\t\n\t\t/** !#en Minimum priority level for user scheduling.\n\t\t!#zh 用户调度最低优先级。 */\n\t\tPRIORITY_NON_SYSTEM : number;\t\n\t}\t\t\n\t\t/** Particle System base class. <br/>\n\t\tAttributes of a Particle System:<br/>\n\t\t - emmision rate of the particles<br/>\n\t\t - Gravity Mode (Mode A): <br/>\n\t\t - gravity <br/>\n\t\t - direction <br/>\n\t\t - speed +-  variance <br/>\n\t\t - tangential acceleration +- variance<br/>\n\t\t - radial acceleration +- variance<br/>\n\t\t - Radius Mode (Mode B):      <br/>\n\t\t - startRadius +- variance    <br/>\n\t\t - endRadius +- variance      <br/>\n\t\t - rotate +- variance         <br/>\n\t\t - Properties common to all modes: <br/>\n\t\t - life +- life variance      <br/>\n\t\t - start spin +- variance     <br/>\n\t\t - end spin +- variance       <br/>\n\t\t - start size +- variance     <br/>\n\t\t - end size +- variance       <br/>\n\t\t - start color +- variance    <br/>\n\t\t - end color +- variance      <br/>\n\t\t - life +- variance           <br/>\n\t\t - blending function          <br/>\n\t\t - texture                    <br/>\n\t\t<br/>\n\t\tcocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>\n\t\t'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,  <br/>\n\t\tcocos2d uses a another approach, but the results are almost identical.<br/>\n\t\tcocos2d supports all the variables used by Particle Designer plus a bit more:  <br/>\n\t\t - spinning particles (supported when using ParticleSystem)       <br/>\n\t\t - tangential acceleration (Gravity mode)                               <br/>\n\t\t - radial acceleration (Gravity mode)                                   <br/>\n\t\t - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>\n\t\tIt is possible to customize any of the above mentioned properties in runtime. Example:   <br/> */\n\t\texport class ParticleSystem extends cc._RendererUnderSG {\t\t\n\t\t/** !#en Play particle in edit mode.\n\t\t!#zh 在编辑器模式下预览粒子，启用后选中粒子时，粒子将自动播放。 */\n\t\tpreview : boolean;\t\t\n\t\t/** !#en\n\t\tIf set custom to true, then use custom properties insteadof read particle file.\n\t\t!#zh 是否自定义粒子属性。 */\n\t\tcustom : boolean;\t\t\n\t\t/** !#en The plist file.\n\t\t!#zh plist 格式的粒子配置文件。 */\n\t\tfile : string;\t\t\n\t\t/** . */\n\t\ttexture : Texture2D;\t\t\n\t\t/** !#en Current quantity of particles that are being simulated.\n\t\t!#zh 当前播放的粒子数量。 */\n\t\tparticleCount : number;\t\t\n\t\t/** !#en Specify the source Blend Factor.\n\t\t!#zh 指定原图混合模式。 */\n\t\tsrcBlendFactor : BlendFactor;\t\t\n\t\t/** !#en Specify the destination Blend Factor.\n\t\t!#zh 指定目标的混合模式。 */\n\t\tdstBlendFactor : BlendFactor;\t\t\n\t\t/** !#en If set to true, the particle system will automatically start playing on onLoad.\n\t\t!#zh 如果设置为 true 运行时会自动发射粒子。 */\n\t\tplayOnLoad : boolean;\t\t\n\t\t/** !#en Indicate whether the owner node will be auto-removed when it has no particles left.\n\t\t!#zh 粒子播放完毕后自动销毁所在的节点。 */\n\t\tautoRemoveOnFinish : boolean;\t\t\n\t\t/** !#en Indicate whether the particle system is activated.\n\t\t!#zh 是否激活粒子。 */\n\t\tactive : boolean;\t\t\n\t\t/** !#en Maximum particles of the system.\n\t\t!#zh 粒子最大数量。 */\n\t\ttotalParticles : number;\t\t\n\t\t/** !#en How many seconds the emitter wil run. -1 means 'forever'.\n\t\t!#zh 发射器生存时间，单位秒，-1表示持续发射。 */\n\t\tduration : number;\t\t\n\t\t/** !#en Emission rate of the particles.\n\t\t!#zh 每秒发射的粒子数目。 */\n\t\temissionRate : number;\t\t\n\t\t/** !#en Life of each particle setter.\n\t\t!#zh 粒子的运行时间。 */\n\t\tlife : number;\t\t\n\t\t/** !#en Variation of life.\n\t\t!#zh 粒子的运行时间变化范围。 */\n\t\tlifeVar : number;\t\t\n\t\t/** !#en Start color of each particle.\n\t\t!#zh 粒子初始颜色。 */\n\t\tstartColor : Color;\t\t\n\t\t/** !#en Variation of the start color.\n\t\t!#zh 粒子初始颜色变化范围。 */\n\t\tstartColorVar : Color;\t\t\n\t\t/** !#en Ending color of each particle.\n\t\t!#zh 粒子结束颜色。 */\n\t\tendColor : Color;\t\t\n\t\t/** !#en Variation of the end color.\n\t\t!#zh 粒子结束颜色变化范围。 */\n\t\tendColorVar : Color;\t\t\n\t\t/** !#en Angle of each particle setter.\n\t\t!#zh 粒子角度。 */\n\t\tangle : number;\t\t\n\t\t/** !#en Variation of angle of each particle setter.\n\t\t!#zh 粒子角度变化范围。 */\n\t\tangleVar : number;\t\t\n\t\t/** !#en Start size in pixels of each particle.\n\t\t!#zh 粒子的初始大小。 */\n\t\tstartSize : number;\t\t\n\t\t/** !#en Variation of start size in pixels.\n\t\t!#zh 粒子初始大小的变化范围。 */\n\t\tstartSizeVar : number;\t\t\n\t\t/** !#en End size in pixels of each particle.\n\t\t!#zh 粒子结束时的大小。 */\n\t\tendSize : number;\t\t\n\t\t/** !#en Variation of end size in pixels.\n\t\t!#zh 粒子结束大小的变化范围。 */\n\t\tendSizeVar : number;\t\t\n\t\t/** !#en Start angle of each particle.\n\t\t!#zh 粒子开始自旋角度。 */\n\t\tstartSpin : number;\t\t\n\t\t/** !#en Variation of start angle.\n\t\t!#zh 粒子开始自旋角度变化范围。 */\n\t\tstartSpinVar : number;\t\t\n\t\t/** !#en End angle of each particle.\n\t\t!#zh 粒子结束自旋角度。 */\n\t\tendSpin : number;\t\t\n\t\t/** !#en Variation of end angle.\n\t\t!#zh 粒子结束自旋角度变化范围。 */\n\t\tendSpinVar : number;\t\t\n\t\t/** !#en Source position of the emitter.\n\t\t!#zh 发射器位置。 */\n\t\tsourcePos : Vec2;\t\t\n\t\t/** !#en Variation of source position.\n\t\t!#zh 发射器位置的变化范围。（横向和纵向） */\n\t\tposVar : Vec2;\t\t\n\t\t/** !#en Particles movement type.\n\t\t!#zh 粒子位置类型。 */\n\t\tpositionType : ParticleSystem.PositionType;\t\t\n\t\t/** !#en Particles emitter modes.\n\t\t!#zh 发射器类型。 */\n\t\temitterMode : ParticleSystem.EmitterMode;\t\t\n\t\t/** !#en Gravity of the emitter.\n\t\t!#zh 重力。 */\n\t\tgravity : Vec2;\t\t\n\t\t/** !#en Speed of the emitter.\n\t\t!#zh 速度。 */\n\t\tspeed : number;\t\t\n\t\t/** !#en Variation of the speed.\n\t\t!#zh 速度变化范围。 */\n\t\tspeedVar : number;\t\t\n\t\t/** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.\n\t\t!#zh 每个粒子的切向加速度，即垂直于重力方向的加速度，只有在重力模式下可用。 */\n\t\ttangentialAccel : number;\t\t\n\t\t/** !#en Variation of the tangential acceleration.\n\t\t!#zh 每个粒子的切向加速度变化范围。 */\n\t\ttangentialAccelVar : number;\t\t\n\t\t/** !#en Acceleration of each particle. Only available in 'Gravity' mode.\n\t\t!#zh 粒子径向加速度，即平行于重力方向的加速度，只有在重力模式下可用。 */\n\t\tradialAccel : number;\t\t\n\t\t/** !#en Variation of the radial acceleration.\n\t\t!#zh 粒子径向加速度变化范围。 */\n\t\tradialAccelVar : number;\t\t\n\t\t/** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.\n\t\t!#zh 每个粒子的旋转是否等于其方向，只有在重力模式下可用。 */\n\t\trotationIsDir : boolean;\t\t\n\t\t/** !#en Starting radius of the particles. Only available in 'Radius' mode.\n\t\t!#zh 初始半径，表示粒子出生时相对发射器的距离，只有在半径模式下可用。 */\n\t\tstartRadius : number;\t\t\n\t\t/** !#en Variation of the starting radius.\n\t\t!#zh 初始半径变化范围。 */\n\t\tstartRadiusVar : number;\t\t\n\t\t/** !#en Ending radius of the particles. Only available in 'Radius' mode.\n\t\t!#zh 结束半径，只有在半径模式下可用。 */\n\t\tendRadius : number;\t\t\n\t\t/** !#en Variation of the ending radius.\n\t\t!#zh 结束半径变化范围。 */\n\t\tendRadiusVar : number;\t\t\n\t\t/** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.\n\t\t!#zh 粒子每秒围绕起始点的旋转角度，只有在半径模式下可用。 */\n\t\trotatePerS : number;\t\t\n\t\t/** !#en Variation of the degress to rotate a particle around the source pos per second.\n\t\t!#zh 粒子每秒围绕起始点的旋转角度变化范围。 */\n\t\trotatePerSVar : number;\t\t\n\t\t/** !#en The Particle emitter lives forever.\n\t\t!#zh 表示发射器永久存在 */\n\t\tDURATION_INFINITY : number;\t\t\n\t\t/** !#en The starting size of the particle is equal to the ending size.\n\t\t!#zh 表示粒子的起始大小等于结束大小。 */\n\t\tSTART_SIZE_EQUAL_TO_END_SIZE : number;\t\t\n\t\t/** !#en The starting radius of the particle is equal to the ending radius.\n\t\t!#zh 表示粒子的起始半径等于结束半径。 */\n\t\tSTART_RADIUS_EQUAL_TO_END_RADIUS : number;\t\t\n\t\t/** !#en Add a particle to the emitter.\n\t\t!#zh 添加一个粒子到发射器中。 \n\t\t*/\n\t\taddParticle() : boolean;\t\t\n\t\t/** !#en Stop emitting particles. Running particles will continue to run until they die.\n\t\t!#zh 停止发射器发射粒子，发射出去的粒子将继续运行，直至粒子生命结束。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// stop particle system.\n\t\tmyParticleSystem.stopSystem();\n\t\t``` \n\t\t*/\n\t\tstopSystem() : void;\t\t\n\t\t/** !#en Kill all living particles.\n\t\t!#zh 杀死所有存在的粒子，然后重新启动粒子发射器。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// play particle system.\n\t\tmyParticleSystem.resetSystem();\n\t\t``` \n\t\t*/\n\t\tresetSystem() : void;\t\t\n\t\t/** !#en Whether or not the system is full.\n\t\t!#zh 发射器中粒子是否大于等于设置的总粒子数量。 \n\t\t*/\n\t\tisFull() : boolean;\t\t\n\t\t/** !#en\n\t\t<p> Sets a new CCSpriteFrame as particle.</br>\n\t\tWARNING: this method is experimental. Use setTextureWithRect instead.\n\t\t</p>\n\t\t!#zh\n\t\t<p> 设置一个新的精灵帧为粒子。</br>\n\t\t警告：这个函数只是试验，请使用 setTextureWithRect 实现。\n\t\t</p> \n\t\t*/\n\t\tsetDisplayFrame(spriteFrame : SpriteFrame) : void;\t\t\n\t\t/** !#en Sets a new texture with a rect. The rect is in texture position and size.\n\t\t!#zh 设置一张新贴图和关联的矩形。 \n\t\t*/\n\t\tsetTextureWithRect(texture : Texture2D, rect : Rect) : void;\t\n\t}\t\t\n\t\t/** !#en Render the TMX layer.\n\t\t!#zh 渲染 TMX layer。 */\n\t\texport class TiledLayer extends _SGComponent {\t\t\n\t\t/** !#en Gets the layer name.\n\t\t!#zh 获取层的名称。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar layerName = tiledLayer.getLayerName();\n\t\tcc.log(layerName);\n\t\t``` \n\t\t*/\n\t\tgetLayerName() : string;\t\t\n\t\t/** !#en Set the layer name.\n\t\t!#zh 设置层的名称\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setLayerName(\"New Layer\");\n\t\t``` \n\t\t*/\n\t\tSetLayerName(layerName : string) : void;\t\t\n\t\t/** !#en Return the value for the specific property name.\n\t\t!#zh 获取指定属性名的值。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar property = tiledLayer.getProperty(\"info\");\n\t\tcc.log(property);\n\t\t``` \n\t\t*/\n\t\tgetProperty(propertyName : string) : any;\t\t\n\t\t/** !#en Returns the position in pixels of a given tile coordinate.\n\t\t!#zh 获取指定 tile 的像素坐标。\n\t\t@param pos position or x\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar pos = tiledLayer.getPositionAt(cc.v2(0, 0));\n\t\tcc.log(\"Pos: \" + pos);\n\t\tvar pos = tiledLayer.getPositionAt(0, 0);\n\t\tcc.log(\"Pos: \" + pos);\n\t\t``` \n\t\t*/\n\t\tgetPositionAt(pos : Vec2|number, y? : number) : Vec2;\t\t\n\t\t/** !#en Removes a tile at given tile coordinate.\n\t\t!#zh 删除指定坐标上的 tile。\n\t\t@param pos position or x\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.removeTileAt(cc.v2(0, 0));\n\t\ttiledLayer.removeTileAt(0, 0);\n\t\t``` \n\t\t*/\n\t\tremoveTileAt(pos : Vec2|number, y? : number) : void;\t\t\n\t\t/** !#en\n\t\tSets the tile gid (gid = tile global id) at a given tile coordinate.<br />\n\t\tThe Tile GID can be obtained by using the method \"tileGIDAt\" or by using the TMX editor . Tileset Mgr +1.<br />\n\t\tIf a tile is already placed at that position, then it will be removed.\n\t\t!#zh\n\t\t设置给定坐标的 tile 的 gid (gid = tile 全局 id)，\n\t\ttile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />\n\t\t如果一个 tile 已经放在那个位置，那么它将被删除。\n\t\t@param posOrX position or x\n\t\t@param flagsOrY flags or y\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setTileGID(1001, 10, 10, 1)\n\t\t``` \n\t\t*/\n\t\tsetTileGID(gid : number, posOrX : Vec2|number, flagsOrY : number, flags? : number) : void;\t\t\n\t\t/** !#en\n\t\tReturns the tile gid at a given tile coordinate. <br />\n\t\tif it returns 0, it means that the tile is empty. <br />\n\t\tThis method requires the the tile map has not been previously released (eg. don't call layer.releaseMap())<br />\n\t\t!#zh\n\t\t通过给定的 tile 坐标、flags（可选）返回 tile 的 GID. <br />\n\t\t如果它返回 0，则表示该 tile 为空。<br />\n\t\t该方法要求 tile 地图之前没有被释放过(如：没有调用过layer.releaseMap()).\n\t\t@param pos or x\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar tileGid = tiledLayer.getTileGIDAt(0, 0);\n\t\t``` \n\t\t*/\n\t\tgetTileGIDAt(pos : Vec2|number, y? : number) : number;\t\t\n\t\t/** !#en\n\t\tReturns the tile (_ccsg.Sprite) at a given a tile coordinate. <br/>\n\t\tThe returned _ccsg.Sprite will be already added to the _ccsg.TMXLayer. Don't add it again.<br/>\n\t\tThe _ccsg.Sprite can be treated like any other _ccsg.Sprite: rotated, scaled, translated, opacity, color, etc. <br/>\n\t\tYou can remove either by calling: <br/>\n\t\t- layer.removeChild(sprite, cleanup); <br/>\n\t\t- or layer.removeTileAt(ccp(x,y));\n\t\t!#zh\n\t\t通过指定的 tile 坐标获取对应的 tile(Sprite)。 返回的 tile(Sprite) 应是已经添加到 TMXLayer，请不要重复添加。<br/>\n\t\t这个 tile(Sprite) 如同其他的 Sprite 一样，可以旋转、缩放、翻转、透明化、设置颜色等。<br/>\n\t\t你可以通过调用以下方法来对它进行删除:<br/>\n\t\t1. layer.removeChild(sprite, cleanup);<br/>\n\t\t2. 或 layer.removeTileAt(cc.v2(x,y));\n\t\t@param pos or x\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar title = tiledLayer.getTileAt(100, 100);\n\t\tcc.log(title);\n\t\t``` \n\t\t*/\n\t\tgetTileAt(pos : Vec2|number, y? : number) : _ccsg.Sprite;\t\t\n\t\t/** !#en\n\t\tDealloc the map that contains the tile position from memory. <br />\n\t\tUnless you want to know at runtime the tiles positions, you can safely call this method. <br />\n\t\tIf you are going to call layer.getTileGIDAt() then, don't release the map.\n\t\t!#zh\n\t\t从内存中释放包含 tile 位置信息的地图。<br />\n\t\t除了在运行时想要知道 tiles 的位置信息外，你都可安全的调用此方法。<br />\n\t\t如果你之后还要调用 layer.tileGIDAt(), 请不要释放地图.\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.releaseMap();\n\t\t``` \n\t\t*/\n\t\treleaseMap() : void;\t\t\n\t\t/** !#en Sets the untransformed size of the _ccsg.TMXLayer.\n\t\t!#zh 设置未转换的 layer 大小。\n\t\t@param size The untransformed size of the _ccsg.TMXLayer or The untransformed size's width of the TMXLayer.\n\t\t@param height The untransformed size's height of the _ccsg.TMXLayer.\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setContentSize(100, 100);\n\t\t``` \n\t\t*/\n\t\tsetContentSize(size : Size|number, height? : number) : void;\t\t\n\t\t/** !#en Return texture of cc.SpriteBatchNode.\n\t\t!#zh 获取纹理。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar texture = tiledLayer.getTexture();\n\t\tcc.log(\"Texture: \" + texture);\n\t\t``` \n\t\t*/\n\t\tgetTexture() : Texture2D;\t\t\n\t\t/** !#en Set the texture of cc.SpriteBatchNode.\n\t\t!#zh 设置纹理。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setTexture(texture);\n\t\t``` \n\t\t*/\n\t\tsetTexture(texture : Texture2D) : void;\t\t\n\t\t/** !#en Gets layer size.\n\t\t!#zh 获得层大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar size = tiledLayer.getLayerSize();\n\t\tcc.log(\"layer size: \" + size);\n\t\t``` \n\t\t*/\n\t\tgetLayerSize() : Size;\t\t\n\t\t/** !#en Set layer size.\n\t\t!#zh 设置层大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setLayerSize(new cc.size(5, 5));\n\t\t``` \n\t\t*/\n\t\tsetLayerSize(layerSize : Size) : void;\t\t\n\t\t/** !#en Size of the map's tile (could be different from the tile's size).\n\t\t!#zh 获取 tile 的大小( tile 的大小可能会有所不同)。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar mapTileSize = tiledLayer.getMapTileSize();\n\t\tcc.log(\"MapTile size: \" + mapTileSize);\n\t\t``` \n\t\t*/\n\t\tgetMapTileSize() : Size;\t\t\n\t\t/** !#en Set the map tile size.\n\t\t!#zh 设置 tile 的大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setMapTileSize(new cc.size(10, 10));\n\t\t``` \n\t\t*/\n\t\tsetMapTileSize(tileSize : Size) : void;\t\t\n\t\t/** !#en Pointer to the map of tiles.\n\t\t!#zh 获取地图 tiles。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar tiles = tiledLayer.getTiles();\n\t\t``` \n\t\t*/\n\t\tgetTiles() : any[];\t\t\n\t\t/** !#en Pointer to the map of tiles.\n\t\t!#zh 设置地图 tiles\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setTiles(tiles);\n\t\t``` \n\t\t*/\n\t\tsetTiles(tiles : any[]) : void;\t\t\n\t\t/** !#en Tile set information for the layer.\n\t\t!#zh 获取 layer 的 Tileset 信息。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar tileset = tiledLayer.getTileSet();\n\t\t``` \n\t\t*/\n\t\tgetTileSet() : TMXTilesetInfo;\t\t\n\t\t/** !#en Tile set information for the layer.\n\t\t!#zh 设置 layer 的 Tileset 信息。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setTileSet(tileset);\n\t\t``` \n\t\t*/\n\t\tsetTileSet(tileset : TMXTilesetInfo) : void;\t\t\n\t\t/** !#en Layer orientation, which is the same as the map orientation.\n\t\t!#zh 获取 Layer 方向(同地图方向)。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar orientation = tiledLayer.getLayerOrientation();\n\t\tcc.log(\"Layer Orientation: \" + orientation);\n\t\t``` \n\t\t*/\n\t\tgetLayerOrientation() : number;\t\t\n\t\t/** !#en Layer orientation, which is the same as the map orientation.\n\t\t!#zh 设置 Layer 方向(同地图方向)。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setLayerOrientation(TiledMap.Orientation.ORTHO);\n\t\t``` \n\t\t*/\n\t\tsetLayerOrientation(orientation : TiledMap.Orientation) : void;\t\t\n\t\t/** !#en properties from the layer. They can be added using Tiled.\n\t\t!#zh 获取 layer 的属性，可以使用 Tiled 编辑器添加属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar properties = tiledLayer.getProperties();\n\t\tcc.log(\"Properties: \" + properties);\n\t\t``` \n\t\t*/\n\t\tgetProperties() : any[];\t\t\n\t\t/** !#en properties from the layer. They can be added using Tiled.\n\t\t!#zh 设置层属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledLayer.setLayerOrientation(properties);\n\t\t``` \n\t\t*/\n\t\tsetProperties(properties : any[]) : void;\t\n\t}\t\t\n\t\t/** !#en Renders a TMX Tile Map in the scene.\n\t\t!#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */\n\t\texport class TiledMap extends Component {\t\t\n\t\t/** !#en The TiledMap Asset.\n\t\t!#zh TiledMap 资源。 */\n\t\ttmxAsset : cc.TiledMapAsset;\t\t\n\t\t/** !#en Gets the map size.\n\t\t!#zh 获取地图大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar mapSize = tiledMap.getMapSize();\n\t\tcc.log(\"Map Size: \" + mapSize);\n\t\t``` \n\t\t*/\n\t\tgetMapSize() : Size;\t\t\n\t\t/** !#en Set the map size.\n\t\t!#zh 设置地图大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledMap.setMapSize(new cc.size(960, 640));\n\t\t``` \n\t\t*/\n\t\tsetMapSize(mapSize : Size) : void;\t\t\n\t\t/** !#en Gets the tile size.\n\t\t!#zh 获取地图背景中 tile 元素的大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar tileSize = tiledMap.getTileSize();\n\t\tcc.log(\"Tile Size: \" + tileSize);\n\t\t``` \n\t\t*/\n\t\tgetTileSize() : Size;\t\t\n\t\t/** !#en Set the tile size.\n\t\t!#zh 设置地图背景中 tile 元素的大小。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledMap.setTileSize(new cc.size(10, 10));\n\t\t``` \n\t\t*/\n\t\tsetTileSize(tileSize : Size) : void;\t\t\n\t\t/** !#en map orientation.\n\t\t!#zh 获取地图方向。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar mapOrientation = tiledMap.getMapOrientation();\n\t\tcc.log(\"Map Orientation: \" + mapOrientation);\n\t\t``` \n\t\t*/\n\t\tgetMapOrientation() : number;\t\t\n\t\t/** !#en map orientation.\n\t\t!#zh 设置地图方向。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttiledMap.setMapOrientation(TiledMap.Orientation.ORTHO);\n\t\t``` \n\t\t*/\n\t\tsetMapOrientation(orientation : TiledMap.Orientation) : void;\t\t\n\t\t/** !#en object groups.\n\t\t!#zh 获取所有的对象层。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar objGroups = titledMap.getObjectGroups();\n\t\tfor (var i = 0; i < objGroups.length; ++i) {\n\t\t    cc.log(\"obj: \" + objGroups[i]);\n\t\t}\n\t\t``` \n\t\t*/\n\t\tgetObjectGroups() : any[];\t\t\n\t\t/** !#en object groups.\n\t\t!#zh 设置所有的对象层。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttitledMap.setObjectGroups(groups);\n\t\t``` \n\t\t*/\n\t\tsetObjectGroups(groups : any[]) : void;\t\t\n\t\t/** !#en Gets the map properties.\n\t\t!#zh 获取地图的属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar properties = titledMap.getProperties();\n\t\tfor (var i = 0; i < properties.length; ++i) {\n\t\t    cc.log(\"Properties: \" + properties[i]);\n\t\t}\n\t\t``` \n\t\t*/\n\t\tgetProperties() : any[];\t\t\n\t\t/** !#en Set the map properties.\n\t\t!#zh 设置地图的属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\ttitledMap.setProperties(properties);\n\t\t``` \n\t\t*/\n\t\tsetProperties(properties : any[]) : void;\t\t\n\t\t/** !#en Return All layers array.\n\t\t!#zh 返回包含所有 layer 的数组。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar layers = titledMap.allLayers();\n\t\tfor (var i = 0; i < layers.length; ++i) {\n\t\t    cc.log(\"Layers: \" + layers[i]);\n\t\t}\n\t\t``` \n\t\t*/\n\t\tallLayers() : Node[];\t\t\n\t\t/** !#en return the cc.TiledLayer for the specific layer.\n\t\t!#zh 获取指定名称的 layer。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar layer = titledMap.getLayer(\"Player\");\n\t\tcc.log(layer);\n\t\t``` \n\t\t*/\n\t\tgetLayer(layerName : string) : TiledLayer;\t\t\n\t\t/** !#en Return the TMXObjectGroup for the specific group.\n\t\t!#zh 获取指定的 TMXObjectGroup。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar group = titledMap.getObjectGroup(\"Players\");\n\t\tcc.log(\"ObjectGroup: \" + group);\n\t\t``` \n\t\t*/\n\t\tgetObjectGroup(groupName : string) : TMXObjectGroup;\t\t\n\t\t/** !#en Return the value for the specific property name.\n\t\t!#zh 通过属性名称，获取指定的属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar property = titledMap.getProperty(\"info\");\n\t\tcc.log(\"Property: \" + property);\n\t\t``` \n\t\t*/\n\t\tgetProperty(propertyName : string) : string;\t\t\n\t\t/** !#en Return properties dictionary for tile GID.\n\t\t!#zh 通过 GID ，获取指定的属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar properties = titledMap.getPropertiesForGID(GID);\n\t\tcc.log(\"Properties: \" + properties);\n\t\t``` \n\t\t*/\n\t\tgetPropertiesForGID(GID : number) : any;\t\n\t}\t\t\n\t\t/** !#en\n\t\t cc.NodePool is the cache pool designed for node type.<br/>\n\t\t It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>\n\t\t\n\t\tIt's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,\n\t\tfor example, a prefab is a specific node type. <br/>\n\t\tWhen you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>\n\t\t\n\t\tSome common use case is :<br/>\n\t\t     1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>\n\t\t     2. Blocks in candy crash (massive creation and recreation)<br/>\n\t\t     etc...\n\t\t!#zh\n\t\tcc.NodePool 是用于管理节点对象的对象缓存池。<br/>\n\t\t它可以帮助您提高游戏性能，适用于优化对象的反复创建和销毁<br/>\n\t\t\n\t\t建议为每种节点分别实例化一个缓冲池，这里的种类对应于游戏中的节点设计，一个 prefab 相当于一个种类的节点。<br/>\n\t\t在创建缓冲池时，可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>\n\t\t\n\t\t一些常见的用例是：<br/>\n\t\t     1.在游戏中的子弹（死亡很快，频繁创建，对其他对象无副作用）<br/>\n\t\t     2.糖果粉碎传奇中的木块（频繁创建）。\n\t\t     等等.... */\n\t\texport class NodePool {\t\t\n\t\t/** \n\t\t@param poolHandlerComp The constructor or the class name of the component to control the unuse/reuse logic. \n\t\t*/\n\t\tconstructor(poolHandlerComp : Function|string);\t\t\n\t\t/** !#en The pool handler component, it could be the class name or the constructor.\n\t\t!#zh 缓冲池处理组件，用于节点的回收和复用逻辑，这个属性可以是组件类名或组件的构造函数。 */\n\t\tpoolHandlerComp : Function|string;\t\t\n\t\t/** !#en The current available size in the pool\n\t\t!#zh 获取当前缓冲池的可用对象数量 \n\t\t*/\n\t\tsize() : void;\t\t\n\t\t/** !#en Put a new Node into the pool.\n\t\tIt will automatically remove the node from its parent without cleanup.\n\t\tIt will also invoke unuse method of the poolHandlerComp if exist.\n\t\t!#zh 向缓冲池中存入一个不再需要的节点对象。\n\t\t这个函数会自动将目标节点从父节点上移除，但是不会进行 cleanup 操作。\n\t\t这个函数会调用 poolHandlerComp 的 unuse 函数，如果组件和函数都存在的话。 \n\t\t*/\n\t\tput() : void;\t\t\n\t\t/** !#en Get a obj from pool, if no available object in pool, null will be returned.\n\t\tThis function will invoke the reuse function of poolHandlerComp if exist.\n\t\t!#zh 获取对象池中的对象，如果对象池没有可用对象，则返回空。\n\t\t这个函数会调用 poolHandlerComp 的 reuse 函数，如果组件和函数都存在的话。 \n\t\t*/\n\t\tget() : any;\t\n\t}\t\t\n\t\t/** !#en\n\t\t Attention: In creator, it's strongly not recommended to use cc.pool to manager cc.Node.\n\t\t We provided {{#crossLink \"NodePool\"}}cc.NodePool{{/crossLink}} instead.\n\t\t\n\t\t cc.pool is a singleton object serves as an object cache pool.<br/>\n\t\t It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>\n\t\t!#zh\n\t\t首先请注意，在 Creator 中我们强烈不建议使用 cc.pool 来管理 cc.Node 节点对象，请使用 {{#crossLink \"NodePool\"}}cc.NodePool{{/crossLink}} 代替\n\t\t因为 cc.pool 是面向类来设计的，而 cc.Node 中使用 Component 来进行组合，它的类永远都一样，实际却千差万别。\n\t\t\n\t\tcc.pool 是一个单例对象，用作为对象缓存池。<br/>\n\t\t它可以帮助您提高游戏性能，适用于优化对象的反复创建和销毁<br/> */\n\t\texport class pool {\t\t\n\t\t/** !#en Put the obj in pool.\n\t\t!#zh 加入对象到对象池中。\n\t\t@param obj The need put in pool object.\n\t\t\n\t\t@example \n\t\t```js\n\t\t---------------------------------\n\t\tvar sp = new _ccsg.Sprite(\"a.png\");\n\t\tthis.addChild(sp);\n\t\tcc.pool.putInPool(sp);\n\t\tcc.pool.getFromPool(_ccsg.Sprite, \"a.png\");\n\t\t\n\t\t``` \n\t\t*/\n\t\tputInPool(obj : any) : void;\t\t\n\t\t/** !#en Check if this kind of obj has already in pool.\n\t\t!#zh 检查对象池中是否有指定对象的存在。\n\t\t@param objClass The check object class. \n\t\t*/\n\t\thasObject(objClass : any) : boolean;\t\t\n\t\t/** !#en Remove the obj if you want to delete it.\n\t\t!#zh 移除在对象池中指定的对象。 \n\t\t*/\n\t\tremoveObject() : void;\t\t\n\t\t/** !#en Get the obj from pool.\n\t\t!#zh 获取对象池中的指定对象。 \n\t\t*/\n\t\tgetFromPool() : any;\t\t\n\t\t/** !#en Remove all objs in pool and reset the pool.\n\t\t!#zh 移除对象池中的所有对象，并且重置对象池。 \n\t\t*/\n\t\tdrainAllPools() : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tBase class for handling assets used in Fireball. This class can be instantiate.\n\t\t\n\t\tYou may want to override:<br/>\n\t\t- createNode<br/>\n\t\t- cc.Object._serialize<br/>\n\t\t- cc.Object._deserialize<br/>\n\t\t!#zh\n\t\t资源基类，该类可以被实例化。<br/>\n\t\t\n\t\t您可能需要重写：<br/>\n\t\t- createNode <br/>\n\t\t- cc.Object._serialize<br/>\n\t\t- cc.Object._deserialize<br/> */\n\t\texport class Asset extends RawAsset {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en\n\t\tReturns the url of this asset's first raw file, if none of rawFile exists,\n\t\tit will returns an empty string.\n\t\t!#zh 返回该资源的原始文件的 URL，如果不支持 RAW 文件，它将返回一个空字符串。 */\n\t\trawUrl : string;\t\t\n\t\t/** !#en\n\t\tReturns the url of this asset's raw files, if none of rawFile exists,\n\t\tit will returns an empty array.\n\t\t!#zh 返回该资源的原文件的 URL 数组，如果不支持 RAW 文件，它将返回一个空数组。 */\n\t\trawUrls : String[];\t\t\n\t\t/** !#en\n\t\tCreate a new node using this asset in the scene.<br/>\n\t\tIf this type of asset dont have its corresponding node type, this method should be null.\n\t\t!#zh\n\t\t使用该资产在场景中创建一个新节点。<br/>\n\t\t如果这类资产没有相应的节点类型，该方法应该是空的。 \n\t\t*/\n\t\tcreateNode(callback: (error: string, node: any) => void) : void;\t\n\t}\t\t\n\t\t/** !#en Class for audio data handling.\n\t\t!#zh 音频资源类。 */\n\t\texport class AudioClip extends RawAsset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for BitmapFont handling.\n\t\t!#zh 位图字体资源类。 */\n\t\texport class BitmapFont extends RawAsset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for Font handling.\n\t\t!#zh 字体资源类。 */\n\t\texport class Font extends RawAsset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for prefab handling.\n\t\t!#zh 预制资源类。 */\n\t\texport class Prefab extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en\n\t\tThe base class for registering asset types.\n\t\t\n\t\tYou may want to override:\n\t\t- createNode (static)\n\t\t!#zh\n\t\t注册用的资源基类。<br/>\n\t\t你可能要重写：<br/>\n\t\t- createNode (static) */\n\t\texport class RawAsset extends CCObject {\t\t\n\t\t/** !#en\n\t\tCreate a new node in the scene.<br/>\n\t\tIf this type of asset dont have its corresponding node type, this method should be null.\n\t\t!#zh\n\t\t在场景中创建一个新节点。<br/>\n\t\t如果这类资源没有相应的节点类型，该方法应该是空的。 \n\t\t*/\n\t\tcreateNodeByInfo(Info : any, callback: (error: string, node: any) => void) : void;\t\n\t}\t\t\n\t\t/** !#en Class for scene handling.\n\t\t!#zh 场景资源类。 */\n\t\texport class SceneAsset extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for script handling.\n\t\t!#zh Script 资源类。 */\n\t\texport class _Script extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for JavaScript handling.\n\t\t!#zh JavaScript 资源类。 */\n\t\texport class _JavaScript extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for coffee script handling.\n\t\t!#zh CoffeeScript 资源类。 */\n\t\texport class CoffeeScript extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for sprite atlas handling.\n\t\t!#zh 精灵图集资源类。 */\n\t\texport class SpriteAtlas extends RawAsset {\t\t\n\t\tconstructor();\t\t\n\t\t/** Returns the texture of the sprite atlas \n\t\t*/\n\t\tgetTexture() : cc.Texture2D;\t\t\n\t\t/** Returns the sprite frame correspond to the given key in sprite atlas. \n\t\t*/\n\t\tgetSpriteFrame(key : string) : cc.SpriteFrame;\t\t\n\t\t/** Returns the sprite frames in sprite atlas. \n\t\t*/\n\t\tgetSpriteFrames() : [cc.SpriteFrame];\t\n\t}\t\t\n\t\t/** !#en Class for TTFFont handling.\n\t\t!#zh TTF 字体资源类。 */\n\t\texport class TTFFont extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Class for text file.\n\t\t!#zh 文本资源类。 */\n\t\texport class TextAsset extends Asset {\t\t\n\t\tconstructor();\t\n\t}\t\t\n\t\t/** !#en Box Collider.\n\t\t!#zh 包围盒碰撞组件 */\n\t\texport class BoxCollider extends Component {\t\t\n\t\t/** !#en Position offset\n\t\t!#zh 位置偏移量 */\n\t\toffset : Vec2;\t\t\n\t\t/** !#en Box size\n\t\t!#zh 包围盒大小 */\n\t\tsize : Size;\t\n\t}\t\t\n\t\t/** !#en Circle Collider.\n\t\t!#zh 圆形碰撞组件 */\n\t\texport class CircleCollider extends Component {\t\t\n\t\t/** !#en Position offset\n\t\t!#zh 位置偏移量 */\n\t\toffset : Vec2;\t\t\n\t\t/** !#en Circle radius\n\t\t!#zh 圆形半径 */\n\t\tradius : number;\t\n\t}\t\t\n\t\t/** !#en Collider component base class.\n\t\t!#zh 碰撞组件基类 */\n\t\texport class Collider extends Component {\t\t\n\t\t/** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.\n\t\t!#zh 标签。当一个节点上有多个碰撞组件时，在发生碰撞后，可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */\n\t\ttag : Integer;\t\n\t}\t\t\n\t\t/** !#en\n\t\tA simple collision manager class.\n\t\tIt will calculate whether the collider collides other colliders, if collides then call the callbacks.\n\t\t!#zh\n\t\t一个简单的碰撞组件管理类，用于处理节点之间的碰撞组件是否产生了碰撞，并调用相应回调函数。 */\n\t\texport class CollisionManager {\t\t\n\t\t/** !#en\n\t\t!#zh\n\t\t是否开启碰撞管理，默认为不开启 */\n\t\tenabled : boolean;\t\t\n\t\t/** !#en\n\t\t!#zh\n\t\t是否绘制碰撞组件的包围盒，默认为不绘制 */\n\t\tenabledDrawBoundingBox : boolean;\t\t\n\t\t/** !#en\n\t\t!#zh\n\t\t是否绘制碰撞组件的形状，默认为不绘制 */\n\t\tenabledDebugDraw : boolean;\t\n\t}\t\t\n\t\t/** !#en Intersection helper class\n\t\t!#zh 辅助类，用于测试形状与形状是否相交 */\n\t\texport class Intersection {\t\t\n\t\t/** !#en Test line and line\n\t\t!#zh 测试线段与线段是否相交\n\t\t@param a1 The start point of the first line\n\t\t@param a2 The end point of the first line\n\t\t@param b1 The start point of the second line\n\t\t@param b2 The end point of the second line \n\t\t*/\n\t\tlineLine(a1 : Vec2, a2 : Vec2, b1 : Vec2, b2 : Vec2) : boolean;\t\t\n\t\t/** !#en Test line and rect\n\t\t!#zh 测试线段与矩形是否相交\n\t\t@param a1 The start point of the line\n\t\t@param a2 The end point of the line\n\t\t@param b The rect \n\t\t*/\n\t\tlineRect(a1 : Vec2, a2 : Vec2, b : Rect) : boolean;\t\t\n\t\t/** !#en Test line and polygon\n\t\t!#zh 测试线段与多边形是否相交\n\t\t@param a1 The start point of the line\n\t\t@param a2 The end point of the line\n\t\t@param b The polygon, a set of points \n\t\t*/\n\t\tlinePolygon(a1 : Vec2, a2 : Vec2, b : [Vec2]) : boolean;\t\t\n\t\t/** !#en Test rect and rect\n\t\t!#zh 测试矩形与矩形是否相交\n\t\t@param a The first rect\n\t\t@param b The second rect \n\t\t*/\n\t\trectRect(a : Rect, b : Rect) : boolean;\t\t\n\t\t/** !#en Test rect and polygon\n\t\t!#zh 测试矩形与多边形是否相交\n\t\t@param a The rect\n\t\t@param b The polygon, a set of points \n\t\t*/\n\t\trectPolygon(a : Rect, b : [Vec2]) : boolean;\t\t\n\t\t/** !#en Test polygon and polygon\n\t\t!#zh 测试多边形与多边形是否相交\n\t\t@param a The first polygon, a set of points\n\t\t@param b The second polygon, a set of points \n\t\t*/\n\t\tpolygonPolygon(a : [Vec2], b : [Vec2]) : boolean;\t\t\n\t\t/** !#en Test circle and circle\n\t\t!#zh 测试圆形与圆形是否相交\n\t\t@param a Object contains position and radius\n\t\t@param b Object contains position and radius \n\t\t*/\n\t\tcircleCircle(a : any, b : any) : boolean;\t\t\n\t\t/** !#en Test polygon and circle\n\t\t!#zh 测试矩形与圆形是否相交\n\t\t@param polygon The Polygon, a set of points\n\t\t@param circle Object contains position and radius \n\t\t*/\n\t\tpolygonCircle(polygon : [Vec2], circle : any) : boolean;\t\t\n\t\t/** !#en Test whether the point is in the polygon\n\t\t!#zh 测试一个点是否在一个多边形中\n\t\t@param point The point\n\t\t@param polygon The polygon, a set of points \n\t\t*/\n\t\tpointInPolygon(point : Vec2, polygon : [Vec2]) : boolean;\t\t\n\t\t/** !#en Calculate the distance of point to line.\n\t\t!#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内，则会计算点到线段端点的距离。\n\t\t@param point The point\n\t\t@param start The start point of line\n\t\t@param end The end point of line\n\t\t@param isSegment whether this line is a segment \n\t\t*/\n\t\tpointLineDistance(point : Vec2, start : Vec2, end : Vec2, isSegment : boolean) : boolean;\t\n\t}\t\t\n\t\t/** !#en Polygon Collider.\n\t\t!#zh 多边形碰撞组件 */\n\t\texport class PolygonCollider extends Component {\t\t\n\t\t/** !#en Position offset\n\t\t!#zh 位置偏移量 */\n\t\toffset : Vec2;\t\t\n\t\t/** !#en Polygon points\n\t\t!#zh 多边形顶点数组 */\n\t\tpoints : [Vec2];\t\n\t}\t\t\n\t\t/** !#en The animation component is used to play back animations.\n\t\t!#zh Animation 组件用于播放动画。你能指定动画剪辑到动画组件并从脚本控制播放。 */\n\t\texport class Animation extends CCComponent {\t\t\n\t\t/** !#en Animation will play the default clip when start game.\n\t\t!#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */\n\t\tdefaultClip : AnimationClip;\t\t\n\t\t/** !#en Current played clip.\n\t\t!#zh 当前播放的动画剪辑。 */\n\t\tcurrentClip : AnimationClip;\t\t\n\t\t/** !#en Whether the animation should auto play the default clip when start game.\n\t\t!#zh 是否在运行游戏后自动播放默认动画剪辑。 */\n\t\tplayOnLoad : boolean;\t\t\n\t\t/** !#en Get all the clips used in this animation.\n\t\t!#zh 获取动画组件上的所有动画剪辑。 \n\t\t*/\n\t\tgetClips() : AnimationClip[];\t\t\n\t\t/** !#en Plays an animation and stop other animations.\n\t\t!#zh 播放当前或者指定的动画，并且停止当前正在播放动画。\n\t\t@param name The name of animation to play. If no name is supplied then the default animation will be played.\n\t\t@param startTime play an animation from startTime\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar animCtrl = this.node.getComponent(cc.Animation);\n\t\tanimCtrl.play(\"linear\");\n\t\t``` \n\t\t*/\n\t\tplay(name? : string, startTime? : number) : AnimationState;\t\t\n\t\t/** !#en\n\t\tPlays an additive animation, it will not stop other animations.\n\t\tIf there are other animations playing, then will play several animations at the same time.\n\t\t!#zh 播放当前或者指定的动画（将不会停止当前播放的动画）。\n\t\t@param name The name of animation to play. If no name is supplied then the default animation will be played.\n\t\t@param startTime play an animation from startTime\n\t\t\n\t\t@example \n\t\t```js\n\t\t// linear_1 and linear_2 at the same time playing.\n\t\tvar animCtrl = this.node.getComponent(cc.Animation);\n\t\tanimCtrl.playAdditive(\"linear_1\");\n\t\tanimCtrl.playAdditive(\"linear_2\");\n\t\t``` \n\t\t*/\n\t\tplayAdditive(name? : string, startTime? : number) : AnimationState;\t\t\n\t\t/** !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>\n\t\tStopping an animation also Rewinds it to the Start.\n\t\t!#zh 停止当前或者指定的动画。如果没有指定名字，则停止所有动画。\n\t\t@param name The animation to stop, if not supplied then stops all playing animations. \n\t\t*/\n\t\tstop(name? : string) : void;\t\t\n\t\t/** !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.\n\t\t!#zh 暂停当前或者指定的动画。如果没有指定名字，则暂停当前正在播放的动画。\n\t\t@param name The animation to pauses, if not supplied then pauses all playing animations. \n\t\t*/\n\t\tpause(name? : string) : void;\t\t\n\t\t/** !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.\n\t\t!#zh 重新播放指定的动画，如果没有指定名字，则重新播放当前正在播放的动画。\n\t\t@param name The animation to resumes, if not supplied then resumes all paused animations. \n\t\t*/\n\t\tresume(name? : string) : void;\t\t\n\t\t/** !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time.\n\t\t!#zh 设置指定动画的播放时间。如果没有指定名字，则设置所有动画的播放时间。\n\t\t@param time The time to go to\n\t\t@param name Specified animation name, if not supplied then make all animations go to the time. \n\t\t*/\n\t\tsetCurrentTime(time? : number, name? : string) : void;\t\t\n\t\t/** !#en Returns the animation state named name. If no animation with the specified name, the function will return null.\n\t\t!#zh 获取当前或者指定的动画状态，如果未找到指定动画剪辑则返回 null。 \n\t\t*/\n\t\tgetAnimationState(name : string) : AnimationState;\t\t\n\t\t/** !#en Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip.\n\t\t!#zh 添加动画剪辑，并且可以重新设置该动画剪辑的名称。\n\t\t@param clip the clip to add \n\t\t*/\n\t\taddClip(clip : AnimationClip, newName? : string) : AnimationState;\t\t\n\t\t/** !#en\n\t\tRemove clip from the animation list. This will remove the clip and any animation states based on it.\n\t\tIf there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.\n\t\tBut if force is true, then will always remove the clip and any animation states based on it. If clip is defaultClip, defaultClip will be reset to null\n\t\t!#zh\n\t\t从动画列表中移除指定的动画剪辑，<br/>\n\t\t如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话，默认是不会删除 clip 的。\n\t\t但是如果 force 参数为 true，则会强制停止该动画，然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip，defaultClip 将会被重置为 null。\n\t\t@param force If force is true, then will always remove the clip and any animation states based on it. \n\t\t*/\n\t\tremoveClip(clip : AnimationClip, force : boolean) : void;\t\t\n\t\t/** !#en\n\t\tSamples animations at the current state.<br/>\n\t\tThis is useful when you explicitly want to set up some animation state, and sample it once.\n\t\t!#zh 对当前动画进行采样。你可以手动将动画设置到某一个状态，然后采样一次。 \n\t\t*/\n\t\tsample() : void;\t\n\t}\t\t\n\t\t/** !#en Audio Source.\n\t\t!#zh 音频源组件，能对音频剪辑。 */\n\t\texport class AudioSource extends Component {\t\t\n\t\t/** !#en\n\t\tIs the audio source playing (Read Only). <br/>\n\t\tNote: isPlaying is not supported for Native platforms.\n\t\t!#zh\n\t\t该音频剪辑是否正播放（只读）。<br/>\n\t\t注意：Native 平台暂时不支持 isPlaying。 */\n\t\tisPlaying : boolean;\t\t\n\t\t/** !#en The clip of the audio source.\n\t\t!#zh 默认要播放的音频剪辑。 */\n\t\tclip : AudioClip;\t\t\n\t\t/** !#en The volume of the audio source.\n\t\t!#zh 音频源的音量（0.0 ~ 1.0）。 */\n\t\tvolume : number;\t\t\n\t\t/** !#en Is the audio source mute?\n\t\t!#zh 是否静音音频源。Mute 是设置音量为 0，取消静音是恢复原来的音量。 */\n\t\tmute : boolean;\t\t\n\t\t/** !#en Is the audio source looping?\n\t\t!#zh 音频源是否循环播放？ */\n\t\tloop : boolean;\t\t\n\t\t/** !#en If set to true, the audio source will automatically start playing on onLoad.\n\t\t!#zh 如果设置为true，音频源将在 onLoad 时自动播放。 */\n\t\tplayOnLoad : boolean;\t\t\n\t\t/** !#en Plays the clip.\n\t\t!#zh 播放音频剪辑。 \n\t\t*/\n\t\tplay() : void;\t\t\n\t\t/** !#en Stops the clip.\n\t\t!#zh 停止当前音频剪辑。 \n\t\t*/\n\t\tstop() : void;\t\t\n\t\t/** !#en Pause the clip.\n\t\t!#zh 暂停当前音频剪辑。 \n\t\t*/\n\t\tpause() : void;\t\t\n\t\t/** !#en Resume the clip.\n\t\t!#zh 恢复播放。 \n\t\t*/\n\t\tresume() : void;\t\t\n\t\t/** !#en Rewind playing music.\n\t\t!#zh 从头开始播放。 \n\t\t*/\n\t\trewind() : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tButton has 3 Transition types\n\t\tWhen Button state changed:\n\t\t If Transition type is Button.Transition.NONE, Button will do nothing\n\t\t If Transition type is Button.Transition.COLOR, Button will change target's color\n\t\t If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite\n\t\t\n\t\tButton will trigger 5 events:\n\t\t Button.EVENT_TOUCH_DOWN\n\t\t Button.EVENT_TOUCH_UP\n\t\t Button.EVENT_HOVER_IN\n\t\t Button.EVENT_HOVER_MOVE\n\t\t Button.EVENT_HOVER_OUT\n\t\t\n\t\t!#zh\n\t\t按钮组件。可以被按下,或者点击。</br>\n\t\t\n\t\t按钮可以通过修改 Transition 来设置按钮状态过渡的方式：</br>\n\t\t  -Button.Transition.NONE   // 不做任何过渡</br>\n\t\t  -Button.Transition.COLOR  // 进行颜色之间过渡</br>\n\t\t  -Button.Transition.SPRITE // 进行精灵之间过渡</br>\n\t\t\n\t\t按钮可以绑定事件（但是必须要在按钮的 Node 上才能绑定事件）：</br>\n\t\t  // 以下事件可以在全平台上都触发</br>\n\t\t  -cc.Node.EventType.TOUCH_START  // 按下时事件</br>\n\t\t  -cc.Node.EventType.TOUCH_Move   // 按住移动后事件</br>\n\t\t  -cc.Node.EventType.TOUCH_END    // 按下后松开后事件</br>\n\t\t  -cc.Node.EventType.TOUCH_CANCEL // 按下取消事件</br>\n\t\t  // 以下事件只在 PC 平台上触发</br>\n\t\t  -cc.Node.EventType.MOUSE_DOWN  // 鼠标按下时事件</br>\n\t\t  -cc.Node.EventType.MOUSE_MOVE  // 鼠标按住移动后事件</br>\n\t\t  -cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件</br>\n\t\t  -cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件</br>\n\t\t  -cc.Node.EventType.MOUSE_UP    // 鼠标松开事件</br>\n\t\t  -cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件</br> */\n\t\texport class Button extends Component {\t\t\n\t\t/** !#en\n\t\tWhether the Button is disabled.\n\t\tIf true, the Button will trigger event and do transition.\n\t\t!#zh\n\t\t按钮事件是否被响应，如果为 false，则按钮将被禁用。 */\n\t\tinteractable : boolean;\t\t\n\t\t/** !#en Transition type\n\t\t!#zh 按钮状态改变时过渡方式。 */\n\t\ttransition : Button.Transition;\t\t\n\t\t/** !#en Normal state color.\n\t\t!#zh 普通状态下按钮所显示的颜色。 */\n\t\tnormalColor : Color;\t\t\n\t\t/** !#en Pressed state color\n\t\t!#zh 按下状态时按钮所显示的颜色。 */\n\t\tpressedColor : Color;\t\t\n\t\t/** !#en Hover state color\n\t\t!#zh 悬停状态下按钮所显示的颜色。 */\n\t\thoverColor : Color;\t\t\n\t\t/** !#en Disabled state color\n\t\t!#zh 禁用状态下按钮所显示的颜色。 */\n\t\tdisabledColor : Color;\t\t\n\t\t/** !#en Color transition duration\n\t\t!#zh 颜色过渡时所需时间 */\n\t\tduration : number;\t\t\n\t\t/** !#en Normal state sprite\n\t\t!#zh 普通状态下按钮所显示的 Sprite 。 */\n\t\tnormalSprite : SpriteFrame;\t\t\n\t\t/** !#en Pressed state sprite\n\t\t!#zh 按下状态时按钮所显示的 Sprite 。 */\n\t\tpressedSprite : SpriteFrame;\t\t\n\t\t/** !#en Hover state sprite\n\t\t!#zh 悬停状态下按钮所显示的 Sprite 。 */\n\t\thoverSprite : SpriteFrame;\t\t\n\t\t/** !#en Disabled state sprite\n\t\t!#zh 禁用状态下按钮所显示的 Sprite 。 */\n\t\tdisabledSprite : SpriteFrame;\t\t\n\t\t/** !#en\n\t\tTransition target.\n\t\tWhen Button state changed:\n\t\t If Transition type is Button.Transition.NONE, Button will do nothing\n\t\t If Transition type is Button.Transition.COLOR, Button will change target's color\n\t\t If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite\n\t\t!#zh\n\t\t需要过渡的目标。\n\t\t当前按钮状态改变有：\n\t\t-如果 Transition type 选择 Button.Transition.NONE，按钮不做任何过渡。\n\t\t-如果 Transition type 选择 Button.Transition.COLOR，按钮会对目标颜色进行颜色之间的过渡。\n\t\t-如果 Transition type 选择 Button.Transition.NONE，按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */\n\t\ttarget : Node;\t\t\n\t\t/** !#en If Button is clicked, it will trigger event's handler\n\t\t!#zh 按钮的点击事件列表。 */\n\t\tclickEvents : Component.EventHandler[];\t\n\t}\t\t\n\t\t/** !#zh: 作为 UI 根节点，为所有子节点提供视窗四边的位置信息以供对齐，另外提供屏幕适配策略接口，方便从编辑器设置。\n\t\t注：由于本节点的尺寸会跟随屏幕拉伸，所以 anchorPoint 只支持 (0.5, 0.5)，否则适配不同屏幕时坐标会有偏差。 */\n\t\texport class Canvas extends Component {\t\t\n\t\t/** !#en Current active canvas, the scene should only have one active canvas at the same time.\n\t\t!#zh 当前激活的画布组件，场景同一时间只能有一个激活的画布。 */\n\t\tinstance : Canvas;\t\t\n\t\t/** !#en The desigin resolution for current scene.\n\t\t!#zh 当前场景设计分辨率。 */\n\t\tdesignResolution : cc.Size;\t\t\n\t\t/** !#en TODO\n\t\t!#zh: 是否优先将设计分辨率高度撑满视图高度。 */\n\t\tfitHeight : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */\n\t\tfitWidth : boolean;\t\n\t}\t\t\n\t\t/** !#en\n\t\tBase class for everything attached to Node(Entity).<br/>\n\t\t<br/>\n\t\tNOTE: Not allowed to use construction parameters for Component's subclasses,\n\t\t      because Component is created by the engine.\n\t\t!#zh\n\t\t所有附加到节点的基类。<br/>\n\t\t<br/>\n\t\t注意：不允许使用组件的子类构造参数，因为组件是由引擎创建的。 */\n\t\texport class Component extends Object {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en The node this component is attached to. A component is always attached to a node.\n\t\t!#zh 该组件被附加到的节点。组件总会附加到一个节点。 */\n\t\tnode : Node;\t\t\n\t\t/** !#en The uuid for editor.\n\t\t!#zh 组件的 uuid，用于编辑器。 */\n\t\tuuid : string;\t\t\n\t\t/** !#en indicates whether this component is enabled or not.\n\t\t!#zh 表示该组件自身是否启用。 */\n\t\tenabled : boolean;\t\t\n\t\t/** !#en indicates whether this component is enabled and its node is also active in the hierarchy.\n\t\t!#zh 表示该组件是否被启用并且所在的节点也处于激活状态。。 */\n\t\tenabledInHierarchy : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh onLoad 是否被调用。 */\n\t\t_isOnLoadCalled : boolean;\t\t\n\t\t/** !#en Update is called every frame, if the Component is enabled.\n\t\t!#zh 如果该组件启用，则每帧调用 update。 \n\t\t*/\n\t\tupdate() : void;\t\t\n\t\t/** !#en LateUpdate is called every frame, if the Component is enabled.\n\t\t!#zh 如果该组件启用，则每帧调用 LateUpdate。 \n\t\t*/\n\t\tlateUpdate() : void;\t\t\n\t\t/** !#en When attaching to an active node or its node first activated.\n\t\t!#zh 当附加到一个激活的节点上或者其节点第一次激活时候调用。 \n\t\t*/\n\t\tonLoad() : void;\t\t\n\t\t/** !#en Called before all scripts' update if the Component is enabled.\n\t\t!#zh 如果该组件启用，则在所有组件的 update 之前调用。 \n\t\t*/\n\t\tstart() : void;\t\t\n\t\t/** !#en Called when this component becomes enabled and its node is active.\n\t\t!#zh 当该组件被启用，并且它的节点也激活时。 \n\t\t*/\n\t\tonEnable() : void;\t\t\n\t\t/** !#en Called when this component becomes disabled or its node becomes inactive.\n\t\t!#zh 当该组件被禁用或节点变为无效时调用。 \n\t\t*/\n\t\tonDisable() : void;\t\t\n\t\t/** !#en Called when this component will be destroyed.\n\t\t!#zh 当该组件被销毁时调用 \n\t\t*/\n\t\tonDestroy() : void;\t\t\n\t\tonFocusInEditor() : void;\t\t\n\t\tonLostFocusInEditor() : void;\t\t\n\t\t/** !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.\n\t\t!#zh 向节点添加一个组件类，你还可以通过传入脚本的名称来添加组件。\n\t\t@param typeOrTypename the constructor or the class name of the component to add\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprite = node.addComponent(cc.Sprite);\n\t\tvar test = node.addComponent(\"Test\");\n\t\t``` \n\t\t*/\n\t\taddComponent(typeOrTypename : Function|string) : Component;\t\t\n\t\t/** !#en\n\t\tReturns the component of supplied type if the node has one attached, null if it doesn't.<br/>\n\t\tYou can also get component in the node by passing in the name of the script.\n\t\t!#zh\n\t\t获取节点上指定类型的组件，如果节点有附加指定类型的组件，则返回，如果没有则为空。<br/>\n\t\t传入参数也可以是脚本的名称。\n\t\t\n\t\t@example \n\t\t```js\n\t\t// get sprite component.\n\t\tvar sprite = node.getComponent(cc.Sprite);\n\t\t// get custom test calss.\n\t\tvar test = node.getComponent(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponent(typeOrClassName : Function|string) : Component;\t\t\n\t\t/** !#en Returns all components of supplied Type in the node.\n\t\t!#zh 返回节点上指定类型的所有组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprites = node.getComponents(cc.Sprite);\n\t\tvar tests = node.getComponents(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponents(typeOrClassName : Function|string) : Component[];\t\t\n\t\t/** !#en Returns the component of supplied type in any of its children using depth first search.\n\t\t!#zh 递归查找所有子节点中第一个匹配指定类型的组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprite = node.getComponentInChildren(cc.Sprite);\n\t\tvar Test = node.getComponentInChildren(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponentInChildren(typeOrClassName : Function|string) : Component;\t\t\n\t\t/** !#en Returns the components of supplied type in any of its children using depth first search.\n\t\t!#zh 递归查找所有子节点中指定类型的组件。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar sprites = node.getComponentsInChildren(cc.Sprite);\n\t\tvar tests = node.getComponentsInChildren(\"Test\");\n\t\t``` \n\t\t*/\n\t\tgetComponentsInChildren(typeOrClassName : Function|string) : Component[];\t\t\n\t\t/** !#en\n\t\tIf the component's bounding box is different from the node's, you can implement this method to supply\n\t\ta custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.\n\t\t!#zh\n\t\t如果组件的包围盒与节点不同，您可以实现该方法以提供自定义的轴向对齐的包围盒（AABB），\n\t\t以便编辑器的场景视图可以正确地执行点选测试。\n\t\t@param out_rect the Rect to receive the bounding box \n\t\t*/\n\t\t_getLocalBounds(out_rect : Rect) : void;\t\t\n\t\t/** !#en\n\t\tonRestore is called after the user clicks the Reset item in the Inspector's context menu or performs\n\t\tan undo operation on this component.<br/>\n\t\t<br/>\n\t\tIf the component contains the \"internal state\", short for \"temporary member variables which not included<br/>\n\t\tin its CCClass properties\", then you may need to implement this function.<br/>\n\t\t<br/>\n\t\tThe editor will call the getset accessors of your component to record/restore the component's state<br/>\n\t\tfor undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>\n\t\tthis function to manually synchronize your component's \"internal states\" with its public properties.<br/>\n\t\tOnce you implement this function, all the getset accessors of your component will not be called when<br/>\n\t\tthe user performs an undo/redo operation. Which means that only the properties with default value<br/>\n\t\twill be recorded or restored by editor.<br/>\n\t\t<br/>\n\t\tSimilarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>\n\t\tto support the reset menu, you should manually synchronize your component's \"internal states\" with its<br/>\n\t\tproperties in this function. Once you implement this function, all the getset accessors of your component<br/>\n\t\twill not be called during reset operation. Which means that only the properties with default value<br/>\n\t\twill be reset by editor.\n\t\t\n\t\tThis function is only called in editor mode.\n\t\t!#zh\n\t\tonRestore 是用户在检查器菜单点击 Reset 时，对此组件执行撤消操作后调用的。<br/>\n\t\t<br/>\n\t\t如果组件包含了“内部状态”（不在 CCClass 属性中定义的临时成员变量），那么你可能需要实现该方法。<br/>\n\t\t<br/>\n\t\t编辑器执行撤销/重做操作时，将调用组件的 get set 来录制和还原组件的状态。\n\t\t然而，在极端的情况下，它可能无法良好运作。<br/>\n\t\t那么你就应该实现这个方法，手动根据组件的属性同步“内部状态”。\n\t\t一旦你实现这个方法，当用户撤销或重做时，组件的所有 get set 都不会再被调用。\n\t\t这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>\n\t\t<br/>\n\t\t同样的，编辑可能无法在极端情况下正确地重置您的组件。<br/>\n\t\t于是如果你需要支持组件重置菜单，你需要在该方法中手工同步组件属性到“内部状态”。<br/>\n\t\t一旦你实现这个方法，组件的所有 get set 都不会在重置操作时被调用。\n\t\t这意味着仅仅指定了默认值的属性将被编辑器重置。\n\t\t<br/>\n\t\t此方法仅在编辑器下会被调用。 \n\t\t*/\n\t\tonRestore() : void;\t\t\n\t\t/** !#en\n\t\tSchedules a custom selector.<br/>\n\t\tIf the selector is already scheduled, then the interval parameter will be updated without scheduling it again.\n\t\t!#zh\n\t\t调度一个自定义的回调函数。<br/>\n\t\t如果回调函数已调度，那么将不会重复调度它，只会更新时间间隔参数。\n\t\t@param callback The callback function\n\t\t@param interval Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use scheduleUpdate() instead.\n\t\t@param repeat The selector will be executed (repeat + 1) times, you can use kCCRepeatForever for tick infinitely.\n\t\t@param delay The amount of time that the first tick will wait before execution.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar timeCallback = function (dt) {\n\t\t  cc.log(\"time: \" + dt);\n\t\t}\n\t\tthis.schedule(timeCallback, 1);\n\t\t``` \n\t\t*/\n\t\tschedule(callback : Function, interval? : number, repeat? : number, delay? : number) : void;\t\t\n\t\t/** !#en Schedules a callback function that runs only once, with a delay of 0 or larger.\n\t\t!#zh 调度一个只运行一次的回调函数，可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。\n\t\t@param callback A function wrapped as a selector\n\t\t@param delay The amount of time that the first tick will wait before execution.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar timeCallback = function (dt) {\n\t\t  cc.log(\"time: \" + dt);\n\t\t}\n\t\tthis.scheduleOnce(timeCallback, 2);\n\t\t``` \n\t\t*/\n\t\tscheduleOnce(callback : Function, delay? : number) : void;\t\t\n\t\t/** !#en Unschedules a custom callback function.\n\t\t!#zh 取消调度一个自定义的回调函数。\n\t\t@param callback_fn A function wrapped as a selector\n\t\t\n\t\t@example \n\t\t```js\n\t\tthis.unschedule(_callback);\n\t\t``` \n\t\t*/\n\t\tunschedule(callback_fn : Function) : void;\t\t\n\t\t/** !#en\n\t\tunschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>\n\t\tActions are not affected by this method.\n\t\t!#zh 取消调度所有已调度的回调函数：定制的回调函数以及 'update' 回调函数。动作不受此方法影响。\n\t\t\n\t\t@example \n\t\t```js\n\t\tthis.unscheduleAllCallbacks();\n\t\t``` \n\t\t*/\n\t\tunscheduleAllCallbacks() : void;\t\n\t}\t\t\n\t\t/** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.\n\t\t!#zh EditBox 组件，用于获取用户的输入文本。 */\n\t\texport class EditBox extends _RendererUnderSG {\t\t\n\t\t/** !#en Input string of EditBox.\n\t\t!#zh 输入框的初始输入内容，如果为空则会显示占位符的文本。 */\n\t\tstring : string;\t\t\n\t\t/** !#en The background image of EditBox.\n\t\t!#zh 输入框的背景图片 */\n\t\tbackGroundImage : SpriteFrame;\t\t\n\t\t/** !#en\n\t\tThe return key type of EditBox.\n\t\tNote: it is meaningless for web platforms and desktop platforms.\n\t\t!#zh\n\t\t指定移动设备上面回车按钮的样式。\n\t\t注意：这个选项对 web 平台与 desktop 平台无效。 */\n\t\treturnType : EditBox.KeyboardReturnType;\t\t\n\t\t/** !#en Set the input flags that are to be applied to the EditBox.\n\t\t!#zh 指定输入标志位，可以指定输入方式为密码或者单词首字母大写。 */\n\t\tinputFlag : EditBox.InputFlag;\t\t\n\t\t/** !#en\n\t\tSet the input mode of the edit box.\n\t\tIf you pass ANY, it will create a multiline EditBox.\n\t\t!#zh\n\t\t指定输入模式: ANY表示多行输入，其它都是单行输入，移动平台上还可以指定键盘样式。 */\n\t\tinputMode : EditBox.InputMode;\t\t\n\t\t/** !#en Font size of the input text.\n\t\t!#zh 输入框文本的字体大小 */\n\t\tfontSize : number;\t\t\n\t\t/** !#en Change the lineHeight of displayed text.\n\t\t!#zh 输入框文本的行高。 */\n\t\tlineHeight : number;\t\t\n\t\t/** !#en Font color of the input text.\n\t\t!#zh 输入框文本的颜色。 */\n\t\tfontColor : Color;\t\t\n\t\t/** !#en The display text of placeholder.\n\t\t!#zh 输入框占位符的文本内容。 */\n\t\tplaceholder : string;\t\t\n\t\t/** !#en The font size of placeholder.\n\t\t!#zh 输入框占位符的字体大小。 */\n\t\tplaceholderFontSize : number;\t\t\n\t\t/** !#en The font color of placeholder.\n\t\t!#zh 输入框最大允许输入的字符个数。 */\n\t\tplaceholderFontColor : Color;\t\t\n\t\t/** !#en The maximize input length of EditBox.\n\t\t!#zh 输入框最大允许输入的字符个数。 */\n\t\tmaxLength : number;\t\t\n\t\t/** !#en The event handler to be called when EditBox began to edit text.\n\t\t!#zh 开始编辑文本输入框触发的事件回调。 */\n\t\teditingDidBegin : Component.EventHandler;\t\t\n\t\t/** !#en The event handler to be called when EditBox text changes.\n\t\t!#zh 编辑文本输入框时触发的事件回调。 */\n\t\ttextChanged : Component.EventHandler;\t\t\n\t\t/** !#en The event handler to be called when EditBox edit ends.\n\t\t!#zh 结束编辑文本输入框时触发的事件回调。 */\n\t\teditingDidEnded : Component.EventHandler;\t\n\t}\t\t\n\t\t/** !#en The Label Component.\n\t\t!#zh 文字标签组件 */\n\t\texport class Label extends _RendererUnderSG {\t\t\n\t\t/** !#en Content string of label.\n\t\t!#zh 标签显示的文本内容。 */\n\t\tstring : string;\t\t\n\t\t/** !#en Horizontal Alignment of label.\n\t\t!#zh 文本内容的水平对齐方式。 */\n\t\thorizontalAlign : Label.TextAlignment;\t\t\n\t\t/** !#en Vertical Alignment of label.\n\t\t!#zh 文本内容的垂直对齐方式。 */\n\t\tverticalAlign : Label.VerticalTextAlignment;\t\t\n\t\t/** !#en Font size of label.\n\t\t!#zh 文本字体大小。 */\n\t\tfontSize : number;\t\t\n\t\t/** !#en Line Height of label.\n\t\t!#zh 文本行高。 */\n\t\tlineHeight : number;\t\t\n\t\t/** !#en Overflow of label.\n\t\t!#zh 文字显示超出范围时的处理方式。 */\n\t\toverflow : Label.Overflow;\t\t\n\t\t/** !#en Whether auto wrap label when string width is large than label width.\n\t\t!#zh 是否自动换行。 */\n\t\tenableWrapText : boolean;\t\t\n\t\t/** !#en The font of label.\n\t\t!#zh 文本字体。 */\n\t\tfont : cc.Font;\t\t\n\t\t/** !#en Whether use system font name or not.\n\t\t!#zh 是否使用系统字体。 */\n\t\tisSystemFontUsed : boolean;\t\n\t}\t\t\n\t\t/** !#en Outline effect used to change the display, only used for TTF font\n\t\t!#zh 描边效果组件,用于字体描边,只能用于系统字体 */\n\t\texport class LabelOutline extends Component {\t\t\n\t\t/** !#en Change the outline color\n\t\t!#zh 改变描边的颜色 */\n\t\tcolor : Color;\t\t\n\t\t/** !#en Change the outline width\n\t\t!#zh 改变描边的宽度 */\n\t\twidth : number;\t\n\t}\t\t\n\t\t/** !#en The Layout is a container component, use it to arrange child elements easily.\n\t\t!#zh Layout 组件相当于一个容器，能自动对它的所有子节点进行统一排版。 */\n\t\texport class Layout extends Component {\t\t\n\t\t/** !#en The layout type.\n\t\t!#zh 布局类型 */\n\t\ttype : Layout.Type;\t\t\n\t\t/** !#en\n\t\tThe are three resize modes for Layout.\n\t\tNone, resize Container and resize children.\n\t\t!#zh 缩放模式 */\n\t\tresizeMode : Layout.ResizeMode;\t\t\n\t\t/** !#en The cell size for grid layout.\n\t\t!#zh 每个格子的大小，只有布局类型为 GRID 的时候才有效。 */\n\t\tcellSize : Size;\t\t\n\t\t/** !#en\n\t\tThe start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,\n\t\tand then break line on demand. Choose vertical if you want to layout vertically at first .\n\t\t!#zh 起始轴方向类型，可进行水平和垂直布局排列，只有布局类型为 GRID 的时候才有效。 */\n\t\tstartAxis : Layout.AxisDirection;\t\t\n\t\t/** !#en The padding of layout, it only effect the layout in one direction.\n\t\t!#zh 容器内边距，只会在布局方向上生效。 */\n\t\tpadding : number;\t\t\n\t\t/** !#en The distance in x-axis between each element in layout.\n\t\t!#zh 子节点之间的水平间距。 */\n\t\tspacingX : number;\t\t\n\t\t/** !#en The distance in y-axis between each element in layout.\n\t\t!#zh 子节点之间的垂直间距。 */\n\t\tspacingY : number;\t\t\n\t\t/** !#en\n\t\tOnly take effect in Vertical layout mode.\n\t\tThis option changes the start element's positioning.\n\t\t!#zh 垂直排列子节点的方向。 */\n\t\tverticalDirection : Layout.VerticalDirection;\t\t\n\t\t/** !#en\n\t\tOnly take effect in Horizontal layout mode.\n\t\tThis option changes the start element's positioning.\n\t\t!#zh 水平排列子节点的方向。 */\n\t\thorizontalDirection : Layout.HorizontalDirection;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Mask extends _RendererInSG {\t\n\t}\t\t\n\t\t/** !#en\n\t\tVisual indicator of progress in some operation.\n\t\tDisplays a bar to the user representing how far the operation has progressed.\n\t\t!#zh\n\t\t进度条组件，可用于显示加载资源时的进度。 */\n\t\texport class ProgressBar extends Component {\t\t\n\t\t/** !#en The targeted Sprite which will be changed progressively.\n\t\t!#zh 用来显示进度条比例的 Sprite 对象。 */\n\t\tbarSprite : Sprite;\t\t\n\t\t/** !#en The progress mode, there are two modes supported now: horizontal and vertical.\n\t\t!#zh 进度条的模式 */\n\t\tmode : ProgressBar.Mode;\t\t\n\t\t/** !#en The total width or height of the bar sprite.\n\t\t!#zh 进度条实际的总长度 */\n\t\ttotalLength : number;\t\t\n\t\t/** !#en The current progress of the bar sprite. The valid value is between 0-1.\n\t\t!#zh 当前进度值，该数值的区间是 0-1 之间。 */\n\t\tprogress : number;\t\t\n\t\t/** !#en Whether reverse the progress direction of the bar sprite.\n\t\t!#zh 进度条是否进行反方向变化。 */\n\t\treverse : boolean;\t\n\t}\t\t\n\t\t/** Rendering component in scene graph.\n\t\tMaintains a node which will be the scene graph of component's Node. */\n\t\texport class _RendererInSG extends _SGComponent {\t\n\t}\t\t\n\t\t/** The base rendering component which will attach a leaf node to the cocos2d scene graph. */\n\t\texport class _RendererUnderSG extends _SGComponent {\t\n\t}\t\t\n\t\t/** The base class for all rendering component in scene graph.\n\t\t\n\t\tYou should override:\n\t\t- _createSgNode\n\t\t- _initSgNode */\n\t\texport class _SGComponent extends Component {\t\n\t}\t\t\n\t\t/** !#en\n\t\tThe Scrollbar control allows the user to scroll an image or other view that is too large to see completely\n\t\t!#zh 滚动条组件 */\n\t\texport class Scrollbar extends Component {\t\t\n\t\t/** !#en The \"handle\" part of the scrollbar.\n\t\t!#zh 作为当前滚动区域位置显示的滑块 Sprite。 */\n\t\thandle : cc.Sprite;\t\t\n\t\t/** !#en The direction of scrollbar.\n\t\t!#zh ScrollBar 的滚动方向。 */\n\t\tdirection : Scrollbar.Direction;\t\t\n\t\t/** !#en Whehter enable auto hide or not.\n\t\t!#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */\n\t\tenableAutoHide : boolean;\t\t\n\t\t/** !#en\n\t\tThe time to hide scrollbar when scroll finished.\n\t\tNote: This value is only useful when enableAutoHide is true.\n\t\t!#zh\n\t\t没有滚动动作后经过多久会自动隐藏。\n\t\t注意：只要当 “enableAutoHide” 为 true 时，才有效。 */\n\t\tautoHideTime : number;\t\n\t}\t\t\n\t\t/** !#en\n\t\tLayout container for a view hierarchy that can be scrolled by the user,\n\t\tallowing it to be larger than the physical display.\n\t\t\n\t\t!#zh\n\t\t滚动视图组件 */\n\t\texport class ScrollView extends Component {\t\t\n\t\t/** !#en This is a reference to the UI element to be scrolled.\n\t\t!#zh 可滚动展示内容的节点。 */\n\t\tcontent : Node;\t\t\n\t\t/** !#en Enable horizontal scroll.\n\t\t!#zh 是否开启水平滚动。 */\n\t\thorizontal : boolean;\t\t\n\t\t/** !#en Enable vertical scroll.\n\t\t!#zh 是否开启垂直滚动。 */\n\t\tvertical : boolean;\t\t\n\t\t/** !#en When inertia is set, the content will continue to move when touch ended.\n\t\t!#zh 是否开启滚动惯性。 */\n\t\tinertia : boolean;\t\t\n\t\t/** !#en\n\t\tIt determines how quickly the content stop moving. A value of 1 will stop the movement immediately.\n\t\tA value of 0 will never stop the movement until it reaches to the boundary of scrollview.\n\t\t!#zh\n\t\t开启惯性后，在用户停止触摸后滚动多快停止，0表示永不停止，1表示立刻停止。 */\n\t\tbrake : number;\t\t\n\t\t/** !#en When elastic is set, the content will be bounce back when move out of boundary.\n\t\t!#zh 是否允许滚动内容超过边界，并在停止触摸后回弹。 */\n\t\telastic : boolean;\t\t\n\t\t/** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.\n\t\t!#zh 回弹持续的时间，0 表示将立即反弹。 */\n\t\tbounceDuration : number;\t\t\n\t\t/** !#en The horizontal scrollbar reference.\n\t\t!#zh 水平滚动的 ScrollBar。 */\n\t\thorizontalScrollBar : Scrollbar;\t\t\n\t\t/** !#en The vertical scrollbar reference.\n\t\t!#zh 垂直滚动的 ScrollBar。 */\n\t\tverticalScrollBar : Scrollbar;\t\t\n\t\t/** !#en Scrollview events callback\n\t\t!#zh 滚动视图的事件回调函数 */\n\t\tscrollEvents : Component.EventHandler[];\t\t\n\t\t/** !#en Scroll the content to the bottom boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图底部。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the bottom boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the bottom of the view.\n\t\tscrollView.scrollToBottom(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToBottom(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the top boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图顶部。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the top boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the top of the view.\n\t\tscrollView.scrollToTop(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToTop(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the left boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图左边。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the left boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the left of the view.\n\t\tscrollView.scrollToLeft(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToLeft(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the right boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图右边。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the right boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the right of the view.\n\t\tscrollView.scrollToRight(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToRight(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the top left boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图左上角。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the top left boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the upper left corner of the view.\n\t\tscrollView.scrollToTopLeft(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToTopLeft(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the top right boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图右上角。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the top right boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the top right corner of the view.\n\t\tscrollView.scrollToTopRight(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToTopRight(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the bottom left boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图左下角。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the bottom left boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the lower left corner of the view.\n\t\tscrollView.scrollToBottomLeft(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToBottomLeft(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the bottom right boundary of ScrollView.\n\t\t!#zh 视图内容将在规定时间内滚动到视图右下角。\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the bottom right boundary immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to the lower right corner of the view.\n\t\tscrollView.scrollToBottomRight(0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToBottomRight(timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the\n\t\t      specific offset immediately.\n\t\t!#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传，则立即滚动到指定偏移位置。\n\t\t@param offset A Vec2, the value of which each axis between 0 and maxScrollOffset\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the specific offset of ScrollView immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to middle position in 0.1 second in x-axis\n\t\tvar maxScrollOffset = this.getMaxScrollOffset();\n\t\tscrollView.scrollToOffset(cc.p(maxScrollOffset.x / 2, 0), 0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToOffset(offset : Vec2, timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en  Get the positive offset value corresponds to the content's top left boundary.\n\t\t!#zh  获取滚动视图相对于左上角原点的当前滚动偏移 \n\t\t*/\n\t\tgetScrollOffset() : Vec2;\t\t\n\t\t/** !#en Get the maximize available  scroll offset\n\t\t!#zh 获取滚动视图最大可以滚动的偏移量 \n\t\t*/\n\t\tgetMaxScrollOffset() : Vec2;\t\t\n\t\t/** !#en Scroll the content to the horizontal percent position of ScrollView.\n\t\t!#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。\n\t\t@param percent A value between 0 and 1.\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the horizontal percent position of ScrollView immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Scroll to middle position.\n\t\tscrollView.scrollToBottomRight(0.5, 0.1);\n\t\t``` \n\t\t*/\n\t\tscrollToPercentHorizontal(percent : number, timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the percent position of ScrollView in any direction.\n\t\t!#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动，并且滚动到指定百分比位置上。\n\t\t@param anchor A point which will be clamp between cc.p(0,0) and cc.p(1,1).\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the percent position of ScrollView immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Vertical scroll to the bottom of the view.\n\t\tscrollView.scrollTo(cc.p(0, 1), 0.1);\n\t\t\n\t\t// Horizontal scroll to view right.\n\t\tscrollView.scrollTo(cc.p(1, 0), 0.1);\n\t\t``` \n\t\t*/\n\t\tscrollTo(anchor : Vec2, timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Scroll the content to the vertical percent position of ScrollView.\n\t\t!#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。\n\t\t@param percent A value between 0 and 1.\n\t\t@param timeInSecond Scroll time in second, if you don't pass timeInSecond,\n\t\tthe content will jump to the vertical percent position of ScrollView immediately.\n\t\t@param attenuated Whether the scroll acceleration attenuated, default is true.\n\t\t// Scroll to middle position.\n\t\tscrollView.scrollToPercentVertical(0.5, 0.1); \n\t\t*/\n\t\tscrollToPercentVertical(percent : number, timeInSecond? : number, attenuated? : boolean) : void;\t\t\n\t\t/** !#en Modify the content position.\n\t\t!#zh 设置当前视图内容的坐标点。\n\t\t@param position The position in content's parent space. \n\t\t*/\n\t\tsetContentPosition(position : Vec2) : void;\t\t\n\t\t/** !#en Query the content's position in its parent space.\n\t\t!#zh 获取当前视图内容的坐标点。 \n\t\t*/\n\t\tgetContentPosition() : Position;\t\n\t}\t\t\n\t\t/** !#en Renders a sprite in the scene.\n\t\t!#zh 该组件用于在场景中渲染精灵。 */\n\t\texport class Sprite extends _RendererUnderSG {\t\t\n\t\t/** !#en The sprite frame of the sprite.\n\t\t!#zh 精灵的精灵帧 */\n\t\tspriteFrame : SpriteFrame;\t\t\n\t\t/** !#en The sprite render type.\n\t\t!#zh 精灵渲染类型 */\n\t\ttype : Sprite.SpriteType;\t\t\n\t\t/** !#en\n\t\tThe fill type, This will only have any effect if the \"type\" is set to “cc.Sprite.Type.FILLED”.\n\t\t!#zh\n\t\t精灵填充类型，仅渲染类型设置为 cc.Sprite.SpriteType.FILLED 时有效。 */\n\t\tfillType : Sprite.FillType;\t\t\n\t\t/** !#en\n\t\tThe fill Center, This will only have any effect if the \"type\" is set to “cc.Sprite.Type.FILLED”.\n\t\t!#zh\n\t\t填充中心点，仅渲染类型设置为 cc.Sprite.SpriteType.FILLED 时有效。 */\n\t\tfillCenter : Vec2;\t\t\n\t\t/** !#en\n\t\tThe fill Start, This will only have any effect if the \"type\" is set to “cc.Sprite.Type.FILLED”.\n\t\t!#zh\n\t\t填充起始点，仅渲染类型设置为 cc.Sprite.SpriteType.FILLED 时有效。 */\n\t\tfillStart : number;\t\t\n\t\t/** !#en\n\t\tThe fill Range, This will only have any effect if the \"type\" is set to “cc.Sprite.Type.FILLED”.\n\t\t!#zh\n\t\t填充范围，仅渲染类型设置为 cc.Sprite.SpriteType.FILLED 时有效。 */\n\t\tfillRange : number;\t\t\n\t\t/** !#en specify the frame is trimmed or not.\n\t\t!#zh 是否使用裁剪模式 */\n\t\ttrim : boolean;\t\t\n\t\t/** !#en specify the source Blend Factor.\n\t\t!#zh 指定原图的混合模式 */\n\t\tsrcBlendFactor : BlendFactor;\t\t\n\t\t/** !#en specify the destination Blend Factor.\n\t\t!#zh 指定目标的混合模式 */\n\t\tdstBlendFactor : BlendFactor;\t\t\n\t\t/** !#en specify the size tracing mode.\n\t\t!#zh 精灵尺寸调整模式 */\n\t\tsizeMode : Sprite.SizeMode;\t\t\n\t\t/** !#en Sets whether the sprite is visible or not.\n\t\t!#zh 设置精灵是否可见\n\t\t\n\t\t@example \n\t\t```js\n\t\tsprite.setVisible(false);\n\t\t``` \n\t\t*/\n\t\tsetVisible(visible : boolean) : void;\t\t\n\t\t/** !#en Query the sprite's original size.\n\t\t!#zh 获取精灵原始大小\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar originalSize = sprite.getOriginalSize();\n\t\tcc.log(\"Original Size:\" + originalSize);\n\t\t``` \n\t\t*/\n\t\tgetOriginalSize() : Size;\t\t\n\t\t/** !#en Change the left sprite's cap inset.\n\t\t!#zh 设置精灵左边框-用于九宫格。\n\t\t@param insetLeft The values to use for the cap inset.\n\t\t\n\t\t@example \n\t\t```js\n\t\tsprite.setInsetLeft(5);\n\t\t``` \n\t\t*/\n\t\tsetInsetLeft(insetLeft : number) : void;\t\t\n\t\t/** !#en Query the left sprite's cap inset.\n\t\t!#zh 获取精灵左边框\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar insetLeft = sprite.getInsetLeft();\n\t\tcc.log(\"Inset Left:\" + insetLeft);\n\t\t``` \n\t\t*/\n\t\tgetInsetLeft() : number;\t\t\n\t\t/** !#en Change the top sprite's cap inset.\n\t\t!#zh 设置精灵上边框-用于九宫格。\n\t\t@param insetTop The values to use for the cap inset.\n\t\t\n\t\t@example \n\t\t```js\n\t\tsprite.setInsetTop(5);\n\t\t``` \n\t\t*/\n\t\tsetInsetTop(insetTop : number) : void;\t\t\n\t\t/** !#en Query the top sprite's cap inset.\n\t\t!#zh 获取精灵上边框。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar insetTop = sprite.getInsetTop();\n\t\tcc.log(\"Inset Top:\" + insetTop);\n\t\t``` \n\t\t*/\n\t\tgetInsetTop() : number;\t\t\n\t\t/** !#en Change the right sprite's cap inset.\n\t\t!#zh 设置精灵右边框-用于九宫格。\n\t\t@param insetRight The values to use for the cap inset.\n\t\t\n\t\t@example \n\t\t```js\n\t\tsprite.setInsetRight(5);\n\t\t``` \n\t\t*/\n\t\tsetInsetRight(insetRight : number) : void;\t\t\n\t\t/** !#en Query the right sprite's cap inset.\n\t\t!#zh 获取精灵右边框。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar insetRight = sprite.getInsetRight();\n\t\tcc.log(\"Inset Right:\" + insetRight);\n\t\t``` \n\t\t*/\n\t\tgetInsetRight() : number;\t\t\n\t\t/** !#en Change the bottom sprite's cap inset.\n\t\t!#zh 设置精灵下边框-用于九宫格。\n\t\t@param bottomInset The values to use for the cap inset.\n\t\t\n\t\t@example \n\t\t```js\n\t\tsprite.setInsetBottom(5);\n\t\t``` \n\t\t*/\n\t\tsetInsetBottom(bottomInset : number) : void;\t\t\n\t\t/** !#en Query the bottom sprite's cap inset.\n\t\t!#zh 获取精灵下边框。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar insetBottom = sprite.getInsetBottom();\n\t\tcc.log(\"Inset Bottom:\" + insetBottom);\n\t\t``` \n\t\t*/\n\t\tgetInsetBottom() : number;\t\n\t}\t\t\n\t\t/** !#en A distortion used to change the rendering of simple sprite.If will take effect after sprite component is added.\n\t\t!#zh 扭曲效果组件,用于改变SIMPLE类型sprite的渲染,只有当sprite组件已经添加后,才能起作用. */\n\t\texport class SpriteDistortion extends Component {\t\t\n\t\t/** !#en Change the UV offset for distortion rendering.\n\t\t!#zh 在渲染时改变UV的整体偏移. */\n\t\toffset : Vec2;\t\t\n\t\t/** !#en Change the UV scale for distortion rendering.\n\t\t!#zh 在渲染时改变UV的寻址系数 */\n\t\ttiling : Vec2;\t\n\t}\t\t\n\t\t/** !#en cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game.\n\t\t!#zh Video 组件，用于在游戏中播放视频 */\n\t\texport class VideoPlayer extends _RendererUnderSG {\t\t\n\t\t/** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.\n\t\t!#zh 视频来源：REMOTE 表示远程视频 URL，LOCAL 表示本地视频地址。 */\n\t\tresourceType : VideoPlayer.ResourceType;\t\t\n\t\t/** !#en The remote URL of video.\n\t\t!#zh 远程视频的 URL */\n\t\tremoteURL : string;\t\t\n\t\t/** !#en The local video full path.\n\t\t!#zh 本地视频的 URL */\n\t\tvideo : string;\t\t\n\t\t/** !#en The current time when video start to play.\n\t\t!#zh  从当前时间点开始播放视频 */\n\t\tcurrentTime : Float;\t\t\n\t\t/** !#en Whether keep the aspect ration of the original video.\n\t\t!#zh 是否保持视频原来的宽高比 */\n\t\tkeepAspectRatio : boolean;\t\t\n\t\t/** !#en Whether play video in fullscreen mode.\n\t\t!#zh 是否全屏播放视频 */\n\t\tisFullscreen : boolean;\t\t\n\t\t/** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.\n\t\t!#zh 视频播放回调函数，该回调函数会在特定情况被触发，比如播放中，暂时，停止和完成播放。 */\n\t\tvideoPlayerEvent : cc.Component.EventHandler[];\t\n\t}\t\t\n\t\t/** !#en\n\t\tStores and manipulate the anchoring based on its parent.\n\t\tWidget are used for GUI but can also be used for other things.\n\t\t!#zh\n\t\tWidget 组件，用于设置和适配其相对于父节点的边距，Widget 通常被用于 UI 界面，也可以用于其他地方。 */\n\t\texport class Widget extends Component {\t\t\n\t\t/** !#en Whether to align the top.\n\t\t!#zh 是否对齐上边。 */\n\t\tisAlignTop : boolean;\t\t\n\t\t/** !#en\n\t\tVertically aligns the midpoint, This will open the other vertical alignment options cancel.\n\t\t!#zh\n\t\t是否垂直方向对齐中点，开启此项会将垂直方向其他对齐选项取消。 */\n\t\tisAlignVerticalCenter : boolean;\t\t\n\t\t/** !#en Whether to align the bottom.\n\t\t!#zh 是否对齐下边。 */\n\t\tisAlignBottom : boolean;\t\t\n\t\t/** !#en Whether to align the left.\n\t\t!#zh 是否对齐左边 */\n\t\tisAlignLeft : boolean;\t\t\n\t\t/** !#en\n\t\tHorizontal aligns the midpoint. This will open the other horizontal alignment options canceled.\n\t\t!#zh\n\t\t是否水平方向对齐中点，开启此选项会将水平方向其他对齐选项取消。 */\n\t\tisAlignHorizontalCenter : boolean;\t\t\n\t\t/** !#en Whether to align the right.\n\t\t!#zh 是否对齐右边。 */\n\t\tisAlignRight : boolean;\t\t\n\t\t/** !#en\n\t\tWhether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,\n\t\tthe width setting is invalid (read only).\n\t\t!#zh\n\t\t当前是否水平拉伸。当同时启用左右对齐时，节点将会被水平拉伸，此时节点的宽度只读。 */\n\t\tisStretchWidth : boolean;\t\t\n\t\t/** !#en\n\t\tWhether the stretched vertically, when enable the left and right alignment will be stretched vertically,\n\t\tthen height setting is invalid (read only)\n\t\t!#zh\n\t\t当前是否垂直拉伸。当同时启用上下对齐时，节点将会被垂直拉伸，此时节点的高度只读。 */\n\t\tisStretchHeight : boolean;\t\t\n\t\t/** !#en\n\t\tThe margins between the top of this node and the top of parent node,\n\t\tthe value can be negative, Only available in 'isAlignTop' open.\n\t\t!#zh\n\t\t本节点顶边和父节点顶边的距离，可填写负值，只有在 isAlignTop 开启时才有作用。 */\n\t\ttop : number;\t\t\n\t\t/** !#en\n\t\tThe margins between the bottom of this node and the bottom of parent node,\n\t\tthe value can be negative, Only available in 'isAlignBottom' open.\n\t\t!#zh\n\t\t本节点底边和父节点底边的距离，可填写负值，只有在 isAlignBottom 开启时才有作用。 */\n\t\tbottom : number;\t\t\n\t\t/** !#en\n\t\tThe margins between the left of this node and the left of parent node,\n\t\tthe value can be negative, Only available in 'isAlignLeft' open.\n\t\t!#zh\n\t\t本节点左边和父节点左边的距离，可填写负值，只有在 isAlignLeft 开启时才有作用。 */\n\t\tleft : number;\t\t\n\t\t/** !#en\n\t\tThe margins between the right of this node and the right of parent node,\n\t\tthe value can be negative, Only available in 'isAlignRight' open.\n\t\t!#zh\n\t\t本节点右边和父节点右边的距离，可填写负值，只有在 isAlignRight 开启时才有作用。 */\n\t\tright : number;\t\t\n\t\t/** !#en\n\t\tIf true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.\n\t\t!#zh\n\t\t如果为 true，\"top\" 将会以像素作为边距，否则将会以相对父物体高度的百分比（0 到 1）作为边距。 */\n\t\tisAbsoluteTop : boolean;\t\t\n\t\t/** !#en\n\t\tIf true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.\n\t\t!#zh\n\t\t如果为 true，\"bottom\" 将会以像素作为边距，否则将会以相对父物体高度的百分比（0 到 1）作为边距。 */\n\t\tisAbsoluteBottom : boolean;\t\t\n\t\t/** !#en\n\t\tIf true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.\n\t\t!#zh\n\t\t如果为 true，\"left\" 将会以像素作为边距，否则将会以相对父物体宽度的百分比（0 到 1）作为边距。 */\n\t\tisAbsoluteLeft : boolean;\t\t\n\t\t/** !#en\n\t\tIf true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.\n\t\t!#zh\n\t\t如果为 true，\"right\" 将会以像素作为边距，否则将会以相对父物体宽度的百分比（0 到 1）作为边距。 */\n\t\tisAbsoluteRight : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh\n\t\t开启后仅会在 onEnable 的当帧结束时对齐一次，然后立刻禁用当前组件。\n\t\t这样便于脚本或动画继续控制当前节点。\n\t\t注意：onEnable 时所在的那一帧仍然会进行对齐。 */\n\t\tisAlignOnce : boolean;\t\n\t}\t\t\n\t\t/** !#en\n\t\tEventTarget is an object to which an event is dispatched when something has occurred.\n\t\tEntity are the most common event targets, but other objects can be event targets too.\n\t\t\n\t\tEvent targets are an important part of the Fireball event model.\n\t\tThe event target serves as the focal point for how events flow through the scene graph.\n\t\tWhen an event such as a mouse click or a keypress occurs, Fireball dispatches an event object\n\t\tinto the event flow from the root of the hierarchy. The event object then makes its way through\n\t\tthe scene graph until it reaches the event target, at which point it begins its return trip through\n\t\tthe scene graph. This round-trip journey to the event target is conceptually divided into three phases:\n\t\t- The capture phase comprises the journey from the root to the last node before the event target's node\n\t\t- The target phase comprises only the event target node\n\t\t- The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree\n\t\tSee also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow\n\t\t\n\t\tEvent targets can implement the following methods:\n\t\t - _getCapturingTargets\n\t\t - _getBubblingTargets\n\t\t\n\t\t!#zh\n\t\t事件目标是事件触发时，分派的事件对象，Node 是最常见的事件目标，\n\t\t但是其他对象也可以是事件目标。<br/> */\n\t\texport class EventTarget {\t\t\n\t\t/** !#en\n\t\tRegister an callback of a specific event type on the EventTarget.\n\t\tThis method is merely an alias to addEventListener.\n\t\t!#zh\n\t\t注册事件目标的特定事件类型回调，仅仅是 addEventListener 的别名。\n\t\t@param type A string representing the event type to listen for.\n\t\t@param callback The callback that will be invoked when the event is dispatched.\n\t\t                             The callback is ignored if it is a duplicate (the callbacks are unique).\n\t\t@param target The target to invoke the callback, can be null\n\t\t@param useCapture When set to true, the capture argument prevents callback\n\t\t                             from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.\n\t\t                             When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.\n\t\t                             Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.on(cc.Node.EventType.TOUCH_END, function (event) {\n\t\t    cc.log(\"this is callback\");\n\t\t}, node);\n\t\t``` \n\t\t*/\n\t\ton(type : string, callback: (param: Event) => void, target : any, useCapture : boolean) : Function;\t\t\n\t\t/** !#en\n\t\tRemoves the callback previously registered with the same type, callback, target and or useCapture.\n\t\tThis method is merely an alias to removeEventListener.\n\t\t!#zh\n\t\t删除之前与同类型，回调，目标或 useCapture 注册的回调，仅仅是 removeEventListener 的别名。\n\t\t@param type A string representing the event type being removed.\n\t\t@param callback The callback to remove.\n\t\t@param target The target to invoke the callback, if it's not given, only callback without target will be removed\n\t\t@param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.\n\t\t                             If not specified, useCapture defaults to false. If a callback was registered twice,\n\t\t                             one with capture and one without, each must be removed separately. Removal of a capturing callback\n\t\t                             does not affect a non-capturing version of the same listener, and vice versa.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// register touchEnd eventListener\n\t\tvar touchEnd = node.on(cc.Node.EventType.TOUCH_END, function (event) {\n\t\t    cc.log(\"this is callback\");\n\t\t}, node);\n\t\t// remove touchEnd eventListener\n\t\tnode.off(cc.Node.EventType.TOUCH_END, touchEnd, node);\n\t\t``` \n\t\t*/\n\t\toff(type : string, callback : Function, target : any, useCapture : boolean) : void;\t\t\n\t\t/** !#en Removes all callbacks previously registered with the same target.\n\t\t!#zh 删除指定目标上的所有注册回调。\n\t\t@param target The target to be searched for all related callbacks \n\t\t*/\n\t\ttargetOff(target : any) : void;\t\t\n\t\t/** !#en\n\t\tRegister an callback of a specific event type on the EventTarget,\n\t\tthe callback will remove itself after the first time it is triggered.\n\t\t!#zh\n\t\t注册事件目标的特定事件类型回调，回调会在第一时间被触发后删除自身。\n\t\t@param type A string representing the event type to listen for.\n\t\t@param callback The callback that will be invoked when the event is dispatched.\n\t\t                             The callback is ignored if it is a duplicate (the callbacks are unique).\n\t\t@param target The target to invoke the callback, can be null\n\t\t@param useCapture When set to true, the capture argument prevents callback\n\t\t                             from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.\n\t\t                             When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.\n\t\t                             Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.once(cc.Node.EventType.TOUCH_END, function (event) {\n\t\t    cc.log(\"this is callback\");\n\t\t}, node);\n\t\t``` \n\t\t*/\n\t\tonce(type : string, callback: (param: Event) => void, target : any, useCapture : boolean) : void;\t\t\n\t\t/** !#en\n\t\tDispatches an event into the event flow.\n\t\tThe event target is the EventTarget object upon which the dispatchEvent() method is called.\n\t\t!#zh 分发事件到事件流中。\n\t\t@param event The Event object that is dispatched into the event flow \n\t\t*/\n\t\tdispatchEvent(event : Event) : void;\t\t\n\t\t/** !#en\n\t\tSend an event to this object directly, this method will not propagate the event to any other objects.\n\t\tThe event will be created from the supplied message, you can get the \"detail\" argument from event.detail.\n\t\t!#zh\n\t\t该对象直接发送事件， 这种方法不会对事件传播到任何其他对象。\n\t\t@param message the message to send\n\t\t@param detail whatever argument the message needs \n\t\t*/\n\t\temit(message : string, detail? : any) : void;\t\n\t}\t\t\n\t\t/** !#en Base class of all kinds of events.\n\t\t!#zh 包含事件相关信息的对象。 */\n\t\texport class Event {\t\t\n\t\tconstructor();\t\t\n\t\t/** \n\t\t@param type The name of the event (case-sensitive), e.g. \"click\", \"fire\", or \"submit\"\n\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t*/\n\t\tEvent(type : string, bubbles : boolean) : Event;\t\t\n\t\t/** !#en The name of the event (case-sensitive), e.g. \"click\", \"fire\", or \"submit\".\n\t\t!#zh 事件类型。 */\n\t\ttype : string;\t\t\n\t\t/** !#en Indicate whether the event bubbles up through the tree or not.\n\t\t!#zh 表示该事件是否进行冒泡。 */\n\t\tbubbles : boolean;\t\t\n\t\t/** !#en A reference to the target to which the event was originally dispatched.\n\t\t!#zh 最初事件触发的目标 */\n\t\ttarget : any;\t\t\n\t\t/** !#en A reference to the currently registered target for the event.\n\t\t!#zh 当前目标 */\n\t\tcurrentTarget : any;\t\t\n\t\t/** !#en\n\t\tIndicates which phase of the event flow is currently being evaluated.\n\t\tReturns an integer value represented by 4 constants:\n\t\t - Event.NONE = 0\n\t\t - Event.CAPTURING_PHASE = 1\n\t\t - Event.AT_TARGET = 2\n\t\t - Event.BUBBLING_PHASE = 3\n\t\tThe phases are explained in the [section 3.1, Event dispatch and DOM event flow]\n\t\t(http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.\n\t\t!#zh 事件阶段 */\n\t\teventPhase : number;\t\t\n\t\t/** !#en Reset the event for being stored in the object pool.\n\t\t!#zh 重置对象池中存储的事件。 \n\t\t*/\n\t\tunuse() : string;\t\t\n\t\t/** !#en Reuse the event for being used again by the object pool.\n\t\t!#zh 用于对象池再次使用的事件。 \n\t\t*/\n\t\treuse() : string;\t\t\n\t\t/** !#en Stops propagation for current event.\n\t\t!#zh 停止传递当前事件。 \n\t\t*/\n\t\tstopPropagation() : void;\t\t\n\t\t/** !#en Stops propagation for current event immediately,\n\t\tthe event won't even be dispatched to the listeners attached in the current target.\n\t\t!#zh 立即停止当前事件的传递，事件甚至不会被分派到所连接的当前目标。 \n\t\t*/\n\t\tstopPropagationImmediate() : void;\t\t\n\t\t/** !#en Checks whether the event has been stopped.\n\t\t!#zh 检查该事件是否已经停止传递. \n\t\t*/\n\t\tisStopped() : boolean;\t\t\n\t\t/** !#en\n\t\t<p>\n\t\t    Gets current target of the event                                                            <br/>\n\t\t    note: It only be available when the event listener is associated with node.                <br/>\n\t\t         It returns 0 when the listener is associated with fixed priority.\n\t\t</p>\n\t\t!#zh 获取当前目标节点 \n\t\t*/\n\t\tgetCurrentTarget() : Node;\t\t\n\t\t/** !#en Gets the event type.\n\t\t!#zh 获取事件类型 \n\t\t*/\n\t\tgetType() : string;\t\t\n\t\t/** !#en Code for event without type.\n\t\t!#zh 没有类型的事件 */\n\t\tNO_TYPE : string;\t\t\n\t\t/** !#en Events not currently dispatched are in this phase\n\t\t!#zh 尚未派发事件阶段 */\n\t\tNONE : number;\t\t\n\t\t/** !#en\n\t\tThe capturing phase comprises the journey from the root to the last node before the event target's node\n\t\tsee http://www.w3.org/TR/DOM-Level-3-Events/#event-flow\n\t\t!#zh 捕获阶段，包括事件目标节点之前从根节点到最后一个节点的过程。 */\n\t\tCAPTURING_PHASE : number;\t\t\n\t\t/** !#en\n\t\tThe target phase comprises only the event target node\n\t\tsee http://www.w3.org/TR/DOM-Level-3-Events/#event-flow\n\t\t!#zh 目标阶段仅包括事件目标节点。 */\n\t\tAT_TARGET : number;\t\t\n\t\t/** !#en\n\t\tThe bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy\n\t\tsee http://www.w3.org/TR/DOM-Level-3-Events/#event-flow\n\t\t!#zh 冒泡阶段， 包括回程遇到到层次根节点的任何后续节点。 */\n\t\tBUBBLING_PHASE : number;\t\n\t}\t\t\n\t\t/** !#en\n\t\t<p>\n\t\t    The base class of event listener.                                                                        <br/>\n\t\t    If you need custom listener which with different callback, you need to inherit this class.               <br/>\n\t\t    For instance, you could refer to EventListenerAcceleration, EventListenerKeyboard,                       <br/>\n\t\t     EventListenerTouchOneByOne, EventListenerCustom.\n\t\t</p>\n\t\t\n\t\t!#zh\n\t\t封装用户的事件处理逻辑。\n\t\t注意：这是一个抽象类，开发者不应该直接实例化这个类，请参考 {{#crossLink \"EventListener/create:method\"}}cc.EventListener.create{{/crossLink}}。 */\n\t\texport class EventListener {\t\t\n\t\t/** Constructor \n\t\t*/\n\t\tEventListener(type : number, listenerID : number, callback : number) : EventListner;\t\t\n\t\t/** !#en Checks whether the listener is available.\n\t\t!#zh 检测监听器是否有效 \n\t\t*/\n\t\tcheckAvailable() : boolean;\t\t\n\t\t/** !#en Clones the listener, its subclasses have to override this method.\n\t\t!#zh 克隆监听器,它的子类必须重写此方法。 \n\t\t*/\n\t\tclone() : EventListener;\t\t\n\t\t/** !#en Enables or disables the listener\n\t\t!#zh 启用或禁用监听器。 \n\t\t*/\n\t\tsetEnabled(enabled : boolean) : void;\t\t\n\t\t/** !#en Checks whether the listener is enabled\n\t\t!#zh 检查监听器是否可用。 \n\t\t*/\n\t\tisEnabled() : boolean;\t\t\n\t\t/** !#en The type code of unknown event listener.\n\t\t!#zh 未知的事件监听器类型 */\n\t\tUNKNOWN : number;\t\t\n\t\t/** !#en The type code of keyboard event listener.\n\t\t!#zh 键盘事件监听器类型 */\n\t\tKEYBOARD : number;\t\t\n\t\t/** !#en The type code of focus event listener.\n\t\t!#zh 加速器事件监听器类型 */\n\t\tACCELERATION : number;\t\t\n\t\t/** !#en\n\t\tCreate a EventListener object with configuration including the event type, handlers and other parameters.\n\t\tIn handlers, this refer to the event listener object itself.\n\t\tYou can also pass custom parameters in the configuration object,\n\t\tall custom parameters will be polyfilled into the event listener object and can be accessed in handlers.\n\t\t!#zh 通过指定不同的 Event 对象来设置想要创建的事件监听器。\n\t\t@param argObj a json object\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Create KEYBOARD EventListener.\n\t\tcc.EventListener.create({\n\t\t    event: cc.EventListener.KEYBOARD,\n\t\t    onKeyPressed: function (keyCode, event) {\n\t\t        cc.log('pressed key: ' + keyCode);\n\t\t    },\n\t\t    onKeyReleased: function (keyCode, event) {\n\t\t        cc.log('released key: ' + keyCode);\n\t\t    }\n\t\t});\n\t\t\n\t\t// Create ACCELERATION EventListener.\n\t\tcc.EventListener.create({\n\t\t    event: cc.EventListener.ACCELERATION,\n\t\t    callback: function (acc, event) {\n\t\t        cc.log('acc: ' + keyCode);\n\t\t    }\n\t\t});\n\t\t``` \n\t\t*/\n\t\tcreate(argObj : any) : EventListener;\t\n\t}\t\t\n\t\t/** !#en\n\t\t<p>\n\t\t cc.eventManager is a singleton object which manages event listener subscriptions and event dispatching. <br/>\n\t\t                                                                                                             <br/>\n\t\t The EventListener list is managed in such way so that event listeners can be added and removed          <br/>\n\t\t while events are being dispatched.\n\t\t</p>\n\t\t!#zh\n\t\t事件管理器，它主要管理事件监听器注册和派发系统事件。\n\t\t原始设计中，它支持鼠标，触摸，键盘，陀螺仪和自定义事件。\n\t\t在 Creator 的设计中，鼠标，触摸和自定义事件的监听和派发请参考 http://cocos.com/docs/creator/scripting/events.html。 */\n\t\texport class eventManager {\t\t\n\t\t/** !#en Pauses all listeners which are associated the specified target.\n\t\t!#zh 暂停传入的 node 相关的所有监听器的事件响应。 \n\t\t*/\n\t\tpauseTarget(node : Node, recursive : boolean) : void;\t\t\n\t\t/** !#en Resumes all listeners which are associated the specified target.\n\t\t!#zh 恢复传入的 node 相关的所有监听器的事件响应。 \n\t\t*/\n\t\tresumeTarget(node : Node, recursive : boolean) : void;\t\t\n\t\t/** !#en\n\t\t<p>\n\t\tAdds a event listener for a specified event.<br/>\n\t\tif the parameter \"nodeOrPriority\" is a node,\n\t\tit means to add a event listener for a specified event with the priority of scene graph.<br/>\n\t\tif the parameter \"nodeOrPriority\" is a Number,\n\t\tit means to add a event listener for a specified event with the fixed priority.<br/>\n\t\t</p>\n\t\t!#zh\n\t\t将事件监听器添加到事件管理器中。<br/>\n\t\t如果参数 “nodeOrPriority” 是节点，优先级由 node 的渲染顺序决定，显示在上层的节点将优先收到事件。<br/>\n\t\t如果参数 “nodeOrPriority” 是数字，优先级则固定为该参数的数值，数字越小，优先级越高。<br/>\n\t\t@param listener The listener of a specified event or a object of some event parameters.\n\t\t@param nodeOrPriority The priority of the listener is based on the draw order of this node or fixedPriority The fixed priority of the listener. \n\t\t*/\n\t\taddListener(listener : EventListener|any, nodeOrPriority : Node|number) : EventListener;\t\t\n\t\t/** !#en Remove a listener.\n\t\t!#zh 移除一个已添加的监听器。\n\t\t@param listener an event listener or a registered node target\n\t\t\n\t\t@example \n\t\t```js\n\t\t\n\t\t// 1. remove eventManager add Listener;\n\t\tvar mouseListener1 = cc.eventManager.addListener({\n\t\t    event: cc.EventListener.MOUSE,\n\t\t    onMouseDown:  function(keyCode, event){ },\n\t\t    onMouseUp: function(keyCode, event){ },\n\t\t    onMouseMove: function () { },\n\t\t    onMouseScroll: function () { }\n\t\t}, node);\n\t\t\n\t\tcc.eventManager.removeListener(mouseListener1);\n\t\t\n\t\t// 2. remove eventListener create Listener;\n\t\tvar mouseListener2 = cc.EventListener.create({\n\t\t    event: cc.EventListener.MOUSE,\n\t\t    onMouseDown:  function(keyCode, event){ },\n\t\t    onMouseUp: function(keyCode, event){ },\n\t\t    onMouseMove: function () { },\n\t\t    onMouseScroll: function () { }\n\t\t});\n\t\t\n\t\tcc.eventManager.removeListener(mouseListener2);\n\t\t\n\t\t``` \n\t\t*/\n\t\tremoveListener(listener: (type: number, listenerID: number, callback: number) => void) : void;\t\t\n\t\t/** !#en Removes all listeners with the same event listener type or removes all listeners of a node.\n\t\t!#zh\n\t\t移除注册到 eventManager 中指定类型的所有事件监听器。<br/>\n\t\t1. 如果传入的第一个参数类型是 Node，那么事件管理器将移除与该对象相关的所有事件监听器。\n\t\t（如果第二参数 recursive 是 true 的话，就会连同该对象的子控件上所有的事件监听器也一并移除）<br/>\n\t\t2. 如果传入的第一个参数类型是 Number（该类型 EventListener 中定义的事件类型），\n\t\t那么事件管理器将移除该类型的所有事件监听器。<br/>\n\t\t\n\t\t下列是目前存在监听器类型：       <br/>\n\t\tcc.EventListener.UNKNOWN       <br/>\n\t\tcc.EventListener.KEYBOARD      <br/>\n\t\tcc.EventListener.ACCELERATION，<br/>\n\t\t@param listenerType listenerType or a node \n\t\t*/\n\t\tremoveListeners(listenerType : number|Node, recursive : boolean) : void;\t\t\n\t\t/** !#en Removes all listeners\n\t\t!#zh 移除所有事件监听器。 \n\t\t*/\n\t\tremoveAllListeners() : void;\t\t\n\t\t/** !#en Sets listener's priority with fixed value.\n\t\t!#zh 设置 FixedPriority 类型监听器的优先级。\n\t\t@param listener Constructor \n\t\t*/\n\t\tsetPriority(listener: (type: number, listenerID: number, callback: number) => void, fixedPriority : number) : void;\t\t\n\t\t/** !#en Whether to enable dispatching events\n\t\t!#zh 启用或禁用事件管理器，禁用后不会分发任何事件。 \n\t\t*/\n\t\tsetEnabled(enabled : boolean) : void;\t\t\n\t\t/** !#en Checks whether dispatching events is enabled\n\t\t!#zh 检测事件管理器是否启用。 \n\t\t*/\n\t\tisEnabled() : boolean;\t\n\t}\t\t\n\t\t/** !#en The touch event class\n\t\t!#zh 封装了触摸相关的信息。 */\n\t\texport class Touch {\t\t\n\t\t/** !#en Returns the current touch location in OpenGL coordinates.、\n\t\t!#zh 获取当前触点位置。 \n\t\t*/\n\t\tgetLocation() : Vec2;\t\t\n\t\t/** !#en Returns X axis location value.\n\t\t!#zh 获取当前触点 X 轴位置。 \n\t\t*/\n\t\tgetLocationX() : number;\t\t\n\t\t/** !#en Returns Y axis location value.\n\t\t!#zh 获取当前触点 Y 轴位置。 \n\t\t*/\n\t\tgetLocationY() : number;\t\t\n\t\t/** !#en Returns the previous touch location in OpenGL coordinates.\n\t\t!#zh 获取触点在上一次事件时的位置对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetPreviousLocation() : Vec2;\t\t\n\t\t/** !#en Returns the start touch location in OpenGL coordinates.\n\t\t!#zh 获获取触点落下时的位置对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetStartLocation() : Vec2;\t\t\n\t\t/** !#en Returns the delta distance from the previous touche to the current one in screen coordinates.\n\t\t!#zh 获取触点距离上一次事件移动的距离对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetDelta() : Vec2;\t\t\n\t\t/** !#en Returns the current touch location in screen coordinates.\n\t\t!#zh 获取当前事件在游戏窗口内的坐标位置对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetLocationInView() : Vec2;\t\t\n\t\t/** !#en Returns the previous touch location in screen coordinates.\n\t\t!#zh 获取触点在上一次事件时在游戏窗口中的位置对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetPreviousLocationInView() : Vec2;\t\t\n\t\t/** !#en Returns the start touch location in screen coordinates.\n\t\t!#zh 获取触点落下时在游戏窗口中的位置对象，对象包含 x 和 y 属性。 \n\t\t*/\n\t\tgetStartLocationInView() : Vec2;\t\t\n\t\t/** !#en Returns the id of cc.Touch.\n\t\t!#zh 触点的标识 ID，可以用来在多点触摸中跟踪触点。 \n\t\t*/\n\t\tgetID() : number;\t\t\n\t\t/** !#en Sets information to touch.\n\t\t!#zh 设置触摸相关的信息。用于监控触摸事件。 \n\t\t*/\n\t\tsetTouchInfo(id : number, x : number, y : number) : void;\t\n\t}\t\t\n\t\t/** Loader for resource loading process. It's a singleton object. */\n\t\texport class loader extends Pipeline {\t\t\n\t\t/** The downloader in cc.loader's pipeline, it's by default the first pipe.\n\t\tIt's used to download files with several handlers: pure text, image, script, audio, font, uuid.\n\t\tYou can add your own download function with addDownloadHandlers */\n\t\tdownloader : any;\t\t\n\t\t/** The downloader in cc.loader's pipeline, it's by default the second pipe.\n\t\tIt's used to parse downloaded content with several handlers: JSON, image, plist, fnt, uuid.\n\t\tYou can add your own download function with addLoadHandlers */\n\t\tloader : any;\t\t\n\t\t/** Add custom supported types handler or modify existing type handler for download process.\n\t\t@param extMap Custom supported types with corresponded handler\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.loader.addDownloadHandlers({\n\t\t     // This will match all url with `.scene` extension or all url with `scene` type\n\t\t     'scene' : function (url, callback) {}\n\t\t });\n\t\t``` \n\t\t*/\n\t\taddDownloadHandlers(extMap : any) : void;\t\t\n\t\t/** Add custom supported types handler or modify existing type handler for load process.\n\t\t@param extMap Custom supported types with corresponded handler\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.loader.addLoadHandlers({\n\t\t     // This will match all url with `.scene` extension or all url with `scene` type\n\t\t     'scene' : function (url, callback) {}\n\t\t });\n\t\t``` \n\t\t*/\n\t\taddLoadHandlers(extMap : any) : void;\t\t\n\t\t/** Load resources with a progression callback and a complete callback.\n\t\tThe progression callback is the same as Pipeline's {{#crossLink \"Pipeline/onProgress:method\"}}onProgress{{/crossLink}}\n\t\tThe complete callback is almost the same as Pipeline's {{#crossLink \"Pipeline/onComplete:method\"}}onComplete{{/crossLink}}\n\t\tThe only difference is when user pass a single url as resources, the complete callback will set its result directly as the second parameter.\n\t\t@param resources Url list in an array\n\t\t@param progressCallback Callback invoked when progression change\n\t\t@param completeCallback Callback invoked when all resources loaded\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.loader.load('a.png', function (err, tex) {\n\t\t    cc.log('Result should be a texture: ' + (tex instanceof cc.Texture2D));\n\t\t});\n\t\t\n\t\tcc.loader.load('http://example.com/a.png', function (err, tex) {\n\t\t    cc.log('Should load a texture from external url: ' + (tex instanceof cc.Texture2D));\n\t\t});\n\t\t\n\t\tcc.loader.load({id: 'http://example.com/getImageREST?file=a.png', type: 'png'}, function (err, tex) {\n\t\t    cc.log('Should load a texture from RESTful API by specify the type: ' + (tex instanceof cc.Texture2D));\n\t\t});\n\t\t\n\t\tcc.loader.load(['a.png', 'b.json'], function (errors, results) {\n\t\t    if (errors) {\n\t\t        for (var i = 0; i < errors.length; i++) {\n\t\t            cc.log('Error url [' + errors[i] + ']: ' + results.getError(errors[i]));\n\t\t        }\n\t\t    }\n\t\t    var aTex = results.getContent('a.png');\n\t\t    var bJsonObj = results.getContent('b.json');\n\t\t});\n\t\t``` \n\t\t*/\n\t\tload(resources : string|any[], progressCallback? : Function, completeCallback : Function) : void;\t\t\n\t\t/** Load resources from the \"resources\" folder inside the \"assets\" folder of your project.<br>\n\t\t<br>\n\t\tNote: All asset urls in Creator use forward slashes, urls using backslashes will not work.\n\t\t@param url Url of the target resource.\n\t\t                      The url is relative to the \"resources\" folder, extensions must be omitted.\n\t\t@param type Only asset of type will be loaded if this argument is supplied.\n\t\t@param completeCallback Callback invoked when the resource loaded.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// load the prefab (project/assets/resources/misc/character/cocos) from resources folder\n\t\tcc.loader.loadRes('misc/character/cocos', function (err, prefab) {\n\t\t    if (err) {\n\t\t        cc.error(err.message || err);\n\t\t        return;\n\t\t    }\n\t\t    cc.log('Result should be a prefab: ' + (prefab instanceof cc.Prefab));\n\t\t});\n\t\t\n\t\t// load the sprite frame (project/assets/resources/imgs/cocos.png/cocos) from resources folder\n\t\tcc.loader.loadRes('imgs/cocos', cc.SpriteFrame, function (err, spriteFrame) {\n\t\t    if (err) {\n\t\t        cc.error(err.message || err);\n\t\t        return;\n\t\t    }\n\t\t    cc.log('Result should be a sprite frame: ' + (spriteFrame instanceof cc.SpriteFrame));\n\t\t});\n\t\t``` \n\t\t*/\n\t\tloadRes(url : string, type? : Function, completeCallback: (error: Error, resource: any) => void) : void;\t\t\n\t\t/** Load all assets in a folder inside the \"assets/resources\" folder of your project.<br>\n\t\t<br>\n\t\tNote: All asset urls in Creator use forward slashes, urls using backslashes will not work.\n\t\t@param url Url of the target folder.\n\t\t                      The url is relative to the \"resources\" folder, extensions must be omitted.\n\t\t@param type Only asset of type will be loaded if this argument is supplied.\n\t\t@param completeCallback A callback which is called when all assets have been loaded, or an error occurs.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// load the texture (resources/imgs/cocos.png) and sprite frame (resources/imgs/cocos.png/cocos)\n\t\tcc.loader.loadResAll('imgs/cocos', function (err, assets) {\n\t\t    if (err) {\n\t\t        cc.error(err);\n\t\t        return;\n\t\t    }\n\t\t    var texture = assets[0];\n\t\t    var spriteFrame = assets[1];\n\t\t});\n\t\t\n\t\t// load all textures in \"resources/imgs/\"\n\t\tcc.loader.loadResAll('imgs', cc.Texture2D, function (err, textures) {\n\t\t    if (err) {\n\t\t        cc.error(err);\n\t\t        return;\n\t\t    }\n\t\t    var texture1 = textures[0];\n\t\t    var texture2 = textures[1];\n\t\t});\n\t\t``` \n\t\t*/\n\t\tloadResAll(url : string, type? : Function, completeCallback: (error: Error, assets: any[]) => void) : void;\t\t\n\t\t/** Get resource data by id. <br>\n\t\tWhen you load resources with {{#crossLink \"loader/load:method\"}}{{/crossLink}} or {{#crossLink \"loader/loadRes:method\"}}{{/crossLink}},\n\t\tthe url will be the unique identity of the resource.\n\t\tAfter loaded, you can acquire them by passing the url to this API. \n\t\t*/\n\t\tgetRes(url : string) : any;\t\t\n\t\t/** Returns an item in pipeline. \n\t\t*/\n\t\tgetItem() : LoadingItem;\t\t\n\t\t/** Release the cache of resource by url. \n\t\t*/\n\t\trelease(url : string) : void;\t\t\n\t\t/** Release the loaded cache of asset. \n\t\t*/\n\t\treleaseAsset(asset : Asset) : void;\t\t\n\t\t/** Release the cache of resource which loaded by {{#crossLink \"loader/loadRes:method\"}}{{/crossLink}}. \n\t\t*/\n\t\treleaseRes(url : string) : void;\t\t\n\t\t/** Resource cache of all resources. \n\t\t*/\n\t\treleaseAll() : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tLoadingItems is the manager of items in pipeline.</br>\n\t\tIt hold a map of items, each entry in the map is a url to object key value pair.</br>\n\t\tEach item always contains the following property:</br>\n\t\t- id: The identification of the item, usually it's identical to url</br>\n\t\t- url: The url </br>\n\t\t- type: The type, it's the extension name of the url by default, could be specified manually too.</br>\n\t\t- error: The error happened in pipeline will be stored in this property.</br>\n\t\t- content: The content processed by the pipeline, the final result will also be stored in this property.</br>\n\t\t- complete: The flag indicate whether the item is completed by the pipeline.</br>\n\t\t- states: An object stores the states of each pipe the item go through, the state can be: Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE</br>\n\t\t</br>\n\t\tItem can hold other custom properties.\n\t\t!#zh\n\t\tLoadingItems 负责管理 pipeline 中的对象</br>\n\t\t它有一个 map 属性用来存放加载项，在 map 对象中已 url 为 key 值。</br>\n\t\t每个对象都会包含下列属性：</br>\n\t\t- id：该对象的标识，通常与 url 相同。</br>\n\t\t- url：路径 </br>\n\t\t- type: 类型，它这是默认的 URL 的扩展名，可以手动指定赋值。</br>\n\t\t- error：pipeline 中发生的错误将被保存在这个属性中。</br>\n\t\t- content: pipeline 中处理的内容时，最终的结果也将被存储在这个属性中。</br>\n\t\t- complete：该标志表明该对象是否通过 pipeline 完成。</br>\n\t\t- states：该对象存储每个管道中对象经历的状态，状态可以是 Pipeline.ItemState.WORKING | Pipeline.ItemState.ERROR | Pipeline.ItemState.COMPLETE</br>\n\t\t</br>\n\t\t对象可容纳其他自定义属性。 */\n\t\texport class LoadingItems extends CallbacksInvoker {\t\t\n\t\t/** !#en The map of all items.\n\t\t!#zh 存储所有加载项的对象。 */\n\t\tmap : any;\t\t\n\t\t/** !#en The map of completed items.\n\t\t!#zh 存储已经完成的加载项。 */\n\t\tcompleted : any;\t\t\n\t\t/** !#en Total count of all items.\n\t\t!#zh 所有加载项的总数。 */\n\t\ttotalCount : number;\t\t\n\t\t/** !#en Total count of completed items.\n\t\t!#zh 所有完成加载项的总数。 */\n\t\tcompletedCount : number;\t\t\n\t\t/** !#en Check whether all items are completed.\n\t\t!#zh 检查是否所有加载项都已经完成。 \n\t\t*/\n\t\tisCompleted() : boolean;\t\t\n\t\t/** !#en Check whether an item is completed.\n\t\t!#zh 通过 id 检查指定加载项是否已经加载完成。\n\t\t@param id The item's id. \n\t\t*/\n\t\tisItemCompleted(id : string) : boolean;\t\t\n\t\t/** !#en Check whether an item exists.\n\t\t!#zh 通过 id 检查加载项是否存在。\n\t\t@param id The item's id. \n\t\t*/\n\t\texists(id : string) : boolean;\t\t\n\t\t/** !#en Returns the content of an internal item.\n\t\t!#zh 通过 id 获取指定对象的内容。\n\t\t@param id The item's id. \n\t\t*/\n\t\tgetContent(id : string) : any;\t\t\n\t\t/** !#en Returns the error of an internal item.\n\t\t!#zh 通过 id 获取指定对象的错误信息。\n\t\t@param id The item's id. \n\t\t*/\n\t\tgetError(id : string) : any;\t\t\n\t\t/** !#en Add a listener for an item, the callback will be invoked when the item is completed.\n\t\t!#zh 监听加载项（通过 key 指定）的完成事件。\n\t\t@param callback can be null\n\t\t@param target can be null \n\t\t*/\n\t\taddListener(key : string, callback : Function, target : any) : boolean;\t\t\n\t\t/** !#en\n\t\tCheck if the specified key has any registered callback. </br>\n\t\tIf a callback is also specified, it will only return true if the callback is registered.\n\t\t!#zh\n\t\t检查指定的加载项是否有完成事件监听器。</br>\n\t\t如果同时还指定了一个回调方法，并且回调有注册，它只会返回 true。 \n\t\t*/\n\t\thasListener(key : string, callback? : Function, target? : any) : boolean;\t\t\n\t\t/** !#en\n\t\tRemoves a listener. </br>\n\t\tIt will only remove when key, callback, target all match correctly.\n\t\t!#zh\n\t\t移除指定加载项已经注册的完成事件监听器。</br>\n\t\t只会删除 key, callback, target 均匹配的监听器。 \n\t\t*/\n\t\tremove(key : string, callback : Function, target : any) : boolean;\t\t\n\t\t/** !#en\n\t\tRemoves all callbacks registered in a certain event\n\t\ttype or all callbacks registered with a certain target.\n\t\t!#zh 删除指定目标的所有完成事件监听器。\n\t\t@param key The event key to be removed or the target to be removed \n\t\t*/\n\t\tremoveAllListeners(key : string|any) : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tA pipeline describes a sequence of manipulations, each manipulation is called a pipe.</br>\n\t\tIt's designed for loading process. so items should be urls, and the url will be the identity of each item during the process.</br>\n\t\tA list of items can flow in the pipeline and it will output the results of all pipes.</br>\n\t\tThey flow in the pipeline like water in tubes, they go through pipe by pipe separately.</br>\n\t\tFinally all items will flow out the pipeline and the process is finished.\n\t\t\n\t\t!#zh\n\t\tpipeline 描述了一系列的操作，每个操作都被称为 pipe。</br>\n\t\t它被设计来做加载过程的流程管理。所以 item 应该是 url，并且该 url 将是在处理中的每个 item 的身份标识。</br>\n\t\t一个 item 列表可以在 pipeline 中流动，它将输出加载项经过所有 pipe 之后的结果。</br>\n\t\t它们穿过 pipeline 就像水在管子里流动，将会按顺序流过每个 pipe。</br>\n\t\t最后当所有加载项都流出 pipeline 时，整个加载流程就结束了。 */\n\t\texport class Pipeline {\t\t\n\t\t/** !#en\n\t\tConstructor, pass an array of pipes to construct a new Pipeline,\n\t\tthe pipes will be chained in the given order.</br>\n\t\tA pipe is an object which must contain an `id` in string and a `handle` function,\n\t\tthe id must be unique in the pipeline.</br>\n\t\tIt can also include `async` property to identify whether it's an asynchronous process.\n\t\t!#zh\n\t\t构造函数，通过一系列的 pipe 来构造一个新的 pipeline，pipes 将会在给定的顺序中被锁定。</br>\n\t\t一个 pipe 就是一个对象，它包含了字符串类型的 ‘id’ 和 ‘handle’ 函数，在 pipeline 中 id 必须是唯一的。</br>\n\t\t它还可以包括 ‘async’ 属性以确定它是否是一个异步过程。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar pipeline = new Pipeline([\n\t\t     {\n\t\t         id: 'Downloader',\n\t\t         handle: function (item, callback) {},\n\t\t         async: true\n\t\t     },\n\t\t     {id: 'Parser', handle: function (item) {}, async: false}\n\t\t ]);\n\t\t``` \n\t\t*/\n\t\tPipeline(pipes : any[]) : void;\t\t\n\t\t/** !#en\n\t\tInsert a new pipe at the given index of the pipeline. </br>\n\t\tA pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.\n\t\t!#zh\n\t\t在给定的索引位置插入一个新的 pipe。</br>\n\t\t一个 pipe 必须包含一个字符串类型的 ‘id’ 和 ‘handle’ 函数，该 id 在 pipeline 必须是唯一标识。\n\t\t@param pipe The pipe to be inserted\n\t\t@param index The index to insert \n\t\t*/\n\t\tinsertPipe(pipe : any, index : number) : void;\t\t\n\t\t/** !#en\n\t\tAdd a new pipe at the end of the pipeline. </br>\n\t\tA pipe must contain an `id` in string and a `handle` function, the id must be unique in the pipeline.\n\t\t!#zh\n\t\t添加一个新的 pipe 到 pipeline 尾部。 </br>\n\t\t该 pipe 必须包含一个字符串类型 ‘id’ 和 ‘handle’ 函数，该 id 在 pipeline 必须是唯一标识。\n\t\t@param pipe The pipe to be appended \n\t\t*/\n\t\tappendPipe(pipe : any) : void;\t\t\n\t\t/** !#en\n\t\tLet new items flow into the pipeline. </br>\n\t\tEach item can be a simple url string or an object,\n\t\tif it's an object, it must contain `id` property. </br>\n\t\tYou can specify its type by `type` property, by default, the type is the extension name in url. </br>\n\t\tBy adding a `skips` property including pipe ids, you can skip these pipe. </br>\n\t\tThe object can contain any supplementary property as you want. </br>\n\t\t!#zh\n\t\t让新的 item 流入 pipeline 中。</br>\n\t\t这里的每个 item 可以是一个简单字符串类型的 url 或者是一个对象,\n\t\t如果它是一个对象的话，他必须要包含 ‘id’ 属性。</br>\n\t\t你也可以指定它的 ‘type’ 属性类型，默认情况下，该类型是 ‘url’ 的后缀名。</br>\n\t\t也通过添加一个 包含 ‘skips’ 属性的 item 对象，你就可以跳过 skips 中包含的 pipe。</br>\n\t\t该对象可以包含任何附加属性。\n\t\t\n\t\t@example \n\t\t```js\n\t\tpipeline.flowIn([\n\t\t     'res/Background.png',\n\t\t     {\n\t\t         id: 'res/scene.json',\n\t\t         type: 'scene',\n\t\t         name: 'scene',\n\t\t         skips: ['Downloader']\n\t\t     }\n\t\t ]);\n\t\t``` \n\t\t*/\n\t\tflowIn(urlList : any[]) : any[];\t\t\n\t\t/** !#en\n\t\tLet new items flow into the pipeline and give a callback when the list of items are all completed. </br>\n\t\tThis is for loading dependencies for an existing item in flow, usually used in a pipe logic. </br>\n\t\tFor example, we have a loader for scene configuration file in JSON, the scene will only be fully loaded  </br>\n\t\tafter all its dependencies are loaded, then you will need to use function to flow in all dependencies  </br>\n\t\tfound in the configuration file, and finish the loader pipe only after all dependencies are loaded (in the callback).\n\t\t!#zh\n\t\t让新 items 流入 pipeline 并且当 item 列表完成时进行回调函数。</br>\n\t\t这个 API 的使用通常是为了加载依赖项。</br>\n\t\t例如：</br>\n\t\t我们需要加载一个场景配置的 JSON 文件，该场景会将所有的依赖项全部都加载完毕以后，进行回调表示加载完毕。 \n\t\t*/\n\t\tflowInDeps(urlList : any[], callback : Function) : any[];\t\t\n\t\t/** !#en\n\t\tCopy the item states from one source item to all destination items. </br>\n\t\tIt's quite useful when a pipe generate new items from one source item,</br>\n\t\tthen you should flowIn these generated items into pipeline, </br>\n\t\tbut you probably want them to skip all pipes the source item already go through,</br>\n\t\tyou can achieve it with this API. </br>\n\t\t</br>\n\t\tFor example, an unzip pipe will generate more items, but you won't want them to pass unzip or download pipe again.\n\t\t!#zh\n\t\t从一个源 item 向所有目标 item 复制它的 pipe 状态，用于避免重复通过部分 pipe。</br>\n\t\t当一个源 item 生成了一系列新的 items 时很有用，</br>\n\t\t你希望让这些新的依赖项进入 pipeline，但是又不希望它们通过源 item 已经经过的 pipe，</br>\n\t\t但是你可能希望他们源 item 已经通过并跳过所有 pipes，</br>\n\t\t这个时候就可以使用这个 API。\n\t\t@param srcItem The source item\n\t\t@param dstItems A single destination item or an array of destination items \n\t\t*/\n\t\tcopyItemStates(srcItem : any, dstItems : any[]|any) : void;\t\t\n\t\t/** !#en Returns whether the pipeline is flowing (contains item) currently.\n\t\t!#zh 获取 pipeline 当前是否正在处理中。 \n\t\t*/\n\t\tisFlowing() : boolean;\t\t\n\t\t/** !#en Returns all items in pipeline.\n\t\t!#zh 获取 pipeline 中的所有 items。 \n\t\t*/\n\t\tgetItems() : LoadingItems;\t\t\n\t\t/** !#en Returns an item in pipeline.\n\t\t!#zh 获取指定 item。 \n\t\t*/\n\t\tgetItem() : LoadingItems;\t\t\n\t\t/** !#en Removes an item in pipeline, no matter it's in progress or completed.\n\t\t!#zh 移除指定 item，无论是进行时还是已完成。 \n\t\t*/\n\t\tremoveItem() : boolean;\t\t\n\t\t/** !#en Clear the current pipeline, this function will clean up the items.\n\t\t!#zh 清空当前 pipeline，该函数将清理 items。 \n\t\t*/\n\t\tclear() : void;\t\t\n\t\t/** !#en This is a callback which will be invoked while an item flow out the pipeline, you should overwrite this function.\n\t\t!#zh 这个回调函数将在 item 流出 pipeline 时被调用，你应该重写该函数。\n\t\t@param completedCount The number of the items that are already completed.\n\t\t@param totalCount The total number of the items.\n\t\t@param item The latest item which flow out the pipeline.\n\t\t\n\t\t@example \n\t\t```js\n\t\tpipeline.onProgress = function (completedCount, totalCount, item) {\n\t\t     var progress = (100 * completedCount / totalCount).toFixed(2);\n\t\t     cc.log(progress + '%');\n\t\t }\n\t\t``` \n\t\t*/\n\t\tonProgress(completedCount : number, totalCount : number, item : any) : void;\t\t\n\t\t/** !#en This is a callback which will be invoked while all items flow out the pipeline,\n\t\tyou should overwirte this function.\n\t\t!#zh 该函数将在所有 item 流出 pipeline 时被调用，你应该重写该函数。\n\t\t@param error All errored urls will be stored in this array, if no error happened, then it will be null\n\t\t@param items All items.\n\t\t\n\t\t@example \n\t\t```js\n\t\tpipeline.onComplete = function (error, items) {\n\t\t     if (error)\n\t\t         cc.log('Completed with ' + error.length + ' errors');\n\t\t     else\n\t\t         cc.log('Completed ' + items.totalCount + ' items');\n\t\t }\n\t\t``` \n\t\t*/\n\t\tonComplete(error : any[], items : LoadingItems) : void;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class _ComponentAttributes {\t\t\n\t\tconstructor();\t\t\n\t\t/** Automatically add required component as a dependency. */\n\t\trequireComponent : Component;\t\t\n\t\t/** If specified to a type, prevents Component of the same type (or subtype) to be added more than once to a Node. */\n\t\tdisallowMultiple : Component;\t\t\n\t\t/** The menu path to register a component to the editors \"Component\" menu. Eg. \"Rendering/Camera\". */\n\t\tmenu : string;\t\t\n\t\t/** Makes a component execute in edit mode.\n\t\tBy default, all components are only executed in play mode,\n\t\twhich means they will not have their callback functions executed while the Editor is in edit mode. */\n\t\texecuteInEditMode : boolean;\t\t\n\t\t/** This property is only available if executeInEditMode is true.\n\t\tIf specified, the editor's scene view will keep updating this node in 60 fps when it is selected,\n\t\totherwise, it will update only if necessary. */\n\t\tplayOnFocus : boolean;\t\t\n\t\t/** Specifying the url of the custom html to draw the component in inspector. */\n\t\tinspector : string;\t\t\n\t\t/** Specifying the url of the icon to display in inspector. */\n\t\ticon : string;\t\t\n\t\t/** The custom documentation URL */\n\t\thelp : string;\t\n\t}\t\t\n\t\t/** <p>\n\t\t This class manages all events of input. include: touch, mouse, accelerometer, keyboard                                       <br/>\n\t\t</p> */\n\t\texport class inputManager {\t\t\n\t\t/**  \n\t\t*/\n\t\thandleTouchesBegin(touches : any[]) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\thandleTouchesMove(touches : any[]) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\thandleTouchesEnd(touches : any[]) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\thandleTouchesCancel(touches : any[]) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetSetOfTouchesEndOrCancel(touches : any[]) : any[];\t\t\n\t\t/**  \n\t\t*/\n\t\tgetHTMLElementPosition(element : HTMLElement) : any;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetPreTouch(touch : Touch) : Touch;\t\t\n\t\t/**  \n\t\t*/\n\t\tsetPreTouch(touch : Touch) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetTouchByXY(tx : number, ty : number, pos : Vec2) : Touch;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetTouchByXY(location : Vec2, pos : Vec2, eventType : number) : Event.EventMouse;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetPointByEvent(event : Touch, pos : Vec2) : Vec2;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetTouchesByEvent(event : Touch, pos : Vec2) : any[];\t\t\n\t\t/**  \n\t\t*/\n\t\tregisterSystemEvent(element : HTMLElement) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tupdate(dt : number) : void;\t\n\t}\t\n\t/** Key map for keyboard event */\n\texport enum KEY {\t\t\n\t\tnone = 0,\n\t\tback = 0,\n\t\tmenu = 0,\n\t\tbackspace = 0,\n\t\ttab = 0,\n\t\tenter = 0,\n\t\tshift = 0,\n\t\tctrl = 0,\n\t\talt = 0,\n\t\tpause = 0,\n\t\tcapslock = 0,\n\t\tescape = 0,\n\t\tspace = 0,\n\t\tpageup = 0,\n\t\tpagedown = 0,\n\t\tend = 0,\n\t\thome = 0,\n\t\tleft = 0,\n\t\tup = 0,\n\t\tright = 0,\n\t\tdown = 0,\n\t\tselect = 0,\n\t\tinsert = 0,\n\t\tDelete = 0,\n\t\ta = 0,\n\t\tb = 0,\n\t\tc = 0,\n\t\td = 0,\n\t\te = 0,\n\t\tf = 0,\n\t\tg = 0,\n\t\th = 0,\n\t\ti = 0,\n\t\tj = 0,\n\t\tk = 0,\n\t\tl = 0,\n\t\tm = 0,\n\t\tn = 0,\n\t\to = 0,\n\t\tp = 0,\n\t\tq = 0,\n\t\tr = 0,\n\t\ts = 0,\n\t\tt = 0,\n\t\tu = 0,\n\t\tv = 0,\n\t\tw = 0,\n\t\tx = 0,\n\t\ty = 0,\n\t\tz = 0,\n\t\tnum0 = 0,\n\t\tnum1 = 0,\n\t\tnum2 = 0,\n\t\tnum3 = 0,\n\t\tnum4 = 0,\n\t\tnum5 = 0,\n\t\tnum6 = 0,\n\t\tnum7 = 0,\n\t\tnum8 = 0,\n\t\tnum9 = 0,\n\t\t'*' = 0,\n\t\t'+' = 0,\n\t\t'-' = 0,\n\t\tnumdel = 0,\n\t\t'/' = 0,\n\t\tf1 = 0,\n\t\tf2 = 0,\n\t\tf3 = 0,\n\t\tf4 = 0,\n\t\tf5 = 0,\n\t\tf6 = 0,\n\t\tf7 = 0,\n\t\tf8 = 0,\n\t\tf9 = 0,\n\t\tf10 = 0,\n\t\tf11 = 0,\n\t\tf12 = 0,\n\t\tnumlock = 0,\n\t\tscrolllock = 0,\n\t\t';' = 0,\n\t\tsemicolon = 0,\n\t\tequal = 0,\n\t\t'=' = 0,\n\t\t',' = 0,\n\t\tcomma = 0,\n\t\tdash = 0,\n\t\t'.' = 0,\n\t\tperiod = 0,\n\t\tforwardslash = 0,\n\t\tgrave = 0,\n\t\t'[' = 0,\n\t\topenbracket = 0,\n\t\tbackslash = 0,\n\t\t']' = 0,\n\t\tclosebracket = 0,\n\t\tquote = 0,\n\t\tdpadLeft = 0,\n\t\tdpadRight = 0,\n\t\tdpadUp = 0,\n\t\tdpadDown = 0,\n\t\tdpadCenter = 0,\t\n\t}\t\n\t/** Image formats */\n\texport enum ImageFormat {\t\t\n\t\tJPG = 0,\n\t\tPNG = 0,\n\t\tTIFF = 0,\n\t\tWEBP = 0,\n\t\tPVR = 0,\n\t\tETC = 0,\n\t\tS3TC = 0,\n\t\tATITC = 0,\n\t\tTGA = 0,\n\t\tRAWDATA = 0,\n\t\tUNKNOWN = 0,\n\t\tgetImageFormatByData = 0,\t\n\t}\t\n\t/** Predefined constants */\n\texport enum Macro {\t\t\n\t\tINVALID_INDEX = 0,\n\t\tNODE_TAG_INVALID = 0,\n\t\tPI = 0,\n\t\tPI2 = 0,\n\t\tFLT_MAX = 0,\n\t\tFLT_MIN = 0,\n\t\tRAD = 0,\n\t\tDEG = 0,\n\t\tUINT_MAX = 0,\n\t\tREPEAT_FOREVER = 0,\n\t\tFLT_EPSILON = 0,\n\t\tONE = 0,\n\t\tZERO = 0,\n\t\tSRC_ALPHA = 0,\n\t\tSRC_ALPHA_SATURATE = 0,\n\t\tSRC_COLOR = 0,\n\t\tDST_ALPHA = 0,\n\t\tDST_COLOR = 0,\n\t\tONE_MINUS_SRC_ALPHA = 0,\n\t\tONE_MINUS_SRC_COLOR = 0,\n\t\tONE_MINUS_DST_ALPHA = 0,\n\t\tONE_MINUS_DST_COLOR = 0,\n\t\tONE_MINUS_CONSTANT_ALPHA = 0,\n\t\tONE_MINUS_CONSTANT_COLOR = 0,\n\t\tLINEAR = 0,\n\t\tBLEND_DST = 0,\n\t\tWEB_ORIENTATION_PORTRAIT = 0,\n\t\tWEB_ORIENTATION_LANDSCAPE_LEFT = 0,\n\t\tWEB_ORIENTATION_PORTRAIT_UPSIDE_DOWN = 0,\n\t\tWEB_ORIENTATION_LANDSCAPE_RIGHT = 0,\n\t\tORIENTATION_PORTRAIT = 0,\n\t\tORIENTATION_LANDSCAPE = 0,\n\t\tORIENTATION_AUTO = 0,\n\t\tVERTEX_ATTRIB_FLAG_NONE = 0,\n\t\tVERTEX_ATTRIB_FLAG_POSITION = 0,\n\t\tVERTEX_ATTRIB_FLAG_COLOR = 0,\n\t\tVERTEX_ATTRIB_FLAG_TEX_COORDS = 0,\n\t\tVERTEX_ATTRIB_FLAG_POS_COLOR_TEX = 0,\n\t\tGL_ALL = 0,\n\t\tVERTEX_ATTRIB_POSITION = 0,\n\t\tVERTEX_ATTRIB_COLOR = 0,\n\t\tVERTEX_ATTRIB_TEX_COORDS = 0,\n\t\tVERTEX_ATTRIB_MAX = 0,\n\t\tUNIFORM_PMATRIX = 0,\n\t\tUNIFORM_MVMATRIX = 0,\n\t\tUNIFORM_MVPMATRIX = 0,\n\t\tUNIFORM_TIME = 0,\n\t\tUNIFORM_SINTIME = 0,\n\t\tUNIFORM_COSTIME = 0,\n\t\tUNIFORM_RANDOM01 = 0,\n\t\tUNIFORM_SAMPLER = 0,\n\t\tUNIFORM_MAX = 0,\n\t\tSHADER_POSITION_TEXTURECOLOR = 0,\n\t\tSHADER_POSITION_TEXTURECOLORALPHATEST = 0,\n\t\tSHADER_POSITION_COLOR = 0,\n\t\tSHADER_POSITION_TEXTURE = 0,\n\t\tSHADER_POSITION_TEXTURE_UCOLOR = 0,\n\t\tSHADER_POSITION_TEXTUREA8COLOR = 0,\n\t\tSHADER_POSITION_UCOLOR = 0,\n\t\tSHADER_POSITION_LENGTHTEXTURECOLOR = 0,\n\t\tUNIFORM_PMATRIX_S = 0,\n\t\tUNIFORM_MVMATRIX_S = 0,\n\t\tUNIFORM_MVPMATRIX_S = 0,\n\t\tUNIFORM_TIME_S = 0,\n\t\tUNIFORM_SINTIME_S = 0,\n\t\tUNIFORM_COSTIME_S = 0,\n\t\tUNIFORM_RANDOM01_S = 0,\n\t\tUNIFORM_SAMPLER_S = 0,\n\t\tUNIFORM_ALPHA_TEST_VALUE_S = 0,\n\t\tATTRIBUTE_NAME_COLOR = 0,\n\t\tATTRIBUTE_NAME_POSITION = 0,\n\t\tATTRIBUTE_NAME_TEX_COORD = 0,\n\t\tITEM_SIZE = 0,\n\t\tCURRENT_ITEM = 0,\n\t\tZOOM_ACTION_TAG = 0,\n\t\tNORMAL_TAG = 0,\n\t\tSELECTED_TAG = 0,\n\t\tDISABLE_TAG = 0,\n\t\tFIX_ARTIFACTS_BY_STRECHING_TEXEL = 0,\n\t\tDIRECTOR_STATS_POSITION = 0,\n\t\tDIRECTOR_FPS_INTERVAL = 0,\n\t\tCOCOSNODE_RENDER_SUBPIXEL = 0,\n\t\tSPRITEBATCHNODE_RENDER_SUBPIXEL = 0,\n\t\tAUTO_PREMULTIPLIED_ALPHA_FOR_PNG = 0,\n\t\tOPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA = 0,\n\t\tTEXTURE_ATLAS_USE_TRIANGLE_STRIP = 0,\n\t\tTEXTURE_ATLAS_USE_VAO = 0,\n\t\tUSE_LA88_LABELS = 0,\n\t\tSPRITE_DEBUG_DRAW = 0,\n\t\tLABELBMFONT_DEBUG_DRAW = 0,\n\t\tLABELATLAS_DEBUG_DRAW = 0,\n\t\tENABLE_STACKABLE_ACTIONS = 0,\n\t\tENABLE_GL_STATE_CACHE = 0,\n\t\tBLEND_SRC = 0,\n\t\tlerp = 0,\n\t\trand = 0,\n\t\trandomMinus1To1 = 0,\n\t\trandom0To1 = 0,\n\t\tdegreesToRadians = 0,\n\t\tradiansToDegrees = 0,\n\t\tnodeDrawSetup = 0,\n\t\tincrementGLDraws = 0,\n\t\tcheckGLErrorDebug = 0,\t\n\t}\t\t\n\t\t/** The base class of most of all the objects in Fireball. */\n\t\texport class Object {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en The name of the object.\n\t\t!#zh 该对象的名称。 */\n\t\tname : string;\t\t\n\t\t/** !#en Indicates whether the object is not yet destroyed.\n\t\t!#zh 表示该对象是否可用（被销毁后将不可用）。 */\n\t\tisValid : boolean;\t\t\n\t\t/** !#en\n\t\tDestroy this Object, and release all its own references to other objects.<br/>\n\t\t<br/>\n\t\tAfter destroy, this CCObject is not usable any more.<br/>\n\t\tYou can use cc.isValid(obj) (or obj.isValid if obj is non-nil) to check whether the object is destroyed before\n\t\taccessing it.\n\t\t!#zh\n\t\t销毁该对象，并释放所有它对其它对象的引用。<br/>\n\t\t销毁后，CCObject 不再可用。<br/>\n\t\t您可以在访问对象之前使用 cc.isValid(obj)（或 obj.isValid 如果 obj 不为 null）来检查对象是否已被销毁。\n\t\t\n\t\t@example \n\t\t```js\n\t\tobj.destroy();\n\t\t``` \n\t\t*/\n\t\tdestroy() : boolean;\t\n\t}\t\t\n\t\t/** Bit mask that controls object states. */\n\t\texport class Flags {\t\t\n\t\t/** !#en The object will not be saved.\n\t\t!#zh 该对象将不会被保存。 */\n\t\tDontSave : number;\t\t\n\t\t/** !#en The object will not be saved when building a player.\n\t\t!#zh 构建项目时，该对象将不会被保存。 */\n\t\tEditorOnly : number;\t\n\t}\t\t\n\t\t/** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.\n\t\tIt's invalid on safari, QQbrowser and android browser */\n\t\texport class screen {\t\t\n\t\t/** initialize \n\t\t*/\n\t\tinit() : void;\t\t\n\t\t/** return true if it's full now. \n\t\t*/\n\t\tfullScreen() : boolean;\t\t\n\t\t/** change the screen to full mode. \n\t\t*/\n\t\trequestFullScreen(element : Element, onFullScreenChange : Function) : void;\t\t\n\t\t/** exit the full mode. \n\t\t*/\n\t\texitFullScreen() : boolean;\t\t\n\t\t/** Automatically request full screen with a touch/click event \n\t\t*/\n\t\tautoFullScreen(element : Element, onFullScreenChange : Function) : void;\t\n\t}\t\t\n\t\t/** System variables */\n\t\texport class sys {\t\t\n\t\t/** English language code */\n\t\tLANGUAGE_ENGLISH : string;\t\t\n\t\t/** Chinese language code */\n\t\tLANGUAGE_CHINESE : string;\t\t\n\t\t/** French language code */\n\t\tLANGUAGE_FRENCH : string;\t\t\n\t\t/** Italian language code */\n\t\tLANGUAGE_ITALIAN : string;\t\t\n\t\t/** German language code */\n\t\tLANGUAGE_GERMAN : string;\t\t\n\t\t/** Spanish language code */\n\t\tLANGUAGE_SPANISH : string;\t\t\n\t\t/** Spanish language code */\n\t\tLANGUAGE_DUTCH : string;\t\t\n\t\t/** Russian language code */\n\t\tLANGUAGE_RUSSIAN : string;\t\t\n\t\t/** Korean language code */\n\t\tLANGUAGE_KOREAN : string;\t\t\n\t\t/** Japanese language code */\n\t\tLANGUAGE_JAPANESE : string;\t\t\n\t\t/** Hungarian language code */\n\t\tLANGUAGE_HUNGARIAN : string;\t\t\n\t\t/** Portuguese language code */\n\t\tLANGUAGE_PORTUGUESE : string;\t\t\n\t\t/** Arabic language code */\n\t\tLANGUAGE_ARABIC : string;\t\t\n\t\t/** Norwegian language code */\n\t\tLANGUAGE_NORWEGIAN : string;\t\t\n\t\t/** Polish language code */\n\t\tLANGUAGE_POLISH : string;\t\t\n\t\t/** Unknown language code */\n\t\tLANGUAGE_UNKNOWN : string;\t\t\n\t\tOS_IOS : string;\t\t\n\t\tOS_ANDROID : string;\t\t\n\t\tOS_WINDOWS : string;\t\t\n\t\tOS_MARMALADE : string;\t\t\n\t\tOS_LINUX : string;\t\t\n\t\tOS_BADA : string;\t\t\n\t\tOS_BLACKBERRY : string;\t\t\n\t\tOS_OSX : string;\t\t\n\t\tOS_WP8 : string;\t\t\n\t\tOS_WINRT : string;\t\t\n\t\tOS_UNKNOWN : string;\t\t\n\t\tUNKNOWN : number;\t\t\n\t\tWIN32 : number;\t\t\n\t\tLINUX : number;\t\t\n\t\tMACOS : number;\t\t\n\t\tANDROID : number;\t\t\n\t\tIOS : number;\t\t\n\t\tIPAD : number;\t\t\n\t\tBLACKBERRY : number;\t\t\n\t\tNACL : number;\t\t\n\t\tEMSCRIPTEN : number;\t\t\n\t\tTIZEN : number;\t\t\n\t\tWINRT : number;\t\t\n\t\tWP8 : number;\t\t\n\t\tMOBILE_BROWSER : number;\t\t\n\t\tDESKTOP_BROWSER : number;\t\t\n\t\t/** Indicates whether executes in editor's window process (Electron's renderer context) */\n\t\tEDITOR_PAGE : number;\t\t\n\t\t/** Indicates whether executes in editor's main process (Electron's browser context) */\n\t\tEDITOR_CORE : number;\t\t\n\t\t/** BROWSER_TYPE_WECHAT */\n\t\tBROWSER_TYPE_WECHAT : string;\t\t\n\t\tBROWSER_TYPE_ANDROID : string;\t\t\n\t\tBROWSER_TYPE_IE : string;\t\t\n\t\tBROWSER_TYPE_QQ : string;\t\t\n\t\tBROWSER_TYPE_MOBILE_QQ : string;\t\t\n\t\tBROWSER_TYPE_UC : string;\t\t\n\t\tBROWSER_TYPE_360 : string;\t\t\n\t\tBROWSER_TYPE_BAIDU_APP : string;\t\t\n\t\tBROWSER_TYPE_BAIDU : string;\t\t\n\t\tBROWSER_TYPE_MAXTHON : string;\t\t\n\t\tBROWSER_TYPE_OPERA : string;\t\t\n\t\tBROWSER_TYPE_OUPENG : string;\t\t\n\t\tBROWSER_TYPE_MIUI : string;\t\t\n\t\tBROWSER_TYPE_FIREFOX : string;\t\t\n\t\tBROWSER_TYPE_SAFARI : string;\t\t\n\t\tBROWSER_TYPE_CHROME : string;\t\t\n\t\tBROWSER_TYPE_LIEBAO : string;\t\t\n\t\tBROWSER_TYPE_QZONE : string;\t\t\n\t\tBROWSER_TYPE_SOUGOU : string;\t\t\n\t\tBROWSER_TYPE_UNKNOWN : string;\t\t\n\t\t/** Is native ? This is set to be true in jsb auto. */\n\t\tisNative : boolean;\t\t\n\t\t/** Is web browser ? */\n\t\tisBrowser : boolean;\t\t\n\t\t/** Indicate whether system is mobile system */\n\t\tisMobile : boolean;\t\t\n\t\t/** Indicate the running platform */\n\t\tplatform : number;\t\t\n\t\t/** Indicate the current language of the running system */\n\t\tlanguage : string;\t\t\n\t\t/** Indicate the running os name */\n\t\tos : string;\t\t\n\t\t/** Indicate the running browser type */\n\t\tbrowserType : string;\t\t\n\t\t/** Indicate the running browser version */\n\t\tbrowserVersion : number;\t\t\n\t\t/** Indicate the real pixel resolution of the whole game window */\n\t\twindowPixelResolution : number;\t\t\n\t\t/** cc.sys.localStorage is a local storage component. */\n\t\tlocalStorage : any;\t\t\n\t\t/** The capabilities of the current platform */\n\t\tcapabilities : any;\t\t\n\t\t/** Forces the garbage collection, only available in JSB \n\t\t*/\n\t\tgarbageCollect() : void;\t\t\n\t\t/** Dumps rooted objects, only available in JSB \n\t\t*/\n\t\tdumpRoot() : void;\t\t\n\t\t/** Restart the JS VM, only available in JSB \n\t\t*/\n\t\trestartVM() : void;\t\t\n\t\t/** Clean a script in the JS VM, only available in JSB \n\t\t*/\n\t\tcleanScript(jsfile : string) : void;\t\t\n\t\t/** Check whether an object is valid,\n\t\tIn web engine, it will return true if the object exist\n\t\tIn native engine, it will return true if the JS object and the correspond native object are both valid \n\t\t*/\n\t\tisObjectValid(obj : any) : boolean;\t\t\n\t\t/** Dump system informations \n\t\t*/\n\t\tdump() : void;\t\t\n\t\t/** Open a url in browser \n\t\t*/\n\t\topenURL(url : string) : void;\t\n\t}\t\t\n\t\t/** cc.view is the singleton object which represents the game window.<br/>\n\t\tIt's main task include: <br/>\n\t\t - Apply the design resolution policy<br/>\n\t\t - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>\n\t\t - Manage the game view port which can be different with the window<br/>\n\t\t - Manage the content scale and translation<br/>\n\t\t<br/>\n\t\tSince the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>\n\t\tthe standard way to use it is by calling:<br/>\n\t\t - cc.view.methodName(); <br/> */\n\t\texport class View {\t\t\n\t\t/** <p>\n\t\tSets view's target-densitydpi for android mobile browser. it can be set to:           <br/>\n\t\t  1. cc.macro.DENSITYDPI_DEVICE, value is \"device-dpi\"                                      <br/>\n\t\t  2. cc.macro.DENSITYDPI_HIGH, value is \"high-dpi\"  (default value)                         <br/>\n\t\t  3. cc.macro.DENSITYDPI_MEDIUM, value is \"medium-dpi\" (browser's default value)            <br/>\n\t\t  4. cc.macro.DENSITYDPI_LOW, value is \"low-dpi\"                                            <br/>\n\t\t  5. Custom value, e.g: \"480\"                                                         <br/>\n\t\t</p> \n\t\t*/\n\t\tsetTargetDensityDPI(densityDPI : string) : void;\t\t\n\t\t/** Returns the current target-densitydpi value of cc.view. \n\t\t*/\n\t\tgetTargetDensityDPI() : string;\t\t\n\t\t/** Sets whether resize canvas automatically when browser's size changed.<br/>\n\t\tUseful only on web.\n\t\t@param enabled Whether enable automatic resize with browser's resize event \n\t\t*/\n\t\tresizeWithBrowserSize(enabled : boolean) : void;\t\t\n\t\t/** Sets the callback function for cc.view's resize action,<br/>\n\t\tthis callback will be invoked before applying resolution policy, <br/>\n\t\tso you can do any additional modifications within the callback.<br/>\n\t\tUseful only on web.\n\t\t@param callback The callback function \n\t\t*/\n\t\tsetResizeCallback(callback : Function|void) : void;\t\t\n\t\t/** Sets the orientation of the game, it can be landscape, portrait or auto.\n\t\tWhen set it to landscape or portrait, and screen w/h ratio doesn't fit,\n\t\tcc.view will automatically rotate the game canvas using CSS.\n\t\tNote that this function doesn't have any effect in native,\n\t\tin native, you need to set the application orientation in native project settings\n\t\t@param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO \n\t\t*/\n\t\tsetOrientation(orientation : number) : void;\t\t\n\t\t/** Sets whether the engine modify the \"viewport\" meta in your web page.<br/>\n\t\tIt's enabled by default, we strongly suggest you not to disable it.<br/>\n\t\tAnd even when it's enabled, you can still set your own \"viewport\" meta, it won't be overridden<br/>\n\t\tOnly useful on web\n\t\t@param enabled Enable automatic modification to \"viewport\" meta \n\t\t*/\n\t\tadjustViewPort(enabled : boolean) : void;\t\t\n\t\t/** Retina support is enabled by default for Apple device but disabled for other devices,<br/>\n\t\tit takes effect only when you called setDesignResolutionPolicy<br/>\n\t\tOnly useful on web\n\t\t@param enabled Enable or disable retina display \n\t\t*/\n\t\tenableRetina(enabled : boolean) : void;\t\t\n\t\t/** Check whether retina display is enabled.<br/>\n\t\tOnly useful on web \n\t\t*/\n\t\tisRetinaEnabled() : boolean;\t\t\n\t\t/** If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>\n\t\tYou can pass true as parameter to enable it and disable it by passing false.<br/>\n\t\tOnly useful on web\n\t\t@param enabled Enable or disable auto full screen on mobile devices \n\t\t*/\n\t\tenableAutoFullScreen(enabled : boolean) : void;\t\t\n\t\t/** Check whether auto full screen is enabled.<br/>\n\t\tOnly useful on web \n\t\t*/\n\t\tisAutoFullScreenEnabled() : boolean;\t\t\n\t\t/** Get whether render system is ready(no matter opengl or canvas),<br/>\n\t\tthis name is for the compatibility with cocos2d-x, subclass must implement this method. \n\t\t*/\n\t\tisViewReady() : boolean;\t\t\n\t\t/** Sets the resolution translate on View. \n\t\t*/\n\t\tsetContentTranslateLeftTop(offsetLeft : number, offsetTop : number) : void;\t\t\n\t\t/** Returns the resolution translate on View \n\t\t*/\n\t\tgetContentTranslateLeftTop() : Size;\t\t\n\t\t/** Returns the frame size of the view.<br/>\n\t\tOn native platforms, it returns the screen size since the view is a fullscreen view.<br/>\n\t\tOn web, it returns the size of the canvas's outer DOM element. \n\t\t*/\n\t\tgetFrameSize() : Size;\t\t\n\t\t/** On native, it sets the frame size of view.<br/>\n\t\tOn web, it sets the size of the canvas's outer DOM element. \n\t\t*/\n\t\tsetFrameSize(width : number, height : number) : void;\t\t\n\t\t/** Returns the visible area size of the view port. \n\t\t*/\n\t\tgetVisibleSize() : Size;\t\t\n\t\t/** Returns the visible area size of the view port. \n\t\t*/\n\t\tgetVisibleSizeInPixel() : Size;\t\t\n\t\t/** Returns the visible origin of the view port. \n\t\t*/\n\t\tgetVisibleOrigin() : Vec2;\t\t\n\t\t/** Returns the visible origin of the view port. \n\t\t*/\n\t\tgetVisibleOriginInPixel() : Vec2;\t\t\n\t\t/** Returns whether developer can set content's scale factor. \n\t\t*/\n\t\tcanSetContentScaleFactor() : boolean;\t\t\n\t\t/** Returns the current resolution policy \n\t\t*/\n\t\tgetResolutionPolicy() : ResolutionPolicy;\t\t\n\t\t/** Sets the current resolution policy \n\t\t*/\n\t\tsetResolutionPolicy(resolutionPolicy : ResolutionPolicy|number) : void;\t\t\n\t\t/** Sets the resolution policy with designed view size in points.<br/>\n\t\tThe resolution policy include: <br/>\n\t\t[1] ResolutionExactFit       Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.<br/>\n\t\t[2] ResolutionNoBorder       Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.<br/>\n\t\t[3] ResolutionShowAll        Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.<br/>\n\t\t[4] ResolutionFixedHeight    Scale the content's height to screen's height and proportionally scale its width<br/>\n\t\t[5] ResolutionFixedWidth     Scale the content's width to screen's width and proportionally scale its height<br/>\n\t\t[cc.ResolutionPolicy]        [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>\n\t\t@param width Design resolution width.\n\t\t@param height Design resolution height.\n\t\t@param resolutionPolicy The resolution policy desired \n\t\t*/\n\t\tsetDesignResolutionSize(width : number, height : number, resolutionPolicy : ResolutionPolicy|number) : void;\t\t\n\t\t/** Returns the designed size for the view.\n\t\tDefault resolution size is the same as 'getFrameSize'. \n\t\t*/\n\t\tgetDesignResolutionSize() : Size;\t\t\n\t\t/** Sets the container to desired pixel resolution and fit the game content to it.\n\t\tThis function is very useful for adaptation in mobile browsers.\n\t\tIn some HD android devices, the resolution is very high, but its browser performance may not be very good.\n\t\tIn this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.\n\t\tBut this API can be helpful to set a desired pixel resolution which is in between.\n\t\tThis API will do the following:\n\t\t    1. Set viewport's width to the desired width in pixel\n\t\t    2. Set body width to the exact pixel resolution\n\t\t    3. The resolution policy will be reset with designed view size in points.\n\t\t@param width Design resolution width.\n\t\t@param height Design resolution height.\n\t\t@param resolutionPolicy The resolution policy desired \n\t\t*/\n\t\tsetRealPixelResolution(width : number, height : number, resolutionPolicy : ResolutionPolicy|number) : void;\t\t\n\t\t/** Sets view port rectangle with points.\n\t\t@param w width\n\t\t@param h height \n\t\t*/\n\t\tsetViewPortInPoints(x : number, y : number, w : number, h : number) : void;\t\t\n\t\t/** Sets Scissor rectangle with points. \n\t\t*/\n\t\tsetScissorInPoints(x : number, y : number, w : number, h : number) : void;\t\t\n\t\t/** Returns whether GL_SCISSOR_TEST is enable \n\t\t*/\n\t\tisScissorEnabled() : boolean;\t\t\n\t\t/** Returns the current scissor rectangle \n\t\t*/\n\t\tgetScissorRect() : Rect;\t\t\n\t\t/** Sets the name of the view \n\t\t*/\n\t\tsetViewName(viewName : string) : void;\t\t\n\t\t/** Returns the name of the view \n\t\t*/\n\t\tgetViewName() : string;\t\t\n\t\t/** Returns the view port rectangle. \n\t\t*/\n\t\tgetViewPortRect() : Rect;\t\t\n\t\t/** Returns scale factor of the horizontal direction (X axis). \n\t\t*/\n\t\tgetScaleX() : number;\t\t\n\t\t/** Returns scale factor of the vertical direction (Y axis). \n\t\t*/\n\t\tgetScaleY() : number;\t\t\n\t\t/** Returns device pixel ratio for retina display. \n\t\t*/\n\t\tgetDevicePixelRatio() : number;\t\t\n\t\t/** Returns the real location in view for a translation based on a related position\n\t\t@param tx The X axis translation\n\t\t@param ty The Y axis translation\n\t\t@param relatedPos The related position object including \"left\", \"top\", \"width\", \"height\" informations \n\t\t*/\n\t\tconvertToLocationInView(tx : number, ty : number, relatedPos : any) : Vec2;\t\n\t}\t\t\n\t\t/** <p>cc.ContainerStrategy class is the root strategy class of container's scale strategy,\n\t\tit controls the behavior of how to scale the cc.container and cc.game.canvas object</p> */\n\t\texport class ContainerStrategy {\t\t\n\t\t/** Manipulation before appling the strategy\n\t\t@param view The target view \n\t\t*/\n\t\tpreApply(view : View) : void;\t\t\n\t\t/** Function to apply this strategy \n\t\t*/\n\t\tapply(view : View, designedResolution : Size) : void;\t\t\n\t\t/** Manipulation after applying the strategy\n\t\t@param view The target view \n\t\t*/\n\t\tpostApply(view : View) : void;\t\n\t}\t\t\n\t\t/** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,\n\t\tit controls the behavior of how to scale the scene and setup the viewport for the game</p> */\n\t\texport class ContentStrategy {\t\t\n\t\t/** Manipulation before applying the strategy\n\t\t@param view The target view \n\t\t*/\n\t\tpreApply(view : View) : void;\t\t\n\t\t/** Function to apply this strategy\n\t\tThe return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},\n\t\tThe target view can then apply these value to itself, it's preferred not to modify directly its private variables \n\t\t*/\n\t\tapply(view : View, designedResolution : Size) : any;\t\t\n\t\t/** Manipulation after applying the strategy\n\t\t@param view The target view \n\t\t*/\n\t\tpostApply(view : View) : void;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class EqualToFrame extends ContainerStrategy {\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class ProportionalToFrame extends ContainerStrategy {\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class EqualToWindow extends EqualToFrame {\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class ProportionalToWindow extends ProportionalToFrame {\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class OriginalContainer extends ContainerStrategy {\t\n\t}\t\t\n\t\t/** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,\n\t\tits main task is to maintain the compatibility with Cocos2d-x</p> */\n\t\texport class ResolutionPolicy {\t\t\n\t\t/** \n\t\t@param containerStg The container strategy\n\t\t@param contentStg The content strategy \n\t\t*/\n\t\tResolutionPolicy(containerStg : ContainerStrategy, contentStg : ContentStrategy) : void;\t\t\n\t\t/** Manipulation before applying the resolution policy\n\t\t@param view The target view \n\t\t*/\n\t\tpreApply(view : View) : void;\t\t\n\t\t/** Function to apply this resolution policy\n\t\tThe return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},\n\t\tThe target view can then apply these value to itself, it's preferred not to modify directly its private variables\n\t\t@param view The target view\n\t\t@param designedResolution The user defined design resolution \n\t\t*/\n\t\tapply(view : View, designedResolution : Size) : any;\t\t\n\t\t/** Manipulation after appyling the strategy\n\t\t@param view The target view \n\t\t*/\n\t\tpostApply(view : View) : void;\t\t\n\t\t/** Setup the container's scale strategy \n\t\t*/\n\t\tsetContainerStrategy(containerStg : ContainerStrategy) : void;\t\t\n\t\t/** Setup the content's scale strategy \n\t\t*/\n\t\tsetContentStrategy(contentStg : ContentStrategy) : void;\t\t\n\t\t/** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>\n\t\tDistortion can occur, and the application may appear stretched or compressed. */\n\t\tEXACT_FIT : number;\t\t\n\t\t/** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>\n\t\twhile maintaining the original aspect ratio of the application. */\n\t\tNO_BORDER : number;\t\t\n\t\t/** The entire application is visible in the specified area without distortion while maintaining the original<br/>\n\t\taspect ratio of the application. Borders can appear on two sides of the application. */\n\t\tSHOW_ALL : number;\t\t\n\t\t/** The application takes the height of the design resolution size and modifies the width of the internal<br/>\n\t\tcanvas so that it fits the aspect ratio of the device<br/>\n\t\tno distortion will occur however you must make sure your application works on different<br/>\n\t\taspect ratios */\n\t\tFIXED_HEIGHT : number;\t\t\n\t\t/** The application takes the width of the design resolution size and modifies the height of the internal<br/>\n\t\tcanvas so that it fits the aspect ratio of the device<br/>\n\t\tno distortion will occur however you must make sure your application works on different<br/>\n\t\taspect ratios */\n\t\tFIXED_WIDTH : number;\t\t\n\t\t/** Unknow policy */\n\t\tUNKNOWN : number;\t\n\t}\t\t\n\t\t/** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,\n\t\tit should represent the same rect as cc.view.getViewportRect() */\n\t\texport class visibleRect {\t\t\n\t\t/** initialize \n\t\t*/\n\t\tinit(visibleRect : Rect) : void;\t\t\n\t\t/** Top left coordinate of the screen related to the game scene. */\n\t\ttopLeft : Vec2;\t\t\n\t\t/** Top right coordinate of the screen related to the game scene. */\n\t\ttopRight : Vec2;\t\t\n\t\t/** Top center coordinate of the screen related to the game scene. */\n\t\ttop : Vec2;\t\t\n\t\t/** Bottom left coordinate of the screen related to the game scene. */\n\t\tbottomLeft : Vec2;\t\t\n\t\t/** Bottom right coordinate of the screen related to the game scene. */\n\t\tbottomRight : Vec2;\t\t\n\t\t/** Bottom center coordinate of the screen related to the game scene. */\n\t\tbottom : Vec2;\t\t\n\t\t/** Center coordinate of the screen related to the game scene. */\n\t\tcenter : Vec2;\t\t\n\t\t/** Left center coordinate of the screen related to the game scene. */\n\t\tleft : Vec2;\t\t\n\t\t/** Right center coordinate of the screen related to the game scene. */\n\t\tright : Vec2;\t\t\n\t\t/** Width of the screen. */\n\t\twidth : number;\t\t\n\t\t/** Height of the screen. */\n\t\theight : number;\t\n\t}\t\t\n\t\t/** The CallbacksHandler is an abstract class that can register and unregister callbacks by key.\n\t\tSubclasses should implement their own methods about how to invoke the callbacks. */\n\t\texport class _CallbacksHandler {\t\t\n\t\tconstructor();\t\t\n\t\t/** \n\t\t@param target can be null \n\t\t*/\n\t\tadd(key : string, callback : Function, target? : any) : boolean;\t\t\n\t\t/** Check if the specified key has any registered callback. If a callback is also specified,\n\t\tit will only return true if the callback is registered. \n\t\t*/\n\t\thas(key : string, callback? : Function, target? : any) : boolean;\t\t\n\t\t/** Removes all callbacks registered in a certain event type or all callbacks registered with a certain target\n\t\t@param key The event key to be removed or the target to be removed \n\t\t*/\n\t\tremoveAll(key : string|any) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tremove(key : string, callback : Function, target : any) : boolean;\t\n\t}\t\t\n\t\t/** !#en The callbacks invoker to handle and invoke callbacks by key.\n\t\t!#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */\n\t\texport class CallbacksInvoker extends _CallbacksHandler {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tinvoke(key : string, p1? : any, p2? : any, p3? : any, p4? : any, p5? : any) : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tinvokeAndRemove(key : string, p1? : any, p2? : any, p3? : any, p4? : any, p5? : any) : void;\t\t\n\t\t/** \n\t\t@param remove remove callbacks after invoked \n\t\t*/\n\t\tbindKey(key : string, remove? : boolean) : Function;\t\n\t}\t\t\n\t\t/** !#en Contains information collected during deserialization\n\t\t!#zh 包含反序列化时的一些信息 */\n\t\texport class Details {\t\t\n\t\tconstructor();\t\t\n\t\t/** list of the depends assets' uuid */\n\t\tuuidList : String[];\t\t\n\t\t/** the obj list whose field needs to load asset by uuid */\n\t\tuuidObjList : any[];\t\t\n\t\t/** the corresponding field name which referenced to the asset */\n\t\tuuidPropList : String[];\t\t\n\t\t/** the corresponding field name which referenced to the raw object */\n\t\trawProp : string;\t\t\n\t\treset() : void;\t\t\n\t\t/**  \n\t\t*/\n\t\tgetUuidOf(obj : any, propName : string) : string;\t\t\n\t\t/**  \n\t\t*/\n\t\tassignAssetsBy(getter : Function) : boolean;\t\t\n\t\t/**  \n\t\t*/\n\t\tpush(obj : any, propName : string, uuid : string) : void;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class url {\t\t\n\t\t/** Returns the url of raw assets, you will only need this if the raw asset is inside the \"resources\" folder.\n\t\t\n\t\t@example \n\t\t```js\n\t\t---\n\t\tvar url = cc.url.raw(\"textures/myTexture.png\");\n\t\tconsole.log(url);   // \"resources/raw/textures/myTexture.png\"\n\t\t\n\t\t``` \n\t\t*/\n\t\traw(url : string) : string;\t\t\n\t\t/** Returns the url of builtin raw assets. This method can only used in editor.\n\t\t\n\t\t@example \n\t\t```js\n\t\t---\n\t\tvar url = cc.url.builtinRaw(\"textures/myTexture.png\");\n\t\tconsole.log(url);   // \"resources/default-raw/textures/myTexture.png\"\n\t\t\n\t\t``` \n\t\t*/\n\t\tbuiltinRaw(url : string) : string;\t\n\t}\t\t\n\t\t/** A cc.SpriteFrame has:<br/>\n\t\t - texture: A cc.Texture2D that will be used by the _ccsg.Sprite<br/>\n\t\t - rectangle: A rectangle of the texture<br/>\n\t\t<br/>\n\t\tYou can modify the frame of a _ccsg.Sprite by doing:<br/> */\n\t\texport class SpriteFrame extends Asset {\t\t\n\t\tconstructor();\t\t\n\t\t/** Constructor of SpriteFrame class\n\t\t@param rotated Whether the frame is rotated in the texture\n\t\t@param offset The offset of the frame in the texture\n\t\t@param originalSize The size of the frame in the texture\n\t\t\n\t\t@example \n\t\t```js\n\t\t// ----------------------------------------------------\n\t\t// 1. Create a cc.SpriteFrame with image path\n\t\tvar url = cc.url.raw('resources/textures/grossini_dance.png');\n\t\tvar frame1 = new cc.SpriteFrame(url, cc.Rect(0, 0, 90, 128));\n\t\t\n\t\t// ----------------------------------------------------\n\t\t// 2. Create a cc.SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.\n\t\tvar url = cc.url.raw('resources/textures/grossini_dance.png');\n\t\tvar texture = cc.textureCache.addImage(url);\n\t\tvar frame1 = new cc.SpriteFrame(texture, cc.Rect(0, 0, 90, 128));\n\t\tvar frame2 = new cc.SpriteFrame(texture, cc.Rect(0, 0, 90, 128), false, 0, cc.Size(90, 128));\n\t\t\n\t\t// ----------------------------------------------------\n\t\t// 3. load a cc.SpriteFrame with image path (Recommend)\n\t\tvar url = 'resources://test assets/PurpleMonster.png/PurpleMonster';\n\t\tvar self = this;\n\t\tcc.loader.load(url, function (err, spriteFrame) {\n\t\t        var node = new cc.Node(\"New Sprite\");\n\t\t        var sprite = node.addComponent(cc.Sprite);\n\t\t        sprite.spriteFrame = spriteFrame;\n\t\t        node.parent = self.node\n\t\t    }\n\t\t);\n\t\t\n\t\t``` \n\t\t*/\n\t\tSpriteFrame(filename? : string|Texture2D, rect? : Rect, rotated? : boolean, offset? : Vec2, originalSize? : Size) : void;\t\t\n\t\t/** Top border of the sprite */\n\t\tinsetTop : number;\t\t\n\t\t/** Bottom border of the sprite */\n\t\tinsetBottom : number;\t\t\n\t\t/** Left border of the sprite */\n\t\tinsetLeft : number;\t\t\n\t\t/** Right border of the sprite */\n\t\tinsetRight : number;\t\t\n\t\t/** Returns whether the texture have been loaded \n\t\t*/\n\t\ttextureLoaded() : boolean;\t\t\n\t\t/** Add a event listener for texture loaded event. \n\t\t*/\n\t\taddLoadedEventListener(callback : Function, target : any) : void;\t\t\n\t\t/** Returns whether the sprite frame is rotated in the texture. \n\t\t*/\n\t\tisRotated() : boolean;\t\t\n\t\t/** Set whether the sprite frame is rotated in the texture. \n\t\t*/\n\t\tsetRotated(bRotated : boolean) : void;\t\t\n\t\t/** Returns the rect of the sprite frame in the texture. \n\t\t*/\n\t\tgetRect() : Rect;\t\t\n\t\t/** Sets the rect of the sprite frame in the texture. \n\t\t*/\n\t\tsetRect(rect : Rect) : void;\t\t\n\t\t/** Returns the original size of the trimmed image. \n\t\t*/\n\t\tgetOriginalSize() : Size;\t\t\n\t\t/** Sets the original size of the trimmed image. \n\t\t*/\n\t\tsetOriginalSize(size : Size) : void;\t\t\n\t\t/** Returns the texture of the frame. \n\t\t*/\n\t\tgetTexture() : Texture2D;\t\t\n\t\t/** Sets the texture of the frame, the texture is retained automatically. \n\t\t*/\n\t\t_refreshTexture(texture : Texture2D) : void;\t\t\n\t\t/** Returns the offset of the frame in the texture. \n\t\t*/\n\t\tgetOffset() : Vec2;\t\t\n\t\t/** Sets the offset of the frame in the texture. \n\t\t*/\n\t\tsetOffset(offsets : Vec2) : void;\t\t\n\t\t/** Clone the sprite frame. \n\t\t*/\n\t\tclone() : SpriteFrame;\t\t\n\t\t/** Initializes SpriteFrame with Texture, rect, rotated, offset and originalSize in pixels.<br/>\n\t\tPlease pass parameters to the constructor to initialize the sprite, do not call this function yourself. \n\t\t*/\n\t\tinitWithTexture(texture : string|Texture2D, rect? : Rect, rotated? : boolean, offset? : Vec2, originalSize? : Size) : boolean;\t\t\n\t\t/** Copy the sprite frame \n\t\t*/\n\t\tcopyWithZone() : SpriteFrame;\t\t\n\t\t/** Copy the sprite frame \n\t\t*/\n\t\tcopy() : SpriteFrame;\t\n\t}\t\t\n\t\t/** <p>\n\t\tThis class allows to easily create OpenGL or Canvas 2D textures from images, text or raw data.                                    <br/>\n\t\tThe created cc.Texture2D object will always have power-of-two dimensions.                                                <br/>\n\t\tDepending on how you create the cc.Texture2D object, the actual image area of the texture might be smaller than the texture dimensions <br/>\n\t\t i.e. \"contentSize\" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0).                                           <br/>\n\t\tBe aware that the content of the generated textures will be upside-down! </p> */\n\t\texport class Texture2D extends RawAsset {\t\t\n\t\t/** Get width in pixels. \n\t\t*/\n\t\tgetPixelWidth() : number;\t\t\n\t\t/** Get height of in pixels. \n\t\t*/\n\t\tgetPixelHeight() : number;\t\t\n\t\t/** Get content size. \n\t\t*/\n\t\tgetContentSize() : Size;\t\t\n\t\t/** Get content size in pixels. \n\t\t*/\n\t\tgetContentSizeInPixels() : Size;\t\t\n\t\t/** Init with HTML element.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar img = new Image();\n\t\timg.src = dataURL;\n\t\ttexture.initWithElement(img);\n\t\ttexture.handleLoadedTexture();\n\t\t``` \n\t\t*/\n\t\tinitWithElement(element : HTMLImageElement|HTMLCanvasElement) : void;\t\t\n\t\t/** Intializes with a texture2d with data. \n\t\t*/\n\t\tinitWithData(data : any[], pixelFormat : number, pixelsWide : number, pixelsHigh : number, contentSize : Size) : boolean;\t\t\n\t\t/** Initializes a texture from a UIImage object.\n\t\tExtensions to make it easy to create a CCTexture2D object from an image file.\n\t\tNote that RGBA type textures will have their alpha premultiplied - use the blending mode (gl.ONE, gl.ONE_MINUS_SRC_ALPHA). \n\t\t*/\n\t\tinitWithImage(uiImage : HTMLImageElement) : boolean;\t\t\n\t\t/** HTMLElement Object getter. \n\t\t*/\n\t\tgetHtmlElementObj() : HTMLImageElement;\t\t\n\t\t/** Check whether texture is loaded. \n\t\t*/\n\t\tisLoaded() : boolean;\t\t\n\t\t/** Handler of texture loaded event. \n\t\t*/\n\t\thandleLoadedTexture(premultiplied? : boolean) : void;\t\t\n\t\t/** Description of cc.Texture2D. \n\t\t*/\n\t\tdescription() : string;\t\t\n\t\t/** Release texture. \n\t\t*/\n\t\treleaseTexture() : void;\t\t\n\t\t/** Pixel format of the texture. \n\t\t*/\n\t\tgetPixelFormat() : number;\t\t\n\t\t/** Whether or not the texture has their Alpha premultiplied,\n\t\tsupport only in WebGl rendering mode. \n\t\t*/\n\t\thasPremultipliedAlpha() : boolean;\t\t\n\t\t/** Whether or not use mipmap, support only in WebGl rendering mode. \n\t\t*/\n\t\thasMipmaps() : boolean;\t\t\n\t\t/** Sets the min filter, mag filter, wrap s and wrap t texture parameters. <br/>\n\t\tIf the texture size is NPOT (non power of 2), then in can only use gl.CLAMP_TO_EDGE in gl.TEXTURE_WRAP_{S,T}.\n\t\t@param texParams texParams object or minFilter \n\t\t*/\n\t\tsetTexParameters(texParams : any|number, magFilter? : number, wrapS? : Texture2D.WrapMode, wrapT? : Texture2D.WrapMode) : void;\t\t\n\t\t/** WebGLTexture Object. */\n\t\tname : WebGLTexture;\t\t\n\t\t/** Pixel format of the texture. */\n\t\tpixelFormat : number;\t\t\n\t\t/** Width in pixels. */\n\t\tpixelWidth : number;\t\t\n\t\t/** Height in pixels. */\n\t\tpixelHeight : number;\t\t\n\t\t/** Content width in points. */\n\t\twidth : number;\t\t\n\t\t/** Content height in points. */\n\t\theight : number;\t\n\t}\t\t\n\t\t/** <p>A class that implements a Texture Atlas. <br />\n\t\tSupported features: <br />\n\t\tThe atlas file can be a PNG, JPG. <br />\n\t\tQuads can be updated in runtime <br />\n\t\tQuads can be added in runtime <br />\n\t\tQuads can be removed in runtime <br />\n\t\tQuads can be re-ordered in runtime <br />\n\t\tThe TextureAtlas capacity can be increased or decreased in runtime.</p> */\n\t\texport class TextureAtlas {\t\t\n\t\tconstructor();\t\t\n\t\t/** <p>Creates a TextureAtlas with an filename and with an initial capacity for Quads. <br />\n\t\tThe TextureAtlas capacity can be increased in runtime. </p>\n\t\tConstructor of cc.TextureAtlas\n\t\t\n\t\t@example \n\t\t```js\n\t\t--------------------------\n\t\t1. //creates a TextureAtlas with  filename\n\t\tvar textureAtlas = new cc.TextureAtlas(\"res/hello.png\", 3);\n\t\t\n\t\t2. //creates a TextureAtlas with texture\n\t\tvar texture = cc.textureCache.addImage(\"hello.png\");\n\t\tvar textureAtlas = new cc.TextureAtlas(texture, 3);\n\t\t\n\t\t``` \n\t\t*/\n\t\tTextureAtlas(fileName : string|Texture2D, capacity : number) : void;\t\t\n\t\t/** Quantity of quads that are going to be drawn. \n\t\t*/\n\t\tgetTotalQuads() : number;\t\t\n\t\t/** Quantity of quads that can be stored with the current texture atlas size. \n\t\t*/\n\t\tgetCapacity() : number;\t\t\n\t\t/** Texture of the texture atlas. \n\t\t*/\n\t\tgetTexture() : Image;\t\t\n\t\t/** Set texture for texture atlas. \n\t\t*/\n\t\tsetTexture(texture : Image) : void;\t\t\n\t\t/** specify if the array buffer of the VBO needs to be updated. \n\t\t*/\n\t\tsetDirty(dirty : boolean) : void;\t\t\n\t\t/** whether or not the array buffer of the VBO needs to be updated. \n\t\t*/\n\t\tisDirty() : boolean;\t\t\n\t\t/** Quads that are going to be rendered. \n\t\t*/\n\t\tgetQuads() : any[];\t\t\n\t\t/**  \n\t\t*/\n\t\tsetQuads(quads : any[]) : void;\t\t\n\t\t/** <p>Initializes a TextureAtlas with a filename and with a certain capacity for Quads.<br />\n\t\tThe TextureAtlas capacity can be increased in runtime.<br />\n\t\tWARNING: Do not reinitialize the TextureAtlas because it will leak memory. </p>\n\t\t\n\t\t@example \n\t\t```js\n\t\t--------------------------------------------------\n\t\tvar textureAtlas = new cc.TextureAtlas();\n\t\ttextureAtlas.initWithTexture(\"hello.png\", 3);\n\t\t\n\t\t``` \n\t\t*/\n\t\tinitWithFile(file : string, capacity : number) : boolean;\t\t\n\t\t/** <p>Initializes a TextureAtlas with a previously initialized Texture2D object, and<br />\n\t\twith an initial capacity for Quads.<br />\n\t\tThe TextureAtlas capacity can be increased in runtime.<br />\n\t\tWARNING: Do not reinitialize the TextureAtlas because it will leak memory</p>\n\t\t\n\t\t@example \n\t\t```js\n\t\t---------------------------\n\t\tvar texture = cc.textureCache.addImage(\"hello.png\");\n\t\tvar textureAtlas = new cc.TextureAtlas();\n\t\ttextureAtlas.initWithTexture(texture, 3);\n\t\t\n\t\t``` \n\t\t*/\n\t\tinitWithTexture(texture : Image, capacity : number) : boolean;\t\t\n\t\t/** <p>Updates a Quad (texture, vertex and color) at a certain index <br />\n\t\tindex must be between 0 and the atlas capacity - 1 </p> \n\t\t*/\n\t\tupdateQuad(quad : V3F_C4B_T2F_Quad, index : number) : void;\t\t\n\t\t/** <p>Inserts a Quad (texture, vertex and color) at a certain index<br />\n\t\tindex must be between 0 and the atlas capacity - 1 </p> \n\t\t*/\n\t\tinsertQuad(quad : V3F_C4B_T2F_Quad, index : number) : void;\t\t\n\t\t/** <p>\n\t\t     Inserts a c array of quads at a given index                                           <br />\n\t\t     index must be between 0 and the atlas capacity - 1                                    <br />\n\t\t     this method doesn't enlarge the array when amount + index > totalQuads                <br />\n\t\t</p> \n\t\t*/\n\t\tinsertQuads(quads : any[], index : number, amount : number) : void;\t\t\n\t\t/** <p>Removes the quad that is located at a certain index and inserts it at a new index <br />\n\t\tThis operation is faster than removing and inserting in a quad in 2 different steps</p> \n\t\t*/\n\t\tinsertQuadFromIndex(fromIndex : number, newIndex : number) : void;\t\t\n\t\t/** <p>Removes a quad at a given index number.<br />\n\t\tThe capacity remains the same, but the total number of quads to be drawn is reduced in 1 </p> \n\t\t*/\n\t\tremoveQuadAtIndex(index : number) : void;\t\t\n\t\t/** Removes a given number of quads at a given index. \n\t\t*/\n\t\tremoveQuadsAtIndex(index : number, amount : number) : void;\t\t\n\t\t/** <p>Removes all Quads. <br />\n\t\tThe TextureAtlas capacity remains untouched. No memory is freed.<br />\n\t\tThe total number of quads to be drawn will be 0</p> \n\t\t*/\n\t\tremoveAllQuads() : void;\t\t\n\t\t/** <p>Resize the capacity of the CCTextureAtlas.<br />\n\t\tThe new capacity can be lower or higher than the current one<br />\n\t\tIt returns YES if the resize was successful. <br />\n\t\tIf it fails to resize the capacity it will return NO with a new capacity of 0. <br />\n\t\tno used for js</p> \n\t\t*/\n\t\tresizeCapacity(newCapacity : number) : boolean;\t\t\n\t\t/** Used internally by CCParticleBatchNode                                    <br/>\n\t\tdon't use this unless you know what you're doing. \n\t\t*/\n\t\tincreaseTotalQuadsWith(amount : number) : void;\t\t\n\t\t/** Moves an amount of quads from oldIndex at newIndex. \n\t\t*/\n\t\tmoveQuadsFromIndex(oldIndex : number, amount : number, newIndex : number) : void;\t\t\n\t\t/** Ensures that after a realloc quads are still empty                                <br/>\n\t\tUsed internally by CCParticleBatchNode. \n\t\t*/\n\t\tfillWithEmptyQuadsFromIndex(index : number, amount : number) : void;\t\t\n\t\t/** <p>Draws n quads from an index (offset). <br />\n\t\tn + start can't be greater than the capacity of the atlas</p> \n\t\t*/\n\t\tdrawNumberOfQuads(n : number, start : number) : void;\t\t\n\t\t/** Indicates whether or not the array buffer of the VBO needs to be updated. */\n\t\tdirty : boolean;\t\t\n\t\t/** Image texture for cc.TextureAtlas. */\n\t\ttexture : Image;\t\t\n\t\t/** Quantity of quads that can be stored with the current texture atlas size. */\n\t\tcapacity : number;\t\t\n\t\t/** Quantity of quads that are going to be drawn. */\n\t\ttotalQuads : number;\t\t\n\t\t/** Quads that are going to be rendered. */\n\t\tquads : any[];\t\n\t}\t\t\n\t\t/** cc.textureCache is a singleton object, it's the global cache for cc.Texture2D */\n\t\texport class textureCache {\t\t\n\t\t/** Description \n\t\t*/\n\t\tdescription() : string;\t\t\n\t\t/** Returns an already created texture. Returns null if the texture doesn't exist.\n\t\t\n\t\t@example \n\t\t```js\n\t\t------------------\n\t\tvar key = cc.textureCache.textureForKey(\"hello.png\");\n\t\t\n\t\t``` \n\t\t*/\n\t\ttextureForKey(textureKeyName : string) : Texture2D;\t\t\n\t\t/** Returns an already created texture. Returns null if the texture doesn't exist.\n\t\t\n\t\t@example \n\t\t```js\n\t\t------------------\n\t\tvar key = cc.textureCache.getTextureForKey(\"hello.png\");\n\t\t\n\t\t``` \n\t\t*/\n\t\tgetTextureForKey(textureKeyName : string) : Texture2D;\t\t\n\t\t/** \n\t\t\n\t\t@example \n\t\t```js\n\t\t---------\n\t\tvar key = cc.textureCache.getKeyByTexture(texture);\n\t\t\n\t\t``` \n\t\t*/\n\t\tgetKeyByTexture(texture : Image) : string;\t\t\n\t\t/** \n\t\t\n\t\t@example \n\t\t```js\n\t\t---------------\n\t\tvar cacheTextureForColor = cc.textureCache.getTextureColors(texture);\n\t\t\n\t\t``` \n\t\t*/\n\t\tgetTextureColors(texture : Image) : any[];\t\t\n\t\t/** <p>Purges the dictionary of loaded textures. <br />\n\t\tCall this method if you receive the \"Memory Warning\"  <br />\n\t\tIn the short term: it will free some resources preventing your app from being killed  <br />\n\t\tIn the medium term: it will allocate more resources <br />\n\t\tIn the long term: it will be the same</p>\n\t\t\n\t\t@example \n\t\t```js\n\t\t--------\n\t\tcc.textureCache.removeAllTextures();\n\t\t\n\t\t``` \n\t\t*/\n\t\tremoveAllTextures() : void;\t\t\n\t\t/** Deletes a texture from the cache given a texture.\n\t\t\n\t\t@example \n\t\t```js\n\t\t-----\n\t\tcc.textureCache.removeTexture(texture);\n\t\t\n\t\t``` \n\t\t*/\n\t\tremoveTexture(texture : Image) : void;\t\t\n\t\t/** Deletes a texture from the cache given a its key name.\n\t\t\n\t\t@example \n\t\t```js\n\t\t------\n\t\tcc.textureCache.removeTexture(\"hello.png\");\n\t\t\n\t\t``` \n\t\t*/\n\t\tremoveTextureForKey(textureKeyName : string) : void;\t\t\n\t\t/** <p>Returns a Texture2D object given an file image <br />\n\t\tIf the file image was not previously loaded, it will create a new Texture2D <br />\n\t\t object and it will return it. It will use the filename as a key.<br />\n\t\tOtherwise it will return a reference of a previously loaded image. <br />\n\t\tSupported image extensions: .png, .jpg, .gif</p>\n\t\t\n\t\t@example \n\t\t```js\n\t\t----\n\t\tcc.textureCache.addImage(\"hello.png\");\n\t\t\n\t\t``` \n\t\t*/\n\t\taddImage(url : string, cb : Function, target : any) : Texture2D;\t\t\n\t\t/** Cache the image data. \n\t\t*/\n\t\tcacheImage(path : string, texture : Image|HTMLImageElement|HTMLCanvasElement) : void;\t\t\n\t\t/** <p>Returns a Texture2D object given an UIImage image<br />\n\t\tIf the image was not previously loaded, it will create a new Texture2D object and it will return it.<br />\n\t\tOtherwise it will return a reference of a previously loaded image<br />\n\t\tThe \"key\" parameter will be used as the \"key\" for the cache.<br />\n\t\tIf \"key\" is null, then a new texture will be created each time.</p> \n\t\t*/\n\t\taddUIImage(image : HTMLImageElement|HTMLCanvasElement, key : string) : Texture2D;\t\n\t}\t\t\n\t\t/** A base node for CCNode and CCEScene, it will:\n\t\t- provide the same api with origin cocos2d rendering node (SGNode)\n\t\t- maintains properties of the internal SGNode\n\t\t- retain and release the SGNode\n\t\t- serialize datas for SGNode (but SGNode itself will not being serialized)\n\t\t- notifications if some properties changed\n\t\t- define some interfaces shares between CCNode and CCEScene */\n\t\texport class _BaseNode extends Object {\t\t\n\t\t/** !#en Name of node.\n\t\t!#zh 该节点名称。 */\n\t\tname : string;\t\t\n\t\t/** !#en The parent of the node.\n\t\t!#zh 该节点的父节点。 */\n\t\tparent : Node;\t\t\n\t\t/** !#en The uuid for editor, will be stripped before building project.\n\t\t!#zh 用于编辑器使用的 uuid，在构建项目之前将会被剔除。 */\n\t\tuuid : string;\t\t\n\t\t/** !#en Skew x\n\t\t!#zh 该节点 Y 轴倾斜角度。 */\n\t\tskewX : number;\t\t\n\t\t/** !#en Skew y\n\t\t!#zh 该节点 X 轴倾斜角度。 */\n\t\tskewY : number;\t\t\n\t\t/** !#en Z order in depth which stands for the drawing order.\n\t\t!#zh 该节点渲染排序的 Z 轴深度。 */\n\t\tzIndex : number;\t\t\n\t\t/** !#en Rotation of node.\n\t\t!#zh 该节点旋转角度。 */\n\t\trotation : number;\t\t\n\t\t/** !#en Rotation on x axis.\n\t\t!#zh 该节点 X 轴旋转角度。 */\n\t\trotationX : number;\t\t\n\t\t/** !#en Rotation on y axis.\n\t\t!#zh 该节点 Y 轴旋转角度。 */\n\t\trotationY : number;\t\t\n\t\t/** !#en Scale on x axis.\n\t\t!#zh 节点 X 轴缩放。 */\n\t\tscaleX : number;\t\t\n\t\t/** !#en Scale on y axis.\n\t\t!#zh 节点 Y 轴缩放。 */\n\t\tscaleY : number;\t\t\n\t\t/** !#en x axis position of node.\n\t\t!#zh 节点 X 轴坐标。 */\n\t\tx : number;\t\t\n\t\t/** !#en y axis position of node.\n\t\t!#zh 节点 Y 轴坐标。 */\n\t\ty : number;\t\t\n\t\t/** !#en All children nodes.\n\t\t!#zh 节点的所有子节点。 */\n\t\tchildren : Node[];\t\t\n\t\t/** !#en All children nodes.\n\t\t!#zh 节点的子节点数量。 */\n\t\tchildrenCount : number;\t\t\n\t\t/** !#en Anchor point's position on x axis.\n\t\t!#zh 节点 X 轴锚点位置。 */\n\t\tanchorX : number;\t\t\n\t\t/** !#en Anchor point's position on y axis.\n\t\t!#zh 节点 Y 轴锚点位置。 */\n\t\tanchorY : number;\t\t\n\t\t/** !#en Width of node.\n\t\t!#zh 节点宽度。 */\n\t\twidth : number;\t\t\n\t\t/** !#en Height of node.\n\t\t!#zh 节点高度。 */\n\t\theight : number;\t\t\n\t\t/** !#en Tag of node.\n\t\t!#zh 节点标签。 */\n\t\ttag : number;\t\t\n\t\t/** !#en Opacity of node, default value is 255.\n\t\t!#zh 节点透明度，默认值为 255。 */\n\t\topacity : number;\t\t\n\t\t/** !#en Indicate whether node's opacity value affect its child nodes, default value is false.\n\t\t!#zh 节点的不透明度值是否影响其子节点，默认值为 false。 */\n\t\tcascadeOpacity : boolean;\t\t\n\t\t/** !#en Color of node, default value is white: (255, 255, 255).\n\t\t!#zh 节点颜色。默认为白色，数值为：（255，255，255）。 */\n\t\tcolor : Color;\t\t\n\t\t/** !#en\n\t\tProperties configuration function </br>\n\t\tAll properties in attrs will be set to the node, </br>\n\t\twhen the setter of the node is available, </br>\n\t\tthe property will be set via setter function.</br>\n\t\t!#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。\n\t\t@param attrs Properties to be set to node\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar attrs = { key: 0, num: 100 };\n\t\tnode.attr(attrs);\n\t\t``` \n\t\t*/\n\t\tattr(attrs : any) : void;\t\t\n\t\t/** !#en\n\t\tDefines the oder in which the nodes are renderer.\n\t\tNodes that have a Global Z Order lower, are renderer first.\n\t\t<br/>\n\t\tIn case two or more nodes have the same Global Z Order, the oder is not guaranteed.\n\t\tThe only exception if the Nodes have a Global Z Order == 0. In that case, the Scene Graph order is used.\n\t\t<br/>\n\t\tBy default, all nodes have a Global Z Order = 0. That means that by default, the Scene Graph order is used to render the nodes.\n\t\t<br/>\n\t\tGlobal Z Order is useful when you need to render nodes in an order different than the Scene Graph order.\n\t\t<br/>\n\t\tLimitations: Global Z Order can't be used used by Nodes that have SpriteBatchNode as one of their ancestors.\n\t\tAnd if ClippingNode is one of the ancestors, then \"global Z order\" will be relative to the ClippingNode.\n\t\t!#zh\n\t\t定义节点的渲染顺序。\n\t\t节点具有全局 Z 顺序，顺序越小的节点，最先渲染。\n\t\t</br>\n\t\t假设两个或者更多的节点拥有相同的全局 Z 顺序，那么渲染顺序无法保证。\n\t\t唯一的例外是如果节点的全局 Z 顺序为零，那么场景中的顺序是可以使用默认的。\n\t\t</br>\n\t\t所有的节点全局 Z 顺序都是零。这就是说，默认使用场景中的顺序来渲染节点。\n\t\t</br>\n\t\t全局 Z 顺序是非常有用的当你需要渲染节点按照不同的顺序而不是场景顺序。\n\t\t</br>\n\t\t局限性: 全局 Z 顺序不能够被拥有继承 “SpriteBatchNode” 的节点使用。\n\t\t并且如果 “ClippingNode” 是其中之一的上代，那么 “global Z order” 将会和 “ClippingNode” 有关。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setGlobalZOrder(0);\n\t\t``` \n\t\t*/\n\t\tsetGlobalZOrder(globalZOrder : number) : void;\t\t\n\t\t/** !#en Return the Node's Global Z Order.\n\t\t!#zh 获取节点的全局 Z 顺序。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"Global Z Order: \" + node.getGlobalZOrder());\n\t\t``` \n\t\t*/\n\t\tgetGlobalZOrder() : number;\t\t\n\t\t/** !#en\n\t\tReturns the scale factor of the node.\n\t\tAssertion will fail when _scaleX != _scaleY.\n\t\t!#zh 获取节点的缩放。当 X 轴和 Y 轴有相同的缩放数值时。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"Node Scale: \" + node.getScale());\n\t\t``` \n\t\t*/\n\t\tgetScale() : number;\t\t\n\t\t/** !#en Sets the scale factor of the node. 1.0 is the default scale factor. This function can modify the X and Y scale at the same time.\n\t\t!#zh 设置节点的缩放比例，默认值为 1.0。这个函数可以在同一时间修改 X 和 Y 缩放。\n\t\t@param scale scaleX or scale\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setScale(cc.v2(1, 1));\n\t\tnode.setScale(1, 1);\n\t\t``` \n\t\t*/\n\t\tsetScale(scale : number|Vec2, scaleY? : number) : void;\t\t\n\t\t/** !#en Returns a copy of the position (x,y) of the node in cocos2d coordinates. (0,0) is the left-bottom corner.\n\t\t!#zh 获取在父节点坐标系中节点的位置（ x , y ）。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"Node Position: \" + node.getPosition());\n\t\t``` \n\t\t*/\n\t\tgetPosition() : Vec2;\t\t\n\t\t/** !#en\n\t\tChanges the position (x,y) of the node in cocos2d coordinates.<br/>\n\t\tThe original point (0,0) is at the left-bottom corner of screen.<br/>\n\t\tUsually we use cc.v2(x,y) to compose CCVec2 object.<br/>\n\t\tand Passing two numbers (x,y) is more efficient than passing CCPoint object.\n\t\t!#zh\n\t\t设置节点在父坐标系中的位置。<br/>\n\t\t可以通过 2 种方式设置坐标点：<br/>\n\t\t1.传入 cc.v2(x, y) 类型为 cc.Vec2 的对象。<br/>\n\t\t2.传入 2 个数值 x 和 y。\n\t\t@param newPosOrxValue The position (x,y) of the node in coordinates or the X coordinate for position\n\t\t@param yValue Y coordinate for position\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setPosition(cc.v2(0, 0));\n\t\tnode.setPosition(0, 0);\n\t\t\n\t\t``` \n\t\t*/\n\t\tsetPosition(newPosOrxValue : Vec2|number, yValue? : number) : void;\t\t\n\t\t/** !#en\n\t\tReturns a copy of the anchor point.<br/>\n\t\tAnchor point is the point around which all transformations and positioning manipulations take place.<br/>\n\t\tIt's like a pin in the node where it is \"attached\" to its parent. <br/>\n\t\tThe anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>\n\t\tBut you can use values higher than (1,1) and lower than (0,0) too.  <br/>\n\t\tThe default anchor point is (0.5,0.5), so it starts at the center of the node.\n\t\t!#zh\n\t\t获取节点锚点，用百分比表示。<br/>\n\t\t锚点应用于所有变换和坐标点的操作，它就像在节点上连接其父节点的大头针。<br/>\n\t\t锚点是标准化的，就像百分比一样。(0，0) 表示左下角，(1，1) 表示右上角。<br/>\n\t\t但是你可以使用比（1，1）更高的值或者比（0，0）更低的值。<br/>\n\t\t默认的锚点是（0.5，0.5），因此它开始于节点的中心位置。<br/>\n\t\t注意：Creator 中的锚点仅用于定位所在的节点，子节点的定位不受影响。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"Node AnchorPoint: \" + node.getAnchorPoint());\n\t\t``` \n\t\t*/\n\t\tgetAnchorPoint() : Vec2;\t\t\n\t\t/** !#en\n\t\tSets the anchor point in percent. <br/>\n\t\tanchor point is the point around which all transformations and positioning manipulations take place. <br/>\n\t\tIt's like a pin in the node where it is \"attached\" to its parent. <br/>\n\t\tThe anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>\n\t\tBut you can use values higher than (1,1) and lower than (0,0) too.<br/>\n\t\tThe default anchor point is (0.5,0.5), so it starts at the center of the node.\n\t\t!#zh\n\t\t设置锚点的百分比。<br/>\n\t\t锚点应用于所有变换和坐标点的操作，它就像在节点上连接其父节点的大头针。<br/>\n\t\t锚点是标准化的，就像百分比一样。(0，0) 表示左下角，(1，1) 表示右上角。<br/>\n\t\t但是你可以使用比（1，1）更高的值或者比（0，0）更低的值。<br/>\n\t\t默认的锚点是（0.5，0.5），因此它开始于节点的中心位置。<br/>\n\t\t注意：Creator 中的锚点仅用于定位所在的节点，子节点的定位不受影响。\n\t\t@param point The anchor point of node or The x axis anchor of node.\n\t\t@param y The y axis anchor of node.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setAnchorPoint(cc.v2(1, 1));\n\t\tnode.setAnchorPoint(1, 1);\n\t\t``` \n\t\t*/\n\t\tsetAnchorPoint(point : Vec2|number, y? : number) : void;\t\t\n\t\t/** !#en\n\t\tReturns a copy of the anchor point in absolute pixels.  <br/>\n\t\tyou can only read it. If you wish to modify it, use setAnchorPoint.\n\t\t!#zh\n\t\t返回锚点的绝对像素位置。<br/>\n\t\t你只能读它。如果您要修改它，使用 setAnchorPoint。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"AnchorPointInPoints: \" + node.getAnchorPointInPoints());\n\t\t``` \n\t\t*/\n\t\tgetAnchorPointInPoints() : Vec2;\t\t\n\t\t/** !#en\n\t\tReturns a copy the untransformed size of the node. <br/>\n\t\tThe contentSize remains the same no matter the node is scaled or rotated.<br/>\n\t\tAll nodes has a size. Layer and Scene has the same size of the screen by default. <br/>\n\t\t!#zh 获取节点自身大小，不受该节点是否被缩放或者旋转的影响。\n\t\t@param ignoreSizeProvider true if you need to get the original size of the node\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(\"Content Size: \" + node.getContentSize());\n\t\t``` \n\t\t*/\n\t\tgetContentSize(ignoreSizeProvider? : boolean) : Size;\t\t\n\t\t/** !#en\n\t\tSets the untransformed size of the node.<br/>\n\t\tThe contentSize remains the same no matter the node is scaled or rotated.<br/>\n\t\tAll nodes has a size. Layer and Scene has the same size of the screen.\n\t\t!#zh 设置节点原始大小，不受该节点是否被缩放或者旋转的影响。\n\t\t@param size The untransformed size of the node or The untransformed size's width of the node.\n\t\t@param height The untransformed size's height of the node.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setContentSize(cc.size(100, 100));\n\t\tnode.setContentSize(100, 100);\n\t\t``` \n\t\t*/\n\t\tsetContentSize(size : Size|number, height? : number) : void;\t\t\n\t\t/** !#en\n\t\tReturns a \"local\" axis aligned bounding box of the node. <br/>\n\t\tThe returned box is relative only to its parent.\n\t\t!#zh 返回父节坐标系下的轴向对齐的包围盒。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar boundingBox = node.getBoundingBox();\n\t\t``` \n\t\t*/\n\t\tgetBoundingBox() : Rect;\t\t\n\t\t/** !#en Stops all running actions and schedulers.\n\t\t!#zh 停止所有正在播放的动作和计时器。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.cleanup();\n\t\t``` \n\t\t*/\n\t\tcleanup() : void;\t\t\n\t\t/** !#en Returns a child from the container given its tag.\n\t\t!#zh 通过标签获取节点的子节点。\n\t\t@param aTag An identifier to find the child node.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar child = node.getChildByTag(1001);\n\t\t``` \n\t\t*/\n\t\tgetChildByTag(aTag : number) : Node;\t\t\n\t\t/** !#en Returns a child from the container given its uuid.\n\t\t!#zh 通过 uuid 获取节点的子节点。\n\t\t@param uuid The uuid to find the child node.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar child = node.getChildByUuid(uuid);\n\t\t``` \n\t\t*/\n\t\tgetChildByUuid(uuid : string) : Node;\t\t\n\t\t/** !#en Returns a child from the container given its name.\n\t\t!#zh 通过名称获取节点的子节点。\n\t\t@param name A name to find the child node.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar child = node.getChildByName(\"Test Node\");\n\t\t``` \n\t\t*/\n\t\tgetChildByName(name : string) : Node;\t\t\n\t\t/** !#en\n\t\t\"add\" logic MUST only be in this method <br/>\n\t\t!#zh\n\t\t添加子节点，并且可以修改该节点的 局部 Z 顺序和标签。\n\t\t@param child A child node\n\t\t@param localZOrder Z order for drawing priority. Please refer to setZOrder(int)\n\t\t@param tag An integer or a name to identify the node easily. Please refer to setTag(int) and setName(string)\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.addChild(newNode, 1, 1001);\n\t\t``` \n\t\t*/\n\t\taddChild(child : Node, localZOrder? : number, tag? : number|string) : void;\t\t\n\t\t/** !#en\n\t\tRemove itself from its parent node. If cleanup is true, then also remove all actions and callbacks. <br/>\n\t\tIf the cleanup parameter is not passed, it will force a cleanup. <br/>\n\t\tIf the node orphan, then nothing happens.\n\t\t!#zh\n\t\t从父节点中删除一个节点。cleanup 参数为 true，那么在这个节点上所有的动作和回调都会被删除，反之则不会。<br/>\n\t\t如果不传入 cleanup 参数，默认是 true 的。<br/>\n\t\t如果这个节点是一个孤节点，那么什么都不会发生。\n\t\t@param cleanup true if all actions and callbacks on this node should be removed, false otherwise.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.removeFromParent();\n\t\tnode.removeFromParent(false);\n\t\t``` \n\t\t*/\n\t\tremoveFromParent(cleanup? : boolean) : void;\t\t\n\t\t/** !#en\n\t\tRemoves a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>\n\t\tIf the cleanup parameter is not passed, it will force a cleanup. <br/>\n\t\t\"remove\" logic MUST only be on this method  <br/>\n\t\tIf a class wants to extend the 'removeChild' behavior it only needs <br/>\n\t\tto override this method.\n\t\t!#zh\n\t\t移除节点中指定的子节点，是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>\n\t\t如果 cleanup 参数不传入，默认为 true 表示清理。<br/>\n\t\t@param child The child node which will be removed.\n\t\t@param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.removeChild(newNode);\n\t\tnode.removeChild(newNode, false);\n\t\t``` \n\t\t*/\n\t\tremoveChild(child : Node, cleanup? : boolean) : void;\t\t\n\t\t/** !#en\n\t\tRemoves a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter.\n\t\tIf the cleanup parameter is not passed, it will force a cleanup. <br/>\n\t\t!#zh\n\t\t通过标签移除节点中指定的子节点，是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>\n\t\t如果 cleanup 参数不传入，默认为 true 表示清理。\n\t\t@param tag An integer number that identifies a child node\n\t\t@param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.removeChildByTag(1001);\n\t\tnode.removeChildByTag(1001, false);\n\t\t``` \n\t\t*/\n\t\tremoveChildByTag(tag : number, cleanup? : boolean) : void;\t\t\n\t\t/** !#en\n\t\tRemoves all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>\n\t\tIf the cleanup parameter is not passed, it will force a cleanup.\n\t\t!#zh\n\t\t移除节点所有的子节点，是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>\n\t\t如果 cleanup 参数不传入，默认为 true 表示清理。\n\t\t@param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.removeAllChildren();\n\t\tnode.removeAllChildren(false);\n\t\t``` \n\t\t*/\n\t\tremoveAllChildren(cleanup? : boolean) : void;\t\t\n\t\t/** !#en\n\t\tReturns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>\n\t\tThe matrix is in Pixels. The returned transform is readonly and cannot be changed.\n\t\t!#zh\n\t\t返回将父节点的坐标系转换成节点（局部）的空间坐标系的矩阵。<br/>\n\t\t该矩阵以像素为单位。返回的矩阵是只读的，不能更改。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar affineTransform = node.getParentToNodeTransform();\n\t\t``` \n\t\t*/\n\t\tgetParentToNodeTransform() : AffineTransform;\t\t\n\t\t/** !#en Returns the world affine transform matrix. The matrix is in Pixels.\n\t\t!#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar affineTransform = node.getNodeToWorldTransform();\n\t\t``` \n\t\t*/\n\t\tgetNodeToWorldTransform() : AffineTransform;\t\t\n\t\t/** !#en\n\t\tReturns the world affine transform matrix. The matrix is in Pixels.<br/>\n\t\tThis method is AR (Anchor Relative).\n\t\t!#zh\n\t\t返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>\n\t\t该方法基于节点坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar mat = node.getNodeToWorldTransformAR();\n\t\t``` \n\t\t*/\n\t\tgetNodeToWorldTransformAR() : AffineTransform;\t\t\n\t\t/** !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.\n\t\t!#en 返回世界坐标系到节点坐标系的逆矩阵。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar affineTransform = node.getWorldToNodeTransform();\n\t\t``` \n\t\t*/\n\t\tgetWorldToNodeTransform() : AffineTransform;\t\t\n\t\t/** !#en Converts a Point to node (local) space coordinates. The result is in Vec2.\n\t\t!#zh 将一个点转换到节点 (局部) 坐标系。结果以 Vec2 为单位。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertToNodeSpace(cc.v2(100, 100));\n\t\t``` \n\t\t*/\n\t\tconvertToNodeSpace(worldPoint : Vec2) : Vec2;\t\t\n\t\t/** !#en Converts a Point to world space coordinates. The result is in Points.\n\t\t!#zh 将一个点转换到世界空间坐标系。结果以 Vec2 为单位。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertToWorldSpace(cc.v2(100, 100));\n\t\t``` \n\t\t*/\n\t\tconvertToWorldSpace(nodePoint : Vec2) : Vec2;\t\t\n\t\t/** !#en\n\t\tConverts a Point to node (local) space coordinates. The result is in Points.<br/>\n\t\ttreating the returned/received node point as anchor relative.\n\t\t!#zh\n\t\t将一个点转换到节点 (局部) 空间坐标系。结果以 Vec2 为单位。<br/>\n\t\t返回值将基于节点坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));\n\t\t``` \n\t\t*/\n\t\tconvertToNodeSpaceAR(worldPoint : Vec2) : Vec2;\t\t\n\t\t/** !#en\n\t\tConverts a local Point to world space coordinates.The result is in Points.<br/>\n\t\ttreating the returned/received node point as anchor relative.\n\t\t!#zh\n\t\t将一个点转换到世界空间坐标系。结果以 Vec2 为单位。<br/>\n\t\t返回值将基于节点坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));\n\t\t``` \n\t\t*/\n\t\tconvertToWorldSpaceAR(nodePoint : Vec2) : Vec2;\t\t\n\t\t/** !#en convenience methods which take a cc.Touch instead of cc.Vec2.\n\t\t!#zh 将触摸点转换成本地坐标系中位置。\n\t\t@param touch The touch object\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertTouchToNodeSpace(touch);\n\t\t``` \n\t\t*/\n\t\tconvertTouchToNodeSpace(touch : Touch) : Vec2;\t\t\n\t\t/** !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).\n\t\t!#zh 转换一个 cc.Touch（世界坐标）到一个局部坐标，该方法基于节点坐标。\n\t\t@param touch The touch object\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newVec2 = node.convertTouchToNodeSpaceAR(touch);\n\t\t``` \n\t\t*/\n\t\tconvertTouchToNodeSpaceAR(touch : Touch) : Vec2;\t\t\n\t\t/** !#en\n\t\tReturns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>\n\t\tThe matrix is in Pixels.\n\t\t!#zh 返回这个将节点（局部）的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar affineTransform = node.getNodeToParentTransform();\n\t\t``` \n\t\t*/\n\t\tgetNodeToParentTransform() : AffineTransform;\t\t\n\t\t/** !#en\n\t\tReturns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>\n\t\tThe matrix is in Pixels.<br/>\n\t\tThis method is AR (Anchor Relative).\n\t\t!#zh\n\t\t返回这个将节点（局部）的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>\n\t\t这个矩阵以像素为单位。<br/>\n\t\t该方法基于节点坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar affineTransform = node.getNodeToParentTransformAR();\n\t\t``` \n\t\t*/\n\t\tgetNodeToParentTransformAR() : AffineTransform;\t\t\n\t\t/** !#en\n\t\tReturns a \"world\" axis aligned bounding box of the node.<br/>\n\t\tThe bounding box contains self and active children's world bounding box.\n\t\t!#zh\n\t\t返回节点在世界坐标系下的对齐轴向的包围盒（AABB）。<br/>\n\t\t该边框包含自身和已激活的子节点的世界边框。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar newRect = node.getBoundingBoxToWorld();\n\t\t``` \n\t\t*/\n\t\tgetBoundingBoxToWorld() : Rect;\t\t\n\t\t/** !#en\n\t\tReturns the displayed opacity of Node,\n\t\tthe difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.\n\t\t!#zh\n\t\t获取节点显示透明度，\n\t\t显示透明度和透明度之间的不同之处在于当启用级连透明度时，\n\t\t显示透明度是基于自身透明度和父节点透明度计算的。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar displayOpacity = node.getDisplayedOpacity();\n\t\t``` \n\t\t*/\n\t\tgetDisplayedOpacity() : number;\t\t\n\t\t/** !#en\n\t\tReturns the displayed color of Node,\n\t\tthe difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.\n\t\t!#zh\n\t\t获取节点的显示透明度，\n\t\t显示透明度和透明度之间的不同之处在于显示透明度是基于透明度和父节点透明度启用级连透明度时计算的。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar displayColor = node.getDisplayedColor();\n\t\t``` \n\t\t*/\n\t\tgetDisplayedColor() : Color;\t\t\n\t\t/** !#en\n\t\tSet whether color should be changed with the opacity value,\n\t\tuseless in ccsg.Node, but this function is override in some class to have such behavior.\n\t\t!#zh 设置更改透明度时是否修改RGB值，\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setOpacityModifyRGB(true);\n\t\t``` \n\t\t*/\n\t\tsetOpacityModifyRGB(opacityValue : boolean) : void;\t\t\n\t\t/** !#en Get whether color should be changed with the opacity value.\n\t\t!#zh 更改透明度时是否修改RGB值。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar hasChange = node.isOpacityModifyRGB();\n\t\t``` \n\t\t*/\n\t\tisOpacityModifyRGB() : boolean;\t\t\n\t\t/** !#en Get the sibling index.\n\t\t!#zh 获取同级索引。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar index = node.getSiblingIndex();\n\t\t``` \n\t\t*/\n\t\tgetSiblingIndex() : number;\t\t\n\t\t/** !#en Set the sibling index of this node.\n\t\t!#zh 设置节点同级索引。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setSiblingIndex(1);\n\t\t``` \n\t\t*/\n\t\tsetSiblingIndex(index : number) : void;\t\t\n\t\t/** !#en Is this node a child of the given node?\n\t\t!#zh 是否是指定节点的子节点？\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.isChildOf(newNode);\n\t\t``` \n\t\t*/\n\t\tisChildOf(parent : Node) : boolean;\t\t\n\t\t/** !#en Sorts the children array depends on children's zIndex and arrivalOrder,\n\t\tnormally you won't need to invoke this function.\n\t\t!#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序，正常情况下开发者不需要手动调用这个函数。 \n\t\t*/\n\t\tsortAllChildren() : void;\t\t\n\t\t/** !#en position of node.\n\t\t!#zh 节点相对父节点的坐标。 */\n\t\tposition : Vec2;\t\t\n\t\t/** !#en Scale of node.\n\t\t!#zh 节点缩放 */\n\t\tscale : number;\t\t\n\t\t/** !#en Returns the x axis position of the node in cocos2d coordinates.\n\t\t!#zh 获取节点 X 轴坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar posX = node.getPositionX();\n\t\t``` \n\t\t*/\n\t\tgetPositionX() : number;\t\t\n\t\t/** !#en Sets the x axis position of the node in cocos2d coordinates.\n\t\t!#zh 设置节点 X 轴坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setPositionX(1);\n\t\t``` \n\t\t*/\n\t\tsetPositionX(x : number) : void;\t\t\n\t\t/** !#en Returns the y axis position of the node in cocos2d coordinates.\n\t\t!#zh 获取节点 Y 轴坐标。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar posY = node.getPositionY();\n\t\t``` \n\t\t*/\n\t\tgetPositionY() : number;\t\t\n\t\t/** !#en Sets the y axis position of the node in cocos2d coordinates.\n\t\t!#zh 设置节点 Y 轴坐标。\n\t\t@param y The new position in y axis\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setPositionY(100);\n\t\t``` \n\t\t*/\n\t\tsetPositionY(y : number) : void;\t\t\n\t\t/** !#en Returns the local Z order of this node.\n\t\t!#zh 获取节点局部 Z 轴顺序。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar localZorder = node.getLocalZOrder();\n\t\t``` \n\t\t*/\n\t\tgetLocalZOrder() : number;\t\t\n\t\t/** !#en\n\t\tLocalZOrder is the 'key' used to sort the node relative to its siblings.                                        <br/>\n\t\t                                                                                                                <br/>\n\t\tThe Node's parent will sort all its children based ont the LocalZOrder value.                                   <br/>\n\t\tIf two nodes have the same LocalZOrder, then the node that was added first to the children's array              <br/>\n\t\twill be in front of the other node in the array.                                                                <br/>\n\t\tAlso, the Scene Graph is traversed using the \"In-Order\" tree traversal algorithm ( http://en.wikipedia.org/wiki/Tree_traversal#In-order ) <br/>\n\t\tAnd Nodes that have LocalZOder values smaller than 0 are the \"left\" subtree <br/>\n\t\tWhile Nodes with LocalZOder greater than 0 are the \"right\" subtree.\n\t\t!#zh\n\t\tLocalZOrder 是 “key” (关键)来分辨节点和它兄弟节点的相关性。\n\t\t父节点将会通过 LocalZOrder 的值来分辨所有的子节点。\n\t\t如果两个节点有同样的 LocalZOrder，那么先加入子节点数组的节点将会显示在后加入的节点的前面。\n\t\t同样的，场景图使用 “In-Order（按顺序）” 遍历数算法来遍历\n\t\t( http://en.wikipedia.org/wiki/Tree_traversal#In-order ) 并且拥有小于 0 的 LocalZOrder 的值的节点是 “ left ” 子树（左子树）\n\t\t所以拥有大于 0 的 LocalZOrder 的值得节点是 “ right ”子树（右子树）。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setLocalZOrder(1);\n\t\t``` \n\t\t*/\n\t\tsetLocalZOrder(localZOrder : number) : void;\t\t\n\t\t/** !#en Returns whether node's opacity value affect its child nodes.\n\t\t!#zh 返回节点的不透明度值是否影响其子节点。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.log(node.isCascadeOpacityEnabled());\n\t\t``` \n\t\t*/\n\t\tisCascadeOpacityEnabled() : boolean;\t\t\n\t\t/** !#en Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.\n\t\t!#zh 启用或禁用级连不透明度，如果级连启用，子节点的不透明度将是父不透明度乘上它自己的不透明度。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setCascadeOpacityEnabled(true);\n\t\t``` \n\t\t*/\n\t\tsetCascadeOpacityEnabled(cascadeOpacityEnabled : boolean) : void;\t\t\n\t\t/** !#en Enable or disable cascade color, if cascade enabled, child nodes' opacity will be the cascade value of parent color and its own color.\n\t\t!#zh 启用或禁用级连颜色，如果级连启用，子节点的颜色将是父颜色和它自己的颜色的级连值。\n\t\t\n\t\t@example \n\t\t```js\n\t\tnode.setCascadeColorEnabled(true);\n\t\t``` \n\t\t*/\n\t\tsetCascadeColorEnabled(cascadeColorEnabled : boolean) : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tcc.AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>\n\t\tPlease do not use its constructor directly, use cc.affineTransformMake alias function instead.\n\t\t!#zh\n\t\tcc.AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转，缩放转变所组成。<br/>\n\t\t请不要直接使用它的构造，请使用 cc.affineTransformMake 函数代替。 */\n\t\texport class AffineTransform {\t\t\n\t\t/** !#en Create a cc.AffineTransform object with all contents in the matrix.\n\t\t!#zh 用在矩阵中的所有内容创建一个 cc.AffineTransform 对象。 \n\t\t*/\n\t\taffineTransformMake(a : number, b : number, c : number, d : number, tx : number, ty : number) : AffineTransform;\t\t\n\t\t/** !#en Clone a cc.AffineTransform object from the specified transform.\n\t\t!#zh 克隆指定的 cc.AffineTransform 对象。 \n\t\t*/\n\t\taffineTransformClone(t : AffineTransform) : AffineTransform;\t\t\n\t\t/** !#en Apply the affine transformation on a point.\n\t\t!#zh 对一个点应用矩阵变换。\n\t\t@param point or x.\n\t\t@param transOrY transform matrix or y.\n\t\t@param t transform matrix or y. \n\t\t*/\n\t\tpointApplyAffineTransform(point : Vec2|number, transOrY : AffineTransform|number, t : AffineTransform) : Vec2;\t\t\n\t\t/** !#en Apply the affine transformation on a size.\n\t\t!#zh 应用 Size 到仿射变换矩阵上。 \n\t\t*/\n\t\tsizeApplyAffineTransform(size : Size, t : AffineTransform) : Size;\t\t\n\t\t/** !#en\n\t\tCreate a identity transformation matrix: <br/>\n\t\t[ 1, 0, 0, <br/>\n\t\t  0, 1, 0 ]\n\t\t!#zh\n\t\t单位矩阵：<br/>\n\t\t[ 1, 0, 0, <br/>\n\t\t  0, 1, 0 ] \n\t\t*/\n\t\taffineTransformMakeIdentity() : AffineTransform;\t\t\n\t\t/** !#en Apply the affine transformation on a rect.\n\t\t!#zh 应用 Rect 到仿射变换矩阵上。 \n\t\t*/\n\t\trectApplyAffineTransform(rect : Rect, anAffineTransform : AffineTransform) : Rect;\t\t\n\t\t/** !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.\n\t\t!#zh 应用 Rect 到仿射变换矩阵上, 并转换为有向包围盒 \n\t\t*/\n\t\tobbApplyAffineTransform(rect : Rect, anAffineTransform : AffineTransform, out_bl : Vec2, out_tl : Vec2, out_tr : Vec2, out_br : Vec2) : void;\t\t\n\t\t/** !#en Create a new affine transformation with a base transformation matrix and a translation based on it.\n\t\t!#zh 基于一个基础矩阵加上一个平移操作来创建一个新的矩阵。\n\t\t@param t The base affine transform object.\n\t\t@param tx The translation on x axis.\n\t\t@param ty The translation on y axis. \n\t\t*/\n\t\taffineTransformTranslate(t : AffineTransform, tx : number, ty : number) : AffineTransform;\t\t\n\t\t/** !#en Create a new affine transformation with a base transformation matrix and a scale based on it.\n\t\t!#zh 创建一个基础变换矩阵，并在此基础上进行了 Scale 仿射变换。\n\t\t@param t The base affine transform object.\n\t\t@param sx The scale on x axis.\n\t\t@param sy The scale on y axis. \n\t\t*/\n\t\taffineTransformScale(t : AffineTransform, sx : number, sy : number) : AffineTransform;\t\t\n\t\t/** !#en Create a new affine transformation with a base transformation matrix and a rotation based on it.\n\t\t!#zh 创建一个基础变换矩阵，并在此基础上进行了 Rotation 仿射变换。\n\t\t@param aTransform The base affine transform object.\n\t\t@param anAngle The angle to rotate. \n\t\t*/\n\t\taffineTransformRotate(aTransform : AffineTransform, anAngle : number) : AffineTransform;\t\t\n\t\t/** !#en\n\t\tConcatenate a transform matrix to another and return the result:<br/>\n\t\tt' = t1 * t2\n\t\t!#zh 拼接两个矩阵，并返回结果：<br/>\n\t\tt' = t1 * t2\n\t\t@param t1 The first transform object.\n\t\t@param t2 The transform object to concatenate. \n\t\t*/\n\t\taffineTransformConcat(t1 : AffineTransform, t2 : AffineTransform) : AffineTransform;\t\t\n\t\t/** !#en\n\t\tConcatenate a transform matrix to another<br/>\n\t\tThe results are reflected in the first matrix.<br/>\n\t\tt' = t1 * t2\n\t\t!#zh\n\t\t拼接两个矩阵，将结果保存到第一个矩阵。<br/>\n\t\tt' = t1 * t2\n\t\t@param t1 The first transform object.\n\t\t@param t2 The transform object to concatenate. \n\t\t*/\n\t\taffineTransformConcatIn(t1 : AffineTransform, t2 : AffineTransform) : AffineTransform;\t\t\n\t\t/** !#en Return true if an affine transform equals to another, false otherwise.\n\t\t!#zh 判断两个矩阵是否相等。 \n\t\t*/\n\t\taffineTransformEqualToTransform(t1 : AffineTransform, t2 : AffineTransform) : boolean;\t\t\n\t\t/** !#en Get the invert transform of an AffineTransform object.\n\t\t!#zh 求逆矩阵。 \n\t\t*/\n\t\taffineTransformInvert(t : AffineTransform) : AffineTransform;\t\n\t}\t\t\n\t\t/** !#en\n\t\tRepresentation of RGBA colors.\n\t\t\n\t\tEach color component is a floating point value with a range from 0 to 255.\n\t\t\n\t\tYou can also use the convenience method {{#crossLink \"cc/color:method\"}}cc.color{{/crossLink}} to create a new Color.\n\t\t\n\t\t!#zh\n\t\tcc.Color 用于表示颜色。\n\t\t\n\t\t它包含 RGBA 四个以浮点数保存的颜色分量，每个的值都在 0 到 255 之间。\n\t\t\n\t\t您也可以通过使用 {{#crossLink \"cc/color:method\"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */\n\t\texport class Color extends ValueType {\t\t\n\t\t/** \n\t\t@param r red component of the color, default value is 0.\n\t\t@param g green component of the color, defualt value is 0.\n\t\t@param b blue component of the color, default value is 0.\n\t\t@param a alpha component of the color, default value is 255. \n\t\t*/\n\t\tColor(r? : number, g? : number, b? : number, a? : number) : Color;\t\t\n\t\t/** !#en Solid white, RGBA is [255, 255, 255, 255].\n\t\t!#zh 纯白色，RGBA 是 [255, 255, 255, 255]。 */\n\t\tWHITE : Color;\t\t\n\t\t/** !#en Solid black, RGBA is [0, 0, 0, 255].\n\t\t!#zh 纯黑色，RGBA 是 [0, 0, 0, 255]。 */\n\t\tBLACK : Color;\t\t\n\t\t/** !#en Transparent, RGBA is [0, 0, 0, 0].\n\t\t!#zh 透明，RGBA 是 [0, 0, 0, 0]。 */\n\t\tTRANSPARENT : Color;\t\t\n\t\t/** !#en Grey, RGBA is [127.5, 127.5, 127.5].\n\t\t!#zh 灰色，RGBA 是 [127.5, 127.5, 127.5]。 */\n\t\tGRAY : Color;\t\t\n\t\t/** !#en Solid red, RGBA is [255, 0, 0].\n\t\t!#zh 纯红色，RGBA 是 [255, 0, 0]。 */\n\t\tRED : Color;\t\t\n\t\t/** !#en Solid green, RGBA is [0, 255, 0].\n\t\t!#zh 纯绿色，RGBA 是 [0, 255, 0]。 */\n\t\tGREEN : Color;\t\t\n\t\t/** !#en Solid blue, RGBA is [0, 0, 255].\n\t\t!#zh 纯蓝色，RGBA 是 [0, 0, 255]。 */\n\t\tBLUE : Color;\t\t\n\t\t/** !#en Yellow, RGBA is [255, 235, 4].\n\t\t!#zh 黄色，RGBA 是 [255, 235, 4]。 */\n\t\tYELLOW : Color;\t\t\n\t\t/** !#en Orange, RGBA is [255, 127, 0].\n\t\t!#zh 橙色，RGBA 是 [255, 127, 0]。 */\n\t\tORANGE : Color;\t\t\n\t\t/** !#en Cyan, RGBA is [0, 255, 255].\n\t\t!#zh 青色，RGBA 是 [0, 255, 255]。 */\n\t\tCYAN : Color;\t\t\n\t\t/** !#en Magenta, RGBA is [255, 0, 255].\n\t\t!#zh 洋红色（品红色），RGBA 是 [255, 0, 255]。 */\n\t\tMAGENTA : Color;\t\t\n\t\t/** !#en Clone a new color from the current color.\n\t\t!#zh 克隆当前颜色。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color();\n\t\tvar newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}\n\t\t``` \n\t\t*/\n\t\tclone() : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 判断两个颜色是否相等。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color1 = cc.Color.WHITE;\n\t\tvar color2 = new cc.Color(255, 255, 255);\n\t\tcc.log(color1.equals(color2)); // true;\n\t\tcolor2 = cc.Color.RED;\n\t\tcc.log(color2.equals(color1)); // false;\n\t\t``` \n\t\t*/\n\t\tequals(other: (r: number, g: number, b: number, a: number) => void) : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 线性插值\n\t\t@param ratio the interpolation coefficient.\n\t\t@param out optional, the receiving vector.\n\t\t\n\t\t@example \n\t\t```js\n\t\t// Converts a white color to a black one trough time.\n\t\tupdate: function (dt) {\n\t\t    var color = this.node.color;\n\t\t    if (color.equals(cc.Color.BLACK)) {\n\t\t        return;\n\t\t    }\n\t\t    this.ratio += dt * 0.1;\n\t\t    this.node.color = cc.Color.WHITE.lerp(cc.Color.BLACK, ratio);\n\t\t}\n\t\t\n\t\t``` \n\t\t*/\n\t\tlerp(to: (r: number, g: number, b: number, a: number) => void, ratio : number, out: (r: number, g: number, b: number, a: number) => void) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为方便阅读的字符串。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.WHITE;\n\t\tcolor.toString(); // \"rgba(255, 255, 255, 255)\"\n\t\t``` \n\t\t*/\n\t\ttoString() : string;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 设置当前的红色值，并返回当前对象。\n\t\t@param red the new Red component.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color();\n\t\tcolor.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}\n\t\t``` \n\t\t*/\n\t\tsetR(red : number) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 设置当前的绿色值，并返回当前对象。\n\t\t@param green the new Green component.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color();\n\t\tcolor.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}\n\t\t``` \n\t\t*/\n\t\tsetG(green : number) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 设置当前的蓝色值，并返回当前对象。\n\t\t@param blue the new Blue component.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color();\n\t\tcolor.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}\n\t\t``` \n\t\t*/\n\t\tsetB(blue : number) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 设置当前的透明度，并返回当前对象。\n\t\t@param alpha the new Alpha component.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color();\n\t\tcolor.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}\n\t\t``` \n\t\t*/\n\t\tsetA(alpha : number) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为 CSS 格式。\n\t\t@param opt \"rgba\", \"rgb\", \"#rgb\" or \"#rrggbb\".\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.BLACK;\n\t\tcolor.toCSS();          // \"#000\";\n\t\tcolor.toCSS(\"rgba\");    // \"rgba(0,0,0,1.00)\";\n\t\tcolor.toCSS(\"rgb\");     // \"rgba(0,0,0)\";\n\t\tcolor.toCSS(\"#rgb\");    // \"#000\";\n\t\tcolor.toCSS(\"#rrggbb\"); // \"#000000\";\n\t\t``` \n\t\t*/\n\t\ttoCSS(opt : string) : string;\t\t\n\t\t/** !#en Clamp this color to make all components between 0 to 255。\n\t\t!#zh 限制颜色数值，在 0 到 255 之间。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = new cc.Color(1000, 0, 0, 255);\n\t\tcolor.clamp();\n\t\tcc.log(color); // (255, 0, 0, 255)\n\t\t``` \n\t\t*/\n\t\tclamp() : void;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 读取 16 进制。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.BLACK;\n\t\tcolor.fromHEX(\"#FFFF33\"); // Color {r: 255, g: 255, b: 51, a: 255};\n\t\t``` \n\t\t*/\n\t\tfromHEX(hexString : string) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为 16 进制。\n\t\t@param fmt \"#rgb\" or \"#rrggbb\".\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.BLACK;\n\t\tcolor.toHEX(\"#rgb\");     // \"000\";\n\t\tcolor.toHEX(\"#rrggbb\");  // \"000000\";\n\t\t``` \n\t\t*/\n\t\ttoHEX(fmt : string) : string;\t\t\n\t\t/** !#en Convert to 24bit rgb value.\n\t\t!#zh 转换为 24bit 的 RGB 值。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.YELLOW;\n\t\tcolor.toRGBValue(); // 16771844;\n\t\t``` \n\t\t*/\n\t\ttoRGBValue() : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 读取 HSV（色彩模型）格式。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.YELLOW;\n\t\tcolor.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};\n\t\t``` \n\t\t*/\n\t\tfromHSV(h : number, s : number, v : number) : Color;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为 HSV（色彩模型）格式。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar color = cc.Color.YELLOW;\n\t\tcolor.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};\n\t\t``` \n\t\t*/\n\t\ttoHSV() : any;\t\t\n\t\t/** !#en TODO\n\t\t!#zh RGB 转换为 HSV。\n\t\t@param r red, must be [0, 255].\n\t\t@param g red, must be [0, 255].\n\t\t@param b red, must be [0, 255].\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.Color.rgb2hsv(255, 255, 255); // Object {h: 0, s: 0, v: 1};\n\t\t``` \n\t\t*/\n\t\trgb2hsv(r : number, g : number, b : number) : any;\t\t\n\t\t/** !#en TODO\n\t\t!#zh HSV 转换为 RGB。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.Color.hsv2rgb(0, 0, 1); // Object {r: 255, g: 255, b: 255};\n\t\t``` \n\t\t*/\n\t\thsv2rgb(h : number, s : number, v : number) : any;\t\n\t}\t\t\n\t\t/** !#en A 2D rectangle defined by x, y position and width, height.\n\t\t!#zh 通过位置和宽高定义的 2D 矩形。 */\n\t\texport class Rect extends ValueType {\t\t\n\t\t/** !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。 \n\t\t*/\n\t\tRect(x? : number, y? : number, w? : number, h? : number) : Rect;\t\t\n\t\t/** !#en Creates a rectangle from two coordinate values.\n\t\t!#zh 根据指定 2 个坐标创建出一个矩形区域。\n\t\t\n\t\t@example \n\t\t```js\n\t\tcc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};\n\t\t``` \n\t\t*/\n\t\tfromMinMax(v1 : Vec2, v2 : Vec2) : Rect;\t\t\n\t\t/** !#en Checks if rect contains.\n\t\t!#zh\n\t\t判断 2 个矩形是否有包含。<br/>\n\t\t返回 1 为 a 包含 b，如果 -1 为 b 包含 a,\n\t\t0 这则都不包含。\n\t\t@param a Rect a\n\t\t@param b Rect b\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.rect(5, 5, 5, 5);\n\t\tvar c = new cc.rect(20, 20, 10, 10);\n\t\tcc.Rect.contain(a, b); //  1;\n\t\tcc.Rect.contain(b, a); // -1;\n\t\tcc.Rect.contain(a, c); //  0;\n\t\t``` \n\t\t*/\n\t\tcontain(a: (x: number, y: number, w: number, h: number) => void, b: (x: number, y: number, w: number, h: number) => void) : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 克隆一个新的 Rect。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\ta.clone();// Rect {x: 0, y: 0, width: 10, height: 10}\n\t\t``` \n\t\t*/\n\t\tclone() : Rect;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 是否等于指定的矩形。\n\t\t@param other !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.rect(0, 0, 10, 10);\n\t\ta.equals(b);// true;\n\t\t``` \n\t\t*/\n\t\tequals(other: (x: number, y: number, w: number, h: number) => void) : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 线性插值\n\t\t@param to !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\t@param ratio the interpolation coefficient.\n\t\t@param out optional, the receiving vector.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.rect(50, 50, 100, 100);\n\t\tupdate (dt) {\n\t\t   // method 1;\n\t\t   var c = a.lerp(b, dt * 0.1);\n\t\t   // method 2;\n\t\t   a.lerp(b, dt * 0.1, c);\n\t\t}\n\t\t``` \n\t\t*/\n\t\tlerp(to: (x: number, y: number, w: number, h: number) => void, ratio : number, out: (x: number, y: number, w: number, h: number) => void) : Rect;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为方便阅读的字符串\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\ta.toString();// \"(0.00, 0.00, 10.00, 10.00)\";\n\t\t``` \n\t\t*/\n\t\ttoString() : string;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形 x 轴上的最小值。 */\n\t\txMin : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形 y 轴上的最小值。 */\n\t\tyMin : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形 x 轴上的最大值。 */\n\t\txMax : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形 y 轴上的最大值。 */\n\t\tyMax : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形的中心点。 */\n\t\tcenter : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 矩形的大小。 */\n\t\tsize : Size;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 当前矩形与指定矩形是否相交。\n\t\t@param rect !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.rect(0, 0, 20, 20);\n\t\ta.intersects(b);// true\n\t\t``` \n\t\t*/\n\t\tintersects(rect: (x: number, y: number, w: number, h: number) => void) : void;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 当前矩形是否包含指定坐标点。\n\t\tReturns true if the point inside this rectangle.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.v2(0, 5);\n\t\ta.contains(b);// true\n\t\t``` \n\t\t*/\n\t\tcontains(point : Vec2) : void;\t\t\n\t\t/** !#en Returns true if the other rect totally inside this rectangle.\n\t\t!#zh 当前矩形是否包含指定矩形。\n\t\t@param rect !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.rect(0, 0, 10, 10);\n\t\tvar b = new cc.rect(0, 0, 20, 20);\n\t\ta.containsRect(b);// true\n\t\t``` \n\t\t*/\n\t\tcontainsRect(rect: (x: number, y: number, w: number, h: number) => void) : void;\t\n\t}\t\t\n\t\t/** !#en\n\t\tcc.Size is the class for size object,<br/>\n\t\tplease do not use its constructor to create sizes,<br/>\n\t\tuse {{#crossLink \"cc/size:method\"}}{{/crossLink}} alias function instead.<br/>\n\t\tIt will be deprecated soon, please use cc.Vec2 instead.\n\t\t\n\t\t!#zh\n\t\tcc.Size 是 size 对象的类。<br/>\n\t\t请不要使用它的构造函数创建的 size，<br/>\n\t\t使用 {{#crossLink \"cc/size:method\"}}{{/crossLink}} 别名函数。<br/>\n\t\t它不久将被取消，请使用cc.Vec2代替。 */\n\t\texport class Size {\t\t\n\t\t/**  \n\t\t*/\n\t\tSize(width : number, height : number) : Size;\t\t\n\t\t/** !#en return a Size object with width = 0 and height = 0.\n\t\t!#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */\n\t\tZERO : Size;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 克隆 size 对象。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.size(10, 10);\n\t\ta.clone();// return Size {width: 0, height: 0};\n\t\t``` \n\t\t*/\n\t\tclone() : Size;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 当前 Size 对象是否等于指定 Size 对象。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.size(10, 10);\n\t\ta.equals(new cc.size(10, 10));// return true;\n\t\t``` \n\t\t*/\n\t\tequals(other: (width: number, height: number) => void) : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 线性插值。\n\t\t@param to !#en\n\t\tConstructor of cc.Rect class.\n\t\tsee {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} for convenience method.\n\t\t!#zh\n\t\tcc.Rect类的构造函数。可以通过 {{#crossLink \"cc/rect:method\"}} cc.rect {{/crossLink}} 简便方法进行创建。\n\t\t@param ratio the interpolation coefficient.\n\t\t@param out optional, the receiving vector.\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.size(10, 10);\n\t\tvar b = new cc.rect(50, 50, 100, 100);\n\t\tupdate (dt) {\n\t\t   // method 1;\n\t\t   var c = a.lerp(b, dt * 0.1);\n\t\t   // method 2;\n\t\t   a.lerp(b, dt * 0.1, c);\n\t\t}\n\t\t``` \n\t\t*/\n\t\tlerp(to: (x: number, y: number, w: number, h: number) => void, ratio : number, out: (width: number, height: number) => void) : Size;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为方便阅读的字符串。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.size(10, 10);\n\t\ta.toString();// return \"(10.00, 10.00)\";\n\t\t``` \n\t\t*/\n\t\ttoString() : string;\t\t\n\t\t/** !#en\n\t\tHelper function that creates a cc.Size.<br/>\n\t\tPlease use cc.p or cc.v2 instead, it will soon replace cc.Size.\n\t\t!#zh\n\t\t创建一个 cc.Size 对象的帮助函数。<br/>\n\t\t注意：可以使用 cc.p 或者是 cc.v2 代替，它们将很快取代 cc.Size。\n\t\t@param w width or a size object\n\t\t@param h height\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar size1 = cc.size();\n\t\tvar size2 = cc.size(100,100);\n\t\tvar size3 = cc.size(size2);\n\t\tvar size4 = cc.size({width: 100, height: 100});\n\t\t\n\t\t``` \n\t\t*/\n\t\tsize(w : number|Size, h : number) : Size;\t\t\n\t\t/** !#en Check whether a point's value equals to another.\n\t\t!#zh 检查 Size 对象是否等于另一个。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar a = new cc.size(10, 10);\n\t\tvar b = new cc.size(10, 10);\n\t\tcc.sizeEqualToSize(a, b);// return true;\n\t\tvar b = new cc.size(5, 10);\n\t\tcc.sizeEqualToSize(a, b);// return false;\n\t\t``` \n\t\t*/\n\t\tsizeEqualToSize(size1: (width: number, height: number) => void, size2: (width: number, height: number) => void) : boolean;\t\n\t}\t\t\n\t\t/** !#en the device accelerometer reports values for each axis in units of g-force.\n\t\t!#zh 设备重力传感器传递的各个轴的数据。 */\n\t\texport class Acceleration {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tAcceleration(x : number, y : number, z : number, timestamp : number) : Acceleration;\t\n\t}\t\t\n\t\t/** !#en Blend Function used for textures.\n\t\t!#zh 图像的混合方式。 */\n\t\texport class BlendFunc {\t\t\n\t\tconstructor();\t\t\n\t\t/** \n\t\t@param src1 source blend function\n\t\t@param dst1 destination blend function \n\t\t*/\n\t\tBlendFunc(src1 : number, dst1 : number) : BlendFunc;\t\n\t}\t\n\t/** !#en\n\tEnum for blend factor\n\tRefer to: http://www.andersriggelsen.dk/glblendfunc.php\n\t!#zh\n\t混合因子\n\t可参考: http://www.andersriggelsen.dk/glblendfunc.php */\n\texport enum BlendFactor {\t\t\n\t\tONE = 0,\n\t\tZERO = 0,\n\t\tSRC_ALPHA = 0,\n\t\tSRC_COLOR = 0,\n\t\tDST_ALPHA = 0,\n\t\tDST_COLOR = 0,\n\t\tONE_MINUS_SRC_ALPHA = 0,\n\t\tONE_MINUS_SRC_COLOR = 0,\n\t\tONE_MINUS_DST_ALPHA = 0,\n\t\tONE_MINUS_DST_COLOR = 0,\n\t\tblendFuncDisable = 0,\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class WebGLColor {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tWebGLColor(r : number, g : number, b : number, a : number, arrayBuffer : any[], offset : number) : WebGLColor;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Vertex2F {\t\t\n\t\t/**  \n\t\t*/\n\t\tVertex2F(x : number, y : number, arrayBuffer : any[], offset : number) : Vertex2F;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Vertex3F {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tVertex3F(x : number, y : number, z : number, arrayBuffer : any[], offset : number) : Vertex3F;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Tex2F {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tTex2F(u : number, v : number, arrayBuffer : any[], offset : number) : Tex2F;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class Quad2 {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tQuad2(tl: (x: number, y: number, arrayBuffer: any[], offset: number) => void, tr: (x: number, y: number, arrayBuffer: any[], offset: number) => void, bl: (x: number, y: number, arrayBuffer: any[], offset: number) => void, br: (x: number, y: number, arrayBuffer: any[], offset: number) => void, arrayBuffer : any[], offset : number) : Quad2;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** A 3D Quad. 4 * 3 floats */\n\t\texport class Quad3 {\t\t\n\t\t/**  \n\t\t*/\n\t\tQuad3(bl1: (x: number, y: number, z: number, arrayBuffer: any[], offset: number) => void, br1: (x: number, y: number, z: number, arrayBuffer: any[], offset: number) => void, tl1: (x: number, y: number, z: number, arrayBuffer: any[], offset: number) => void, tr1: (x: number, y: number, z: number, arrayBuffer: any[], offset: number) => void) : Quad3;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class V3F_C4B_T2F {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tV3F_C4B_T2F(vertices: (x: number, y: number, z: number, arrayBuffer: any[], offset: number) => void, colors: (r: number, g: number, b: number, a: number) => void, texCoords: (u: number, v: number, arrayBuffer: any[], offset: number) => void, arrayBuffer : any[], offset : number) : V3F_C4B_T2F;\t\t\n\t\tBYTES_PER_ELEMENT() : void;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class V3F_C4B_T2F_Quad {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tV3F_C4B_T2F_Quad(tl: (vertices: Vertex3F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, bl: (vertices: Vertex3F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, tr: (vertices: Vertex3F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, br: (vertices: Vertex3F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, arrayBuffer : any[], offset : number) : V3F_C4B_T2F_Quad;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class V2F_C4B_T2F {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tV2F_C4B_T2F(vertices: (x: number, y: number, arrayBuffer: any[], offset: number) => void, colors: (r: number, g: number, b: number, a: number) => void, texCoords: (u: number, v: number, arrayBuffer: any[], offset: number) => void, arrayBuffer : any[], offset : number) : V2F_C4B_T2F;\t\t\n\t\tBYTES_PER_ELEMENT : number;\t\n\t}\t\t\n\t\t/** undefined */\n\t\texport class V2F_C4B_T2F_Triangle {\t\t\n\t\tconstructor();\t\t\n\t\t/**  \n\t\t*/\n\t\tV2F_C4B_T2F_Triangle(a: (vertices: Vertex2F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, b: (vertices: Vertex2F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, c: (vertices: Vertex2F, colors: Color, texCoords: Tex2F, arrayBuffer: any[], offset: number) => void, arrayBuffer : any[], offset : number) : V2F_C4B_T2F_Triangle;\t\n\t}\t\t\n\t\t/** !#en The base class of all value types.\n\t\t!#zh 所有值类型的基类。 */\n\t\texport class ValueType {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en This method returns an exact copy of current value.\n\t\t!#zh 克隆当前值，该方法返回一个新对象，新对象的值和原对象相等。 \n\t\t*/\n\t\tclone() : ValueType;\t\t\n\t\t/** !#en Compares this object with the other one.\n\t\t!#zh 当前对象是否等于指定对象。 \n\t\t*/\n\t\tequals(other : ValueType) : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为方便阅读的字符串。 \n\t\t*/\n\t\ttoString() : string;\t\t\n\t\t/** !#en\n\t\tLinearly interpolates between this value to to value by ratio which is in the range [0, 1].\n\t\tWhen ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.\n\t\t!#zh\n\t\t线性插值。<br/>\n\t\t当 ratio = 0 时返回自身，ratio = 1 时返回目标，ratio = 0.5 返回自身和目标的平均值。。\n\t\t@param to the to value\n\t\t@param ratio the interpolation coefficient \n\t\t*/\n\t\tlerp(to : ValueType, ratio : number) : ValueType;\t\n\t}\t\t\n\t\t/** !#en Representation of 2D vectors and points.\n\t\t!#zh 表示 2D 向量和坐标 */\n\t\texport class Vec2 extends ValueType {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}} \n\t\t*/\n\t\tVec2(x? : number, y? : number) : Vec2;\t\t\n\t\t/** !#en clone a Vec2 value\n\t\t!#zh 克隆一个 Vec2 值 \n\t\t*/\n\t\tclone() : Vec2;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 设置向量值。\n\t\t@param newValue !#en new value to set. !#zh 要设置的新值 \n\t\t*/\n\t\tset(newValue: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 当前的向量是否与指定的向量相等。\n\t\t@param other !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}} \n\t\t*/\n\t\tequals(other: (x: number, y: number) => void) : boolean;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 转换为方便阅读的字符串。 \n\t\t*/\n\t\ttoString() : string;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 线性插值。\n\t\t@param to !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t@param ratio the interpolation coefficient\n\t\t@param out optional, the receiving vector \n\t\t*/\n\t\tlerp(to: (x: number, y: number) => void, ratio : number, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Adds this vector. If you want to save result to another vector, use add() instead.\n\t\t!#zh 向量加法。如果你想保存结果到另一个向量，使用 add() 代替。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.addSelf(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};\n\t\t``` \n\t\t*/\n\t\taddSelf(vector: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Adds two vectors, and returns the new result.\n\t\t!#zh 向量加法，并返回新结果。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.add(cc.v2(5, 5));      // return Vec2 {x: 15, y: 15};\n\t\tvar v1;\n\t\tv.add(cc.v2(5, 5), v1);  // return Vec2 {x: 15, y: 15};\n\t\t``` \n\t\t*/\n\t\tadd(vector: (x: number, y: number) => void, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.\n\t\t!#zh 向量减法。如果你想保存结果到另一个向量，可使用 sub() 代替。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};\n\t\t``` \n\t\t*/\n\t\tsubSelf(vector: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Subtracts one vector from this, and returns the new result.\n\t\t!#zh 向量减法，并返回新结果。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.sub(cc.v2(5, 5));      // return Vec2 {x: 5, y: 5};\n\t\tvar v1;\n\t\tv.sub(cc.v2(5, 5), v1);  // return Vec2 {x: 5, y: 5};\n\t\t``` \n\t\t*/\n\t\tsub(vector: (x: number, y: number) => void, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.\n\t\t!#zh 缩放当前向量。如果你想结果保存到另一个向量，可使用 mul() 代替。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.mulSelf(5);// return Vec2 {x: 50, y: 50};\n\t\t``` \n\t\t*/\n\t\tmulSelf(num : number) : Vec2;\t\t\n\t\t/** !#en Multiplies by a number, and returns the new result.\n\t\t!#zh 缩放当前向量，并返回新结果。\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.mul(5);      // return Vec2 {x: 50, y: 50};\n\t\tvar v1;\n\t\tv.mul(5, v1);  // return Vec2 {x: 50, y: 50};\n\t\t``` \n\t\t*/\n\t\tmul(num : number, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Multiplies two vectors.\n\t\t!#zh 分量相乘。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};\n\t\t``` \n\t\t*/\n\t\tscaleSelf(vector: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Multiplies two vectors, and returns the new result.\n\t\t!#zh 分量相乘，并返回新的结果。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.scale(cc.v2(5, 5));      // return Vec2 {x: 50, y: 50};\n\t\tvar v1;\n\t\tv.scale(cc.v2(5, 5), v1);  // return Vec2 {x: 50, y: 50};\n\t\t``` \n\t\t*/\n\t\tscale(vector: (x: number, y: number) => void, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Divides by a number. If you want to save result to another vector, use div() instead.\n\t\t!#zh 向量除法。如果你想结果保存到另一个向量，可使用 div() 代替。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.divSelf(5); // return Vec2 {x: 2, y: 2};\n\t\t``` \n\t\t*/\n\t\tdivSelf(vector: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Divides by a number, and returns the new result.\n\t\t!#zh 向量除法，并返回新的结果。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.div(5);      // return Vec2 {x: 2, y: 2};\n\t\tvar v1;\n\t\tv.div(5, v1);  // return Vec2 {x: 2, y: 2};\n\t\t``` \n\t\t*/\n\t\tdiv(vector: (x: number, y: number) => void, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Negates the components. If you want to save result to another vector, use neg() instead.\n\t\t!#zh 向量取反。如果你想结果保存到另一个向量，可使用 neg() 代替。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.negSelf(); // return Vec2 {x: -10, y: -10};\n\t\t``` \n\t\t*/\n\t\tnegSelf() : Vec2;\t\t\n\t\t/** !#en Negates the components, and returns the new result.\n\t\t!#zh 返回取反后的新向量。\n\t\t@param out optional, the receiving vector\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tvar v1;\n\t\tv.neg(v1);  // return Vec2 {x: -10, y: -10};\n\t\t``` \n\t\t*/\n\t\tneg(out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Dot product\n\t\t!#zh 当前向量与指定向量进行点乘。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.dot(cc.v2(5, 5)); // return 100;\n\t\t``` \n\t\t*/\n\t\tdot(vector: (x: number, y: number) => void) : number;\t\t\n\t\t/** !#en Cross product\n\t\t!#zh 当前向量与指定向量进行叉乘。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.cross(cc.v2(5, 5)); // return 0;\n\t\t``` \n\t\t*/\n\t\tcross(vector: (x: number, y: number) => void) : number;\t\t\n\t\t/** !#en Returns the length of this vector.\n\t\t!#zh 返回该向量的长度。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.mag(); // return 14.142135623730951;\n\t\t``` \n\t\t*/\n\t\tmag() : number;\t\t\n\t\t/** !#en Returns the squared length of this vector.\n\t\t!#zh 返回该向量的长度平方。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.magSqr(); // return 200;\n\t\t``` \n\t\t*/\n\t\tmagSqr() : number;\t\t\n\t\t/** !#en Make the length of this vector to 1.\n\t\t!#zh 向量归一化，让这个向量的长度为 1。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar v = cc.v2(10, 10);\n\t\tv.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};\n\t\t``` \n\t\t*/\n\t\tnormalizeSelf() : Vec2;\t\t\n\t\t/** !#en\n\t\tReturns this vector with a magnitude of 1.<br/>\n\t\t<br/>\n\t\tNote that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.\n\t\t!#zh\n\t\t返回归一化后的向量。<br/>\n\t\t<br/>\n\t\t注意，当前向量不变，并返回一个新的归一化向量。如果你想来归一化当前向量，可使用 normalizeSelf 函数。\n\t\t@param out optional, the receiving vector \n\t\t*/\n\t\tnormalize(out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en Get angle in radian between this and vector.\n\t\t!#zh 夹角的弧度。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}} \n\t\t*/\n\t\tangle(vector: (x: number, y: number) => void) : number;\t\t\n\t\t/** !#en Get angle in radian between this and vector with direction.\n\t\t!#zh 带方向的夹角的弧度。\n\t\t@param vector !#en\n\t\tConstructor\n\t\tsee {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} or {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}}\n\t\t!#zh\n\t\t构造函数，可查看 {{#crossLink \"cc/vec2:method\"}}cc.v2{{/crossLink}} 或者 {{#crossLink \"cc/p:method\"}}cc.p{{/crossLink}} \n\t\t*/\n\t\tsignAngle(vector: (x: number, y: number) => void) : number;\t\t\n\t\t/** !#en rotate\n\t\t!#zh 返回旋转给定弧度后的新向量。\n\t\t@param out optional, the receiving vector \n\t\t*/\n\t\trotate(radians : number, out: (x: number, y: number) => void) : Vec2;\t\t\n\t\t/** !#en rotate self\n\t\t!#zh 按指定弧度旋转向量。 \n\t\t*/\n\t\trotateSelf(radians : number) : Vec2;\t\t\n\t\t/** !#en return a Vec2 object with x = 1 and y = 1.\n\t\t!#zh 新 Vec2 对象。 */\n\t\tONE : Vec2;\t\t\n\t\t/** !#en return a Vec2 object with x = 0 and y = 0.\n\t\t!#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */\n\t\tZERO : Vec2;\t\t\n\t\t/** !#en return a Vec2 object with x = 0 and y = 1.\n\t\t!#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */\n\t\tup : Vec2;\t\t\n\t\t/** !#en return a Vec2 object with x = 1 and y = 0.\n\t\t!#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */\n\t\tRIGHT : Vec2;\t\n\t}\t\n\t\n\t/****************************************************\n\t* Node\n\t*****************************************************/\n\t\n\texport module Node {\t\t\n\t\t/** !#en The event type supported by Node\n\t\t!#zh Node 支持的事件类型 */\n\t\texport enum EventType {\t\t\t\n\t\t\tTOUCH_START = 0,\n\t\t\tTOUCH_MOVE = 0,\n\t\t\tTOUCH_END = 0,\n\t\t\tTOUCH_CANCEL = 0,\n\t\t\tMOUSE_DOWN = 0,\n\t\t\tMOUSE_MOVE = 0,\n\t\t\tMOUSE_ENTER = 0,\n\t\t\tMOUSE_LEAVE = 0,\n\t\t\tMOUSE_UP = 0,\n\t\t\tMOUSE_WHEEL = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* ParticleSystem\n\t*****************************************************/\n\t\n\texport module ParticleSystem {\t\t\n\t\t/** !#en Enum for emitter modes\n\t\t!#zh 发射模式 */\n\t\texport enum EmitterMode {\t\t\t\n\t\t\tGRAVITY = 0,\n\t\t\tRADIUS = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* ParticleSystem\n\t*****************************************************/\n\t\n\texport module ParticleSystem {\t\t\n\t\t/** !#en Enum for particles movement type.\n\t\t!#zh 粒子位置类型 */\n\t\texport enum PositionType {\t\t\t\n\t\t\tFREE = 0,\n\t\t\tRELATIVE = 0,\n\t\t\tGROUPED = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* TiledMap\n\t*****************************************************/\n\t\n\texport module TiledMap {\t\t\n\t\t/** !#en The orientation of tiled map.\n\t\t!#zh Tiled Map 地图方向。 */\n\t\texport enum Orientation {\t\t\t\n\t\t\tORTHO = 0,\n\t\t\tHEX = 0,\n\t\t\tISO = 0,\n\t\t\tNONE = 0,\n\t\t\tMAP = 0,\n\t\t\tLAYER = 0,\n\t\t\tOBJECTGROUP = 0,\n\t\t\tOBJECT = 0,\n\t\t\tTILE = 0,\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\n\t\t\tDIAGONAL = 0,\n\t\t\tFLIPPED_ALL = 0,\n\t\t\tFLIPPED_MASK = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Button\n\t*****************************************************/\n\t\n\texport module Button {\t\t\n\t\t/** !#en Enum for transition type.\n\t\t!#zh 过渡类型 */\n\t\texport enum Transition {\t\t\t\n\t\t\tNONE = 0,\n\t\t\tCOLOR = 0,\n\t\t\tSPRITE = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Component\n\t*****************************************************/\n\t\n\texport module Component {\t\t\t\n\t\t\t/** !#en\n\t\t\tComponent will register a event to target component's handler.\n\t\t\tAnd it will trigger the handler when a certain event occurs.\n\t\t\t\n\t\t\t!@zh\n\t\t\t“EventHandler” 类用来设置场景中的事件回调，\n\t\t\t该类允许用户设置回调目标节点，目标组件名，组件方法名，\n\t\t\t并可通过 emit 方法调用目标函数。 */\n\t\t\texport class EventHandler {\t\t\t\n\t\t\t/** !#en Event target\n\t\t\t!#zh 目标节点 */\n\t\t\ttarget : Node;\t\t\t\n\t\t\t/** !#en Component name\n\t\t\t!#zh 目标组件名 */\n\t\t\tcomponent : string;\t\t\t\n\t\t\t/** !#en Event handler\n\t\t\t!#zh 响应事件函数名 */\n\t\t\thandler : string;\t\t\t\n\t\t\t/**  \n\t\t\t*/\n\t\t\temitEvents(events : Component.EventHandler[]) : void;\t\t\t\n\t\t\t/** !#en Emit event with params\n\t\t\t!#zh 触发目标组件上的指定 handler 函数，该参数是回调函数的参数值（可不填）。\n\t\t\t\n\t\t\t@example \n\t\t\t```js\n\t\t\t// Call Function\n\t\t\tvar eventHandler = new cc.Component.EventHandler();\n\t\t\teventHandler.target = newTarget;\n\t\t\teventHandler.component = \"MainMenu\";\n\t\t\teventHandler.handler = \"OnClick\"\n\t\t\teventHandler.emit(\"This is the argument to the callback function!\");\n\t\t\t``` \n\t\t\t*/\n\t\t\temit(params : any) : void;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* EditBox\n\t*****************************************************/\n\t\n\texport module EditBox {\t\t\n\t\t/** !#en Enum for keyboard return types\n\t\t!#zh 键盘的返回键类型 */\n\t\texport enum KeyboardReturnType {\t\t\t\n\t\t\tDEFAULT = 0,\n\t\t\tDONE = 0,\n\t\t\tSEND = 0,\n\t\t\tSEARCH = 0,\n\t\t\tGO = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* EditBox\n\t*****************************************************/\n\t\n\texport module EditBox {\t\t\n\t\t/** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.\n\t\t!#zh 输入模式 */\n\t\texport enum InputMode {\t\t\t\n\t\t\tANY = 0,\n\t\t\tEMAIL_ADDR = 0,\n\t\t\tNUMERIC = 0,\n\t\t\tPHONE_NUMBER = 0,\n\t\t\tURL = 0,\n\t\t\tDECIMAL = 0,\n\t\t\tSINGLE_LINE = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* EditBox\n\t*****************************************************/\n\t\n\texport module EditBox {\t\t\n\t\t/** !#en Enum for the EditBox's input flags\n\t\t!#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */\n\t\texport enum InputFlag {\t\t\t\n\t\t\tPASSWORD = 0,\n\t\t\tSENSITIVE = 0,\n\t\t\tINITIAL_CAPS_WORD = 0,\n\t\t\tINITIAL_CAPS_SENTENCE = 0,\n\t\t\tINITIAL_CAPS_ALL_CHARACTERS = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Label\n\t*****************************************************/\n\t\n\texport module Label {\t\t\n\t\t/** !#en Enum for Overflow.\n\t\t!#zh Overflow 类型 */\n\t\texport enum Overflow {\t\t\t\n\t\t\tNONE = 0,\n\t\t\tCLAMP = 0,\n\t\t\tSHRINK = 0,\n\t\t\tRESIZE_HEIGHT = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Label\n\t*****************************************************/\n\t\n\texport module Label {\t\t\n\t\t/** !#en Enum for font type.\n\t\t!#zh Type 类型 */\n\t\texport enum Type {\t\t\t\n\t\t\tTTF = 0,\n\t\t\tBMFont = 0,\n\t\t\tSystemFont = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Layout\n\t*****************************************************/\n\t\n\texport module Layout {\t\t\n\t\t/** !#en Enum for Layout type\n\t\t!#zh 布局类型 */\n\t\texport enum Type {\t\t\t\n\t\t\tNONE = 0,\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\n\t\t\tGRID = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Layout\n\t*****************************************************/\n\t\n\texport module Layout {\t\t\n\t\t/** !#en Enum for Layout Resize Mode\n\t\t!#zh 缩放模式 */\n\t\texport enum ResizeMode {\t\t\t\n\t\t\tNONE = 0,\n\t\t\tCONTAINER = 0,\n\t\t\tCHILDREN = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Layout\n\t*****************************************************/\n\t\n\texport module Layout {\t\t\n\t\t/** !#en Enum for Grid Layout start axis direction.\n\t\t!#zh 布局轴向，只用于 GRID 布局。 */\n\t\texport enum AxisDirection {\t\t\t\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Layout\n\t*****************************************************/\n\t\n\texport module Layout {\t\t\n\t\t/** !#en Enum for vertical layout direction.\n\t\t!#zh 垂直方向布局方式 */\n\t\texport enum VerticalDirection {\t\t\t\n\t\t\tBOTTOM_TO_TOP = 0,\n\t\t\tTOP_TO_BOTTOM = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Layout\n\t*****************************************************/\n\t\n\texport module Layout {\t\t\n\t\t/** !#en Enum for horizontal layout direction.\n\t\t!#zh 水平方向布局方式 */\n\t\texport enum HorizontalDirection {\t\t\t\n\t\t\tLEFT_TO_RIGHT = 0,\n\t\t\tRIGHT_TO_LEFT = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Mask\n\t*****************************************************/\n\t\n\texport module Mask {\t\t\n\t\t/** !#en the type for mask.\n\t\t!#zh 遮罩组件的类型 */\n\t\texport enum Type {\t\t\t\n\t\t\tRECT = 0,\n\t\t\tELLIPSE = 0,\n\t\t\ttype = 0,\n\t\t\tsegements = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* ProgressBar\n\t*****************************************************/\n\t\n\texport module ProgressBar {\t\t\n\t\t/** !#en Enum for ProgressBar mode\n\t\t!#zh 进度条模式 */\n\t\texport enum Mode {\t\t\t\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\n\t\t\tFILLED = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Scrollbar\n\t*****************************************************/\n\t\n\texport module Scrollbar {\t\t\n\t\t/** Enum for Scrollbar direction */\n\t\texport enum Direction {\t\t\t\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* ScrollView\n\t*****************************************************/\n\t\n\texport module ScrollView {\t\t\n\t\t/** !#en Enum for ScrollView event type.\n\t\t!#zh 滚动视图事件类型 */\n\t\texport enum EventType {\t\t\t\n\t\t\tSCROLL_TO_TOP = 0,\n\t\t\tSCROLL_TO_BOTTOM = 0,\n\t\t\tSCROLL_TO_LEFT = 0,\n\t\t\tSCROLL_TO_RIGHT = 0,\n\t\t\tSCROLLING = 0,\n\t\t\tBOUNCE_TOP = 0,\n\t\t\tBOUNCE_BOTTOM = 0,\n\t\t\tBOUNCE_LEFT = 0,\n\t\t\tBOUNCE_RIGHT = 0,\n\t\t\tAUTOSCROLL_ENDED = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Sprite\n\t*****************************************************/\n\t\n\texport module Sprite {\t\t\n\t\t/** !#en Enum for sprite type.\n\t\t!#zh Sprite 类型 */\n\t\texport enum SpriteType {\t\t\t\n\t\t\tSIMPLE = 0,\n\t\t\tSLICED = 0,\n\t\t\tTILED = 0,\n\t\t\tFILLED = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Sprite\n\t*****************************************************/\n\t\n\texport module Sprite {\t\t\n\t\t/** !#en Enum for fill type.\n\t\t!#zh 填充类型 */\n\t\texport enum FillType {\t\t\t\n\t\t\tHORIZONTAL = 0,\n\t\t\tVERTICAL = 0,\n\t\t\tRADIAL = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Sprite\n\t*****************************************************/\n\t\n\texport module Sprite {\t\t\n\t\t/** !#en Sprite Size can track trimmed size, raw size or none.\n\t\t!#zh 精灵尺寸调整模式 */\n\t\texport enum SizeMode {\t\t\t\n\t\t\tCUSTOM = 0,\n\t\t\tTRIMMED = 0,\n\t\t\tRAW = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* VideoPlayer\n\t*****************************************************/\n\t\n\texport module VideoPlayer {\t\t\n\t\t/** !#en Enum for video resouce type type.\n\t\t!#zh 视频来源 */\n\t\texport enum ResourceType {\t\t\t\n\t\t\tREMOTE = 0,\n\t\t\tLOCAL = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Event\n\t*****************************************************/\n\t\n\texport module Event {\t\t\t\n\t\t\t/** !#en The Custom event\n\t\t\t!#zh 自定义事件 */\n\t\t\texport class EventCustom extends Event {\t\t\t\n\t\t\tconstructor();\t\t\t\n\t\t\t/** \n\t\t\t@param type The name of the event (case-sensitive), e.g. \"click\", \"fire\", or \"submit\"\n\t\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t\t*/\n\t\t\tEventCustom(type : string, bubbles : boolean) : EventCustom;\t\t\t\n\t\t\t/** !#en A reference to the detailed data of the event\n\t\t\t!#zh 事件的详细数据 */\n\t\t\tdetail : any;\t\t\t\n\t\t\t/** !#en Sets user data\n\t\t\t!#zh 设置用户数据 \n\t\t\t*/\n\t\t\tsetUserData(data : any) : void;\t\t\t\n\t\t\t/** !#en Gets user data\n\t\t\t!#zh 获取用户数据 \n\t\t\t*/\n\t\t\tgetUserData() : any;\t\t\t\n\t\t\t/** !#en Gets event name\n\t\t\t!#zh 获取事件名称 \n\t\t\t*/\n\t\t\tgetEventName() : string;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Event\n\t*****************************************************/\n\t\n\texport module Event {\t\t\t\n\t\t\t/** !#en The mouse event\n\t\t\t!#zh 鼠标事件类型 */\n\t\t\texport class EventMouse extends Event {\t\t\t\n\t\t\t/** \n\t\t\t@param eventType The mouse event type, UP, DOWN, MOVE, CANCELED\n\t\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t\t*/\n\t\t\tconstructor(eventType : number, bubbles? : boolean);\t\t\t\n\t\t\t/** !#en Sets scroll data.\n\t\t\t!#zh 设置鼠标的滚动数据。 \n\t\t\t*/\n\t\t\tsetScrollData(scrollX : number, scrollY : number) : void;\t\t\t\n\t\t\t/** !#en Returns the x axis scroll value.\n\t\t\t!#zh 获取鼠标滚动的X轴距离，只有滚动时才有效。 \n\t\t\t*/\n\t\t\tgetScrollX() : number;\t\t\t\n\t\t\t/** !#en Returns the y axis scroll value.\n\t\t\t!#zh 获取滚轮滚动的 Y 轴距离，只有滚动时才有效。 \n\t\t\t*/\n\t\t\tgetScrollY() : number;\t\t\t\n\t\t\t/** !#en Sets cursor location.\n\t\t\t!#zh 设置当前鼠标位置。 \n\t\t\t*/\n\t\t\tsetLocation(x : number, y : number) : void;\t\t\t\n\t\t\t/** !#en Returns cursor location.\n\t\t\t!#zh 获取鼠标位置对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetLocation() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the current cursor location in screen coordinates.\n\t\t\t!#zh 获取当前事件在游戏窗口内的坐标位置对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetLocationInView() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the previous touch location.\n\t\t\t!#zh 获取鼠标点击在上一次事件时的位置对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetPreviousLocation() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the delta distance from the previous location to current location.\n\t\t\t!#zh 获取鼠标距离上一次事件移动的距离对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetDelta() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the X axis delta distance from the previous location to current location.\n\t\t\t!#zh 获取鼠标距离上一次事件移动的 X 轴距离。 \n\t\t\t*/\n\t\t\tgetDeltaX() : number;\t\t\t\n\t\t\t/** !#en Returns the Y axis delta distance from the previous location to current location.\n\t\t\t!#zh 获取鼠标距离上一次事件移动的 Y 轴距离。 \n\t\t\t*/\n\t\t\tgetDeltaY() : number;\t\t\t\n\t\t\t/** !#en Sets mouse button.\n\t\t\t!#zh 设置鼠标按键。 \n\t\t\t*/\n\t\t\tsetButton(button : number) : void;\t\t\t\n\t\t\t/** !#en Returns mouse button.\n\t\t\t!#zh 获取鼠标按键。 \n\t\t\t*/\n\t\t\tgetButton() : number;\t\t\t\n\t\t\t/** !#en Returns location X axis data.\n\t\t\t!#zh 获取鼠标当前位置 X 轴。 \n\t\t\t*/\n\t\t\tgetLocationX() : number;\t\t\t\n\t\t\t/** !#en Returns location Y axis data.\n\t\t\t!#zh 获取鼠标当前位置 Y 轴。 \n\t\t\t*/\n\t\t\tgetLocationY() : number;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Event\n\t*****************************************************/\n\t\n\texport module Event {\t\t\t\n\t\t\t/** !#en The touch event\n\t\t\t!#zh 触摸事件 */\n\t\t\texport class EventTouch extends Event {\t\t\t\n\t\t\t/** \n\t\t\t@param touchArr The array of the touches\n\t\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t\t*/\n\t\t\tconstructor(touchArr : any[], bubbles : boolean);\t\t\t\n\t\t\t/** !#en Returns event code.\n\t\t\t!#zh 获取事件类型。 \n\t\t\t*/\n\t\t\tgetEventCode() : number;\t\t\t\n\t\t\t/** !#en Returns touches of event.\n\t\t\t!#zh 获取触摸点的列表。 \n\t\t\t*/\n\t\t\tgetTouches() : any[];\t\t\t\n\t\t\t/** !#en Sets touch location.\n\t\t\t!#zh 设置当前触点位置 \n\t\t\t*/\n\t\t\tsetLocation(x : number, y : number) : void;\t\t\t\n\t\t\t/** !#en Returns touch location.\n\t\t\t!#zh 获取触点位置。 \n\t\t\t*/\n\t\t\tgetLocation() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the current touch location in screen coordinates.\n\t\t\t!#zh 获取当前触点在游戏窗口中的位置。 \n\t\t\t*/\n\t\t\tgetLocationInView() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the previous touch location.\n\t\t\t!#zh 获取触点在上一次事件时的位置对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetPreviousLocation() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the start touch location.\n\t\t\t!#zh 获获取触点落下时的位置对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetStartLocation() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the id of cc.Touch.\n\t\t\t!#zh 触点的标识 ID，可以用来在多点触摸中跟踪触点。 \n\t\t\t*/\n\t\t\tgetID() : number;\t\t\t\n\t\t\t/** !#en Returns the delta distance from the previous location to current location.\n\t\t\t!#zh 获取触点距离上一次事件移动的距离对象，对象包含 x 和 y 属性。 \n\t\t\t*/\n\t\t\tgetDelta() : Vec2;\t\t\t\n\t\t\t/** !#en Returns the X axis delta distance from the previous location to current location.\n\t\t\t!#zh 获取触点距离上一次事件移动的 x 轴距离。 \n\t\t\t*/\n\t\t\tgetDeltaX() : number;\t\t\t\n\t\t\t/** !#en Returns the Y axis delta distance from the previous location to current location.\n\t\t\t!#zh 获取触点距离上一次事件移动的 y 轴距离。 \n\t\t\t*/\n\t\t\tgetDeltaY() : number;\t\t\t\n\t\t\t/** !#en Returns location X axis data.\n\t\t\t!#zh 获取当前触点 X 轴位置。 \n\t\t\t*/\n\t\t\tgetLocationX() : number;\t\t\t\n\t\t\t/** !#en Returns location Y axis data.\n\t\t\t!#zh 获取当前触点 Y 轴位置。 \n\t\t\t*/\n\t\t\tgetLocationY() : number;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Event\n\t*****************************************************/\n\t\n\texport module Event {\t\t\t\n\t\t\t/** !#en The acceleration event\n\t\t\t!#zh 加速度事件 */\n\t\t\texport class EventAcceleration extends Event {\t\t\t\n\t\t\t/** \n\t\t\t@param acc The acceleration\n\t\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t\t*/\n\t\t\tconstructor(acc : any, bubbles : boolean);\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Event\n\t*****************************************************/\n\t\n\texport module Event {\t\t\t\n\t\t\t/** !#en The keyboard event\n\t\t\t!#zh 键盘事件 */\n\t\t\texport class EventKeyboard extends Event {\t\t\t\n\t\t\t/** \n\t\t\t@param keyCode The key code of which triggered this event\n\t\t\t@param isPressed A boolean indicating whether the key have been pressed\n\t\t\t@param bubbles A boolean indicating whether the event bubbles up through the tree or not \n\t\t\t*/\n\t\t\tconstructor(keyCode : number, isPressed : boolean, bubbles : boolean);\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Pipeline\n\t*****************************************************/\n\t\n\texport module Pipeline {\t\t\t\n\t\t\t/** The downloader pipe, it can download several types of files:\n\t\t\t1. Text\n\t\t\t2. Image\n\t\t\t3. Script\n\t\t\t4. Audio\n\t\t\tAll unknown type will be downloaded as plain text.\n\t\t\tYou can pass custom supported types in the constructor. */\n\t\t\texport class Downloader {\t\t\t\n\t\t\t/** Constructor of Downloader, you can pass custom supported types.\n\t\t\t@param extMap Custom supported types with corresponded handler\n\t\t\t\n\t\t\t@example \n\t\t\t```js\n\t\t\tvar downloader = new Downloader({\n\t\t\t     // This will match all url with `.scene` extension or all url with `scene` type\n\t\t\t     'scene' : function (url, callback) {}\n\t\t\t });\n\t\t\t``` \n\t\t\t*/\n\t\t\tDownloader(extMap : any) : void;\t\t\t\n\t\t\t/** Add custom supported types handler or modify existing type handler.\n\t\t\t@param extMap Custom supported types with corresponded handler \n\t\t\t*/\n\t\t\taddHandlers(extMap : any) : void;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Pipeline\n\t*****************************************************/\n\t\n\texport module Pipeline {\t\t\t\n\t\t\t/** The loader pipe, it can load several types of files:\n\t\t\t1. Images\n\t\t\t2. JSON\n\t\t\t3. Plist\n\t\t\t4. Audio\n\t\t\t5. Font\n\t\t\t6. Cocos Creator scene\n\t\t\tIt will not interfere with items of unknown type.\n\t\t\tYou can pass custom supported types in the constructor. */\n\t\t\texport class Loader {\t\t\t\n\t\t\t/** Constructor of Loader, you can pass custom supported types.\n\t\t\t@param extMap Custom supported types with corresponded handler\n\t\t\t\n\t\t\t@example \n\t\t\t```js\n\t\t\tvar loader = new Loader({\n\t\t\t     // This will match all url with `.scene` extension or all url with `scene` type\n\t\t\t     'scene' : function (url, callback) {}\n\t\t\t });\n\t\t\t``` \n\t\t\t*/\n\t\t\tLoader(extMap : any) : void;\t\t\t\n\t\t\t/** Add custom supported types handler or modify existing type handler.\n\t\t\t@param extMap Custom supported types with corresponded handler \n\t\t\t*/\n\t\t\taddHandlers(extMap : any) : void;\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Texture2D\n\t*****************************************************/\n\t\n\texport module Texture2D {\t\t\n\t\t/** The texture wrap mode */\n\t\texport enum WrapMode {\t\t\t\n\t\t\tREPEAT = 0,\n\t\t\tCLAMP_TO_EDGE = 0,\n\t\t\tMIRRORED_REPEAT = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Label\n\t*****************************************************/\n\t\n\texport module Label {\t\t\n\t\t/** !#en Enum for text alignment.\n\t\t!#zh 文本对齐类型 */\n\t\texport enum TextAlignment {\t\t\t\n\t\t\tLEFT = 0,\n\t\t\tCENTER = 0,\n\t\t\tRIGHT = 0,\t\t\n\t\t}\t\n\t}\t\n\t\n\t/****************************************************\n\t* Label\n\t*****************************************************/\n\t\n\texport module Label {\t\t\n\t\t/** !#en Enum for vertical text alignment.\n\t\t!#zh 文本垂直对齐类型 */\n\t\texport enum VerticalTextAlignment {\t\t\t\n\t\t\tTOP = 0,\n\t\t\tCENTER = 0,\n\t\t\tBOTTOM = 0,\t\t\n\t\t}\t\n\t}\n}\n/** !#en\nThe global main namespace of Spine, all classes, functions,\nproperties and constants of Spine are defined in this namespace\n!#zh\nSpine 的全局的命名空间，\n与 Spine 相关的所有的类，函数，属性，常量都在这个命名空间中定义。 */\ndeclare module sp {\t\n\t/** !#en\n\tThe official spine runtime.<br/>\n\tSee http://en.esotericsoftware.com/spine-using-runtimes\n\t!#zh\n\t官方 Spine Runtime。<br/>\n\t可查看 Spine 官方文档 http://en.esotericsoftware.com/spine-using-runtimes */\n\texport var spine : any;\t\t\n\t\t/** !#en\n\t\tThe skeleton of Spine <br/>\n\t\t<br/>\n\t\t(Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,\n\t\twhich consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>\n\t\tMultiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>\n\t\t!#zh\n\t\tSpine 骨骼动画 <br/>\n\t\t<br/>\n\t\t(Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态，\n\t\t它由当前的骨骼动作，slot 颜色，和可见的 slot attachments 组成。<br/>\n\t\t多个 Skeleton 可以使用相同的骨骼数据，其中包括所有的动画，皮肤和 attachments。 */\n\t\texport class Skeleton extends cc._RendererUnderSG {\t\t\n\t\tconstructor();\t\t\n\t\t/** !#en The skeletal animation is paused?\n\t\t!#zh 该骨骼动画是否暂停。 */\n\t\tpaused : boolean;\t\t\n\t\t/** !#en\n\t\tThe skeleton data contains the skeleton information (bind pose bones, slots, draw order,\n\t\tattachments, skins, etc) and animations but does not hold any state.<br/>\n\t\tMultiple skeletons can share the same skeleton data.\n\t\t!#zh\n\t\t骨骼数据包含了骨骼信息（绑定骨骼动作，slots，渲染顺序，\n\t\tattachments，皮肤等等）和动画但不持有任何状态。<br/>\n\t\t多个 Skeleton 可以共用相同的骨骼数据。 */\n\t\tskeletonData : SkeletonData;\t\t\n\t\t/** !#en The name of default skin.\n\t\t!#zh 默认的皮肤名称。 */\n\t\tdefaultSkin : string;\t\t\n\t\t/** !#en The name of default animation.\n\t\t!#zh 默认的动画名称。 */\n\t\tdefaultAnimation : string;\t\t\n\t\t/** !#en The name of current playing animation.\n\t\t!#zh 当前播放的动画名称。 */\n\t\tanimation : string;\t\t\n\t\t_defaultSkinIndex : number;\t\t\n\t\t/** !#en TODO\n\t\t!#zh 是否循环播放当前骨骼动画。 */\n\t\tloop : boolean;\t\t\n\t\t/** !#en The time scale of this skeleton.\n\t\t!#zh 当前骨骼中所有动画的时间缩放率。 */\n\t\ttimeScale : number;\t\t\n\t\t/** !#en Indicates whether open debug slots.\n\t\t!#zh 是否显示 slot 的 debug 信息。 */\n\t\tdebugSlots : boolean;\t\t\n\t\t/** !#en Indicates whether open debug bones.\n\t\t!#zh 是否显示 bone 的 debug 信息。 */\n\t\tdebugBones : boolean;\t\t\n\t\t/** !#en Computes the world SRT from the local SRT for each bone.\n\t\t!#zh 重新更新所有骨骼的世界 Transform，\n\t\t当获取 bone 的数值未更新时，即可使用该函数进行更新数值。\n\t\t\n\t\t@example \n\t\t```js\n\t\tvar bone = spine.findBone('head');\n\t\tcc.log(bone.worldX); // return 0;\n\t\tspine.updateWorldTransform();\n\t\tbone = spine.findBone('head');\n\t\tcc.log(bone.worldX); // return -23.12;\n\t\t``` \n\t\t*/\n\t\tupdateWorldTransform() : void;\t\t\n\t\t/** !#en Sets the bones and slots to the setup pose.\n\t\t!#zh 还原到起始动作 \n\t\t*/\n\t\tsetToSetupPose() : void;\t\t\n\t\t/** !#en\n\t\tSets the bones to the setup pose,\n\t\tusing the values from the `BoneData` list in the `SkeletonData`.\n\t\t!#zh\n\t\t设置 bone 到起始动作\n\t\t使用 SkeletonData 中的 BoneData 列表中的值。 \n\t\t*/\n\t\tsetBonesToSetupPose() : void;\t\t\n\t\t/** !#en\n\t\tSets the slots to the setup pose,\n\t\tusing the values from the `SlotData` list in the `SkeletonData`.\n\t\t!#zh\n\t\t设置 slot 到起始动作。\n\t\t使用 SkeletonData 中的 SlotData 列表中的值。 \n\t\t*/\n\t\tsetSlotsToSetupPose() : void;\t\t\n\t\t/** !#en\n\t\tFinds a bone by name.\n\t\tThis does a string comparison for every bone.\n\t\t!#zh\n\t\t通过名称查找 bone。\n\t\t这里对每个 bone 的名称进行了对比。 \n\t\t*/\n\t\tfindBone(boneName : string) : spine.Bone;\t\t\n\t\t/** !#en\n\t\tFinds a slot by name.\n\t\tThis does a string comparison for every slot.\n\t\t!#zh\n\t\t通过名称查找 slot。\n\t\t这里对每个 slot 的名称进行了比较。 \n\t\t*/\n\t\tfindSlot(slotName : string) : spine.Slot;\t\t\n\t\t/** !#en\n\t\tFinds a skin by name and makes it the active skin.\n\t\tThis does a string comparison for every skin.\n\t\tNote that setting the skin does not change which attachments are visible.\n\t\t!#zh\n\t\t按名称查找皮肤，激活该皮肤。\n\t\t这里对每个皮肤的名称进行了比较。\n\t\t注意：设置皮肤不会改变 attachment 的可见性。。 \n\t\t*/\n\t\tsetSkin(skinName : string) : spine.Skin;\t\t\n\t\t/** !#en\n\t\tReturns the attachment for the slot and attachment name.\n\t\tThe skeleton looks first in its skin, then in the skeleton data’s default skin.\n\t\t!#zh\n\t\t通过 slot 和 attachment 的名称获取 attachment。\n\t\tSkeleton 优先查找它的皮肤，然后才是 Skeleton Data 中默认的皮肤。 \n\t\t*/\n\t\tgetAttachment(slotName : string, attachmentName : string) : spine.RegionAttachment;\t\t\n\t\t/** !#en\n\t\tSets the attachment for the slot and attachment name.\n\t\tThe skeleton looks first in its skin, then in the skeleton data’s default skin.\n\t\t!#zh\n\t\t通过 slot 和 attachment 的名字来设置 attachment。\n\t\tSkeleton 优先查找它的皮肤，然后才是 Skeleton Data 中默认的皮肤。 \n\t\t*/\n\t\tsetAttachment(slotName : string, attachmentName : string) : void;\t\t\n\t\t/** !#en Sets skeleton data to sp.Skeleton.\n\t\t!#zh 设置 Skeleton 中的 Skeleton Data。 \n\t\t*/\n\t\tsetSkeletonData(skeletonData : spine.SkeletonData, ownsSkeletonData : spine.SkeletonData) : void;\t\t\n\t\t/** !#en Sets animation state data.\n\t\t!#zh 设置动画状态数据。 \n\t\t*/\n\t\tsetAnimationStateData(stateData : spine.AnimationStateData) : void;\t\t\n\t\t/** !#en\n\t\tMix applies all keyframe values,\n\t\tinterpolated for the specified time and mixed with the current values.\n\t\t!#zh 为所有关键帧设定混合及混合时间（从当前值开始差值）。 \n\t\t*/\n\t\tsetMix(fromAnimation : string, toAnimation : string, duration : number) : void;\t\t\n\t\t/** !#en Sets event listener.\n\t\t!#zh 设置动画事件监听器。 \n\t\t*/\n\t\tsetAnimationListener(target : any, callback : Function) : void;\t\t\n\t\t/** !#en Set the current animation. Any queued animations are cleared.\n\t\t!#zh 设置当前动画。队列中的任何的动画将被清除。 \n\t\t*/\n\t\tsetAnimation(trackIndex : number, name : string, loop : boolean) : spine.TrackEntry;\t\t\n\t\t/** !#en Adds an animation to be played delay seconds after the current or last queued animation.\n\t\t!#zh 添加一个动画到动画队列尾部，还可以延迟指定的秒数。 \n\t\t*/\n\t\taddAnimation(trackIndex : number, name : string, loop : boolean, delay? : number) : spine.TrackEntry;\t\t\n\t\t/** !#en Returns track entry by trackIndex.\n\t\t!#zh 通过 track 索引获取 TrackEntry。 \n\t\t*/\n\t\tgetCurrent(trackIndex : void) : spine.TrackEntry;\t\t\n\t\t/** !#en Clears all tracks of animation state.\n\t\t!#zh 清除所有 track 的动画状态。 \n\t\t*/\n\t\tclearTracks() : void;\t\t\n\t\t/** !#en Clears track of animation state by trackIndex.\n\t\t!#zh 清除出指定 track 的动画状态。 \n\t\t*/\n\t\tclearTrack(trackIndex : number) : void;\t\t\n\t\t/** !#en Set the start event listener.\n\t\t!#zh 用来设置开始播放动画的事件监听。 \n\t\t*/\n\t\tsetStartListener(listener : Function) : void;\t\t\n\t\t/** !#en Set the end event listener.\n\t\t!#zh 用来设置动画播放完后的事件监听。 \n\t\t*/\n\t\tsetEndListener(listener : Function) : void;\t\n\t}\t\t\n\t\t/** !#en The skeleton data of spine.\n\t\t!#zh Spine 的 骨骼数据。 */\n\t\texport class SkeletonData extends cc.Asset {\t\t\n\t\t/** !#en See http://en.esotericsoftware.com/spine-json-format\n\t\t!#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */\n\t\tskeletonJson : any;\t\t\n\t\tatlasText : string;\t\t\n\t\ttextures : Texture2D;\t\t\n\t\t/** !#en\n\t\tA scale can be specified on the JSON or binary loader which will scale the bone positions,\n\t\timage sizes, and animation translations.\n\t\tThis can be useful when using different sized images than were used when designing the skeleton\n\t\tin Spine. For example, if using images that are half the size than were used in Spine,\n\t\ta scale of 0.5 can be used. This is commonly used for games that can run with either low or high\n\t\tresolution texture atlases.\n\t\tsee http://en.esotericsoftware.com/spine-using-runtimes#Scaling\n\t\t!#zh 可查看 Spine 官方文档： http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */\n\t\tscale : number;\t\t\n\t\t/** !#en Get the included SkeletonData used in spine runtime.\n\t\t!#zh 获取 Spine Runtime 使用的 SkeletonData。 \n\t\t*/\n\t\tgetRuntimeData(quiet? : boolean) : spine.SkeletonData;\t\n\t}\t\n\t/** !#en The event type of spine skeleton animation.\n\t!#zh 骨骼动画事件类型。 */\n\texport enum AnimationEventType {\t\t\n\t\tSTART = 0,\n\t\tEND = 0,\n\t\tCOMPLETE = 0,\n\t\tEVENT = 0,\t\n\t}\n}\n/** This module provides some JavaScript utilities.\nAll members can be accessed with cc.js */\ndeclare module js {\t\n\t/** Check the obj whether is number or not\n\tIf a number is created by using 'new Number(10086)', the typeof it will be \"object\"...\n\tThen you can use this function if you care about this case. \n\t*/\n\texport function isNumber(obj : any) : boolean;\t\n\t/** Check the obj whether is string or not.\n\tIf a string is created by using 'new String(\"blabla\")', the typeof it will be \"object\"...\n\tThen you can use this function if you care about this case. \n\t*/\n\texport function isString(obj : any) : boolean;\t\n\t/** copy all properties not defined in obj from arguments[1...n]\n\t@param obj object to extend its properties\n\t@param sourceObj source object to copy properties from \n\t*/\n\texport function addon(obj : any, sourceObj : any) : any;\t\n\t/** copy all properties from arguments[1...n] to obj \n\t*/\n\texport function mixin(obj : any, sourceObj : any) : any;\t\n\t/** Derive the class from the supplied base class.\n\tBoth classes are just native javascript constructors, not created by cc.Class, so\n\tusually you will want to inherit using {{#crossLink \"cc/Class:method\"}}cc.Class {{/crossLink}} instead.\n\t@param base the baseclass to inherit \n\t*/\n\texport function extend(cls : Function, base : Function) : Function;\t\n\t/** Removes all enumerable properties from object \n\t*/\n\texport function clear(obj : any) : void;\t\n\t/** Get property descriptor in object and all its ancestors \n\t*/\n\texport function getPropertyDescriptor(obj : any, name : string) : any;\t\n\t/** Get class name of the object, if object is just a {} (and which class named 'Object'), it will return null.\n\t(modified from <a href=\"http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class\">the code from this stackoverflow post</a>)\n\t@param obj instance or constructor \n\t*/\n\texport function getClassName(obj : any|Function) : string;\t\n\t/** Register the class by specified name manually \n\t*/\n\texport function setClassName(className : string, constructor : Function) : void;\t\n\t/** Unregister a class from fireball.\n\t\n\tIf you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.\n\tPlease note that its still your responsibility to free other references to the class.\n\t@param constructor the class you will want to unregister, any number of classes can be added \n\t*/\n\texport function unregisterClass(constructor : Function) : void;\t\n\t/** Get the registered class by name \n\t*/\n\texport function getClassByName(classname : string) : Function;\t\n\t/** Define get set accessor, just help to call Object.defineProperty(...) \n\t*/\n\texport function getset(obj : any, prop : string, getter : Function, setter : Function, enumerable? : boolean) : void;\t\n\t/** Define get accessor, just help to call Object.defineProperty(...) \n\t*/\n\texport function get(obj : any, prop : string, getter : Function, enumerable? : boolean) : void;\t\n\t/** Define set accessor, just help to call Object.defineProperty(...) \n\t*/\n\texport function set(obj : any, prop : string, setter : Function, enumerable? : boolean) : void;\t\n\t/** Defines a polyfill field for obsoleted codes.\n\t@param obj YourObject or YourClass.prototype\n\t@param obsoleted \"OldParam\" or \"YourClass.OldParam\"\n\t@param newPropName \"NewParam\" \n\t*/\n\texport function obsolete(obj : any, obsoleted : string, newPropName : string, writable? : boolean) : void;\t\n\t/** Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.\n\t@param obj YourObject or YourClass.prototype\n\t@param objName \"YourObject\" or \"YourClass\" \n\t*/\n\texport function obsoletes(obj : any, objName : any, props : any, writable? : boolean) : void;\t\n\t/** A string tool to construct a string with format string.\n\tfor example:\n\t     cc.js.formatStr(\"a: %s, b: %s\", a, b);\n\t     cc.js.formatStr(a, b, c); \n\t*/\n\texport function formatStr() : string;\t\t\n\t\t/** undefined */\n\t\texport class array {\t\t\n\t\t/** Removes the first occurrence of a specific object from the array. \n\t\t*/\n\t\tremove(array : any[], value : any) : boolean;\t\t\n\t\t/** Removes the array item at the specified index. \n\t\t*/\n\t\tremoveAt(array : any[], index : number) : void;\t\t\n\t\t/** Determines whether the array contains a specific value. \n\t\t*/\n\t\tcontains(array : any[], value : any) : boolean;\t\t\n\t\t/** Verify array's Type \n\t\t*/\n\t\tverifyType(array : any[], type : Function) : boolean;\t\t\n\t\t/** Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.\n\t\t@param array Source Array\n\t\t@param minusArr minus Array \n\t\t*/\n\t\tremoveArray(array : any[], minusArr : any[]) : void;\t\t\n\t\t/** Inserts some objects at index \n\t\t*/\n\t\tappendObjectsAt(array : any[], addObjs : any[], index : number) : any[];\t\t\n\t\t/** Copy an array's item to a new array (its performance is better than Array.slice) \n\t\t*/\n\t\tcopy(array : any[]) : any[];\t\t\n\t\t/** Exact same function as Array.prototype.indexOf.\n\t\tHACK: ugliy hack for Baidu mobile browser compatibility,\n\t\tstupid Baidu guys modify Array.prototype.indexOf for all pages loaded,\n\t\ttheir version changes strict comparison to non-strict comparison,\n\t\tit also ignores the second parameter of the original API,\n\t\tand this will cause event handler enter infinite loop.\n\t\tBaidu developers, if you ever see this documentation,\n\t\there is the standard: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\n\t\tSeriously !\n\t\t@param searchElement Element to locate in the array.\n\t\t@param fromIndex The index to start the search at \n\t\t*/\n\t\tindexOf(searchElement : any, fromIndex? : number) : number;\t\n\t}\n}"
  },
  {
    "path": "bin/client/jsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"target\": \"es6\",\n        \"module\": \"commonjs\"\n    },\n    \"exclude\": [\n        \"node_modules\",\n        \"library\",\n        \"local\",\n        \"settings\",\n        \"temp\"\n    ]\n}"
  },
  {
    "path": "bin/client/project.json",
    "content": "{\n  \"engine\": \"cocos-creator-js\",\n  \"packages\": \"packages\"\n}"
  },
  {
    "path": "bin/client.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>game test</title>\n</head>\n\n<body>\n\n\n<p>登录 :\n    <output id=\"result\"></output>\n</p>\n\n<p>\n    <button onclick=\"joinRoom()\">加入房间</button>\n    <output id=\"joinRoomRes\"></output>\n</p>\n<p>\n    <button onclick=\"leaveRoom()\">离开房间</button>\n    <output id=\"leaveRoomRes\"></output>\n</p>\n\n\n<p>\n    <button onclick=\"standUp()\">站起</button>\n    <output id=\"standupRes\"></output>\n</p>\n<p>\n    <button onclick=\"sitDown()\">坐下</button>\n    <output id=\"sitdownRes\"></output>\n</p>\n\n<p>\n    <button onclick=\"bet()\">下注</button>\n    <output id=\"betRes\"></output>\n</p>\n\n\n<p>\n    <button onclick=\"roomList()\">房间列表</button>\n    <output id=\"roomList\"></output>\n</p>\n\n\n<script type=\"text/javascript\">\n    var ws = new WebSocket('ws://127.0.0.1:8989')\n    ws.onopen = function () {\n        document.getElementById(\"result\").innerHTML = \"ok\";\n\n        var msg = {\n            UserLoginInfo: {\n                Nickname: \"Nicknameasdf\",\n                UnionId: \"MichaelUnionIdasdf\",\n            }\n        }\n        ws.send(JSON.stringify(msg))\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"result\").innerHTML = this.result;\n            }\n        }\n    }\n\n    function roomList() {\n        var msg = {\n            RoomList: {}\n        }\n        var m = JSON.stringify(msg)\n        console.log(\"send data:  \", m);\n        ws.send(m)\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"roomList\").innerHTML = this.result;\n            }\n        }\n    }\n\n\n    function sitDown() {\n        // ws.send(JSON.stringify({Hello: {Name: 'leaf' }}))\n        var msg = {\n            SitDown: {\n                RoomNumber: \"123456\",\n                RoomPwd: \"RoomPwd123456\"\n            }\n        }\n        var m = JSON.stringify(msg)\n        console.log(\"send data:  \", m);\n        ws.send(m)\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"sitDownRes\").innerHTML = this.result;\n            }\n        }\n    }\n\n    function leaveRoom() {\n        // ws.send(JSON.stringify({Hello: {Name: 'leaf' }}))\n        var msg = {\n            LeaveRoom: {\n                RoomNumber: \"123456\",\n                RoomPwd: \"RoomPwd123456\"\n            }\n        }\n        var m = JSON.stringify(msg)\n        console.log(\"send data:  \", m);\n        ws.send(m)\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"leaveRoomRes\").innerHTML = this.result;\n            }\n        }\n    }\n\n    function bet() {\n        // ws.send(JSON.stringify({Hello: {Name: 'leaf' }}))\n        var msg = {\n            Bet: {\n                RoomNumber: \"123456\",\n                RoomPwd: \"RoomPwd123456\"\n            }\n        }\n        var m = JSON.stringify(msg)\n        console.log(\"send data:  \", m);\n        ws.send(m)\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"betRes\").innerHTML = this.result;\n            }\n        }\n    }\n\n\n    function joinRoom() {\n        // ws.send(JSON.stringify({Hello: {Name: 'leaf' }}))\n        var msg = {\n            JoinRoom: {\n                RoomNumber: \"123456\",\n                RoomPwd: \"RoomPwd123456\"\n            }\n        }\n        var m = JSON.stringify(msg)\n        console.log(\"send data:  \", m);\n        ws.send(m)\n\n        ws.onmessage = function (evt) {\n            var re = evt.data;\n            var reader = new FileReader()\n            reader.readAsText(re)\n            reader.onload = function () {\n                console.log(this.result);\n                document.getElementById(\"joinRoomRes\").innerHTML = this.result;\n            }\n        }\n    }\n</script>\n</body>\n</html>"
  },
  {
    "path": "src/github.com/davecgh/go-spew/LICENSE",
    "content": "Copyright (c) 2012-2013 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/bypass.go",
    "content": "// Copyright (c) 2015 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is not running on Google App Engine and \"-tags disableunsafe\"\n// is not added to the go build command line.\n// +build !appengine,!disableunsafe\n\npackage spew\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = false\n\n\t// ptrSize is the size of a pointer on the current arch.\n\tptrSize = unsafe.Sizeof((*byte)(nil))\n)\n\nvar (\n\t// offsetPtr, offsetScalar, and offsetFlag are the offsets for the\n\t// internal reflect.Value fields.  These values are valid before golang\n\t// commit ecccf07e7f9d which changed the format.  The are also valid\n\t// after commit 82f48826c6c7 which changed the format again to mirror\n\t// the original format.  Code in the init function updates these offsets\n\t// as necessary.\n\toffsetPtr    = uintptr(ptrSize)\n\toffsetScalar = uintptr(0)\n\toffsetFlag   = uintptr(ptrSize * 2)\n\n\t// flagKindWidth and flagKindShift indicate various bits that the\n\t// reflect package uses internally to track kind information.\n\t//\n\t// flagRO indicates whether or not the value field of a reflect.Value is\n\t// read-only.\n\t//\n\t// flagIndir indicates whether the value field of a reflect.Value is\n\t// the actual data or a pointer to the data.\n\t//\n\t// These values are valid before golang commit 90a7c3c86944 which\n\t// changed their positions.  Code in the init function updates these\n\t// flags as necessary.\n\tflagKindWidth = uintptr(5)\n\tflagKindShift = uintptr(flagKindWidth - 1)\n\tflagRO        = uintptr(1 << 0)\n\tflagIndir     = uintptr(1 << 1)\n)\n\nfunc init() {\n\t// Older versions of reflect.Value stored small integers directly in the\n\t// ptr field (which is named val in the older versions).  Versions\n\t// between commits ecccf07e7f9d and 82f48826c6c7 added a new field named\n\t// scalar for this purpose which unfortunately came before the flag\n\t// field, so the offset of the flag field is different for those\n\t// versions.\n\t//\n\t// This code constructs a new reflect.Value from a known small integer\n\t// and checks if the size of the reflect.Value struct indicates it has\n\t// the scalar field. When it does, the offsets are updated accordingly.\n\tvv := reflect.ValueOf(0xf00)\n\tif unsafe.Sizeof(vv) == (ptrSize * 4) {\n\t\toffsetScalar = ptrSize * 2\n\t\toffsetFlag = ptrSize * 3\n\t}\n\n\t// Commit 90a7c3c86944 changed the flag positions such that the low\n\t// order bits are the kind.  This code extracts the kind from the flags\n\t// field and ensures it's the correct type.  When it's not, the flag\n\t// order has been changed to the newer format, so the flags are updated\n\t// accordingly.\n\tupf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag)\n\tupfv := *(*uintptr)(upf)\n\tflagKindMask := uintptr((1<<flagKindWidth - 1) << flagKindShift)\n\tif (upfv&flagKindMask)>>flagKindShift != uintptr(reflect.Int) {\n\t\tflagKindShift = 0\n\t\tflagRO = 1 << 5\n\t\tflagIndir = 1 << 6\n\n\t\t// Commit adf9b30e5594 modified the flags to separate the\n\t\t// flagRO flag into two bits which specifies whether or not the\n\t\t// field is embedded.  This causes flagIndir to move over a bit\n\t\t// and means that flagRO is the combination of either of the\n\t\t// original flagRO bit and the new bit.\n\t\t//\n\t\t// This code detects the change by extracting what used to be\n\t\t// the indirect bit to ensure it's set.  When it's not, the flag\n\t\t// order has been changed to the newer format, so the flags are\n\t\t// updated accordingly.\n\t\tif upfv&flagIndir == 0 {\n\t\t\tflagRO = 3 << 5\n\t\t\tflagIndir = 1 << 7\n\t\t}\n\t}\n}\n\n// unsafeReflectValue converts the passed reflect.Value into a one that bypasses\n// the typical safety restrictions preventing access to unaddressable and\n// unexported data.  It works by digging the raw pointer to the underlying\n// value out of the protected value and generating a new unprotected (unsafe)\n// reflect.Value to it.\n//\n// This allows us to check for implementations of the Stringer and error\n// interfaces to be used for pretty printing ordinarily unaddressable and\n// inaccessible values such as unexported struct fields.\nfunc unsafeReflectValue(v reflect.Value) (rv reflect.Value) {\n\tindirects := 1\n\tvt := v.Type()\n\tupv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr)\n\trvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag))\n\tif rvf&flagIndir != 0 {\n\t\tvt = reflect.PtrTo(v.Type())\n\t\tindirects++\n\t} else if offsetScalar != 0 {\n\t\t// The value is in the scalar field when it's not one of the\n\t\t// reference types.\n\t\tswitch vt.Kind() {\n\t\tcase reflect.Uintptr:\n\t\tcase reflect.Chan:\n\t\tcase reflect.Func:\n\t\tcase reflect.Map:\n\t\tcase reflect.Ptr:\n\t\tcase reflect.UnsafePointer:\n\t\tdefault:\n\t\t\tupv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) +\n\t\t\t\toffsetScalar)\n\t\t}\n\t}\n\n\tpv := reflect.NewAt(vt, upv)\n\trv = pv\n\tfor i := 0; i < indirects; i++ {\n\t\trv = rv.Elem()\n\t}\n\treturn rv\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/bypasssafe.go",
    "content": "// Copyright (c) 2015 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when either the code is running on Google App Engine or \"-tags disableunsafe\"\n// is added to the go build command line.\n// +build appengine disableunsafe\n\npackage spew\n\nimport \"reflect\"\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = true\n)\n\n// unsafeReflectValue typically converts the passed reflect.Value into a one\n// that bypasses the typical safety restrictions preventing access to\n// unaddressable and unexported data.  However, doing this relies on access to\n// the unsafe package.  This is a stub version which simply returns the passed\n// reflect.Value when the unsafe package is not available.\nfunc unsafeReflectValue(v reflect.Value) reflect.Value {\n\treturn v\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/common.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n)\n\n// Some constants in the form of bytes to avoid string overhead.  This mirrors\n// the technique used in the fmt package.\nvar (\n\tpanicBytes            = []byte(\"(PANIC=\")\n\tplusBytes             = []byte(\"+\")\n\tiBytes                = []byte(\"i\")\n\ttrueBytes             = []byte(\"true\")\n\tfalseBytes            = []byte(\"false\")\n\tinterfaceBytes        = []byte(\"(interface {})\")\n\tcommaNewlineBytes     = []byte(\",\\n\")\n\tnewlineBytes          = []byte(\"\\n\")\n\topenBraceBytes        = []byte(\"{\")\n\topenBraceNewlineBytes = []byte(\"{\\n\")\n\tcloseBraceBytes       = []byte(\"}\")\n\tasteriskBytes         = []byte(\"*\")\n\tcolonBytes            = []byte(\":\")\n\tcolonSpaceBytes       = []byte(\": \")\n\topenParenBytes        = []byte(\"(\")\n\tcloseParenBytes       = []byte(\")\")\n\tspaceBytes            = []byte(\" \")\n\tpointerChainBytes     = []byte(\"->\")\n\tnilAngleBytes         = []byte(\"<nil>\")\n\tmaxNewlineBytes       = []byte(\"<max depth reached>\\n\")\n\tmaxShortBytes         = []byte(\"<max>\")\n\tcircularBytes         = []byte(\"<already shown>\")\n\tcircularShortBytes    = []byte(\"<shown>\")\n\tinvalidAngleBytes     = []byte(\"<invalid>\")\n\topenBracketBytes      = []byte(\"[\")\n\tcloseBracketBytes     = []byte(\"]\")\n\tpercentBytes          = []byte(\"%\")\n\tprecisionBytes        = []byte(\".\")\n\topenAngleBytes        = []byte(\"<\")\n\tcloseAngleBytes       = []byte(\">\")\n\topenMapBytes          = []byte(\"map[\")\n\tcloseMapBytes         = []byte(\"]\")\n\tlenEqualsBytes        = []byte(\"len=\")\n\tcapEqualsBytes        = []byte(\"cap=\")\n)\n\n// hexDigits is used to map a decimal value to a hex digit.\nvar hexDigits = \"0123456789abcdef\"\n\n// catchPanic handles any panics that might occur during the handleMethods\n// calls.\nfunc catchPanic(w io.Writer, v reflect.Value) {\n\tif err := recover(); err != nil {\n\t\tw.Write(panicBytes)\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\tw.Write(closeParenBytes)\n\t}\n}\n\n// handleMethods attempts to call the Error and String methods on the underlying\n// type the passed reflect.Value represents and outputes the result to Writer w.\n//\n// It handles panics in any called methods by catching and displaying the error\n// as the formatted value.\nfunc handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {\n\t// We need an interface to check if the type implements the error or\n\t// Stringer interface.  However, the reflect package won't give us an\n\t// interface on certain things like unexported struct fields in order\n\t// to enforce visibility rules.  We use unsafe, when it's available,\n\t// to bypass these restrictions since this package does not mutate the\n\t// values.\n\tif !v.CanInterface() {\n\t\tif UnsafeDisabled {\n\t\t\treturn false\n\t\t}\n\n\t\tv = unsafeReflectValue(v)\n\t}\n\n\t// Choose whether or not to do error and Stringer interface lookups against\n\t// the base type or a pointer to the base type depending on settings.\n\t// Technically calling one of these methods with a pointer receiver can\n\t// mutate the value, however, types which choose to satisify an error or\n\t// Stringer interface with a pointer receiver should not be mutating their\n\t// state inside these interface methods.\n\tif !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {\n\t\tv = unsafeReflectValue(v)\n\t}\n\tif v.CanAddr() {\n\t\tv = v.Addr()\n\t}\n\n\t// Is it an error or Stringer?\n\tswitch iface := v.Interface().(type) {\n\tcase error:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.Error()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\n\t\tw.Write([]byte(iface.Error()))\n\t\treturn true\n\n\tcase fmt.Stringer:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.String()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\t\tw.Write([]byte(iface.String()))\n\t\treturn true\n\t}\n\treturn false\n}\n\n// printBool outputs a boolean value as true or false to Writer w.\nfunc printBool(w io.Writer, val bool) {\n\tif val {\n\t\tw.Write(trueBytes)\n\t} else {\n\t\tw.Write(falseBytes)\n\t}\n}\n\n// printInt outputs a signed integer value to Writer w.\nfunc printInt(w io.Writer, val int64, base int) {\n\tw.Write([]byte(strconv.FormatInt(val, base)))\n}\n\n// printUint outputs an unsigned integer value to Writer w.\nfunc printUint(w io.Writer, val uint64, base int) {\n\tw.Write([]byte(strconv.FormatUint(val, base)))\n}\n\n// printFloat outputs a floating point value using the specified precision,\n// which is expected to be 32 or 64bit, to Writer w.\nfunc printFloat(w io.Writer, val float64, precision int) {\n\tw.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))\n}\n\n// printComplex outputs a complex value using the specified float precision\n// for the real and imaginary parts to Writer w.\nfunc printComplex(w io.Writer, c complex128, floatPrecision int) {\n\tr := real(c)\n\tw.Write(openParenBytes)\n\tw.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))\n\ti := imag(c)\n\tif i >= 0 {\n\t\tw.Write(plusBytes)\n\t}\n\tw.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))\n\tw.Write(iBytes)\n\tw.Write(closeParenBytes)\n}\n\n// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x'\n// prefix to Writer w.\nfunc printHexPtr(w io.Writer, p uintptr) {\n\t// Null pointer.\n\tnum := uint64(p)\n\tif num == 0 {\n\t\tw.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix\n\tbuf := make([]byte, 18)\n\n\t// It's simpler to construct the hex string right to left.\n\tbase := uint64(16)\n\ti := len(buf) - 1\n\tfor num >= base {\n\t\tbuf[i] = hexDigits[num%base]\n\t\tnum /= base\n\t\ti--\n\t}\n\tbuf[i] = hexDigits[num]\n\n\t// Add '0x' prefix.\n\ti--\n\tbuf[i] = 'x'\n\ti--\n\tbuf[i] = '0'\n\n\t// Strip unused leading bytes.\n\tbuf = buf[i:]\n\tw.Write(buf)\n}\n\n// valuesSorter implements sort.Interface to allow a slice of reflect.Value\n// elements to be sorted.\ntype valuesSorter struct {\n\tvalues  []reflect.Value\n\tstrings []string // either nil or same len and values\n\tcs      *ConfigState\n}\n\n// newValuesSorter initializes a valuesSorter instance, which holds a set of\n// surrogate keys on which the data should be sorted.  It uses flags in\n// ConfigState to decide if and how to populate those surrogate keys.\nfunc newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {\n\tvs := &valuesSorter{values: values, cs: cs}\n\tif canSortSimply(vs.values[0].Kind()) {\n\t\treturn vs\n\t}\n\tif !cs.DisableMethods {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tb := bytes.Buffer{}\n\t\t\tif !handleMethods(cs, &b, vs.values[i]) {\n\t\t\t\tvs.strings = nil\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvs.strings[i] = b.String()\n\t\t}\n\t}\n\tif vs.strings == nil && cs.SpewKeys {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tvs.strings[i] = Sprintf(\"%#v\", vs.values[i].Interface())\n\t\t}\n\t}\n\treturn vs\n}\n\n// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted\n// directly, or whether it should be considered for sorting by surrogate keys\n// (if the ConfigState allows it).\nfunc canSortSimply(kind reflect.Kind) bool {\n\t// This switch parallels valueSortLess, except for the default case.\n\tswitch kind {\n\tcase reflect.Bool:\n\t\treturn true\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn true\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn true\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn true\n\tcase reflect.String:\n\t\treturn true\n\tcase reflect.Uintptr:\n\t\treturn true\n\tcase reflect.Array:\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Len returns the number of values in the slice.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Len() int {\n\treturn len(s.values)\n}\n\n// Swap swaps the values at the passed indices.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Swap(i, j int) {\n\ts.values[i], s.values[j] = s.values[j], s.values[i]\n\tif s.strings != nil {\n\t\ts.strings[i], s.strings[j] = s.strings[j], s.strings[i]\n\t}\n}\n\n// valueSortLess returns whether the first value should sort before the second\n// value.  It is used by valueSorter.Less as part of the sort.Interface\n// implementation.\nfunc valueSortLess(a, b reflect.Value) bool {\n\tswitch a.Kind() {\n\tcase reflect.Bool:\n\t\treturn !a.Bool() && b.Bool()\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn a.Int() < b.Int()\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn a.Float() < b.Float()\n\tcase reflect.String:\n\t\treturn a.String() < b.String()\n\tcase reflect.Uintptr:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Array:\n\t\t// Compare the contents of both arrays.\n\t\tl := a.Len()\n\t\tfor i := 0; i < l; i++ {\n\t\t\tav := a.Index(i)\n\t\t\tbv := b.Index(i)\n\t\t\tif av.Interface() == bv.Interface() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn valueSortLess(av, bv)\n\t\t}\n\t}\n\treturn a.String() < b.String()\n}\n\n// Less returns whether the value at index i should sort before the\n// value at index j.  It is part of the sort.Interface implementation.\nfunc (s *valuesSorter) Less(i, j int) bool {\n\tif s.strings == nil {\n\t\treturn valueSortLess(s.values[i], s.values[j])\n\t}\n\treturn s.strings[i] < s.strings[j]\n}\n\n// sortValues is a sort function that handles both native types and any type that\n// can be converted to error or Stringer.  Other inputs are sorted according to\n// their Value.String() value to ensure display stability.\nfunc sortValues(values []reflect.Value, cs *ConfigState) {\n\tif len(values) == 0 {\n\t\treturn\n\t}\n\tsort.Sort(newValuesSorter(values, cs))\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/config.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\n// ConfigState houses the configuration options used by spew to format and\n// display values.  There is a global instance, Config, that is used to control\n// all top-level Formatter and Dump functionality.  Each ConfigState instance\n// provides methods equivalent to the top-level functions.\n//\n// The zero value for ConfigState provides no indentation.  You would typically\n// want to set it to a space or a tab.\n//\n// Alternatively, you can use NewDefaultConfig to get a ConfigState instance\n// with default settings.  See the documentation of NewDefaultConfig for default\n// values.\ntype ConfigState struct {\n\t// Indent specifies the string to use for each indentation level.  The\n\t// global config instance that all top-level functions use set this to a\n\t// single space by default.  If you would like more indentation, you might\n\t// set this to a tab with \"\\t\" or perhaps two spaces with \"  \".\n\tIndent string\n\n\t// MaxDepth controls the maximum number of levels to descend into nested\n\t// data structures.  The default, 0, means there is no limit.\n\t//\n\t// NOTE: Circular data structures are properly detected, so it is not\n\t// necessary to set this value unless you specifically want to limit deeply\n\t// nested data structures.\n\tMaxDepth int\n\n\t// DisableMethods specifies whether or not error and Stringer interfaces are\n\t// invoked for types that implement them.\n\tDisableMethods bool\n\n\t// DisablePointerMethods specifies whether or not to check for and invoke\n\t// error and Stringer interfaces on types which only accept a pointer\n\t// receiver when the current type is not a pointer.\n\t//\n\t// NOTE: This might be an unsafe action since calling one of these methods\n\t// with a pointer receiver could technically mutate the value, however,\n\t// in practice, types which choose to satisify an error or Stringer\n\t// interface with a pointer receiver should not be mutating their state\n\t// inside these interface methods.  As a result, this option relies on\n\t// access to the unsafe package, so it will not have any effect when\n\t// running in environments without access to the unsafe package such as\n\t// Google App Engine or with the \"disableunsafe\" build tag specified.\n\tDisablePointerMethods bool\n\n\t// ContinueOnMethod specifies whether or not recursion should continue once\n\t// a custom error or Stringer interface is invoked.  The default, false,\n\t// means it will print the results of invoking the custom error or Stringer\n\t// interface and return immediately instead of continuing to recurse into\n\t// the internals of the data type.\n\t//\n\t// NOTE: This flag does not have any effect if method invocation is disabled\n\t// via the DisableMethods or DisablePointerMethods options.\n\tContinueOnMethod bool\n\n\t// SortKeys specifies map keys should be sorted before being printed. Use\n\t// this to have a more deterministic, diffable output.  Note that only\n\t// native types (bool, int, uint, floats, uintptr and string) and types\n\t// that support the error or Stringer interfaces (if methods are\n\t// enabled) are supported, with other types sorted according to the\n\t// reflect.Value.String() output which guarantees display stability.\n\tSortKeys bool\n\n\t// SpewKeys specifies that, as a last resort attempt, map keys should\n\t// be spewed to strings and sorted by those strings.  This is only\n\t// considered if SortKeys is true.\n\tSpewKeys bool\n}\n\n// Config is the active configuration of the top-level functions.\n// The configuration can be changed by modifying the contents of spew.Config.\nvar Config = ConfigState{Indent: \" \"}\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the formatted string as a value that satisfies error.  See NewFormatter\n// for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, c.convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, c.convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, c.convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a Formatter interface returned by c.NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, c.convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(c.convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, c.convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(c.convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(c.convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, c.convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a Formatter interface returned by c.NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(c.convertArgs(a)...)\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nc.Printf, c.Println, or c.Printf.\n*/\nfunc (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(c, v)\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {\n\tfdump(c, w, a...)\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by modifying the public members\nof c.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc (c *ConfigState) Dump(a ...interface{}) {\n\tfdump(c, os.Stdout, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc (c *ConfigState) Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(c, &buf, a...)\n\treturn buf.String()\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a spew Formatter interface using\n// the ConfigState associated with s.\nfunc (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = newFormatter(c, arg)\n\t}\n\treturn formatters\n}\n\n// NewDefaultConfig returns a ConfigState with the following default settings.\n//\n// \tIndent: \" \"\n// \tMaxDepth: 0\n// \tDisableMethods: false\n// \tDisablePointerMethods: false\n// \tContinueOnMethod: false\n// \tSortKeys: false\nfunc NewDefaultConfig() *ConfigState {\n\treturn &ConfigState{Indent: \" \"}\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/doc.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nPackage spew implements a deep pretty printer for Go data structures to aid in\ndebugging.\n\nA quick overview of the additional features spew provides over the built-in\nprinting facilities for Go data types are as follows:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output (only when using\n\t  Dump style)\n\nThere are two different approaches spew allows for dumping Go data structures:\n\n\t* Dump style which prints with newlines, customizable indentation,\n\t  and additional debug information such as types and all pointer addresses\n\t  used to indirect to the final value\n\t* A custom Formatter interface that integrates cleanly with the standard fmt\n\t  package and replaces %v, %+v, %#v, and %#+v to provide inline printing\n\t  similar to the default %v while providing the additional functionality\n\t  outlined above and passing unsupported format verbs such as %x and %q\n\t  along to fmt\n\nQuick Start\n\nThis section demonstrates how to quickly get started with spew.  See the\nsections below for further details on formatting and configuration options.\n\nTo dump a variable with full newlines, indentation, type, and pointer\ninformation use Dump, Fdump, or Sdump:\n\tspew.Dump(myVar1, myVar2, ...)\n\tspew.Fdump(someWriter, myVar1, myVar2, ...)\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nAlternatively, if you would prefer to use format strings with a compacted inline\nprinting style, use the convenience wrappers Printf, Fprintf, etc with\n%v (most compact), %+v (adds pointer addresses), %#v (adds types), or\n%#+v (adds types and pointer addresses):\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Fprintf(someWriter, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(someWriter, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nConfiguration Options\n\nConfiguration of spew is handled by fields in the ConfigState type.  For\nconvenience, all of the top-level functions use a global state available\nvia the spew.Config global.\n\nIt is also possible to create a ConfigState instance that provides methods\nequivalent to the top-level functions.  This allows concurrent configuration\noptions.  See the ConfigState documentation for more details.\n\nThe following configuration options are available:\n\t* Indent\n\t\tString to use for each indentation level for Dump functions.\n\t\tIt is a single space by default.  A popular alternative is \"\\t\".\n\n\t* MaxDepth\n\t\tMaximum number of levels to descend into nested data structures.\n\t\tThere is no limit by default.\n\n\t* DisableMethods\n\t\tDisables invocation of error and Stringer interface methods.\n\t\tMethod invocation is enabled by default.\n\n\t* DisablePointerMethods\n\t\tDisables invocation of error and Stringer interface methods on types\n\t\twhich only accept pointer receivers from non-pointer variables.\n\t\tPointer method invocation is enabled by default.\n\n\t* ContinueOnMethod\n\t\tEnables recursion into types after invoking error and Stringer interface\n\t\tmethods. Recursion after method invocation is disabled by default.\n\n\t* SortKeys\n\t\tSpecifies map keys should be sorted before being printed. Use\n\t\tthis to have a more deterministic, diffable output.  Note that\n\t\tonly native types (bool, int, uint, floats, uintptr and string)\n\t\tand types which implement error or Stringer interfaces are\n\t\tsupported with other types sorted according to the\n\t\treflect.Value.String() output which guarantees display\n\t\tstability.  Natural map order is used by default.\n\n\t* SpewKeys\n\t\tSpecifies that, as a last resort attempt, map keys should be\n\t\tspewed to strings and sorted by those strings.  This is only\n\t\tconsidered if SortKeys is true.\n\nDump Usage\n\nSimply call spew.Dump with a list of variables you want to dump:\n\n\tspew.Dump(myVar1, myVar2, ...)\n\nYou may also call spew.Fdump if you would prefer to output to an arbitrary\nio.Writer.  For example, to dump to standard error:\n\n\tspew.Fdump(os.Stderr, myVar1, myVar2, ...)\n\nA third option is to call spew.Sdump to get the formatted output as a string:\n\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nSample Dump Output\n\nSee the Dump example for details on the setup of the types and variables being\nshown here.\n\n\t(main.Foo) {\n\t unexportedField: (*main.Bar)(0xf84002e210)({\n\t  flag: (main.Flag) flagTwo,\n\t  data: (uintptr) <nil>\n\t }),\n\t ExportedField: (map[interface {}]interface {}) (len=1) {\n\t  (string) (len=3) \"one\": (bool) true\n\t }\n\t}\n\nByte (and uint8) arrays and slices are displayed uniquely like the hexdump -C\ncommand as shown.\n\t([]uint8) (len=32 cap=32) {\n\t 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |\n\t 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!\"#$%&'()*+,-./0|\n\t 00000020  31 32                                             |12|\n\t}\n\nCustom Formatter\n\nSpew provides a custom formatter that implements the fmt.Formatter interface\nso that it integrates cleanly with standard fmt package printing functions. The\nformatter is useful for inline printing of smaller data types similar to the\nstandard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nCustom Formatter Usage\n\nThe simplest way to make use of the spew custom formatter is to call one of the\nconvenience functions such as spew.Printf, spew.Println, or spew.Printf.  The\nfunctions have syntax you are most likely already familiar with:\n\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Println(myVar, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nSee the Index for the full list convenience functions.\n\nSample Formatter Output\n\nDouble pointer to a uint8:\n\t  %v: <**>5\n\t %+v: <**>(0xf8400420d0->0xf8400420c8)5\n\t %#v: (**uint8)5\n\t%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5\n\nPointer to circular struct with a uint8 field and a pointer to itself:\n\t  %v: <*>{1 <*><shown>}\n\t %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}\n\t %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}\n\t%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}\n\nSee the Printf example for details on the setup of variables being shown\nhere.\n\nErrors\n\nSince it is possible for custom Stringer/error interfaces to panic, spew\ndetects them and handles them internally by printing the panic information\ninline with the output.  Since spew is intended to provide deep pretty printing\ncapabilities on structures, it intentionally does not return any errors.\n*/\npackage spew\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/dump.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nvar (\n\t// uint8Type is a reflect.Type representing a uint8.  It is used to\n\t// convert cgo types to uint8 slices for hexdumping.\n\tuint8Type = reflect.TypeOf(uint8(0))\n\n\t// cCharRE is a regular expression that matches a cgo char.\n\t// It is used to detect character arrays to hexdump them.\n\tcCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_char$\")\n\n\t// cUnsignedCharRE is a regular expression that matches a cgo unsigned\n\t// char.  It is used to detect unsigned character arrays to hexdump\n\t// them.\n\tcUnsignedCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_unsignedchar$\")\n\n\t// cUint8tCharRE is a regular expression that matches a cgo uint8_t.\n\t// It is used to detect uint8_t arrays to hexdump them.\n\tcUint8tCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_uint8_t$\")\n)\n\n// dumpState contains information about the state of a dump operation.\ntype dumpState struct {\n\tw                io.Writer\n\tdepth            int\n\tpointers         map[uintptr]int\n\tignoreNextType   bool\n\tignoreNextIndent bool\n\tcs               *ConfigState\n}\n\n// indent performs indentation according to the depth level and cs.Indent\n// option.\nfunc (d *dumpState) indent() {\n\tif d.ignoreNextIndent {\n\t\td.ignoreNextIndent = false\n\t\treturn\n\t}\n\td.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (d *dumpState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface && !v.IsNil() {\n\t\tv = v.Elem()\n\t}\n\treturn v\n}\n\n// dumpPtr handles formatting of pointers by indirecting them as necessary.\nfunc (d *dumpState) dumpPtr(v reflect.Value) {\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range d.pointers {\n\t\tif depth >= d.depth {\n\t\t\tdelete(d.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by dereferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := d.pointers[addr]; ok && pd < d.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\td.pointers[addr] = d.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type information.\n\td.w.Write(openParenBytes)\n\td.w.Write(bytes.Repeat(asteriskBytes, indirects))\n\td.w.Write([]byte(ve.Type().String()))\n\td.w.Write(closeParenBytes)\n\n\t// Display pointer information.\n\tif len(pointerChain) > 0 {\n\t\td.w.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\td.w.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(d.w, addr)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\td.w.Write(openParenBytes)\n\tswitch {\n\tcase nilFound == true:\n\t\td.w.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\td.w.Write(circularBytes)\n\n\tdefault:\n\t\td.ignoreNextType = true\n\t\td.dump(ve)\n\t}\n\td.w.Write(closeParenBytes)\n}\n\n// dumpSlice handles formatting of arrays and slices.  Byte (uint8 under\n// reflection) arrays and slices are dumped in hexdump -C fashion.\nfunc (d *dumpState) dumpSlice(v reflect.Value) {\n\t// Determine whether this type should be hex dumped or not.  Also,\n\t// for types which should be hexdumped, try to use the underlying data\n\t// first, then fall back to trying to convert them to a uint8 slice.\n\tvar buf []uint8\n\tdoConvert := false\n\tdoHexDump := false\n\tnumEntries := v.Len()\n\tif numEntries > 0 {\n\t\tvt := v.Index(0).Type()\n\t\tvts := vt.String()\n\t\tswitch {\n\t\t// C types that need to be converted.\n\t\tcase cCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUnsignedCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUint8tCharRE.MatchString(vts):\n\t\t\tdoConvert = true\n\n\t\t// Try to use existing uint8 slices and fall back to converting\n\t\t// and copying if that fails.\n\t\tcase vt.Kind() == reflect.Uint8:\n\t\t\t// We need an addressable interface to convert the type\n\t\t\t// to a byte slice.  However, the reflect package won't\n\t\t\t// give us an interface on certain things like\n\t\t\t// unexported struct fields in order to enforce\n\t\t\t// visibility rules.  We use unsafe, when available, to\n\t\t\t// bypass these restrictions since this package does not\n\t\t\t// mutate the values.\n\t\t\tvs := v\n\t\t\tif !vs.CanInterface() || !vs.CanAddr() {\n\t\t\t\tvs = unsafeReflectValue(vs)\n\t\t\t}\n\t\t\tif !UnsafeDisabled {\n\t\t\t\tvs = vs.Slice(0, numEntries)\n\n\t\t\t\t// Use the existing uint8 slice if it can be\n\t\t\t\t// type asserted.\n\t\t\t\tiface := vs.Interface()\n\t\t\t\tif slice, ok := iface.([]uint8); ok {\n\t\t\t\t\tbuf = slice\n\t\t\t\t\tdoHexDump = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The underlying data needs to be converted if it can't\n\t\t\t// be type asserted to a uint8 slice.\n\t\t\tdoConvert = true\n\t\t}\n\n\t\t// Copy and convert the underlying type if needed.\n\t\tif doConvert && vt.ConvertibleTo(uint8Type) {\n\t\t\t// Convert and copy each element into a uint8 byte\n\t\t\t// slice.\n\t\t\tbuf = make([]uint8, numEntries)\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tvv := v.Index(i)\n\t\t\t\tbuf[i] = uint8(vv.Convert(uint8Type).Uint())\n\t\t\t}\n\t\t\tdoHexDump = true\n\t\t}\n\t}\n\n\t// Hexdump the entire slice as needed.\n\tif doHexDump {\n\t\tindent := strings.Repeat(d.cs.Indent, d.depth)\n\t\tstr := indent + hex.Dump(buf)\n\t\tstr = strings.Replace(str, \"\\n\", \"\\n\"+indent, -1)\n\t\tstr = strings.TrimRight(str, d.cs.Indent)\n\t\td.w.Write([]byte(str))\n\t\treturn\n\t}\n\n\t// Recursively call dump for each item.\n\tfor i := 0; i < numEntries; i++ {\n\t\td.dump(d.unpackValue(v.Index(i)))\n\t\tif i < (numEntries - 1) {\n\t\t\td.w.Write(commaNewlineBytes)\n\t\t} else {\n\t\t\td.w.Write(newlineBytes)\n\t\t}\n\t}\n}\n\n// dump is the main workhorse for dumping a value.  It uses the passed reflect\n// value to figure out what kind of object we are dealing with and formats it\n// appropriately.  It is a recursive function, however circular data structures\n// are detected and handled properly.\nfunc (d *dumpState) dump(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\td.w.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\td.indent()\n\t\td.dumpPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !d.ignoreNextType {\n\t\td.indent()\n\t\td.w.Write(openParenBytes)\n\t\td.w.Write([]byte(v.Type().String()))\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\td.ignoreNextType = false\n\n\t// Display length and capacity if the built-in len and cap functions\n\t// work with the value's kind and the len/cap itself is non-zero.\n\tvalueLen, valueCap := 0, 0\n\tswitch v.Kind() {\n\tcase reflect.Array, reflect.Slice, reflect.Chan:\n\t\tvalueLen, valueCap = v.Len(), v.Cap()\n\tcase reflect.Map, reflect.String:\n\t\tvalueLen = v.Len()\n\t}\n\tif valueLen != 0 || valueCap != 0 {\n\t\td.w.Write(openParenBytes)\n\t\tif valueLen != 0 {\n\t\t\td.w.Write(lenEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueLen), 10)\n\t\t}\n\t\tif valueCap != 0 {\n\t\t\tif valueLen != 0 {\n\t\t\t\td.w.Write(spaceBytes)\n\t\t\t}\n\t\t\td.w.Write(capEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueCap), 10)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\n\t// Call Stringer/error interfaces if they exist and the handle methods flag\n\t// is enabled\n\tif !d.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(d.cs, d.w, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(d.w, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(d.w, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(d.w, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(d.w, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(d.w, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(d.w, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(d.w, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\td.dumpSlice(v)\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.String:\n\t\td.w.Write([]byte(strconv.Quote(v.String())))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tkeys := v.MapKeys()\n\t\t\tif d.cs.SortKeys {\n\t\t\t\tsortValues(keys, d.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\td.dump(d.unpackValue(key))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.MapIndex(key)))\n\t\t\t\tif i < (numEntries - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Struct:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tnumFields := v.NumField()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\td.indent()\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\td.w.Write([]byte(vtf.Name))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.Field(i)))\n\t\t\t\tif i < (numFields - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(d.w, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(d.w, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it in case any new\n\t// types are added.\n\tdefault:\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.String())\n\t\t}\n\t}\n}\n\n// fdump is a helper function to consolidate the logic from the various public\n// methods which take varying writers and config states.\nfunc fdump(cs *ConfigState, w io.Writer, a ...interface{}) {\n\tfor _, arg := range a {\n\t\tif arg == nil {\n\t\t\tw.Write(interfaceBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\tw.Write(nilAngleBytes)\n\t\t\tw.Write(newlineBytes)\n\t\t\tcontinue\n\t\t}\n\n\t\td := dumpState{w: w, cs: cs}\n\t\td.pointers = make(map[uintptr]int)\n\t\td.dump(reflect.ValueOf(arg))\n\t\td.w.Write(newlineBytes)\n\t}\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc Fdump(w io.Writer, a ...interface{}) {\n\tfdump(&Config, w, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(&Config, &buf, a...)\n\treturn buf.String()\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by an exported package global,\nspew.Config.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc Dump(a ...interface{}) {\n\tfdump(&Config, os.Stdout, a...)\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/format.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// supportedFlags is a list of all the character flags supported by fmt package.\nconst supportedFlags = \"0-+# \"\n\n// formatState implements the fmt.Formatter interface and contains information\n// about the state of a formatting operation.  The NewFormatter function can\n// be used to get a new Formatter which can be used directly as arguments\n// in standard fmt package printing calls.\ntype formatState struct {\n\tvalue          interface{}\n\tfs             fmt.State\n\tdepth          int\n\tpointers       map[uintptr]int\n\tignoreNextType bool\n\tcs             *ConfigState\n}\n\n// buildDefaultFormat recreates the original format string without precision\n// and width information to pass in to fmt.Sprintf in the case of an\n// unrecognized type.  Unless new types are added to the language, this\n// function won't ever be called.\nfunc (f *formatState) buildDefaultFormat() (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tbuf.WriteRune('v')\n\n\tformat = buf.String()\n\treturn format\n}\n\n// constructOrigFormat recreates the original format string including precision\n// and width information to pass along to the standard fmt package.  This allows\n// automatic deferral of all format strings this package doesn't support.\nfunc (f *formatState) constructOrigFormat(verb rune) (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tif width, ok := f.fs.Width(); ok {\n\t\tbuf.WriteString(strconv.Itoa(width))\n\t}\n\n\tif precision, ok := f.fs.Precision(); ok {\n\t\tbuf.Write(precisionBytes)\n\t\tbuf.WriteString(strconv.Itoa(precision))\n\t}\n\n\tbuf.WriteRune(verb)\n\n\tformat = buf.String()\n\treturn format\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible and\n// ensures that types for values which have been unpacked from an interface\n// are displayed when the show types flag is also set.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (f *formatState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface {\n\t\tf.ignoreNextType = false\n\t\tif !v.IsNil() {\n\t\t\tv = v.Elem()\n\t\t}\n\t}\n\treturn v\n}\n\n// formatPtr handles formatting of pointers by indirecting them as necessary.\nfunc (f *formatState) formatPtr(v reflect.Value) {\n\t// Display nil if top level pointer is nil.\n\tshowTypes := f.fs.Flag('#')\n\tif v.IsNil() && (!showTypes || f.ignoreNextType) {\n\t\tf.fs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range f.pointers {\n\t\tif depth >= f.depth {\n\t\t\tdelete(f.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to possibly show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by derferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := f.pointers[addr]; ok && pd < f.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\tf.pointers[addr] = f.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type or indirection level depending on flags.\n\tif showTypes && !f.ignoreNextType {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write(bytes.Repeat(asteriskBytes, indirects))\n\t\tf.fs.Write([]byte(ve.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t} else {\n\t\tif nilFound || cycleFound {\n\t\t\tindirects += strings.Count(ve.Type().String(), \"*\")\n\t\t}\n\t\tf.fs.Write(openAngleBytes)\n\t\tf.fs.Write([]byte(strings.Repeat(\"*\", indirects)))\n\t\tf.fs.Write(closeAngleBytes)\n\t}\n\n\t// Display pointer information depending on flags.\n\tif f.fs.Flag('+') && (len(pointerChain) > 0) {\n\t\tf.fs.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\tf.fs.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(f.fs, addr)\n\t\t}\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\tswitch {\n\tcase nilFound == true:\n\t\tf.fs.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\tf.fs.Write(circularShortBytes)\n\n\tdefault:\n\t\tf.ignoreNextType = true\n\t\tf.format(ve)\n\t}\n}\n\n// format is the main workhorse for providing the Formatter interface.  It\n// uses the passed reflect value to figure out what kind of object we are\n// dealing with and formats it appropriately.  It is a recursive function,\n// however circular data structures are detected and handled properly.\nfunc (f *formatState) format(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\tf.fs.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\tf.formatPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !f.ignoreNextType && f.fs.Flag('#') {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write([]byte(v.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\tf.ignoreNextType = false\n\n\t// Call Stringer/error interfaces if they exist and the handle methods\n\t// flag is enabled.\n\tif !f.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(f.cs, f.fs, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(f.fs, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(f.fs, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(f.fs, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(f.fs, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(f.fs, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(f.fs, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(f.fs, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\tf.fs.Write(openBracketBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.Index(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBracketBytes)\n\n\tcase reflect.String:\n\t\tf.fs.Write([]byte(v.String()))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\tf.fs.Write(openMapBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tkeys := v.MapKeys()\n\t\t\tif f.cs.SortKeys {\n\t\t\t\tsortValues(keys, f.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(key))\n\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.MapIndex(key)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeMapBytes)\n\n\tcase reflect.Struct:\n\t\tnumFields := v.NumField()\n\t\tf.fs.Write(openBraceBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\tif f.fs.Flag('+') || f.fs.Flag('#') {\n\t\t\t\t\tf.fs.Write([]byte(vtf.Name))\n\t\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\t}\n\t\t\t\tf.format(f.unpackValue(v.Field(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(f.fs, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(f.fs, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it if any get added.\n\tdefault:\n\t\tformat := f.buildDefaultFormat()\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(f.fs, format, v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(f.fs, format, v.String())\n\t\t}\n\t}\n}\n\n// Format satisfies the fmt.Formatter interface. See NewFormatter for usage\n// details.\nfunc (f *formatState) Format(fs fmt.State, verb rune) {\n\tf.fs = fs\n\n\t// Use standard formatting for verbs that are not v.\n\tif verb != 'v' {\n\t\tformat := f.constructOrigFormat(verb)\n\t\tfmt.Fprintf(fs, format, f.value)\n\t\treturn\n\t}\n\n\tif f.value == nil {\n\t\tif fs.Flag('#') {\n\t\t\tfs.Write(interfaceBytes)\n\t\t}\n\t\tfs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\tf.format(reflect.ValueOf(f.value))\n}\n\n// newFormatter is a helper function to consolidate the logic from the various\n// public methods which take varying config states.\nfunc newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {\n\tfs := &formatState{value: v, cs: cs}\n\tfs.pointers = make(map[uintptr]int)\n\treturn fs\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nPrintf, Println, or Fprintf.\n*/\nfunc NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(&Config, v)\n}\n"
  },
  {
    "path": "src/github.com/davecgh/go-spew/spew/spew.go",
    "content": "/*\n * Copyright (c) 2013 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the formatted string as a value that satisfies error.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a default Formatter interface returned by NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(convertArgs(a)...)\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a default spew Formatter interface.\nfunc convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = NewFormatter(arg)\n\t}\n\treturn formatters\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   Copyright 2014-2017 Name5566.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/README.md",
    "content": "Leaf\n====\nA pragmatic game server framework in Go (golang).\n\nFeatures\n---------\n\n* Extremely easy to use\n* Reliable\n* Multicore support\n* Modularity\n\nCommunity\n---------\n\n* QQ 群：376389675\n\nDocumentation\n---------\n\n* [中文文档](https://github.com/name5566/leaf/blob/master/TUTORIAL_ZH.md)\n* [English](https://github.com/name5566/leaf/blob/master/TUTORIAL_EN.md)\n\nLicensing\n---------\n\nLeaf is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/name5566/leaf/blob/master/LICENSE) for the full license text.\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/TUTORIAL_EN.md",
    "content": "Brief introduction to Leaf\n==========================\n\nLeaf, written in Go, is a open source game server framework aiming to boost the efficiency both in development and runtime.\n\nLeaf champions below philosophies:\n\n* Simple APIs. Leaf tends to provide simple and plain interfaces which are always best for use.\n* Self-healing. Leaf always tries to salvage the process from runtime errors instead of leaving it to crash.\n* Multi-core support. Leaf utilize its modules and [leaf/go](https://github.com/name5566/leaf/tree/master/go) to make use of CPU resouces at maximum while avoiding varieties of side effects may be caused.\n\n* Module-based.\n\nLeaf's Modules\n--------------\n\nA game server implemented with Leaf may include many modules (e.g. [LeafServer](https://github.com/name5566/leafserver)) which all share below traits:\n\n* Each module runs inside a separate goroutine\n* Modules communicate with one another via a light weight RPC channel([leaf/chanrpc](https://github.com/name5566/leaf/tree/master/chanrpc))\n\nLeaf suggests not to take in too many modules in your game server implementation.\n\nModules are registered at the beginning of program as below\n\n```go\nleaf.Run(\n    game.Module,\n    gate.Module,\n    login.Module,\n)\n```\n\nThe modules of `game`, `gate` and `gate` are registered consecutively. They are required to implement a `Module` interface.\n\n```go\ntype Module interface {\n    OnInit()\n    OnDestroy()\n    Run(closeSig chan bool)\n}\n```\n\nLeaf follows below steps to manage modules:\n\n1. Takes turns (FIFO) to register the given modules by calling `OnInit()`' in a parent goroutine\n2. Starts a new goroutine for each module to run `Run()`\n3. When the parent goroutine is being closed (like by a SIGINT), the modules will be unregistered by calling `OnDestroy()` in the reverse order when they get registered.\n\nLeaf source code directories\n----------------------------\n\n* leaf/chanrpc : RPC channel for inter-modules communication\n* leaf/db : Database Utilities with [MongoDB](https://www.mongodb.org/) support\n* leaf/gate : Gate module that connects to client\n* leaf/go : Factory of goroutine that manageable for Leaf\n* leaf/log : Logging\n* leaf/network : Networking through TCP or WebSocket with a customized message encoding. There are two built-in encodings, [protobuf](https://developers.google.com/protocol-buffers) and JSON.\n* leaf/recordfile : To manage game related data.\n* leaf/timer : Timer\n* leaf/util : Utilities\n\nHow to use Leaf\n---------------\n\n[LeafServer](https://github.com/name5566/leafserver) is a game server developped with Leaf. Let's start with it.\n\nDownload the source code of LeafServer：\n\n```\ngit clone https://github.com/name5566/leafserver\n```\n\nDownload and install leafserver to GOPATH:\n\n```\ngo get github.com/name5566/leaf\n```\n\nCompile LeafServer：\n\n```\ngo install server\n```\n\nRun `server` you will get below screen output if everything is successful.\n\n```\n2015/08/26 22:11:27 [release] Leaf 1.1.2 starting up\n```\n\nPress Ctrl + C to terminate the process, you'll see\n\n```\n2015/08/26 22:12:30 [release] Leaf closing down (signal: interrupt)\n```\n\n### Hello Leaf\n\nNow with the acknowledge of LeafServer, we come to see how server receives and handles messages.\n\n\nFirstly we define a JSON-encoded message(likely the protobuf). Open LeafServer msg/msg.go then you will see below:\n\n```go\npackage msg\n\nimport (\n    \"github.com/name5566/leaf/network\"\n)\n\nvar Processor network.Processor\n\nfunc init() {\n\n}\n```\n\nProcessor is the message handler. Here we use the handler of JSON, the default message encoding, and create a Hello message.\n\n```go\npackage msg\n\nimport (\n    \"github.com/name5566/leaf/network/json\"\n)\n\n// Create a JSON Processor（or protobuf if you like）\nvar Processor = json.NewProcessor()\n\nfunc init() {\n    // Register message Hello\n    Processor.Register(&Hello{})\n}\n\n// One struct for one message\n// Contains a string member\ntype Hello struct {\n    Name string\n}\n```\n\nEvery message sent from client to server will be flown to `gate` module for routing. Just in brief, `gate` determines which message will be handled by which modules. We want to feed `game` module with `Hello` here, so open LeafServer gate/router.go and write below:\n\n```go\npackage gate\n\nimport (\n    \"server/game\"\n    \"server/msg\"\n)\n\nfunc init() {\n    // Route Hello to game\n    // All communication are through ChanRPC including the management messages\n    msg.Processor.SetRouter(&msg.Hello{}, game.ChanRPC)\n}\n```\n\nIt is ready to handle `Hello` message in `game` module. Open LeafServer game/internal/handler.go and write:\n\n```go\npackage internal\n\nimport (\n    \"github.com/name5566/leaf/log\"\n    \"github.com/name5566/leaf/gate\"\n    \"reflect\"\n    \"server/msg\"\n)\n\nfunc init() {\n    // Register the handler of `Hello` message to `game` module handleHello\n    handler(&msg.Hello{}, handleHello)\n}\n\nfunc handler(m interface{}, h interface{}) {\n    skeleton.RegisterChanRPC(reflect.TypeOf(m), h)\n}\n\nfunc handleHello(args []interface{}) {\n    // Send \"Hello\"\n    m := args[0].(*msg.Hello)\n    // The receiver\n    a := args[1].(gate.Agent)\n\n    // The content of the message\n    log.Debug(\"hello %v\", m.Name)\n\n    // Reply with a `Hello`\n    a.WriteMsg(&msg.Hello{\n        Name: \"client\",\n    })\n}\n```\n\nBy here we've finished a simplest example for server. Now we will write a client from scratch for testing to understand the message structure better.\n\nWhen we choose TCP over the others, the message in transition will be all formated like below:\n\n```\n--------------\n| len | data |\n--------------\n```\n\nTo be more specific:\n\n1. len means the size of data by bytes. len itself takes space(2 bytes by default, configurable). The minimum size of len equals the the minimum size of a single message.\n2. data part is encoded with JSON or protobuf (or a customized one)\n\nWrite the client:\n```go\npackage main\n\nimport (\n    \"encoding/binary\"\n    \"net\"\n)\n\nfunc main() {\n    conn, err := net.Dial(\"tcp\", \"127.0.0.1:3563\")\n    if err != nil {\n        panic(err)\n    }\n\n    // Hello message (JSON-encoded)\n    // The structure of the message\n    data := []byte(`{\n        \"Hello\": {\n            \"Name\": \"leaf\"\n        }\n    }`)\n\n    // len + data\n    m := make([]byte, 2+len(data))\n\n    // BigEndian encoded\n    binary.BigEndian.PutUint16(m, uint16(len(data)))\n\n    copy(m[2:], data)\n\n    // Send message\n    conn.Write(m)\n}\n```\n\nRun the client to send the message, then server will display it as received\n\n```\n2015/09/25 07:41:03 [debug  ] hello leaf\n2015/09/25 07:41:03 [debug  ] read message: read tcp 127.0.0.1:3563->127.0.0.1:54599: wsarecv: An existing connection was forcibly closed by the remote host.\n```\n\nClient will exit after send out the message, and then disconnect with server. Thus server displays the event message of disconnection(the second, the event message might be dependant on the version of Go environment).\n\nBeside TCP, WebSocket is another choice of protocol and ideal for HTML5 web game. Leaf uses TCP or WebSocket separately or jointly. In other words, server can handle TCP messages and WebSocket messages at the same time. They are \"transparent\" for developers. From now on we will demonstrate how to use a client based on WebSocket:\n```html\n<script type=\"text/javascript\">\nvar ws = new WebSocket('ws://127.0.0.1:3653')\n\nws.onopen = function() {\n    // Send Hello message\n    ws.send(JSON.stringify({Hello: {\n        Name: 'leaf'\n    }}))\n}\n</script>\n```\n\nSave above to a HTML file and open it in a browser (with WebSocket support). Before that, we still have to update the configuration for LeafServer in bin/conf/server.json by adding WebSocket listenning address：\n```json\n{\n    \"LogLevel\": \"debug\",\n    \"LogPath\": \"\",\n    \"TCPAddr\": \"127.0.0.1:3563\",\n    \"WSAddr\": \"127.0.0.1:3653\",\n    \"MaxConnNum\": 20000\n}\n```\n\nRestart server then we get the first WebSocket message:\n\n```\n2015/09/25 07:50:03 [debug  ] hello leaf\n```\n\nPlease to be noted: Within WebSocket, Leaf always send binary messages rather text messages.\n\n### Leaf in details\n\nLeafServer includes three modules, they are:\n\n* gate module: for management of connection\n* login module: for the user authentication\n* game module: for the main business\n\nThe structure of a Leaf module is suggested (but not forced) to:\n\n1. Be located in a separate directory\n2. Have its internal implementation located under `./internal`\n3. Have a file external.go to expose its interfaces. For instance of external.go:\n\n```go\npackage game\n\nimport (\n    \"server/game/internal\"\n)\n\nvar (\n    // Instantiate game module\n    Module = new(internal.Module)\n    // Expose ChanRPC\n    ChanRPC = internal.ChanRPC\n)\n```\n\nInstantiation of game module must be done before its registration to Leaf framework(detailed in LeafServer main.go). Besides ChanRPC needs to be exposed for inter-module communication.\n\nEnter into game module's internal（LeafServer game/internal/module.go）：\n\n```go\npackage internal\n\nimport (\n    \"github.com/name5566/leaf/module\"\n    \"server/base\"\n)\n\nvar (\n    skeleton = base.NewSkeleton()\n    ChanRPC  = skeleton.ChanRPCServer\n)\n\ntype Module struct {\n    *module.Skeleton\n}\n\nfunc (m *Module) OnInit() {\n    m.Skeleton = skeleton\n}\n\nfunc (m *Module) OnDestroy() {\n\n}\n```\n\nskeleton is the key which implements `Run()` and provides:\n\n* ChanRPC\n* goroutine\n* Timer\n\n### Leaf ChanRPC\n\nSince in Leaf, every module runs in a separate goroutine, a RPC channel is needed to support the communication between modules. The representing object ChanRPC needs to be registered when the game server is being started and actually it is not safe. For example, in LeafServer, game module registers two ChanRPC objects: NewAgent and CloseAgent.\n\n```go\npackage internal\n\nimport (\n    \"github.com/name5566/leaf/gate\"\n)\n\nfunc init() {\n    skeleton.RegisterChanRPC(\"NewAgent\", rpcNewAgent)\n    skeleton.RegisterChanRPC(\"CloseAgent\", rpcCloseAgent)\n}\n\nfunc rpcNewAgent(args []interface{}) {\n\n}\n\nfunc rpcCloseAgent(args []interface{}) {\n\n}\n```\n\nskeleton is used to register ChanRPC. RegisterChanRPC's first parameter is the string name of ChanRPC and the second is the function that implements ChanRPC. NewAgent and CloseAgent will be called by gate module respectively when connection is set up or broken. The calling of ChanRPC includes 3 modes:\n\n1. Synchronous mode : called waiting for ChanRPC is yielded\n2. Asynchronous mode : called with a callback function where you can handle the returned ChanRPC\n3. \"Go mode\" : return immediately ignoring any return values or errors\n\nThis is how gate module call game module's NewAgent ChanRPC (This snippet is simplified for demonstration):\n\n```go\ngame.ChanRPC.Go(\"NewAgent\", a)\n```\n\nHere NewAgent will be called with a parameter a which can be retrieved from args[0], the rest can be done in the same manner.\n\nMore references are at [leaf/chanrpc](https://github.com/name5566/leaf/blob/master/chanrpc). Please be noted, no matter how delicate the encapsulation is, calling function across goroutines cannot be that straight. Try not to create too many modules and interactions. Modules designed in Leaf are supposed to decouple the businesses from others rather make most use of CPU cores. The correct way to make most use of CPU cores is to use goroutine properly.\n\n### Leaf Go\n\nUse goroutine properly can make better use of CPU cores. Leaf implements its own Go() for below reasons:\n\n* Errors within goroutine can be handled\n* Game server needs to wait for all goroutines' execution\n* The results of goroutine can be obtained more easily\n* goroutine will follow the order to be exercised. It is very important in some occasion\n\nHere is an example which can be tested in OnInit() in LeafServer's module.\n\n```go\nlog.Debug(\"1\")\n\n// Define res to make the result watchable\nvar res string\n\nskeleton.Go(func() {\n    // Simulate a slow operation\n    time.Sleep(1 * time.Second)\n\n    // res is modified\n    res = \"3\"\n}, func() {\n    log.Debug(res)\n})\n\nlog.Debug(\"2\")\n```\n\nThe result are:\n\n```go\n2015/08/27 20:37:17 [debug  ] 1\n2015/08/27 20:37:17 [debug  ] 2\n2015/08/27 20:37:18 [debug  ] 3\n```\n\nskeleton.Go() accepts two function parameters, first one will be exercised in a separate goroutine and afterwards the second be exercised within the same goroutine. And res can only be used by one goroutine at one moment so nothing more need to be done for synchronization. This implementation makes CPU can be fully used while no need to block goroutines. It is quite convenient when shared resources are used.\n\nMore references are at [leaf/go](https://github.com/name5566/leaf/blob/master/go)。\n\n### Leaf timer\n\nGo has a built-in implementation in its standard library:\n\n```go\nfunc AfterFunc(d Duration, f func()) *Timer\n```\n\nAfterFunc() will wait for a duration of d then exercises f() in a separate goroutine. Leaf also implement AfterFunc(), and in this version f() will be exercised but within the same goroutine. It will prevent synchronization from happening.\n\n```go\nskeleton.AfterFunc(5 * time.Second, func() {\n    // ...\n})\n```\n\nBesides, Leaf timer support [cron expressions](https://en.wikipedia.org/wiki/Cron) to support scheduled jobs like start at 9am daily or Sunday 6pm weekly.\n\nMore references are at [leaf/timer](https://github.com/name5566/leaf/blob/master/timer)。\n\n### Leaf log\n\nLeaf support below log level:\n\n1. Debug level: Not critical\n2. Release level: Critical\n3. Error level: Errors\n4. Fatal level: Fatal errors\n\nDebug < Release < Error < Fatal (In priority level)\n\nFor LeafServer, bin/conf/server.json is used to configure log level which will filter out the lower level log information. Fatal level log is sort of different and comes only when the game server exit. Usually it records the information when the game server is failed to start up.\n\nSet LogFlag (LeafServer conf/conf.go) to output the file name and the line number:\n\n```\nLogFlag = log.Lshortfile\n```\n\nLogFlag：[https://golang.org/pkg/log/#pkg-constants](https://golang.org/pkg/log/#pkg-constants)\n\n\nMore references are at [leaf/log](https://github.com/name5566/leaf/blob/master/log).\n\n### Leaf recordfile\n\nLeaf recordfile is formatted in CSV([Example](https://github.com/name5566/leaf/blob/master/recordfile/test.txt)). recordfile is to manage the configuration for game. The usage of recordfile in LeafServer is quite simple:\n\n1. Create a CSV file under bin/gamedata\n2. Call readRf() to read it in gamedata module\n\nSamples:\n\n```go\n// Make sure Test.txt is located in bin/gamedata\n// The file name must match the name of the struct, and all characters are case sensitive.\n// Every instance of defined struct maps to one specific row in recordfile\ntype Test struct {\n    // The type of first column is int\n    // \"index\" means this column will be indexed(exclusively)\n    Id  int \"index\"\n    // The type of second column is an array of int with a length of 4\n    Arr [4]int\n    // The type of third column is string\n    Str string\n}\n\n// Load recordfile Test.txt into memory\n// RfTest is the object that represents Test.txt in memory\nvar RfTest = readRf(Test{})\n\nfunc init() {\n    // Search in index\n    // Fetch the row with id equals 1 in Test.txt\n    r := RfTest.Index(1)\n\n    if r != nil {\n        row := r.(*Test)\n\n        // Log this row\n        log.Debug(\"%v %v %v\", row.Id, row.Arr, row.Str)\n    }\n}\n```\n\nRefer to [leaf/recordfile](https://github.com/name5566/leaf/blob/master/recordfile) for more details.\n\nLearn more\n----------\n\nMore references are at Wiki [https://github.com/name5566/leaf/wiki](https://github.com/name5566/leaf/wiki)\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/TUTORIAL_ZH.md",
    "content": "Leaf 游戏服务器框架简介\n==================\n\nLeaf 是一个由 Go 语言（golang）编写的开发效率和执行效率并重的开源游戏服务器框架。Leaf 适用于各类游戏服务器的开发，包括 H5（HTML5）游戏服务器。\n\nLeaf 的关注点：\n\n* 良好的使用体验。Leaf 总是尽可能的提供简洁和易用的接口，尽可能的提升开发的效率\n* 稳定性。Leaf 总是尽可能的恢复运行过程中的错误，避免崩溃\n* 多核支持。Leaf 通过模块机制和 [leaf/go](https://github.com/name5566/leaf/tree/master/go) 尽可能的利用多核资源，同时又尽量避免各种副作用\n* 模块机制。\n\nLeaf 的模块机制\n---------------\n\n一个 Leaf 开发的游戏服务器由多个模块组成（例如 [LeafServer](https://github.com/name5566/leafserver)），模块有以下特点：\n\n* 每个模块运行在一个单独的 goroutine 中\n* 模块间通过一套轻量的 RPC 机制通讯（[leaf/chanrpc](https://github.com/name5566/leaf/tree/master/chanrpc)）\n\nLeaf 不建议在游戏服务器中设计过多的模块。\n\n游戏服务器在启动时进行模块的注册，例如：\n\n```go\nleaf.Run(\n\tgame.Module,\n\tgate.Module,\n\tlogin.Module,\n)\n```\n\n这里按顺序注册了 game、gate、login 三个模块。每个模块都需要实现接口：\n\n```go\ntype Module interface {\n\tOnInit()\n\tOnDestroy()\n\tRun(closeSig chan bool)\n}\n```\n\nLeaf 首先会在同一个 goroutine 中按模块注册顺序执行模块的 OnInit 方法，等到所有模块 OnInit 方法执行完成后则为每一个模块启动一个 goroutine 并执行模块的 Run 方法。最后，游戏服务器关闭时（Ctrl + C 关闭游戏服务器）将按模块注册相反顺序在同一个 goroutine 中执行模块的 OnDestroy 方法。\n\nLeaf 源码概览\n---------------\n\n* leaf/chanrpc 提供了一套基于 channel 的 RPC 机制，用于游戏服务器模块间通讯\n* leaf/db 数据库相关，目前支持 [MongoDB](https://www.mongodb.org/)\n* leaf/gate 网关模块，负责游戏客户端的接入\n* leaf/go 用于创建能够被 Leaf 管理的 goroutine\n* leaf/log 日志相关\n* leaf/network 网络相关，使用 TCP 和 WebSocket 协议，可自定义消息格式，默认 Leaf 提供了基于 [protobuf](https://developers.google.com/protocol-buffers) 和 JSON 的消息格式\n* leaf/recordfile 用于管理游戏数据\n* leaf/timer 定时器相关\n* leaf/util 辅助库\n\n使用 Leaf 开发游戏服务器\n---------------\n\n[LeafServer](https://github.com/name5566/leafserver) 是一个基于 Leaf 开发的游戏服务器，我们以 LeafServer 作为起点。\n\n获取 LeafServer：\n\n```\ngit clone https://github.com/name5566/leafserver\n```\n\n设置 leafserver 目录到 GOPATH 环境变量后获取 Leaf：\n\n```\ngo get github.com/name5566/leaf\n```\n\n编译 LeafServer：\n\n```\ngo install server\n```\n\n如果一切顺利，运行 server 你可以获得以下输出：\n\n```\n2015/08/26 22:11:27 [release] Leaf 1.1.2 starting up\n```\n\n敲击 Ctrl + C 关闭游戏服务器，服务器正常关闭输出：\n\n```\n2015/08/26 22:12:30 [release] Leaf closing down (signal: interrupt)\n```\n\n### Hello Leaf\n\n现在，在 LeafServer 的基础上，我们来看看游戏服务器如何接收和处理网络消息。\n\n首先定义一个 JSON 格式的消息（protobuf 类似）。打开 LeafServer msg/msg.go 文件可以看到如下代码：\n\n```go\npackage msg\n\nimport (\n\t\"github.com/name5566/leaf/network\"\n)\n\nvar Processor network.Processor\n\nfunc init() {\n\n}\n```\n\nProcessor 为消息的处理器（可由用户自定义），这里我们使用 Leaf 默认提供的 JSON 消息处理器并尝试添加一个名字为 Hello 的消息：\n\n```go\npackage msg\n\nimport (\n\t\"github.com/name5566/leaf/network/json\"\n)\n\n// 使用默认的 JSON 消息处理器（默认还提供了 protobuf 消息处理器）\nvar Processor = json.NewProcessor()\n\nfunc init() {\n\t// 这里我们注册了一个 JSON 消息 Hello\n\tProcessor.Register(&Hello{})\n}\n\n// 一个结构体定义了一个 JSON 消息的格式\n// 消息名为 Hello\ntype Hello struct {\n\tName string\n}\n```\n\n客户端发送到游戏服务器的消息需要通过 gate 模块路由，简而言之，gate 模块决定了某个消息具体交给内部的哪个模块来处理。这里，我们将 Hello 消息路由到 game 模块中。打开 LeafServer gate/router.go，敲入如下代码：\n\n```go\npackage gate\n\nimport (\n\t\"server/game\"\n\t\"server/msg\"\n)\n\nfunc init() {\n\t// 这里指定消息 Hello 路由到 game 模块\n\t// 模块间使用 ChanRPC 通讯，消息路由也不例外\n\tmsg.Processor.SetRouter(&msg.Hello{}, game.ChanRPC)\n}\n```\n\n一切就绪，我们现在可以在 game 模块中处理 Hello 消息了。打开 LeafServer game/internal/handler.go，敲入如下代码：\n\n```go\npackage internal\n\nimport (\n\t\"github.com/name5566/leaf/log\"\n\t\"github.com/name5566/leaf/gate\"\n\t\"reflect\"\n\t\"server/msg\"\n)\n\nfunc init() {\n\t// 向当前模块（game 模块）注册 Hello 消息的消息处理函数 handleHello\n\thandler(&msg.Hello{}, handleHello)\n}\n\nfunc handler(m interface{}, h interface{}) {\n\tskeleton.RegisterChanRPC(reflect.TypeOf(m), h)\n}\n\nfunc handleHello(args []interface{}) {\n\t// 收到的 Hello 消息\n\tm := args[0].(*msg.Hello)\n\t// 消息的发送者\n\ta := args[1].(gate.Agent)\n\n\t// 输出收到的消息的内容\n\tlog.Debug(\"hello %v\", m.Name)\n\n\t// 给发送者回应一个 Hello 消息\n\ta.WriteMsg(&msg.Hello{\n\t\tName: \"client\",\n\t})\n}\n```\n\n到这里，一个简单的范例就完成了。为了更加清楚的了解消息的格式，我们从 0 编写一个最简单的测试客户端。\n\nLeaf 中，当选择使用 TCP 协议时，在网络中传输的消息都会使用以下格式：\n\n```\n--------------\n| len | data |\n--------------\n```\n\n其中：\n\n1. len 表示了 data 部分的长度（字节数）。len 本身也有长度，默认为 2 字节（可配置），len 本身的长度决定了单个消息的最大大小\n2. data 部分使用 JSON 或者 protobuf 编码（也可自定义其他编码方式）\n\n测试客户端同样使用 Go 语言编写：\n```go\npackage main\n\nimport (\n\t\"encoding/binary\"\n\t\"net\"\n)\n\nfunc main() {\n\tconn, err := net.Dial(\"tcp\", \"127.0.0.1:3563\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Hello 消息（JSON 格式）\n\t// 对应游戏服务器 Hello 消息结构体\n\tdata := []byte(`{\n\t\t\"Hello\": {\n\t\t\t\"Name\": \"leaf\"\n\t\t}\n\t}`)\n\n\t// len + data\n\tm := make([]byte, 2+len(data))\n\n\t// 默认使用大端序\n\tbinary.BigEndian.PutUint16(m, uint16(len(data)))\n\n\tcopy(m[2:], data)\n\n\t// 发送消息\n\tconn.Write(m)\n}\n```\n\n执行此测试客户端，游戏服务器输出：\n\n```\n2015/09/25 07:41:03 [debug  ] hello leaf\n2015/09/25 07:41:03 [debug  ] read message: read tcp 127.0.0.1:3563->127.0.0.1:54599: wsarecv: An existing connection was forcibly closed by the remote host.\n```\n\n测试客户端发送完消息以后就退出了，此时和游戏服务器的连接断开，相应的，游戏服务器输出连接断开的提示日志（第二条日志，日志的具体内容和 Go 语言版本有关）。\n\n除了使用 TCP 协议外，还可以选择使用 WebSocket 协议（例如开发 H5 游戏）。Leaf 可以单独使用 TCP 协议或 WebSocket 协议，也可以同时使用两者，换而言之，服务器可以同时接受 TCP 连接和 WebSocket 连接，对开发者而言消息来自 TCP 还是 WebSocket 是完全透明的。现在，我们来编写一个对应上例的使用 WebSocket 协议的客户端：\n```html\n<script type=\"text/javascript\">\nvar ws = new WebSocket('ws://127.0.0.1:3653')\n\nws.onopen = function() {\n    // 发送 Hello 消息\n    ws.send(JSON.stringify({Hello: {\n        Name: 'leaf'\n    }}))\n}\n</script>\n```\n\n保存上述代码到某 HTML 文件中并使用（任意支持 WebSocket 协议的）浏览器打开。在打开此 HTML 文件前，首先需要配置一下 LeafServer 的 bin/conf/server.json 文件，增加 WebSocket 监听地址（WSAddr）：\n```json\n{\n    \"LogLevel\": \"debug\",\n    \"LogPath\": \"\",\n    \"TCPAddr\": \"127.0.0.1:3563\",\n    \"WSAddr\": \"127.0.0.1:3653\",\n    \"MaxConnNum\": 20000\n}\n```\n\n重启游戏服务器后，方可接受 WebSocket 消息：\n\n```\n2015/09/25 07:50:03 [debug  ] hello leaf\n```\n\n在 Leaf 中使用 WebSocket 需要注意的一点是：Leaf 总是发送二进制消息而非文本消息。\n\n### Leaf 模块详解\n\nLeafServer 中包含了 3 个模块，它们分别是：\n\n* gate 模块，负责游戏客户端的接入\n* login 模块，负责登录流程\n* game 模块，负责游戏主逻辑\n\n一般来说（而非强制规定），从代码结构上，一个 Leaf 模块：\n\n1. 放置于一个目录中（例如 game 模块放置于 game 目录中）\n2. 模块的具体实现放置于 internal 包中（例如 game 模块的具体实现放置于 game/internal 包中）\n\n每个模块下一般有一个 external.go 的文件，顾名思义表示模块对外暴露的接口，这里以 game 模块的 external.go 文件为例：\n\n```go\npackage game\n\nimport (\n\t\"server/game/internal\"\n)\n\nvar (\n\t// 实例化 game 模块\n\tModule  = new(internal.Module)\n\t// 暴露 ChanRPC\n\tChanRPC = internal.ChanRPC\n)\n```\n\n首先，模块会被实例化，这样才能注册到 Leaf 框架中（详见 LeafServer main.go），另外，模块暴露的 ChanRPC 被用于模块间通讯。\n\n进入 game 模块的内部（LeafServer game/internal/module.go）：\n\n```go\npackage internal\n\nimport (\n\t\"github.com/name5566/leaf/module\"\n\t\"server/base\"\n)\n\nvar (\n\tskeleton = base.NewSkeleton()\n\tChanRPC  = skeleton.ChanRPCServer\n)\n\ntype Module struct {\n\t*module.Skeleton\n}\n\nfunc (m *Module) OnInit() {\n\tm.Skeleton = skeleton\n}\n\nfunc (m *Module) OnDestroy() {\n\n}\n```\n\n模块中最关键的就是 skeleton（骨架），skeleton 实现了 Module 接口的 Run 方法并提供了：\n\n* ChanRPC\n* goroutine\n* 定时器\n\n### Leaf ChanRPC\n\n由于 Leaf 中，每个模块跑在独立的 goroutine 上，为了模块间方便的相互调用就有了基于 channel 的 RPC 机制。一个 ChanRPC 需要在游戏服务器初始化的时候进行注册（注册过程不是 goroutine 安全的），例如 LeafServer 中 game 模块注册了 NewAgent 和 CloseAgent 两个 ChanRPC：\n\n```go\npackage internal\n\nimport (\n\t\"github.com/name5566/leaf/gate\"\n)\n\nfunc init() {\n\tskeleton.RegisterChanRPC(\"NewAgent\", rpcNewAgent)\n\tskeleton.RegisterChanRPC(\"CloseAgent\", rpcCloseAgent)\n}\n\nfunc rpcNewAgent(args []interface{}) {\n\n}\n\nfunc rpcCloseAgent(args []interface{}) {\n\n}\n```\n\n使用 skeleton 来注册 ChanRPC。RegisterChanRPC 的第一个参数是 ChanRPC 的名字，第二个参数是 ChanRPC 的实现。这里的 NewAgent 和 CloseAgent 会被 LeafServer 的 gate 模块在连接建立和连接中断时调用。ChanRPC 的调用方有 3 种调用模式：\n\n1. 同步模式，调用并等待 ChanRPC 返回\n2. 异步模式，调用并提供回调函数，回调函数会在 ChanRPC 返回后被调用\n3. Go 模式，调用并立即返回，忽略任何返回值和错误\n\ngate 模块这样调用 game 模块的 NewAgent ChanRPC（这仅仅是一个示例，实际的代码细节复杂的多）：\n\n```go\ngame.ChanRPC.Go(\"NewAgent\", a)\n```\n\n这里调用 NewAgent 并传递参数 a，我们在 rpcNewAgent 的参数 args[0] 中可以取到 a（args[1] 表示第二个参数，以此类推）。\n\n更加详细的用法可以参考 [leaf/chanrpc](https://github.com/name5566/leaf/blob/master/chanrpc)。需要注意的是，无论封装多么精巧，跨 goroutine 的调用总不能像直接的函数调用那样简单直接，因此除非必要我们不要构建太多的模块，模块间不要太频繁的交互。模块在 Leaf 中被设计出来最主要是用于划分功能而非利用多核，Leaf 认为在模块内按需使用 goroutine 才是多核利用率问题的解决之道。\n\n### Leaf Go\n\n善用 goroutine 能够充分利用多核资源，Leaf 提供的 Go 机制解决了原生 goroutine 存在的一些问题：\n\n* 能够恢复 goroutine 运行过程中的错误\n* 游戏服务器会等待所有 goroutine 执行结束后才关闭\n* 非常方便的获取 goroutine 执行的结果数据\n* 在一些特殊场合保证 goroutine 按创建顺序执行\n\n我们来看一个例子（可以在 LeafServer 的模块的 OnInit 方法中测试）：\n\n```go\nlog.Debug(\"1\")\n\n// 定义变量 res 接收结果\nvar res string\n\nskeleton.Go(func() {\n\t// 这里使用 Sleep 来模拟一个很慢的操作\n\ttime.Sleep(1 * time.Second)\n\n\t// 假定得到结果\n\tres = \"3\"\n}, func() {\n\tlog.Debug(res)\n})\n\nlog.Debug(\"2\")\n```\n\n上面代码执行结果如下：\n\n```go\n2015/08/27 20:37:17 [debug  ] 1\n2015/08/27 20:37:17 [debug  ] 2\n2015/08/27 20:37:18 [debug  ] 3\n```\n\n这里的 Go 方法接收 2 个函数作为参数，第一个函数会被放置在一个新创建的 goroutine 中执行，在其执行完成之后，第二个函数会在当前 goroutine 中被执行。由此，我们可以看到变量 res 同一时刻总是只被一个 goroutine 访问，这就避免了同步机制的使用。Go 的设计使得 CPU 得到充分利用，避免操作阻塞当前 goroutine，同时又无需为共享资源同步而忧心。\n\n更加详细的用法可以参考 [leaf/go](https://github.com/name5566/leaf/blob/master/go)。\n\n### Leaf timer\n\nGo 语言标准库提供了定时器的支持：\n\n```go\nfunc AfterFunc(d Duration, f func()) *Timer\n```\n\nAfterFunc 会等待 d 时长后调用 f 函数，这里的 f 函数将在另外一个 goroutine 中执行。Leaf 提供了一个相同的 AfterFunc 函数，相比之下，f 函数在 AfterFunc 的调用 goroutine 中执行，这样就避免了同步机制的使用：\n\n```go\nskeleton.AfterFunc(5 * time.Second, func() {\n\t// ...\n})\n```\n\n另外，Leaf timer 还支持 [cron 表达式](https://en.wikipedia.org/wiki/Cron)，用于实现诸如“每天 9 点执行”、“每周末 6 点执行”的逻辑。\n\n更加详细的用法可以参考 [leaf/timer](https://github.com/name5566/leaf/blob/master/timer)。\n\n### Leaf log\n\nLeaf 的 log 系统支持多种日志级别：\n\n1. Debug 日志，非关键日志\n2. Release 日志，关键日志\n3. Error 日志，错误日志\n4. Fatal 日志，致命错误日志\n\nDebug < Release < Error < Fatal（日志级别高低）\n\n在 LeafServer 中，bin/conf/server.json 可以配置日志级别，低于配置的日志级别的日志将不会输出。Fatal 日志比较特殊，每次输出 Fatal 日志之后游戏服务器进程就会结束，通常来说，只在游戏服务器初始化失败时使用 Fatal 日志。\n\n我们还可以通过配置 LeafServer conf/conf.go 的 LogFlag 来在日志中输出文件名和行号：\n\n```\nLogFlag = log.Lshortfile\n```\n\n可用的 LogFlag 见：[https://golang.org/pkg/log/#pkg-constants](https://golang.org/pkg/log/#pkg-constants)\n\n\n更加详细的用法可以参考 [leaf/log](https://github.com/name5566/leaf/blob/master/log)。\n\n### Leaf recordfile\n\nLeaf 的 recordfile 是基于 CSV 格式（范例见[这里](https://github.com/name5566/leaf/blob/master/recordfile/test.txt)）。recordfile 用于管理游戏配置数据。在 LeafServer 中使用 recordfile 非常简单：\n\n1. 将 CSV 文件放置于 bin/gamedata 目录中\n2. 在 gamedata 模块中调用函数 readRf 读取 CSV 文件\n\n范例：\n\n```go\n// 确保 bin/gamedata 目录中存在 Test.txt 文件\n// 文件名必须和此结构体名称相同（大小写敏感）\n// 结构体的一个实例映射 recordfile 中的一行\ntype Test struct {\n\t// 将第一列按 int 类型解析\n\t// \"index\" 表明在此列上建立唯一索引\n\tId  int \"index\"\n\t// 将第二列解析为长度为 4 的整型数组\n\tArr [4]int\n\t// 将第三列解析为字符串\n\tStr string\n}\n\n// 读取 recordfile Test.txt 到内存中\n// RfTest 即为 Test.txt 的内存镜像\nvar RfTest = readRf(Test{})\n\nfunc init() {\n\t// 按索引查找\n\t// 获取 Test.txt 中 Id 为 1 的那一行\n\tr := RfTest.Index(1)\n\n\tif r != nil {\n\t\trow := r.(*Test)\n\n\t\t// 输出此行的所有列的数据\n\t\tlog.Debug(\"%v %v %v\", row.Id, row.Arr, row.Str)\n\t}\n}\n```\n\n更加详细的用法可以参考 [leaf/recordfile](https://github.com/name5566/leaf/blob/master/recordfile)。\n\n了解更多\n---------------\n\n阅读 Wiki 获取更多的帮助：[https://github.com/name5566/leaf/wiki](https://github.com/name5566/leaf/wiki)\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/chanrpc/chanrpc.go",
    "content": "package chanrpc\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/golang/glog\"\n\t\"reflect\"\n\t\"github.com/dolotech/lib/utils\"\n)\n\ntype Server struct {\n\tfunctions map[interface{}]*reflect.Value\n\tChanCall  chan *CallInfo\n}\n\ntype CallInfo struct {\n\tf       *reflect.Value\n\targs    []interface{}\n\tchanRet chan *RetInfo\n\tcb      interface{}\n}\n\ntype RetInfo struct {\n\tret interface{}\n\terr error\n\tcb  interface{}\n}\n\ntype Client struct {\n\ts               *Server\n\tchanSyncRet     chan *RetInfo\n\tChanAsynRet     chan *RetInfo\n\tpendingAsynCall int\n}\n\nfunc NewServer(l int) *Server {\n\ts := new(Server)\n\ts.functions = make(map[interface{}]*reflect.Value)\n\ts.ChanCall = make(chan *CallInfo, l)\n\treturn s\n}\n\nfunc assert(i interface{}) []interface{} {\n\tif i == nil {\n\t\treturn nil\n\t} else {\n\t\treturn i.([]interface{})\n\t}\n}\n\n// you must call the function before calling Open and Go\nfunc (s *Server) Register(id interface{}, f interface{}) {\n\tif reflect.TypeOf(f).Kind() != reflect.Func {\n\t\tglog.Warning(\"消息处理不是函数\", id)\n\t\treturn\n\t}\n\tif _, ok := s.functions[id]; ok {\n\t\treturn\n\t\t//panic(fmt.Sprintf(\"function id %v: already registered\", id))\n\t}\n\n\tv := reflect.ValueOf(f)\n\ts.functions[id] = &v\n}\n\nfunc (s *Server) ret(ci *CallInfo, ri *RetInfo) (err error) {\n\tif ci.chanRet == nil {\n\t\treturn\n\t}\n\n\tdefer utils.PrintPanicStack()\n\n\tri.cb = ci.cb\n\tci.chanRet <- ri\n\treturn\n}\n\nfunc (s *Server) Exec(ci *CallInfo) {\n\tdefer func() {\n\t\tif r := utils.PrintPanicStack(); r != nil {\n\t\t\ts.ret(ci, &RetInfo{err: fmt.Errorf(\"%v\", r)})\n\t\t}\n\t}()\n\n\tagrs := make([]reflect.Value, 0, len(ci.args))\n\tfor i := 0; i < len(ci.args); i++ {\n\t\tagrs = append(agrs, reflect.ValueOf(ci.args[i]))\n\t}\n\tci.f.Call(agrs)\n}\n\n// goroutine safe\nfunc (s *Server) Go(id interface{}, args ...interface{}) {\n\tf, _ := s.functions[id]\n\tif f == nil {\n\t\treturn\n\t}\n\n\tdefer utils.PrintPanicStack()\n\n\ts.ChanCall <- &CallInfo{\n\t\tf:    f,\n\t\targs: args,\n\t}\n}\n\n// goroutine safe\nfunc (s *Server) Call0(id interface{}, args ...interface{}) error {\n\treturn s.Open(0).Call0(id, args...)\n}\n\n// goroutine safe\nfunc (s *Server) Call1(id interface{}, args ...interface{}) (interface{}, error) {\n\treturn s.Open(0).Call1(id, args...)\n}\n\n// goroutine safe\nfunc (s *Server) CallN(id interface{}, args ...interface{}) ([]interface{}, error) {\n\treturn s.Open(0).CallN(id, args...)\n}\n\nfunc (s *Server) Close() {\n\tclose(s.ChanCall)\n\n\tfor ci := range s.ChanCall {\n\t\ts.ret(ci, &RetInfo{\n\t\t\terr: errors.New(\"chanrpc server closed\"),\n\t\t})\n\t}\n}\n\n// goroutine safe\nfunc (s *Server) Open(l int) *Client {\n\tc := NewClient(l)\n\tc.Attach(s)\n\treturn c\n}\n\nfunc NewClient(l int) *Client {\n\tc := new(Client)\n\tc.chanSyncRet = make(chan *RetInfo, 1)\n\tc.ChanAsynRet = make(chan *RetInfo, l)\n\treturn c\n}\n\nfunc (c *Client) Attach(s *Server) {\n\tc.s = s\n}\n\nfunc (c *Client) call(ci *CallInfo, block bool) (err error) {\n\tdefer func() {\n\t\tif r := utils.PrintPanicStack(); r != nil {\n\t\t\terr = r.(error)\n\t\t}\n\t}()\n\n\tif block {\n\t\tc.s.ChanCall <- ci\n\t} else {\n\t\tselect {\n\t\tcase c.s.ChanCall <- ci:\n\t\tdefault:\n\t\t\terr = errors.New(\"chanrpc channel full\")\n\t\t}\n\t}\n\treturn\n}\n\nfunc (c *Client) f(id interface{}, n int) (*reflect.Value, error) {\n\tif c.s == nil {\n\t\treturn nil, errors.New(\"server not attached\")\n\t}\n\tf := c.s.functions[id]\n\tif f == nil {\n\t\treturn nil, fmt.Errorf(\"function id %v: function not registered\", id)\n\t}\n\treturn f, nil\n}\n\nfunc (c *Client) Call0(id interface{}, args ...interface{}) error {\n\tf, err := c.f(id, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.call(&CallInfo{\n\t\tf:       f,\n\t\targs:    args,\n\t\tchanRet: c.chanSyncRet,\n\t}, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tri := <-c.chanSyncRet\n\treturn ri.err\n}\n\nfunc (c *Client) Call1(id interface{}, args ...interface{}) (interface{}, error) {\n\tf, err := c.f(id, 1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = c.call(&CallInfo{\n\t\tf:       f,\n\t\targs:    args,\n\t\tchanRet: c.chanSyncRet,\n\t}, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tri := <-c.chanSyncRet\n\treturn ri.ret, ri.err\n}\n\nfunc (c *Client) CallN(id interface{}, args ...interface{}) ([]interface{}, error) {\n\tf, err := c.f(id, 2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.call(&CallInfo{\n\t\tf:       f,\n\t\targs:    args,\n\t\tchanRet: c.chanSyncRet,\n\t}, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tri := <-c.chanSyncRet\n\treturn assert(ri.ret), ri.err\n}\n\nfunc (c *Client) asynCall(id interface{}, args []interface{}, cb interface{}, n int) {\n\tf, err := c.f(id, n)\n\tif err != nil {\n\t\tc.ChanAsynRet <- &RetInfo{err: err, cb: cb}\n\t\treturn\n\t}\n\terr = c.call(&CallInfo{\n\t\tf:       f,\n\t\targs:    args,\n\t\tchanRet: c.ChanAsynRet,\n\t\tcb:      cb,\n\t}, false)\n\tif err != nil {\n\t\tc.ChanAsynRet <- &RetInfo{err: err, cb: cb}\n\t\treturn\n\t}\n}\n\nfunc (c *Client) AsynCall(id interface{}, _args ...interface{}) {\n\tif len(_args) < 1 {\n\t\tpanic(\"callback function not found\")\n\t}\n\n\targs := _args[:len(_args)-1]\n\tcb := _args[len(_args)-1]\n\n\tvar n int\n\tswitch cb.(type) {\n\tcase func(error):\n\t\tn = 0\n\tcase func(interface{}, error):\n\t\tn = 1\n\tcase func([]interface{}, error):\n\t\tn = 2\n\tdefault:\n\t\tpanic(\"definition of callback function is invalid\")\n\t}\n\n\t// too many calls\n\tif c.pendingAsynCall >= cap(c.ChanAsynRet) {\n\t\texecCb(&RetInfo{err: errors.New(\"too many calls\"), cb: cb})\n\t\treturn\n\t}\n\n\tc.asynCall(id, args, cb, n)\n\tc.pendingAsynCall++\n}\n\nfunc execCb(ri *RetInfo) {\n\tdefer utils.PrintPanicStack()\n\n\t// execute\n\tswitch ri.cb.(type) {\n\tcase func(error):\n\t\tri.cb.(func(error))(ri.err)\n\tcase func(interface{}, error):\n\t\tri.cb.(func(interface{}, error))(ri.ret, ri.err)\n\tcase func([]interface{}, error):\n\t\tri.cb.(func([]interface{}, error))(assert(ri.ret), ri.err)\n\tdefault:\n\t\tpanic(\"bug\")\n\t}\n\treturn\n}\n\nfunc (c *Client) Cb(ri *RetInfo) {\n\tc.pendingAsynCall--\n\texecCb(ri)\n}\n\nfunc (c *Client) Close() {\n\tfor c.pendingAsynCall > 0 {\n\t\tc.Cb(<-c.ChanAsynRet)\n\t}\n}\n\nfunc (c *Client) Idle() bool {\n\treturn c.pendingAsynCall == 0\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/chanrpc/example_test.go",
    "content": "package chanrpc\n\nimport (\n\t\"sync\"\n\t\"testing\"\n)\n\nfunc TestClient_AsynCall(t *testing.T) {\n\ts := NewServer(10)\n\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\n\t// goroutine 1\n\tgo func() {\n\t\ts.Register(\"f0\", func(args []interface{}) {\n\n\t\t})\n\n\t\ts.Register(\"f1\", func(args []interface{}) interface{} {\n\t\t\treturn 1\n\t\t})\n\n\t\ts.Register(\"fn\", func(args []interface{}) []interface{} {\n\t\t\treturn []interface{}{1, 2, 3}\n\t\t})\n\n\t\ts.Register(\"add\", func(args []interface{}) interface{} {\n\t\t\tn1 := args[0].(int)\n\t\t\tn2 := args[1].(int)\n\t\t\treturn n1 + n2\n\t\t})\n\n\t\twg.Done()\n\n\t\tfor {\n\t\t\ts.Exec(<-s.ChanCall)\n\t\t}\n\t}()\n\n\twg.Wait()\n\twg.Add(1)\n\n\t// goroutine 2\n\tgo func() {\n\t\tc := s.Open(10)\n\n\t\t// sync\n\t\terr := c.Call0(\"f0\")\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t}\n\n\t\tr1, err := c.Call1(\"f1\")\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t} else {\n\t\t\tt.Log(r1)\n\t\t}\n\n\t\trn, err := c.CallN(\"fn\")\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t} else {\n\t\t\tt.Log(rn[0], rn[1], rn[2])\n\t\t}\n\n\t\tra, err := c.Call1(\"add\", 1, 2)\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t} else {\n\t\t\tt.Log(ra)\n\t\t}\n\n\t\t// asyn\n\t\tc.AsynCall(\"f0\", func(err error) {\n\t\t\tif err != nil {\n\t\t\t\tt.Log(err)\n\t\t\t}\n\t\t})\n\n\t\tc.AsynCall(\"f1\", func(ret interface{}, err error) {\n\t\t\tif err != nil {\n\t\t\t\tt.Log(err)\n\t\t\t} else {\n\t\t\t\tt.Log(ret)\n\t\t\t}\n\t\t})\n\n\t\tc.AsynCall(\"fn\", func(ret []interface{}, err error) {\n\t\t\tif err != nil {\n\t\t\t\tt.Log(err)\n\t\t\t} else {\n\t\t\t\tt.Log(ret[0], ret[1], ret[2])\n\t\t\t}\n\t\t})\n\n\t\tc.AsynCall(\"add\", 1, 2, func(ret interface{}, err error) {\n\t\t\tif err != nil {\n\t\t\t\tt.Log(err)\n\t\t\t} else {\n\t\t\t\tt.Log(ret)\n\t\t\t}\n\t\t})\n\n\t\tc.Cb(<-c.ChanAsynRet)\n\t\tc.Cb(<-c.ChanAsynRet)\n\t\tc.Cb(<-c.ChanAsynRet)\n\t\tc.Cb(<-c.ChanAsynRet)\n\n\t\t// go\n\t\ts.Go(\"f0\")\n\n\t\twg.Done()\n\t}()\n\n\twg.Wait()\n\n\t// Output:\n\t// 1\n\t// 1 2 3\n\t// 3\n\t// 1\n\t// 1 2 3\n\t// 3\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/conf/conf.go",
    "content": "package conf\n\nvar (\n\tLenStackBuf = 4096\n\n\t// console\n\tConsolePort   int\n\tConsolePrompt string = \"Leaf# \"\n\tProfilePath   string\n\n\t// cluster\n\tListenAddr      string\n\tConnAddrs       []string\n\tPendingWriteNum int\n)\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/gate/agent.go",
    "content": "package gate\n\nimport (\n\t\"net\"\n)\n\ntype Agent interface {\n\tWriteMsg(msg interface{})\n\tLocalAddr() net.Addr\n\tRemoteAddr() net.Addr\n\tClose()\n\tDestroy()\n\tUserData() interface{}\n\tSetUserData(data interface{})\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/gate/gate.go",
    "content": "package gate\n\nimport (\n\t\"github.com/dolotech/leaf/chanrpc\"\n\t\"github.com/golang/glog\"\n\t\"github.com/dolotech/leaf/network\"\n\t\"net\"\n\t\"reflect\"\n\t\"time\"\n)\n\ntype Gate struct {\n\tMaxConnNum      int\n\tPendingWriteNum int\n\tMaxMsgLen       uint32\n\tProcessor       network.Processor\n\tAgentChanRPC    *chanrpc.Server\n\n\t// websocket\n\tWSAddr      string\n\tHTTPTimeout time.Duration\n\tCertFile    string\n\tKeyFile     string\n\n\t// tcp\n\tTCPAddr      string\n\tLenMsgLen    int\n\tLittleEndian bool\n}\n\nfunc (gate *Gate) Run(closeSig chan bool) {\n\tvar wsServer *network.WSServer\n\tif gate.WSAddr != \"\" {\n\t\twsServer = new(network.WSServer)\n\t\twsServer.Addr = gate.WSAddr\n\t\twsServer.MaxConnNum = gate.MaxConnNum\n\t\twsServer.PendingWriteNum = gate.PendingWriteNum\n\t\twsServer.MaxMsgLen = gate.MaxMsgLen\n\t\twsServer.HTTPTimeout = gate.HTTPTimeout\n\t\twsServer.CertFile = gate.CertFile\n\t\twsServer.KeyFile = gate.KeyFile\n\t\twsServer.NewAgent = func(conn *network.WSConn) network.Agent {\n\t\t\ta := &agent{conn: conn, gate: gate}\n\t\t\tif gate.AgentChanRPC != nil {\n\t\t\t\tgate.AgentChanRPC.Go(\"NewAgent\", a)\n\t\t\t}\n\t\t\treturn a\n\t\t}\n\t}\n\n\tvar tcpServer *network.TCPServer\n\tif gate.TCPAddr != \"\" {\n\t\ttcpServer = new(network.TCPServer)\n\t\ttcpServer.Addr = gate.TCPAddr\n\t\ttcpServer.MaxConnNum = gate.MaxConnNum\n\t\ttcpServer.PendingWriteNum = gate.PendingWriteNum\n\t\ttcpServer.LenMsgLen = gate.LenMsgLen\n\t\ttcpServer.MaxMsgLen = gate.MaxMsgLen\n\t\ttcpServer.LittleEndian = gate.LittleEndian\n\t\ttcpServer.NewAgent = func(conn *network.TCPConn) network.Agent {\n\t\t\ta := &agent{conn: conn, gate: gate}\n\t\t\tif gate.AgentChanRPC != nil {\n\t\t\t\tgate.AgentChanRPC.Go(\"NewAgent\", a)\n\t\t\t}\n\t\t\treturn a\n\t\t}\n\t}\n\n\tif wsServer != nil {\n\t\twsServer.Start()\n\t}\n\tif tcpServer != nil {\n\t\ttcpServer.Start()\n\t}\n\t<-closeSig\n\tif wsServer != nil {\n\t\twsServer.Close()\n\t}\n\tif tcpServer != nil {\n\t\ttcpServer.Close()\n\t}\n}\n\nfunc (gate *Gate) OnDestroy() {}\n\ntype agent struct {\n\tconn     network.Conn\n\tgate     *Gate\n\tuserData interface{}\n}\n\nfunc (a *agent) Run() {\n\tfor {\n\t\tdata, err := a.conn.ReadMsg()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"read message: %v\", err)\n\t\t\tbreak\n\t\t}\n\n\t\tif a.gate.Processor != nil {\n\t\t\tmsg, err := a.gate.Processor.Unmarshal(data)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"unmarshal message error: %v\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\terr = a.gate.Processor.Route(msg, a)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"route message error: %v\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (a *agent) OnClose() {\n\tif a.gate.AgentChanRPC != nil {\n\t\terr := a.gate.AgentChanRPC.Call0(\"CloseAgent\", a)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"chanrpc error: %v\", err)\n\t\t}\n\t}\n}\n\nfunc (a *agent) WriteMsg(msg interface{}) {\n\tif a.gate.Processor != nil {\n\t\tdata, err := a.gate.Processor.Marshal(msg)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"marshal message %v error: %v\", reflect.TypeOf(msg), err)\n\t\t\treturn\n\t\t}\n\t\terr = a.conn.WriteMsg(data...)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"write message %v error: %v\", reflect.TypeOf(msg), err)\n\t\t}\n\t}\n}\n\nfunc (a *agent) LocalAddr() net.Addr {\n\treturn a.conn.LocalAddr()\n}\n\nfunc (a *agent) RemoteAddr() net.Addr {\n\treturn a.conn.RemoteAddr()\n}\n\nfunc (a *agent) Close() {\n\ta.conn.Close()\n}\n\nfunc (a *agent) Destroy() {\n\ta.conn.Destroy()\n}\n\nfunc (a *agent) UserData() interface{} {\n\treturn a.userData\n}\n\nfunc (a *agent) SetUserData(data interface{}) {\n\ta.userData = data\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/leaf.go",
    "content": "package leaf\n\nimport (\n\t\"github.com/golang/glog\"\n\t\"github.com/dolotech/leaf/module\"\n\t\"os\"\n\t\"os/signal\"\n)\n\nfunc Run(mods ...module.Module) {\n\n\tglog.Errorf(\"Leaf %v starting up\", version)\n\n\t// module\n\tfor i := 0; i < len(mods); i++ {\n\t\tmodule.Register(mods[i])\n\t}\n\tmodule.Init()\n\n\t// close\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt, os.Kill)\n\tsig := <-c\n\tglog.Errorf(\"Leaf closing down (signal: %v)\", sig)\n\tmodule.Destroy()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/module/go_test.go",
    "content": "package module\n\nimport (\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestSkeleton_Go(t *testing.T) {\n\n\ts := Skeleton{}\n\ts.Init()\n\tf := func() {\n\t\t<-time.After(time.Second)\n\t\tt.Log(\"ffff\")\n\t}\n\n\tch:= make(chan int)\n\tc := func() {\n\t\t<-time.After(time.Second)\n\t\tt.Log(\"ccc\")\n\n\t\tch <- 0\n\t}\n\n\ts.Go(f, c)\n\n\tt.Log(\"end\",<-ch)\n\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/module/module.go",
    "content": "package module\n\nimport (\n\t\"sync\"\n\t\"github.com/dolotech/lib/utils\"\n)\n\ntype Module interface {\n\tOnInit()\n\tOnDestroy()\n\tRun(closeSig chan bool)\n}\n\ntype module struct {\n\tmi       Module\n\tcloseSig chan bool\n\twg       sync.WaitGroup\n}\n\nvar mods []*module\n\nfunc Register(mi Module) {\n\tm := new(module)\n\tm.mi = mi\n\tm.closeSig = make(chan bool, 1)\n\n\tmods = append(mods, m)\n}\n\nfunc Init() {\n\tfor i := 0; i < len(mods); i++ {\n\t\tmods[i].mi.OnInit()\n\t}\n\n\tfor i := 0; i < len(mods); i++ {\n\t\tm := mods[i]\n\t\tm.wg.Add(1)\n\t\tgo run(m)\n\t}\n}\n\nfunc Destroy() {\n\tfor i := len(mods) - 1; i >= 0; i-- {\n\t\tm := mods[i]\n\t\tm.closeSig <- true\n\t\tm.wg.Wait()\n\t\tdestroy(m)\n\t}\n}\n\nfunc run(m *module) {\n\tdefer utils.PrintPanicStack()\n\tm.mi.Run(m.closeSig)\n\tm.wg.Done()\n}\n\nfunc destroy(m *module) {\n\tdefer utils.PrintPanicStack()\n\n\tm.mi.OnDestroy()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/module/skeleton.go",
    "content": "package module\n\nimport (\n\t\"github.com/dolotech/leaf/chanrpc\"\n\t\"github.com/dolotech/leaf/timer\"\n\t\"time\"\n\t\"github.com/dolotech/lib/grpool\"\n\t\"runtime\"\n)\n\ntype Skeleton struct {\n\tGoLen              int\n\tTimerDispatcherLen int\n\tAsynCallLen        int\n\tChanRPCServer      *chanrpc.Server\n\tdispatcher         *timer.Dispatcher\n\tclient             *chanrpc.Client\n\tserver             *chanrpc.Server\n\tcommandServer      *chanrpc.Server\n\n\tpool *grpool.Pool\n}\n\nfunc (s *Skeleton) Init() {\n\tif s.GoLen < runtime.NumCPU()*2 {\n\t\ts.GoLen = runtime.NumCPU() * 4\n\t}\n\n\ts.pool = grpool.NewPool(runtime.NumCPU()*2, s.GoLen)\n\tif s.TimerDispatcherLen <= 0 {\n\t\ts.TimerDispatcherLen = 0\n\t}\n\tif s.AsynCallLen <= 0 {\n\t\ts.AsynCallLen = 0\n\t}\n\n\ts.dispatcher = timer.NewDispatcher(s.TimerDispatcherLen)\n\ts.client = chanrpc.NewClient(s.AsynCallLen)\n\ts.server = s.ChanRPCServer\n\n\tif s.server == nil {\n\t\ts.server = chanrpc.NewServer(0)\n\t}\n\ts.commandServer = chanrpc.NewServer(0)\n}\n\nfunc (s *Skeleton) Run(closeSig chan bool) {\n\tfor {\n\t\tselect {\n\t\tcase <-closeSig:\n\t\t\ts.commandServer.Close()\n\t\t\ts.server.Close()\n\t\t\t//for !s.g.Idle() || !s.client.Idle() {\n\t\t\tfor !s.client.Idle() {\n\t\t\t\t//s.g.Close()\n\t\t\t\ts.client.Close()\n\t\t\t}\n\t\t\ts.pool.Release()\n\t\t\treturn\n\t\tcase ri := <-s.client.ChanAsynRet:\n\t\t\ts.client.Cb(ri)\n\t\tcase ci := <-s.server.ChanCall:\n\t\t\ts.server.Exec(ci)\n\t\tcase ci := <-s.commandServer.ChanCall:\n\t\t\ts.commandServer.Exec(ci)\n\t\t\t/*case cb := <-s.g.ChanCb:\n\t\t\t\ts.g.Cb(cb)*/\n\t\tcase t := <-s.dispatcher.ChanTimer:\n\t\t\tt.Cb()\n\t\t}\n\t}\n}\n\nfunc (s *Skeleton) AfterFunc(d time.Duration, cb func()) *timer.Timer {\n\tif s.TimerDispatcherLen == 0 {\n\t\tpanic(\"invalid TimerDispatcherLen\")\n\t}\n\n\treturn s.dispatcher.AfterFunc(d, cb)\n}\n\nfunc (s *Skeleton) CronFunc(cronExpr *timer.CronExpr, cb func()) *timer.Cron {\n\tif s.TimerDispatcherLen == 0 {\n\t\tpanic(\"invalid TimerDispatcherLen\")\n\t}\n\n\treturn s.dispatcher.CronFunc(cronExpr, cb)\n}\n\n/*func (s *Skeleton) Go(f func(), cb func()) {\n\ts.pool.JobQueue <- func() {\n\t\tdefer func() {\n\t\t\tif nil != cb {\n\t\t\t\ts.pool.JobQueue <- cb\n\t\t\t}\n\t\t\tif r := recover(); r != nil {\n\t\t\t\tif conf.LenStackBuf > 0 {\n\t\t\t\t\tbuf := make([]byte, conf.LenStackBuf)\n\t\t\t\t\tl := runtime.Stack(buf, false)\n\t\t\t\t\tglog.Errorf(\"%v: %s\", r, buf[:l])\n\t\t\t\t} else {\n\t\t\t\t\tglog.Errorf(\"%v\", r)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tf()\n\t}\n}*/\n\nfunc (s *Skeleton) AsynCall(server *chanrpc.Server, id interface{}, args ...interface{}) {\n\tif s.AsynCallLen == 0 {\n\t\tpanic(\"invalid AsynCallLen\")\n\t}\n\n\ts.client.Attach(server)\n\ts.client.AsynCall(id, args...)\n}\n\nfunc (s *Skeleton) RegisterChanRPC(id interface{}, f interface{}) {\n\tif s.ChanRPCServer == nil {\n\t\tpanic(\"invalid ChanRPCServer\")\n\t}\n\n\ts.server.Register(id, f)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/agent.go",
    "content": "package network\n\ntype Agent interface {\n\tRun()\n\tOnClose()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/conn.go",
    "content": "package network\n\nimport (\n\t\"net\"\n)\n\ntype Conn interface {\n\tReadMsg() ([]byte, error)\n\tWriteMsg(args ...[]byte) error\n\tLocalAddr() net.Addr\n\tRemoteAddr() net.Addr\n\tClose()\n\tDestroy()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/json/json.go",
    "content": "package json\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/dolotech/leaf/chanrpc\"\n\t\"github.com/golang/glog\"\n\t\"reflect\"\n)\n\ntype Processor struct {\n\tmsgInfo map[string]*MsgInfo\n}\n\ntype MsgInfo struct {\n\tmsgType       reflect.Type\n\tmsgRouter     *chanrpc.Server\n\tmsgHandler    *reflect.Value\n\tmsgRawHandler MsgHandler\n}\n\ntype MsgHandler func([]interface{})\n\ntype MsgRaw struct {\n\tmsgID      string\n\tmsgRawData json.RawMessage\n}\n\nfunc NewProcessor() *Processor {\n\tp := new(Processor)\n\tp.msgInfo = make(map[string]*MsgInfo)\n\treturn p\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) Register(msg interface{}) string {\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\tglog.Fatal(\"json message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\tif msgID == \"\" {\n\t\tglog.Fatal(\"unnamed json message\")\n\t}\n\tif _, ok := p.msgInfo[msgID]; ok {\n\t\tglog.Fatal(\"message %v is already registered\", msgID)\n\t}\n\n\ti := new(MsgInfo)\n\ti.msgType = msgType\n\tp.msgInfo[msgID] = i\n\treturn msgID\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetRouter(msg interface{}, msgRouter *chanrpc.Server) {\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\tglog.Fatal(\"json message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\ti, ok := p.msgInfo[msgID]\n\tif !ok {\n\t\tglog.Fatal(\"message %v not registered\", msgID)\n\t}\n\n\ti.msgRouter = msgRouter\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetHandler(msg interface{}, msgHandler interface{}) {\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\tglog.Fatal(\"json message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\ti, ok := p.msgInfo[msgID]\n\tif !ok {\n\t\tglog.Fatal(\"message %v not registered\", msgID)\n\t}\n\n\tv:=reflect.ValueOf(msgHandler)\n\ti.msgHandler = &v\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetRawHandler(msgID string, msgRawHandler MsgHandler) {\n\ti, ok := p.msgInfo[msgID]\n\tif !ok {\n\t\tglog.Fatal(\"message %v not registered\", msgID)\n\t}\n\n\ti.msgRawHandler = msgRawHandler\n}\n\n// goroutine safe\nfunc (p *Processor) Route(msg, userData interface{}) error {\n\t// raw\n\tif msgRaw, ok := msg.(MsgRaw); ok {\n\t\ti, ok := p.msgInfo[msgRaw.msgID]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"message %v not registered\", msgRaw.msgID)\n\t\t}\n\t\tif i.msgRawHandler != nil {\n\t\t\ti.msgRawHandler([]interface{}{msgRaw.msgID, msgRaw.msgRawData, userData})\n\t\t}\n\t\tglog.Infoln(msg)\n\t\treturn nil\n\t}\n\t// json\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"json message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\ti, ok := p.msgInfo[msgID]\n\n\tif !ok {\n\t\treturn fmt.Errorf(\"message %v not registered\", msgID)\n\t}\n\tif i.msgHandler != nil {\n\t\ti.msgHandler.Call([]reflect.Value{reflect.ValueOf(msg), reflect.ValueOf(userData)})\n\t}\n\tif i.msgRouter != nil {\n\t\ti.msgRouter.Go(msgType, msg, userData)\n\t}\n\n\treturn nil\n}\n\n// goroutine safe\nfunc (p *Processor) Unmarshal(data []byte) (interface{}, error) {\n\t if len(data) == 0 {\n\t\t return nil, errors.New(\"json data len == 0\")\n\t}\n\n\tvar m map[string]json.RawMessage\n\terr := json.Unmarshal(data, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(m) != 1 {\n\t\treturn nil, errors.New(\"invalid json data\")\n\t}\n\n\tfor msgID, data := range m {\n\t\ti, ok := p.msgInfo[msgID]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"message %v not registered\", msgID)\n\t\t}\n\n\t\t// msg\n\t\tif i.msgRawHandler != nil {\n\t\t\treturn MsgRaw{msgID, data}, nil\n\t\t} else {\n\t\t\tmsg := reflect.New(i.msgType.Elem()).Interface()\n\t\t\treturn msg, json.Unmarshal(data, msg)\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"invalid json data\")\n}\n\n// goroutine safe\nfunc (p *Processor) Marshal(msg interface{}) ([][]byte, error) {\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\treturn nil, errors.New(\"json message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\tif _, ok := p.msgInfo[msgID]; !ok {\n\t\treturn nil, fmt.Errorf(\"message %v not registered\", msgID)\n\t}\n\n\t// data\n\tm := map[string]interface{}{msgID: msg}\n\tdata, err := json.Marshal(m)\n\treturn [][]byte{data}, err\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/processor.go",
    "content": "package network\n\ntype Processor interface {\n\t// must goroutine safe\n\tRoute(msg , userData interface{}) error\n\t// must goroutine safe\n\tUnmarshal(data []byte) (interface{}, error)\n\t// must goroutine safe\n\tMarshal(msg interface{}) ([][]byte, error)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/protobuf/protobuf.go",
    "content": "package protobuf\n\nimport (\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/dolotech/leaf/chanrpc\"\n\t\"github.com/golang/glog\"\n\t\"math\"\n\t\"reflect\"\n)\n\n// -------------------------\n// | id | protobuf message |\n// -------------------------\ntype Processor struct {\n\tlittleEndian bool\n\tmsgInfo      []*MsgInfo\n\tmsgID        map[reflect.Type]uint16\n}\n\ntype MsgInfo struct {\n\tmsgType       reflect.Type\n\tmsgRouter     *chanrpc.Server\n\tmsgHandler    *reflect.Value\n\tmsgRawHandler MsgHandler\n}\n\ntype MsgHandler func([]interface{})\n\ntype MsgRaw struct {\n\tmsgID      uint16\n\tmsgRawData []byte\n}\n\nfunc NewProcessor() *Processor {\n\tp := new(Processor)\n\tp.littleEndian = false\n\tp.msgID = make(map[reflect.Type]uint16)\n\treturn p\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetByteOrder(littleEndian bool) {\n\tp.littleEndian = littleEndian\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) Register(msg interface{}) uint16 {\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\tglog.Fatal(\"protobuf message pointer required\")\n\t}\n\tif _, ok := p.msgID[msgType]; ok {\n\t\tglog.Fatal(\"message %s is already registered\", msgType)\n\t}\n\tif len(p.msgInfo) >= math.MaxUint16 {\n\t\tglog.Fatal(\"too many protobuf messages (max = %v)\", math.MaxUint16)\n\t}\n\n\ti := new(MsgInfo)\n\ti.msgType = msgType\n\tp.msgInfo = append(p.msgInfo, i)\n\tid := uint16(len(p.msgInfo) - 1)\n\tp.msgID[msgType] = id\n\treturn id\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetRouter(msg  interface{}, msgRouter *chanrpc.Server) {\n\tmsgType := reflect.TypeOf(msg)\n\tid, ok := p.msgID[msgType]\n\tif !ok {\n\t\tglog.Fatal(\"message %s not registered\", msgType)\n\t}\n\n\tp.msgInfo[id].msgRouter = msgRouter\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetHandler(msg , msgHandler interface{}) {\n\tmsgType := reflect.TypeOf(msg)\n\tid, ok := p.msgID[msgType]\n\tif !ok {\n\t\tglog.Fatal(\"message %s not registered\", msgType)\n\t}\n\tv:=reflect.ValueOf(msgHandler)\n\tp.msgInfo[id].msgHandler = &v\n}\n\n// It's dangerous to call the method on routing or marshaling (unmarshaling)\nfunc (p *Processor) SetRawHandler(id uint16, msgRawHandler MsgHandler) {\n\tif id >= uint16(len(p.msgInfo)) {\n\t\tglog.Fatal(\"message id %v not registered\", id)\n\t}\n\n\tp.msgInfo[id].msgRawHandler = msgRawHandler\n}\n\n// goroutine safe\nfunc (p *Processor) Route(msg , userData interface{}) error {\n\t// raw\n\tif msgRaw, ok := msg.(MsgRaw); ok {\n\t\tif msgRaw.msgID >= uint16(len(p.msgInfo)) {\n\t\t\treturn fmt.Errorf(\"message id %v not registered\", msgRaw.msgID)\n\t\t}\n\t\ti := p.msgInfo[msgRaw.msgID]\n\t\tif i.msgRawHandler != nil {\n\t\t\ti.msgRawHandler([]interface{}{msgRaw.msgID, msgRaw.msgRawData, userData})\n\t\t}\n\t\treturn nil\n\t}\n\n\t// protobuf\n\tmsgType := reflect.TypeOf(msg)\n\tid, ok := p.msgID[msgType]\n\tif !ok {\n\t\treturn fmt.Errorf(\"message %s not registered\", msgType)\n\t}\n\ti := p.msgInfo[id]\n\tif i.msgHandler != nil {\n\t\t//i.msgHandler([]interface{}{msg, userData})\n\t\ti.msgHandler.Call([]reflect.Value{reflect.ValueOf(msg), reflect.ValueOf(userData)})\n\t}\n\tif i.msgRouter != nil {\n\t\ti.msgRouter.Go(msgType, msg, userData)\n\t}\n\treturn nil\n}\n\n// goroutine safe\nfunc (p *Processor) Unmarshal(data []byte) (interface{}, error) {\n\tif len(data) < 2 {\n\t\treturn nil, errors.New(\"protobuf data too short\")\n\t}\n\n\t// id\n\tvar id uint16\n\tif p.littleEndian {\n\t\tid = binary.LittleEndian.Uint16(data)\n\t} else {\n\t\tid = binary.BigEndian.Uint16(data)\n\t}\n\tif id >= uint16(len(p.msgInfo)) {\n\t\treturn nil, fmt.Errorf(\"message id %v not registered\", id)\n\t}\n\n\t// msg\n\ti := p.msgInfo[id]\n\tif i.msgRawHandler != nil {\n\t\treturn MsgRaw{id, data[2:]}, nil\n\t} else {\n\t\tmsg := reflect.New(i.msgType.Elem()).Interface()\n\t\treturn msg, proto.UnmarshalMerge(data[2:], msg.(proto.Message))\n\t}\n}\n\n// goroutine safe\nfunc (p *Processor) Marshal(msg interface{}) ([][]byte, error) {\n\tmsgType := reflect.TypeOf(msg)\n\n\t// id\n\t_id, ok := p.msgID[msgType]\n\tif !ok {\n\t\terr := fmt.Errorf(\"message %s not registered\", msgType)\n\t\treturn nil, err\n\t}\n\n\tid := make([]byte, 2)\n\tif p.littleEndian {\n\t\tbinary.LittleEndian.PutUint16(id, _id)\n\t} else {\n\t\tbinary.BigEndian.PutUint16(id, _id)\n\t}\n\n\t// data\n\tdata, err := proto.Marshal(msg.(proto.Message))\n\treturn [][]byte{id, data}, err\n}\n\n// goroutine safe\nfunc (p *Processor) Range(f func(id uint16, t reflect.Type)) {\n\tfor id, i := range p.msgInfo {\n\t\tf(uint16(id), i.msgType)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/tcp_client.go",
    "content": "package network\n\nimport (\n\t\"github.com/golang/glog\"\n\t\"net\"\n\t\"sync\"\n\t\"time\"\n)\n\ntype TCPClient struct {\n\tsync.Mutex\n\tAddr            string\n\tConnNum         int\n\tConnectInterval time.Duration\n\tPendingWriteNum int\n\tAutoReconnect   bool\n\tNewAgent        func(*TCPConn) Agent\n\tconns           ConnSet\n\twg              sync.WaitGroup\n\tcloseFlag       bool\n\n\t// msg parser\n\tLenMsgLen    int\n\tMinMsgLen    uint32\n\tMaxMsgLen    uint32\n\tLittleEndian bool\n\tmsgParser    *MsgParser\n}\n\nfunc (client *TCPClient) Start() {\n\tclient.init()\n\n\tfor i := 0; i < client.ConnNum; i++ {\n\t\tclient.wg.Add(1)\n\t\tgo client.connect()\n\t}\n}\n\nfunc (client *TCPClient) init() {\n\tclient.Lock()\n\tdefer client.Unlock()\n\n\tif client.ConnNum <= 0 {\n\t\tclient.ConnNum = 1\n\t\tglog.Errorf(\"invalid ConnNum, reset to %v\", client.ConnNum)\n\t}\n\tif client.ConnectInterval <= 0 {\n\t\tclient.ConnectInterval = 3 * time.Second\n\t\tglog.Errorf(\"invalid ConnectInterval, reset to %v\", client.ConnectInterval)\n\t}\n\tif client.PendingWriteNum <= 0 {\n\t\tclient.PendingWriteNum = 100\n\t\tglog.Errorf(\"invalid PendingWriteNum, reset to %v\", client.PendingWriteNum)\n\t}\n\tif client.NewAgent == nil {\n\t\tglog.Fatal(\"NewAgent must not be nil\")\n\t}\n\tif client.conns != nil {\n\t\tglog.Fatal(\"client is running\")\n\t}\n\n\tclient.conns = make(ConnSet)\n\tclient.closeFlag = false\n\n\t// msg parser\n\tmsgParser := NewMsgParser()\n\tmsgParser.SetMsgLen(client.LenMsgLen, client.MinMsgLen, client.MaxMsgLen)\n\tmsgParser.SetByteOrder(client.LittleEndian)\n\tclient.msgParser = msgParser\n}\n\nfunc (client *TCPClient) dial() net.Conn {\n\tfor {\n\t\tconn, err := net.Dial(\"tcp\", client.Addr)\n\t\tif err == nil || client.closeFlag {\n\t\t\treturn conn\n\t\t}\n\n\t\tglog.Errorf(\"connect to %v error: %v\", client.Addr, err)\n\t\ttime.Sleep(client.ConnectInterval)\n\t\tcontinue\n\t}\n}\n\nfunc (client *TCPClient) connect() {\n\tdefer client.wg.Done()\n\nreconnect:\n\tconn := client.dial()\n\tif conn == nil {\n\t\treturn\n\t}\n\n\tclient.Lock()\n\tif client.closeFlag {\n\t\tclient.Unlock()\n\t\tconn.Close()\n\t\treturn\n\t}\n\tclient.conns[conn] = struct{}{}\n\tclient.Unlock()\n\n\ttcpConn := newTCPConn(conn, client.PendingWriteNum, client.msgParser)\n\tagent := client.NewAgent(tcpConn)\n\tagent.Run()\n\n\t// cleanup\n\ttcpConn.Close()\n\tclient.Lock()\n\tdelete(client.conns, conn)\n\tclient.Unlock()\n\tagent.OnClose()\n\n\tif client.AutoReconnect {\n\t\ttime.Sleep(client.ConnectInterval)\n\t\tgoto reconnect\n\t}\n}\n\nfunc (client *TCPClient) Close() {\n\tclient.Lock()\n\tclient.closeFlag = true\n\tfor conn := range client.conns {\n\t\tconn.Close()\n\t}\n\tclient.conns = nil\n\tclient.Unlock()\n\n\tclient.wg.Wait()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/tcp_conn.go",
    "content": "package network\n\nimport (\n\t\"github.com/golang/glog\"\n\t\"net\"\n\t\"sync\"\n)\n\ntype ConnSet map[net.Conn]struct{}\n\ntype TCPConn struct {\n\tsync.Mutex\n\tconn      net.Conn\n\twriteChan chan []byte\n\tcloseFlag bool\n\tmsgParser *MsgParser\n}\n\nfunc newTCPConn(conn net.Conn, pendingWriteNum int, msgParser *MsgParser) *TCPConn {\n\ttcpConn := new(TCPConn)\n\ttcpConn.conn = conn\n\ttcpConn.writeChan = make(chan []byte, pendingWriteNum)\n\ttcpConn.msgParser = msgParser\n\n\tgo func() {\n\t\tfor b := range tcpConn.writeChan {\n\t\t\tif b == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t_, err := conn.Write(b)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tconn.Close()\n\t\ttcpConn.Lock()\n\t\ttcpConn.closeFlag = true\n\t\ttcpConn.Unlock()\n\t}()\n\n\treturn tcpConn\n}\n\nfunc (tcpConn *TCPConn) doDestroy() {\n\ttcpConn.conn.(*net.TCPConn).SetLinger(0)\n\ttcpConn.conn.Close()\n\n\tif !tcpConn.closeFlag {\n\t\tclose(tcpConn.writeChan)\n\t\ttcpConn.closeFlag = true\n\t}\n}\n\nfunc (tcpConn *TCPConn) Destroy() {\n\ttcpConn.Lock()\n\tdefer tcpConn.Unlock()\n\n\ttcpConn.doDestroy()\n}\n\nfunc (tcpConn *TCPConn) Close() {\n\ttcpConn.Lock()\n\tdefer tcpConn.Unlock()\n\tif tcpConn.closeFlag {\n\t\treturn\n\t}\n\n\ttcpConn.doWrite(nil)\n\ttcpConn.closeFlag = true\n}\n\nfunc (tcpConn *TCPConn) doWrite(b []byte) {\n\tif len(tcpConn.writeChan) == cap(tcpConn.writeChan) {\n\t\tglog.Error(\"close conn: channel full\")\n\t\ttcpConn.doDestroy()\n\t\treturn\n\t}\n\n\ttcpConn.writeChan <- b\n}\n\n// b must not be modified by the others goroutines\nfunc (tcpConn *TCPConn) Write(b []byte) {\n\ttcpConn.Lock()\n\tdefer tcpConn.Unlock()\n\tif tcpConn.closeFlag || b == nil {\n\t\treturn\n\t}\n\n\ttcpConn.doWrite(b)\n}\n\nfunc (tcpConn *TCPConn) Read(b []byte) (int, error) {\n\treturn tcpConn.conn.Read(b)\n}\n\nfunc (tcpConn *TCPConn) LocalAddr() net.Addr {\n\treturn tcpConn.conn.LocalAddr()\n}\n\nfunc (tcpConn *TCPConn) RemoteAddr() net.Addr {\n\treturn tcpConn.conn.RemoteAddr()\n}\n\nfunc (tcpConn *TCPConn) ReadMsg() ([]byte, error) {\n\treturn tcpConn.msgParser.Read(tcpConn)\n}\n\nfunc (tcpConn *TCPConn) WriteMsg(args ...[]byte) error {\n\treturn tcpConn.msgParser.Write(tcpConn, args...)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/tcp_msg.go",
    "content": "package network\n\nimport (\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"io\"\n\t\"math\"\n)\n\n// --------------\n// | len | data |\n// --------------\ntype MsgParser struct {\n\tlenMsgLen    int\n\tminMsgLen    uint32\n\tmaxMsgLen    uint32\n\tlittleEndian bool\n}\n\nfunc NewMsgParser() *MsgParser {\n\tp := new(MsgParser)\n\tp.lenMsgLen = 2\n\tp.minMsgLen = 1\n\tp.maxMsgLen = 4096\n\tp.littleEndian = false\n\n\treturn p\n}\n\n// It's dangerous to call the method on reading or writing\nfunc (p *MsgParser) SetMsgLen(lenMsgLen int, minMsgLen uint32, maxMsgLen uint32) {\n\tif lenMsgLen == 1 || lenMsgLen == 2 || lenMsgLen == 4 {\n\t\tp.lenMsgLen = lenMsgLen\n\t}\n\tif minMsgLen != 0 {\n\t\tp.minMsgLen = minMsgLen\n\t}\n\tif maxMsgLen != 0 {\n\t\tp.maxMsgLen = maxMsgLen\n\t}\n\n\tvar max uint32\n\tswitch p.lenMsgLen {\n\tcase 1:\n\t\tmax = math.MaxUint8\n\tcase 2:\n\t\tmax = math.MaxUint16\n\tcase 4:\n\t\tmax = math.MaxUint32\n\t}\n\tif p.minMsgLen > max {\n\t\tp.minMsgLen = max\n\t}\n\tif p.maxMsgLen > max {\n\t\tp.maxMsgLen = max\n\t}\n}\n\n// It's dangerous to call the method on reading or writing\nfunc (p *MsgParser) SetByteOrder(littleEndian bool) {\n\tp.littleEndian = littleEndian\n}\n\n// goroutine safe\nfunc (p *MsgParser) Read(conn *TCPConn) ([]byte, error) {\n\tvar b [4]byte\n\tbufMsgLen := b[:p.lenMsgLen]\n\n\t// read len\n\tif _, err := io.ReadFull(conn, bufMsgLen); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// parse len\n\tvar msgLen uint32\n\tswitch p.lenMsgLen {\n\tcase 1:\n\t\tmsgLen = uint32(bufMsgLen[0])\n\tcase 2:\n\t\tif p.littleEndian {\n\t\t\tmsgLen = uint32(binary.LittleEndian.Uint16(bufMsgLen))\n\t\t} else {\n\t\t\tmsgLen = uint32(binary.BigEndian.Uint16(bufMsgLen))\n\t\t}\n\tcase 4:\n\t\tif p.littleEndian {\n\t\t\tmsgLen = binary.LittleEndian.Uint32(bufMsgLen)\n\t\t} else {\n\t\t\tmsgLen = binary.BigEndian.Uint32(bufMsgLen)\n\t\t}\n\t}\n\n\t// check len\n\tif msgLen > p.maxMsgLen {\n\t\treturn nil, errors.New(\"message too long\")\n\t} else if msgLen < p.minMsgLen {\n\t\treturn nil, errors.New(\"message too short\")\n\t}\n\n\t// data\n\tmsgData := make([]byte, msgLen)\n\tif _, err := io.ReadFull(conn, msgData); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn msgData, nil\n}\n\n// goroutine safe\nfunc (p *MsgParser) Write(conn *TCPConn, args ...[]byte) error {\n\t// get len\n\tvar msgLen uint32\n\tfor i := 0; i < len(args); i++ {\n\t\tmsgLen += uint32(len(args[i]))\n\t}\n\n\t// check len\n\tif msgLen > p.maxMsgLen {\n\t\treturn errors.New(\"message too long\")\n\t} else if msgLen < p.minMsgLen {\n\t\treturn errors.New(\"message too short\")\n\t}\n\n\tmsg := make([]byte, uint32(p.lenMsgLen)+msgLen)\n\n\t// write len\n\tswitch p.lenMsgLen {\n\tcase 1:\n\t\tmsg[0] = byte(msgLen)\n\tcase 2:\n\t\tif p.littleEndian {\n\t\t\tbinary.LittleEndian.PutUint16(msg, uint16(msgLen))\n\t\t} else {\n\t\t\tbinary.BigEndian.PutUint16(msg, uint16(msgLen))\n\t\t}\n\tcase 4:\n\t\tif p.littleEndian {\n\t\t\tbinary.LittleEndian.PutUint32(msg, msgLen)\n\t\t} else {\n\t\t\tbinary.BigEndian.PutUint32(msg, msgLen)\n\t\t}\n\t}\n\n\t// write data\n\tl := p.lenMsgLen\n\tfor i := 0; i < len(args); i++ {\n\t\tcopy(msg[l:], args[i])\n\t\tl += len(args[i])\n\t}\n\n\tconn.Write(msg)\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/tcp_server.go",
    "content": "package network\n\nimport (\n\t\"github.com/golang/glog\"\n\t\"net\"\n\t\"sync\"\n\t\"time\"\n)\n\ntype TCPServer struct {\n\tAddr            string\n\tMaxConnNum      int\n\tPendingWriteNum int\n\tNewAgent        func(*TCPConn) Agent\n\tln              net.Listener\n\tconns           ConnSet\n\tmutexConns      sync.Mutex\n\twgLn            sync.WaitGroup\n\twgConns         sync.WaitGroup\n\n\t// msg parser\n\tLenMsgLen    int\n\tMinMsgLen    uint32\n\tMaxMsgLen    uint32\n\tLittleEndian bool\n\tmsgParser    *MsgParser\n}\n\nfunc (server *TCPServer) Start() {\n\tserver.init()\n\tgo server.run()\n}\n\nfunc (server *TCPServer) init() {\n\tln, err := net.Listen(\"tcp\", server.Addr)\n\tif err != nil {\n\t\tglog.Fatal(\"%v\", err)\n\t}\n\n\tif server.MaxConnNum <= 0 {\n\t\tserver.MaxConnNum = 100\n\t\tglog.Errorf(\"invalid MaxConnNum, reset to %v\", server.MaxConnNum)\n\t}\n\tif server.PendingWriteNum <= 0 {\n\t\tserver.PendingWriteNum = 100\n\t\tglog.Errorf(\"invalid PendingWriteNum, reset to %v\", server.PendingWriteNum)\n\t}\n\tif server.NewAgent == nil {\n\t\tglog.Fatal(\"NewAgent must not be nil\")\n\t}\n\n\tserver.ln = ln\n\tserver.conns = make(ConnSet)\n\n\t// msg parser\n\tmsgParser := NewMsgParser()\n\tmsgParser.SetMsgLen(server.LenMsgLen, server.MinMsgLen, server.MaxMsgLen)\n\tmsgParser.SetByteOrder(server.LittleEndian)\n\tserver.msgParser = msgParser\n}\n\nfunc (server *TCPServer) run() {\n\tserver.wgLn.Add(1)\n\tdefer server.wgLn.Done()\n\n\tvar tempDelay time.Duration\n\tfor {\n\t\tconn, err := server.ln.Accept()\n\t\tif err != nil {\n\t\t\tif ne, ok := err.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\tglog.Errorf(\"accept error: %v; retrying in %v\", err, tempDelay)\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\ttempDelay = 0\n\n\t\tserver.mutexConns.Lock()\n\t\tif len(server.conns) >= server.MaxConnNum {\n\t\t\tserver.mutexConns.Unlock()\n\t\t\tconn.Close()\n\t\t\tglog.Errorf(\"too many connections\")\n\t\t\tcontinue\n\t\t}\n\t\tserver.conns[conn] = struct{}{}\n\t\tserver.mutexConns.Unlock()\n\n\t\tserver.wgConns.Add(1)\n\n\t\ttcpConn := newTCPConn(conn, server.PendingWriteNum, server.msgParser)\n\t\tagent := server.NewAgent(tcpConn)\n\t\tgo func() {\n\t\t\tagent.Run()\n\n\t\t\t// cleanup\n\t\t\ttcpConn.Close()\n\t\t\tserver.mutexConns.Lock()\n\t\t\tdelete(server.conns, conn)\n\t\t\tserver.mutexConns.Unlock()\n\t\t\tagent.OnClose()\n\n\t\t\tserver.wgConns.Done()\n\t\t}()\n\t}\n}\n\nfunc (server *TCPServer) Close() {\n\tserver.ln.Close()\n\tserver.wgLn.Wait()\n\n\tserver.mutexConns.Lock()\n\tfor conn := range server.conns {\n\t\tconn.Close()\n\t}\n\tserver.conns = nil\n\tserver.mutexConns.Unlock()\n\tserver.wgConns.Wait()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/ws_client.go",
    "content": "package network\n\nimport (\n\t\"github.com/gorilla/websocket\"\n\t\"github.com/golang/glog\"\n\t\"sync\"\n\t\"time\"\n)\n\ntype WSClient struct {\n\tsync.Mutex\n\tAddr             string\n\tConnNum          int\n\tConnectInterval  time.Duration\n\tPendingWriteNum  int\n\tMaxMsgLen        uint32\n\tHandshakeTimeout time.Duration\n\tAutoReconnect    bool\n\tNewAgent         func(*WSConn) Agent\n\tdialer           websocket.Dialer\n\tconns            WebsocketConnSet\n\twg               sync.WaitGroup\n\tcloseFlag        bool\n}\n\nfunc (client *WSClient) Start() {\n\tclient.init()\n\n\tfor i := 0; i < client.ConnNum; i++ {\n\t\tclient.wg.Add(1)\n\t\tgo client.connect()\n\t}\n}\n\nfunc (client *WSClient) init() {\n\tclient.Lock()\n\tdefer client.Unlock()\n\n\tif client.ConnNum <= 0 {\n\t\tclient.ConnNum = 1\n\t\tglog.Errorf(\"invalid ConnNum, reset to %v\", client.ConnNum)\n\t}\n\tif client.ConnectInterval <= 0 {\n\t\tclient.ConnectInterval = 3 * time.Second\n\t\tglog.Errorf(\"invalid ConnectInterval, reset to %v\", client.ConnectInterval)\n\t}\n\tif client.PendingWriteNum <= 0 {\n\t\tclient.PendingWriteNum = 100\n\t\tglog.Errorf(\"invalid PendingWriteNum, reset to %v\", client.PendingWriteNum)\n\t}\n\tif client.MaxMsgLen <= 0 {\n\t\tclient.MaxMsgLen = 4096\n\t\tglog.Errorf(\"invalid MaxMsgLen, reset to %v\", client.MaxMsgLen)\n\t}\n\tif client.HandshakeTimeout <= 0 {\n\t\tclient.HandshakeTimeout = 10 * time.Second\n\t\tglog.Errorf(\"invalid HandshakeTimeout, reset to %v\", client.HandshakeTimeout)\n\t}\n\tif client.NewAgent == nil {\n\t\tglog.Fatal(\"NewAgent must not be nil\")\n\t}\n\tif client.conns != nil {\n\t\tglog.Fatal(\"client is running\")\n\t}\n\n\tclient.conns = make(WebsocketConnSet)\n\tclient.closeFlag = false\n\tclient.dialer = websocket.Dialer{\n\t\tHandshakeTimeout: client.HandshakeTimeout,\n\t}\n}\n\nfunc (client *WSClient) dial() *websocket.Conn {\n\tfor {\n\t\tconn, _, err := client.dialer.Dial(client.Addr, nil)\n\t\tif err == nil || client.closeFlag {\n\t\t\treturn conn\n\t\t}\n\n\t\tglog.Errorf(\"connect to %v error: %v\", client.Addr, err)\n\t\ttime.Sleep(client.ConnectInterval)\n\t\tcontinue\n\t}\n}\n\nfunc (client *WSClient) connect() {\n\tdefer client.wg.Done()\n\nreconnect:\n\tconn := client.dial()\n\tif conn == nil {\n\t\treturn\n\t}\n\tconn.SetReadLimit(int64(client.MaxMsgLen))\n\n\tclient.Lock()\n\tif client.closeFlag {\n\t\tclient.Unlock()\n\t\tconn.Close()\n\t\treturn\n\t}\n\tclient.conns[conn] = struct{}{}\n\tclient.Unlock()\n\n\twsConn := newWSConn(conn, client.PendingWriteNum, client.MaxMsgLen)\n\tagent := client.NewAgent(wsConn)\n\tagent.Run()\n\n\t// cleanup\n\twsConn.Close()\n\tclient.Lock()\n\tdelete(client.conns, conn)\n\tclient.Unlock()\n\tagent.OnClose()\n\n\tif client.AutoReconnect {\n\t\ttime.Sleep(client.ConnectInterval)\n\t\tgoto reconnect\n\t}\n}\n\nfunc (client *WSClient) Close() {\n\tclient.Lock()\n\tclient.closeFlag = true\n\tfor conn := range client.conns {\n\t\tconn.Close()\n\t}\n\tclient.conns = nil\n\tclient.Unlock()\n\n\tclient.wg.Wait()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/ws_conn.go",
    "content": "package network\n\nimport (\n\t\"errors\"\n\t\"github.com/gorilla/websocket\"\n\t\"github.com/golang/glog\"\n\t\"net\"\n\t\"sync\"\n)\n\ntype WebsocketConnSet map[*websocket.Conn]struct{}\n\ntype WSConn struct {\n\tsync.Mutex\n\tconn      *websocket.Conn\n\twriteChan chan []byte\n\tmaxMsgLen uint32\n\tcloseFlag bool\n}\n\nfunc newWSConn(conn *websocket.Conn, pendingWriteNum int, maxMsgLen uint32) *WSConn {\n\twsConn := new(WSConn)\n\twsConn.conn = conn\n\twsConn.writeChan = make(chan []byte, pendingWriteNum)\n\twsConn.maxMsgLen = maxMsgLen\n\n\tgo func() {\n\t\tfor b := range wsConn.writeChan {\n\t\t\tif b == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr := conn.WriteMessage(websocket.BinaryMessage, b)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tconn.Close()\n\t\twsConn.Lock()\n\t\twsConn.closeFlag = true\n\t\twsConn.Unlock()\n\t}()\n\n\treturn wsConn\n}\n\nfunc (wsConn *WSConn) doDestroy() {\n\twsConn.conn.UnderlyingConn().(*net.TCPConn).SetLinger(0)\n\twsConn.conn.Close()\n\n\tif !wsConn.closeFlag {\n\t\tclose(wsConn.writeChan)\n\t\twsConn.closeFlag = true\n\t}\n}\n\nfunc (wsConn *WSConn) Destroy() {\n\twsConn.Lock()\n\tdefer wsConn.Unlock()\n\n\twsConn.doDestroy()\n}\n\nfunc (wsConn *WSConn) Close() {\n\twsConn.Lock()\n\tdefer wsConn.Unlock()\n\tif wsConn.closeFlag {\n\t\treturn\n\t}\n\n\twsConn.doWrite(nil)\n\twsConn.closeFlag = true\n}\n\nfunc (wsConn *WSConn) doWrite(b []byte) {\n\tif len(wsConn.writeChan) == cap(wsConn.writeChan) {\n\t\tglog.Error(\"close conn: channel full\")\n\t\twsConn.doDestroy()\n\t\treturn\n\t}\n\n\twsConn.writeChan <- b\n}\n\nfunc (wsConn *WSConn) LocalAddr() net.Addr {\n\treturn wsConn.conn.LocalAddr()\n}\n\nfunc (wsConn *WSConn) RemoteAddr() net.Addr {\n\treturn wsConn.conn.RemoteAddr()\n}\n\n// goroutine not safe\nfunc (wsConn *WSConn) ReadMsg() ([]byte, error) {\n\t_, b, err := wsConn.conn.ReadMessage()\n\treturn b, err\n}\n\n// args must not be modified by the others goroutines\nfunc (wsConn *WSConn) WriteMsg(args ...[]byte) error {\n\twsConn.Lock()\n\tdefer wsConn.Unlock()\n\tif wsConn.closeFlag {\n\t\treturn nil\n\t}\n\n\t// get len\n\tvar msgLen uint32\n\tfor i := 0; i < len(args); i++ {\n\t\tmsgLen += uint32(len(args[i]))\n\t}\n\n\t// check len\n\tif msgLen > wsConn.maxMsgLen {\n\t\treturn errors.New(\"message too long\")\n\t} else if msgLen < 1 {\n\t\treturn errors.New(\"message too short\")\n\t}\n\n\t// don't copy\n\tif len(args) == 1 {\n\t\twsConn.doWrite(args[0])\n\t\treturn nil\n\t}\n\n\t// merge the args\n\tmsg := make([]byte, msgLen)\n\tl := 0\n\tfor i := 0; i < len(args); i++ {\n\t\tcopy(msg[l:], args[i])\n\t\tl += len(args[i])\n\t}\n\n\twsConn.doWrite(msg)\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/network/ws_server.go",
    "content": "package network\n\nimport (\n\t\"crypto/tls\"\n\t\"github.com/gorilla/websocket\"\n\t\"github.com/golang/glog\"\n\t\"net\"\n\t\"net/http\"\n\t\"sync\"\n\t\"time\"\n)\n\ntype WSServer struct {\n\tAddr            string\n\tMaxConnNum      int\n\tPendingWriteNum int\n\tMaxMsgLen       uint32\n\tHTTPTimeout     time.Duration\n\tCertFile        string\n\tKeyFile         string\n\tNewAgent        func(*WSConn) Agent\n\tln              net.Listener\n\thandler         *WSHandler\n}\n\ntype WSHandler struct {\n\tmaxConnNum      int\n\tpendingWriteNum int\n\tmaxMsgLen       uint32\n\tnewAgent        func(*WSConn) Agent\n\tupgrader        websocket.Upgrader\n\tconns           WebsocketConnSet\n\tmutexConns      sync.Mutex\n\twg              sync.WaitGroup\n}\n\nfunc (handler *WSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", 405)\n\t\treturn\n\t}\n\tconn, err := handler.upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tglog.Errorf(\"upgrade error: %v\", err)\n\t\treturn\n\t}\n\tconn.SetReadLimit(int64(handler.maxMsgLen))\n\n\thandler.wg.Add(1)\n\tdefer handler.wg.Done()\n\n\thandler.mutexConns.Lock()\n\tif handler.conns == nil {\n\t\thandler.mutexConns.Unlock()\n\t\tconn.Close()\n\t\treturn\n\t}\n\tif len(handler.conns) >= handler.maxConnNum {\n\t\thandler.mutexConns.Unlock()\n\t\tconn.Close()\n\t\tglog.Error(\"too many connections\")\n\t\treturn\n\t}\n\thandler.conns[conn] = struct{}{}\n\thandler.mutexConns.Unlock()\n\n\twsConn := newWSConn(conn, handler.pendingWriteNum, handler.maxMsgLen)\n\tagent := handler.newAgent(wsConn)\n\tagent.Run()\n\n\t// cleanup\n\twsConn.Close()\n\thandler.mutexConns.Lock()\n\tdelete(handler.conns, conn)\n\thandler.mutexConns.Unlock()\n\tagent.OnClose()\n}\n\nfunc (server *WSServer) Start() {\n\tln, err := net.Listen(\"tcp\", server.Addr)\n\tif err != nil {\n\t\tglog.Fatalf(\"%v\", err)\n\t}\n\n\tif server.MaxConnNum <= 0 {\n\t\tserver.MaxConnNum = 100\n\t\tglog.Errorf(\"invalid MaxConnNum, reset to %v\", server.MaxConnNum)\n\t}\n\tif server.PendingWriteNum <= 0 {\n\t\tserver.PendingWriteNum = 100\n\t\tglog.Errorf(\"invalid PendingWriteNum, reset to %v\", server.PendingWriteNum)\n\t}\n\tif server.MaxMsgLen <= 0 {\n\t\tserver.MaxMsgLen = 4096\n\t\tglog.Errorf(\"invalid MaxMsgLen, reset to %v\", server.MaxMsgLen)\n\t}\n\tif server.HTTPTimeout <= 0 {\n\t\tserver.HTTPTimeout = 10 * time.Second\n\t\tglog.Errorf(\"invalid HTTPTimeout, reset to %v\", server.HTTPTimeout)\n\t}\n\tif server.NewAgent == nil {\n\t\tglog.Fatal(\"NewAgent must not be nil\")\n\t}\n\n\tif server.CertFile != \"\" || server.KeyFile != \"\" {\n\t\tconfig := &tls.Config{}\n\t\tconfig.NextProtos = []string{\"http/1.1\"}\n\n\t\tvar err error\n\t\tconfig.Certificates = make([]tls.Certificate, 1)\n\t\tconfig.Certificates[0], err = tls.LoadX509KeyPair(server.CertFile, server.KeyFile)\n\t\tif err != nil {\n\t\t\tglog.Fatalf(\"%v\", err)\n\t\t}\n\n\t\tln = tls.NewListener(ln, config)\n\t}\n\n\tserver.ln = ln\n\tserver.handler = &WSHandler{\n\t\tmaxConnNum:      server.MaxConnNum,\n\t\tpendingWriteNum: server.PendingWriteNum,\n\t\tmaxMsgLen:       server.MaxMsgLen,\n\t\tnewAgent:        server.NewAgent,\n\t\tconns:           make(WebsocketConnSet),\n\t\tupgrader: websocket.Upgrader{\n\t\t\tHandshakeTimeout: server.HTTPTimeout,\n\t\t\tCheckOrigin:      func(_ *http.Request) bool { return true },\n\t\t},\n\t}\n\n\thttpServer := &http.Server{\n\t\tAddr:           server.Addr,\n\t\tHandler:        server.handler,\n\t\tReadTimeout:    server.HTTPTimeout,\n\t\tWriteTimeout:   server.HTTPTimeout,\n\t\tMaxHeaderBytes: 1024,\n\t}\n\n\tgo httpServer.Serve(ln)\n}\n\nfunc (server *WSServer) Close() {\n\tserver.ln.Close()\n\n\tserver.handler.mutexConns.Lock()\n\tfor conn := range server.handler.conns {\n\t\tconn.Close()\n\t}\n\tserver.handler.conns = nil\n\tserver.handler.mutexConns.Unlock()\n\n\tserver.handler.wg.Wait()\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/room/interface.go",
    "content": "package room\n\ntype IOccupant interface {\n\tGetRoom() IRoom\n\tWriteMsg(msg interface{})\n}\ntype ICreator interface {\n\tCreate(interface{}) IRoom\n}\ntype IRoom interface {\n\tCap() uint8\n\tLen() uint8\n\tGetNumber() string\n\tSetNumber(string)\n\tData() interface{}\n\tSetData(interface{})\n\tClose(room IRoom)\n\tClosed() chan struct{}\n\tSend(IOccupant, interface{}) error\n\tWriteMsg(interface{}, ...uint32)\n\tRegist(interface{}, interface{})\n\n\n\tInfo(args ...interface{})\n\tInfof(format string, args ...interface{})\n\tError(args ...interface{})\n\tErrorf(format string, args ...interface{})\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/room/msg_loop.go",
    "content": "package room\n\nimport (\n\t\"github.com/dolotech/lib/utils\"\n\t\"server/protocol\"\n\t\"errors\"\n\t\"github.com/dolotech/lib/route\"\n\t\"github.com/golang/glog\"\n\t\"github.com/davecgh/go-spew/spew\"\n)\n\ntype MsgLoop struct {\n\tclosedBroadcastChan chan struct{}\n\tcloseChan           chan IRoom\n\tmsgChan             chan *msgObj\n\troute.Route\n}\n\nfunc NewMsgLoop() *MsgLoop {\n\tm := &MsgLoop{\n\t\tcloseChan:           make(chan IRoom, 1),\n\t\tclosedBroadcastChan: make(chan struct{}),\n\t\tmsgChan:             make(chan *msgObj, 128),\n\t}\n\tgo m.msgLoop()\n\n\treturn m\n}\n\nfunc (r *MsgLoop) Closed() chan struct{} {\n\treturn r.closedBroadcastChan\n}\nfunc (r *MsgLoop) msgLoop() {\n\tdefer func() {\n\t\tif err := utils.PrintPanicStack(); err != nil {\n\t\t\tgo r.msgLoop()\n\t\t}\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase m := <-r.closeChan:\n\t\t\tclose(r.closedBroadcastChan)\n\t\t\tDelRoom(m.(IRoom))\n\t\t\treturn\n\t\tcase m := <-r.msgChan:\n\t\t\tr.Emit(m.msg, m.o)\n\t\t}\n\t}\n}\n\nfunc (r *MsgLoop) Close(m IRoom) {\n\tselect {\n\tcase r.closeChan <- m:\n\tdefault:\n\t}\n}\n\ntype msgObj struct {\n\tmsg interface{}\n\to   IOccupant\n}\n\nfunc (r *MsgLoop) Send(o IOccupant, m interface{}) error {\n\tselect {\n\tcase r.msgChan <- &msgObj{m, o}:\n\tdefault:\n\t\to.WriteMsg(protocol.MSG_ROOM_CLOSED)\n\t}\n\n\treturn errors.New(\"room closed\")\n}\n\ntype Log struct {\n\troom IRoom\n}\n\nfunc NewLog(room IRoom) *Log {\n\treturn &Log{room: room}\n}\n\nfunc (r *Log) Info(args ...interface{}) {\n\tglog.InfoDepth(1, r.parseLog(args)...)\n}\n\nfunc (r *Log) Infof(format string, args ...interface{}) {\n\tglog.InfofDepth(1, format, r.parseLog(args)...)\n}\n\nfunc (r *Log) Error(args ...interface{}) {\n\tglog.ErrorDepth(1, r.parseLog(args)...)\n}\nfunc (r *Log) Debug(args ...interface{}) {\n\tfor k, v := range args {\n\t\targs[k] = spew.Sdump(v)\n\t}\n\tglog.InfoDepth(1, r.parseLog(args)...)\n}\n\nfunc (r *Log) Debugf(format string, args ...interface{}) {\n\tfor k, v := range args {\n\t\targs[k] = spew.Sdump(v)\n\t}\n\tglog.InfofDepth(1, format, r.parseLog(args)...)\n}\nfunc (r *Log) Errorf(format string, args ...interface{}) {\n\tglog.ErrorfDepth(1, format, r.parseLog(args)...)\n}\n\nfunc (r *Log) parseLog(args ...interface{}) []interface{} {\n\tparam := make([]interface{}, len(args)+4)\n\tparam[0] = r.room.GetNumber()\n\tparam[1] = r.room.Cap()\n\tparam[2] = r.room.Len()\n\tparam[3] = r.room.Data()\n\tcopy(param[4:], args)\n\treturn param\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/room/room_list.go",
    "content": "package room\n\nimport (\n\t\"sync\"\n\t\"time\"\n\t\"strconv\"\n\t\"math/rand\"\n\t\"server/protocol\"\n\t\"github.com/dolotech/leaf/gate\"\n)\n\nfunc OnMessage(m interface{}, a gate.Agent) {\n\to := a.UserData().(IOccupant)\n\tif o.GetRoom() != nil {\n\t\to.GetRoom().Send(o, m)\n\t} else {\n\t\tif r := hand.Create(m); r == nil {\n\t\t\ta.WriteMsg(protocol.MSG_NOT_IN_ROOM)\n\t\t} else {\n\t\t\tSetRoom(r)\n\t\t\tr.Send(o, m)\n\t\t}\n\t}\n}\n\nvar rooms *roomlist\n\nvar hand ICreator\n\nfunc init() {\n\trooms = &roomlist{\n\t\tM: make(map[string]IRoom, 1000),\n\t}\n}\n\nfunc Init(h ICreator) {\n\thand = h\n}\n\ntype roomlist struct {\n\tM map[string]IRoom\n\tsync.RWMutex\n}\n\nfunc FindRoom() IRoom {\n\trooms.Lock()\n\tfor _, v := range rooms.M {\n\t\tif v.Len() < v.Cap() {\n\t\t\treturn v\n\t\t}\n\t}\n\trooms.Unlock()\n\treturn nil\n}\n\nfunc GetRoom(rid string) IRoom {\n\trooms.RLock()\n\tr := rooms.M[rid]\n\trooms.RUnlock()\n\treturn r\n}\n\nfunc SetRoom(room IRoom) string {\n\n\trooms.Lock()\n\tid := rooms.createNumber()\n\troom.SetNumber(id)\n\trooms.M[id] = room\n\trooms.Unlock()\n\treturn id\n}\nfunc DelRoom(room IRoom) {\n\trooms.Lock()\n\tdelete(rooms.M, room.GetNumber())\n\trooms.Unlock()\n}\n\nfunc (this *roomlist) createNumber() string {\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tvar n string\n\tfor i := 0; i < 100; i++ {\n\t\tn = strconv.Itoa(int(r.Int31n(999999-100000) + 100000))\n\t\tif _, ok := rooms.M[n]; !ok {\n\t\t\treturn n\n\t\t}\n\t}\n\treturn n\n}\n\nfunc Each(f func(o IRoom) bool) {\n\trooms.RLock()\n\tfor _, v := range rooms.M {\n\t\tif !f(v) {\n\t\t\tbreak\n\t\t}\n\t}\n\trooms.RUnlock()\n}\nfunc GetRooms() []IRoom {\n\tr := make([]IRoom, len(rooms.M))\n\trooms.RLock()\n\tvar n = 0\n\tfor _, v := range rooms.M {\n\t\tr[n] = v\n\t\tn ++\n\t}\n\n\trooms.RUnlock()\n\treturn r\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/timer/cronexpr.go",
    "content": "package timer\n\n// reference: https://github.com/robfig/cron\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n)\n\n// Field name   | Mandatory? | Allowed values | Allowed special characters\n// ----------   | ---------- | -------------- | --------------------------\n// Seconds      | No         | 0-59           | * / , -\n// Minutes      | Yes        | 0-59           | * / , -\n// Hours        | Yes        | 0-23           | * / , -\n// Day of month | Yes        | 1-31           | * / , -\n// Month        | Yes        | 1-12           | * / , -\n// Day of week  | Yes        | 0-6            | * / , -\ntype CronExpr struct {\n\tsec   uint64\n\tmin   uint64\n\thour  uint64\n\tdom   uint64\n\tmonth uint64\n\tdow   uint64\n}\n\n// goroutine safe\nfunc NewCronExpr(expr string) (cronExpr *CronExpr, err error) {\n\tfields := strings.Fields(expr)\n\tif len(fields) != 5 && len(fields) != 6 {\n\t\terr = fmt.Errorf(\"invalid expr %v: expected 5 or 6 fields, got %v\", expr, len(fields))\n\t\treturn\n\t}\n\n\tif len(fields) == 5 {\n\t\tfields = append([]string{\"0\"}, fields...)\n\t}\n\n\tcronExpr = new(CronExpr)\n\t// Seconds\n\tcronExpr.sec, err = parseCronField(fields[0], 0, 59)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\t// Minutes\n\tcronExpr.min, err = parseCronField(fields[1], 0, 59)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\t// Hours\n\tcronExpr.hour, err = parseCronField(fields[2], 0, 23)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\t// Day of month\n\tcronExpr.dom, err = parseCronField(fields[3], 1, 31)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\t// Month\n\tcronExpr.month, err = parseCronField(fields[4], 1, 12)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\t// Day of week\n\tcronExpr.dow, err = parseCronField(fields[5], 0, 6)\n\tif err != nil {\n\t\tgoto onError\n\t}\n\treturn\n\nonError:\n\terr = fmt.Errorf(\"invalid expr %v: %v\", expr, err)\n\treturn\n}\n\n// 1. *\n// 2. num\n// 3. num-num\n// 4. */num\n// 5. num/num (means num-max/num)\n// 6. num-num/num\nfunc parseCronField(field string, min int, max int) (cronField uint64, err error) {\n\tfields := strings.Split(field, \",\")\n\tfor _, field := range fields {\n\t\trangeAndIncr := strings.Split(field, \"/\")\n\t\tif len(rangeAndIncr) > 2 {\n\t\t\terr = fmt.Errorf(\"too many slashes: %v\", field)\n\t\t\treturn\n\t\t}\n\n\t\t// range\n\t\tstartAndEnd := strings.Split(rangeAndIncr[0], \"-\")\n\t\tif len(startAndEnd) > 2 {\n\t\t\terr = fmt.Errorf(\"too many hyphens: %v\", rangeAndIncr[0])\n\t\t\treturn\n\t\t}\n\n\t\tvar start, end int\n\t\tif startAndEnd[0] == \"*\" {\n\t\t\tif len(startAndEnd) != 1 {\n\t\t\t\terr = fmt.Errorf(\"invalid range: %v\", rangeAndIncr[0])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstart = min\n\t\t\tend = max\n\t\t} else {\n\t\t\t// start\n\t\t\tstart, err = strconv.Atoi(startAndEnd[0])\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"invalid range: %v\", rangeAndIncr[0])\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// end\n\t\t\tif len(startAndEnd) == 1 {\n\t\t\t\tif len(rangeAndIncr) == 2 {\n\t\t\t\t\tend = max\n\t\t\t\t} else {\n\t\t\t\t\tend = start\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tend, err = strconv.Atoi(startAndEnd[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"invalid range: %v\", rangeAndIncr[0])\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif start > end {\n\t\t\terr = fmt.Errorf(\"invalid range: %v\", rangeAndIncr[0])\n\t\t\treturn\n\t\t}\n\t\tif start < min {\n\t\t\terr = fmt.Errorf(\"out of range [%v, %v]: %v\", min, max, rangeAndIncr[0])\n\t\t\treturn\n\t\t}\n\t\tif end > max {\n\t\t\terr = fmt.Errorf(\"out of range [%v, %v]: %v\", min, max, rangeAndIncr[0])\n\t\t\treturn\n\t\t}\n\n\t\t// increment\n\t\tvar incr int\n\t\tif len(rangeAndIncr) == 1 {\n\t\t\tincr = 1\n\t\t} else {\n\t\t\tincr, err = strconv.Atoi(rangeAndIncr[1])\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"invalid increment: %v\", rangeAndIncr[1])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif incr <= 0 {\n\t\t\t\terr = fmt.Errorf(\"invalid increment: %v\", rangeAndIncr[1])\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// cronField\n\t\tif incr == 1 {\n\t\t\tcronField |= ^(math.MaxUint64 << uint(end+1)) & (math.MaxUint64 << uint(start))\n\t\t} else {\n\t\t\tfor i := start; i <= end; i += incr {\n\t\t\t\tcronField |= 1 << uint(i)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}\n\nfunc (e *CronExpr) matchDay(t time.Time) bool {\n\t// day-of-month blank\n\tif e.dom == 0xfffffffe {\n\t\treturn 1<<uint(t.Weekday())&e.dow != 0\n\t}\n\n\t// day-of-week blank\n\tif e.dow == 0x7f {\n\t\treturn 1<<uint(t.Day())&e.dom != 0\n\t}\n\n\treturn 1<<uint(t.Weekday())&e.dow != 0 ||\n\t\t1<<uint(t.Day())&e.dom != 0\n}\n\n// goroutine safe\nfunc (e *CronExpr) Next(t time.Time) time.Time {\n\t// the upcoming second\n\tt = t.Truncate(time.Second).Add(time.Second)\n\n\tyear := t.Year()\n\tinitFlag := false\n\nretry:\n\t// Year\n\tif t.Year() > year+1 {\n\t\treturn time.Time{}\n\t}\n\n\t// Month\n\tfor 1<<uint(t.Month())&e.month == 0 {\n\t\tif !initFlag {\n\t\t\tinitFlag = true\n\t\t\tt = time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location())\n\t\t}\n\n\t\tt = t.AddDate(0, 1, 0)\n\t\tif t.Month() == time.January {\n\t\t\tgoto retry\n\t\t}\n\t}\n\n\t// Day\n\tfor !e.matchDay(t) {\n\t\tif !initFlag {\n\t\t\tinitFlag = true\n\t\t\tt = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())\n\t\t}\n\n\t\tt = t.AddDate(0, 0, 1)\n\t\tif t.Day() == 1 {\n\t\t\tgoto retry\n\t\t}\n\t}\n\n\t// Hours\n\tfor 1<<uint(t.Hour())&e.hour == 0 {\n\t\tif !initFlag {\n\t\t\tinitFlag = true\n\t\t\tt = t.Truncate(time.Hour)\n\t\t}\n\n\t\tt = t.Add(time.Hour)\n\t\tif t.Hour() == 0 {\n\t\t\tgoto retry\n\t\t}\n\t}\n\n\t// Minutes\n\tfor 1<<uint(t.Minute())&e.min == 0 {\n\t\tif !initFlag {\n\t\t\tinitFlag = true\n\t\t\tt = t.Truncate(time.Minute)\n\t\t}\n\n\t\tt = t.Add(time.Minute)\n\t\tif t.Minute() == 0 {\n\t\t\tgoto retry\n\t\t}\n\t}\n\n\t// Seconds\n\tfor 1<<uint(t.Second())&e.sec == 0 {\n\t\tif !initFlag {\n\t\t\tinitFlag = true\n\t\t}\n\n\t\tt = t.Add(time.Second)\n\t\tif t.Second() == 0 {\n\t\t\tgoto retry\n\t\t}\n\t}\n\n\treturn t\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/timer/example_test.go",
    "content": "package timer\n\nimport (\n\t\"time\"\n\t\"testing\"\n)\n\nfunc TestTimer(t *testing.T) {\n\td := NewDispatcher(10)\n\n\t// timer 1\n\td.AfterFunc(1, func() {\n\t\tt.Log(\"My name is Leaf\")\n\t})\n\n\t// timer 2\n\ttim := d.AfterFunc(1, func() {\n\t\tt.Log(\"will not print\")\n\t})\n\ttim.Stop()\n\n\t// dispatch\n\t(<-d.ChanTimer).Cb()\n\n\t// Output:\n\t// My name is Leaf\n}\n\nfunc TestNewCronExpr(t *testing.T) {\n\tcronExpr, err := NewCronExpr(\"0 * * * *\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tt.Log(cronExpr.Next(time.Date(\n\t\t2000, 1, 1,\n\t\t20, 10, 5,\n\t\t0, time.UTC,\n\t)))\n\n\t// Output:\n\t// 2000-01-01 21:00:00 +0000 UTC\n}\n\nfunc TestDispatcher_CronFunc(t *testing.T) {\n\td := NewDispatcher(10)\n\n\t// cron expr\n\tcronExpr, err := NewCronExpr(\"* * * * * *\")\n\tif err != nil {\n\t\tt.Log(err)\n\t\treturn\n\t}\n\n\t// cron\n\tvar c *Cron\n\tc = d.CronFunc(cronExpr, func() {\n\t\tt.Log(\"My name is Leaf\")\n\t\tc.Stop()\n\t})\n\n\t// dispatch\n\t(<-d.ChanTimer).Cb()\n\n\t// Output:\n\t// My name is Leaf\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/timer/timer.go",
    "content": "package timer\n\nimport (\n\t\"github.com/dolotech/leaf/conf\"\n\t\"github.com/golang/glog\"\n\t\"runtime\"\n\t\"time\"\n)\n\n// one dispatcher per goroutine (goroutine not safe)\ntype Dispatcher struct {\n\tChanTimer chan *Timer\n}\n\nfunc NewDispatcher(l int) *Dispatcher {\n\tdisp := new(Dispatcher)\n\tdisp.ChanTimer = make(chan *Timer, l)\n\treturn disp\n}\n\n// Timer\ntype Timer struct {\n\tt  *time.Timer\n\tcb func()\n}\n\nfunc (t *Timer) Stop() {\n\tt.t.Stop()\n\tt.cb = nil\n}\n\nfunc (t *Timer) Cb() {\n\tdefer func() {\n\t\tt.cb = nil\n\t\tif r := recover(); r != nil {\n\t\t\tif conf.LenStackBuf > 0 {\n\t\t\t\tbuf := make([]byte, conf.LenStackBuf)\n\t\t\t\tl := runtime.Stack(buf, false)\n\t\t\t\tglog.Error(\"%v: %s\", r, buf[:l])\n\t\t\t} else {\n\t\t\t\tglog.Error(\"%v\", r)\n\t\t\t}\n\t\t}\n\t}()\n\n\tif t.cb != nil {\n\t\tt.cb()\n\t}\n}\n\nfunc (disp *Dispatcher) AfterFunc(d time.Duration, cb func()) *Timer {\n\tt := new(Timer)\n\tt.cb = cb\n\tt.t = time.AfterFunc(d, func() {\n\t\tdisp.ChanTimer <- t\n\t})\n\treturn t\n}\n\n// Cron\ntype Cron struct {\n\tt *Timer\n}\n\nfunc (c *Cron) Stop() {\n\tif c.t != nil {\n\t\tc.t.Stop()\n\t}\n}\n\nfunc (disp *Dispatcher) CronFunc(cronExpr *CronExpr, _cb func()) *Cron {\n\tc := new(Cron)\n\n\tnow := time.Now()\n\tnextTime := cronExpr.Next(now)\n\tif nextTime.IsZero() {\n\t\treturn c\n\t}\n\n\t// callback\n\tvar cb func()\n\tcb = func() {\n\t\tdefer _cb()\n\n\t\tnow := time.Now()\n\t\tnextTime := cronExpr.Next(now)\n\t\tif nextTime.IsZero() {\n\t\t\treturn\n\t\t}\n\t\tc.t = disp.AfterFunc(nextTime.Sub(now), cb)\n\t}\n\n\tc.t = disp.AfterFunc(nextTime.Sub(now), cb)\n\treturn c\n}\n"
  },
  {
    "path": "src/github.com/dolotech/leaf/version.go",
    "content": "package leaf\n\nconst version = \"1.1.2\"\n"
  },
  {
    "path": "src/github.com/dolotech/lib/README.md",
    "content": ""
  },
  {
    "path": "src/github.com/dolotech/lib/csv/bench_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:40\n * Filename : bench_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"testing\"\n)\n\n// Benchmark with large CSV data set\n\nfunc loadData() []byte {\n\tf, err := os.Open(\"testdata/ercot-dam.csv.gz\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\n\tgz, err := gzip.NewReader(f)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, err := ioutil.ReadAll(gz)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn data\n}\n\ntype Price struct {\n\tDeliveryDate string\n\tHourEnding   string\n\tBusName      string\n\tLMP          float32\n\tDSTFlag      bool `true:\"Y\" false:\"N\"`\n}\n\nfunc BenchmarkUnmarshal(b *testing.B) {\n\tb.StopTimer()\n\tdata := loadData()\n\tb.StartTimer()\n\n\tpp := []Price{}\n\n\terr := Unmarshal(data, &pp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tout, err := Marshal(pp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif bytes.Equal(data, out) != true {\n\t\tpanic(\"wrong results\")\n\t}\n\n\tb.Logf(\"Unmarshal %d rows\", len(pp))\n\tb.Logf(\"Marshaled %d bytes\", len(out))\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/cfield.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : cfield.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n)\n\ntype decoderFn func(*reflect.Value, *Row) error\n\n// maps a CSV column Name and index to a StructField\ntype cfield struct {\n\tcolIndex    int\n\tstructField *reflect.StructField\n\tdecoder     decoderFn\n}\n\nfunc newCfield(index int, sf *reflect.StructField) cfield {\n\tcf := cfield{\n\t\tcolIndex:    index,\n\t\tstructField: sf,\n\t}\n\n\tcf.decoder = cf.unassignedDecoder\n\n\treturn cf\n}\n\nfunc (cf *cfield) assignUnmarshaller(code int) {\n\tif code == impsPtr {\n\t\tcf.decoder = cf.unmarshalPointer\n\t} else {\n\t\tcf.decoder = cf.unmarshalValue\n\t}\n}\n\nfunc (cf *cfield) unmarshalPointer(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\tm := cell.Addr().Interface().(Unmarshaler)\n\tm.UnmarshalCSV(val, row)\n\n\treturn nil\n}\n\nfunc (cf *cfield) unmarshalValue(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\tm := cell.Interface().(Unmarshaler)\n\tm.UnmarshalCSV(val, row)\n\treturn nil\n}\n\nfunc (cf *cfield) assignDecoder() {\n\tswitch cf.structField.Type.Kind() {\n\tcase reflect.String:\n\t\tcf.decoder = cf.decodeString\n\tcase reflect.Uint32:\n\t\tcf.decoder = cf.decodeUint32\n\tcase reflect.Int, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int8:\n\t\tcf.decoder = cf.decodeInt\n\tcase reflect.Float32:\n\t\tcf.decoder = cf.decodeFloat(32)\n\tcase reflect.Float64:\n\t\tcf.decoder = cf.decodeFloat(64)\n\tcase reflect.Bool:\n\t\tcf.decoder = cf.decodeBool\n\tdefault:\n\t\tcf.decoder = cf.ignoreValue\n\t}\n}\n\nfunc (cf *cfield) decodeBool(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\tvar bv bool\n\n\tbt := cf.structField.Tag.Get(\"true\")\n\tbf := cf.structField.Tag.Get(\"false\")\n\n\tswitch val {\n\tcase bt:\n\t\tbv = true\n\tcase bf:\n\t\tbv = false\n\tdefault:\n\t\tbv = true\n\t}\n\n\tcell.SetBool(bv)\n\n\treturn nil\n}\n\nfunc (cf *cfield) decodeUint32(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\ti, e := strconv.ParseUint(val, 10, 32)\n\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tcell.SetUint(i)\n\treturn nil\n}\nfunc (cf *cfield) decodeInt(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\ti, e := strconv.Atoi(val)\n\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tcell.SetInt(int64(i))\n\treturn nil\n}\n\nfunc (cf *cfield) decodeString(cell *reflect.Value, row *Row) error {\n\tval := row.At(cf.colIndex)\n\tcell.SetString(val)\n\n\treturn nil\n}\n\nfunc (cf *cfield) decodeFloat(bit int) decoderFn {\n\treturn func(cell *reflect.Value, row *Row) error {\n\t\tval := row.At(cf.colIndex)\n\t\tn, err := strconv.ParseFloat(val, bit)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcell.SetFloat(n)\n\n\t\treturn nil\n\t}\n}\n\n// ignoreValue does nothing. This is for unsupported types.\nfunc (cf *cfield) ignoreValue(cell *reflect.Value, row *Row) error {\n\treturn nil\n}\n\n// unassignedDecoder is the default decoder.  It returns an error since it should\n// have been assigned.\nfunc (cf *cfield) unassignedDecoder(cell *reflect.Value, row *Row) error {\n\treturn fmt.Errorf(\"no decoder for %v\\n\", cf.structField.Name)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/csv.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : csv.go\n * Description :\n * *******************************************************/\n// Package csv provides `Marshal` and `UnMarshal` encoding functions for CSV(Comma Seperated Value) data.\n// This package is built on the the standard library's encoding/csv.\npackage csv\n\nimport (\n\t\"reflect\"\n)\n\n// fieldHeaderName returns the header name to use for the given StructField\n// This can be a user defined name (via the Tag) or a default name.\nfunc fieldHeaderName(f reflect.StructField) (string, bool) {\n\th := f.Tag.Get(\"csv\")\n\n\tif h == \"-\" {\n\t\treturn \"\", false\n\t}\n\n\t// If there is no tag set, use a default name\n\tif h == \"\" {\n\t\treturn f.Name, true\n\t}\n\n\treturn h, true\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/csv_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : csv_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"testing\"\n)\n\ntype simple struct {\n\tName    string `csv:\"FullName\"`\n\tGender  string\n\tprivate int    `csv:\"-\"`\n\tIgnore  string `csv:\"-\"`\n\tAge     int\n}\n\nfunc TestHeader(t *testing.T) {\n\tx := reflect.TypeOf(simple{})\n\n\t// Get the header when defined via a tag\n\tf, _ := x.FieldByName(\"Name\")\n\th, _ := fieldHeaderName(f)\n\n\tif h != \"FullName\" {\n\t\tt.Error(\"header does not match\")\n\t}\n\n\t// Use the field FullName when there is no tag\n\tf, _ = x.FieldByName(\"Gender\")\n\th, _ = fieldHeaderName(f)\n\n\tif h != \"Gender\" {\n\t\tt.Error(\"Default header FullName not created\")\n\t}\n\n\t// Get the header when defined via a tag\n\tf, _ = x.FieldByName(\"Ignore\")\n\t_, ok := fieldHeaderName(f)\n\n\tif ok == true {\n\t\tt.Error(\"Omitted field returned ok\")\n\t}\n}\n\nfunc TestHeaders(t *testing.T) {\n\tx := reflect.TypeOf(simple{})\n\n\thh := colNames(x)\n\n\tif \"[FullName Gender Age]\" != fmt.Sprintf(\"%v\", hh) {\n\t\tt.Errorf(\"Incorrected headers: %v\", hh)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/decode.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : decode.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"bytes\"\n\t\"encoding/csv\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n)\n\n// Row is one row of CSV data, indexed by column name or position.\ntype Row struct {\n\tColumns *[]string // The name of the columns, in order\n\tData    []string  // the data for the row\n}\n\n// At returns the rows data for the column positon i\nfunc (r *Row) At(i int) string {\n\treturn r.Data[i]\n}\n\n// Named returns the row's data for the first columne named 'n'\nfunc (r *Row) Named(n string) (string, error) {\n\tfor i, cn := range *r.Columns {\n\t\tif cn == n {\n\t\t\treturn r.At(i), nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"no column found for %s\", n)\n}\n\ntype decoder struct {\n\tcsv          *csv.Reader   // the csv document for input\n\treflect.Type               // the underlying struct to decode\n\tout          reflect.Value // the slice output\n\tcfields      []cfield      //\n\tcols         []string      // colum names\n}\n\n// Unmarshaler is the interface implemented by objects which can unmarshall the CSV row itself.\ntype Unmarshaler interface {\n\n\t// UnmarshalCSV receives a string with the column value matching this field\n\t// and a reference to the the current row.\n\t// This allows composing a value from mutliple columns.\n\tUnmarshalCSV(string, *Row) error\n}\n\n// Unmarshal parses the CSV document and stores the result in the value pointed to by v. Only a slice of a struct is allowed for v.\n//\n// The first line of the CSV is document is used for column names.  These are\n// paired to matching exported fields in v's type. See Marshal on how to use tags\n// to map to different names and additional options.\n//\n// Supported Types\n//\n// string, int, float and bool are supported. Any type which implements Unmarshal is also supported.\nfunc Unmarshal(doc []byte, v interface{}) error {\n\trv, err := checkForSlice(v)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdec, err := newDecoder(doc, rv)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdec.unmarshal()\n\treturn nil\n}\n\nfunc (dec *decoder) unmarshal() error {\n\tfor {\n\t\traw, err := dec.csv.Read()\n\n\t\tif err != nil {\n\t\t\tbreak\n\t\t} else {\n\t\t\trow := dec.newRow(raw)\n\t\t\to := reflect.New(dec.Type).Elem()\n\t\t\terr := dec.set(row, &o)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdec.out.Set(reflect.Append(dec.out, o))\n\t\t}\n\n\t}\n\n\treturn nil\n\n}\n\nfunc (dec *decoder) newRow(raw []string) *Row {\n\treturn &Row{\n\t\tColumns: &dec.cols,\n\t\tData:    raw,\n\t}\n}\n\n// checkForSlice validates that the interface is a slice type\nfunc checkForSlice(v interface{}) (reflect.Value, error) {\n\tpv := reflect.ValueOf(v)\n\n\tif pv.Kind() != reflect.Ptr || pv.IsNil() {\n\t\treturn pv, errors.New(\"type is nil or not a pointer\")\n\t}\n\n\trv := reflect.ValueOf(v).Elem()\n\n\tif rv.Kind() != reflect.Slice {\n\t\treturn rv, fmt.Errorf(\"only slices are allowed: %s\", rv.Kind())\n\t}\n\n\treturn rv, nil\n}\n\nconst (\n\t// interface is implemented on a value\n\timpsVal int = 1\n\n\t// interface is implemented on a pointer\n\timpsPtr int = 2\n)\n\n// impsUnmarshaller checks if an object implements the Unmarshaler interface\nfunc impsUnmarshaller(et reflect.Type, i interface{}) (int, error) {\n\tel := reflect.New(et).Elem()\n\tit := reflect.TypeOf(i).Elem()\n\n\tif el.Type().Implements(it) {\n\t\treturn impsVal, nil\n\t}\n\n\tif el.Addr().Type().Implements(it) {\n\t\treturn impsPtr, nil\n\t}\n\n\treturn 0, fmt.Errorf(\"%v el does not implement %s\", el, it.Name())\n}\n\n// mapFields creates a set of fieldMap instances.\n//\n// A cfield is created when a column name matches an exported field name in the\n// decoder's Type.\nfunc (dec *decoder) mapFieldsToCols(cols []string) {\n\tpFields := exportedFields(dec.Type)\n\n\tcMap := map[string]int{}\n\n\tfor i, col := range cols {\n\t\tcMap[col] = i\n\t}\n\n\tfor _, f := range pFields {\n\n\t\tname, ok := fieldHeaderName(*f)\n\t\tif ok == false {\n\t\t\tcontinue\n\t\t}\n\n\t\tindex, ok := cMap[name]\n\n\t\tif ok == true {\n\t\t\tcf := newCfield(index, f)\n\n\t\t\tif code, err := impsUnmarshaller(f.Type, new(Unmarshaler)); err == nil {\n\t\t\t\tcf.assignUnmarshaller(code)\n\t\t\t} else {\n\t\t\t\tcf.assignDecoder()\n\t\t\t}\n\n\t\t\tdec.cfields = append(dec.cfields, cf)\n\t\t}\n\t}\n}\n\n// exportedFields returns a slice of exported fields\nfunc exportedFields(t reflect.Type) []*reflect.StructField {\n\tvar out []*reflect.StructField\n\t//\tif t.Kind() == reflect.Ptr {\n\t//\t\tt = t.Elem()\n\t//\t}\n\tv := reflect.New(t).Elem()\n\n\tflen := v.NumField()\n\n\tfor i := 0; i < flen; i++ {\n\n\t\t// Get the StructField from the Type\n\t\tsf := t.Field(i)\n\n\t\t// Check if the field is CanSet from the value (v)\n\t\tif v.Field(i).CanSet() == true {\n\t\t\tout = append(out, &sf)\n\t\t}\n\t}\n\n\treturn out\n\n}\n\nfunc newDecoder(doc []byte, rv reflect.Value) (*decoder, error) {\n\tb := bytes.NewReader(doc)\n\tr := csv.NewReader(b)\n\tcols, err := r.Read()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tel := rv.Type().Elem()\n\n\tdec := decoder{\n\t\tType: el,\n\t\tcsv:  r,\n\t\tout:  rv,\n\t\tcols: cols,\n\t}\n\n\tdec.mapFieldsToCols(cols)\n\n\treturn &dec, nil\n}\n\n// Sets each field value for the el struct for the given row\nfunc (dec *decoder) set(row *Row, el *reflect.Value) error {\n\tfor _, cf := range dec.cfields {\n\t\tfield := cf.structField\n\n\t\tf := el.FieldByName(field.Name)\n\t\terr := cf.decoder(&f, row)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/decode_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : decode_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n)\n\ntype Q struct {\n\tString    string\n\tInt       int\n\tunxported int\n\tBool      bool `true:\"Yes\" false:\"No\"`\n\tFloat32   float32\n\tFloat64   float64\n\tComplex64 complex64 `csv:\"C64\"`\n}\n\nfunc TestUnmarshal(t *testing.T) {\n\tdoc := []byte(`String,Int,unexported,Bool,Float32,Float64,C64\nJohn,23,1,Yes,32.2,64.1,1\nJane,27,2,No,33.1,65.1,2\nBill,28,3,Yes,34.7,65.1,3`)\n\n\tpp := []Q{}\n\n\tUnmarshal(doc, &pp)\n\n\tif len(pp) != 3 {\n\t\tt.Errorf(\"Incorrect record length: %d\", len(pp))\n\t}\n\n\tassert := func(e, a interface{}) {\n\t\tif e != a {\n\t\t\tt.Errorf(\"expected (%s) got (%s)\", e, a)\n\t\t}\n\t}\n\n\tstrs := []string{\"John\", \"Jane\", \"Bill\"}\n\tints := []int{23, 27, 28}\n\tbools := []bool{true, false, true}\n\tf32s := []float32{32.2, 33.1, 34.7}\n\tf64s := []float64{64.1, 65.1, 65.1}\n\n\tfor i, p := range pp {\n\t\tassert(strs[i], p.String)\n\t\tassert(ints[i], p.Int)\n\t\tassert(bools[i], p.Bool)\n\t\tassert(f32s[i], p.Float32)\n\t\tassert(f64s[i], p.Float64)\n\t}\n\n}\n\nfunc TestMarshalErrors(t *testing.T) {\n\tdoc := []byte(`Name,Age`)\n\terr := Unmarshal(doc, []Q{})\n\tif err == nil {\n\t\tt.Error(\"No error generated for non-pointer\")\n\t}\n\n\terr = Unmarshal(doc, &Q{})\n\tif err == nil {\n\t\tt.Error(\"No error generated for non-slice\")\n\t}\n\n\tpp := []Q{}\n\terr = Unmarshal(doc, &pp)\n\tif err != nil {\n\t\tt.Error(\"Error returned when not expected:\", err)\n\t}\n}\n\nfunc TestExportedFields(t *testing.T) {\n\ttype s struct {\n\t\tName string\n\t\tAge  int `csv:\"Age\"`\n\t\tpriv int `csv:\"-\"`\n\t}\n\n\tfs := exportedFields(reflect.TypeOf(s{}))\n\n\tif len(fs) != 2 {\n\t\tt.Error(\"Incorrect number of exported fields 2 expected got %d\", len(fs))\n\t}\n\n\tif fs[0].Name != \"Name\" || fs[1].Name != \"Age\" {\n\t\tt.Error(\"Incorrect returned fields\")\n\t}\n}\n\ntype T struct {\n\tName    string\n\tage     string // unexported, should not be included\n\tAddr    string `csv:\"Address\"`\n\tNoMatch int    // public, but no match in the CSV headers\n}\n\nfunc TestMapFields(t *testing.T) {\n\tdec := &decoder{Type: reflect.TypeOf(T{})}\n\tcols := []string{\n\t\t\"Name\",\n\t\t\"age\", // should not match since the 'age' field is not exported\n\t\t\"Address\",\n\t}\n\n\tdec.mapFieldsToCols(cols)\n\n\tfm := dec.cfields\n\tif len(fm) != 2 {\n\t\tt.Errorf(\"Expected length of 2, got %d\", len(fm))\n\t}\n\n\tfor i, n := range []int{0, 2} {\n\t\tif fm[i].colIndex != n {\n\t\t\tt.Errorf(\"expected colIndex of %d got %d\", fm[i].colIndex, n)\n\t\t}\n\t}\n}\n\ntype Um struct {\n\tV string\n}\n\ntype U struct {\n\tName Um\n}\n\nfunc (u *Um) UnmarshalCSV(val string, row *Row) error {\n\tv, _ := row.Named(\"Age\")\n\tu.V = row.At(0) + \" \" + v\n\treturn nil\n}\n\nfunc TestCustomUnMarshaller(t *testing.T) {\n\tdoc := `Name,Age\nJay,23`\n\n\too := []U{}\n\n\tUnmarshal([]byte(doc), &oo)\n\n\tif oo[0].Name.V != \"Jay 23\" {\n\t\tt.Errorf(\"custom unmarshal did not work (%s)\", oo[0].Name.V)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/encode.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:41\n * Filename : encode.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"bytes\"\n\t\"encoding/csv\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n)\n\n// Marshaler is an interface for objects which can Marshal themselves into CSV.\ntype Marshaler interface {\n\tMarshalCSV() ([]byte, error)\n}\n\ntype encoder struct {\n\t*csv.Writer\n\tbuffer *bytes.Buffer\n}\n\n// Marshal returns the CSV encoding of i, which must be a slice of struct types.\n//\n// Marshal traverses the slice and encodes the primative values.\n//\n// The first row of the CSV output is a header row. The column names are based\n// on the field name.  If a different name is required a struct tag can be used\n// to define a new name.\n//\n//   Field string `csv:\"Column Name\"`\n//\n// To skip encoding a field use the \"-\" as the tag value.\n//\n//   Field string `csv:\"-\"`\n//\n// Boolean fields can use string values to define true or false.\n//   Bool bool `true:\"Yes\" false:\"No\"`\nfunc Marshal(i interface{}) ([]byte, error) {\n\t// validate the interface\n\t// create a new encoder\n\t//   assing the cfields\n\t// get the headers\n\t// encoder each row\n\n\tdata := reflect.ValueOf(i)\n\n\tif data.Kind() != reflect.Slice {\n\t\treturn []byte{}, errors.New(\"only slices can be marshalled\")\n\t}\n\n\tel := data.Index(0)\n\tenc, err := newEncoder(el)\n\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\terr = enc.encodeAll(data)\n\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\tenc.Flush()\n\treturn enc.buffer.Bytes(), nil\n}\n\nfunc newEncoder(el reflect.Value) (*encoder, error) {\n\tb := bytes.NewBuffer([]byte{})\n\n\tenc := &encoder{\n\t\tbuffer: b,\n\t\tWriter: csv.NewWriter(b),\n\t}\n\n\terr := enc.Write(colNames(el.Type()))\n\n\treturn enc, err\n}\n\n// colNames takes a struct and returns the computed columns names for each\n// field.\nfunc colNames(t reflect.Type) (out []string) {\n\tl := t.NumField()\n\n\tfor x := 0; x < l; x++ {\n\t\tf := t.Field(x)\n\t\th, ok := fieldHeaderName(f)\n\t\tif ok {\n\t\t\tout = append(out, h)\n\t\t}\n\t}\n\n\treturn\n}\n\n// encodeAll iterates over each item in data, encoder it then writes it\nfunc (enc *encoder) encodeAll(data reflect.Value) error {\n\tn := data.Len()\n\tfor c := 0; c < n; c++ {\n\t\trow, err := enc.encodeRow(data.Index(c))\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = enc.Write(row)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// encodes a struct into a CSV row\nfunc (enc *encoder) encodeRow(v reflect.Value) ([]string, error) {\n\n\tvar row []string\n\t// TODO env.columns should map to a cfield\n\t// iterate over each cfield and encode with it\n\tl := v.Type().NumField()\n\n\tfor x := 0; x < l; x++ {\n\t\tfv := v.Field(x)\n\t\tst := v.Type().Field(x).Tag\n\n\t\tif st.Get(\"csv\") == \"-\" {\n\t\t\tcontinue\n\t\t}\n\t\to := enc.encodeCol(fv, st)\n\t\trow = append(row, o)\n\t}\n\n\treturn row, nil\n}\n\n// Returns the string representation of the field value\nfunc (enc *encoder) encodeCol(fv reflect.Value, st reflect.StructTag) string {\n\tswitch fv.Kind() {\n\tcase reflect.String:\n\t\treturn fv.String()\n\tcase reflect.Int, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int8:\n\t\treturn fmt.Sprintf(\"%v\", fv.Int())\n\tcase reflect.Float32:\n\t\treturn encodeFloat(32, fv)\n\tcase reflect.Float64:\n\t\treturn encodeFloat(64, fv)\n\tcase reflect.Bool:\n\t\treturn encodeBool(fv.Bool(), st)\n\tcase reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint8:\n\t\treturn fmt.Sprintf(\"%v\", fv.Uint())\n\tcase reflect.Complex64, reflect.Complex128:\n\t\treturn fmt.Sprintf(\"%+.3g\", fv.Complex())\n\tcase reflect.Interface:\n\t\treturn encodeInterface(fv, st)\n\tcase reflect.Struct:\n\t\treturn encodeInterface(fv, st)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unsupported type %s\", fv.Kind()))\n\t}\n\n\treturn \"\"\n}\n\nfunc encodeFloat(bits int, f reflect.Value) string {\n\treturn strconv.FormatFloat(f.Float(), 'g', -1, bits)\n}\n\nfunc encodeBool(b bool, st reflect.StructTag) string {\n\tv := strconv.FormatBool(b)\n\ttv := st.Get(v)\n\n\tif tv != \"\" {\n\t\treturn tv\n\t}\n\treturn v\n}\n\nfunc encodeInterface(fv reflect.Value, st reflect.StructTag) string {\n\tmarshalerType := reflect.TypeOf(new(Marshaler)).Elem()\n\n\tif fv.Type().Implements(marshalerType) {\n\t\tm := fv.Interface().(Marshaler)\n\t\tb, err := m.MarshalCSV()\n\t\tif err != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn string(b)\n\t}\n\n\treturn \"\"\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/encode_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:42\n * Filename : encode_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n)\n\ntype X struct {\n\tFirst string\n}\n\ntype P struct {\n\tFirst string\n\tLast  string\n}\n\nfunc (p P) MarshalCSV() ([]byte, error) {\n\treturn []byte(p.First + \" \" + p.Last), nil\n}\n\nfunc TestMarshal_without_a_slice(t *testing.T) {\n\t_, err := Marshal(simple{})\n\n\tif err == nil {\n\t\tt.Error(\"Non slice produced no error\")\n\t}\n}\n\nfunc TestEncodeFieldValue(t *testing.T) {\n\tvar encTests = []struct {\n\t\tval      interface{}\n\t\texpected string\n\t\ttag      string\n\t}{\n\t\t// Strings\n\t\t{\"ABC\", \"ABC\", \"\"},\n\t\t{byte(123), \"123\", \"\"},\n\n\t\t// Numerics\n\t\t{int(1), \"1\", \"\"},\n\t\t{float32(3.2), \"3.2\", \"\"},\n\t\t{uint32(123), \"123\", \"\"},\n\t\t{complex64(1 + 2i), \"(+1+2i)\", \"\"},\n\n\t\t// Boolean\n\t\t{true, \"Yes\", `true:\"Yes\" false:\"No\"`},\n\t\t{false, \"No\", `true:\"Yes\" false:\"No\"`},\n\n\t\t// TODO Array\n\t\t// Interface with Marshaler\n\t\t{P{\"Jay\", \"Zee\"}, \"Jay Zee\", \"\"},\n\n\t\t// Struct without Marshaler will produce nothing\n\t\t{X{\"Jay\"}, \"\", \"\"},\n\t}\n\n\tenc := &encoder{}\n\n\tfor _, test := range encTests {\n\t\tfv := reflect.ValueOf(test.val)\n\t\tst := reflect.StructTag(test.tag)\n\t\tres := enc.encodeCol(fv, st)\n\n\t\tif res != test.expected {\n\t\t\tt.Errorf(\"%s does not match %s\", res, test.expected)\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/example_marshal_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:42\n * Filename : example_marshal_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"fmt\"\n\t\"github.com/golang/glog\"\n)\n\nfunc ExampleMarshal() {\n\ttype Person struct {\n\t\tName    string `csv:\"FullName\"`\n\t\tGender  string\n\t\tAge     int\n\t\tWallet  float32 `csv:\"Bank Account\"`\n\t\tHappy   bool    `true:\"Yes!\" false:\"Sad\"`\n\t\tprivate int     `csv:\"-\"`\n\t}\n\n\tpeople := []Person{\n\t\tPerson{\n\t\t\tName:   \"Smith, Joe\",\n\t\t\tGender: \"M\",\n\t\t\tAge:    23,\n\t\t\tWallet: 19.07,\n\t\t\tHappy:  false,\n\t\t},\n\t}\n\n\tout, _ := Marshal(people)\n\tglog.Infof(\"%s\", out)\n\t// Output:\n\t// FullName,Gender,Age,Bank Account,Happy\n\t// \"Smith, Joe\",M,23,19.07,Sad\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/csv/example_test.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-07-07 23:42\n * Filename : example_test.go\n * Description :\n * *******************************************************/\npackage csv\n\nimport (\n\t\"fmt\"\n\t\"github.com/golang/glog\"\n)\n\ntype Person struct {\n\tName    string  `csv:\"Full Name\"`\n\tincome  string  // unexported fields are not Unmarshalled\n\tAge     int     `csv:\"-\"`      // skip this field\n\tAddress Address `csv:\"Street\"` // skip this field\n}\n\ntype Address struct {\n\tCity   string\n\tStreet string\n}\n\nfunc (a *Address) UnmarshalCSV(val string, row *Row) error {\n\tc, _ := row.Named(\"City\")\n\ts, _ := row.Named(\"Street\")\n\n\ta.Street = s\n\ta.City = c\n\n\treturn nil\n}\n\nfunc ExampleUnmarshal() {\n\tpeople := []Person{}\n\n\tsample := []byte(\n\t\t`Full Name,income,Age,City,Street\nJohn Doe,\"32,000\",45,Brooklyn,\"7th Street\"\n`)\n\n\terr := Unmarshal(sample, &people)\n\n\tif err != nil {\n\t\tglog.Infoln(\"Error: \", err)\n\t}\n\n\tglog.Infof(\"%+v\", people)\n\n\t// Output:\n\t// [{Name:John Doe income: Age:0 Address:{City:Brooklyn Street:7th Street}}]\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/db/client.go",
    "content": "// 数据库客户端常用操作 （基于 xorm）\npackage db\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/go-xorm/xorm\"\n\t_ \"github.com/lib/pq\"\n)\n\n// Client 数据库客户端\ntype Client struct {\n\tengine *xorm.Engine\n}\n\nvar db *Client\n\n//var database_addr string\n//const configFilePath string = \"config.ini\"\n\nfunc Init(url string) error{\n\tvar err error\n\tif db == nil {\n\t\tdb, err = NewClient(\"postgres\", url)\n\t\t//db.ShowSQL(config.GetCfgDatabase().ShowSql)\n\t\tdb.ShowSQL(true)\n\t}\n\treturn err\n}\nfunc C() *Client {\n\treturn db\n}\n\n// NewClient 创建一个客户端链接\nfunc NewClient(driver, connstr string) (*Client, error) {\n\tengine, err := xorm.NewEngine(driver, connstr)\n\tengine.SetMaxIdleConns(200) //最大连接数设置为200\n\tif err == nil {\n\t\tping := func() <-chan string {\n\t\t\terrmsg := make(chan string)\n\t\t\tgo func() {\n\t\t\t\terr := engine.Ping()\n\t\t\t\tif err != nil {\n\t\t\t\t\terrmsg <- err.Error()\n\t\t\t\t} else {\n\t\t\t\t\terrmsg <- \"\"\n\t\t\t\t}\n\t\t\t}()\n\t\t\treturn errmsg\n\t\t}\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase msg := <-ping():\n\t\t\t\tif len(msg) > 0 {\n\t\t\t\t\t//logs.Error(msg)\n\t\t\t\t} else {\n\t\t\t\t\t//logs.Info(\"connect %s succeed.\", driver)\n\t\t\t\t}\n\t\t\tcase <-time.After(time.Second * 5):\n\t\t\t\t//logs.Info(\"connect timeout 5 second.\")\n\t\t\t}\n\t\t}()\n\t}\n\treturn &Client{engine: engine}, err\n}\n\nfunc (cl *Client) Engine() *xorm.Engine {\n\treturn cl.engine\n}\n\n// Close 关闭连接\nfunc (cl *Client) Close() error {\n\tif cl.engine != nil {\n\t\terr := cl.engine.Close()\n\t\tcl.engine = nil\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// SerialInteractor 序列接口\ntype SerialInteractor interface {\n\tTableName() string\n}\n\n// ShowSQL 显示 SQL\nfunc (cl *Client) ShowSQL(show bool) {\n\tcl.engine.ShowSQL(show)\n}\n\n// NewSession 创建一个事务\nfunc (cl *Client) NewSession() *xorm.Session {\n\treturn cl.engine.NewSession()\n}\n\n// GetNextSerial 获取下个以序列\nfunc (cl *Client) GetNextSerial(serialbean SerialInteractor) (int, error) {\n\tsqlStr := fmt.Sprintf(\"select nextval('%s_id_seq'::regclass)\", serialbean.TableName())\n\tdata, err := cl.engine.Query(sqlStr)\n\tif err != nil || data == nil || len(data) == 0 {\n\t\treturn 0, err\n\t}\n\tnextval := string(data[0][\"nextval\"])\n\treturn strconv.Atoi(nextval)\n}\n\n// SimpleValue 简单结果\nfunc (cl *Client) SimpleValue(sql string) (string, error) {\n\tdata, err := cl.engine.Query(sql)\n\tif err != nil || data == nil || len(data) == 0 {\n\t\treturn \"\", err\n\t}\n\tfor _, v := range data[0] {\n\t\tret := string(v)\n\t\treturn ret, nil\n\t}\n\treturn \"\", errors.New(\"not found return value\")\n}\n\n// SimpleIntValue 简单的 int 值\nfunc (cl *Client) SimpleIntValue(sql string) (int, error) {\n\tdata, err := cl.engine.Query(sql)\n\tif err != nil || data == nil || len(data) == 0 {\n\t\treturn 0, err\n\t}\n\tfor _, v := range data[0] {\n\t\tret := string(v)\n\t\treturn strconv.Atoi(ret)\n\t}\n\treturn 0, errors.New(\"not found return value\")\n}\n\n// Insert 保存一个数据\nfunc (cl *Client) Insert(bean interface{}, omitColumns ...string) (int64, error) {\n\treturn cl.engine.Omit(omitColumns...).Insert(bean)\n}\n\n// Get 查找一条数据\nfunc (cl *Client) Get(bean interface{}) (bool, error) {\n\thas, err := cl.engine.Get(bean)\n\treturn has, err\n}\n\n// WhereGet 条件查询\nfunc (cl *Client) WhereGet(bean interface{}, querystring string, args ...interface{}) (bool, error) {\n\treturn cl.engine.Where(querystring, args...).Get(bean)\n}\n\n// WhereFind 条件查询\nfunc (cl *Client) WhereFind(bean interface{}, querystring string, args ...interface{}) error {\n\treturn cl.engine.Where(querystring, args...).Find(bean)\n}\n\n// Update 修改一条数据\nfunc (cl *Client) Update(id int, bean interface{}, omitClumns ...string) error {\n\tsession := cl.engine.NewSession()\n\tdefer session.Close()\n\trows, err := session.Omit(omitClumns...).Id(id).Update(bean)\n\tif rows > 1 {\n\t\t_ = session.Rollback()\n\t\treturn fmt.Errorf(\"修改失败，影响行数: %d \", rows)\n\t}\n\t_ = session.Commit()\n\treturn err\n}\n\n// Delete 删除数据\nfunc (cl *Client) Delete(bean interface{}) error {\n\tsession := cl.engine.NewSession()\n\trows, err := session.Delete(bean)\n\tif rows > 1 {\n\t\t_ = session.Rollback()\n\t\treturn fmt.Errorf(\"修改失败，影响行数: %d \", rows)\n\t}\n\t_ = session.Commit()\n\treturn err\n}\n\n// // Query 多数据查询\n// func (cl *Client) Query(beans interface{}, querystring string, args ...interface{}) error {\n// \treturn cl.engine.Where(querystring, args...).Find(beans)\n// }\n\n// Where 条件查询\nfunc (cl *Client) Where(beans interface{}, querystring string, args ...interface{}) error {\n\treturn cl.engine.Where(querystring, args...).Find(beans)\n}\n\n// In 条件查询 IN list\nfunc (cl *Client) In(beans interface{}, querystring string, args ...interface{}) error {\n\treturn cl.engine.In(querystring, args...).Find(beans)\n}\n\n// SQL 查询\nfunc (cl *Client) SQL(beans interface{}, querystring string, args ...interface{}) error {\n\treturn cl.engine.Sql(querystring, args...).Find(beans)\n}\n\n// QueryValue 查询\nfunc (cl *Client) QueryValue(sqlstr string) ([]map[string][]byte, error) {\n\tdata, err := cl.engine.Query(sqlstr)\n\treturn data, err\n}\n\n// Create 新建一个表\nfunc (cl *Client) CreateTables(beans ...interface{}) error {\n\treturn cl.engine.CreateTables(beans...)\n}\n\n// Sync 同步新表\nfunc (cl *Client) Sync(beans ...interface{}) error {\n\treturn cl.engine.Sync(beans...)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/db/client_test.go",
    "content": "package db\n\nimport (\n\t//\"game/player\"\n\t//\"github.com/bmizerany/assert\"\n\t_ \"github.com/lib/pq\"\n\t//l4g \"lib/log4go\"\n\t\"testing\"\n)\n\nconst UCDBURL = \"postgres://postgres:postgres@192.168.1.240:3021/postgres?sslmode=disable\"\n\nfunc Test_NewClient(t *testing.T) {\n\t//l4g.Info(\"test client ...\")\n\n\t//client, err := NewClient(\"postgres\", UCDBURL)\n\t//client.engine.ShowSQL(true)\n\t//assert.Equal(t, err, nil)\n\t//defer client.Close()\n\n\t//l4g.Info(\"Start New Client\", client)\n}\n\nfunc Test_Insert(t *testing.T) {\n\t//client, err := NewClient(\"postgres\", UCDBURL)\n\t//assert.Equal(t, err, nil)\n\t//defer client.Close()\n\t//\n\t//l4g.Info(\"XXXXX\", client)\n\t//client.Insert(&player.User{},)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/filter/filter.go",
    "content": "package filter\n\nimport (\n\t\"bytes\"\n\t_ \"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"os/signal\"\n\t\"sort\"\n\t\"syscall\"\n\t\"time\"\n\t\"github.com/golang/glog\"\n)\n\nvar dicFileTrie map[string]*Trie = make(map[string]*Trie) //map for dictionary file to trie\nvar dicFileTime map[string]int64 = make(map[string]int64) //map for dictionary file to it's built time\n\nfunc LoadDicFiles(dicFiles []string) { //load serveral dictionary file to build tries\n\tfor _, dicFile := range dicFiles {\n\t\tdicFileTrie[dicFile] = nil\n\t\tdicFileTime[dicFile] = 0\n\t}\n\tgo buildDicFileTrie() //asyn build dictionary file trie,when completed the old trie will be replaced\n}\n\nfunc buildDicFileTrie() { //when server start-up the trie will be built automatically\n\tfor {\n\t\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c, syscall.SIGHUP)\n\t\tfor dicFile, _ := range dicFileTrie {\n\t\t\tstat, e := os.Stat(dicFile)\n\t\t\tif e != nil || stat.ModTime().Unix() > dicFileTime[dicFile] { //maybe deleted file or updated file\n\t\t\t\tdata, e := ioutil.ReadFile(dicFile)\n\t\t\t\tif e != nil || len(data) <= 0 { //file not exist or empty\n\t\t\t\t\tdicFileTrie[dicFile] = nil //delete the old trie,maybe concurrency problem\n\t\t\t\t}\n\t\t\t\tdictionary := bytes.Split(data, []byte(\"\\n\"))\n\t\t\t\tvar tree Trie\n\t\t\t\ttree.InitRootNode()\n\t\t\t\ttree.BuildTrie(dictionary)\n\t\t\t\tdicFileTrie[dicFile] = &tree             //replace the old trie,maybe concurrency problem\n\t\t\t\tdicFileTime[dicFile] = time.Now().Unix() //save the replace time\n\t\t\t}\n\t\t}\n\t\t<-c //after we refresh the all dictionary trie we will block to the next SIGHUP signal and refresh the all dictionary trie again\n\t}\n}\n\n//separator charactors,if we want to match \"abcde\" in \"abc112312de\" ,separator charactors can be set to \"123\"\ntype Seps []rune\n\nfunc (s Seps) Len() int {\n\treturn len(s)\n}\nfunc (s Seps) Swap(i, j int) {\n\ts[i], s[j] = s[j], s[i]\n}\nfunc (s Seps) Less(i, j int) bool {\n\treturn s[i] < s[j]\n}\n\nfunc FindSepC(seps Seps, charactor rune) bool {\n\ti := sort.Search(len(seps), func(i int) bool { return seps[i] >= charactor })\n\treturn i < len(seps) && seps[i] == charactor\n}\n\n// we use a dictionary file to filter text,all separator in text will be bypassed,and matched words will be replace by rep\nfunc FilterText(dicFile string, text []rune, seps Seps, rep rune) {\n\tT := dicFileTrie[dicFile] //save trie to temporary variable to eliminate concurrency problem\n\n\tif T == nil { //no matched trie for dictionary file\n\t\treturn\n\t}\n\tsort.Sort(seps)        //sort seps to speed up search process\n\twalkNode := T.RootNode //walk through the trie from root\n\n\tvar nextNode *Node //point to walkNode's next node\n\tfor i, charactor := range text { //travel the text,i is used as an index to present charactor\n\t\tfor {\n\t\t\tif FindSepC(seps, charactor) { //omit charactor in seps\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tnextNode = walkNode.BinGetChildNodeByVal(charactor)\n\t\t\tif nextNode == nil { //not found next node whose val is charactor\n\t\t\t\tif nil != walkNode.SuffixNode { //point to suffix node, redo the find operation,maybe its suffix node is root\n\t\t\t\t\twalkNode = walkNode.SuffixNode\n\t\t\t\t\tcontinue\n\t\t\t\t} else { //only root node's suffix node is null\n\t\t\t\t\twalkNode = T.RootNode //restart from root\n\t\t\t\t\tbreak                 //break to handle next charactor\n\t\t\t\t}\n\t\t\t} else { // find node\n\t\t\t\tif nextNode.EOW { //if a word end up with next node\n\t\t\t\t\tdepth := nextNode.Depth //get the word length\n\t\t\t\t\tj := i                  //search back from i\n\t\t\t\t\tfor depth > 0 { //until to root\n\t\t\t\t\t\tfor j >= 0 && FindSepC(seps, text[j]) { //omit\n\t\t\t\t\t\t\tj--\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif j >= 0 {\n\t\t\t\t\t\t\ttext[j] = rep //replace with rep\n\t\t\t\t\t\t\tj--\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdepth--\n\t\t\t\t\t}\n\t\t\t\t\twalkNode = T.RootNode //restart from root\n\t\t\t\t} else { //not EOW\n\t\t\t\t\twalkNode = nextNode //step to next node\n\t\t\t\t}\n\t\t\t\tbreak //break to handle next charactor\n\t\t\t}\n\t\t}\n\t}\n\n}\n\n\n\n\n// we use a dictionary file to filter text,all separator in text will be bypassed,and matched words will be replace by rep\nfunc IsInValid(dicFile string, text []rune, seps Seps, rep rune)(valid bool) {\n\tT := dicFileTrie[dicFile] //save trie to temporary variable to eliminate concurrency problem\n\n\tif T == nil { //no matched trie for dictionary file\n\t\tglog.Errorf(\"empty is %+v\",T)\n\t\treturn\n\t}\n\tsort.Sort(seps)        //sort seps to speed up search process\n\twalkNode := T.RootNode //walk through the trie from root\n\n\tvar nextNode *Node               //point to walkNode's next node\n\tfor i, charactor := range text { //travel the text,i is used as an index to present charactor\n\t\tfor {\n\t\t\tif FindSepC(seps, charactor) { //omit charactor in seps\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tnextNode = walkNode.BinGetChildNodeByVal(charactor)\n\t\t\tif nextNode == nil { //not found next node whose val is charactor\n\t\t\t\tif nil != walkNode.SuffixNode { //point to suffix node, redo the find operation,maybe its suffix node is root\n\t\t\t\t\twalkNode = walkNode.SuffixNode\n\t\t\t\t\tcontinue\n\t\t\t\t} else { //only root node's suffix node is null\n\t\t\t\t\twalkNode = T.RootNode //restart from root\n\t\t\t\t\tbreak                 //break to handle next charactor\n\t\t\t\t}\n\t\t\t} else { // find node\n\t\t\t\tif nextNode.EOW { //if a word end up with next node\n\t\t\t\t\tdepth := nextNode.Depth //get the word length\n\t\t\t\t\tj := i                  //search back from i\n\t\t\t\t\tfor depth > 0 {         //until to root\n\t\t\t\t\t\tfor j >= 0 && FindSepC(seps, text[j]) { //omit\n\t\t\t\t\t\t\tj--\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif j >= 0 {\n\t\t\t\t\t\t\tvalid=true\n\t\t\t\t\t\t\t//text[j] = rep //replace with rep\n\t\t\t\t\t\t\t//j--\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdepth--\n\t\t\t\t\t}\n\t\t\t\t\twalkNode = T.RootNode //restart from root\n\t\t\t\t} else { //not EOW\n\t\t\t\t\twalkNode = nextNode //step to next node\n\t\t\t\t}\n\t\t\t\tbreak //break to handle next charactor\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/filter/readme.txt",
    "content": "Aho-Corasick is a multiple string matching algorithm\nI implement the algorithm in trie.go\nIn filter.go, I use the built trie to search sensitive words,and filter them out\nIn test1.go, I test the filter function\nIn test2.go, I implement a simple http server, and the dictionary can be asynchronously hot-updated and hot-reloading using command: 'kill -1 pid'\n\ngo run test1.go\ngo run test2.go\n\nI tested for a dictionary file which contains 140W lines of diffrent sensitive phrases and 2100W charactors and totally 35M in size. It takes 50s to build the according trie, and it takes 1.5s to filter the all phrases out from a given text file which is the same to the dictionary file ( the worst case ) in a routine. And the total memory usage of the process is 2.4G\n"
  },
  {
    "path": "src/github.com/dolotech/lib/filter/trie.go",
    "content": "// trie.go: use dictionary words to build FSM\n//          with the help of Aho-Corasick algorithm\n//          which is proficient in searching multiple string pattern in text\n//          with small usage of memory and high speed.\n\npackage filter\n\nimport (\n\t\"container/list\"\n\t\"fmt\"\n\t\"sort\"\n\t\"unicode/utf8\"\n\t\"github.com/golang/glog\"\n)\n\n// In a trie, each node has many child nodes\ntype ChildNodeType []*Node\n\n// Implement the interface which is needed by STL sort function\nfunc (c ChildNodeType) Len() int {\n\treturn len(c)\n}\n\n// Implement the interface which is needed by STL sort function\nfunc (c ChildNodeType) Swap(i, j int) {\n\tc[i], c[j] = c[j], c[i]\n}\n\n// Implement the interface which is needed by STL sort function\nfunc (c ChildNodeType) Less(i, j int) bool {\n\treturn c[i].Val < c[j].Val\n}\n\n// Node used to build trie structure\ntype Node struct {\n\tVal        rune          // val from the parent to the node,or edge, utf-8 encode\n\tDepth      int           // depth of the node from root,root's depth is 0\n\tParentNode *Node         // parent node used to trace back to the root\n\tChildNodes ChildNodeType // child node slice\n\tSuffixNode *Node         // suffix node of the node's longest postfix, represented by root->node1->node2....->suffix\n\tEOW        bool          // end-of-word tag\n}\n\n// get child node by given val\nfunc (N *Node) GetChildNodeByVal(val rune) *Node {\n\tchildNodeNum := len(N.ChildNodes)\n\tfor left := 0; left <= childNodeNum-1; left++ {\n\t\tif N.ChildNodes[left].Val == val {\n\t\t\treturn N.ChildNodes[left]\n\t\t}\n\t}\n\treturn nil\n}\n\n// binary search childnodes with given val\nfunc (N *Node) BinGetChildNodeByVal(val rune) *Node {\n\tright := len(N.ChildNodes) - 1\n\tleft := 0\n\tmid := 0\n\tvar midnode *Node\n\tfor left <= right {\n\t\tmid = (left + right) / 2\n\t\tmidnode = N.ChildNodes[mid]\n\t\tif midnode.Val == val {\n\t\t\treturn midnode\n\t\t} else if midnode.Val < val {\n\t\t\tleft = mid + 1\n\t\t} else if midnode.Val > val {\n\t\t\tright = mid - 1\n\t\t}\n\t}\n\treturn nil\n}\n\n// simplly insert a child node\nfunc (N *Node) InsertChildNodeByVal(val rune) *Node {\n\tnode := new(Node)\n\tnode.Val = val\n\tnode.Depth = N.Depth + 1\n\tnode.ParentNode = N\n\tnode.ChildNodes = nil\n\tnode.SuffixNode = nil\n\tnode.EOW = false\n\tN.ChildNodes = append(N.ChildNodes, node)\n\t//fmt.Printf(\"build %c---->%c\\n\", N.Val, node.Val)\n\treturn node\n}\n\n// Trie\ntype Trie struct {\n\tRootNode *Node // root\n}\n\nfunc (T *Trie) InitRootNode() {\n\tnode := new(Node)\n\tnode.Val = 0\n\tnode.Depth = 0\n\tnode.ParentNode = nil\n\tnode.ChildNodes = nil\n\tnode.SuffixNode = nil\n\tnode.EOW = false\n\tT.RootNode = node\n}\n\n// dump the whole trie which is rooted in node\nfunc (T *Trie) DumpTrie(node *Node) {\n\n\tlst := new(list.List)\n\tlst.PushBack(node)\n\n\tfor lst.Len() > 0 {\n\n\t\tnode := lst.Remove(lst.Front()).(*Node)\n\t\tpnode := node.ParentNode\n\t\tsnode := node.SuffixNode\n\n\t\tvar adr *Node = nil\n\t\tvar padr *Node = nil\n\t\tvar sadr *Node = nil\n\t\tvar cadr *Node = nil\n\n\t\tvar val rune = 0\n\t\tvar pval rune = 0\n\t\tvar sval rune = 0\n\t\tvar cval rune = 0\n\n\t\tval = node.Val\n\t\tadr = node\n\n\t\tif pnode != nil {\n\t\t\tpval = pnode.Val\n\t\t\tpadr = pnode\n\t\t}\n\n\t\tif snode != nil {\n\t\t\tsval = snode.Val\n\t\t\tsadr = snode\n\t\t}\n\n\t\tglog.Infof(\"adr:%p  val:%c  depth:%d  padr:%p  pval:%c  sadr:%p  sval:%c  eow:%v\\n\", adr, val, node.Depth, padr, pval, sadr, sval, node.EOW)\n\n\t\tfor _, child := range node.ChildNodes {\n\t\t\tcadr = child\n\t\t\tcval = child.Val\n\t\t\tglog.Infof(\"-------------->cadr:%p  cval:%c\\n\", cadr, cval)\n\t\t\tlst.PushBack(child)\n\t\t}\n\t}\n}\n\n// trace from a node to root, root and the node are both contained in return\nfunc (T *Trie) TraceBackToRoot(node *Node) []*Node {\n\tdepth := node.Depth\n\tnodes := make([]*Node, depth+1)\n\tnodes[0] = T.RootNode\n\tfor tmpnode := node; tmpnode != nil; tmpnode = tmpnode.ParentNode {\n\t\tnodes[depth] = tmpnode\n\t\tdepth--\n\t}\n\treturn nodes\n}\n\n// find a node the path to which can be represented by value of nodes arr\nfunc (T *Trie) FindNodeByPath(nodes []*Node) *Node { //nodes not contain root node\n\ttmpnode := T.RootNode\n\tfor i, node := range nodes {\n\t\ttmpnode = tmpnode.GetChildNodeByVal(node.Val)\n\t\tif tmpnode == nil || tmpnode.Val != node.Val {\n\t\t\treturn nil\n\t\t} else if i == len(nodes)-1 {\n\t\t\treturn tmpnode\n\t\t}\n\t}\n\treturn nil\n}\n\n// build trie by given dictionary,each line in dictionary is a word\nfunc (T *Trie) BuildTrie(dictionary [][]byte) {\n\tfor _, line := range dictionary {\n\t\tif len(line) <= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tparent := T.RootNode //when we handle a word, we start from rootnode\n\t\tfor len(line) > 0 {\n\t\t\tcharactor, length := utf8.DecodeRune(line) //each time get a rune and its size in bytes\n\t\t\tif length <= 0 {\n\t\t\t\tbreak //maybe not handle whole line\n\t\t\t}\n\t\t\tchild := parent.GetChildNodeByVal(charactor)\n\t\t\tif child == nil {\n\t\t\t\tchild = parent.InsertChildNodeByVal(charactor)\n\t\t\t}\n\t\t\tparent = child\n\t\t\tline = line[length:]\n\t\t}\n\t\tif parent != T.RootNode {\n\t\t\tparent.EOW = true // if len(line)>0 and rightly handle at least one charactor, we tag the node as EOW\n\t\t}\n\t} // now a trie is built\n\n\tlst := new(list.List)\n\tlst.PushBack(T.RootNode) // start from root node , we find suffix node of each node\n\n\tfor lst.Len() > 0 {\n\t\tnode := lst.Remove(lst.Front()).(*Node)\n\t\tsort.Sort(node.ChildNodes)              //sort the child nodes to use binary search\n\t\tfor _, child := range node.ChildNodes { //each time we get a child\n\t\t\tlst.PushBack(child)\n\t\t\tstartDepth := 2            //only nodes whose depth>=2 have suffix node\n\t\t\tsearchDepth := child.Depth //search from child's depth\n\t\t\tvar suffixNode *Node\n\t\t\tif searchDepth >= startDepth { // only nodes whose depth is bigger or equal to 2 are considered\n\t\t\t\tpathToRoot := T.TraceBackToRoot(child) //pathToRoot is root->level1node->level2node->level3node......\n\t\t\t\tfor startDepth <= searchDepth {\n\t\t\t\t\tsuffixNode = T.FindNodeByPath(pathToRoot[startDepth : searchDepth+1]) //just start from level2node\n\t\t\t\t\tif suffixNode != nil {                                                //if find,we break,because we just care the longest postfix\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tstartDepth++ //each time we add startDepth the postfix is shortened\n\t\t\t\t}\n\t\t\t}\n\t\t\tif suffixNode != nil {\n\t\t\t\tchild.SuffixNode = suffixNode // found\n\t\t\t} else {\n\t\t\t\tchild.SuffixNode = T.RootNode // if not found or level1 nodes ,root is set, so we can ensure that every node has a suffix node\n\t\t\t}\n\t\t}\n\t}\n\t//T.DumpTrie(T.RootNode)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/goevent/go_event.go",
    "content": "package goevent\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sync\"\n)\n\n\ntype Event struct {\n\tlisteners []reflect.Value\n\tlmu       sync.RWMutex\n\n\targTypes []reflect.Type\n\ttmu      sync.RWMutex\n}\n\nfunc (p *Event) Trigger(args ...interface{}) error {\n\n\targuments := make([]reflect.Value, 0, len(args))\n\targTypes := make([]reflect.Type, 0, len(args))\n\tfor _, v := range args {\n\t\targuments = append(arguments, reflect.ValueOf(v))\n\t\targTypes = append(argTypes, reflect.TypeOf(v))\n\t}\n\n\terr := p.validateArgs(argTypes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.lmu.RLock()\n\tdefer p.lmu.RUnlock()\n\n\twg := sync.WaitGroup{}\n\twg.Add(len(p.listeners))\n\tfor _, fn := range p.listeners {\n\t\tgo func(f reflect.Value) {\n\t\t\tdefer wg.Done()\n\t\t\tf.Call(arguments)\n\t\t}(fn)\n\t}\n\n\twg.Wait()\n\treturn nil\n}\n\n// Start to listen an Event.\nfunc (p *Event) On(f interface{}) error {\n\tfn, err := p.checkFuncSignature(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.lmu.Lock()\n\tdefer p.lmu.Unlock()\n\tp.listeners = append(p.listeners, *fn)\n\n\treturn nil\n}\n\n// Stop listening an Event.\nfunc (p *Event) Off(f interface{}) error {\n\tfn := reflect.ValueOf(f)\n\n\tp.lmu.Lock()\n\tdefer p.lmu.Unlock()\n\tl := len(p.listeners)\n\tm := l // for error check\n\tfor i := 0; i < l; i++ {\n\t\tif fn == p.listeners[i] {\n\t\t\t// XXX: GC Ref: http://jxck.hatenablog.com/entry/golang-slice-internals\n\t\t\tp.listeners = append(p.listeners[:i], p.listeners[i+1:]...)\n\t\t\tl--\n\t\t\ti--\n\t\t}\n\t}\n\n\tif l == m {\n\t\treturn fmt.Errorf(\"Listener does't exists\")\n\t}\n\treturn nil\n}\n\n// retrun function as reflect.Value\n// retrun error if f isn't function, argument is invalid\nfunc (p *Event) checkFuncSignature(f interface{}) (*reflect.Value, error) {\n\tfn := reflect.ValueOf(f)\n\tif fn.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Argument should be a function\")\n\t}\n\n\ttypes := fnArgTypes(fn)\n\n\tp.lmu.RLock()\n\tdefer p.lmu.RUnlock()\n\tif len(p.listeners) == 0 {\n\t\tp.tmu.Lock()\n\t\tdefer p.tmu.Unlock()\n\t\tp.argTypes = types\n\t\treturn &fn, nil\n\t}\n\n\terr := p.validateArgs(types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &fn, nil\n}\n\n// if argument size or type are different return error.\nfunc (p *Event) validateArgs(types []reflect.Type) error {\n\tp.tmu.RLock()\n\tdefer p.tmu.RUnlock()\n\tif len(types) != len(p.argTypes) {\n\t\treturn fmt.Errorf(\"Argument length expected %d, but got %d\", len(p.argTypes), len(types))\n\t}\n\tfor i, t := range types {\n\t\tif t != p.argTypes[i] {\n\t\t\treturn fmt.Errorf(\"Argument Error. Args[%d] expected %s, but got %s\", i, p.argTypes[i], t)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// return argument types.\nfunc fnArgTypes(fn reflect.Value) []reflect.Type {\n\tfnType := fn.Type()\n\tfnNum := fnType.NumIn()\n\n\ttypes := make([]reflect.Type, 0, fnNum)\n\n\tfor i := 0; i < fnNum; i++ {\n\t\ttypes = append(types, fnType.In(i))\n\t}\n\n\treturn types\n}"
  },
  {
    "path": "src/github.com/dolotech/lib/grpool/grpool.go",
    "content": "package grpool\n\nimport (\n\t\"sync\"\n)\n\n// Gorouting instance which can accept client jobs\ntype worker struct {\n\tworkerPool chan *worker\n\tjobChannel chan Job\n\tstop       chan struct{}\n}\n\nfunc (w *worker) start() {\n\tgo func() {\n\t\tvar job Job\n\t\tfor {\n\t\t\t// worker free, add it to pool\n\t\t\tw.workerPool <- w\n\n\t\t\tselect {\n\t\t\tcase job = <-w.jobChannel:\n\t\t\t\tjob()\n\t\t\tcase <-w.stop:\n\t\t\t\tw.stop <- struct{}{}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}\n\nfunc newWorker(pool chan *worker) *worker {\n\treturn &worker{\n\t\tworkerPool: pool,\n\t\tjobChannel: make(chan Job),\n\t\tstop:       make(chan struct{}),\n\t}\n}\n\n// Accepts jobs from clients, and waits for first free worker to deliver job\ntype dispatcher struct {\n\tworkerPool chan *worker\n\tjobQueue   chan Job\n\tstop       chan struct{}\n}\n\nfunc (d *dispatcher) dispatch() {\n\tfor {\n\t\tselect {\n\t\tcase job := <-d.jobQueue:\n\t\t\tworker := <-d.workerPool\n\t\t\tworker.jobChannel <- job\n\t\tcase <-d.stop:\n\t\t\tfor i := 0; i < cap(d.workerPool); i++ {\n\t\t\t\tworker := <-d.workerPool\n\n\t\t\t\tworker.stop <- struct{}{}\n\t\t\t\t<-worker.stop\n\t\t\t}\n\n\t\t\td.stop <- struct{}{}\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc newDispatcher(workerPool chan *worker, jobQueue chan Job) *dispatcher {\n\td := &dispatcher{\n\t\tworkerPool: workerPool,\n\t\tjobQueue:   jobQueue,\n\t\tstop:       make(chan struct{}),\n\t}\n\n\tfor i := 0; i < cap(d.workerPool); i++ {\n\t\tworker := newWorker(d.workerPool)\n\t\tworker.start()\n\t}\n\n\tgo d.dispatch()\n\treturn d\n}\n\n// Represents user request, function which should be executed in some worker.\ntype Job func()\n\ntype Pool struct {\n\tJobQueue   chan Job\n\tdispatcher *dispatcher\n\twg         sync.WaitGroup\n}\n\n// Will make pool of gorouting workers.\n// numWorkers - how many workers will be created for this pool\n// queueLen - how many jobs can we accept until we block\n//\n// Returned object contains JobQueue reference, which you can use to send job to pool.\nfunc NewPool(numWorkers int, jobQueueLen int) *Pool {\n\tjobQueue := make(chan Job, jobQueueLen)\n\tworkerPool := make(chan *worker, numWorkers)\n\n\tpool := &Pool{\n\t\tJobQueue:   jobQueue,\n\t\tdispatcher: newDispatcher(workerPool, jobQueue),\n\t}\n\n\treturn pool\n}\n\n// In case you are using WaitAll fn, you should call this method\n// every time your job is done.\n//\n// If you are not using WaitAll then we assume you have your own way of synchronizing.\nfunc (p *Pool) JobDone() {\n\tp.wg.Done()\n}\n\n// How many jobs we should wait when calling WaitAll.\n// It is using WaitGroup Add/Done/Wait\nfunc (p *Pool) WaitCount(count int) {\n\tp.wg.Add(count)\n}\n\n// Will wait for all jobs to finish.\nfunc (p *Pool) WaitAll() {\n\tp.wg.Wait()\n}\n\n// Will release resources used by pool\nfunc (p *Pool) Release() {\n\tp.dispatcher.stop <- struct{}{}\n\t<-p.dispatcher.stop\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/grpool/grpool_test.go",
    "content": "\npackage grpool\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"runtime\"\n\t\"sync/atomic\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc init() {\n\tprintln(\"using MAXPROC\")\n\tnumCPUs := runtime.NumCPU()\n\truntime.GOMAXPROCS(numCPUs)\n}\n\nfunc TestNewWorker(t *testing.T) {\n\tpool := make(chan *worker)\n\tworker := newWorker(pool)\n\tworker.start()\n\tassert.NotNil(t, worker)\n\n\tworker = <-pool\n\tassert.NotNil(t, worker, \"Worker should register itself to the pool\")\n\n\tcalled := false\n\tdone := make(chan bool)\n\n\tjob := func() {\n\t\tcalled = true\n\t\tdone <- true\n\t}\n\n\tworker.jobChannel <- job\n\t<-done\n\tassert.Equal(t, true, called)\n}\n\nfunc TestNewPool(t *testing.T) {\n\tpool := NewPool(1000, 10000)\n\tdefer pool.Release()\n\n\titerations := 1000000\n\tpool.WaitCount(iterations)\n\tvar counter uint64 = 0\n\n\tfor i := 0; i < iterations; i++ {\n\t\targ := uint64(1)\n\n\t\tjob := func() {\n\t\t\tdefer pool.JobDone()\n\t\t\tatomic.AddUint64(&counter, arg)\n\t\t\tassert.Equal(t, uint64(1), arg)\n\t\t}\n\n\t\tpool.JobQueue <- job\n\t}\n\n\tpool.WaitAll()\n\n\tcounterFinal := atomic.LoadUint64(&counter)\n\tassert.Equal(t, uint64(iterations), counterFinal)\n}\n\nfunc TestRelease(t *testing.T) {\n\tgrNum := runtime.NumGoroutine()\n\tpool := NewPool(5, 10)\n\n\t//t.Log(runtime.NumCPU())\n\tdefer func() {\n\t\tpool.Release()\n\n\t\t// give some time for all goroutines to quit\n\t\tassert.Equal(t, grNum, runtime.NumGoroutine(), \"All goroutines should be released after Release() call\")\n\t}()\n\n\tpool.WaitCount(1000)\n\n\tfor i := 0; i < 1000; i++ {\n\t\tjob := func() {\n\t\t\tdefer pool.JobDone()\n\t\t}\n\n\t\tpool.JobQueue <- job\n\t}\n\tt.Log(runtime.NumCPU())\n\tpool.WaitAll()\n}\n\nfunc BenchmarkPool(b *testing.B) {\n\t// Testing with just 1 goroutine\n\t// to benchmark the non-parallel part of the code\n\tpool := NewPool(1, 10)\n\tdefer pool.Release()\n\n\tlog.SetOutput(ioutil.Discard)\n\n\tfor n := 0; n < b.N; n++ {\n\t\tpool.JobQueue <- func() {\n\t\t\tlog.Printf(\"I am worker! Number %d\\n\", n)\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_darwin.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n\npackage pse\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n)\n\n// ProcUsage returns CPU usage\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\tpidStr := fmt.Sprintf(\"%d\", os.Getpid())\n\tout, err := exec.Command(\"ps\", \"o\", \"pcpu=,rss=,vsz=\", \"-p\", pidStr).Output()\n\tif err != nil {\n\t\t*rss, *vss = -1, -1\n\t\treturn fmt.Errorf(\"ps call failed:%v\", err)\n\t}\n\tfmt.Sscanf(string(out), \"%f %d %d\", pcpu, rss, vss)\n\t*rss *= 1024 // 1k blocks, want bytes.\n\t*vss *= 1024 // 1k blocks, want bytes.\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_freebsd.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n\npackage pse\n\n/*\n#include <sys/types.h>\n#include <sys/sysctl.h>\n#include <sys/user.h>\n#include <stddef.h>\n#include <unistd.h>\n\nlong pagetok(long size)\n{\n    int pageshift, pagesize;\n\n    pagesize = getpagesize();\n    pageshift = 0;\n\n    while (pagesize > 1) {\n        pageshift++;\n        pagesize >>= 1;\n    }\n\n    return (size << pageshift);\n}\n\nint getusage(double *pcpu, unsigned int *rss, unsigned int *vss)\n{\n    int mib[4], ret;\n    size_t len;\n    struct kinfo_proc kp;\n\n    len = 4;\n    sysctlnametomib(\"kern.proc.pid\", mib, &len);\n\n    mib[3] = getpid();\n    len = sizeof(kp);\n\n    ret = sysctl(mib, 4, &kp, &len, NULL, 0);\n    if (ret != 0) {\n        return (errno);\n    }\n\n    *rss = pagetok(kp.ki_rssize);\n    *vss = kp.ki_size;\n    *pcpu = kp.ki_pctcpu;\n\n    return 0;\n}\n\n*/\nimport \"C\"\n\nimport (\n\t\"syscall\"\n)\n\n// This is a placeholder for now.\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\tvar r, v C.uint\n\tvar c C.double\n\n\tif ret := C.getusage(&c, &r, &v); ret != 0 {\n\t\treturn syscall.Errno(ret)\n\t}\n\n\t*pcpu = float64(c)\n\t*rss = int64(r)\n\t*vss = int64(v)\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_linux.go",
    "content": "// Copyright 2015 Apcera Inc. All rights reserved.\n\npackage pse\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"sync/atomic\"\n\t\"syscall\"\n\t\"time\"\n)\n\nvar (\n\tprocStatFile string\n\tticks        int64\n\tlastTotal    int64\n\tlastSeconds  int64\n\tipcpu        int64\n)\n\nconst (\n\tutimePos = 13\n\tstimePos = 14\n\tstartPos = 21\n\tvssPos   = 22\n\trssPos   = 23\n)\n\nfunc init() {\n\t// Avoiding to generate docker image without CGO\n\tticks = 100 // int64(C.sysconf(C._SC_CLK_TCK))\n\tprocStatFile = fmt.Sprintf(\"/proc/%d/stat\", os.Getpid())\n\tperiodic()\n}\n\n// Sampling function to keep pcpu relevant.\nfunc periodic() {\n\tcontents, err := ioutil.ReadFile(procStatFile)\n\tif err != nil {\n\t\treturn\n\t}\n\tfields := bytes.Fields(contents)\n\n\t// PCPU\n\tpstart := parseInt64(fields[startPos])\n\tutime := parseInt64(fields[utimePos])\n\tstime := parseInt64(fields[stimePos])\n\ttotal := utime + stime\n\n\tvar sysinfo syscall.Sysinfo_t\n\tif err := syscall.Sysinfo(&sysinfo); err != nil {\n\t\treturn\n\t}\n\n\tseconds := int64(sysinfo.Uptime) - (pstart / ticks)\n\n\t// Save off temps\n\tlt := lastTotal\n\tls := lastSeconds\n\n\t// Update last sample\n\tlastTotal = total\n\tlastSeconds = seconds\n\n\t// Adjust to current time window\n\ttotal -= lt\n\tseconds -= ls\n\n\tif seconds > 0 {\n\t\tatomic.StoreInt64(&ipcpu, (total*1000/ticks)/seconds)\n\t}\n\n\ttime.AfterFunc(1*time.Second, periodic)\n}\n\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\tcontents, err := ioutil.ReadFile(procStatFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfields := bytes.Fields(contents)\n\n\t// Memory\n\t*rss = (parseInt64(fields[rssPos])) << 12\n\t*vss = parseInt64(fields[vssPos])\n\n\t// PCPU\n\t// We track this with periodic sampling, so just load and go.\n\t*pcpu = float64(atomic.LoadInt64(&ipcpu)) / 10.0\n\n\treturn nil\n}\n\n// Ascii numbers 0-9\nconst (\n\tasciiZero = 48\n\tasciiNine = 57\n)\n\n// parseInt64 expects decimal positive numbers. We\n// return -1 to signal error\nfunc parseInt64(d []byte) (n int64) {\n\tif len(d) == 0 {\n\t\treturn -1\n\t}\n\tfor _, dec := range d {\n\t\tif dec < asciiZero || dec > asciiNine {\n\t\t\treturn -1\n\t\t}\n\t\tn = n*10 + (int64(dec) - asciiZero)\n\t}\n\treturn n\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_rumprun.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n// +build rumprun\n\npackage pse\n\n// This is a placeholder for now.\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\t*pcpu = 0.0\n\t*rss = 0\n\t*vss = 0\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_solaris.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n\npackage pse\n\n// This is a placeholder for now.\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\t*pcpu = 0.0\n\t*rss = 0\n\t*vss = 0\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_test.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n\npackage pse\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n\t\"runtime\"\n\t\"testing\"\n)\n\nfunc TestPSEmulation(t *testing.T) {\n\tif runtime.GOOS == \"windows\" {\n\t\tt.Skipf(\"Skipping this test on Windows\")\n\t}\n\tvar rss, vss, psRss, psVss int64\n\tvar pcpu, psPcpu float64\n\n\truntime.GC()\n\n\t// PS version first\n\tpidStr := fmt.Sprintf(\"%d\", os.Getpid())\n\tout, err := exec.Command(\"ps\", \"o\", \"pcpu=,rss=,vsz=\", \"-p\", pidStr).Output()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to execute ps command: %v\\n\", err)\n\t}\n\n\tfmt.Sscanf(string(out), \"%f %d %d\", &psPcpu, &psRss, &psVss)\n\tpsRss *= 1024 // 1k blocks, want bytes.\n\tpsVss *= 1024 // 1k blocks, want bytes.\n\n\truntime.GC()\n\n\t// Our internal version\n\tProcUsage(&pcpu, &rss, &vss)\n\n\tif pcpu != psPcpu {\n\t\tdelta := int64(pcpu - psPcpu)\n\t\tif delta < 0 {\n\t\t\tdelta = -delta\n\t\t}\n\t\tif delta > 30 { // 30%?\n\t\t\tt.Fatalf(\"CPUs did not match close enough: %f vs %f\", pcpu, psPcpu)\n\t\t}\n\t}\n\tif rss != psRss {\n\t\tdelta := rss - psRss\n\t\tif delta < 0 {\n\t\t\tdelta = -delta\n\t\t}\n\t\tif delta > 1024*1024 { // 1MB\n\t\t\tt.Fatalf(\"RSSs did not match close enough: %d vs %d\", rss, psRss)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_windows.go",
    "content": "// Copyright 2015-2016 Apcera Inc. All rights reserved.\n// +build windows\n\npackage pse\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"sync\"\n\t\"syscall\"\n\t\"time\"\n\t\"unsafe\"\n)\n\nvar (\n\tpdh                            = syscall.NewLazyDLL(\"pdh.dll\")\n\twinPdhOpenQuery                = pdh.NewProc(\"PdhOpenQuery\")\n\twinPdhAddCounter               = pdh.NewProc(\"PdhAddCounterW\")\n\twinPdhCollectQueryData         = pdh.NewProc(\"PdhCollectQueryData\")\n\twinPdhGetFormattedCounterValue = pdh.NewProc(\"PdhGetFormattedCounterValue\")\n\twinPdhGetFormattedCounterArray = pdh.NewProc(\"PdhGetFormattedCounterArrayW\")\n)\n\n// global performance counter query handle and counters\nvar (\n\tpcHandle                                       PDH_HQUERY\n\tpidCounter, cpuCounter, rssCounter, vssCounter PDH_HCOUNTER\n\tprevCPU                                        float64\n\tprevRss                                        int64\n\tprevVss                                        int64\n\tlastSampleTime                                 time.Time\n\tprocessPid                                     int\n\tpcQueryLock                                    sync.Mutex\n\tinitialSample                                  = true\n)\n\n// maxQuerySize is the number of values to return from a query.\n// It represents the maximum # of servers that can be queried\n// simultaneously running on a machine.\nconst maxQuerySize = 512\n\n// Keep static memory around to reuse; this works best for passing\n// into the pdh API.\nvar counterResults [maxQuerySize]PDH_FMT_COUNTERVALUE_ITEM_DOUBLE\n\n// PDH Types\ntype (\n\tPDH_HQUERY   syscall.Handle\n\tPDH_HCOUNTER syscall.Handle\n)\n\n// PDH constants used here\nconst (\n\tPDH_FMT_DOUBLE   = 0x00000200\n\tPDH_INVALID_DATA = 0xC0000BC6\n\tPDH_MORE_DATA    = 0x800007D2\n)\n\n// PDH_FMT_COUNTERVALUE_DOUBLE - double value\ntype PDH_FMT_COUNTERVALUE_DOUBLE struct {\n\tCStatus     uint32\n\tDoubleValue float64\n}\n\n// PDH_FMT_COUNTERVALUE_ITEM_DOUBLE is an array\n// element of a double value\ntype PDH_FMT_COUNTERVALUE_ITEM_DOUBLE struct {\n\tSzName   *uint16 // pointer to a string\n\tFmtValue PDH_FMT_COUNTERVALUE_DOUBLE\n}\n\nfunc pdhAddCounter(hQuery PDH_HQUERY, szFullCounterPath string, dwUserData uintptr, phCounter *PDH_HCOUNTER) error {\n\tptxt, _ := syscall.UTF16PtrFromString(szFullCounterPath)\n\tr0, _, _ := winPdhAddCounter.Call(\n\t\tuintptr(hQuery),\n\t\tuintptr(unsafe.Pointer(ptxt)),\n\t\tdwUserData,\n\t\tuintptr(unsafe.Pointer(phCounter)))\n\n\tif r0 != 0 {\n\t\treturn fmt.Errorf(\"pdhAddCounter failed. %d\", r0)\n\t}\n\treturn nil\n}\n\nfunc pdhOpenQuery(datasrc *uint16, userdata uint32, query *PDH_HQUERY) error {\n\tr0, _, _ := syscall.Syscall(winPdhOpenQuery.Addr(), 3, 0, uintptr(userdata), uintptr(unsafe.Pointer(query)))\n\tif r0 != 0 {\n\t\treturn fmt.Errorf(\"pdhOpenQuery failed - %d\", r0)\n\t}\n\treturn nil\n}\n\nfunc pdhCollectQueryData(hQuery PDH_HQUERY) error {\n\tr0, _, _ := winPdhCollectQueryData.Call(uintptr(hQuery))\n\tif r0 != 0 {\n\t\treturn fmt.Errorf(\"pdhCollectQueryData failed - %d\", r0)\n\t}\n\treturn nil\n}\n\n// pdhGetFormattedCounterArrayDouble returns the value of return code\n// rather than error, to easily check return codes\nfunc pdhGetFormattedCounterArrayDouble(hCounter PDH_HCOUNTER, lpdwBufferSize *uint32, lpdwBufferCount *uint32, itemBuffer *PDH_FMT_COUNTERVALUE_ITEM_DOUBLE) uint32 {\n\tret, _, _ := winPdhGetFormattedCounterArray.Call(\n\t\tuintptr(hCounter),\n\t\tuintptr(PDH_FMT_DOUBLE),\n\t\tuintptr(unsafe.Pointer(lpdwBufferSize)),\n\t\tuintptr(unsafe.Pointer(lpdwBufferCount)),\n\t\tuintptr(unsafe.Pointer(itemBuffer)))\n\n\treturn uint32(ret)\n}\n\nfunc getCounterArrayData(counter PDH_HCOUNTER) ([]float64, error) {\n\tvar bufSize uint32\n\tvar bufCount uint32\n\n\t// Retrieving array data requires two calls, the first which\n\t// requires an addressable empty buffer, and sets size fields.\n\t// The second call returns the data.\n\tinitialBuf := make([]PDH_FMT_COUNTERVALUE_ITEM_DOUBLE, 1)\n\tret := pdhGetFormattedCounterArrayDouble(counter, &bufSize, &bufCount, &initialBuf[0])\n\tif ret == PDH_MORE_DATA {\n\t\t// we'll likely never get here, but be safe.\n\t\tif bufCount > maxQuerySize {\n\t\t\tbufCount = maxQuerySize\n\t\t}\n\t\tret = pdhGetFormattedCounterArrayDouble(counter, &bufSize, &bufCount, &counterResults[0])\n\t\tif ret == 0 {\n\t\t\trv := make([]float64, bufCount)\n\t\t\tfor i := 0; i < int(bufCount); i++ {\n\t\t\t\trv[i] = counterResults[i].FmtValue.DoubleValue\n\t\t\t}\n\t\t\treturn rv, nil\n\t\t}\n\t}\n\tif ret != 0 {\n\t\treturn nil, fmt.Errorf(\"getCounterArrayData failed - %d\", ret)\n\t}\n\n\treturn nil, nil\n}\n\n// getProcessImageName returns the name of the process image, as expected by\n// the performance counter API.\nfunc getProcessImageName() (name string) {\n\tname = filepath.Base(os.Args[0])\n\tname = strings.TrimRight(name, \".exe\")\n\treturn\n}\n\n// initialize our counters\nfunc initCounters() (err error) {\n\n\tprocessPid = os.Getpid()\n\t// require an addressible nil pointer\n\tvar source uint16\n\tif err := pdhOpenQuery(&source, 0, &pcHandle); err != nil {\n\t\treturn err\n\t}\n\n\t// setup the performance counters, search for all server instances\n\tname := fmt.Sprintf(\"%s*\", getProcessImageName())\n\tpidQuery := fmt.Sprintf(\"\\\\Process(%s)\\\\ID Process\", name)\n\tcpuQuery := fmt.Sprintf(\"\\\\Process(%s)\\\\%% Processor Time\", name)\n\trssQuery := fmt.Sprintf(\"\\\\Process(%s)\\\\Working Set - Private\", name)\n\tvssQuery := fmt.Sprintf(\"\\\\Process(%s)\\\\Virtual Bytes\", name)\n\n\tif err = pdhAddCounter(pcHandle, pidQuery, 0, &pidCounter); err != nil {\n\t\treturn err\n\t}\n\tif err = pdhAddCounter(pcHandle, cpuQuery, 0, &cpuCounter); err != nil {\n\t\treturn err\n\t}\n\tif err = pdhAddCounter(pcHandle, rssQuery, 0, &rssCounter); err != nil {\n\t\treturn err\n\t}\n\tif err = pdhAddCounter(pcHandle, vssQuery, 0, &vssCounter); err != nil {\n\t\treturn err\n\t}\n\n\t// prime the counters by collecting once, and sleep to get somewhat\n\t// useful information the first request.  Counters for the CPU require\n\t// at least two collect calls.\n\tif err = pdhCollectQueryData(pcHandle); err != nil {\n\t\treturn err\n\t}\n\ttime.Sleep(50)\n\n\treturn nil\n}\n\n// ProcUsage returns process CPU and memory statistics\nfunc ProcUsage(pcpu *float64, rss, vss *int64) error {\n\tvar err error\n\n\n\t\n\t// For simplicity, protect the entire call.\n\t// Most simultaneous requests will immediately return\n\t// with cached values.\n\tpcQueryLock.Lock()\n\tdefer pcQueryLock.Unlock()\n\n\t// First time through, initialize counters.\n\tif initialSample {\n\t\tif err = initCounters(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinitialSample = false\n\t} else if time.Since(lastSampleTime) < (2 * time.Second) {\n\t\t// only refresh every two seconds as to minimize impact\n\t\t// on the server.\n\t\t*pcpu = prevCPU\n\t\t*rss = prevRss\n\t\t*vss = prevVss\n\t\treturn nil\n\t}\n\n\t// always save the sample time, even on errors.\n\tdefer func() {\n\t\tlastSampleTime = time.Now()\n\t}()\n\n\t// refresh the performance counter data\n\tif err = pdhCollectQueryData(pcHandle); err != nil {\n\t\treturn err\n\t}\n\n\t// retrieve the data\n\tvar pidAry, cpuAry, rssAry, vssAry []float64\n\tif pidAry, err = getCounterArrayData(pidCounter); err != nil {\n\t\treturn err\n\t}\n\tif cpuAry, err = getCounterArrayData(cpuCounter); err != nil {\n\t\treturn err\n\t}\n\tif rssAry, err = getCounterArrayData(rssCounter); err != nil {\n\t\treturn err\n\t}\n\tif vssAry, err = getCounterArrayData(vssCounter); err != nil {\n\t\treturn err\n\t}\n\t// find the index of the entry for this process\n\tidx := int(-1)\n\tfor i := range pidAry {\n\t\tif int(pidAry[i]) == processPid {\n\t\t\tidx = i\n\t\t\tbreak\n\t\t}\n\t}\n\t// no pid found...\n\tif idx < 0 {\n\t\treturn fmt.Errorf(\"could not find pid in performance counter results\")\n\t}\n\t// assign values from the performance counters\n\t*pcpu = cpuAry[idx]\n\t*rss = int64(rssAry[idx])\n\t*vss = int64(vssAry[idx])\n\n\t// save off cache values\n\tprevCPU = *pcpu\n\tprevRss = *rss\n\tprevVss = *vss\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/pse/pse_windows_test.go",
    "content": "// Copyright 2016 Apcera Inc. All rights reserved.\n// +build windows\n\npackage pse\n\nimport (\n\t\"fmt\"\n\t\"os/exec\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc checkValues(t *testing.T, pcpu, tPcpu float64, rss, tRss int64) {\n\tif pcpu != tPcpu {\n\t\tdelta := int64(pcpu - tPcpu)\n\t\tif delta < 0 {\n\t\t\tdelta = -delta\n\t\t}\n\t\tif delta > 30 { // 30%?\n\t\t\tt.Fatalf(\"CPUs did not match close enough: %f vs %f\", pcpu, tPcpu)\n\t\t}\n\t}\n\tif rss != tRss {\n\t\tdelta := rss - tRss\n\t\tif delta < 0 {\n\t\t\tdelta = -delta\n\t\t}\n\t\tif delta > 1024*1024 { // 1MB\n\t\t\tt.Fatalf(\"RSSs did not match close enough: %d vs %d\", rss, tRss)\n\t\t}\n\t}\n}\n\nfunc TestPSEmulationWin(t *testing.T) {\n\tvar pcpu, tPcpu float64\n\tvar rss, vss, tRss int64\n\n\truntime.GC()\n\n\tif err := ProcUsage(&pcpu, &rss, &vss); err != nil {\n\t\tt.Fatalf(\"Error:  %v\", err)\n\t}\n\n\truntime.GC()\n\n\timageName := getProcessImageName()\n\t// query the counters using typeperf\n\tout, err := exec.Command(\"typeperf.exe\",\n\t\tfmt.Sprintf(\"\\\\Process(%s)\\\\%% Processor Time\", imageName),\n\t\tfmt.Sprintf(\"\\\\Process(%s)\\\\Working Set - Private\", imageName),\n\t\tfmt.Sprintf(\"\\\\Process(%s)\\\\Virtual Bytes\", imageName),\n\t\t\"-sc\", \"1\").Output()\n\tif err != nil {\n\t\tt.Fatal(\"unable to run command\", err)\n\t}\n\n\t// parse out results - refer to comments in procUsage for detail\n\tresults := strings.Split(string(out), \"\\r\\n\")\n\tvalues := strings.Split(results[2], \",\")\n\n\t// parse pcpu\n\ttPcpu, err = strconv.ParseFloat(strings.Trim(values[1], \"\\\"\"), 64)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to parse percent cpu: %s\", values[1])\n\t}\n\n\t// parse private bytes (rss)\n\tfval, err := strconv.ParseFloat(strings.Trim(values[2], \"\\\"\"), 64)\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to parse private bytes: %s\", values[2])\n\t}\n\ttRss = int64(fval)\n\n\tcheckValues(t, pcpu, tPcpu, rss, tRss)\n\n\truntime.GC()\n\n\t// Again to test caching\n\tif err = ProcUsage(&pcpu, &rss, &vss); err != nil {\n\t\tt.Fatalf(\"Error:  %v\", err)\n\t}\n\tcheckValues(t, pcpu, tPcpu, rss, tRss)\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/route/route_msg.go",
    "content": "package route\n\nimport (\n\t\"reflect\"\n\t\"github.com/golang/glog\"\n)\n\ntype Route map[string]*reflect.Value\n\nfunc (this *Route) Emit(msg interface{}, arg ...interface{}) {\n\tif *this != nil {\n\t\tmsgID := reflect.TypeOf(msg).Elem().Name()\n\t\tif f, ok := (*this)[msgID]; ok {\n\t\t\tarray := make([]reflect.Value, len(arg)+1)\n\t\t\tarray[0] = reflect.ValueOf(msg)\n\t\t\tfor i := 0; i < len(arg); i++ {\n\t\t\t\tarray[i+1] = reflect.ValueOf(arg[i])\n\t\t\t}\n\t\t\tf.Call(array)\n\t\t}\n\t}\n}\nfunc (this *Route) Regist(msg, f interface{}) {\n\tif *this == nil {\n\t\t*this = make(map[string]*reflect.Value, 18)\n\t}\n\tmsgType := reflect.TypeOf(msg)\n\tif msgType == nil || msgType.Kind() != reflect.Ptr {\n\t\tglog.Error(\"message pointer required\")\n\t}\n\tmsgID := msgType.Elem().Name()\n\tif msgID == \"\" {\n\t\tglog.Error(\"unnamed  message\")\n\t}\n\tif _, ok := (*this)[msgID]; ok {\n\t\tglog.Errorf(\"message %v is already registered\", msgID)\n\t}\n\tv := reflect.ValueOf(f)\n\t(*this)[msgID] = &v\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/route/router_test.go",
    "content": "package route\n\nimport \"testing\"\n\nfunc TestNewRoute(t *testing.T) {\n\tvar r Route\n\n\n\ttype msg struct {\n\t\tN int\n\t}\n\n\tr.Regist(&msg{}, func(m *msg) {t.Log(\"callback\",m)})\n\n\tr.Emit(&msg{123})\n\n\n\n\tr.Emit(&msg{123})\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/aes.go",
    "content": "package utils\n\nimport (\n\t\"crypto/aes\"\n\t\"crypto/cipher\"\n\t\"errors\"\n)\n\n//type AesEncrypt struct {\n//\tKey []byte\n//}\n\nfunc  SetKey(key []byte) ([]byte,error){\n\tkeyLen := len(key)\n\tif keyLen < 16 {\n\t\t//panic(\"res key 长度不能小于16\")\n\t\treturn nil,errors.New(\"res key 长度不能小于16\")\n\t}\n\tif keyLen >= 32 {\n\t\t//取前32个字节\n\t\treturn  key[:32],nil\n\t}\n\tif keyLen >= 24 {\n\t\t//取前24个字节\n\t\treturn key[:24],nil\n\t}\n\t//取前16个字节\n\treturn key[:16],nil\n}\n\n//加密字符串\nfunc  AesEncrypt(key []byte,strMesg []byte) ([]byte, error) {\n\tkey,err:= SetKey(key)\n\tencrypted := make([]byte, len(strMesg))\n\tif err!= nil{\n\t\treturn encrypted,err\n\t}\n\tvar iv = key[:aes.BlockSize]\n\n\taesBlockEncrypter, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taesEncrypter := cipher.NewCFBEncrypter(aesBlockEncrypter, iv)\n\taesEncrypter.XORKeyStream(encrypted, strMesg)\n\treturn encrypted, nil\n}\n\n//解密字符串\nfunc AesDecrypt(key []byte,src []byte) (strDesc []byte, err error) {\n\tkey,err= SetKey(key)\n\tif err!= nil{\n\t\treturn\n\t}\n\n\tvar iv = key[:aes.BlockSize]\n\tdecrypted := make([]byte, len(src))\n\tvar aesBlockDecrypter cipher.Block\n\taesBlockDecrypter, err = aes.NewCipher(key)\n\tif err != nil {\n\t\treturn\n\t}\n\taesDecrypter := cipher.NewCFBDecrypter(aesBlockDecrypter, iv)\n\taesDecrypter.XORKeyStream(decrypted, src)\n\treturn decrypted,err\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/debug.go",
    "content": "/**********************************************************\n * Author : Michael\n * Email : dolotech@163.com\n * Last modified : 2016-04-30 09:40\n * Filename : debug.go\n * Description :\n * *******************************************************/\npackage utils\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"github.com/golang/glog\"\n)\n\ntype variable struct {\n\t// Output dump string\n\tOut string\n\n\t// Indent counter\n\tindent int64\n}\n\nfunc (v *variable) dump(val reflect.Value, name string) {\n\tv.indent++\n\n\tif val.IsValid() && val.CanInterface() {\n\t\ttyp := val.Type()\n\n\t\tswitch typ.Kind() {\n\t\tcase reflect.Array, reflect.Slice:\n\t\t\tv.printType(name, val.Interface())\n\t\t\tl := val.Len()\n\t\t\tfor i := 0; i < l; i++ {\n\t\t\t\tv.dump(val.Index(i), strconv.Itoa(i))\n\t\t\t}\n\t\tcase reflect.Map:\n\t\t\tv.printType(name, val.Interface())\n\t\t\t//l := val.Len()\n\t\t\tkeys := val.MapKeys()\n\t\t\tfor _, k := range keys {\n\t\t\t\tv.dump(val.MapIndex(k), k.Interface().(string))\n\t\t\t}\n\t\tcase reflect.Ptr:\n\t\t\tv.printType(name, val.Interface())\n\t\t\tv.dump(val.Elem(), name)\n\t\tcase reflect.Struct:\n\t\t\tv.printType(name, val.Interface())\n\t\t\tfor i := 0; i < typ.NumField(); i++ {\n\t\t\t\tfield := typ.Field(i)\n\t\t\t\tv.dump(val.FieldByIndex([]int{i}), field.Name)\n\t\t\t}\n\t\tdefault:\n\t\t\tv.printValue(name, val.Interface())\n\t\t}\n\t} else {\n\t\tv.printValue(name, \"\")\n\t}\n\n\tv.indent--\n}\n\nfunc (v *variable) printType(name string, vv interface{}) {\n\tv.printIndent()\n\tv.Out = fmt.Sprintf(\"%s%s(%T)\\n\", v.Out, name, vv)\n}\n\nfunc (v *variable) printValue(name string, vv interface{}) {\n\tv.printIndent()\n\tv.Out = fmt.Sprintf(\"%s%s(%T) %#v\\n\", v.Out, name, vv, vv)\n}\n\nfunc (v *variable) printIndent() {\n\tvar i int64\n\tfor i = 0; i < v.indent; i++ {\n\t\tv.Out = fmt.Sprintf(\"%s  \", v.Out)\n\t}\n}\n\n// Print to standard out the value that is passed as the argument with indentation.\n// Pointers are dereferenced.\nfunc Dump(v interface{}) {\n\tval := reflect.ValueOf(v)\n\tdump := &variable{indent: -1}\n\tdump.dump(val, \"\")\n\tglog.Infof(\"%s\", dump.Out)\n}\n\n// Return the value that is passed as the argument with indentation.\n// Pointers are dereferenced.\nfunc Sdump(v interface{}) string {\n\tval := reflect.ValueOf(v)\n\tdump := &variable{indent: -1}\n\tdump.dump(val, \"\")\n\treturn dump.Out\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/helper.go",
    "content": "package utils\nimport (\n\t\"runtime\"\n\t\"runtime/debug\"\n\t\"time\"\n\t\"fmt\"\n\t\"strconv\"\n)\nvar startTime = time.Now()\n\nfunc avg(items []time.Duration) time.Duration {\n\tvar sum time.Duration\n\tfor _, item := range items {\n\t\tsum += item\n\t}\n\treturn time.Duration(int64(sum) / int64(len(items)))\n}\n\nfunc toH(bytes uint64) string {\n\tswitch {\n\tcase bytes < 1024:\n\t\treturn fmt.Sprintf(\"%dB\", bytes)\n\tcase bytes < 1024*1024:\n\t\treturn fmt.Sprintf(\"%.2fK\", float64(bytes)/1024)\n\tcase bytes < 1024*1024*1024:\n\t\treturn fmt.Sprintf(\"%.2fM\", float64(bytes)/1024/1024)\n\tdefault:\n\t\treturn fmt.Sprintf(\"%.2fG\", float64(bytes)/1024/1024/1024)\n\t}\n}\n\nfunc toS(d time.Duration) string {\n\n\tu := uint64(d)\n\tif u < uint64(time.Second) {\n\t\tswitch {\n\t\tcase u == 0:\n\t\t\treturn \"0\"\n\t\tcase u < uint64(time.Microsecond):\n\t\t\treturn fmt.Sprintf(\"%.2fns\", float64(u))\n\t\tcase u < uint64(time.Millisecond):\n\t\t\treturn fmt.Sprintf(\"%.2fus\", float64(u)/1000)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%.2fms\", float64(u)/1000/1000)\n\t\t}\n\t} else {\n\t\tswitch {\n\t\tcase u < uint64(time.Minute):\n\t\t\treturn fmt.Sprintf(\"%.2fs\", float64(u)/1000/1000/1000)\n\t\tcase u < uint64(time.Hour):\n\t\t\treturn fmt.Sprintf(\"%.2fm\", float64(u)/1000/1000/1000/60)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%.2fh\", float64(u)/1000/1000/1000/60/60)\n\t\t}\n\t}\n\n}\n\nfunc printGC(memStats *runtime.MemStats, gcstats *debug.GCStats) string {\n\tif gcstats.NumGC > 0 {\n\t\tlastPause := gcstats.Pause[0]\n\t\telapsed := time.Now().Sub(startTime)\n\t\toverhead := float64(gcstats.PauseTotal) / float64(elapsed) * 100\n\t\tallocatedRate := float64(memStats.TotalAlloc) / elapsed.Seconds()\n\n\t\treturn fmt.Sprintf(\"NumGC:%d Pause:%s Pause(Avg):%s Overhead:%3.2f%% Alloc:%s Sys:%s Alloc(Rate):%s/s Histogram:%s %s %s \\n\",\n\t\t\tgcstats.NumGC,\n\t\t\ttoS(lastPause),\n\t\t\ttoS(avg(gcstats.Pause)),\n\t\t\toverhead,\n\t\t\ttoH(memStats.Alloc),\n\t\t\ttoH(memStats.Sys),\n\t\t\ttoH(uint64(allocatedRate)),\n\t\t\ttoS(gcstats.PauseQuantiles[94]),\n\t\t\ttoS(gcstats.PauseQuantiles[98]),\n\t\t\ttoS(gcstats.PauseQuantiles[99]))\n\t} else {\n\t\telapsed := time.Now().Sub(startTime)\n\t\tallocatedRate := float64(memStats.TotalAlloc) / elapsed.Seconds()\n\n\t\treturn fmt.Sprintf(\"Alloc:%s Sys:%s Alloc(Rate):%s/s\\n\",\n\t\t\ttoH(memStats.Alloc),\n\t\t\ttoH(memStats.Sys),\n\t\t\ttoH(uint64(allocatedRate)))\n\t}\n}\n\nfunc GCSummary() string {\n\tmemStats := &runtime.MemStats{}\n\truntime.ReadMemStats(memStats)\n\tgcstats := &debug.GCStats{PauseQuantiles: make([]time.Duration, 100)}\n\tdebug.ReadGCStats(gcstats)\n\n\treturn printGC(memStats, gcstats) +\"NumGoroutine: \"+ strconv.Itoa(runtime.NumGoroutine())\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/list.go",
    "content": "// 线程安全的数组封装，注意：写锁接口不能嵌套调用，比如：Range接口不能调用删除接口Del\npackage utils\n\nimport (\n\t\"sync\"\n)\n\nfunc NewList() *List {\n\treturn &List{elems: make([]interface{}, 0)}\n}\n\ntype List struct {\n\tsync.RWMutex\n\telems []interface{}\n}\n\nfunc (this *List) Get(f func(interface{}) bool) interface{} {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\tfor _, v := range this.elems {\n\t\tif f(v) {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (this *List) Add(value interface{}) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tthis.elems = append(this.elems, value)\n}\n\nfunc (this *List) Pure() {\n\tthis.Lock()\n\n\tdefer this.Unlock()\n\tthis.elems = this.elems[:0]\n\n}\nfunc (this *List) Del(value interface{}) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tfor k, v := range this.elems {\n\t\tif value == v {\n\t\t\tthis.elems = append(this.elems[:k], this.elems[k+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc (this *List) Delete(f func(interface{}) bool) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tfor k, v := range this.elems {\n\t\tif f(v) {\n\t\t\tthis.elems = append(this.elems[:k], this.elems[k+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc (this *List) Len() int {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\treturn len(this.elems)\n}\n\nfunc (this *List) Replace(value interface{}, f func(interface{}) bool) {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\tfor k, v := range this.elems {\n\t\tif f(v) {\n\t\t\tthis.elems = append(this.elems[:k], this.elems[k+1:]...)\n\t\t\tthis.elems = append(this.elems, value)\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc (this *List) Range(f func(interface{}) bool) {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\tfor _, v := range this.elems {\n\t\tif f(v) {\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc (this *List) LRange(f func(interface{}) bool) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tfor _, v := range this.elems {\n\t\tif f(v) {\n\t\t\tbreak\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/map.go",
    "content": "package utils\n\nimport (\n\t\"sync\"\n)\n\nfunc NewMap() *Map {\n\treturn &Map{elems: map[interface{}]interface{}{}}\n}\n\ntype Map struct {\n\tsync.RWMutex\n\telems map[interface{}]interface{}\n}\n\nfunc (this *Map) Get(key interface{}) interface{} {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\tif value, ok := this.elems[key]; ok {\n\t\treturn value\n\t} else {\n\t\treturn nil\n\t}\n}\nfunc (this *Map) Set(key interface{}, value interface{}) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tthis.elems[key] = value\n}\n\nfunc (this *Map) Del(key interface{}) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tdelete(this.elems, key)\n}\n\nfunc (this *Map) Len() int {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\treturn len(this.elems)\n}\n\nfunc (this *Map) Range(f func(interface{}, interface{}) bool) {\n\tthis.RLock()\n\tdefer this.RUnlock()\n\tfor k, v := range this.elems {\n\t\tif f(k, v) {\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc (this *Map) LRange(f func(interface{}, interface{}) bool) {\n\tthis.Lock()\n\tdefer this.Unlock()\n\tfor k, v := range this.elems {\n\t\tif f(k, v) {\n\t\t\tbreak\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/map_list_test.go",
    "content": "/**\n * Created by Michael on 2015/8/4.\n */\npackage utils\n\nimport \"testing\"\n\nfunc Test_ran(t *testing.T) {\n\tlist := &List{}\n\tt.Log(list)\n\t//m := NewMap()\n\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/queue.go",
    "content": "package utils\n\ntype Queue struct {\n\telems               []interface{}\n\tnelems, popi, pushi int\n}\n\nfunc (q *Queue) Len() int {\n\treturn q.nelems\n}\n\nfunc (q *Queue) Push(elem interface{}) {\n\tif q.nelems == len(q.elems) {\n\t\tq.expand()\n\t}\n\tq.elems[q.pushi] = elem\n\tq.nelems++\n\tq.pushi = (q.pushi + 1) % len(q.elems)\n}\n\nfunc (q *Queue) Pop() (elem interface{}) {\n\tif q.nelems == 0 {\n\t\treturn nil\n\t}\n\telem = q.elems[q.popi]\n\tq.elems[q.popi] = nil // Help GC.\n\tq.nelems--\n\tq.popi = (q.popi + 1) % len(q.elems)\n\treturn elem\n}\n\nfunc (q *Queue) expand() {\n\tcurcap := len(q.elems)\n\tvar newcap int\n\tif curcap == 0 {\n\t\tnewcap = 8\n\t} else if curcap < 1024 {\n\t\tnewcap = curcap * 2\n\t} else {\n\t\tnewcap = curcap + (curcap / 4)\n\t}\n\telems := make([]interface{}, newcap)\n\n\tif q.popi == 0 {\n\t\tcopy(elems, q.elems)\n\t\tq.pushi = curcap\n\t} else {\n\t\tnewpopi := newcap - (curcap - q.popi)\n\t\tcopy(elems, q.elems[:q.popi])\n\t\tcopy(elems[newpopi:], q.elems[q.popi:])\n\t\tq.popi = newpopi\n\t}\n\tfor i := range q.elems {\n\t\tq.elems[i] = nil // Help GC.\n\t}\n\tq.elems = elems\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/random.go",
    "content": "package utils\n\nimport (\n\t\"math/rand\"\n\t\"time\"\n\t\"sync\"\n\t//crand \"crypto/rand\"\n)\n\nvar o *rand.Rand = rand.New(rand.NewSource(TimestampNano()))\nvar random_mux_ sync.Mutex\n\nfunc RandInt64() (r int64) {\n\trandom_mux_.Lock()\n\tdefer random_mux_.Unlock()\n\treturn (o.Int63())\n}\n\nfunc RandInt32() (r int32) {\n\trandom_mux_.Lock()\n\tdefer random_mux_.Unlock()\n\treturn (o.Int31())\n}\n\nfunc RandUint32() (r uint32) {\n\trandom_mux_.Lock()\n\tdefer random_mux_.Unlock()\n\treturn (o.Uint32())\n}\n\nfunc RandInt64N(n int64) (r int64) {\n\trandom_mux_.Lock()\n\tdefer random_mux_.Unlock()\n\treturn (o.Int63n(n))\n}\n\nfunc RandInt32N(n int32) (r int32) {\n\trandom_mux_.Lock()\n\tdefer random_mux_.Unlock()\n\treturn (o.Int31n(n))\n}\n\nvar randomChan chan uint32\n\nfunc randUint32() {\n\trandomChan = make(chan uint32, 1024)\n\tgo func() {\n\t\tvar numstr uint32\n\t\tfor {\n\t\t\tnumstr = RandUint32()\n\t\t\tselect {\n\t\t\tcase randomChan <- numstr:\n\t\t\t}\n\t\t\t<-time.After(time.Millisecond * 100)\n\t\t}\n\t}()\n}\n\nfunc GetRandUint32() uint32 {\n\treturn <-randomChan\n}\n\n\nfunc init() {\n\trand.Seed(time.Now().UTC().UnixNano())\n}\n\nvar letters = []rune(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\")\n\nfunc RandomString(length int) string {\n\n\t//rand.Seed(time.Now().UTC().UnixNano())\n\tb := make([]rune, length)\n\tfor i := range b {\n\t\tb[i] = letters[rand.Intn(len(letters))]\n\t}\n\treturn string(b)\n}\n\n\nvar letters_ = []rune(\"ABCDEFGHIJKLMNPQRSTUVWXYZ123456789\")\n\nfunc RandomString_(length int) string {\n\n\t//rand.Seed(time.Now().UTC().UnixNano())\n\tb := make([]rune, length)\n\tfor i := range b {\n\t\tb[i] = letters_[rand.Intn(len(letters_))]\n\t}\n\treturn string(b)\n}"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/sign.go",
    "content": "package utils\n\nimport (\n\t\"crypto/md5\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"sort\"\n\t\"strings\"\n)\n\n//生成签名\nfunc LoginSign(gameid string, device string) (string, error) {\n\tparra := fmt.Sprintf(\"gameid=%s&deviceId=%s\", gameid, device)\n\tparameters := strings.Split(parra, \"&\")\n\tsort_parameters := sort.StringSlice(parameters)\n\tsort.Sort(sort_parameters)\n\tparameter := \"\"\n\tfor i := 0; i < len(sort_parameters); i++ {\n\t\tparameter += \"&\" + sort_parameters[i]\n\t}\n\tparameter = string([]byte(parameter)[1:])\n\n\th := md5.New()\n\n\t_, err := h.Write([]byte(parameter + \"&key=\" + \"19a87399fde1bccbf04a5eaa018ea0df\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.ToUpper(hex.EncodeToString(h.Sum(nil))), nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/stack.go",
    "content": "package utils\n\nimport (\n\t\"runtime\"\n\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"github.com/golang/glog\"\n)\n\n// 产生panic时的调用栈打印\nfunc PrintPanicStack(extras ...interface{}) interface{}{\n\tif x := recover(); x != nil {\n\t\tglog.Errorln(x)\n\t\ti := 0\n\t\tfuncName, file, line, ok := runtime.Caller(i)\n\t\tfor ok {\n\t\t\tglog.Errorf(\"frame %v:[func:%v,file:%v,line:%v]\\n\", i, runtime.FuncForPC(funcName).Name(), file, line)\n\t\t\ti++\n\t\t\tfuncName, file, line, ok = runtime.Caller(i)\n\t\t}\n\n\t\tfor k := range extras {\n\t\t\tglog.Errorf(\"EXRAS#%v DATA:%v\\n\", k, spew.Sdump(extras[k]))\n\t\t}\n\t\treturn x\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/string_2_bytes.go",
    "content": "package utils\n\nimport (\n\t\"unsafe\"\n\t\"reflect\"\n)\n\nfunc String2Bytes(s string) (b []byte) {\n\tpbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n\tpstring := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tpbytes.Data = pstring.Data\n\tpbytes.Len = pstring.Len\n\tpbytes.Cap = pstring.Len\n\treturn\n}\n\nfunc Bytes2String(b []byte) (s string) {\n\tpbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n\tpstring := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tpstring.Data = pbytes.Data\n\tpstring.Len = pbytes.Len\n\treturn\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/string_2_bytes_test.go",
    "content": "package utils\n\nimport (\n\t\"testing\"\n)\n\n/*func BenchmarkBytes2String(t *testing.B) {\n\tfor i := 1; i < N; i++ {\n\t\tb := []byte(\"34asdfasdfasdfasdfasdfasdfasdfasdf12\")\n\t\tt.Log(Bytes2String(b))\n\t}\n}*/\nfunc BenchmarkTestString2Bytes(t *testing.B) {\n\tfor i := 1; i < N; i++ {\n\t\tb := \"34asdfasdfasdfasdfasdfasdfasdfasdf12\"\n\t\tt.Log(Bytes2String(String2Bytes(b)))\n\t}\n}\n\nconst N = 30000\n/*func BenchmarkBytes2String1(t *testing.B) {\n\tfor i := 1; i < N; i++ {\n\t\tb := []byte(\"34asdfasdfasdfasdfasdfasdfasdfasdf12\")\n\t\tt.Log(Bytes2String(b))\n\t}\n}*/\nfunc BenchmarkTestString2Bytes1(t *testing.B) {\n\tfor i := 1; i < N; i++ {\n\t\tb := \"34asdfasdfasdfasdfasdfasdfasdfasdf12\"\n\t\tt.Log(string([]byte(b)))\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/structandmap.go",
    "content": "package utils\n\nimport (\n\t\"errors\"\n\t\"reflect\"\n)\n\nfunc ToM(value interface{}) map[string]interface{} {\n\tif value == nil{\n\t\treturn nil\n\t}\n\tv := reflect.ValueOf(value)\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t\tvalue = v.Interface()\n\t\tv = reflect.ValueOf(value)\n\t}\n\tt := reflect.TypeOf(value)\n\tvar data = make(map[string]interface{})\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tdata[t.Field(i).Name] = v.Field(i).Interface()\n\t}\n\treturn data\n}\n\n//\nfunc ToMs(values []interface{}) []interface{} {\n\tlist:= make([]interface{},len(values))\n\tl:= len(values)\n\tfor i:=0;i<l;i++{\n\t\tvalue:=values[i]\n\t\tif value == nil{\n\t\t\treturn nil\n\t\t}\n\t\tv := reflect.ValueOf(value)\n\t\tif v.Kind() == reflect.Ptr {\n\t\t\tv = v.Elem()\n\t\t\tvalue = v.Interface()\n\t\t\tv = reflect.ValueOf(value)\n\t\t}\n\t\tt := reflect.TypeOf(value)\n\t\tdata := make(map[string]interface{})\n\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\tdata[t.Field(i).Name] = v.Field(i).Interface()\n\t\t}\n\t\tlist[i] = data\n\t}\n\treturn list\n}\n\nfunc setField(obj interface{}, name string, value interface{}) error {\n\tstructValue := reflect.ValueOf(obj).Elem()\n\tstructFieldValue := structValue.FieldByName(name)\n\n\tif !structFieldValue.IsValid() {\n\t\treturn errors.New(\"No such field: %s in obj\" + name)\n\t}\n\n\tif !structFieldValue.CanSet() {\n\t\treturn errors.New(\"Cannot set %s field value\" + name)\n\t}\n\n\tstructFieldType := structFieldValue.Type()\n\tval := reflect.ValueOf(value)\n\tif structFieldType != val.Type() {\n\t\treturn errors.New(\"Provided value type didn't match obj field type\")\n\t}\n\n\tstructFieldValue.Set(val)\n\treturn nil\n}\n\ntype RPCConfig struct {\n\tip   string\n\tport string\n}\n\nfunc (s *RPCConfig) FillStruct(m map[string]string) error {\n\tfor k, v := range m {\n\t\terr := setField(s, k, v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/timer_queue.go",
    "content": "package utils\n\nimport (\n\t\"container/heap\"\n)\n\ntype TimeOuter interface {\n\tTimeOut(int64)\n}\n\ntype Timer struct {\n\tTimeOuter\n\tid       uint32\n\tend      int64 //结束时间\n\tinterval int64 //迭代周期\n\tindex    int\n}\n\ntype TimerQueue []*Timer\n\nfunc (this TimerQueue) Len() int {\n\treturn len(this)\n}\n\nfunc (this TimerQueue) Less(i, j int) bool {\n\treturn this[i].end < this[j].end\n}\n\nfunc (this TimerQueue) Swap(i, j int) {\n\tthis[i], this[j] = this[j], this[i]\n\tthis[i].index = i\n\tthis[j].index = j\n}\n\nfunc (this *TimerQueue) Push(x interface{}) {\n\ttmp := *this\n\tn := len(tmp)\n\ttmp = tmp[0 : n+1]\n\ttimer := x.(*Timer)\n\ttimer.index = n\n\ttmp[n] = timer\n\t*this = tmp\n}\n\nfunc (this *TimerQueue) Pop() interface{} {\n\ttmp := *this\n\tn := len(tmp)\n\ttimer := tmp[n-1]\n\ttmp[n-1] = nil\n\ttimer.index = -1\n\t*this = tmp[0 : n-1]\n\treturn timer\n}\n\ntype TimerManager struct {\n\tid uint32\n\ttq TimerQueue\n}\n\nfunc NewTimerManager(size int) *TimerManager {\n\tif size == 0 {\n\t\tsize = 1024\n\t}\n\treturn &TimerManager{tq: make([]*Timer, 0, size)}\n}\n\nfunc (this *TimerManager) AddTimer(i TimeOuter, e int64, iv int64) uint32 {\n\tif cap(this.tq) <= len(this.tq) {\n\t\treturn 0\n\t}\n\ttimer := &Timer{TimeOuter: i, interval: iv, end: e}\n\tthis.id++\n\ttimer.id = this.id\n\theap.Push(&this.tq, timer)\n\treturn timer.id\n}\n\nfunc (this *TimerManager) RemoveTimer(id uint32) {\n\tfor _, timer := range this.tq {\n\t\tif timer.id == id {\n\t\t\theap.Remove(&this.tq, timer.index)\n\t\t\treturn\n\t\t}\n\t}\n}\n\nvar queue *Queue = &Queue{}\n\nfunc (this *TimerManager) Run(now int64, limit int) {\n\tfor len(this.tq) > 0 {\n\t\ttmp := this.tq[0]\n\t\tif tmp.end <= now {\n\t\t\ttimer := heap.Pop(&this.tq).(*Timer)\n\t\t\tqueue.Push(timer.TimeOuter)\n\t\t\tif timer.interval > 0 {\n\t\t\t\ttimer.end += timer.interval\n\t\t\t\theap.Push(&this.tq, timer)\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\tif limit > 0 && queue.Len() >= limit {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor queue.Len() > 0 {\n\t\tqueue.Pop().(TimeOuter).TimeOut(now)\n\t}\n}\n\nfunc (this *TimerManager) dump() {\n\tqueue := &Queue{}\n\tfor len(this.tq) > 0 {\n\t\ttimer := heap.Pop(&this.tq).(*Timer)\n\t\tqueue.Push(timer)\n\t\tprintln(\"Timer:\", timer.id, timer.index, timer.end, timer.interval)\n\t}\n\tfor queue.Len() > 0 {\n\t\theap.Push(&this.tq, queue.Pop().(*Timer))\n\t}\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/utils.go",
    "content": "/**********************************************************\n * Author        : Michael\n * Email         : dolotech@163.com\n * Last modified : 2016-04-30 09:40\n * Filename      : utils.go\n * Description   : 常用的工具方法\n * *******************************************************/\npackage utils\n\nimport (\n\t\"bytes\"\n\t\"crypto/md5\"\n\t\"encoding/binary\"\n\t\"encoding/gob\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"github.com/golang/glog\"\n\t\"math\"\n\t\"math/rand\"\n\t\"net\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode/utf8\"\n)\n\n// Auth\nfunc GetAuth() []rune {\n\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tvar list []rune\n\tfor i := 0; i < 6; i++ {\n\t\tran := r.Intn(122-97+1) + 97\n\t\tlist = append(list, rune(ran))\n\t}\n\treturn list\n}\n\n// 验证是否邮箱\nfunc EmailRegexp(mail string) bool {\n\tb := false\n\tif mail != \"\" {\n\t\treg := regexp.MustCompile(`^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-]+)$`)\n\t\tb = reg.FindString(mail) != \"\"\n\t}\n\treturn b\n}\n\n// 验证是否手机\nfunc PhoneRegexp(phone string) bool {\n\tb := false\n\tif phone != \"\" {\n\t\treg := regexp.MustCompile(`^(86)*0*1\\d{10}$`)\n\t\tb = reg.FindString(phone) != \"\"\n\t}\n\treturn b\n}\n\n// 验证账号是否合法\nfunc AccountRegexp(account string) bool {\n\tb := false\n\tif account != \"\" {\n\t\treg := regexp.MustCompile(`^[a-zA-Z0-9]{6,8}$`)\n\t\tb = reg.FindString(account) != \"\"\n\t}\n\treturn b\n}\n\n// 数值类型转成点分结构的IP地址\n// eg: t.Log((InetTontoa(3232235966).String()))\nfunc InetTontoa(ipnr uint32) string {\n\tvar bytes [4]byte\n\tbytes[0] = byte(ipnr & 0xFF)\n\tbytes[1] = byte((ipnr >> 8) & 0xFF)\n\tbytes[2] = byte((ipnr >> 16) & 0xFF)\n\tbytes[3] = byte((ipnr >> 24) & 0xFF)\n\treturn net.IPv4(bytes[3], bytes[2], bytes[1], bytes[0]).String()\n}\n\n// 点分结构的IP地址转成数值类型\n// eg: t.Log((InetToaton(\"192.168.1.190\")))\nfunc InetToaton(ipnr string) uint32 {\n\tbits := strings.Split(ipnr, \".\")\n\n\tb0, _ := strconv.Atoi(bits[0])\n\tb1, _ := strconv.Atoi(bits[1])\n\tb2, _ := strconv.Atoi(bits[2])\n\tb3, _ := strconv.Atoi(bits[3])\n\n\tvar sum uint32\n\n\tsum += uint32(b0) << 24\n\tsum += uint32(b1) << 16\n\tsum += uint32(b2) << 8\n\tsum += uint32(b3)\n\n\treturn sum\n}\n\n// 验证只能由数字字母下划线组成的5-17位密码字符串\nfunc AalidataPwd(name string) (b bool) {\n\tif name != \"\" {\n\t\t//reg := regexp.MustCompile(`^[a-zA-Z0-9_]*$`)\n\t\treg := regexp.MustCompile(`^[a-zA-Z_]\\w{5,17}$`)\n\t\tb = reg.FindString(name) != \"\"\n\t}\n\treturn\n}\n\n// 不可见字符,用于用户提交的字符过滤分别对应为：,\\0   \\t  _  space  \"  ` ctrl+z \\n \\r  `  %   \\  ,\nvar IllegalNameRune = [13]rune{0x00, 0x09, 0x5f, 0x20, 0x22, 0x60, 0x1a, 0x0a, 0x0d, 0x27, 0x25, 0x5c, 0x2c}\n\nvar hasIllegalNameRune = func(c rune) bool {\n\tfor _, v := range IllegalNameRune {\n\t\tif v == c {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// 限制最大字符数，检测不可见字符\n// maxcount 限制的最大字符数，1个中文=2个英文\nfunc LegalName(name string, maxcount int) bool {\n\tif !utf8.ValidString(name) {\n\t\treturn false\n\t}\n\n\tnum := len([]rune(name)) + len([]byte(name))\n\tresult := float64(num) / 4.0\n\tsum := int(result + 0.99)\n\n\tif sum > maxcount*2 {\n\t\treturn false\n\t}\n\treturn strings.IndexFunc(name, hasIllegalNameRune) == -1\n}\n\n/**\n * 截取字符串\n * @param string str\n * @param begin int\n * @param length int\n * @return int 长度\n */\nfunc SubStr(str string, begin, length int) (substr string) {\n\t// 将字符串的转换成[]rune\n\trs := []rune(str)\n\tlth := len(rs)\n\n\t// 简单的越界判断\n\tif begin < 0 {\n\t\tbegin = 0\n\t}\n\tif begin >= lth {\n\t\tbegin = lth\n\t}\n\tend := begin + length\n\tif end > lth {\n\t\tend = lth\n\t}\n\n\t// 返回子串\n\treturn string(rs[begin:end])\n}\n\n//整形转换成字节\nfunc IntToBytes(n int) []byte {\n\tx := int32(n)\n\tbytesBuffer := bytes.NewBuffer([]byte{})\n\tbinary.Write(bytesBuffer, binary.BigEndian, x)\n\treturn bytesBuffer.Bytes()\n}\n\n//字节转换成整形\nfunc BytesToInt(b []byte) int {\n\tbytesBuffer := bytes.NewBuffer(b)\n\tvar x int32\n\tbinary.Read(bytesBuffer, binary.BigEndian, &x)\n\treturn int(x)\n}\n\n//整形转换成字节\nfunc Int64ToBytes(n int64) []byte {\n\tx := int64(n)\n\tbytesBuffer := bytes.NewBuffer([]byte{})\n\tbinary.Write(bytesBuffer, binary.BigEndian, x)\n\treturn bytesBuffer.Bytes()\n}\n\n//字节转换成整形\nfunc BytesToInt64(b []byte) int64 {\n\tbytesBuffer := bytes.NewBuffer(b)\n\tvar x int64\n\tbinary.Read(bytesBuffer, binary.BigEndian, &x)\n\treturn int64(x)\n}\n\n//切片中字符串第一个位置\nfunc SliceIndexOf(arr []string, str string) int {\n\tvar index int = -1\n\tarrlen := len(arr)\n\tfor i := 0; i < arrlen; i++ {\n\t\tif arr[i] == str {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn index\n}\n\n//字节转换成整形\nfunc SliceLastIndexOf(arr []string, str string) int {\n\tvar index int = -1\n\tfor arrlen := len(arr) - 1; arrlen > -1; arrlen-- {\n\t\tif arr[arrlen] == str {\n\t\t\tindex = arrlen\n\t\t\tbreak\n\t\t}\n\t}\n\treturn index\n}\n\n//字节转换成整形\nfunc SliceRemoveFormSlice(oriArr []string, removeArr []string) []string {\n\tendArr := oriArr[:]\n\tfor _, value := range removeArr {\n\t\tindex := SliceIndexOf(endArr, value)\n\t\tif index != -1 {\n\t\t\tendArr = append(endArr[:index], endArr[index+1:]...)\n\t\t}\n\t}\n\treturn endArr\n}\n\n// 把时间戳转换成头像存储目录\nfunc TimeToHeadphpoto(t int64, userid int, headname int64) (string, string) {\n\tvar str, name string\n\tti := time.Unix(t, 0)\n\tstr = ti.Format(\"2006/01/02/15\")\n\n\tstr = \"./headpic/\" + str + \"/\" + strconv.Itoa(userid)\n\tif headname == 0 {\n\t\tname = \"/130_\" + strconv.Itoa(userid) + \".jpg\"\n\t} else {\n\t\tname = \"/\" + strconv.Itoa(int(headname)) + \".jpg\"\n\t}\n\treturn str, name\n}\n\n// 把时间戳转换成头像存储目录\nfunc TimeToPhpotoPath(t int64, userid int) string {\n\tvar str string\n\tti := time.Unix(t, 0)\n\tstr = ti.Format(\"2006/01/02/15\")\n\treturn \"./photo/\" + str + \"/\" + strconv.Itoa(userid)\n}\nfunc UseridCovToInvate(userid string) uint32 {\n\tuseridbyte := []byte(userid)\n\tuseridbyte = useridbyte[len(useridbyte)-4:]\n\ttimestr := []byte(strconv.Itoa(int(time.Now().Unix())))\n\ttimestr = timestr[len(timestr)-5:]\n\tuseridbyte = append(useridbyte, timestr...)\n\tcode, _ := strconv.Atoi(string(useridbyte))\n\treturn uint32(code)\n}\n\nvar base = []string{\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"}\nvar flipbase = flip(base)\nvar baselen = len(base)\n\nfunc Base62encode(num uint64) string {\n\tbaseStr := \"\"\n\tfor {\n\t\tif num <= 0 {\n\t\t\tbreak\n\t\t}\n\n\t\ti := num % uint64(baselen)\n\t\tbaseStr += base[i]\n\t\tnum = (num - i) / uint64(baselen)\n\t}\n\treturn baseStr\n}\n\nfunc Base62decode(base62 string) uint64 {\n\tvar rs uint64 = 0\n\tlen := uint64(len(base62))\n\tvar i uint64\n\tfor i = 0; i < len; i++ {\n\t\trs += flipbase[string(base62[i])] * uint64(math.Pow(float64(baselen), float64(i)))\n\t}\n\treturn rs\n}\n\nfunc flip(s []string) map[string]uint64 {\n\tf := make(map[string]uint64)\n\tfor index, value := range s {\n\t\tf[value] = uint64(index)\n\t}\n\treturn f\n}\n\n// 用gob进行数据编码\nfunc Encode(data interface{}) ([]byte, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tenc := gob.NewEncoder(buf)\n\terr := enc.Encode(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}\n\n// 用gob进行数据解码\n//\nfunc Decode(data []byte, to interface{}) error {\n\tbuf := bytes.NewBuffer(data)\n\tdec := gob.NewDecoder(buf)\n\treturn dec.Decode(to)\n}\n\n// 对象深度拷贝\nfunc Clone(dst, src interface{}) error {\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(src); err != nil {\n\t\treturn err\n\t}\n\treturn gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst)\n}\n\n//----------------------一下几个函数只对数字字符串有效----------------------------\nfunc IsNumString(str string) bool {\n\truneArr := []rune(str)\n\tfor i := 0; i < len(runeArr); i++ {\n\t\tif runeArr[i] > 56 {\n\t\t\treturn false\n\t\t} else if runeArr[i] < 48 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\nfunc Between(startid, endid string) []string {\n\tif startid == endid {\n\t\treturn []string{startid}\n\t}\n\tids := []string{}\n\tif len(startid) > len(endid) {\n\t\treturn ids\n\t}\n\tstart := []rune(startid)\n\tend := []rune(endid)\n\n\tfor i := 0; i < len(start); i++ {\n\t\tif int(end[i]) < int(start[i]) {\n\t\t\treturn ids\n\t\t} else if int(end[i]) > int(start[i]) {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor {\n\t\tids = append(ids, startid)\n\t\tstartid = StringAdd(startid)\n\t\tif startid == endid {\n\t\t\tids = append(ids, startid)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ids\n}\n\nfunc StringAddNum(numStr string, num int) string {\n\tfor i := 0; i < num; i++ {\n\t\tnumStr = StringAdd(numStr)\n\t}\n\treturn numStr\n}\n\n// 字符串加法\nfunc StringAdd(numStr string) string {\n\truneArr := []rune(numStr)\n\tlength := len(runeArr)\n\tadd := true\n\tfor i := length - 1; i >= 0; i-- {\n\t\tif runeArr[i] < 57 {\n\t\t\truneArr[i]++\n\t\t\tadd = false\n\t\t\tbreak\n\t\t} else {\n\t\t\truneArr[i] = 48\n\t\t}\n\t}\n\tif add {\n\t\truneArr = append([]rune{49}, runeArr...)\n\t}\n\treturn string(runeArr)\n}\n\n//-----------------------------------------------------------------\nconst FORMAT string = \"2006-01-02 15:04:05\"\nconst FORMATDATA string = \"2006-01-02 \"\n\n// 获取当前时间截\nfunc TimestampNano() int64 {\n\treturn time.Now().UnixNano()\n}\n\n// 获取当前时间截\nfunc Timestamp() int64 {\n\treturn time.Now().Unix()\n}\n\n// 获取本周六零点时间截\nfunc TimestampSaturday() int64 {\n\tnow := time.Now()\n\tunix := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()\n\treturn unix + int64(time.Saturday-now.Weekday())*86400\n}\n\n// 获取本地当天零点时间截\nfunc TimestampToday() int64 {\n\treturn time.Date(Year(), Month(), Day(), 0, 0, 0, 0, time.Local).Unix()\n}\nfunc TimestampTodayStr() string {\n\tt := time.Date(Year(), Month(), Day(), 0, 0, 0, 0, time.Local).Unix()\n\treturn strconv.FormatInt(t, 10)\n}\n\n// 获取本地昨天零点时间截\nfunc TimestampYesterday() int64 {\n\treturn TimestampToday() - 86400\n}\n\n// 获取本地明天零点时间截\nfunc TimestampTomorrow() int64 {\n\treturn TimestampToday() + 86400\n}\n\n// 获取当前年\nfunc Year() int {\n\treturn time.Now().Year()\n}\n\n// 获取当前月\nfunc Month() time.Month {\n\treturn time.Now().Month()\n}\n\n// 获取当前天\nfunc Day() int {\n\treturn time.Now().Day()\n}\n\n// 获取当前周\nfunc Weekday() time.Weekday {\n\treturn time.Now().Weekday()\n}\n\n// 获取指定时间截的年\nfunc Unix2Year(t int64) int {\n\treturn time.Unix(t, 0).Year()\n}\n\n// 获取指定时间截的月\nfunc Unix2Month(t int64) time.Month {\n\treturn time.Unix(t, 0).Month()\n}\n\n// 获取指定时间截的天\nfunc Unix2Day(t int64) int {\n\treturn time.Unix(t, 0).Day()\n}\n\n// 时间戳转str格式化时间\nfunc Unix2Str(t int64) string {\n\treturn time.Unix(t, 0).Format(FORMAT)\n}\n\n// str格式当前日期\nfunc DateStr() string {\n\treturn time.Now().Format(FORMATDATA)\n}\n\n// str格式化时间转时间戳\nfunc Str2Unix(t string) (int64, error) {\n\tthe_time, err := time.Parse(FORMAT, t)\n\tif err == nil {\n\t\treturn the_time.Unix(), err\n\t}\n\treturn 0, err\n}\n\n// 获取指定年月的天数\nfunc MonthDays(year int, month int) (days int) {\n\tif month != 2 {\n\t\tif month == 4 || month == 6 || month == 9 || month == 11 {\n\t\t\tdays = 30\n\t\t} else {\n\t\t\tdays = 31\n\t\t}\n\t} else {\n\t\tif ((year%4) == 0 && (year%100) != 0) || (year%400) == 0 {\n\t\t\tdays = 29\n\t\t} else {\n\t\t\tdays = 28\n\t\t}\n\t}\n\treturn\n}\n\n// md5 加密\n// func Md5(text string) string {\n// \thashMd5 := md5.New()\n// \tio.WriteString(hashMd5, text)\n// \treturn fmt.Sprintf(\"%x\", hashMd5.Sum(nil))\n// }\nfunc Md5(text string) string {\n\th := md5.New()\n\th.Write([]byte(text))                 //\n\treturn hex.EncodeToString(h.Sum(nil)) // 输出加密结果\n}\n\n// 延迟second\nfunc Sleep(second int) {\n\t<-time.After(time.Duration(second) * time.Second)\n}\n\n// 延迟1~second\nfunc SleepRand(second int) {\n\t<-time.After(time.Duration(rand.Intn(second)+1) * time.Second)\n}\n\n// 延迟second\nfunc Sleep64(second int64) {\n\t<-time.After(time.Duration(second) * time.Second)\n}\n\n// 延迟1~second\nfunc SleepRand64(second int64) {\n\t<-time.After(time.Duration(rand.Int63n(second)+1) * time.Second)\n}\n\n// 用于调式显示掩码\nfunc BitOr(v int64) {\n\tglog.Info(\"bit set is:\")\n\tvar s string\n\tfor i := 1; i <= 64; i++ {\n\t\tif v&(1<<uint(i)) > 0 {\n\t\t\ts = fmt.Sprintf(\"%s %d\", s, i)\n\t\t}\n\t}\n\tglog.Infoln(s)\n}\n\nfunc Byte2uint32(in []byte) []uint32 {\n\tout := make([]uint32, 0, len(in))\n\tfor _, v := range in {\n\t\tout = append(out, uint32(v))\n\t}\n\treturn out\n}\nfunc Byte2int32(in []byte) []int32 {\n\tout := make([]int32, 0, len(in))\n\tfor _, v := range in {\n\t\tout = append(out, int32(v))\n\t}\n\treturn out\n}\n\nfunc Int642uint32(in []int64) []uint32 {\n\tout := make([]uint32, 0, len(in))\n\tfor _, v := range in {\n\t\tout = append(out, uint32(v))\n\t}\n\treturn out\n}\n\nfunc String2uint32(in []string) []uint32 {\n\tout := make([]uint32, 0, len(in))\n\tfor _, v := range in {\n\t\tt, _ := strconv.Atoi(v)\n\t\tout = append(out, uint32(t))\n\t}\n\treturn out\n}\n\nfunc String2int(in []string) []int {\n\tout := make([]int, 0, len(in))\n\tfor _, v := range in {\n\t\tt, _ := strconv.Atoi(v)\n\t\tout = append(out, t)\n\t}\n\treturn out\n}\n\nfunc Uint322string(in []uint32) []string {\n\tout := make([]string, 0, len(in))\n\tfor _, v := range in {\n\t\tout = append(out, strconv.Itoa(int(v)))\n\t}\n\treturn out\n}\n\nfunc int2string(in []int) []string {\n\tout := make([]string, 0, len(in))\n\tfor _, v := range in {\n\t\tout = append(out, strconv.Itoa(v))\n\t}\n\treturn out\n}\n\n// 是否在slice里面\nfunc InSlice(ms uint32, arr []uint32) bool {\n\tfor _, v := range arr {\n\t\tif ms == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc Truncate6Words(origin string) string {\n\tnewString := origin\n\tnameRune := []rune(origin)\n\tglog.Errorf(\"len is %v\", len(nameRune))\n\tif len(nameRune) > 6 {\n\t\tnewString = string(nameRune[:6])\n\t}\n\treturn newString\n}\n\n// \"1.1.1\"格式版本号对比,origin  =  target  :1;origin <   target  :-1;   origin =  target:0\nfunc VersionContrast(origin, target string) (int, error) {\n\n\toriginArr := strings.Split(origin, \".\")\n\ttargetArr := strings.Split(target, \".\")\n\n\tfor i := 0; i < len(originArr); i++ {\n\t\toriginItem := originArr[i]\n\t\toriginInt, err := strconv.Atoi(originItem)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif len(targetArr) <= i {\n\t\t\treturn 1, nil\n\t\t}\n\t\ttargetItem := targetArr[i]\n\n\t\ttargetInt, err := strconv.Atoi(targetItem)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tif originInt > targetInt {\n\t\t\treturn 1, nil\n\t\t} else if originInt < targetInt {\n\t\t\treturn -1, nil\n\t\t}\n\t}\n\treturn 0, nil\n}\n\nfunc LogPrefix(uid uint32, str string) string {\n\treturn fmt.Sprintf(\"玩家:%v 操作:[%v]\", uid, str)\n}\n\n/*serverid helper\nserverid采用6位数字，例如：123001\n第1，2位是appid,对应客户端应用id\n第3，4位是game类型,约局10，金币30\n第5，6位是可执行文件编号,比如123001,123002分别是牛牛金币服两个game\n*/\n\nfunc ToServerType(sid int) int {\n\treturn ((sid / 1000) % 100) % 10\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/utils_test.go",
    "content": "/**\n * Created by Michael on 2015/8/4.\n */\npackage utils\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"testing\"\n\n\n)\n\n\n\n\nfunc Test_StringAdd(t *testing.T) {\n\tt.Log(StringAdd(\"123\"))\n\tt.Log(StringAdd(\"789786654567\"))\n\tt.Log(StringAdd(\"sadfasdf\"))\n\tt.Log(StringAdd(\"123944\"))\n\tt.Log(StringAdd(\"1111111111\"))\n\tt.Log(StringAdd(\"999999999\"))\n\tt.Log(StringAdd(\"0\"))\n\tt.Log(StringAdd(\"099\"))\n\n}\n/*\nfunc Test_ran(t *testing.T) {\n\t//for i := 0; i < 100; i++ {\n\t//\ta := RandInt64()\n\t//\tt.Log(Conver10to62(a), len(Conver10to62(a)))\n\n\t//}\n\t//str := \"12345678901\"\n\tstr := Conver10to62(RandInt64())\n\tt.Log(str, len(str))\n\tif len(str) < 12 {\n\t\tvar buf = make([]byte, 12-len(str))\n\t\tfor i := 0; i < 12-len(str); i++ {\n\t\t\tbuf[i] = 48\n\t\t}\n\t\tstr = string(buf) + str\n\t}\n\tt.Log(len(str), str)\n}*/\nfunc Test_copy(t *testing.T) {\n\ta := AA{A: 999}\n\tb := AA{}\n\t//err :=Clone(b, a)\n\tt.Log(a, b)\n}\nfunc Test_AES(t *testing.T) {\n\taesEnc := AesEncrypt{}\n\taesEnc.SetKey([]byte(\"aalk;lkasjd;lkfj;alk\"))\n\tdoc := []byte(\"abcde号。\")\n\tarrEncrypt, err := aesEnc.Encrypt(doc)\n\tglog.Infoln(string(arrEncrypt))\n\tif err != nil {\n\t\tglog.Infoln(string(arrEncrypt))\n\t\treturn\n\t}\n\tstrMsg, err := aesEnc.Decrypt(arrEncrypt)\n\tif err != nil {\n\t\tglog.Infoln(string(arrEncrypt))\n\t\treturn\n\t}\n\tglog.Infoln(string(strMsg))\n}\nfunc Test_XXTEA(t *testing.T) {\n\t/*str := \"Hello World! 你好，中国！\"\n\tkey := \"1234567890\"\n\tencrypt_data := Encrypt([]byte(str), []byte(key))\n\t//glog.Infoln(base64.StdEncoding.EncodeToString(encrypt_data))\n\tdecrypt_data := Decrypt(encrypt_data, []byte(key))*/\n\n}\nfunc TestPWD(t *testing.T) {\n\tt.Log(AalidataPwd(\"dolo0425\"))\n}\n\nfunc TestPhone(t *testing.T) {\n\tt.Log(PhoneRegexp(\"8601593533372\"))\n}\n\ntype AA struct {\n\tCC\n\tA int `json:\"a\"`\n}\n\ntype BB interface {\n\tDecode(b *[]byte) error\n\tEncode() (*[]byte, error)\n}\n\ntype CC struct{}\n\nfunc (this *CC) Decode(b *[]byte) error {\n\treturn json.Unmarshal(*b, this)\n}\n\nfunc (this *CC) Encode() (*[]byte, error) {\n\tdata, err := json.Marshal(this)\n\treturn &data, err\n}\n"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/waitgroup.go",
    "content": "package utils\n\n\nimport (\n\t\"sync\"\n)\n\ntype WaitGroupWrapper struct {\n\tsync.WaitGroup\n}\n\nfunc (w *WaitGroupWrapper) Wrap(cb func()) {\n\tw.Add(1)\n\tgo func() {\n\t\tcb()\n\t\tw.Done()\n\t}()\n}"
  },
  {
    "path": "src/github.com/dolotech/lib/utils/xxtea.go",
    "content": "package utils\n\nconst delta = 0x9E3779B9\n\nfunc toBytes(v []uint32, includeLength bool) []byte {\n\tlength := uint32(len(v))\n\tn := length << 2\n\tif includeLength {\n\t\tm := v[length-1]\n\t\tn -= 4\n\t\tif (m < n-3) || (m > n) {\n\t\t\treturn nil\n\t\t}\n\t\tn = m\n\t}\n\tbytes := make([]byte, n)\n\tfor i := uint32(0); i < n; i++ {\n\t\tbytes[i] = byte(v[i>>2] >> ((i & 3) << 3))\n\t}\n\treturn bytes\n}\n\nfunc toUint32s(bytes []byte, includeLength bool) (v []uint32) {\n\tlength := uint32(len(bytes))\n\tn := length >> 2\n\tif length&3 != 0 {\n\t\tn++\n\t}\n\tif includeLength {\n\t\tv = make([]uint32, n+1)\n\t\tv[n] = length\n\t} else {\n\t\tv = make([]uint32, n)\n\t}\n\tfor i := uint32(0); i < length; i++ {\n\t\tv[i>>2] |= uint32(bytes[i]) << ((i & 3) << 3)\n\t}\n\treturn v\n}\n\nfunc mx(sum uint32, y uint32, z uint32, p uint32, e uint32, k []uint32) uint32 {\n\treturn ((z>>5 ^ y<<2) + (y>>3 ^ z<<4)) ^ ((sum ^ y) + (k[p&3^e] ^ z))\n}\n\nfunc fixk(k []uint32) []uint32 {\n\tif len(k) < 4 {\n\t\tkey := make([]uint32, 4)\n\t\tcopy(key, k)\n\t\treturn key\n\t}\n\treturn k\n}\n\nfunc encrypt(v []uint32, k []uint32) []uint32 {\n\tlength := uint32(len(v))\n\tn := length - 1\n\tk = fixk(k)\n\tvar y, z, sum, e, p, q uint32\n\tz = v[n]\n\ty = v[0]\n\tsum = 0\n\tfor q = 6 + 52/length; q > 0; q-- {\n\t\tsum += delta\n\t\te = sum >> 2 & 3\n\t\tfor p = 0; p < n; p++ {\n\t\t\ty = v[p+1]\n\t\t\tv[p] += mx(sum, y, z, p, e, k)\n\t\t\tz = v[p]\n\t\t}\n\t\ty = v[0]\n\t\tv[n] += mx(sum, y, z, p, e, k)\n\t\tz = v[n]\n\t}\n\treturn v\n}\n\nfunc decrypt(v []uint32, k []uint32) []uint32 {\n\tlength := uint32(len(v))\n\tn := length - 1\n\tk = fixk(k)\n\tvar y, z, sum, e, p, q uint32\n\tz = v[n]\n\ty = v[0]\n\tq = 6 + 52/length\n\tfor sum = q * delta; sum != 0; sum -= delta {\n\t\te = sum >> 2 & 3\n\t\tfor p = n; p > 0; p-- {\n\t\t\tz = v[p-1]\n\t\t\tv[p] -= mx(sum, y, z, p, e, k)\n\t\t\ty = v[p]\n\t\t}\n\t\tz = v[n]\n\t\tv[0] -= mx(sum, y, z, p, e, k)\n\t\ty = v[0]\n\t}\n\treturn v\n}\n\n// Encrypt the data with key.\n// data is the bytes to be encrypted.\n// key is the encrypt key. It is the same as the decrypt key.\nfunc Encrypt(data []byte, key []byte) []byte {\n\tif data == nil || len(data) == 0 {\n\t\treturn data\n\t}\n\treturn toBytes(encrypt(toUint32s(data, true), toUint32s(key, false)), false)\n}\n\n// Decrypt the data with key.\n// data is the bytes to be decrypted.\n// key is the decrypted key. It is the same as the encrypt key.\nfunc Decrypt(data []byte, key []byte) []byte {\n\tif data == nil || len(data) == 0 {\n\t\treturn data\n\t}\n\treturn toBytes(decrypt(toUint32s(data, false), toUint32s(key, false)), true)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/LICENSE",
    "content": "Copyright (c) 2013 - 2015 Lunny Xiao <xiaolunwen@gmail.com>\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the {organization} nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "src/github.com/go-xorm/core/README.md",
    "content": "Core is a lightweight wrapper of sql.DB.\n\n# Open\n```Go\ndb, _ := core.Open(db, connstr)\n```\n\n# SetMapper\n```Go\ndb.SetMapper(SameMapper())\n```\n\n## Scan usage\n\n### Scan\n```Go\nrows, _ := db.Query()\nfor rows.Next() {\n    rows.Scan()\n}\n```\n\n### ScanMap\n```Go\nrows, _ := db.Query()\nfor rows.Next() {\n    rows.ScanMap()\n```\n\n### ScanSlice\n\nYou can use `[]string`, `[][]byte`, `[]interface{}`, `[]*string`, `[]sql.NullString` to ScanSclice. Notice, slice's length should be equal or less than select columns.\n\n```Go\nrows, _ := db.Query()\ncols, _ := rows.Columns()\nfor rows.Next() {\n    var s = make([]string, len(cols))\n    rows.ScanSlice(&s)\n}\n```\n\n```Go\nrows, _ := db.Query()\ncols, _ := rows.Columns()\nfor rows.Next() {\n    var s = make([]*string, len(cols))\n    rows.ScanSlice(&s)\n}\n```\n\n### ScanStruct\n```Go\nrows, _ := db.Query()\nfor rows.Next() {\n    rows.ScanStructByName()\n    rows.ScanStructByIndex()\n}\n```\n\n## Query usage\n```Go\nrows, err := db.Query(\"select * from table where name = ?\", name)\n\nuser = User{\n    Name:\"lunny\",\n}\nrows, err := db.QueryStruct(\"select * from table where name = ?Name\",\n            &user)\n\nvar user = map[string]interface{}{\n    \"name\": \"lunny\",\n}\nrows, err = db.QueryMap(\"select * from table where name = ?name\",\n            &user)\n```\n\n## QueryRow usage\n```Go\nrow := db.QueryRow(\"select * from table where name = ?\", name)\n\nuser = User{\n    Name:\"lunny\",\n}\nrow := db.QueryRowStruct(\"select * from table where name = ?Name\",\n            &user)\n\nvar user = map[string]interface{}{\n    \"name\": \"lunny\",\n}\nrow = db.QueryRowMap(\"select * from table where name = ?name\",\n            &user)\n```\n\n## Exec usage\n```Go\ndb.Exec(\"insert into user (`name`, title, age, alias, nick_name,created) values (?,?,?,?,?,?)\", name, title, age, alias...)\n\nuser = User{\n    Name:\"lunny\",\n    Title:\"test\",\n    Age: 18,\n}\nresult, err = db.ExecStruct(\"insert into user (`name`, title, age, alias, nick_name,created) values (?Name,?Title,?Age,?Alias,?NickName,?Created)\",\n            &user)\n\nvar user = map[string]interface{}{\n    \"Name\": \"lunny\",\n    \"Title\": \"test\",\n    \"Age\": 18,\n}\nresult, err = db.ExecMap(\"insert into user (`name`, title, age, alias, nick_name,created) values (?Name,?Title,?Age,?Alias,?NickName,?Created)\",\n            &user)\n```"
  },
  {
    "path": "src/github.com/go-xorm/core/benchmark.sh",
    "content": "go test -v -bench=. -run=XXX\n"
  },
  {
    "path": "src/github.com/go-xorm/core/cache.go",
    "content": "package core\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\t\"bytes\"\n\t\"encoding/gob\"\n)\n\nconst (\n\t// default cache expired time\n\tCacheExpired = 60 * time.Minute\n\t// not use now\n\tCacheMaxMemory = 256\n\t// evey ten minutes to clear all expired nodes\n\tCacheGcInterval = 10 * time.Minute\n\t// each time when gc to removed max nodes\n\tCacheGcMaxRemoved = 20\n)\n\nvar (\n\tErrCacheMiss = errors.New(\"xorm/cache: key not found.\")\n\tErrNotStored = errors.New(\"xorm/cache: not stored.\")\n)\n\n// CacheStore is a interface to store cache\ntype CacheStore interface {\n\t// key is primary key or composite primary key\n\t// value is struct's pointer\n\t// key format : <tablename>-p-<pk1>-<pk2>...\n\tPut(key string, value interface{}) error\n\tGet(key string) (interface{}, error)\n\tDel(key string) error\n}\n\n// Cacher is an interface to provide cache\n// id format : u-<pk1>-<pk2>...\ntype Cacher interface {\n\tGetIds(tableName, sql string) interface{}\n\tGetBean(tableName string, id string) interface{}\n\tPutIds(tableName, sql string, ids interface{})\n\tPutBean(tableName string, id string, obj interface{})\n\tDelIds(tableName, sql string)\n\tDelBean(tableName string, id string)\n\tClearIds(tableName string)\n\tClearBeans(tableName string)\n}\n\nfunc encodeIds(ids []PK) (string, error) {\n\tbuf := new(bytes.Buffer)\n\tenc := gob.NewEncoder(buf)\n\terr := enc.Encode(ids)\n\n\treturn buf.String(), err\n}\n\n\nfunc decodeIds(s string) ([]PK, error) {\n\tpks := make([]PK, 0)\n\n\tdec := gob.NewDecoder(bytes.NewBufferString(s))\n\terr := dec.Decode(&pks)\n\n\treturn pks, err\n}\n\nfunc GetCacheSql(m Cacher, tableName, sql string, args interface{}) ([]PK, error) {\n\tbytes := m.GetIds(tableName, GenSqlKey(sql, args))\n\tif bytes == nil {\n\t\treturn nil, errors.New(\"Not Exist\")\n\t}\n\treturn decodeIds(bytes.(string))\n}\n\nfunc PutCacheSql(m Cacher, ids []PK, tableName, sql string, args interface{}) error {\n\tbytes, err := encodeIds(ids)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.PutIds(tableName, GenSqlKey(sql, args), bytes)\n\treturn nil\n}\n\nfunc GenSqlKey(sql string, args interface{}) string {\n\treturn fmt.Sprintf(\"%v-%v\", sql, args)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/column.go",
    "content": "package core\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"time\"\n)\n\nconst (\n\tTWOSIDES = iota + 1\n\tONLYTODB\n\tONLYFROMDB\n)\n\n// database column\ntype Column struct {\n\tName            string\n\tTableName       string\n\tFieldName       string\n\tSQLType         SQLType\n\tLength          int\n\tLength2         int\n\tNullable        bool\n\tDefault         string\n\tIndexes         map[string]int\n\tIsPrimaryKey    bool\n\tIsAutoIncrement bool\n\tMapType         int\n\tIsCreated       bool\n\tIsUpdated       bool\n\tIsDeleted       bool\n\tIsCascade       bool\n\tIsVersion       bool\n\tfieldPath       []string\n\tDefaultIsEmpty  bool\n\tEnumOptions     map[string]int\n\tSetOptions      map[string]int\n\tDisableTimeZone bool\n\tTimeZone        *time.Location // column specified time zone\n}\n\nfunc NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable bool) *Column {\n\treturn &Column{\n\t\tName:            name,\n\t\tTableName:       \"\",\n\t\tFieldName:       fieldName,\n\t\tSQLType:         sqlType,\n\t\tLength:          len1,\n\t\tLength2:         len2,\n\t\tNullable:        nullable,\n\t\tDefault:         \"\",\n\t\tIndexes:         make(map[string]int),\n\t\tIsPrimaryKey:    false,\n\t\tIsAutoIncrement: false,\n\t\tMapType:         TWOSIDES,\n\t\tIsCreated:       false,\n\t\tIsUpdated:       false,\n\t\tIsDeleted:       false,\n\t\tIsCascade:       false,\n\t\tIsVersion:       false,\n\t\tfieldPath:       nil,\n\t\tDefaultIsEmpty:  false,\n\t\tEnumOptions:     make(map[string]int),\n\t}\n}\n\n// generate column description string according dialect\nfunc (col *Column) String(d Dialect) string {\n\tsql := d.QuoteStr() + col.Name + d.QuoteStr() + \" \"\n\n\tsql += d.SqlType(col) + \" \"\n\n\tif col.IsPrimaryKey {\n\t\tsql += \"PRIMARY KEY \"\n\t\tif col.IsAutoIncrement {\n\t\t\tsql += d.AutoIncrStr() + \" \"\n\t\t}\n\t}\n\n\tif d.ShowCreateNull() {\n\t\tif col.Nullable {\n\t\t\tsql += \"NULL \"\n\t\t} else {\n\t\t\tsql += \"NOT NULL \"\n\t\t}\n\t}\n\n\tif col.Default != \"\" {\n\t\tsql += \"DEFAULT \" + col.Default + \" \"\n\t}\n\n\treturn sql\n}\n\nfunc (col *Column) StringNoPk(d Dialect) string {\n\tsql := d.QuoteStr() + col.Name + d.QuoteStr() + \" \"\n\n\tsql += d.SqlType(col) + \" \"\n\n\tif d.ShowCreateNull() {\n\t\tif col.Nullable {\n\t\t\tsql += \"NULL \"\n\t\t} else {\n\t\t\tsql += \"NOT NULL \"\n\t\t}\n\t}\n\n\tif col.Default != \"\" {\n\t\tsql += \"DEFAULT \" + col.Default + \" \"\n\t}\n\n\treturn sql\n}\n\n// return col's filed of struct's value\nfunc (col *Column) ValueOf(bean interface{}) (*reflect.Value, error) {\n\tdataStruct := reflect.Indirect(reflect.ValueOf(bean))\n\treturn col.ValueOfV(&dataStruct)\n}\n\nfunc (col *Column) ValueOfV(dataStruct *reflect.Value) (*reflect.Value, error) {\n\tvar fieldValue reflect.Value\n\tif col.fieldPath == nil {\n\t\tcol.fieldPath = strings.Split(col.FieldName, \".\")\n\t}\n\n\tif dataStruct.Type().Kind() == reflect.Map {\n\t\tkeyValue := reflect.ValueOf(col.fieldPath[len(col.fieldPath)-1])\n\t\tfieldValue = dataStruct.MapIndex(keyValue)\n\t\treturn &fieldValue, nil\n\t} else if dataStruct.Type().Kind() == reflect.Interface {\n\t\tstructValue := reflect.ValueOf(dataStruct.Interface())\n\t\tdataStruct = &structValue\n\t}\n\n\tlevel := len(col.fieldPath)\n\tfieldValue = dataStruct.FieldByName(col.fieldPath[0])\n\tfor i := 0; i < level-1; i++ {\n\t\tif !fieldValue.IsValid() {\n\t\t\tbreak\n\t\t}\n\t\tif fieldValue.Kind() == reflect.Struct {\n\t\t\tfieldValue = fieldValue.FieldByName(col.fieldPath[i+1])\n\t\t} else if fieldValue.Kind() == reflect.Ptr {\n\t\t\tif fieldValue.IsNil() {\n\t\t\t\tfieldValue.Set(reflect.New(fieldValue.Type().Elem()))\n\t\t\t}\n\t\t\tfieldValue = fieldValue.Elem().FieldByName(col.fieldPath[i+1])\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"field  %v is not valid\", col.FieldName)\n\t\t}\n\t}\n\n\tif !fieldValue.IsValid() {\n\t\treturn nil, fmt.Errorf(\"field  %v is not valid\", col.FieldName)\n\t}\n\n\treturn &fieldValue, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/converstion.go",
    "content": "package core\n\n// Conversion is an interface. A type implements Conversion will according\n// the custom method to fill into database and retrieve from database.\ntype Conversion interface {\n\tFromDB([]byte) error\n\tToDB() ([]byte, error)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/db.go",
    "content": "package core\n\nimport (\n\t\"database/sql\"\n\t\"database/sql/driver\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"sync\"\n)\n\nfunc MapToSlice(query string, mp interface{}) (string, []interface{}, error) {\n\tvv := reflect.ValueOf(mp)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn \"\", []interface{}{}, ErrNoMapPointer\n\t}\n\n\targs := make([]interface{}, 0, len(vv.Elem().MapKeys()))\n\tvar err error\n\tquery = re.ReplaceAllStringFunc(query, func(src string) string {\n\t\tv := vv.Elem().MapIndex(reflect.ValueOf(src[1:]))\n\t\tif !v.IsValid() {\n\t\t\terr = fmt.Errorf(\"map key %s is missing\", src[1:])\n\t\t} else {\n\t\t\targs = append(args, v.Interface())\n\t\t}\n\t\treturn \"?\"\n\t})\n\n\treturn query, args, err\n}\n\nfunc StructToSlice(query string, st interface{}) (string, []interface{}, error) {\n\tvv := reflect.ValueOf(st)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\treturn \"\", []interface{}{}, ErrNoStructPointer\n\t}\n\n\targs := make([]interface{}, 0)\n\tvar err error\n\tquery = re.ReplaceAllStringFunc(query, func(src string) string {\n\t\tfv := vv.Elem().FieldByName(src[1:]).Interface()\n\t\tif v, ok := fv.(driver.Valuer); ok {\n\t\t\tvar value driver.Value\n\t\t\tvalue, err = v.Value()\n\t\t\tif err != nil {\n\t\t\t\treturn \"?\"\n\t\t\t}\n\t\t\targs = append(args, value)\n\t\t} else {\n\t\t\targs = append(args, fv)\n\t\t}\n\t\treturn \"?\"\n\t})\n\tif err != nil {\n\t\treturn \"\", []interface{}{}, err\n\t}\n\treturn query, args, nil\n}\n\ntype DB struct {\n\t*sql.DB\n\tMapper IMapper\n}\n\nfunc Open(driverName, dataSourceName string) (*DB, error) {\n\tdb, err := sql.Open(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{db, NewCacheMapper(&SnakeMapper{})}, nil\n}\n\nfunc FromDB(db *sql.DB) *DB {\n\treturn &DB{db, NewCacheMapper(&SnakeMapper{})}\n}\n\nfunc (db *DB) Query(query string, args ...interface{}) (*Rows, error) {\n\trows, err := db.DB.Query(query, args...)\n\tif err != nil {\n\t\tif rows != nil {\n\t\t\trows.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn &Rows{rows, db.Mapper}, nil\n}\n\nfunc (db *DB) QueryMap(query string, mp interface{}) (*Rows, error) {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.Query(query, args...)\n}\n\nfunc (db *DB) QueryStruct(query string, st interface{}) (*Rows, error) {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.Query(query, args...)\n}\n\ntype Row struct {\n\trows *Rows\n\t// One of these two will be non-nil:\n\terr error // deferred error for easy chaining\n}\n\nfunc (row *Row) Columns() ([]string, error) {\n\tif row.err != nil {\n\t\treturn nil, row.err\n\t}\n\treturn row.rows.Columns()\n}\n\nfunc (row *Row) Scan(dest ...interface{}) error {\n\tif row.err != nil {\n\t\treturn row.err\n\t}\n\tdefer row.rows.Close()\n\n\tfor _, dp := range dest {\n\t\tif _, ok := dp.(*sql.RawBytes); ok {\n\t\t\treturn errors.New(\"sql: RawBytes isn't allowed on Row.Scan\")\n\t\t}\n\t}\n\n\tif !row.rows.Next() {\n\t\tif err := row.rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn sql.ErrNoRows\n\t}\n\terr := row.rows.Scan(dest...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Make sure the query can be processed to completion with no errors.\n\treturn row.rows.Close()\n}\n\nfunc (row *Row) ScanStructByName(dest interface{}) error {\n\tif row.err != nil {\n\t\treturn row.err\n\t}\n\tif !row.rows.Next() {\n\t\tif err := row.rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn sql.ErrNoRows\n\t}\n\terr := row.rows.ScanStructByName(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Make sure the query can be processed to completion with no errors.\n\treturn row.rows.Close()\n}\n\nfunc (row *Row) ScanStructByIndex(dest interface{}) error {\n\tif row.err != nil {\n\t\treturn row.err\n\t}\n\tif !row.rows.Next() {\n\t\tif err := row.rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn sql.ErrNoRows\n\t}\n\terr := row.rows.ScanStructByIndex(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Make sure the query can be processed to completion with no errors.\n\treturn row.rows.Close()\n}\n\n// scan data to a slice's pointer, slice's length should equal to columns' number\nfunc (row *Row) ScanSlice(dest interface{}) error {\n\tif row.err != nil {\n\t\treturn row.err\n\t}\n\tif !row.rows.Next() {\n\t\tif err := row.rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn sql.ErrNoRows\n\t}\n\terr := row.rows.ScanSlice(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure the query can be processed to completion with no errors.\n\treturn row.rows.Close()\n}\n\n// scan data to a map's pointer\nfunc (row *Row) ScanMap(dest interface{}) error {\n\tif row.err != nil {\n\t\treturn row.err\n\t}\n\tif !row.rows.Next() {\n\t\tif err := row.rows.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn sql.ErrNoRows\n\t}\n\terr := row.rows.ScanMap(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure the query can be processed to completion with no errors.\n\treturn row.rows.Close()\n}\n\nfunc (db *DB) QueryRow(query string, args ...interface{}) *Row {\n\trows, err := db.Query(query, args...)\n\tif err != nil {\n\t\treturn &Row{nil, err}\n\t}\n\treturn &Row{rows, nil}\n}\n\nfunc (db *DB) QueryRowMap(query string, mp interface{}) *Row {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn &Row{nil, err}\n\t}\n\treturn db.QueryRow(query, args...)\n}\n\nfunc (db *DB) QueryRowStruct(query string, st interface{}) *Row {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn &Row{nil, err}\n\t}\n\treturn db.QueryRow(query, args...)\n}\n\ntype Stmt struct {\n\t*sql.Stmt\n\tMapper IMapper\n\tnames  map[string]int\n}\n\nfunc (db *DB) Prepare(query string) (*Stmt, error) {\n\tnames := make(map[string]int)\n\tvar i int\n\tquery = re.ReplaceAllStringFunc(query, func(src string) string {\n\t\tnames[src[1:]] = i\n\t\ti += 1\n\t\treturn \"?\"\n\t})\n\n\tstmt, err := db.DB.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Stmt{stmt, db.Mapper, names}, nil\n}\n\nfunc (s *Stmt) ExecMap(mp interface{}) (sql.Result, error) {\n\tvv := reflect.ValueOf(mp)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn nil, errors.New(\"mp should be a map's pointer\")\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().MapIndex(reflect.ValueOf(k)).Interface()\n\t}\n\treturn s.Stmt.Exec(args...)\n}\n\nfunc (s *Stmt) ExecStruct(st interface{}) (sql.Result, error) {\n\tvv := reflect.ValueOf(st)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\treturn nil, errors.New(\"mp should be a map's pointer\")\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().FieldByName(k).Interface()\n\t}\n\treturn s.Stmt.Exec(args...)\n}\n\nfunc (s *Stmt) Query(args ...interface{}) (*Rows, error) {\n\trows, err := s.Stmt.Query(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Rows{rows, s.Mapper}, nil\n}\n\nfunc (s *Stmt) QueryMap(mp interface{}) (*Rows, error) {\n\tvv := reflect.ValueOf(mp)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn nil, errors.New(\"mp should be a map's pointer\")\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().MapIndex(reflect.ValueOf(k)).Interface()\n\t}\n\n\treturn s.Query(args...)\n}\n\nfunc (s *Stmt) QueryStruct(st interface{}) (*Rows, error) {\n\tvv := reflect.ValueOf(st)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\treturn nil, errors.New(\"mp should be a map's pointer\")\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().FieldByName(k).Interface()\n\t}\n\n\treturn s.Query(args...)\n}\n\nfunc (s *Stmt) QueryRow(args ...interface{}) *Row {\n\trows, err := s.Query(args...)\n\treturn &Row{rows, err}\n}\n\nfunc (s *Stmt) QueryRowMap(mp interface{}) *Row {\n\tvv := reflect.ValueOf(mp)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn &Row{nil, errors.New(\"mp should be a map's pointer\")}\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().MapIndex(reflect.ValueOf(k)).Interface()\n\t}\n\n\treturn s.QueryRow(args...)\n}\n\nfunc (s *Stmt) QueryRowStruct(st interface{}) *Row {\n\tvv := reflect.ValueOf(st)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\treturn &Row{nil, errors.New(\"st should be a struct's pointer\")}\n\t}\n\n\targs := make([]interface{}, len(s.names))\n\tfor k, i := range s.names {\n\t\targs[i] = vv.Elem().FieldByName(k).Interface()\n\t}\n\n\treturn s.QueryRow(args...)\n}\n\nvar (\n\tre = regexp.MustCompile(`[?](\\w+)`)\n)\n\n// insert into (name) values (?)\n// insert into (name) values (?name)\nfunc (db *DB) ExecMap(query string, mp interface{}) (sql.Result, error) {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.DB.Exec(query, args...)\n}\n\nfunc (db *DB) ExecStruct(query string, st interface{}) (sql.Result, error) {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db.DB.Exec(query, args...)\n}\n\ntype Rows struct {\n\t*sql.Rows\n\tMapper IMapper\n}\n\n// scan data to a struct's pointer according field index\nfunc (rs *Rows) ScanStructByIndex(dest ...interface{}) error {\n\tif len(dest) == 0 {\n\t\treturn errors.New(\"at least one struct\")\n\t}\n\n\tvvvs := make([]reflect.Value, len(dest))\n\tfor i, s := range dest {\n\t\tvv := reflect.ValueOf(s)\n\t\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\t\treturn errors.New(\"dest should be a struct's pointer\")\n\t\t}\n\n\t\tvvvs[i] = vv.Elem()\n\t}\n\n\tcols, err := rs.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewDest := make([]interface{}, len(cols))\n\n\tvar i = 0\n\tfor _, vvv := range vvvs {\n\t\tfor j := 0; j < vvv.NumField(); j++ {\n\t\t\tnewDest[i] = vvv.Field(j).Addr().Interface()\n\t\t\ti = i + 1\n\t\t}\n\t}\n\n\treturn rs.Rows.Scan(newDest...)\n}\n\ntype EmptyScanner struct {\n}\n\nfunc (EmptyScanner) Scan(src interface{}) error {\n\treturn nil\n}\n\nvar (\n\tfieldCache      = make(map[reflect.Type]map[string]int)\n\tfieldCacheMutex sync.RWMutex\n)\n\nfunc fieldByName(v reflect.Value, name string) reflect.Value {\n\tt := v.Type()\n\tfieldCacheMutex.RLock()\n\tcache, ok := fieldCache[t]\n\tfieldCacheMutex.RUnlock()\n\tif !ok {\n\t\tcache = make(map[string]int)\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tcache[t.Field(i).Name] = i\n\t\t}\n\t\tfieldCacheMutex.Lock()\n\t\tfieldCache[t] = cache\n\t\tfieldCacheMutex.Unlock()\n\t}\n\n\tif i, ok := cache[name]; ok {\n\t\treturn v.Field(i)\n\t}\n\n\treturn reflect.Zero(t)\n}\n\n// scan data to a struct's pointer according field name\nfunc (rs *Rows) ScanStructByName(dest interface{}) error {\n\tvv := reflect.ValueOf(dest)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"dest should be a struct's pointer\")\n\t}\n\n\tcols, err := rs.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewDest := make([]interface{}, len(cols))\n\tvar v EmptyScanner\n\tfor j, name := range cols {\n\t\tf := fieldByName(vv.Elem(), rs.Mapper.Table2Obj(name))\n\t\tif f.IsValid() {\n\t\t\tnewDest[j] = f.Addr().Interface()\n\t\t} else {\n\t\t\tnewDest[j] = &v\n\t\t}\n\t}\n\n\treturn rs.Rows.Scan(newDest...)\n}\n\ntype cacheStruct struct {\n\tvalue reflect.Value\n\tidx   int\n}\n\nvar (\n\treflectCache      = make(map[reflect.Type]*cacheStruct)\n\treflectCacheMutex sync.RWMutex\n)\n\nfunc ReflectNew(typ reflect.Type) reflect.Value {\n\treflectCacheMutex.RLock()\n\tcs, ok := reflectCache[typ]\n\treflectCacheMutex.RUnlock()\n\n\tconst newSize = 200\n\n\tif !ok || cs.idx+1 > newSize-1 {\n\t\tcs = &cacheStruct{reflect.MakeSlice(reflect.SliceOf(typ), newSize, newSize), 0}\n\t\treflectCacheMutex.Lock()\n\t\treflectCache[typ] = cs\n\t\treflectCacheMutex.Unlock()\n\t} else {\n\t\treflectCacheMutex.Lock()\n\t\tcs.idx = cs.idx + 1\n\t\treflectCacheMutex.Unlock()\n\t}\n\treturn cs.value.Index(cs.idx).Addr()\n}\n\n// scan data to a slice's pointer, slice's length should equal to columns' number\nfunc (rs *Rows) ScanSlice(dest interface{}) error {\n\tvv := reflect.ValueOf(dest)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Slice {\n\t\treturn errors.New(\"dest should be a slice's pointer\")\n\t}\n\n\tvvv := vv.Elem()\n\tcols, err := rs.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewDest := make([]interface{}, len(cols))\n\n\tfor j := 0; j < len(cols); j++ {\n\t\tif j >= vvv.Len() {\n\t\t\tnewDest[j] = reflect.New(vvv.Type().Elem()).Interface()\n\t\t} else {\n\t\t\tnewDest[j] = vvv.Index(j).Addr().Interface()\n\t\t}\n\t}\n\n\terr = rs.Rows.Scan(newDest...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcLen := vvv.Len()\n\tfor i := srcLen; i < len(cols); i++ {\n\t\tvvv = reflect.Append(vvv, reflect.ValueOf(newDest[i]).Elem())\n\t}\n\treturn nil\n}\n\n// scan data to a map's pointer\nfunc (rs *Rows) ScanMap(dest interface{}) error {\n\tvv := reflect.ValueOf(dest)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn errors.New(\"dest should be a map's pointer\")\n\t}\n\n\tcols, err := rs.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewDest := make([]interface{}, len(cols))\n\tvvv := vv.Elem()\n\n\tfor i, _ := range cols {\n\t\tnewDest[i] = ReflectNew(vvv.Type().Elem()).Interface()\n\t\t//v := reflect.New(vvv.Type().Elem())\n\t\t//newDest[i] = v.Interface()\n\t}\n\n\terr = rs.Rows.Scan(newDest...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, name := range cols {\n\t\tvname := reflect.ValueOf(name)\n\t\tvvv.SetMapIndex(vname, reflect.ValueOf(newDest[i]).Elem())\n\t}\n\n\treturn nil\n}\n\n/*func (rs *Rows) ScanMap(dest interface{}) error {\n\tvv := reflect.ValueOf(dest)\n\tif vv.Kind() != reflect.Ptr || vv.Elem().Kind() != reflect.Map {\n\t\treturn errors.New(\"dest should be a map's pointer\")\n\t}\n\n\tcols, err := rs.Columns()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewDest := make([]interface{}, len(cols))\n\terr = rs.ScanSlice(newDest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvvv := vv.Elem()\n\n\tfor i, name := range cols {\n\t\tvname := reflect.ValueOf(name)\n\t\tvvv.SetMapIndex(vname, reflect.ValueOf(newDest[i]).Elem())\n\t}\n\n\treturn nil\n}*/\n\ntype Tx struct {\n\t*sql.Tx\n\tMapper IMapper\n}\n\nfunc (db *DB) Begin() (*Tx, error) {\n\ttx, err := db.DB.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{tx, db.Mapper}, nil\n}\n\nfunc (tx *Tx) Prepare(query string) (*Stmt, error) {\n\tnames := make(map[string]int)\n\tvar i int\n\tquery = re.ReplaceAllStringFunc(query, func(src string) string {\n\t\tnames[src[1:]] = i\n\t\ti += 1\n\t\treturn \"?\"\n\t})\n\n\tstmt, err := tx.Tx.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Stmt{stmt, tx.Mapper, names}, nil\n}\n\nfunc (tx *Tx) Stmt(stmt *Stmt) *Stmt {\n\t// TODO:\n\treturn stmt\n}\n\nfunc (tx *Tx) ExecMap(query string, mp interface{}) (sql.Result, error) {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.Tx.Exec(query, args...)\n}\n\nfunc (tx *Tx) ExecStruct(query string, st interface{}) (sql.Result, error) {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.Tx.Exec(query, args...)\n}\n\nfunc (tx *Tx) Query(query string, args ...interface{}) (*Rows, error) {\n\trows, err := tx.Tx.Query(query, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Rows{rows, tx.Mapper}, nil\n}\n\nfunc (tx *Tx) QueryMap(query string, mp interface{}) (*Rows, error) {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.Query(query, args...)\n}\n\nfunc (tx *Tx) QueryStruct(query string, st interface{}) (*Rows, error) {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.Query(query, args...)\n}\n\nfunc (tx *Tx) QueryRow(query string, args ...interface{}) *Row {\n\trows, err := tx.Query(query, args...)\n\treturn &Row{rows, err}\n}\n\nfunc (tx *Tx) QueryRowMap(query string, mp interface{}) *Row {\n\tquery, args, err := MapToSlice(query, mp)\n\tif err != nil {\n\t\treturn &Row{nil, err}\n\t}\n\treturn tx.QueryRow(query, args...)\n}\n\nfunc (tx *Tx) QueryRowStruct(query string, st interface{}) *Row {\n\tquery, args, err := StructToSlice(query, st)\n\tif err != nil {\n\t\treturn &Row{nil, err}\n\t}\n\treturn tx.QueryRow(query, args...)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/dialect.go",
    "content": "package core\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n)\n\ntype DbType string\n\ntype Uri struct {\n\tDbType  DbType\n\tProto   string\n\tHost    string\n\tPort    string\n\tDbName  string\n\tUser    string\n\tPasswd  string\n\tCharset string\n\tLaddr   string\n\tRaddr   string\n\tTimeout time.Duration\n\tSchema  string\n}\n\n// a dialect is a driver's wrapper\ntype Dialect interface {\n\tSetLogger(logger ILogger)\n\tInit(*DB, *Uri, string, string) error\n\tURI() *Uri\n\tDB() *DB\n\tDBType() DbType\n\tSqlType(*Column) string\n\tFormatBytes(b []byte) string\n\n\tDriverName() string\n\tDataSourceName() string\n\n\tQuoteStr() string\n\tIsReserved(string) bool\n\tQuote(string) string\n\tAndStr() string\n\tOrStr() string\n\tEqStr() string\n\tRollBackStr() string\n\tAutoIncrStr() string\n\n\tSupportInsertMany() bool\n\tSupportEngine() bool\n\tSupportCharset() bool\n\tSupportDropIfExists() bool\n\tIndexOnTable() bool\n\tShowCreateNull() bool\n\n\tIndexCheckSql(tableName, idxName string) (string, []interface{})\n\tTableCheckSql(tableName string) (string, []interface{})\n\n\tIsColumnExist(tableName string, colName string) (bool, error)\n\n\tCreateTableSql(table *Table, tableName, storeEngine, charset string) string\n\tDropTableSql(tableName string) string\n\tCreateIndexSql(tableName string, index *Index) string\n\tDropIndexSql(tableName string, index *Index) string\n\n\tModifyColumnSql(tableName string, col *Column) string\n\n\tForUpdateSql(query string) string\n\n\t//CreateTableIfNotExists(table *Table, tableName, storeEngine, charset string) error\n\t//MustDropTable(tableName string) error\n\n\tGetColumns(tableName string) ([]string, map[string]*Column, error)\n\tGetTables() ([]*Table, error)\n\tGetIndexes(tableName string) (map[string]*Index, error)\n\n\tFilters() []Filter\n}\n\nfunc OpenDialect(dialect Dialect) (*DB, error) {\n\treturn Open(dialect.DriverName(), dialect.DataSourceName())\n}\n\ntype Base struct {\n\tdb             *DB\n\tdialect        Dialect\n\tdriverName     string\n\tdataSourceName string\n\tlogger         ILogger\n\t*Uri\n}\n\nfunc (b *Base) DB() *DB {\n\treturn b.db\n}\n\nfunc (b *Base) SetLogger(logger ILogger) {\n\tb.logger = logger\n}\n\nfunc (b *Base) Init(db *DB, dialect Dialect, uri *Uri, drivername, dataSourceName string) error {\n\tb.db, b.dialect, b.Uri = db, dialect, uri\n\tb.driverName, b.dataSourceName = drivername, dataSourceName\n\treturn nil\n}\n\nfunc (b *Base) URI() *Uri {\n\treturn b.Uri\n}\n\nfunc (b *Base) DBType() DbType {\n\treturn b.Uri.DbType\n}\n\nfunc (b *Base) FormatBytes(bs []byte) string {\n\treturn fmt.Sprintf(\"0x%x\", bs)\n}\n\nfunc (b *Base) DriverName() string {\n\treturn b.driverName\n}\n\nfunc (b *Base) ShowCreateNull() bool {\n\treturn true\n}\n\nfunc (b *Base) DataSourceName() string {\n\treturn b.dataSourceName\n}\n\nfunc (b *Base) AndStr() string {\n\treturn \"AND\"\n}\n\nfunc (b *Base) OrStr() string {\n\treturn \"OR\"\n}\n\nfunc (b *Base) EqStr() string {\n\treturn \"=\"\n}\n\nfunc (db *Base) RollBackStr() string {\n\treturn \"ROLL BACK\"\n}\n\nfunc (db *Base) SupportDropIfExists() bool {\n\treturn true\n}\n\nfunc (db *Base) DropTableSql(tableName string) string {\n\treturn fmt.Sprintf(\"DROP TABLE IF EXISTS `%s`\", tableName)\n}\n\nfunc (db *Base) HasRecords(query string, args ...interface{}) (bool, error) {\n\tdb.LogSQL(query, args)\n\trows, err := db.DB().Query(query, args...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer rows.Close()\n\n\tif rows.Next() {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}\n\nfunc (db *Base) IsColumnExist(tableName, colName string) (bool, error) {\n\tquery := \"SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ?\"\n\tquery = strings.Replace(query, \"`\", db.dialect.QuoteStr(), -1)\n\treturn db.HasRecords(query, db.DbName, tableName, colName)\n}\n\n/*\nfunc (db *Base) CreateTableIfNotExists(table *Table, tableName, storeEngine, charset string) error {\n\tsql, args := db.dialect.TableCheckSql(tableName)\n\trows, err := db.DB().Query(sql, args...)\n\tif db.Logger != nil {\n\t\tdb.Logger.Info(\"[sql]\", sql, args)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tif rows.Next() {\n\t\treturn nil\n\t}\n\n\tsql = db.dialect.CreateTableSql(table, tableName, storeEngine, charset)\n\t_, err = db.DB().Exec(sql)\n\tif db.Logger != nil {\n\t\tdb.Logger.Info(\"[sql]\", sql)\n\t}\n\treturn err\n}*/\n\nfunc (db *Base) CreateIndexSql(tableName string, index *Index) string {\n\tquote := db.dialect.Quote\n\tvar unique string\n\tvar idxName string\n\tif index.Type == UniqueType {\n\t\tunique = \" UNIQUE\"\n\t}\n\tidxName = index.XName(tableName)\n\treturn fmt.Sprintf(\"CREATE%s INDEX %v ON %v (%v)\", unique,\n\t\tquote(idxName), quote(tableName),\n\t\tquote(strings.Join(index.Cols, quote(\",\"))))\n}\n\nfunc (db *Base) DropIndexSql(tableName string, index *Index) string {\n\tquote := db.dialect.Quote\n\tvar name string\n\tif index.IsRegular {\n\t\tname = index.XName(tableName)\n\t} else {\n\t\tname = index.Name\n\t}\n\treturn fmt.Sprintf(\"DROP INDEX %v ON %s\", quote(name), quote(tableName))\n}\n\nfunc (db *Base) ModifyColumnSql(tableName string, col *Column) string {\n\treturn fmt.Sprintf(\"alter table %s MODIFY COLUMN %s\", tableName, col.StringNoPk(db.dialect))\n}\n\nfunc (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset string) string {\n\tvar sql string\n\tsql = \"CREATE TABLE IF NOT EXISTS \"\n\tif tableName == \"\" {\n\t\ttableName = table.Name\n\t}\n\n\tsql += b.dialect.Quote(tableName)\n\tsql += \" (\"\n\n\tif len(table.ColumnsSeq()) > 0 {\n\t\tpkList := table.PrimaryKeys\n\n\t\tfor _, colName := range table.ColumnsSeq() {\n\t\t\tcol := table.GetColumn(colName)\n\t\t\tif col.IsPrimaryKey && len(pkList) == 1 {\n\t\t\t\tsql += col.String(b.dialect)\n\t\t\t} else {\n\t\t\t\tsql += col.StringNoPk(b.dialect)\n\t\t\t}\n\t\t\tsql = strings.TrimSpace(sql)\n\t\t\tsql += \", \"\n\t\t}\n\n\t\tif len(pkList) > 1 {\n\t\t\tsql += \"PRIMARY KEY ( \"\n\t\t\tsql += b.dialect.Quote(strings.Join(pkList, b.dialect.Quote(\",\")))\n\t\t\tsql += \" ), \"\n\t\t}\n\n\t\tsql = sql[:len(sql)-2]\n\t}\n\tsql += \")\"\n\n\tif b.dialect.SupportEngine() && storeEngine != \"\" {\n\t\tsql += \" ENGINE=\" + storeEngine\n\t}\n\tif b.dialect.SupportCharset() {\n\t\tif len(charset) == 0 {\n\t\t\tcharset = b.dialect.URI().Charset\n\t\t}\n\t\tif len(charset) > 0 {\n\t\t\tsql += \" DEFAULT CHARSET \" + charset\n\t\t}\n\t}\n\n\treturn sql\n}\n\nfunc (b *Base) ForUpdateSql(query string) string {\n\treturn query + \" FOR UPDATE\"\n}\n\nfunc (b *Base) LogSQL(sql string, args []interface{}) {\n\tif b.logger != nil && b.logger.IsShowSQL() {\n\t\tif len(args) > 0 {\n\t\t\tb.logger.Info(\"[sql]\", sql, args)\n\t\t} else {\n\t\t\tb.logger.Info(\"[sql]\", sql)\n\t\t}\n\t}\n}\n\nvar (\n\tdialects = map[DbType]func() Dialect{}\n)\n\nfunc RegisterDialect(dbName DbType, dialectFunc func() Dialect) {\n\tif dialectFunc == nil {\n\t\tpanic(\"core: Register dialect is nil\")\n\t}\n\tdialects[dbName] = dialectFunc // !nashtsai! allow override dialect\n}\n\nfunc QueryDialect(dbName DbType) Dialect {\n\treturn dialects[dbName]()\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/driver.go",
    "content": "package core\n\ntype Driver interface {\n\tParse(string, string) (*Uri, error)\n}\n\nvar (\n\tdrivers = map[string]Driver{}\n)\n\nfunc RegisterDriver(driverName string, driver Driver) {\n\tif driver == nil {\n\t\tpanic(\"core: Register driver is nil\")\n\t}\n\tif _, dup := drivers[driverName]; dup {\n\t\tpanic(\"core: Register called twice for driver \" + driverName)\n\t}\n\tdrivers[driverName] = driver\n}\n\nfunc QueryDriver(driverName string) Driver {\n\treturn drivers[driverName]\n}\n\nfunc RegisteredDriverSize() int {\n\treturn len(drivers)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/error.go",
    "content": "package core\n\nimport \"errors\"\n\nvar (\n\tErrNoMapPointer    = errors.New(\"mp should be a map's pointer\")\n\tErrNoStructPointer = errors.New(\"mp should be a struct's pointer\")\n)\n"
  },
  {
    "path": "src/github.com/go-xorm/core/filter.go",
    "content": "package core\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// Filter is an interface to filter SQL\ntype Filter interface {\n\tDo(sql string, dialect Dialect, table *Table) string\n}\n\n// QuoteFilter filter SQL replace ` to database's own quote character\ntype QuoteFilter struct {\n}\n\nfunc (s *QuoteFilter) Do(sql string, dialect Dialect, table *Table) string {\n\treturn strings.Replace(sql, \"`\", dialect.QuoteStr(), -1)\n}\n\n// IdFilter filter SQL replace (id) to primary key column name\ntype IdFilter struct {\n}\n\ntype Quoter struct {\n\tdialect Dialect\n}\n\nfunc NewQuoter(dialect Dialect) *Quoter {\n\treturn &Quoter{dialect}\n}\n\nfunc (q *Quoter) Quote(content string) string {\n\treturn q.dialect.QuoteStr() + content + q.dialect.QuoteStr()\n}\n\nfunc (i *IdFilter) Do(sql string, dialect Dialect, table *Table) string {\n\tquoter := NewQuoter(dialect)\n\tif table != nil && len(table.PrimaryKeys) == 1 {\n\t\tsql = strings.Replace(sql, \"`(id)`\", quoter.Quote(table.PrimaryKeys[0]), -1)\n\t\tsql = strings.Replace(sql, quoter.Quote(\"(id)\"), quoter.Quote(table.PrimaryKeys[0]), -1)\n\t\treturn strings.Replace(sql, \"(id)\", quoter.Quote(table.PrimaryKeys[0]), -1)\n\t}\n\treturn sql\n}\n\n// SeqFilter filter SQL replace ?, ? ... to $1, $2 ...\ntype SeqFilter struct {\n\tPrefix string\n\tStart  int\n}\n\nfunc (s *SeqFilter) Do(sql string, dialect Dialect, table *Table) string {\n\tsegs := strings.Split(sql, \"?\")\n\tsize := len(segs)\n\tres := \"\"\n\tfor i, c := range segs {\n\t\tif i < size-1 {\n\t\t\tres += c + fmt.Sprintf(\"%s%v\", s.Prefix, i+s.Start)\n\t\t}\n\t}\n\tres += segs[size-1]\n\treturn res\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/ilogger.go",
    "content": "package core\n\ntype LogLevel int\n\nconst (\n\t// !nashtsai! following level also match syslog.Priority value\n\tLOG_DEBUG LogLevel = iota\n\tLOG_INFO\n\tLOG_WARNING\n\tLOG_ERR\n\tLOG_OFF\n\tLOG_UNKNOWN\n)\n\n// logger interface\ntype ILogger interface {\n\tDebug(v ...interface{})\n\tDebugf(format string, v ...interface{})\n\tError(v ...interface{})\n\tErrorf(format string, v ...interface{})\n\tInfo(v ...interface{})\n\tInfof(format string, v ...interface{})\n\tWarn(v ...interface{})\n\tWarnf(format string, v ...interface{})\n\n\tLevel() LogLevel\n\tSetLevel(l LogLevel)\n\n\tShowSQL(show ...bool)\n\tIsShowSQL() bool\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/index.go",
    "content": "package core\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n\t\"strings\"\n)\n\nconst (\n\tIndexType = iota + 1\n\tUniqueType\n)\n\n// database index\ntype Index struct {\n\tIsRegular bool\n\tName      string\n\tType      int\n\tCols      []string\n}\n\nfunc (index *Index) XName(tableName string) string {\n\tif !strings.HasPrefix(index.Name, \"UQE_\") &&\n\t\t!strings.HasPrefix(index.Name, \"IDX_\") {\n\t\tif index.Type == UniqueType {\n\t\t\treturn fmt.Sprintf(\"UQE_%v_%v\", tableName, index.Name)\n\t\t}\n\t\treturn fmt.Sprintf(\"IDX_%v_%v\", tableName, index.Name)\n\t}\n\treturn index.Name\n}\n\n// add columns which will be composite index\nfunc (index *Index) AddColumn(cols ...string) {\n\tfor _, col := range cols {\n\t\tindex.Cols = append(index.Cols, col)\n\t}\n}\n\nfunc (index *Index) Equal(dst *Index) bool {\n\tif index.Type != dst.Type {\n\t\treturn false\n\t}\n\tif len(index.Cols) != len(dst.Cols) {\n\t\treturn false\n\t}\n\tsort.StringSlice(index.Cols).Sort()\n\tsort.StringSlice(dst.Cols).Sort()\n\n\tfor i := 0; i < len(index.Cols); i++ {\n\t\tif index.Cols[i] != dst.Cols[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// new an index\nfunc NewIndex(name string, indexType int) *Index {\n\treturn &Index{true, name, indexType, make([]string, 0)}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/mapper.go",
    "content": "package core\n\nimport (\n\t\"strings\"\n\t\"sync\"\n)\n\n// name translation between struct, fields names and table, column names\ntype IMapper interface {\n\tObj2Table(string) string\n\tTable2Obj(string) string\n}\n\ntype CacheMapper struct {\n\toriMapper      IMapper\n\tobj2tableCache map[string]string\n\tobj2tableMutex sync.RWMutex\n\ttable2objCache map[string]string\n\ttable2objMutex sync.RWMutex\n}\n\nfunc NewCacheMapper(mapper IMapper) *CacheMapper {\n\treturn &CacheMapper{oriMapper: mapper, obj2tableCache: make(map[string]string),\n\t\ttable2objCache: make(map[string]string),\n\t}\n}\n\nfunc (m *CacheMapper) Obj2Table(o string) string {\n\tm.obj2tableMutex.RLock()\n\tt, ok := m.obj2tableCache[o]\n\tm.obj2tableMutex.RUnlock()\n\tif ok {\n\t\treturn t\n\t}\n\n\tt = m.oriMapper.Obj2Table(o)\n\tm.obj2tableMutex.Lock()\n\tm.obj2tableCache[o] = t\n\tm.obj2tableMutex.Unlock()\n\treturn t\n}\n\nfunc (m *CacheMapper) Table2Obj(t string) string {\n\tm.table2objMutex.RLock()\n\to, ok := m.table2objCache[t]\n\tm.table2objMutex.RUnlock()\n\tif ok {\n\t\treturn o\n\t}\n\n\to = m.oriMapper.Table2Obj(t)\n\tm.table2objMutex.Lock()\n\tm.table2objCache[t] = o\n\tm.table2objMutex.Unlock()\n\treturn o\n}\n\n// SameMapper implements IMapper and provides same name between struct and\n// database table\ntype SameMapper struct {\n}\n\nfunc (m SameMapper) Obj2Table(o string) string {\n\treturn o\n}\n\nfunc (m SameMapper) Table2Obj(t string) string {\n\treturn t\n}\n\n// SnakeMapper implements IMapper and provides name transaltion between\n// struct and database table\ntype SnakeMapper struct {\n}\n\nfunc snakeCasedName(name string) string {\n\tnewstr := make([]rune, 0)\n\tfor idx, chr := range name {\n\t\tif isUpper := 'A' <= chr && chr <= 'Z'; isUpper {\n\t\t\tif idx > 0 {\n\t\t\t\tnewstr = append(newstr, '_')\n\t\t\t}\n\t\t\tchr -= ('A' - 'a')\n\t\t}\n\t\tnewstr = append(newstr, chr)\n\t}\n\n\treturn string(newstr)\n}\n\nfunc (mapper SnakeMapper) Obj2Table(name string) string {\n\treturn snakeCasedName(name)\n}\n\nfunc titleCasedName(name string) string {\n\tnewstr := make([]rune, 0)\n\tupNextChar := true\n\n\tname = strings.ToLower(name)\n\n\tfor _, chr := range name {\n\t\tswitch {\n\t\tcase upNextChar:\n\t\t\tupNextChar = false\n\t\t\tif 'a' <= chr && chr <= 'z' {\n\t\t\t\tchr -= ('a' - 'A')\n\t\t\t}\n\t\tcase chr == '_':\n\t\t\tupNextChar = true\n\t\t\tcontinue\n\t\t}\n\n\t\tnewstr = append(newstr, chr)\n\t}\n\n\treturn string(newstr)\n}\n\nfunc (mapper SnakeMapper) Table2Obj(name string) string {\n\treturn titleCasedName(name)\n}\n\n// GonicMapper implements IMapper. It will consider initialisms when mapping names.\n// E.g. id -> ID, user -> User and to table names: UserID -> user_id, MyUID -> my_uid\ntype GonicMapper map[string]bool\n\nfunc isASCIIUpper(r rune) bool {\n\treturn 'A' <= r && r <= 'Z'\n}\n\nfunc toASCIIUpper(r rune) rune {\n\tif 'a' <= r && r <= 'z' {\n\t\tr -= ('a' - 'A')\n\t}\n\treturn r\n}\n\nfunc gonicCasedName(name string) string {\n\tnewstr := make([]rune, 0, len(name)+3)\n\tfor idx, chr := range name {\n\t\tif isASCIIUpper(chr) && idx > 0 {\n\t\t\tif !isASCIIUpper(newstr[len(newstr)-1]) {\n\t\t\t\tnewstr = append(newstr, '_')\n\t\t\t}\n\t\t}\n\n\t\tif !isASCIIUpper(chr) && idx > 1 {\n\t\t\tl := len(newstr)\n\t\t\tif isASCIIUpper(newstr[l-1]) && isASCIIUpper(newstr[l-2]) {\n\t\t\t\tnewstr = append(newstr, newstr[l-1])\n\t\t\t\tnewstr[l-1] = '_'\n\t\t\t}\n\t\t}\n\n\t\tnewstr = append(newstr, chr)\n\t}\n\treturn strings.ToLower(string(newstr))\n}\n\nfunc (mapper GonicMapper) Obj2Table(name string) string {\n\treturn gonicCasedName(name)\n}\n\nfunc (mapper GonicMapper) Table2Obj(name string) string {\n\tnewstr := make([]rune, 0)\n\n\tname = strings.ToLower(name)\n\tparts := strings.Split(name, \"_\")\n\n\tfor _, p := range parts {\n\t\t_, isInitialism := mapper[strings.ToUpper(p)]\n\t\tfor i, r := range p {\n\t\t\tif i == 0 || isInitialism {\n\t\t\t\tr = toASCIIUpper(r)\n\t\t\t}\n\t\t\tnewstr = append(newstr, r)\n\t\t}\n\t}\n\n\treturn string(newstr)\n}\n\n// A GonicMapper that contains a list of common initialisms taken from golang/lint\nvar LintGonicMapper = GonicMapper{\n\t\"API\":   true,\n\t\"ASCII\": true,\n\t\"CPU\":   true,\n\t\"CSS\":   true,\n\t\"DNS\":   true,\n\t\"EOF\":   true,\n\t\"GUID\":  true,\n\t\"HTML\":  true,\n\t\"HTTP\":  true,\n\t\"HTTPS\": true,\n\t\"ID\":    true,\n\t\"IP\":    true,\n\t\"JSON\":  true,\n\t\"LHS\":   true,\n\t\"QPS\":   true,\n\t\"RAM\":   true,\n\t\"RHS\":   true,\n\t\"RPC\":   true,\n\t\"SLA\":   true,\n\t\"SMTP\":  true,\n\t\"SSH\":   true,\n\t\"TLS\":   true,\n\t\"TTL\":   true,\n\t\"UI\":    true,\n\t\"UID\":   true,\n\t\"UUID\":  true,\n\t\"URI\":   true,\n\t\"URL\":   true,\n\t\"UTF8\":  true,\n\t\"VM\":    true,\n\t\"XML\":   true,\n\t\"XSRF\":  true,\n\t\"XSS\":   true,\n}\n\n// provide prefix table name support\ntype PrefixMapper struct {\n\tMapper IMapper\n\tPrefix string\n}\n\nfunc (mapper PrefixMapper) Obj2Table(name string) string {\n\treturn mapper.Prefix + mapper.Mapper.Obj2Table(name)\n}\n\nfunc (mapper PrefixMapper) Table2Obj(name string) string {\n\treturn mapper.Mapper.Table2Obj(name[len(mapper.Prefix):])\n}\n\nfunc NewPrefixMapper(mapper IMapper, prefix string) PrefixMapper {\n\treturn PrefixMapper{mapper, prefix}\n}\n\n// provide suffix table name support\ntype SuffixMapper struct {\n\tMapper IMapper\n\tSuffix string\n}\n\nfunc (mapper SuffixMapper) Obj2Table(name string) string {\n\treturn mapper.Mapper.Obj2Table(name) + mapper.Suffix\n}\n\nfunc (mapper SuffixMapper) Table2Obj(name string) string {\n\treturn mapper.Mapper.Table2Obj(name[:len(name)-len(mapper.Suffix)])\n}\n\nfunc NewSuffixMapper(mapper IMapper, suffix string) SuffixMapper {\n\treturn SuffixMapper{mapper, suffix}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/pk.go",
    "content": "package core\n\nimport (\n\t\"bytes\"\n\t\"encoding/gob\"\n)\n\ntype PK []interface{}\n\nfunc NewPK(pks ...interface{}) *PK {\n\tp := PK(pks)\n\treturn &p\n}\n\nfunc (p *PK) ToString() (string, error) {\n\tbuf := new(bytes.Buffer)\n\tenc := gob.NewEncoder(buf)\n\terr := enc.Encode(*p)\n\treturn buf.String(), err\n}\n\nfunc (p *PK) FromString(content string) error {\n\tdec := gob.NewDecoder(bytes.NewBufferString(content))\n\terr := dec.Decode(p)\n\treturn err\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/scan.go",
    "content": "package core\n\nimport (\n\t\"database/sql/driver\"\n\t\"fmt\"\n\t\"time\"\n)\n\ntype NullTime time.Time\n\nvar (\n\t_ driver.Valuer = NullTime{}\n)\n\nfunc (ns *NullTime) Scan(value interface{}) error {\n\tif value == nil {\n\t\treturn nil\n\t}\n\treturn convertTime(ns, value)\n}\n\n// Value implements the driver Valuer interface.\nfunc (ns NullTime) Value() (driver.Value, error) {\n\tif (time.Time)(ns).IsZero() {\n\t\treturn nil, nil\n\t}\n\treturn (time.Time)(ns).Format(\"2006-01-02 15:04:05\"), nil\n}\n\nfunc convertTime(dest *NullTime, src interface{}) error {\n\t// Common cases, without reflect.\n\tswitch s := src.(type) {\n\tcase string:\n\t\tt, err := time.Parse(\"2006-01-02 15:04:05\", s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*dest = NullTime(t)\n\t\treturn nil\n\tcase []uint8:\n\t\tt, err := time.Parse(\"2006-01-02 15:04:05\", string(s))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*dest = NullTime(t)\n\t\treturn nil\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported driver -> Scan pair: %T -> %T\", src, dest)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/table.go",
    "content": "package core\n\nimport (\n\t\"reflect\"\n\t\"strings\"\n)\n\n// database table\ntype Table struct {\n\tName          string\n\tType          reflect.Type\n\tcolumnsSeq    []string\n\tcolumnsMap    map[string][]*Column\n\tcolumns       []*Column\n\tIndexes       map[string]*Index\n\tPrimaryKeys   []string\n\tAutoIncrement string\n\tCreated       map[string]bool\n\tUpdated       string\n\tDeleted       string\n\tVersion       string\n\tCacher        Cacher\n\tStoreEngine   string\n\tCharset       string\n}\n\nfunc (table *Table) Columns() []*Column {\n\treturn table.columns\n}\n\nfunc (table *Table) ColumnsSeq() []string {\n\treturn table.columnsSeq\n}\n\nfunc NewEmptyTable() *Table {\n\treturn NewTable(\"\", nil)\n}\n\nfunc NewTable(name string, t reflect.Type) *Table {\n\treturn &Table{Name: name, Type: t,\n\t\tcolumnsSeq:  make([]string, 0),\n\t\tcolumns:     make([]*Column, 0),\n\t\tcolumnsMap:  make(map[string][]*Column),\n\t\tIndexes:     make(map[string]*Index),\n\t\tCreated:     make(map[string]bool),\n\t\tPrimaryKeys: make([]string, 0),\n\t}\n}\n\nfunc (table *Table) GetColumn(name string) *Column {\n\tif c, ok := table.columnsMap[strings.ToLower(name)]; ok {\n\t\treturn c[0]\n\t}\n\treturn nil\n}\n\nfunc (table *Table) GetColumnIdx(name string, idx int) *Column {\n\tif c, ok := table.columnsMap[strings.ToLower(name)]; ok {\n\t\tif idx < len(c) {\n\t\t\treturn c[idx]\n\t\t}\n\t}\n\treturn nil\n}\n\n// if has primary key, return column\nfunc (table *Table) PKColumns() []*Column {\n\tcolumns := make([]*Column, len(table.PrimaryKeys))\n\tfor i, name := range table.PrimaryKeys {\n\t\tcolumns[i] = table.GetColumn(name)\n\t}\n\treturn columns\n}\n\nfunc (table *Table) ColumnType(name string) reflect.Type {\n\tt, _ := table.Type.FieldByName(name)\n\treturn t.Type\n}\n\nfunc (table *Table) AutoIncrColumn() *Column {\n\treturn table.GetColumn(table.AutoIncrement)\n}\n\nfunc (table *Table) VersionColumn() *Column {\n\treturn table.GetColumn(table.Version)\n}\n\nfunc (table *Table) UpdatedColumn() *Column {\n\treturn table.GetColumn(table.Updated)\n}\n\nfunc (table *Table) DeletedColumn() *Column {\n\treturn table.GetColumn(table.Deleted)\n}\n\n// add a column to table\nfunc (table *Table) AddColumn(col *Column) {\n\ttable.columnsSeq = append(table.columnsSeq, col.Name)\n\ttable.columns = append(table.columns, col)\n\tcolName := strings.ToLower(col.Name)\n\tif c, ok := table.columnsMap[colName]; ok {\n\t\ttable.columnsMap[colName] = append(c, col)\n\t} else {\n\t\ttable.columnsMap[colName] = []*Column{col}\n\t}\n\n\tif col.IsPrimaryKey {\n\t\ttable.PrimaryKeys = append(table.PrimaryKeys, col.Name)\n\t}\n\tif col.IsAutoIncrement {\n\t\ttable.AutoIncrement = col.Name\n\t}\n\tif col.IsCreated {\n\t\ttable.Created[col.Name] = true\n\t}\n\tif col.IsUpdated {\n\t\ttable.Updated = col.Name\n\t}\n\tif col.IsDeleted {\n\t\ttable.Deleted = col.Name\n\t}\n\tif col.IsVersion {\n\t\ttable.Version = col.Name\n\t}\n}\n\n// add an index or an unique to table\nfunc (table *Table) AddIndex(index *Index) {\n\ttable.Indexes[index.Name] = index\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/core/type.go",
    "content": "package core\n\nimport (\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n\t\"time\"\n)\n\nconst (\n\tPOSTGRES = \"postgres\"\n\tSQLITE   = \"sqlite3\"\n\tMYSQL    = \"mysql\"\n\tMSSQL    = \"mssql\"\n\tORACLE   = \"oracle\"\n)\n\n// xorm SQL types\ntype SQLType struct {\n\tName           string\n\tDefaultLength  int\n\tDefaultLength2 int\n}\n\nconst (\n\tUNKNOW_TYPE = iota\n\tTEXT_TYPE\n\tBLOB_TYPE\n\tTIME_TYPE\n\tNUMERIC_TYPE\n)\n\nfunc (s *SQLType) IsType(st int) bool {\n\tif t, ok := SqlTypes[s.Name]; ok && t == st {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (s *SQLType) IsText() bool {\n\treturn s.IsType(TEXT_TYPE)\n}\n\nfunc (s *SQLType) IsBlob() bool {\n\treturn s.IsType(BLOB_TYPE)\n}\n\nfunc (s *SQLType) IsTime() bool {\n\treturn s.IsType(TIME_TYPE)\n}\n\nfunc (s *SQLType) IsNumeric() bool {\n\treturn s.IsType(NUMERIC_TYPE)\n}\n\nfunc (s *SQLType) IsJson() bool {\n\treturn s.Name == Json\n}\n\nvar (\n\tBit       = \"BIT\"\n\tTinyInt   = \"TINYINT\"\n\tSmallInt  = \"SMALLINT\"\n\tMediumInt = \"MEDIUMINT\"\n\tInt       = \"INT\"\n\tInteger   = \"INTEGER\"\n\tBigInt    = \"BIGINT\"\n\n\tEnum = \"ENUM\"\n\tSet  = \"SET\"\n\n\tChar       = \"CHAR\"\n\tVarchar    = \"VARCHAR\"\n\tNVarchar   = \"NVARCHAR\"\n\tTinyText   = \"TINYTEXT\"\n\tText       = \"TEXT\"\n\tClob       = \"CLOB\"\n\tMediumText = \"MEDIUMTEXT\"\n\tLongText   = \"LONGTEXT\"\n\tUuid       = \"UUID\"\n\n\tDate       = \"DATE\"\n\tDateTime   = \"DATETIME\"\n\tTime       = \"TIME\"\n\tTimeStamp  = \"TIMESTAMP\"\n\tTimeStampz = \"TIMESTAMPZ\"\n\n\tDecimal = \"DECIMAL\"\n\tNumeric = \"NUMERIC\"\n\n\tReal   = \"REAL\"\n\tFloat  = \"FLOAT\"\n\tDouble = \"DOUBLE\"\n\n\tBinary     = \"BINARY\"\n\tVarBinary  = \"VARBINARY\"\n\tTinyBlob   = \"TINYBLOB\"\n\tBlob       = \"BLOB\"\n\tMediumBlob = \"MEDIUMBLOB\"\n\tLongBlob   = \"LONGBLOB\"\n\tBytea      = \"BYTEA\"\n\n\tBool = \"BOOL\"\n\n\tSerial    = \"SERIAL\"\n\tBigSerial = \"BIGSERIAL\"\n\n\tJson  = \"JSON\"\n\tJsonb = \"JSONB\"\n\n\tSqlTypes = map[string]int{\n\t\tBit:       NUMERIC_TYPE,\n\t\tTinyInt:   NUMERIC_TYPE,\n\t\tSmallInt:  NUMERIC_TYPE,\n\t\tMediumInt: NUMERIC_TYPE,\n\t\tInt:       NUMERIC_TYPE,\n\t\tInteger:   NUMERIC_TYPE,\n\t\tBigInt:    NUMERIC_TYPE,\n\n\t\tEnum:  TEXT_TYPE,\n\t\tSet:   TEXT_TYPE,\n\t\tJson:  TEXT_TYPE,\n\t\tJsonb: TEXT_TYPE,\n\n\t\tChar:       TEXT_TYPE,\n\t\tVarchar:    TEXT_TYPE,\n\t\tNVarchar:   TEXT_TYPE,\n\t\tTinyText:   TEXT_TYPE,\n\t\tText:       TEXT_TYPE,\n\t\tMediumText: TEXT_TYPE,\n\t\tLongText:   TEXT_TYPE,\n\t\tUuid:       TEXT_TYPE,\n\t\tClob:       TEXT_TYPE,\n\n\t\tDate:       TIME_TYPE,\n\t\tDateTime:   TIME_TYPE,\n\t\tTime:       TIME_TYPE,\n\t\tTimeStamp:  TIME_TYPE,\n\t\tTimeStampz: TIME_TYPE,\n\n\t\tDecimal: NUMERIC_TYPE,\n\t\tNumeric: NUMERIC_TYPE,\n\t\tReal:    NUMERIC_TYPE,\n\t\tFloat:   NUMERIC_TYPE,\n\t\tDouble:  NUMERIC_TYPE,\n\n\t\tBinary:    BLOB_TYPE,\n\t\tVarBinary: BLOB_TYPE,\n\n\t\tTinyBlob:   BLOB_TYPE,\n\t\tBlob:       BLOB_TYPE,\n\t\tMediumBlob: BLOB_TYPE,\n\t\tLongBlob:   BLOB_TYPE,\n\t\tBytea:      BLOB_TYPE,\n\n\t\tBool: NUMERIC_TYPE,\n\n\t\tSerial:    NUMERIC_TYPE,\n\t\tBigSerial: NUMERIC_TYPE,\n\t}\n\n\tintTypes  = sort.StringSlice{\"*int\", \"*int16\", \"*int32\", \"*int8\"}\n\tuintTypes = sort.StringSlice{\"*uint\", \"*uint16\", \"*uint32\", \"*uint8\"}\n)\n\n// !nashtsai! treat following var as interal const values, these are used for reflect.TypeOf comparision\nvar (\n\tc_EMPTY_STRING       string\n\tc_BOOL_DEFAULT       bool\n\tc_BYTE_DEFAULT       byte\n\tc_COMPLEX64_DEFAULT  complex64\n\tc_COMPLEX128_DEFAULT complex128\n\tc_FLOAT32_DEFAULT    float32\n\tc_FLOAT64_DEFAULT    float64\n\tc_INT64_DEFAULT      int64\n\tc_UINT64_DEFAULT     uint64\n\tc_INT32_DEFAULT      int32\n\tc_UINT32_DEFAULT     uint32\n\tc_INT16_DEFAULT      int16\n\tc_UINT16_DEFAULT     uint16\n\tc_INT8_DEFAULT       int8\n\tc_UINT8_DEFAULT      uint8\n\tc_INT_DEFAULT        int\n\tc_UINT_DEFAULT       uint\n\tc_TIME_DEFAULT       time.Time\n)\n\nvar (\n\tIntType   = reflect.TypeOf(c_INT_DEFAULT)\n\tInt8Type  = reflect.TypeOf(c_INT8_DEFAULT)\n\tInt16Type = reflect.TypeOf(c_INT16_DEFAULT)\n\tInt32Type = reflect.TypeOf(c_INT32_DEFAULT)\n\tInt64Type = reflect.TypeOf(c_INT64_DEFAULT)\n\n\tUintType   = reflect.TypeOf(c_UINT_DEFAULT)\n\tUint8Type  = reflect.TypeOf(c_UINT8_DEFAULT)\n\tUint16Type = reflect.TypeOf(c_UINT16_DEFAULT)\n\tUint32Type = reflect.TypeOf(c_UINT32_DEFAULT)\n\tUint64Type = reflect.TypeOf(c_UINT64_DEFAULT)\n\n\tFloat32Type = reflect.TypeOf(c_FLOAT32_DEFAULT)\n\tFloat64Type = reflect.TypeOf(c_FLOAT64_DEFAULT)\n\n\tComplex64Type  = reflect.TypeOf(c_COMPLEX64_DEFAULT)\n\tComplex128Type = reflect.TypeOf(c_COMPLEX128_DEFAULT)\n\n\tStringType = reflect.TypeOf(c_EMPTY_STRING)\n\tBoolType   = reflect.TypeOf(c_BOOL_DEFAULT)\n\tByteType   = reflect.TypeOf(c_BYTE_DEFAULT)\n\tBytesType  = reflect.SliceOf(ByteType)\n\n\tTimeType = reflect.TypeOf(c_TIME_DEFAULT)\n)\n\nvar (\n\tPtrIntType   = reflect.PtrTo(IntType)\n\tPtrInt8Type  = reflect.PtrTo(Int8Type)\n\tPtrInt16Type = reflect.PtrTo(Int16Type)\n\tPtrInt32Type = reflect.PtrTo(Int32Type)\n\tPtrInt64Type = reflect.PtrTo(Int64Type)\n\n\tPtrUintType   = reflect.PtrTo(UintType)\n\tPtrUint8Type  = reflect.PtrTo(Uint8Type)\n\tPtrUint16Type = reflect.PtrTo(Uint16Type)\n\tPtrUint32Type = reflect.PtrTo(Uint32Type)\n\tPtrUint64Type = reflect.PtrTo(Uint64Type)\n\n\tPtrFloat32Type = reflect.PtrTo(Float32Type)\n\tPtrFloat64Type = reflect.PtrTo(Float64Type)\n\n\tPtrComplex64Type  = reflect.PtrTo(Complex64Type)\n\tPtrComplex128Type = reflect.PtrTo(Complex128Type)\n\n\tPtrStringType = reflect.PtrTo(StringType)\n\tPtrBoolType   = reflect.PtrTo(BoolType)\n\tPtrByteType   = reflect.PtrTo(ByteType)\n\n\tPtrTimeType = reflect.PtrTo(TimeType)\n)\n\n// Type2SQLType generate SQLType acorrding Go's type\nfunc Type2SQLType(t reflect.Type) (st SQLType) {\n\tswitch k := t.Kind(); k {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32:\n\t\tst = SQLType{Int, 0, 0}\n\tcase reflect.Int64, reflect.Uint64:\n\t\tst = SQLType{BigInt, 0, 0}\n\tcase reflect.Float32:\n\t\tst = SQLType{Float, 0, 0}\n\tcase reflect.Float64:\n\t\tst = SQLType{Double, 0, 0}\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tst = SQLType{Varchar, 64, 0}\n\tcase reflect.Array, reflect.Slice, reflect.Map:\n\t\tif t.Elem() == reflect.TypeOf(c_BYTE_DEFAULT) {\n\t\t\tst = SQLType{Blob, 0, 0}\n\t\t} else {\n\t\t\tst = SQLType{Text, 0, 0}\n\t\t}\n\tcase reflect.Bool:\n\t\tst = SQLType{Bool, 0, 0}\n\tcase reflect.String:\n\t\tst = SQLType{Varchar, 255, 0}\n\tcase reflect.Struct:\n\t\tif t.ConvertibleTo(TimeType) {\n\t\t\tst = SQLType{DateTime, 0, 0}\n\t\t} else {\n\t\t\t// TODO need to handle association struct\n\t\t\tst = SQLType{Text, 0, 0}\n\t\t}\n\tcase reflect.Ptr:\n\t\tst = Type2SQLType(t.Elem())\n\tdefault:\n\t\tst = SQLType{Text, 0, 0}\n\t}\n\treturn\n}\n\n// default sql type change to go types\nfunc SQLType2Type(st SQLType) reflect.Type {\n\tname := strings.ToUpper(st.Name)\n\tswitch name {\n\tcase Bit, TinyInt, SmallInt, MediumInt, Int, Integer, Serial:\n\t\treturn reflect.TypeOf(1)\n\tcase BigInt, BigSerial:\n\t\treturn reflect.TypeOf(int64(1))\n\tcase Float, Real:\n\t\treturn reflect.TypeOf(float32(1))\n\tcase Double:\n\t\treturn reflect.TypeOf(float64(1))\n\tcase Char, Varchar, NVarchar, TinyText, Text, MediumText, LongText, Enum, Set, Uuid, Clob:\n\t\treturn reflect.TypeOf(\"\")\n\tcase TinyBlob, Blob, LongBlob, Bytea, Binary, MediumBlob, VarBinary:\n\t\treturn reflect.TypeOf([]byte{})\n\tcase Bool:\n\t\treturn reflect.TypeOf(true)\n\tcase DateTime, Date, Time, TimeStamp, TimeStampz:\n\t\treturn reflect.TypeOf(c_TIME_DEFAULT)\n\tcase Decimal, Numeric:\n\t\treturn reflect.TypeOf(\"\")\n\tdefault:\n\t\treturn reflect.TypeOf(\"\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/CONTRIBUTING.md",
    "content": "## Contributing to xorm\n\n`xorm` has a backlog of [pull requests](https://help.github.com/articles/using-pull-requests), but contributions are still very\nmuch welcome. You can help with patch review, submitting bug reports,\nor adding new functionality. There is no formal style guide, but\nplease conform to the style of existing code and general Go formatting\nconventions when submitting patches.\n\n* [fork a repo](https://help.github.com/articles/fork-a-repo)\n* [creating a pull request ](https://help.github.com/articles/creating-a-pull-request)\n\n### Language\n\nSince `xorm` is a world-wide open source project, please describe your issues or code changes in English as soon as possible.\n\n### Sign your codes with comments\n```\n// !<you github id>! your comments\n\ne.g.,\n\n// !lunny! this is comments made by lunny\n```\n\n### Patch review\n\nHelp review existing open [pull requests](https://help.github.com/articles/using-pull-requests) by commenting on the code or\nproposed functionality.\n\n### Bug reports\n\nWe appreciate any bug reports, but especially ones with self-contained\n(doesn't depend on code outside of xorm), minimal (can't be simplified\nfurther) test cases. It's especially helpful if you can submit a pull\nrequest with just the failing test case (you'll probably want to\npattern it after the tests in\n[base.go](https://github.com/go-xorm/tests/blob/master/base.go) AND\n[benchmark.go](https://github.com/go-xorm/tests/blob/master/benchmark.go).\n\nIf you implements a new database interface, you maybe need to add a <databasename>_test.go file.\nFor example, [mysql_test.go](https://github.com/go-xorm/tests/blob/master/mysql/mysql_test.go)\n\n### New functionality\n\nThere are a number of pending patches for new functionality, so\nadditional feature patches will take a while to merge. Still, patches\nare generally reviewed based on usefulness and complexity in addition\nto time-in-queue, so if you have a knockout idea, take a shot. Feel\nfree to open an issue discussion your proposed patch beforehand.\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/LICENSE",
    "content": "Copyright (c) 2013 - 2015 The Xorm Authors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the {organization} nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/README.md",
    "content": "[中文](https://github.com/go-xorm/xorm/blob/master/README_CN.md)\n\nXorm is a simple and powerful ORM for Go.\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-xorm/xorm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n\n[![Build Status](https://drone.io/github.com/go-xorm/tests/status.png)](https://drone.io/github.com/go-xorm/tests/latest)\n\n# Notice\n\nThe last master version is not backwards compatible. You should use `engine.ShowSQL()` and `engine.Logger().SetLevel()` instead of `engine.ShowSQL = `, `engine.ShowInfo = ` and so on.\n\n# Features\n\n* Struct <-> Table Mapping Support\n\n* Chainable APIs\n\n* Transaction Support\n\n* Both ORM and raw SQL operation Support\n\n* Sync database schema Support\n\n* Query Cache speed up\n\n* Database Reverse support, See [Xorm Tool README](https://github.com/go-xorm/cmd/blob/master/README.md)\n\n* Simple cascade loading support\n\n* Optimistic Locking support\n\n\n# Drivers Support\n\nDrivers for Go's sql package which currently support database/sql includes:\n\n* Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)\n\n* MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)\n\n* Postgres: [github.com/lib/pq](https://github.com/lib/pq)\n\n* Tidb: [github.com/pingcap/tidb](https://github.com/pingcap/tidb)\n\n* SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)\n\n* MsSql: [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)\n\n* MsSql: [github.com/lunny/godbc](https://github.com/lunny/godbc)\n\n* Oracle: [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (experiment)\n\n* ql: [github.com/cznic/ql](https://github.com/cznic/ql) (experiment)\n\n# Changelog\n\n* **v0.5.0**\n    * logging interface changed\n    * some bugs fixed\n\n* **v0.4.5**\n    * many bugs fixed\n    * extends support unlimited deepth\n    * Delete Limit support\n\n* **v0.4.4**\n    * ql database expriment support\n    * tidb database expriment support\n    * sql.NullString and etc. field support\n    * select ForUpdate support\n    * many bugs fixed\n\n[More changes ...](https://github.com/go-xorm/manual-en-US/tree/master/chapter-16)\n\n# Installation\n\nIf you have [gopm](https://github.com/gpmgo/gopm) installed,\n\n\tgopm get github.com/go-xorm/xorm\n\nOr\n\n\tgo get github.com/go-xorm/xorm\n\n# Documents\n\n* [Manual](http://xorm.io/docs)\n\n* [GoDoc](http://godoc.org/github.com/go-xorm/xorm)\n\n* [GoWalker](http://gowalker.org/github.com/go-xorm/xorm)\n\n# Quick Start\n\n* Create Engine\n\n```Go\nengine, err := xorm.NewEngine(driverName, dataSourceName)\n```\n\n* Define a struct and Sync2 table struct to database\n\n```Go\ntype User struct {\n    Id int64\n    Name string\n    Salt string\n    Age int\n    Passwd string `xorm:\"varchar(200)\"`\n    Created time.Time `xorm:\"created\"`\n    Updated time.Time `xorm:\"updated\"`\n}\n\nerr := engine.Sync2(new(User))\n```\n\n* Query a SQL string, the returned results is []map[string][]byte\n\n```Go\nresults, err := engine.Query(\"select * from user\")\n```\n\n* Execute a SQL string, the returned results\n\n```Go\naffected, err := engine.Exec(\"update user set age = ? where name = ?\", age, name)\n```\n\n* Insert one or multiple records to database\n\n```Go\naffected, err := engine.Insert(&user)\n// INSERT INTO struct () values ()\naffected, err := engine.Insert(&user1, &user2)\n// INSERT INTO struct1 () values ()\n// INSERT INTO struct2 () values ()\naffected, err := engine.Insert(&users)\n// INSERT INTO struct () values (),(),()\naffected, err := engine.Insert(&user1, &users)\n// INSERT INTO struct1 () values ()\n// INSERT INTO struct2 () values (),(),()\n```\n\n* Query one record from database\n\n```Go\nhas, err := engine.Get(&user)\n// SELECT * FROM user LIMIT 1\nhas, err := engine.Where(\"name = ?\", name).Desc(\"id\").Get(&user)\n// SELECT * FROM user WHERE name = ? ORDER BY id DESC LIMIT 1\n```\n\n* Query multiple records from database, also you can use join and extends\n\n```Go\nvar users []User\nerr := engine.Where(\"name = ?\", name).And(\"age > 10\").Limit(10, 0).Find(&users)\n// SELECT * FROM user WHERE name = ? AND age > 10 limit 0 offset 10\n\ntype Detail struct {\n    Id int64\n    UserId int64 `xorm:\"index\"`\n}\n\ntype UserDetail struct {\n    User `xorm:\"extends\"`\n    Detail `xorm:\"extends\"`\n}\n\nvar users []UserDetail\nerr := engine.Table(\"user\").Select(\"user.*, detail.*\")\n    Join(\"INNER\", \"detail\", \"detail.user_id = user.id\").\n    Where(\"user.name = ?\", name).Limit(10, 0).\n    Find(&users)\n// SELECT user.*, detail.* FROM user INNER JOIN detail WHERE user.name = ? limit 0 offset 10\n```\n\n* Query multiple records and record by record handle, there are two methods Iterate and Rows\n\n```Go\nerr := engine.Iterate(&User{Name:name}, func(idx int, bean interface{}) error {\n    user := bean.(*User)\n    return nil\n})\n// SELECT * FROM user\n\nrows, err := engine.Rows(&User{Name:name})\n// SELECT * FROM user\ndefer rows.Close()\nbean := new(Struct)\nfor rows.Next() {\n    err = rows.Scan(bean)\n}\n```\n\n* Update one or more records, default will update non-empty and non-zero fields except when you use Cols, AllCols and so on.\n\n```Go\naffected, err := engine.Id(1).Update(&user)\n// UPDATE user SET ... Where id = ?\n\naffected, err := engine.Update(&user, &User{Name:name})\n// UPDATE user SET ... Where name = ?\n\nvar ids = []int64{1, 2, 3}\naffected, err := engine.In(\"id\", ids).Update(&user)\n// UPDATE user SET ... Where id IN (?, ?, ?)\n\n// force update indicated columns by Cols\naffected, err := engine.Id(1).Cols(\"age\").Update(&User{Name:name, Age: 12})\n// UPDATE user SET age = ?, updated=? Where id = ?\n\n// force NOT update indicated columns by Omit\naffected, err := engine.Id(1).Omit(\"name\").Update(&User{Name:name, Age: 12})\n// UPDATE user SET age = ?, updated=? Where id = ?\n\naffected, err := engine.Id(1).AllCols().Update(&user)\n// UPDATE user SET name=?,age=?,salt=?,passwd=?,updated=? Where id = ?\n```\n\n* Delete one or more records, Delete MUST have condition\n\n```Go\naffected, err := engine.Where(...).Delete(&user)\n// DELETE FROM user Where ...\naffected, err := engine.Id(2).Delete(&user)\n```\n\n* Count records\n\n```Go\ncounts, err := engine.Count(&user)\n// SELECT count(*) AS total FROM user\n```\n\n# Cases\n\n* [github.com/m3ng9i/qreader](https://github.com/m3ng9i/qreader)\n\n* [Wego](http://github.com/go-tango/wego)\n\n* [Docker.cn](https://docker.cn/)\n\n* [Gogs](http://try.gogits.org) - [github.com/gogits/gogs](http://github.com/gogits/gogs)\n\n* [Gorevel](http://gorevel.cn/) - [github.com/goofcc/gorevel](http://github.com/goofcc/gorevel)\n\n* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)\n\n* [Gobuild.io](http://gobuild.io) - [github.com/shxsun/gobuild](http://github.com/shxsun/gobuild)\n\n* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)\n\n* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)\n\n* [YouGam](http://www.yougam.com/)\n\n* [GoCMS - github.com/zzboy/GoCMS](https://github.com/zzdboy/GoCMS)\n\n* [GoBBS - gobbs.domolo.com](http://gobbs.domolo.com/)\n\n* [go-blog](http://wangcheng.me) - [github.com/easykoo/go-blog](https://github.com/easykoo/go-blog)\n\n# Discuss\n\nPlease visit [Xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm)\n\n# Contributing\n\nIf you want to pull request, please see [CONTRIBUTING](https://github.com/go-xorm/xorm/blob/master/CONTRIBUTING.md)\n\n# LICENSE\n\n BSD License\n [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/README_CN.md",
    "content": "# xorm\n\n[English](https://github.com/go-xorm/xorm/blob/master/README.md)\n\nxorm是一个简单而强大的Go语言ORM库. 通过它可以使数据库操作非常简便。\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-xorm/xorm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n\n[![Build Status](https://drone.io/github.com/go-xorm/tests/status.png)](https://drone.io/github.com/go-xorm/tests/latest)  [![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/go-xorm/xorm)\n\n# 注意\n\n最新的版本有不兼容的更新，您必须使用 `engine.ShowSQL()` 和 `engine.Logger().SetLevel()` 来替代 `engine.ShowSQL = `, `engine.ShowInfo = ` 等等。\n\n## 特性\n\n* 支持Struct和数据库表之间的灵活映射，并支持自动同步\n\n* 事务支持\n\n* 同时支持原始SQL语句和ORM操作的混合执行\n\n* 使用连写来简化调用\n\n* 支持使用Id, In, Where, Limit, Join, Having, Table, Sql, Cols等函数和结构体等方式作为条件\n\n* 支持级联加载Struct\n\n* 支持缓存\n\n* 支持根据数据库自动生成xorm的结构体\n\n* 支持记录版本（即乐观锁）\n\n## 驱动支持\n\n目前支持的Go数据库驱动和对应的数据库如下：\n\n* Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)\n\n* MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)\n\n* Postgres: [github.com/lib/pq](https://github.com/lib/pq)\n\n* Tidb: [github.com/pingcap/tidb](https://github.com/pingcap/tidb)\n\n* SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)\n\n* MsSql: [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)\n\n* MsSql: [github.com/lunny/godbc](https://github.com/lunny/godbc)\n\n* Oracle: [github.com/mattn/go-oci8](https://github.com/mattn/go-oci8) (试验性支持)\n\n* ql: [github.com/cznic/ql](https://github.com/cznic/ql) (试验性支持)\n\n## 更新日志\n\n* **v0.5.0**\n    * logging接口进行不兼容改变\n    * Bug修正\n\n* **v0.4.5**\n    * bug修正\n    * extends 支持无限级\n    * Delete Limit 支持\n\n* **v0.4.4**\n    * Tidb 数据库支持\n    * QL 试验性支持\n    * sql.NullString支持\n    * ForUpdate 支持\n    * bug修正\n\n[更多更新日志...](https://github.com/go-xorm/manual-zh-CN/tree/master/chapter-16)\n\n## 安装\n\n推荐使用 [gopm](https://github.com/gpmgo/gopm) 进行安装：\n\n\tgopm get github.com/go-xorm/xorm\n\n或者您也可以使用go工具进行安装：\n\n\tgo get github.com/go-xorm/xorm\n\n## 文档\n\n* [操作指南](http://xorm.io/docs)\n\n* [GoWalker代码文档](http://gowalker.org/github.com/go-xorm/xorm)\n\n* [Godoc代码文档](http://godoc.org/github.com/go-xorm/xorm)\n\n# 快速开始\n\n* 第一步创建引擎，driverName, dataSourceName和database/sql接口相同\n\n```Go\nengine, err := xorm.NewEngine(driverName, dataSourceName)\n```\n\n* 定义一个和表同步的结构体，并且自动同步结构体到数据库\n\n```Go\ntype User struct {\n    Id int64\n    Name string\n    Salt string\n    Age int\n    Passwd string `xorm:\"varchar(200)\"`\n    Created time.Time `xorm:\"created\"`\n    Updated time.Time `xorm:\"updated\"`\n}\n\nerr := engine.Sync2(new(User))\n```\n\n* 最原始的也支持SQL语句查询，返回的结果类型为 []map[string][]byte\n\n```Go\nresults, err := engine.Query(\"select * from user\")\n```\n\n* 执行一个SQL语句\n\n```Go\naffected, err := engine.Exec(\"update user set age = ? where name = ?\", age, name)\n```\n\n* 插入一条或者多条记录\n\n```Go\naffected, err := engine.Insert(&user)\n// INSERT INTO struct () values ()\naffected, err := engine.Insert(&user1, &user2)\n// INSERT INTO struct1 () values ()\n// INSERT INTO struct2 () values ()\naffected, err := engine.Insert(&users)\n// INSERT INTO struct () values (),(),()\naffected, err := engine.Insert(&user1, &users)\n// INSERT INTO struct1 () values ()\n// INSERT INTO struct2 () values (),(),()\n```\n\n* 查询单条记录\n\n```Go\nhas, err := engine.Get(&user)\n// SELECT * FROM user LIMIT 1\nhas, err := engine.Where(\"name = ?\", name).Desc(\"id\").Get(&user)\n// SELECT * FROM user WHERE name = ? ORDER BY id DESC LIMIT 1\n```\n\n* 查询多条记录，当然可以使用Join和extends来组合使用\n\n```Go\nvar users []User\nerr := engine.Where(\"name = ?\", name).And(\"age > 10\").Limit(10, 0).Find(&users)\n// SELECT * FROM user WHERE name = ? AND age > 10 limit 0 offset 10\n\ntype Detail struct {\n    Id int64\n    UserId int64 `xorm:\"index\"`\n}\n\ntype UserDetail struct {\n    User `xorm:\"extends\"`\n    Detail `xorm:\"extends\"`\n}\n\nvar users []UserDetail\nerr := engine.Table(\"user\").Select(\"user.*, detail.*\")\n    Join(\"INNER\", \"detail\", \"detail.user_id = user.id\").\n    Where(\"user.name = ?\", name).Limit(10, 0).\n    Find(&users)\n// SELECT user.*, detail.* FROM user INNER JOIN detail WHERE user.name = ? limit 0 offset 10\n```\n\n* 根据条件遍历数据库，可以有两种方式: Iterate and Rows\n\n```Go\nerr := engine.Iterate(&User{Name:name}, func(idx int, bean interface{}) error {\n    user := bean.(*User)\n    return nil\n})\n// SELECT * FROM user\n\nrows, err := engine.Rows(&User{Name:name})\n// SELECT * FROM user\ndefer rows.Close()\nbean := new(Struct)\nfor rows.Next() {\n    err = rows.Scan(bean)\n}\n```\n\n* 更新数据，除非使用Cols,AllCols函数指明，默认只更新非空和非0的字段\n\n```Go\naffected, err := engine.Id(1).Update(&user)\n// UPDATE user SET ... Where id = ?\n\naffected, err := engine.Update(&user, &User{Name:name})\n// UPDATE user SET ... Where name = ?\n\nvar ids = []int64{1, 2, 3}\naffected, err := engine.In(ids).Update(&user)\n// UPDATE user SET ... Where id IN (?, ?, ?)\n\n// force update indicated columns by Cols\naffected, err := engine.Id(1).Cols(\"age\").Update(&User{Name:name, Age: 12})\n// UPDATE user SET age = ?, updated=? Where id = ?\n\n// force NOT update indicated columns by Omit\naffected, err := engine.Id(1).Omit(\"name\").Update(&User{Name:name, Age: 12})\n// UPDATE user SET age = ?, updated=? Where id = ?\n\naffected, err := engine.Id(1).AllCols().Update(&user)\n// UPDATE user SET name=?,age=?,salt=?,passwd=?,updated=? Where id = ?\n```\n\n* 删除记录，需要注意，删除必须至少有一个条件，否则会报错。要清空数据库可以用EmptyTable\n\n```Go\naffected, err := engine.Where(...).Delete(&user)\n// DELETE FROM user Where ...\n```\n\n* 获取记录条数\n\n```Go\ncounts, err := engine.Count(&user)\n// SELECT count(*) AS total FROM user\n```\n\n# 案例\n\n* [github.com/m3ng9i/qreader](https://github.com/m3ng9i/qreader)\n\n* [Wego](http://github.com/go-tango/wego)\n\n* [Docker.cn](https://docker.cn/)\n\n* [Gogs](http://try.gogits.org) - [github.com/gogits/gogs](http://github.com/gogits/gogs)\n\n* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)\n\n* [Gobuild.io](http://gobuild.io) - [github.com/shxsun/gobuild](http://github.com/shxsun/gobuild)\n\n* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)\n\n* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)\n\n* [YouGam](http://www.yougam.com/)\n\n* [GoCMS - github.com/zzboy/GoCMS](https://github.com/zzdboy/GoCMS)\n\n* [GoBBS - gobbs.domolo.com](http://gobbs.domolo.com/)\n\n* [go-blog](http://wangcheng.me) - [github.com/easykoo/go-blog](https://github.com/easykoo/go-blog)\n\n## 讨论\n\n请加入QQ群：280360085 进行讨论。\n\n## 贡献\n\n如果您也想为Xorm贡献您的力量，请查看 [CONTRIBUTING](https://github.com/go-xorm/xorm/blob/master/CONTRIBUTING.md)\n\n## LICENSE\n\nBSD License\n[http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/VERSION",
    "content": "xorm v0.5.5.0711\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/doc.go",
    "content": "// Copyright 2013 - 2016 The XORM Authors. All rights reserved.\n// Use of this source code is governed by a BSD\n// license that can be found in the LICENSE file.\n\n/*\n\nPackage xorm is a simple and powerful ORM for Go.\n\nInstallation\n\nMake sure you have installed Go 1.1+ and then:\n\n    go get github.com/go-xorm/xorm\n\nCreate Engine\n\nFirstly, we should new an engine for a database\n\n    engine, err := xorm.NewEngine(driverName, dataSourceName)\n\nMethod NewEngine's parameters is the same as sql.Open. It depends\ndrivers' implementation.\nGenerally, one engine for an application is enough. You can set it as package variable.\n\nRaw Methods\n\nXorm also support raw sql execution:\n\n1. query a SQL string, the returned results is []map[string][]byte\n\n    results, err := engine.Query(\"select * from user\")\n\n2. execute a SQL string, the returned results\n\n    affected, err := engine.Exec(\"update user set .... where ...\")\n\nORM Methods\n\nThere are 7 major ORM methods and many helpful methods to use to operate database.\n\n1. Insert one or multipe records to database\n\n    affected, err := engine.Insert(&struct)\n    // INSERT INTO struct () values ()\n    affected, err := engine.Insert(&struct1, &struct2)\n    // INSERT INTO struct1 () values ()\n    // INSERT INTO struct2 () values ()\n    affected, err := engine.Insert(&sliceOfStruct)\n    // INSERT INTO struct () values (),(),()\n    affected, err := engine.Insert(&struct1, &sliceOfStruct2)\n    // INSERT INTO struct1 () values ()\n    // INSERT INTO struct2 () values (),(),()\n\n2. Query one record from database\n\n    has, err := engine.Get(&user)\n    // SELECT * FROM user LIMIT 1\n\n3. Query multiple records from database\n\n    sliceOfStructs := new(Struct)\n    err := engine.Find(sliceOfStructs)\n    // SELECT * FROM user\n\n4. Query multiple records and record by record handle, there two methods, one is Iterate,\nanother is Rows\n\n    err := engine.Iterate(...)\n    // SELECT * FROM user\n\n    rows, err := engine.Rows(...)\n    // SELECT * FROM user\n    defer rows.Close()\n    bean := new(Struct)\n    for rows.Next() {\n        err = rows.Scan(bean)\n    }\n\n5. Update one or more records\n\n    affected, err := engine.Id(...).Update(&user)\n    // UPDATE user SET ...\n\n6. Delete one or more records, Delete MUST has conditon\n\n    affected, err := engine.Where(...).Delete(&user)\n    // DELETE FROM user Where ...\n\n7. Count records\n\n    counts, err := engine.Count(&user)\n    // SELECT count(*) AS total FROM user\n\nConditions\n\nThe above 7 methods could use with condition methods chainable.\nAttention: the above 7 methods should be the last chainable method.\n\n1. Id, In\n\n    engine.Id(1).Get(&user) // for single primary key\n    // SELECT * FROM user WHERE id = 1\n    engine.Id(core.PK{1, 2}).Get(&user) // for composite primary keys\n    // SELECT * FROM user WHERE id1 = 1 AND id2 = 2\n    engine.In(\"id\", 1, 2, 3).Find(&users)\n    // SELECT * FROM user WHERE id IN (1, 2, 3)\n    engine.In(\"id\", []int{1, 2, 3})\n    // SELECT * FROM user WHERE id IN (1, 2, 3)\n\n2. Where, And, Or\n\n    engine.Where().And().Or().Find()\n    // SELECT * FROM user WHERE (.. AND ..) OR ...\n\n3. OrderBy, Asc, Desc\n\n    engine.Asc().Desc().Find()\n    // SELECT * FROM user ORDER BY .. ASC, .. DESC\n    engine.OrderBy().Find()\n    // SELECT * FROM user ORDER BY ..\n\n4. Limit, Top\n\n    engine.Limit().Find()\n    // SELECT * FROM user LIMIT .. OFFSET ..\n    engine.Top(5).Find()\n    // SELECT TOP 5 * FROM user // for mssql\n    // SELECT * FROM user LIMIT .. OFFSET 0 //for other databases\n\n5. Sql, let you custom SQL\n\n    var users []User\n    engine.Sql(\"select * from user\").Find(&users)\n\n6. Cols, Omit, Distinct\n\n    var users []*User\n    engine.Cols(\"col1, col2\").Find(&users)\n    // SELECT col1, col2 FROM user\n    engine.Cols(\"col1\", \"col2\").Where().Update(user)\n    // UPDATE user set col1 = ?, col2 = ? Where ...\n    engine.Omit(\"col1\").Find(&users)\n    // SELECT col2, col3 FROM user\n    engine.Omit(\"col1\").Insert(&user)\n    // INSERT INTO table (non-col1) VALUES ()\n    engine.Distinct(\"col1\").Find(&users)\n    // SELECT DISTINCT col1 FROM user\n\n7. Join, GroupBy, Having\n\n    engine.GroupBy(\"name\").Having(\"name='xlw'\").Find(&users)\n    //SELECT * FROM user GROUP BY name HAVING name='xlw'\n    engine.Join(\"LEFT\", \"userdetail\", \"user.id=userdetail.id\").Find(&users)\n    //SELECT * FROM user LEFT JOIN userdetail ON user.id=userdetail.id\n\nMore usage, please visit http://xorm.io/docs\n*/\npackage xorm\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/engine.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"database/sql\"\n\t\"encoding/gob\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// Engine is the major struct of xorm, it means a database manager.\n// Commonly, an application only need one engine\ntype Engine struct {\n\tdb      *core.DB\n\tdialect core.Dialect\n\n\tColumnMapper  core.IMapper\n\tTableMapper   core.IMapper\n\tTagIdentifier string\n\tTables        map[reflect.Type]*core.Table\n\n\tmutex  *sync.RWMutex\n\tCacher core.Cacher\n\n\tshowSQL      bool\n\tshowExecTime bool\n\n\tlogger     core.ILogger\n\tTZLocation *time.Location\n\tDatabaseTZ *time.Location // The timezone of the database\n\n\tdisableGlobalCache bool\n}\n\n// ShowSQL show SQL statment or not on logger if log level is great than INFO\nfunc (engine *Engine) ShowSQL(show ...bool) {\n\tengine.logger.ShowSQL(show...)\n\tif len(show) == 0 {\n\t\tengine.showSQL = true\n\t} else {\n\t\tengine.showSQL = show[0]\n\t}\n}\n\n// ShowExecTime show SQL statment and execute time or not on logger if log level is great than INFO\nfunc (engine *Engine) ShowExecTime(show ...bool) {\n\tif len(show) == 0 {\n\t\tengine.showExecTime = true\n\t} else {\n\t\tengine.showExecTime = show[0]\n\t}\n}\n\n// Logger return the logger interface\nfunc (engine *Engine) Logger() core.ILogger {\n\treturn engine.logger\n}\n\n// SetLogger set the new logger\nfunc (engine *Engine) SetLogger(logger core.ILogger) {\n\tengine.logger = logger\n\tengine.dialect.SetLogger(logger)\n}\n\n// SetDisableGlobalCache disable global cache or not\nfunc (engine *Engine) SetDisableGlobalCache(disable bool) {\n\tif engine.disableGlobalCache != disable {\n\t\tengine.disableGlobalCache = disable\n\t}\n}\n\n// DriverName return the current sql driver's name\nfunc (engine *Engine) DriverName() string {\n\treturn engine.dialect.DriverName()\n}\n\n// DataSourceName return the current connection string\nfunc (engine *Engine) DataSourceName() string {\n\treturn engine.dialect.DataSourceName()\n}\n\n// SetMapper set the name mapping rules\nfunc (engine *Engine) SetMapper(mapper core.IMapper) {\n\tengine.SetTableMapper(mapper)\n\tengine.SetColumnMapper(mapper)\n}\n\n// SetTableMapper set the table name mapping rule\nfunc (engine *Engine) SetTableMapper(mapper core.IMapper) {\n\tengine.TableMapper = mapper\n}\n\n// SetColumnMapper set the column name mapping rule\nfunc (engine *Engine) SetColumnMapper(mapper core.IMapper) {\n\tengine.ColumnMapper = mapper\n}\n\n// SupportInsertMany If engine's database support batch insert records like\n// \"insert into user values (name, age), (name, age)\".\n// When the return is ture, then engine.Insert(&users) will\n// generate batch sql and exeute.\nfunc (engine *Engine) SupportInsertMany() bool {\n\treturn engine.dialect.SupportInsertMany()\n}\n\n// QuoteStr Engine's database use which charactor as quote.\n// mysql, sqlite use ` and postgres use \"\nfunc (engine *Engine) QuoteStr() string {\n\treturn engine.dialect.QuoteStr()\n}\n\n// Quote Use QuoteStr quote the string sql\nfunc (engine *Engine) Quote(sql string) string {\n\treturn engine.quoteTable(sql)\n}\n\nfunc (engine *Engine) quote(sql string) string {\n\treturn engine.dialect.QuoteStr() + sql + engine.dialect.QuoteStr()\n}\n\nfunc (engine *Engine) quoteColumn(keyName string) string {\n\tif len(keyName) == 0 {\n\t\treturn keyName\n\t}\n\n\tkeyName = strings.TrimSpace(keyName)\n\tkeyName = strings.Replace(keyName, \"`\", \"\", -1)\n\tkeyName = strings.Replace(keyName, engine.QuoteStr(), \"\", -1)\n\n\tkeyName = strings.Replace(keyName, \",\", engine.dialect.QuoteStr()+\",\"+engine.dialect.QuoteStr(), -1)\n\tkeyName = strings.Replace(keyName, \".\", engine.dialect.QuoteStr()+\".\"+engine.dialect.QuoteStr(), -1)\n\n\treturn engine.dialect.QuoteStr() + keyName + engine.dialect.QuoteStr()\n}\n\nfunc (engine *Engine) quoteTable(keyName string) string {\n\tkeyName = strings.TrimSpace(keyName)\n\tif len(keyName) == 0 {\n\t\treturn keyName\n\t}\n\n\tif string(keyName[0]) == engine.dialect.QuoteStr() || keyName[0] == '`' {\n\t\treturn keyName\n\t}\n\n\tkeyName = strings.Replace(keyName, \".\", engine.dialect.QuoteStr()+\".\"+engine.dialect.QuoteStr(), -1)\n\n\treturn engine.dialect.QuoteStr() + keyName + engine.dialect.QuoteStr()\n}\n\n// SqlType will be depracated, please use SQLType instead\nfunc (engine *Engine) SqlType(c *core.Column) string {\n\treturn engine.dialect.SqlType(c)\n}\n\n// SQLType A simple wrapper to dialect's core.SqlType method\nfunc (engine *Engine) SQLType(c *core.Column) string {\n\treturn engine.dialect.SqlType(c)\n}\n\n// AutoIncrStr Database's autoincrement statement\nfunc (engine *Engine) AutoIncrStr() string {\n\treturn engine.dialect.AutoIncrStr()\n}\n\n// SetMaxOpenConns is only available for go 1.2+\nfunc (engine *Engine) SetMaxOpenConns(conns int) {\n\tengine.db.SetMaxOpenConns(conns)\n}\n\n// SetMaxIdleConns set the max idle connections on pool, default is 2\nfunc (engine *Engine) SetMaxIdleConns(conns int) {\n\tengine.db.SetMaxIdleConns(conns)\n}\n\n// SetDefaultCacher set the default cacher. Xorm's default not enable cacher.\nfunc (engine *Engine) SetDefaultCacher(cacher core.Cacher) {\n\tengine.Cacher = cacher\n}\n\n// NoCache If you has set default cacher, and you want temporilly stop use cache,\n// you can use NoCache()\nfunc (engine *Engine) NoCache() *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.NoCache()\n}\n\n// NoCascade If you do not want to auto cascade load object\nfunc (engine *Engine) NoCascade() *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.NoCascade()\n}\n\n// MapCacher Set a table use a special cacher\nfunc (engine *Engine) MapCacher(bean interface{}, cacher core.Cacher) {\n\tv := rValue(bean)\n\ttb := engine.autoMapType(v)\n\ttb.Cacher = cacher\n}\n\n// NewDB provides an interface to operate database directly\nfunc (engine *Engine) NewDB() (*core.DB, error) {\n\treturn core.OpenDialect(engine.dialect)\n}\n\n// DB return the wrapper of sql.DB\nfunc (engine *Engine) DB() *core.DB {\n\treturn engine.db\n}\n\n// Dialect return database dialect\nfunc (engine *Engine) Dialect() core.Dialect {\n\treturn engine.dialect\n}\n\n// NewSession New a session\nfunc (engine *Engine) NewSession() *Session {\n\tsession := &Session{Engine: engine}\n\tsession.Init()\n\treturn session\n}\n\n// Close the engine\nfunc (engine *Engine) Close() error {\n\treturn engine.db.Close()\n}\n\n// Ping tests if database is alive\nfunc (engine *Engine) Ping() error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\tengine.logger.Infof(\"PING DATABASE %v\", engine.DriverName())\n\treturn session.Ping()\n}\n\n// logging sql\nfunc (engine *Engine) logSQL(sqlStr string, sqlArgs ...interface{}) {\n\tif engine.showSQL && !engine.showExecTime {\n\t\tif len(sqlArgs) > 0 {\n\t\t\tengine.logger.Infof(\"[sql] %v [args] %v\", sqlStr, sqlArgs)\n\t\t} else {\n\t\t\tengine.logger.Infof(\"[sql] %v\", sqlStr)\n\t\t}\n\t}\n}\n\nfunc (engine *Engine) logSQLQueryTime(sqlStr string, args []interface{}, executionBlock func() (*core.Stmt, *core.Rows, error)) (*core.Stmt, *core.Rows, error) {\n\tif engine.showSQL && engine.showExecTime {\n\t\tb4ExecTime := time.Now()\n\t\tstmt, res, err := executionBlock()\n\t\texecDuration := time.Since(b4ExecTime)\n\t\tif len(args) > 0 {\n\t\t\tengine.logger.Infof(\"[sql] %s [args] %v - took: %v\", sqlStr, args, execDuration)\n\t\t} else {\n\t\t\tengine.logger.Infof(\"[sql] %s - took: %v\", sqlStr, execDuration)\n\t\t}\n\t\treturn stmt, res, err\n\t}\n\treturn executionBlock()\n}\n\nfunc (engine *Engine) logSQLExecutionTime(sqlStr string, args []interface{}, executionBlock func() (sql.Result, error)) (sql.Result, error) {\n\tif engine.showSQL && engine.showExecTime {\n\t\tb4ExecTime := time.Now()\n\t\tres, err := executionBlock()\n\t\texecDuration := time.Since(b4ExecTime)\n\t\tif len(args) > 0 {\n\t\t\tengine.logger.Infof(\"[sql] %s [args] %v - took: %v\", sqlStr, args, execDuration)\n\t\t} else {\n\t\t\tengine.logger.Infof(\"[sql] %s - took: %v\", sqlStr, execDuration)\n\t\t}\n\t\treturn res, err\n\t}\n\treturn executionBlock()\n}\n\n// Sql will be depracated, please use SQL instead\nfunc (engine *Engine) Sql(querystring string, args ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Sql(querystring, args...)\n}\n\n// SQL method let's you manualy write raw SQL and operate\n// For example:\n//\n//         engine.SQL(\"select * from user\").Find(&users)\n//\n// This    code will execute \"select * from user\" and set the records to users\nfunc (engine *Engine) SQL(querystring string, args ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.SQL(querystring, args...)\n}\n\n// NoAutoTime Default if your struct has \"created\" or \"updated\" filed tag, the fields\n// will automatically be filled with current time when Insert or Update\n// invoked. Call NoAutoTime if you dont' want to fill automatically.\nfunc (engine *Engine) NoAutoTime() *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.NoAutoTime()\n}\n\n// NoAutoCondition disable auto generate Where condition from bean or not\nfunc (engine *Engine) NoAutoCondition(no ...bool) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.NoAutoCondition(no...)\n}\n\n// DBMetas Retrieve all tables, columns, indexes' informations from database.\nfunc (engine *Engine) DBMetas() ([]*core.Table, error) {\n\ttables, err := engine.dialect.GetTables()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, table := range tables {\n\t\tcolSeq, cols, err := engine.dialect.GetColumns(table.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, name := range colSeq {\n\t\t\ttable.AddColumn(cols[name])\n\t\t}\n\t\t//table.Columns = cols\n\t\t//table.ColumnsSeq = colSeq\n\t\tindexes, err := engine.dialect.GetIndexes(table.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttable.Indexes = indexes\n\n\t\tfor _, index := range indexes {\n\t\t\tfor _, name := range index.Cols {\n\t\t\t\tif col := table.GetColumn(name); col != nil {\n\t\t\t\t\tcol.Indexes[index.Name] = index.Type\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Unknown col \"+name+\" in indexes %v of table\", index, table.ColumnsSeq())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn tables, nil\n}\n\n// DumpAllToFile dump database all table structs and data to a file\nfunc (engine *Engine) DumpAllToFile(fp string) error {\n\tf, err := os.Create(fp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\treturn engine.DumpAll(f)\n}\n\n// DumpAll dump database all table structs and data to w\nfunc (engine *Engine) DumpAll(w io.Writer) error {\n\treturn engine.dumpAll(w, engine.dialect.DBType())\n}\n\n// DumpTablesToFile dump specified tables to SQL file.\nfunc (engine *Engine) DumpTablesToFile(tables []*core.Table, fp string, tp ...core.DbType) error {\n\tf, err := os.Create(fp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\treturn engine.DumpTables(tables, f, tp...)\n}\n\n// DumpTables dump specify tables to io.Writer\nfunc (engine *Engine) DumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error {\n\treturn engine.dumpTables(tables, w, tp...)\n}\n\nfunc (engine *Engine) tableName(beanOrTableName interface{}) (string, error) {\n\tv := rValue(beanOrTableName)\n\tif v.Type().Kind() == reflect.String {\n\t\treturn beanOrTableName.(string), nil\n\t} else if v.Type().Kind() == reflect.Struct {\n\t\treturn engine.tbName(v), nil\n\t}\n\treturn \"\", errors.New(\"bean should be a struct or struct's point\")\n}\n\nfunc (engine *Engine) tbName(v reflect.Value) string {\n\tif tb, ok := v.Interface().(TableName); ok {\n\t\treturn tb.TableName()\n\t}\n\tif v.CanAddr() {\n\t\tif tb, ok := v.Addr().Interface().(TableName); ok {\n\t\t\treturn tb.TableName()\n\t\t}\n\t}\n\treturn engine.TableMapper.Obj2Table(v.Type().Name())\n}\n\n// DumpAll dump database all table structs and data to w with specify db type\nfunc (engine *Engine) dumpAll(w io.Writer, tp ...core.DbType) error {\n\ttables, err := engine.DBMetas()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar dialect core.Dialect\n\tif len(tp) == 0 {\n\t\tdialect = engine.dialect\n\t} else {\n\t\tdialect = core.QueryDialect(tp[0])\n\t\tif dialect == nil {\n\t\t\treturn errors.New(\"Unsupported database type.\")\n\t\t}\n\t\tdialect.Init(nil, engine.dialect.URI(), \"\", \"\")\n\t}\n\n\t_, err = io.WriteString(w, fmt.Sprintf(\"/*Generated by xorm v%s %s*/\\n\\n\",\n\t\tVersion, time.Now().In(engine.TZLocation).Format(\"2006-01-02 15:04:05\")))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, table := range tables {\n\t\tif i > 0 {\n\t\t\t_, err = io.WriteString(w, \"\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t_, err = io.WriteString(w, dialect.CreateTableSql(table, \"\", table.StoreEngine, \"\")+\";\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, index := range table.Indexes {\n\t\t\t_, err = io.WriteString(w, dialect.CreateIndexSql(table.Name, index)+\";\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\trows, err := engine.DB().Query(\"SELECT * FROM \" + engine.Quote(table.Name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tcols, err := rows.Columns()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(cols) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor rows.Next() {\n\t\t\tdest := make([]interface{}, len(cols))\n\t\t\terr = rows.ScanSlice(&dest)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = io.WriteString(w, \"INSERT INTO \"+dialect.Quote(table.Name)+\" (\"+dialect.Quote(strings.Join(cols, dialect.Quote(\", \")))+\") VALUES (\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar temp string\n\t\t\tfor i, d := range dest {\n\t\t\t\tcol := table.GetColumn(cols[i])\n\t\t\t\tif d == nil {\n\t\t\t\t\ttemp += \", NULL\"\n\t\t\t\t} else if col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\t\t\tvar v = fmt.Sprintf(\"%s\", d)\n\t\t\t\t\ttemp += \", '\" + strings.Replace(v, \"'\", \"''\", -1) + \"'\"\n\t\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\t\tif reflect.TypeOf(d).Kind() == reflect.Slice {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", dialect.FormatBytes(d.([]byte)))\n\t\t\t\t\t} else if reflect.TypeOf(d).Kind() == reflect.String {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", d.(string))\n\t\t\t\t\t}\n\t\t\t\t} else if col.SQLType.IsNumeric() {\n\t\t\t\t\tswitch reflect.TypeOf(d).Kind() {\n\t\t\t\t\tcase reflect.Slice:\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", string(d.([]byte)))\n\t\t\t\t\tdefault:\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %v\", d)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ts := fmt.Sprintf(\"%v\", d)\n\t\t\t\t\tif strings.Contains(s, \":\") || strings.Contains(s, \"-\") {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", s)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", s)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, err = io.WriteString(w, temp[2:]+\");\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// DumpAll dump database all table structs and data to w with specify db type\nfunc (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error {\n\tvar dialect core.Dialect\n\tif len(tp) == 0 {\n\t\tdialect = engine.dialect\n\t} else {\n\t\tdialect = core.QueryDialect(tp[0])\n\t\tif dialect == nil {\n\t\t\treturn errors.New(\"Unsupported database type.\")\n\t\t}\n\t\tdialect.Init(nil, engine.dialect.URI(), \"\", \"\")\n\t}\n\n\t_, err := io.WriteString(w, fmt.Sprintf(\"/*Generated by xorm v%s %s, from %s to %s*/\\n\\n\",\n\t\tVersion, time.Now().In(engine.TZLocation).Format(\"2006-01-02 15:04:05\"), engine.dialect.DBType(), dialect.DBType()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, table := range tables {\n\t\tif i > 0 {\n\t\t\t_, err = io.WriteString(w, \"\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t_, err = io.WriteString(w, dialect.CreateTableSql(table, \"\", table.StoreEngine, \"\")+\";\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, index := range table.Indexes {\n\t\t\t_, err = io.WriteString(w, dialect.CreateIndexSql(table.Name, index)+\";\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\trows, err := engine.DB().Query(\"SELECT * FROM \" + engine.Quote(table.Name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tcols, err := rows.Columns()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(cols) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor rows.Next() {\n\t\t\tdest := make([]interface{}, len(cols))\n\t\t\terr = rows.ScanSlice(&dest)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = io.WriteString(w, \"INSERT INTO \"+dialect.Quote(table.Name)+\" (\"+dialect.Quote(strings.Join(cols, dialect.Quote(\", \")))+\") VALUES (\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar temp string\n\t\t\tfor i, d := range dest {\n\t\t\t\tcol := table.GetColumn(cols[i])\n\t\t\t\tif d == nil {\n\t\t\t\t\ttemp += \", NULL\"\n\t\t\t\t} else if col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\t\t\tvar v = fmt.Sprintf(\"%s\", d)\n\t\t\t\t\tif strings.HasSuffix(v, \" +0000 UTC\") {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", v[0:len(v)-len(\" +0000 UTC\")])\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttemp += \", '\" + strings.Replace(v, \"'\", \"''\", -1) + \"'\"\n\t\t\t\t\t}\n\t\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\t\tif reflect.TypeOf(d).Kind() == reflect.Slice {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", dialect.FormatBytes(d.([]byte)))\n\t\t\t\t\t} else if reflect.TypeOf(d).Kind() == reflect.String {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", d.(string))\n\t\t\t\t\t}\n\t\t\t\t} else if col.SQLType.IsNumeric() {\n\t\t\t\t\tswitch reflect.TypeOf(d).Kind() {\n\t\t\t\t\tcase reflect.Slice:\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", string(d.([]byte)))\n\t\t\t\t\tdefault:\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %v\", d)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ts := fmt.Sprintf(\"%v\", d)\n\t\t\t\t\tif strings.Contains(s, \":\") || strings.Contains(s, \"-\") {\n\t\t\t\t\t\tif strings.HasSuffix(s, \" +0000 UTC\") {\n\t\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", s[0:len(s)-len(\" +0000 UTC\")])\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttemp += fmt.Sprintf(\", '%s'\", s)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttemp += fmt.Sprintf(\", %s\", s)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, err = io.WriteString(w, temp[2:]+\");\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Cascade use cascade or not\nfunc (engine *Engine) Cascade(trueOrFalse ...bool) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Cascade(trueOrFalse...)\n}\n\n// Where method provide a condition query\nfunc (engine *Engine) Where(querystring string, args ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Where(querystring, args...)\n}\n\n// Id will be depracated, please use ID instead\nfunc (engine *Engine) Id(id interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Id(id)\n}\n\n// ID mehtod provoide a condition as (id) = ?\nfunc (engine *Engine) ID(id interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.ID(id)\n}\n\n// Before apply before Processor, affected bean is passed to closure arg\nfunc (engine *Engine) Before(closures func(interface{})) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Before(closures)\n}\n\n// After apply after insert Processor, affected bean is passed to closure arg\nfunc (engine *Engine) After(closures func(interface{})) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.After(closures)\n}\n\n// Charset set charset when create table, only support mysql now\nfunc (engine *Engine) Charset(charset string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Charset(charset)\n}\n\n// StoreEngine set store engine when create table, only support mysql now\nfunc (engine *Engine) StoreEngine(storeEngine string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.StoreEngine(storeEngine)\n}\n\n// Distinct use for distinct columns. Caution: when you are using cache,\n// distinct will not be cached because cache system need id,\n// but distinct will not provide id\nfunc (engine *Engine) Distinct(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Distinct(columns...)\n}\n\n// Select customerize your select columns or contents\nfunc (engine *Engine) Select(str string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Select(str)\n}\n\n// Cols only use the paramters as select or update columns\nfunc (engine *Engine) Cols(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Cols(columns...)\n}\n\n// AllCols indicates that all columns should be use\nfunc (engine *Engine) AllCols() *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.AllCols()\n}\n\n// MustCols specify some columns must use even if they are empty\nfunc (engine *Engine) MustCols(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.MustCols(columns...)\n}\n\n// UseBool xorm automatically retrieve condition according struct, but\n// if struct has bool field, it will ignore them. So use UseBool\n// to tell system to do not ignore them.\n// If no paramters, it will use all the bool field of struct, or\n// it will use paramters's columns\nfunc (engine *Engine) UseBool(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.UseBool(columns...)\n}\n\n// Omit only not use the paramters as select or update columns\nfunc (engine *Engine) Omit(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Omit(columns...)\n}\n\n// Nullable set null when column is zero-value and nullable for update\nfunc (engine *Engine) Nullable(columns ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Nullable(columns...)\n}\n\n// In will generate \"column IN (?, ?)\"\nfunc (engine *Engine) In(column string, args ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.In(column, args...)\n}\n\n// Incr provides a update string like \"column = column + ?\"\nfunc (engine *Engine) Incr(column string, arg ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Incr(column, arg...)\n}\n\n// Decr provides a update string like \"column = column - ?\"\nfunc (engine *Engine) Decr(column string, arg ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Decr(column, arg...)\n}\n\n// SetExpr provides a update string like \"column = {expression}\"\nfunc (engine *Engine) SetExpr(column string, expression string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.SetExpr(column, expression)\n}\n\n// Table temporarily change the Get, Find, Update's table\nfunc (engine *Engine) Table(tableNameOrBean interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Table(tableNameOrBean)\n}\n\n// Alias set the table alias\nfunc (engine *Engine) Alias(alias string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Alias(alias)\n}\n\n// Limit will generate \"LIMIT start, limit\"\nfunc (engine *Engine) Limit(limit int, start ...int) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Limit(limit, start...)\n}\n\n// Desc will generate \"ORDER BY column1 DESC, column2 DESC\"\nfunc (engine *Engine) Desc(colNames ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Desc(colNames...)\n}\n\n// Asc will generate \"ORDER BY column1,column2 Asc\"\n// This method can chainable use.\n//\n//        engine.Desc(\"name\").Asc(\"age\").Find(&users)\n//        // SELECT * FROM user ORDER BY name DESC, age ASC\n//\nfunc (engine *Engine) Asc(colNames ...string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Asc(colNames...)\n}\n\n// OrderBy will generate \"ORDER BY order\"\nfunc (engine *Engine) OrderBy(order string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.OrderBy(order)\n}\n\n// Join the join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN\nfunc (engine *Engine) Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Join(joinOperator, tablename, condition, args...)\n}\n\n// GroupBy generate group by statement\nfunc (engine *Engine) GroupBy(keys string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.GroupBy(keys)\n}\n\n// Having generate having statement\nfunc (engine *Engine) Having(conditions string) *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Having(conditions)\n}\n\nfunc (engine *Engine) autoMapType(v reflect.Value) *core.Table {\n\tt := v.Type()\n\tengine.mutex.Lock()\n\ttable, ok := engine.Tables[t]\n\tif !ok {\n\t\ttable = engine.mapType(v)\n\t\tengine.Tables[t] = table\n\t\tif engine.Cacher != nil {\n\t\t\tif v.CanAddr() {\n\t\t\t\tengine.GobRegister(v.Addr().Interface())\n\t\t\t} else {\n\t\t\t\tengine.GobRegister(v.Interface())\n\t\t\t}\n\t\t}\n\t}\n\tengine.mutex.Unlock()\n\treturn table\n}\n\n// GobRegister register one struct to gob for cache use\nfunc (engine *Engine) GobRegister(v interface{}) *Engine {\n\t//fmt.Printf(\"Type: %[1]T => Data: %[1]#v\\n\", v)\n\tgob.Register(v)\n\treturn engine\n}\n\n// Table table struct\ntype Table struct {\n\t*core.Table\n\tName string\n}\n\n// TableInfo get table info according to bean's content\nfunc (engine *Engine) TableInfo(bean interface{}) *Table {\n\tv := rValue(bean)\n\treturn &Table{engine.autoMapType(v), engine.tbName(v)}\n}\n\nfunc addIndex(indexName string, table *core.Table, col *core.Column, indexType int) {\n\tif index, ok := table.Indexes[indexName]; ok {\n\t\tindex.AddColumn(col.Name)\n\t\tcol.Indexes[index.Name] = indexType\n\t} else {\n\t\tindex := core.NewIndex(indexName, indexType)\n\t\tindex.AddColumn(col.Name)\n\t\ttable.AddIndex(index)\n\t\tcol.Indexes[index.Name] = indexType\n\t}\n}\n\nfunc (engine *Engine) newTable() *core.Table {\n\ttable := core.NewEmptyTable()\n\n\tif !engine.disableGlobalCache {\n\t\ttable.Cacher = engine.Cacher\n\t}\n\treturn table\n}\n\n// TableName table name interface to define customerize table name\ntype TableName interface {\n\tTableName() string\n}\n\nfunc (engine *Engine) mapType(v reflect.Value) *core.Table {\n\tt := v.Type()\n\ttable := engine.newTable()\n\tif tb, ok := v.Interface().(TableName); ok {\n\t\ttable.Name = tb.TableName()\n\t} else {\n\t\tif v.CanAddr() {\n\t\t\tif tb, ok = v.Addr().Interface().(TableName); ok {\n\t\t\t\ttable.Name = tb.TableName()\n\t\t\t}\n\t\t}\n\t\tif table.Name == \"\" {\n\t\t\ttable.Name = engine.TableMapper.Obj2Table(t.Name())\n\t\t}\n\t}\n\n\ttable.Type = t\n\n\tvar idFieldColName string\n\tvar err error\n\tvar hasCacheTag, hasNoCacheTag bool\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\ttag := t.Field(i).Tag\n\n\t\tormTagStr := tag.Get(engine.TagIdentifier)\n\t\tvar col *core.Column\n\t\tfieldValue := v.Field(i)\n\t\tfieldType := fieldValue.Type()\n\n\t\tif ormTagStr != \"\" {\n\t\t\tcol = &core.Column{FieldName: t.Field(i).Name, Nullable: true, IsPrimaryKey: false,\n\t\t\t\tIsAutoIncrement: false, MapType: core.TWOSIDES, Indexes: make(map[string]int)}\n\t\t\ttags := splitTag(ormTagStr)\n\n\t\t\tif len(tags) > 0 {\n\t\t\t\tif tags[0] == \"-\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif strings.ToUpper(tags[0]) == \"EXTENDS\" {\n\t\t\t\t\tswitch fieldValue.Kind() {\n\t\t\t\t\tcase reflect.Ptr:\n\t\t\t\t\t\tf := fieldValue.Type().Elem()\n\t\t\t\t\t\tif f.Kind() == reflect.Struct {\n\t\t\t\t\t\t\tfieldPtr := fieldValue\n\t\t\t\t\t\t\tfieldValue = fieldValue.Elem()\n\t\t\t\t\t\t\tif !fieldValue.IsValid() || fieldPtr.IsNil() {\n\t\t\t\t\t\t\t\tfieldValue = reflect.New(f).Elem()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfallthrough\n\t\t\t\t\tcase reflect.Struct:\n\t\t\t\t\t\tparentTable := engine.mapType(fieldValue)\n\t\t\t\t\t\tfor _, col := range parentTable.Columns() {\n\t\t\t\t\t\t\tcol.FieldName = fmt.Sprintf(\"%v.%v\", t.Field(i).Name, col.FieldName)\n\t\t\t\t\t\t\ttable.AddColumn(col)\n\t\t\t\t\t\t\tfor indexName, indexType := range col.Indexes {\n\t\t\t\t\t\t\t\taddIndex(indexName, table, col, indexType)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t//TODO: warning\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindexNames := make(map[string]int)\n\t\t\t\tvar isIndex, isUnique bool\n\t\t\t\tvar preKey string\n\t\t\t\tfor j, key := range tags {\n\t\t\t\t\tk := strings.ToUpper(key)\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase k == \"<-\":\n\t\t\t\t\t\tcol.MapType = core.ONLYFROMDB\n\t\t\t\t\tcase k == \"->\":\n\t\t\t\t\t\tcol.MapType = core.ONLYTODB\n\t\t\t\t\tcase k == \"PK\":\n\t\t\t\t\t\tcol.IsPrimaryKey = true\n\t\t\t\t\t\tcol.Nullable = false\n\t\t\t\t\tcase k == \"NULL\":\n\t\t\t\t\t\tif j == 0 {\n\t\t\t\t\t\t\tcol.Nullable = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcol.Nullable = (strings.ToUpper(tags[j-1]) != \"NOT\")\n\t\t\t\t\t\t}\n\t\t\t\t\t// TODO: for postgres how add autoincr?\n\t\t\t\t\t/*case strings.HasPrefix(k, \"AUTOINCR(\") && strings.HasSuffix(k, \")\"):\n\t\t\t\t\tcol.IsAutoIncrement = true\n\n\t\t\t\t\tautoStart := k[len(\"AUTOINCR\")+1 : len(k)-1]\n\t\t\t\t\tautoStartInt, err := strconv.Atoi(autoStart)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tengine.LogError(err)\n\t\t\t\t\t}\n\t\t\t\t\tcol.AutoIncrStart = autoStartInt*/\n\t\t\t\t\tcase k == \"AUTOINCR\":\n\t\t\t\t\t\tcol.IsAutoIncrement = true\n\t\t\t\t\t\t//col.AutoIncrStart = 1\n\t\t\t\t\tcase k == \"DEFAULT\":\n\t\t\t\t\t\tcol.Default = tags[j+1]\n\t\t\t\t\tcase k == \"CREATED\":\n\t\t\t\t\t\tcol.IsCreated = true\n\t\t\t\t\tcase k == \"VERSION\":\n\t\t\t\t\t\tcol.IsVersion = true\n\t\t\t\t\t\tcol.Default = \"1\"\n\t\t\t\t\tcase k == \"UTC\":\n\t\t\t\t\t\tcol.TimeZone = time.UTC\n\t\t\t\t\tcase k == \"LOCAL\":\n\t\t\t\t\t\tcol.TimeZone = time.Local\n\t\t\t\t\tcase strings.HasPrefix(k, \"LOCALE(\") && strings.HasSuffix(k, \")\"):\n\t\t\t\t\t\tlocation := k[len(\"INDEX\")+1 : len(k)-1]\n\t\t\t\t\t\tcol.TimeZone, err = time.LoadLocation(location)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase k == \"UPDATED\":\n\t\t\t\t\t\tcol.IsUpdated = true\n\t\t\t\t\tcase k == \"DELETED\":\n\t\t\t\t\t\tcol.IsDeleted = true\n\t\t\t\t\tcase strings.HasPrefix(k, \"INDEX(\") && strings.HasSuffix(k, \")\"):\n\t\t\t\t\t\tindexName := k[len(\"INDEX\")+1 : len(k)-1]\n\t\t\t\t\t\tindexNames[indexName] = core.IndexType\n\t\t\t\t\tcase k == \"INDEX\":\n\t\t\t\t\t\tisIndex = true\n\t\t\t\t\tcase strings.HasPrefix(k, \"UNIQUE(\") && strings.HasSuffix(k, \")\"):\n\t\t\t\t\t\tindexName := k[len(\"UNIQUE\")+1 : len(k)-1]\n\t\t\t\t\t\tindexNames[indexName] = core.UniqueType\n\t\t\t\t\tcase k == \"UNIQUE\":\n\t\t\t\t\t\tisUnique = true\n\t\t\t\t\tcase k == \"NOTNULL\":\n\t\t\t\t\t\tcol.Nullable = false\n\t\t\t\t\tcase k == \"CACHE\":\n\t\t\t\t\t\tif !hasCacheTag {\n\t\t\t\t\t\t\thasCacheTag = true\n\t\t\t\t\t\t}\n\t\t\t\t\tcase k == \"NOCACHE\":\n\t\t\t\t\t\tif !hasNoCacheTag {\n\t\t\t\t\t\t\thasNoCacheTag = true\n\t\t\t\t\t\t}\n\t\t\t\t\tcase k == \"NOT\":\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif strings.HasPrefix(k, \"'\") && strings.HasSuffix(k, \"'\") {\n\t\t\t\t\t\t\tif preKey != \"DEFAULT\" {\n\t\t\t\t\t\t\t\tcol.Name = key[1 : len(key)-1]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if strings.Contains(k, \"(\") && strings.HasSuffix(k, \")\") {\n\t\t\t\t\t\t\tfs := strings.Split(k, \"(\")\n\n\t\t\t\t\t\t\tif _, ok := core.SqlTypes[fs[0]]; !ok {\n\t\t\t\t\t\t\t\tpreKey = k\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcol.SQLType = core.SQLType{Name: fs[0]}\n\t\t\t\t\t\t\tif fs[0] == core.Enum && fs[1][0] == '\\'' { //enum\n\t\t\t\t\t\t\t\toptions := strings.Split(fs[1][0:len(fs[1])-1], \",\")\n\t\t\t\t\t\t\t\tcol.EnumOptions = make(map[string]int)\n\t\t\t\t\t\t\t\tfor k, v := range options {\n\t\t\t\t\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\t\t\t\t\tv = strings.Trim(v, \"'\")\n\t\t\t\t\t\t\t\t\tcol.EnumOptions[v] = k\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if fs[0] == core.Set && fs[1][0] == '\\'' { //set\n\t\t\t\t\t\t\t\toptions := strings.Split(fs[1][0:len(fs[1])-1], \",\")\n\t\t\t\t\t\t\t\tcol.SetOptions = make(map[string]int)\n\t\t\t\t\t\t\t\tfor k, v := range options {\n\t\t\t\t\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\t\t\t\t\tv = strings.Trim(v, \"'\")\n\t\t\t\t\t\t\t\t\tcol.SetOptions[v] = k\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfs2 := strings.Split(fs[1][0:len(fs[1])-1], \",\")\n\t\t\t\t\t\t\t\tif len(fs2) == 2 {\n\t\t\t\t\t\t\t\t\tcol.Length, err = strconv.Atoi(fs2[0])\n\t\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcol.Length2, err = strconv.Atoi(fs2[1])\n\t\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if len(fs2) == 1 {\n\t\t\t\t\t\t\t\t\tcol.Length, err = strconv.Atoi(fs2[0])\n\t\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif _, ok := core.SqlTypes[k]; ok {\n\t\t\t\t\t\t\t\tcol.SQLType = core.SQLType{Name: k}\n\t\t\t\t\t\t\t} else if key != col.Default {\n\t\t\t\t\t\t\t\tcol.Name = key\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tengine.dialect.SqlType(col)\n\t\t\t\t\t}\n\t\t\t\t\tpreKey = k\n\t\t\t\t}\n\t\t\t\tif col.SQLType.Name == \"\" {\n\t\t\t\t\tcol.SQLType = core.Type2SQLType(fieldType)\n\t\t\t\t}\n\t\t\t\tif col.Length == 0 {\n\t\t\t\t\tcol.Length = col.SQLType.DefaultLength\n\t\t\t\t}\n\t\t\t\tif col.Length2 == 0 {\n\t\t\t\t\tcol.Length2 = col.SQLType.DefaultLength2\n\t\t\t\t}\n\n\t\t\t\tif col.Name == \"\" {\n\t\t\t\t\tcol.Name = engine.ColumnMapper.Obj2Table(t.Field(i).Name)\n\t\t\t\t}\n\n\t\t\t\tif isUnique {\n\t\t\t\t\tindexNames[col.Name] = core.UniqueType\n\t\t\t\t} else if isIndex {\n\t\t\t\t\tindexNames[col.Name] = core.IndexType\n\t\t\t\t}\n\n\t\t\t\tfor indexName, indexType := range indexNames {\n\t\t\t\t\taddIndex(indexName, table, col, indexType)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tvar sqlType core.SQLType\n\t\t\tif fieldValue.CanAddr() {\n\t\t\t\tif _, ok := fieldValue.Addr().Interface().(core.Conversion); ok {\n\t\t\t\t\tsqlType = core.SQLType{Name: core.Text}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := fieldValue.Interface().(core.Conversion); ok {\n\t\t\t\tsqlType = core.SQLType{Name: core.Text}\n\t\t\t} else {\n\t\t\t\tsqlType = core.Type2SQLType(fieldType)\n\t\t\t}\n\t\t\tcol = core.NewColumn(engine.ColumnMapper.Obj2Table(t.Field(i).Name),\n\t\t\t\tt.Field(i).Name, sqlType, sqlType.DefaultLength,\n\t\t\t\tsqlType.DefaultLength2, true)\n\t\t}\n\t\tif col.IsAutoIncrement {\n\t\t\tcol.Nullable = false\n\t\t}\n\n\t\ttable.AddColumn(col)\n\n\t\tif fieldType.Kind() == reflect.Int64 && (strings.ToUpper(col.FieldName) == \"ID\" || strings.HasSuffix(strings.ToUpper(col.FieldName), \".ID\")) {\n\t\t\tidFieldColName = col.Name\n\t\t}\n\t} // end for\n\n\tif idFieldColName != \"\" && len(table.PrimaryKeys) == 0 {\n\t\tcol := table.GetColumn(idFieldColName)\n\t\tcol.IsPrimaryKey = true\n\t\tcol.IsAutoIncrement = true\n\t\tcol.Nullable = false\n\t\ttable.PrimaryKeys = append(table.PrimaryKeys, col.Name)\n\t\ttable.AutoIncrement = col.Name\n\t}\n\n\tif hasCacheTag {\n\t\tif engine.Cacher != nil { // !nash! use engine's cacher if provided\n\t\t\tengine.logger.Info(\"enable cache on table:\", table.Name)\n\t\t\ttable.Cacher = engine.Cacher\n\t\t} else {\n\t\t\tengine.logger.Info(\"enable LRU cache on table:\", table.Name)\n\t\t\ttable.Cacher = NewLRUCacher2(NewMemoryStore(), time.Hour, 10000) // !nashtsai! HACK use LRU cacher for now\n\t\t}\n\t}\n\tif hasNoCacheTag {\n\t\tengine.logger.Info(\"no cache on table:\", table.Name)\n\t\ttable.Cacher = nil\n\t}\n\n\treturn table\n}\n\n// Map a struct to a table\nfunc (engine *Engine) mapping(beans ...interface{}) (e error) {\n\tengine.mutex.Lock()\n\tdefer engine.mutex.Unlock()\n\tfor _, bean := range beans {\n\t\tv := rValue(bean)\n\t\tengine.Tables[v.Type()] = engine.mapType(v)\n\t}\n\treturn\n}\n\n// IsTableEmpty if a table has any reocrd\nfunc (engine *Engine) IsTableEmpty(bean interface{}) (bool, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.IsTableEmpty(bean)\n}\n\n// IsTableExist if a table is exist\nfunc (engine *Engine) IsTableExist(beanOrTableName interface{}) (bool, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.IsTableExist(beanOrTableName)\n}\n\n// IdOf get id from one struct\nfunc (engine *Engine) IdOf(bean interface{}) core.PK {\n\treturn engine.IdOfV(reflect.ValueOf(bean))\n}\n\n// IdOfV get id from one value of struct\nfunc (engine *Engine) IdOfV(rv reflect.Value) core.PK {\n\tv := reflect.Indirect(rv)\n\ttable := engine.autoMapType(v)\n\tpk := make([]interface{}, len(table.PrimaryKeys))\n\tfor i, col := range table.PKColumns() {\n\t\tpkField := v.FieldByName(col.FieldName)\n\t\tswitch pkField.Kind() {\n\t\tcase reflect.String:\n\t\t\tpk[i] = pkField.String()\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tpk[i] = pkField.Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tpk[i] = pkField.Uint()\n\t\t}\n\t}\n\treturn core.PK(pk)\n}\n\n// CreateIndexes create indexes\nfunc (engine *Engine) CreateIndexes(bean interface{}) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.CreateIndexes(bean)\n}\n\n// CreateUniques create uniques\nfunc (engine *Engine) CreateUniques(bean interface{}) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.CreateUniques(bean)\n}\n\nfunc (engine *Engine) getCacher2(table *core.Table) core.Cacher {\n\treturn table.Cacher\n}\n\nfunc (engine *Engine) getCacher(v reflect.Value) core.Cacher {\n\tif table := engine.autoMapType(v); table != nil {\n\t\treturn table.Cacher\n\t}\n\treturn engine.Cacher\n}\n\n// ClearCacheBean if enabled cache, clear the cache bean\nfunc (engine *Engine) ClearCacheBean(bean interface{}, id string) error {\n\tv := rValue(bean)\n\tt := v.Type()\n\tif t.Kind() != reflect.Struct {\n\t\treturn errors.New(\"error params\")\n\t}\n\ttableName := engine.tbName(v)\n\ttable := engine.autoMapType(v)\n\tcacher := table.Cacher\n\tif cacher == nil {\n\t\tcacher = engine.Cacher\n\t}\n\tif cacher != nil {\n\t\tcacher.ClearIds(tableName)\n\t\tcacher.DelBean(tableName, id)\n\t}\n\treturn nil\n}\n\n// ClearCache if enabled cache, clear some tables' cache\nfunc (engine *Engine) ClearCache(beans ...interface{}) error {\n\tfor _, bean := range beans {\n\t\tv := rValue(bean)\n\t\tt := v.Type()\n\t\tif t.Kind() != reflect.Struct {\n\t\t\treturn errors.New(\"error params\")\n\t\t}\n\t\ttableName := engine.tbName(v)\n\t\ttable := engine.autoMapType(v)\n\t\tcacher := table.Cacher\n\t\tif cacher == nil {\n\t\t\tcacher = engine.Cacher\n\t\t}\n\t\tif cacher != nil {\n\t\t\tcacher.ClearIds(tableName)\n\t\t\tcacher.ClearBeans(tableName)\n\t\t}\n\t}\n\treturn nil\n}\n\n// Sync the new struct changes to database, this method will automatically add\n// table, column, index, unique. but will not delete or change anything.\n// If you change some field, you should change the database manually.\nfunc (engine *Engine) Sync(beans ...interface{}) error {\n\tfor _, bean := range beans {\n\t\tv := rValue(bean)\n\t\ttableName := engine.tbName(v)\n\t\ttable := engine.autoMapType(v)\n\n\t\ts := engine.NewSession()\n\t\tdefer s.Close()\n\t\tisExist, err := s.Table(bean).isTableExist(tableName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !isExist {\n\t\t\terr = engine.CreateTables(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t/*isEmpty, err := engine.IsEmptyTable(bean)\n\t\t  if err != nil {\n\t\t      return err\n\t\t  }*/\n\t\tvar isEmpty bool\n\t\tif isEmpty {\n\t\t\terr = engine.DropTables(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = engine.CreateTables(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, col := range table.Columns() {\n\t\t\t\tsession := engine.NewSession()\n\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\tdefer session.Close()\n\t\t\t\tisExist, err := session.Engine.dialect.IsColumnExist(tableName, col.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !isExist {\n\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\tdefer session.Close()\n\t\t\t\t\terr = session.addColumn(col.Name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor name, index := range table.Indexes {\n\t\t\t\tsession := engine.NewSession()\n\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\tdefer session.Close()\n\t\t\t\tif index.Type == core.UniqueType {\n\t\t\t\t\t//isExist, err := session.isIndexExist(table.Name, name, true)\n\t\t\t\t\tisExist, err := session.isIndexExist2(tableName, index.Cols, true)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif !isExist {\n\t\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\t\tdefer session.Close()\n\t\t\t\t\t\terr = session.addUnique(tableName, name)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if index.Type == core.IndexType {\n\t\t\t\t\tisExist, err := session.isIndexExist2(tableName, index.Cols, false)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif !isExist {\n\t\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\t\tdefer session.Close()\n\t\t\t\t\t\terr = session.addIndex(tableName, name)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn errors.New(\"unknow index type\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Sync2 synchronize structs to database tables\nfunc (engine *Engine) Sync2(beans ...interface{}) error {\n\ts := engine.NewSession()\n\tdefer s.Close()\n\treturn s.Sync2(beans...)\n}\n\nfunc (engine *Engine) unMap(beans ...interface{}) (e error) {\n\tengine.mutex.Lock()\n\tdefer engine.mutex.Unlock()\n\tfor _, bean := range beans {\n\t\tt := rType(bean)\n\t\tif _, ok := engine.Tables[t]; ok {\n\t\t\tdelete(engine.Tables, t)\n\t\t}\n\t}\n\treturn\n}\n\n// Drop all mapped table\nfunc (engine *Engine) dropAll() error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\n\terr := session.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = session.dropAll()\n\tif err != nil {\n\t\tsession.Rollback()\n\t\treturn err\n\t}\n\treturn session.Commit()\n}\n\n// CreateTables create tabls according bean\nfunc (engine *Engine) CreateTables(beans ...interface{}) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\n\terr := session.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, bean := range beans {\n\t\terr = session.CreateTable(bean)\n\t\tif err != nil {\n\t\t\tsession.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\treturn session.Commit()\n}\n\n// DropTables drop specify tables\nfunc (engine *Engine) DropTables(beans ...interface{}) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\n\terr := session.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, bean := range beans {\n\t\terr = session.DropTable(bean)\n\t\tif err != nil {\n\t\t\tsession.Rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\treturn session.Commit()\n}\n\nfunc (engine *Engine) createAll() error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.createAll()\n}\n\n// Exec raw sql\nfunc (engine *Engine) Exec(sql string, args ...interface{}) (sql.Result, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Exec(sql, args...)\n}\n\n// Query a raw sql and return records as []map[string][]byte\nfunc (engine *Engine) Query(sql string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Query(sql, paramStr...)\n}\n\n// Insert one or more records\nfunc (engine *Engine) Insert(beans ...interface{}) (int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Insert(beans...)\n}\n\n// InsertOne insert only one record\nfunc (engine *Engine) InsertOne(bean interface{}) (int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.InsertOne(bean)\n}\n\n// Update records, bean's non-empty fields are updated contents,\n// condiBean' non-empty filds are conditions\n// CAUTION:\n//        1.bool will defaultly be updated content nor conditions\n//         You should call UseBool if you have bool to use.\n//        2.float32 & float64 may be not inexact as conditions\nfunc (engine *Engine) Update(bean interface{}, condiBeans ...interface{}) (int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Update(bean, condiBeans...)\n}\n\n// Delete records, bean's non-empty fields are conditions\nfunc (engine *Engine) Delete(bean interface{}) (int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Delete(bean)\n}\n\n// Get retrieve one record from table, bean's non-empty fields\n// are conditions\nfunc (engine *Engine) Get(bean interface{}) (bool, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Get(bean)\n}\n\n// Find retrieve records from table, condiBeans's non-empty fields\n// are conditions. beans could be []Struct, []*Struct, map[int64]Struct\n// map[int64]*Struct\nfunc (engine *Engine) Find(beans interface{}, condiBeans ...interface{}) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Find(beans, condiBeans...)\n}\n\n// Iterate record by record handle records from table, bean's non-empty fields\n// are conditions.\nfunc (engine *Engine) Iterate(bean interface{}, fun IterFunc) error {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Iterate(bean, fun)\n}\n\n// Rows return sql.Rows compatible Rows obj, as a forward Iterator object for iterating record by record, bean's non-empty fields\n// are conditions.\nfunc (engine *Engine) Rows(bean interface{}) (*Rows, error) {\n\tsession := engine.NewSession()\n\treturn session.Rows(bean)\n}\n\n// Count counts the records. bean's non-empty fields are conditions.\nfunc (engine *Engine) Count(bean interface{}) (int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Count(bean)\n}\n\n// Sum sum the records by some column. bean's non-empty fields are conditions.\nfunc (engine *Engine) Sum(bean interface{}, colName string) (float64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Sum(bean, colName)\n}\n\n// Sums sum the records by some columns. bean's non-empty fields are conditions.\nfunc (engine *Engine) Sums(bean interface{}, colNames ...string) ([]float64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.Sums(bean, colNames...)\n}\n\n// SumsInt like Sums but return slice of int64 instead of float64.\nfunc (engine *Engine) SumsInt(bean interface{}, colNames ...string) ([]int64, error) {\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\treturn session.SumsInt(bean, colNames...)\n}\n\n// ImportFile SQL DDL file\nfunc (engine *Engine) ImportFile(ddlPath string) ([]sql.Result, error) {\n\tfile, err := os.Open(ddlPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\treturn engine.Import(file)\n}\n\n// Import SQL DDL from io.Reader\nfunc (engine *Engine) Import(r io.Reader) ([]sql.Result, error) {\n\tvar results []sql.Result\n\tvar lastError error\n\tscanner := bufio.NewScanner(r)\n\n\tsemiColSpliter := func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tif atEOF && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\t\tif i := bytes.IndexByte(data, ';'); i >= 0 {\n\t\t\treturn i + 1, data[0:i], nil\n\t\t}\n\t\t// If we're at EOF, we have a final, non-terminated line. Return it.\n\t\tif atEOF {\n\t\t\treturn len(data), data, nil\n\t\t}\n\t\t// Request more data.\n\t\treturn 0, nil, nil\n\t}\n\n\tscanner.Split(semiColSpliter)\n\n\tfor scanner.Scan() {\n\t\tquery := strings.Trim(scanner.Text(), \" \\t\\n\\r\")\n\t\tif len(query) > 0 {\n\t\t\tengine.logSQL(query)\n\t\t\tresult, err := engine.DB().Exec(query)\n\t\t\tresults = append(results, result)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t\t//lastError = err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn results, lastError\n}\n\n// TZTime change one time to xorm time location\nfunc (engine *Engine) TZTime(t time.Time) time.Time {\n\tif !t.IsZero() { // if time is not initialized it's not suitable for Time.In()\n\t\treturn t.In(engine.TZLocation)\n\t}\n\treturn t\n}\n\n// NowTime return current time\nfunc (engine *Engine) NowTime(sqlTypeName string) interface{} {\n\tt := time.Now()\n\treturn engine.FormatTime(sqlTypeName, t)\n}\n\n// NowTime2 return current time\nfunc (engine *Engine) NowTime2(sqlTypeName string) (interface{}, time.Time) {\n\tt := time.Now()\n\treturn engine.FormatTime(sqlTypeName, t), t\n}\n\n// FormatTime format time\nfunc (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{}) {\n\treturn engine.formatTime(engine.TZLocation, sqlTypeName, t)\n}\n\nfunc (engine *Engine) formatColTime(col *core.Column, t time.Time) (v interface{}) {\n\tif col.DisableTimeZone {\n\t\treturn engine.formatTime(nil, col.SQLType.Name, t)\n\t} else if col.TimeZone != nil {\n\t\treturn engine.formatTime(col.TimeZone, col.SQLType.Name, t)\n\t}\n\treturn engine.formatTime(engine.TZLocation, col.SQLType.Name, t)\n}\n\nfunc (engine *Engine) formatTime(tz *time.Location, sqlTypeName string, t time.Time) (v interface{}) {\n\tif engine.dialect.DBType() == core.ORACLE {\n\t\treturn t\n\t}\n\tif tz != nil {\n\t\tt = engine.TZTime(t)\n\t}\n\tswitch sqlTypeName {\n\tcase core.Time:\n\t\ts := t.Format(\"2006-01-02 15:04:05\") //time.RFC3339\n\t\tv = s[11:19]\n\tcase core.Date:\n\t\tv = t.Format(\"2006-01-02\")\n\tcase core.DateTime, core.TimeStamp:\n\t\tif engine.dialect.DBType() == \"ql\" {\n\t\t\tv = t\n\t\t} else if engine.dialect.DBType() == \"sqlite3\" {\n\t\t\tv = t.UTC().Format(\"2006-01-02 15:04:05\")\n\t\t} else {\n\t\t\tv = t.Format(\"2006-01-02 15:04:05\")\n\t\t}\n\tcase core.TimeStampz:\n\t\tif engine.dialect.DBType() == core.MSSQL {\n\t\t\tv = t.Format(\"2006-01-02T15:04:05.9999999Z07:00\")\n\t\t} else if engine.DriverName() == \"mssql\" {\n\t\t\tv = t\n\t\t} else {\n\t\t\tv = t.Format(time.RFC3339Nano)\n\t\t}\n\tcase core.BigInt, core.Int:\n\t\tv = t.Unix()\n\tdefault:\n\t\tv = t\n\t}\n\treturn\n}\n\n// Unscoped always disable struct tag \"deleted\"\nfunc (engine *Engine) Unscoped() *Session {\n\tsession := engine.NewSession()\n\tsession.IsAutoClose = true\n\treturn session.Unscoped()\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/error.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n)\n\nvar (\n\tErrParamsType      error = errors.New(\"Params type error\")\n\tErrTableNotFound   error = errors.New(\"Not found table\")\n\tErrUnSupportedType error = errors.New(\"Unsupported type error\")\n\tErrNotExist        error = errors.New(\"Not exist error\")\n\tErrCacheFailed     error = errors.New(\"Cache failed\")\n\tErrNeedDeletedCond error = errors.New(\"Delete need at least one condition\")\n\tErrNotImplemented  error = errors.New(\"Not implemented.\")\n)\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/gen_reserved.sh",
    "content": "#!/bin/bash\nif [ -f $1 ];then\n    cat $1| awk '{printf(\"\\\"\"$1\"\\\":true,\\n\")}' \nelse\n    echo \"argument $1 if not a file!\"\nfi\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/goracle_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"regexp\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// func init() {\n// \tcore.RegisterDriver(\"goracle\", &goracleDriver{})\n// }\n\ntype goracleDriver struct {\n}\n\nfunc (cfg *goracleDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tdb := &core.Uri{DbType: core.ORACLE}\n\tdsnPattern := regexp.MustCompile(\n\t\t`^(?:(?P<user>.*?)(?::(?P<passwd>.*))?@)?` + // [user[:password]@]\n\t\t\t`(?:(?P<net>[^\\(]*)(?:\\((?P<addr>[^\\)]*)\\))?)?` + // [net[(addr)]]\n\t\t\t`\\/(?P<dbname>.*?)` + // /dbname\n\t\t\t`(?:\\?(?P<params>[^\\?]*))?$`) // [?param1=value1&paramN=valueN]\n\tmatches := dsnPattern.FindStringSubmatch(dataSourceName)\n\t//tlsConfigRegister := make(map[string]*tls.Config)\n\tnames := dsnPattern.SubexpNames()\n\n\tfor i, match := range matches {\n\t\tswitch names[i] {\n\t\tcase \"dbname\":\n\t\t\tdb.DbName = match\n\t\t}\n\t}\n\tif db.DbName == \"\" {\n\t\treturn nil, errors.New(\"dbname is empty\")\n\t}\n\treturn db, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/helpers.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// str2PK convert string value to primary key value according to tp\nfunc str2PK(s string, tp reflect.Type) (interface{}, error) {\n\tvar err error\n\tvar result interface{}\n\tswitch tp.Kind() {\n\tcase reflect.Int:\n\t\tresult, err = strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as int: \" + err.Error())\n\t\t}\n\tcase reflect.Int8:\n\t\tx, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as int16: \" + err.Error())\n\t\t}\n\t\tresult = int8(x)\n\tcase reflect.Int16:\n\t\tx, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as int16: \" + err.Error())\n\t\t}\n\t\tresult = int16(x)\n\tcase reflect.Int32:\n\t\tx, err := strconv.Atoi(s)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as int32: \" + err.Error())\n\t\t}\n\t\tresult = int32(x)\n\tcase reflect.Int64:\n\t\tresult, err = strconv.ParseInt(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as int64: \" + err.Error())\n\t\t}\n\tcase reflect.Uint:\n\t\tx, err := strconv.ParseUint(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as uint: \" + err.Error())\n\t\t}\n\t\tresult = uint(x)\n\tcase reflect.Uint8:\n\t\tx, err := strconv.ParseUint(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as uint8: \" + err.Error())\n\t\t}\n\t\tresult = uint8(x)\n\tcase reflect.Uint16:\n\t\tx, err := strconv.ParseUint(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as uint16: \" + err.Error())\n\t\t}\n\t\tresult = uint16(x)\n\tcase reflect.Uint32:\n\t\tx, err := strconv.ParseUint(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as uint32: \" + err.Error())\n\t\t}\n\t\tresult = uint32(x)\n\tcase reflect.Uint64:\n\t\tresult, err = strconv.ParseUint(s, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"convert \" + s + \" as uint64: \" + err.Error())\n\t\t}\n\tcase reflect.String:\n\t\tresult = s\n\tdefault:\n\t\tpanic(\"unsupported convert type\")\n\t}\n\tresult = reflect.ValueOf(result).Convert(tp).Interface()\n\treturn result, nil\n}\n\nfunc splitTag(tag string) (tags []string) {\n\ttag = strings.TrimSpace(tag)\n\tvar hasQuote = false\n\tvar lastIdx = 0\n\tfor i, t := range tag {\n\t\tif t == '\\'' {\n\t\t\thasQuote = !hasQuote\n\t\t} else if t == ' ' {\n\t\t\tif lastIdx < i && !hasQuote {\n\t\t\t\ttags = append(tags, strings.TrimSpace(tag[lastIdx:i]))\n\t\t\t\tlastIdx = i + 1\n\t\t\t}\n\t\t}\n\t}\n\tif lastIdx < len(tag) {\n\t\ttags = append(tags, strings.TrimSpace(tag[lastIdx:len(tag)]))\n\t}\n\treturn\n}\n\ntype zeroable interface {\n\tIsZero() bool\n}\n\nfunc isZero(k interface{}) bool {\n\tswitch k.(type) {\n\tcase int:\n\t\treturn k.(int) == 0\n\tcase int8:\n\t\treturn k.(int8) == 0\n\tcase int16:\n\t\treturn k.(int16) == 0\n\tcase int32:\n\t\treturn k.(int32) == 0\n\tcase int64:\n\t\treturn k.(int64) == 0\n\tcase uint:\n\t\treturn k.(uint) == 0\n\tcase uint8:\n\t\treturn k.(uint8) == 0\n\tcase uint16:\n\t\treturn k.(uint16) == 0\n\tcase uint32:\n\t\treturn k.(uint32) == 0\n\tcase uint64:\n\t\treturn k.(uint64) == 0\n\tcase float32:\n\t\treturn k.(float32) == 0\n\tcase float64:\n\t\treturn k.(float64) == 0\n\tcase bool:\n\t\treturn k.(bool) == false\n\tcase string:\n\t\treturn k.(string) == \"\"\n\tcase zeroable:\n\t\treturn k.(zeroable).IsZero()\n\t}\n\treturn false\n}\n\nfunc isStructZero(v reflect.Value) bool {\n\tif !v.IsValid() {\n\t\treturn true\n\t}\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\tswitch field.Kind() {\n\t\tcase reflect.Ptr:\n\t\t\tfield = field.Elem()\n\t\t\tfallthrough\n\t\tcase reflect.Struct:\n\t\t\tif !isStructZero(field) {\n\t\t\t\treturn false\n\t\t\t}\n\t\tdefault:\n\t\t\tif field.CanInterface() && !isZero(field.Interface()) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n\nfunc int64ToIntValue(id int64, tp reflect.Type) reflect.Value {\n\tvar v interface{}\n\tswitch tp.Kind() {\n\tcase reflect.Int16:\n\t\tv = int16(id)\n\tcase reflect.Int32:\n\t\tv = int32(id)\n\tcase reflect.Int:\n\t\tv = int(id)\n\tcase reflect.Int64:\n\t\tv = id\n\tcase reflect.Uint16:\n\t\tv = uint16(id)\n\tcase reflect.Uint32:\n\t\tv = uint32(id)\n\tcase reflect.Uint64:\n\t\tv = uint64(id)\n\tcase reflect.Uint:\n\t\tv = uint(id)\n\t}\n\treturn reflect.ValueOf(v).Convert(tp)\n}\n\nfunc int64ToInt(id int64, tp reflect.Type) interface{} {\n\treturn int64ToIntValue(id, tp).Interface()\n}\n\nfunc isPKZero(pk core.PK) bool {\n\tfor _, k := range pk {\n\t\tif isZero(k) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc equalNoCase(s1, s2 string) bool {\n\treturn strings.ToLower(s1) == strings.ToLower(s2)\n}\n\nfunc indexNoCase(s, sep string) int {\n\treturn strings.Index(strings.ToLower(s), strings.ToLower(sep))\n}\n\nfunc splitNoCase(s, sep string) []string {\n\tidx := indexNoCase(s, sep)\n\tif idx < 0 {\n\t\treturn []string{s}\n\t}\n\treturn strings.Split(s, s[idx:idx+len(sep)])\n}\n\nfunc splitNNoCase(s, sep string, n int) []string {\n\tidx := indexNoCase(s, sep)\n\tif idx < 0 {\n\t\treturn []string{s}\n\t}\n\treturn strings.SplitN(s, s[idx:idx+len(sep)], n)\n}\n\nfunc makeArray(elem string, count int) []string {\n\tres := make([]string, count)\n\tfor i := 0; i < count; i++ {\n\t\tres[i] = elem\n\t}\n\treturn res\n}\n\nfunc rValue(bean interface{}) reflect.Value {\n\treturn reflect.Indirect(reflect.ValueOf(bean))\n}\n\nfunc rType(bean interface{}) reflect.Type {\n\tsliceValue := reflect.Indirect(reflect.ValueOf(bean))\n\t//return reflect.TypeOf(sliceValue.Interface())\n\treturn sliceValue.Type()\n}\n\nfunc structName(v reflect.Type) string {\n\tfor v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\treturn v.Name()\n}\n\nfunc col2NewCols(columns ...string) []string {\n\tnewColumns := make([]string, 0, len(columns))\n\tfor _, col := range columns {\n\t\tcol = strings.Replace(col, \"`\", \"\", -1)\n\t\tcol = strings.Replace(col, `\"`, \"\", -1)\n\t\tccols := strings.Split(col, \",\")\n\t\tfor _, c := range ccols {\n\t\t\tnewColumns = append(newColumns, strings.TrimSpace(c))\n\t\t}\n\t}\n\treturn newColumns\n}\n\nfunc sliceEq(left, right []string) bool {\n\tif len(left) != len(right) {\n\t\treturn false\n\t}\n\tsort.Sort(sort.StringSlice(left))\n\tsort.Sort(sort.StringSlice(right))\n\tfor i := 0; i < len(left); i++ {\n\t\tif left[i] != right[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc reflect2value(rawValue *reflect.Value) (str string, err error) {\n\taa := reflect.TypeOf((*rawValue).Interface())\n\tvv := reflect.ValueOf((*rawValue).Interface())\n\tswitch aa.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tstr = strconv.FormatInt(vv.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tstr = strconv.FormatUint(vv.Uint(), 10)\n\tcase reflect.Float32, reflect.Float64:\n\t\tstr = strconv.FormatFloat(vv.Float(), 'f', -1, 64)\n\tcase reflect.String:\n\t\tstr = vv.String()\n\tcase reflect.Array, reflect.Slice:\n\t\tswitch aa.Elem().Kind() {\n\t\tcase reflect.Uint8:\n\t\t\tdata := rawValue.Interface().([]byte)\n\t\t\tstr = string(data)\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"Unsupported struct type %v\", vv.Type().Name())\n\t\t}\n\t// time type\n\tcase reflect.Struct:\n\t\tif aa.ConvertibleTo(core.TimeType) {\n\t\t\tstr = vv.Convert(core.TimeType).Interface().(time.Time).Format(time.RFC3339Nano)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"Unsupported struct type %v\", vv.Type().Name())\n\t\t}\n\tcase reflect.Bool:\n\t\tstr = strconv.FormatBool(vv.Bool())\n\tcase reflect.Complex128, reflect.Complex64:\n\t\tstr = fmt.Sprintf(\"%v\", vv.Complex())\n\t/* TODO: unsupported types below\n\t   case reflect.Map:\n\t   case reflect.Ptr:\n\t   case reflect.Uintptr:\n\t   case reflect.UnsafePointer:\n\t   case reflect.Chan, reflect.Func, reflect.Interface:\n\t*/\n\tdefault:\n\t\terr = fmt.Errorf(\"Unsupported struct type %v\", vv.Type().Name())\n\t}\n\treturn\n}\n\nfunc value2Bytes(rawValue *reflect.Value) (data []byte, err error) {\n\tvar str string\n\tstr, err = reflect2value(rawValue)\n\tif err != nil {\n\t\treturn\n\t}\n\tdata = []byte(str)\n\treturn\n}\n\nfunc value2String(rawValue *reflect.Value) (data string, err error) {\n\tdata, err = reflect2value(rawValue)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}\n\nfunc rows2Strings(rows *core.Rows) (resultsSlice []map[string]string, err error) {\n\tfields, err := rows.Columns()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tresult, err := row2mapStr(rows, fields)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresultsSlice = append(resultsSlice, result)\n\t}\n\n\treturn resultsSlice, nil\n}\n\nfunc rows2maps(rows *core.Rows) (resultsSlice []map[string][]byte, err error) {\n\tfields, err := rows.Columns()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tresult, err := row2map(rows, fields)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresultsSlice = append(resultsSlice, result)\n\t}\n\n\treturn resultsSlice, nil\n}\n\nfunc row2map(rows *core.Rows, fields []string) (resultsMap map[string][]byte, err error) {\n\tresult := make(map[string][]byte)\n\tscanResultContainers := make([]interface{}, len(fields))\n\tfor i := 0; i < len(fields); i++ {\n\t\tvar scanResultContainer interface{}\n\t\tscanResultContainers[i] = &scanResultContainer\n\t}\n\tif err := rows.Scan(scanResultContainers...); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor ii, key := range fields {\n\t\trawValue := reflect.Indirect(reflect.ValueOf(scanResultContainers[ii]))\n\t\t//if row is null then ignore\n\t\tif rawValue.Interface() == nil {\n\t\t\t//fmt.Println(\"ignore ...\", key, rawValue)\n\t\t\tcontinue\n\t\t}\n\n\t\tif data, err := value2Bytes(&rawValue); err == nil {\n\t\t\tresult[key] = data\n\t\t} else {\n\t\t\treturn nil, err // !nashtsai! REVIEW, should return err or just error log?\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc row2mapStr(rows *core.Rows, fields []string) (resultsMap map[string]string, err error) {\n\tresult := make(map[string]string)\n\tscanResultContainers := make([]interface{}, len(fields))\n\tfor i := 0; i < len(fields); i++ {\n\t\tvar scanResultContainer interface{}\n\t\tscanResultContainers[i] = &scanResultContainer\n\t}\n\tif err := rows.Scan(scanResultContainers...); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor ii, key := range fields {\n\t\trawValue := reflect.Indirect(reflect.ValueOf(scanResultContainers[ii]))\n\t\t//if row is null then ignore\n\t\tif rawValue.Interface() == nil {\n\t\t\t//fmt.Println(\"ignore ...\", key, rawValue)\n\t\t\tcontinue\n\t\t}\n\n\t\tif data, err := value2String(&rawValue); err == nil {\n\t\t\tresult[key] = data\n\t\t} else {\n\t\t\treturn nil, err // !nashtsai! REVIEW, should return err or just error log?\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc txQuery2(tx *core.Tx, sqlStr string, params ...interface{}) (resultsSlice []map[string]string, err error) {\n\trows, err := tx.Query(sqlStr, params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\treturn rows2Strings(rows)\n}\n\nfunc query2(db *core.DB, sqlStr string, params ...interface{}) (resultsSlice []map[string]string, err error) {\n\ts, err := db.Prepare(sqlStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.Close()\n\trows, err := s.Query(params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\treturn rows2Strings(rows)\n}\n\nfunc setColumnInt(bean interface{}, col *core.Column, t int64) {\n\tv, err := col.ValueOf(bean)\n\tif err != nil {\n\t\treturn\n\t}\n\tif v.CanSet() {\n\t\tswitch v.Type().Kind() {\n\t\tcase reflect.Int, reflect.Int64, reflect.Int32:\n\t\t\tv.SetInt(t)\n\t\tcase reflect.Uint, reflect.Uint64, reflect.Uint32:\n\t\t\tv.SetUint(uint64(t))\n\t\t}\n\t}\n}\n\nfunc setColumnTime(bean interface{}, col *core.Column, t time.Time) {\n\tv, err := col.ValueOf(bean)\n\tif err != nil {\n\t\treturn\n\t}\n\tif v.CanSet() {\n\t\tswitch v.Type().Kind() {\n\t\tcase reflect.Struct:\n\t\t\tv.Set(reflect.ValueOf(t).Convert(v.Type()))\n\t\tcase reflect.Int, reflect.Int64, reflect.Int32:\n\t\t\tv.SetInt(t.Unix())\n\t\tcase reflect.Uint, reflect.Uint64, reflect.Uint32:\n\t\t\tv.SetUint(uint64(t.Unix()))\n\t\t}\n\t}\n}\n\nfunc genCols(table *core.Table, session *Session, bean interface{}, useCol bool, includeQuote bool) ([]string, []interface{}, error) {\n\tcolNames := make([]string, 0, len(table.ColumnsSeq()))\n\targs := make([]interface{}, 0, len(table.ColumnsSeq()))\n\n\tfor _, col := range table.Columns() {\n\t\tlColName := strings.ToLower(col.Name)\n\t\tif useCol && !col.IsVersion && !col.IsCreated && !col.IsUpdated {\n\t\t\tif _, ok := session.Statement.columnMap[lColName]; !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif col.MapType == core.ONLYFROMDB {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldValuePtr, err := col.ValueOf(bean)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfieldValue := *fieldValuePtr\n\n\t\tif col.IsAutoIncrement {\n\t\t\tswitch fieldValue.Type().Kind() {\n\t\t\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int, reflect.Int64:\n\t\t\t\tif fieldValue.Int() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint, reflect.Uint64:\n\t\t\t\tif fieldValue.Uint() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tif len(fieldValue.String()) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif col.IsDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\tif session.Statement.ColumnStr != \"\" {\n\t\t\tif _, ok := session.Statement.columnMap[lColName]; !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif session.Statement.OmitStr != \"\" {\n\t\t\tif _, ok := session.Statement.columnMap[lColName]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// !evalphobia! set fieldValue as nil when column is nullable and zero-value\n\t\tif _, ok := session.Statement.nullableMap[lColName]; ok {\n\t\t\tif col.Nullable && isZero(fieldValue.Interface()) {\n\t\t\t\tvar nilValue *int\n\t\t\t\tfieldValue = reflect.ValueOf(nilValue)\n\t\t\t}\n\t\t}\n\n\t\tif (col.IsCreated || col.IsUpdated) && session.Statement.UseAutoTime {\n\t\t\tval, t := session.Engine.NowTime2(col.SQLType.Name)\n\t\t\targs = append(args, val)\n\n\t\t\tvar colName = col.Name\n\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\tsetColumnTime(bean, col, t)\n\t\t\t})\n\t\t} else if col.IsVersion && session.Statement.checkVersion {\n\t\t\targs = append(args, 1)\n\t\t} else {\n\t\t\targ, err := session.value2Interface(col, fieldValue)\n\t\t\tif err != nil {\n\t\t\t\treturn colNames, args, err\n\t\t\t}\n\t\t\targs = append(args, arg)\n\t\t}\n\n\t\tif includeQuote {\n\t\t\tcolNames = append(colNames, session.Engine.Quote(col.Name)+\" = ?\")\n\t\t} else {\n\t\t\tcolNames = append(colNames, col.Name)\n\t\t}\n\t}\n\treturn colNames, args, nil\n}\n\nfunc indexName(tableName, idxName string) string {\n\treturn fmt.Sprintf(\"IDX_%v_%v\", tableName, idxName)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/logger.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nconst (\n\tDEFAULT_LOG_PREFIX = \"[xorm]\"\n\tDEFAULT_LOG_FLAG   = log.Ldate | log.Lmicroseconds\n\tDEFAULT_LOG_LEVEL  = core.LOG_DEBUG\n)\n\nvar _ core.ILogger = DiscardLogger{}\n\ntype DiscardLogger struct{}\n\nfunc (DiscardLogger) Debug(v ...interface{})                 {}\nfunc (DiscardLogger) Debugf(format string, v ...interface{}) {}\nfunc (DiscardLogger) Error(v ...interface{})                 {}\nfunc (DiscardLogger) Errorf(format string, v ...interface{}) {}\nfunc (DiscardLogger) Info(v ...interface{})                  {}\nfunc (DiscardLogger) Infof(format string, v ...interface{})  {}\nfunc (DiscardLogger) Warn(v ...interface{})                  {}\nfunc (DiscardLogger) Warnf(format string, v ...interface{})  {}\nfunc (DiscardLogger) Level() core.LogLevel {\n\treturn core.LOG_UNKNOWN\n}\nfunc (DiscardLogger) SetLevel(l core.LogLevel) {}\nfunc (DiscardLogger) ShowSQL(show ...bool)     {}\nfunc (DiscardLogger) IsShowSQL() bool {\n\treturn false\n}\n\n// SimpleLogger is the default implment of core.ILogger\ntype SimpleLogger struct {\n\tDEBUG   *log.Logger\n\tERR     *log.Logger\n\tINFO    *log.Logger\n\tWARN    *log.Logger\n\tlevel   core.LogLevel\n\tshowSQL bool\n}\n\nvar _ core.ILogger = &SimpleLogger{}\n\n// NewSimpleLogger use a special io.Writer as logger output\nfunc NewSimpleLogger(out io.Writer) *SimpleLogger {\n\treturn NewSimpleLogger2(out, DEFAULT_LOG_PREFIX, DEFAULT_LOG_FLAG)\n}\n\n// NewSimpleLogger2 let you customrize your logger prefix and flag\nfunc NewSimpleLogger2(out io.Writer, prefix string, flag int) *SimpleLogger {\n\treturn NewSimpleLogger3(out, prefix, flag, DEFAULT_LOG_LEVEL)\n}\n\n// NewSimpleLogger3 let you customrize your logger prefix and flag and logLevel\nfunc NewSimpleLogger3(out io.Writer, prefix string, flag int, l core.LogLevel) *SimpleLogger {\n\treturn &SimpleLogger{\n\t\tDEBUG: log.New(out, fmt.Sprintf(\"%s [debug] \", prefix), flag),\n\t\tERR:   log.New(out, fmt.Sprintf(\"%s [error] \", prefix), flag),\n\t\tINFO:  log.New(out, fmt.Sprintf(\"%s [info]  \", prefix), flag),\n\t\tWARN:  log.New(out, fmt.Sprintf(\"%s [warn]  \", prefix), flag),\n\t\tlevel: l,\n\t}\n}\n\n// Error implement core.ILogger\nfunc (s *SimpleLogger) Error(v ...interface{}) {\n\tif s.level <= core.LOG_ERR {\n\t\ts.ERR.Output(2, fmt.Sprint(v...))\n\t}\n\treturn\n}\n\n// Errorf implement core.ILogger\nfunc (s *SimpleLogger) Errorf(format string, v ...interface{}) {\n\tif s.level <= core.LOG_ERR {\n\t\ts.ERR.Output(2, fmt.Sprintf(format, v...))\n\t}\n\treturn\n}\n\n// Debug implement core.ILogger\nfunc (s *SimpleLogger) Debug(v ...interface{}) {\n\tif s.level <= core.LOG_DEBUG {\n\t\ts.DEBUG.Output(2, fmt.Sprint(v...))\n\t}\n\treturn\n}\n\n// Debugf implement core.ILogger\nfunc (s *SimpleLogger) Debugf(format string, v ...interface{}) {\n\tif s.level <= core.LOG_DEBUG {\n\t\ts.DEBUG.Output(2, fmt.Sprintf(format, v...))\n\t}\n\treturn\n}\n\n// Info implement core.ILogger\nfunc (s *SimpleLogger) Info(v ...interface{}) {\n\tif s.level <= core.LOG_INFO {\n\t\ts.INFO.Output(2, fmt.Sprint(v...))\n\t}\n\treturn\n}\n\n// Infof implement core.ILogger\nfunc (s *SimpleLogger) Infof(format string, v ...interface{}) {\n\tif s.level <= core.LOG_INFO {\n\t\ts.INFO.Output(2, fmt.Sprintf(format, v...))\n\t}\n\treturn\n}\n\n// Warn implement core.ILogger\nfunc (s *SimpleLogger) Warn(v ...interface{}) {\n\tif s.level <= core.LOG_WARNING {\n\t\ts.WARN.Output(2, fmt.Sprint(v...))\n\t}\n\treturn\n}\n\n// Warnf implement core.ILogger\nfunc (s *SimpleLogger) Warnf(format string, v ...interface{}) {\n\tif s.level <= core.LOG_WARNING {\n\t\ts.WARN.Output(2, fmt.Sprintf(format, v...))\n\t}\n\treturn\n}\n\n// Level implement core.ILogger\nfunc (s *SimpleLogger) Level() core.LogLevel {\n\treturn s.level\n}\n\n// SetLevel implement core.ILogger\nfunc (s *SimpleLogger) SetLevel(l core.LogLevel) {\n\ts.level = l\n\treturn\n}\n\n// ShowSQL implement core.ILogger\nfunc (s *SimpleLogger) ShowSQL(show ...bool) {\n\tif len(show) == 0 {\n\t\ts.showSQL = true\n\t\treturn\n\t}\n\ts.showSQL = show[0]\n}\n\n// IsShowSQL implement core.ILogger\nfunc (s *SimpleLogger) IsShowSQL() bool {\n\treturn s.showSQL\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/lru_cacher.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"container/list\"\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype LRUCacher struct {\n\tidList   *list.List\n\tsqlList  *list.List\n\tidIndex  map[string]map[string]*list.Element\n\tsqlIndex map[string]map[string]*list.Element\n\tstore    core.CacheStore\n\tmutex    sync.Mutex\n\t// maxSize    int\n\tMaxElementSize int\n\tExpired        time.Duration\n\tGcInterval     time.Duration\n}\n\nfunc NewLRUCacher(store core.CacheStore, maxElementSize int) *LRUCacher {\n\treturn NewLRUCacher2(store, 3600*time.Second, maxElementSize)\n}\n\nfunc NewLRUCacher2(store core.CacheStore, expired time.Duration, maxElementSize int) *LRUCacher {\n\tcacher := &LRUCacher{store: store, idList: list.New(),\n\t\tsqlList: list.New(), Expired: expired,\n\t\tGcInterval: core.CacheGcInterval, MaxElementSize: maxElementSize,\n\t\tsqlIndex: make(map[string]map[string]*list.Element),\n\t\tidIndex:  make(map[string]map[string]*list.Element),\n\t}\n\tcacher.RunGC()\n\treturn cacher\n}\n\n//func NewLRUCacher3(store CacheStore, expired time.Duration, maxSize int) *LRUCacher {\n//    return newLRUCacher(store, expired, maxSize, 0)\n//}\n\n// RunGC run once every m.GcInterval\nfunc (m *LRUCacher) RunGC() {\n\ttime.AfterFunc(m.GcInterval, func() {\n\t\tm.RunGC()\n\t\tm.GC()\n\t})\n}\n\n// GC check ids lit and sql list to remove all element expired\nfunc (m *LRUCacher) GC() {\n\t//fmt.Println(\"begin gc ...\")\n\t//defer fmt.Println(\"end gc ...\")\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar removedNum int\n\tfor e := m.idList.Front(); e != nil; {\n\t\tif removedNum <= core.CacheGcMaxRemoved &&\n\t\t\ttime.Now().Sub(e.Value.(*idNode).lastVisit) > m.Expired {\n\t\t\tremovedNum++\n\t\t\tnext := e.Next()\n\t\t\t//fmt.Println(\"removing ...\", e.Value)\n\t\t\tnode := e.Value.(*idNode)\n\t\t\tm.delBean(node.tbName, node.id)\n\t\t\te = next\n\t\t} else {\n\t\t\t//fmt.Printf(\"removing %d cache nodes ..., left %d\\n\", removedNum, m.idList.Len())\n\t\t\tbreak\n\t\t}\n\t}\n\n\tremovedNum = 0\n\tfor e := m.sqlList.Front(); e != nil; {\n\t\tif removedNum <= core.CacheGcMaxRemoved &&\n\t\t\ttime.Now().Sub(e.Value.(*sqlNode).lastVisit) > m.Expired {\n\t\t\tremovedNum++\n\t\t\tnext := e.Next()\n\t\t\t//fmt.Println(\"removing ...\", e.Value)\n\t\t\tnode := e.Value.(*sqlNode)\n\t\t\tm.delIds(node.tbName, node.sql)\n\t\t\te = next\n\t\t} else {\n\t\t\t//fmt.Printf(\"removing %d cache nodes ..., left %d\\n\", removedNum, m.sqlList.Len())\n\t\t\tbreak\n\t\t}\n\t}\n}\n\n// Get all bean's ids according to sql and parameter from cache\nfunc (m *LRUCacher) GetIds(tableName, sql string) interface{} {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif _, ok := m.sqlIndex[tableName]; !ok {\n\t\tm.sqlIndex[tableName] = make(map[string]*list.Element)\n\t}\n\tif v, err := m.store.Get(sql); err == nil {\n\t\tif el, ok := m.sqlIndex[tableName][sql]; !ok {\n\t\t\tel = m.sqlList.PushBack(newSqlNode(tableName, sql))\n\t\t\tm.sqlIndex[tableName][sql] = el\n\t\t} else {\n\t\t\tlastTime := el.Value.(*sqlNode).lastVisit\n\t\t\t// if expired, remove the node and return nil\n\t\t\tif time.Now().Sub(lastTime) > m.Expired {\n\t\t\t\tm.delIds(tableName, sql)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tm.sqlList.MoveToBack(el)\n\t\t\tel.Value.(*sqlNode).lastVisit = time.Now()\n\t\t}\n\t\treturn v\n\t} else {\n\t\tm.delIds(tableName, sql)\n\t}\n\n\treturn nil\n}\n\n// Get bean according tableName and id from cache\nfunc (m *LRUCacher) GetBean(tableName string, id string) interface{} {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif _, ok := m.idIndex[tableName]; !ok {\n\t\tm.idIndex[tableName] = make(map[string]*list.Element)\n\t}\n\ttid := genId(tableName, id)\n\tif v, err := m.store.Get(tid); err == nil {\n\t\tif el, ok := m.idIndex[tableName][id]; ok {\n\t\t\tlastTime := el.Value.(*idNode).lastVisit\n\t\t\t// if expired, remove the node and return nil\n\t\t\tif time.Now().Sub(lastTime) > m.Expired {\n\t\t\t\tm.delBean(tableName, id)\n\t\t\t\t//m.clearIds(tableName)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tm.idList.MoveToBack(el)\n\t\t\tel.Value.(*idNode).lastVisit = time.Now()\n\t\t} else {\n\t\t\tel = m.idList.PushBack(newIdNode(tableName, id))\n\t\t\tm.idIndex[tableName][id] = el\n\t\t}\n\t\treturn v\n\t} else {\n\t\t// store bean is not exist, then remove memory's index\n\t\tm.delBean(tableName, id)\n\t\t//m.clearIds(tableName)\n\t\treturn nil\n\t}\n}\n\n// Clear all sql-ids mapping on table tableName from cache\nfunc (m *LRUCacher) clearIds(tableName string) {\n\tif tis, ok := m.sqlIndex[tableName]; ok {\n\t\tfor sql, v := range tis {\n\t\t\tm.sqlList.Remove(v)\n\t\t\tm.store.Del(sql)\n\t\t}\n\t}\n\tm.sqlIndex[tableName] = make(map[string]*list.Element)\n}\n\nfunc (m *LRUCacher) ClearIds(tableName string) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.clearIds(tableName)\n}\n\nfunc (m *LRUCacher) clearBeans(tableName string) {\n\tif tis, ok := m.idIndex[tableName]; ok {\n\t\tfor id, v := range tis {\n\t\t\tm.idList.Remove(v)\n\t\t\ttid := genId(tableName, id)\n\t\t\tm.store.Del(tid)\n\t\t}\n\t}\n\tm.idIndex[tableName] = make(map[string]*list.Element)\n}\n\nfunc (m *LRUCacher) ClearBeans(tableName string) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.clearBeans(tableName)\n}\n\nfunc (m *LRUCacher) PutIds(tableName, sql string, ids interface{}) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif _, ok := m.sqlIndex[tableName]; !ok {\n\t\tm.sqlIndex[tableName] = make(map[string]*list.Element)\n\t}\n\tif el, ok := m.sqlIndex[tableName][sql]; !ok {\n\t\tel = m.sqlList.PushBack(newSqlNode(tableName, sql))\n\t\tm.sqlIndex[tableName][sql] = el\n\t} else {\n\t\tel.Value.(*sqlNode).lastVisit = time.Now()\n\t}\n\tm.store.Put(sql, ids)\n\tif m.sqlList.Len() > m.MaxElementSize {\n\t\te := m.sqlList.Front()\n\t\tnode := e.Value.(*sqlNode)\n\t\tm.delIds(node.tbName, node.sql)\n\t}\n}\n\nfunc (m *LRUCacher) PutBean(tableName string, id string, obj interface{}) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar el *list.Element\n\tvar ok bool\n\n\tif el, ok = m.idIndex[tableName][id]; !ok {\n\t\tel = m.idList.PushBack(newIdNode(tableName, id))\n\t\tm.idIndex[tableName][id] = el\n\t} else {\n\t\tel.Value.(*idNode).lastVisit = time.Now()\n\t}\n\n\tm.store.Put(genId(tableName, id), obj)\n\tif m.idList.Len() > m.MaxElementSize {\n\t\te := m.idList.Front()\n\t\tnode := e.Value.(*idNode)\n\t\tm.delBean(node.tbName, node.id)\n\t}\n}\n\nfunc (m *LRUCacher) delIds(tableName, sql string) {\n\tif _, ok := m.sqlIndex[tableName]; ok {\n\t\tif el, ok := m.sqlIndex[tableName][sql]; ok {\n\t\t\tdelete(m.sqlIndex[tableName], sql)\n\t\t\tm.sqlList.Remove(el)\n\t\t}\n\t}\n\tm.store.Del(sql)\n}\n\nfunc (m *LRUCacher) DelIds(tableName, sql string) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.delIds(tableName, sql)\n}\n\nfunc (m *LRUCacher) delBean(tableName string, id string) {\n\ttid := genId(tableName, id)\n\tif el, ok := m.idIndex[tableName][id]; ok {\n\t\tdelete(m.idIndex[tableName], id)\n\t\tm.idList.Remove(el)\n\t\tm.clearIds(tableName)\n\t}\n\tm.store.Del(tid)\n}\n\nfunc (m *LRUCacher) DelBean(tableName string, id string) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.delBean(tableName, id)\n}\n\ntype idNode struct {\n\ttbName    string\n\tid        string\n\tlastVisit time.Time\n}\n\ntype sqlNode struct {\n\ttbName    string\n\tsql       string\n\tlastVisit time.Time\n}\n\nfunc genSqlKey(sql string, args interface{}) string {\n\treturn fmt.Sprintf(\"%v-%v\", sql, args)\n}\n\nfunc genId(prefix string, id string) string {\n\treturn fmt.Sprintf(\"%v-%v\", prefix, id)\n}\n\nfunc newIdNode(tbName string, id string) *idNode {\n\treturn &idNode{tbName, id, time.Now()}\n}\n\nfunc newSqlNode(tbName, sql string) *sqlNode {\n\treturn &sqlNode{tbName, sql, time.Now()}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/memory_store.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"sync\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar _ core.CacheStore = NewMemoryStore()\n\n// memory store\ntype MemoryStore struct {\n\tstore map[interface{}]interface{}\n\tmutex sync.RWMutex\n}\n\nfunc NewMemoryStore() *MemoryStore {\n\treturn &MemoryStore{store: make(map[interface{}]interface{})}\n}\n\nfunc (s *MemoryStore) Put(key string, value interface{}) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\ts.store[key] = value\n\treturn nil\n}\n\nfunc (s *MemoryStore) Get(key string) (interface{}, error) {\n\ts.mutex.RLock()\n\tdefer s.mutex.RUnlock()\n\tif v, ok := s.store[key]; ok {\n\t\treturn v, nil\n\t}\n\n\treturn nil, ErrNotExist\n}\n\nfunc (s *MemoryStore) Del(key string) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tdelete(s.store, key)\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/mssql_dialect.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar (\n\tmssqlReservedWords = map[string]bool{\n\t\t\"ADD\":                    true,\n\t\t\"EXTERNAL\":               true,\n\t\t\"PROCEDURE\":              true,\n\t\t\"ALL\":                    true,\n\t\t\"FETCH\":                  true,\n\t\t\"PUBLIC\":                 true,\n\t\t\"ALTER\":                  true,\n\t\t\"FILE\":                   true,\n\t\t\"RAISERROR\":              true,\n\t\t\"AND\":                    true,\n\t\t\"FILLFACTOR\":             true,\n\t\t\"READ\":                   true,\n\t\t\"ANY\":                    true,\n\t\t\"FOR\":                    true,\n\t\t\"READTEXT\":               true,\n\t\t\"AS\":                     true,\n\t\t\"FOREIGN\":                true,\n\t\t\"RECONFIGURE\":            true,\n\t\t\"ASC\":                    true,\n\t\t\"FREETEXT\":               true,\n\t\t\"REFERENCES\":             true,\n\t\t\"AUTHORIZATION\":          true,\n\t\t\"FREETEXTTABLE\":          true,\n\t\t\"REPLICATION\":            true,\n\t\t\"BACKUP\":                 true,\n\t\t\"FROM\":                   true,\n\t\t\"RESTORE\":                true,\n\t\t\"BEGIN\":                  true,\n\t\t\"FULL\":                   true,\n\t\t\"RESTRICT\":               true,\n\t\t\"BETWEEN\":                true,\n\t\t\"FUNCTION\":               true,\n\t\t\"RETURN\":                 true,\n\t\t\"BREAK\":                  true,\n\t\t\"GOTO\":                   true,\n\t\t\"REVERT\":                 true,\n\t\t\"BROWSE\":                 true,\n\t\t\"GRANT\":                  true,\n\t\t\"REVOKE\":                 true,\n\t\t\"BULK\":                   true,\n\t\t\"GROUP\":                  true,\n\t\t\"RIGHT\":                  true,\n\t\t\"BY\":                     true,\n\t\t\"HAVING\":                 true,\n\t\t\"ROLLBACK\":               true,\n\t\t\"CASCADE\":                true,\n\t\t\"HOLDLOCK\":               true,\n\t\t\"ROWCOUNT\":               true,\n\t\t\"CASE\":                   true,\n\t\t\"IDENTITY\":               true,\n\t\t\"ROWGUIDCOL\":             true,\n\t\t\"CHECK\":                  true,\n\t\t\"IDENTITY_INSERT\":        true,\n\t\t\"RULE\":                   true,\n\t\t\"CHECKPOINT\":             true,\n\t\t\"IDENTITYCOL\":            true,\n\t\t\"SAVE\":                   true,\n\t\t\"CLOSE\":                  true,\n\t\t\"IF\":                     true,\n\t\t\"SCHEMA\":                 true,\n\t\t\"CLUSTERED\":              true,\n\t\t\"IN\":                     true,\n\t\t\"SECURITYAUDIT\":          true,\n\t\t\"COALESCE\":               true,\n\t\t\"INDEX\":                  true,\n\t\t\"SELECT\":                 true,\n\t\t\"COLLATE\":                true,\n\t\t\"INNER\":                  true,\n\t\t\"SEMANTICKEYPHRASETABLE\": true,\n\t\t\"COLUMN\":                 true,\n\t\t\"INSERT\":                 true,\n\t\t\"SEMANTICSIMILARITYDETAILSTABLE\": true,\n\t\t\"COMMIT\":                  true,\n\t\t\"INTERSECT\":               true,\n\t\t\"SEMANTICSIMILARITYTABLE\": true,\n\t\t\"COMPUTE\":                 true,\n\t\t\"INTO\":                    true,\n\t\t\"SESSION_USER\":            true,\n\t\t\"CONSTRAINT\":              true,\n\t\t\"IS\":                      true,\n\t\t\"SET\":                     true,\n\t\t\"CONTAINS\":                true,\n\t\t\"JOIN\":                    true,\n\t\t\"SETUSER\":                 true,\n\t\t\"CONTAINSTABLE\":           true,\n\t\t\"KEY\":                     true,\n\t\t\"SHUTDOWN\":                true,\n\t\t\"CONTINUE\":                true,\n\t\t\"KILL\":                    true,\n\t\t\"SOME\":                    true,\n\t\t\"CONVERT\":                 true,\n\t\t\"LEFT\":                    true,\n\t\t\"STATISTICS\":              true,\n\t\t\"CREATE\":                  true,\n\t\t\"LIKE\":                    true,\n\t\t\"SYSTEM_USER\":             true,\n\t\t\"CROSS\":                   true,\n\t\t\"LINENO\":                  true,\n\t\t\"TABLE\":                   true,\n\t\t\"CURRENT\":                 true,\n\t\t\"LOAD\":                    true,\n\t\t\"TABLESAMPLE\":             true,\n\t\t\"CURRENT_DATE\":            true,\n\t\t\"MERGE\":                   true,\n\t\t\"TEXTSIZE\":                true,\n\t\t\"CURRENT_TIME\":            true,\n\t\t\"NATIONAL\":                true,\n\t\t\"THEN\":                    true,\n\t\t\"CURRENT_TIMESTAMP\":       true,\n\t\t\"NOCHECK\":                 true,\n\t\t\"TO\":                      true,\n\t\t\"CURRENT_USER\":            true,\n\t\t\"NONCLUSTERED\":            true,\n\t\t\"TOP\":                     true,\n\t\t\"CURSOR\":                  true,\n\t\t\"NOT\":                     true,\n\t\t\"TRAN\":                    true,\n\t\t\"DATABASE\":                true,\n\t\t\"NULL\":                    true,\n\t\t\"TRANSACTION\":             true,\n\t\t\"DBCC\":                    true,\n\t\t\"NULLIF\":                  true,\n\t\t\"TRIGGER\":                 true,\n\t\t\"DEALLOCATE\":              true,\n\t\t\"OF\":                      true,\n\t\t\"TRUNCATE\":                true,\n\t\t\"DECLARE\":                 true,\n\t\t\"OFF\":                     true,\n\t\t\"TRY_CONVERT\":             true,\n\t\t\"DEFAULT\":                 true,\n\t\t\"OFFSETS\":                 true,\n\t\t\"TSEQUAL\":                 true,\n\t\t\"DELETE\":                  true,\n\t\t\"ON\":                      true,\n\t\t\"UNION\":                   true,\n\t\t\"DENY\":                    true,\n\t\t\"OPEN\":                    true,\n\t\t\"UNIQUE\":                  true,\n\t\t\"DESC\":                    true,\n\t\t\"OPENDATASOURCE\":          true,\n\t\t\"UNPIVOT\":                 true,\n\t\t\"DISK\":                    true,\n\t\t\"OPENQUERY\":               true,\n\t\t\"UPDATE\":                  true,\n\t\t\"DISTINCT\":                true,\n\t\t\"OPENROWSET\":              true,\n\t\t\"UPDATETEXT\":              true,\n\t\t\"DISTRIBUTED\":             true,\n\t\t\"OPENXML\":                 true,\n\t\t\"USE\":                     true,\n\t\t\"DOUBLE\":                  true,\n\t\t\"OPTION\":                  true,\n\t\t\"USER\":                    true,\n\t\t\"DROP\":                    true,\n\t\t\"OR\":                      true,\n\t\t\"VALUES\":                  true,\n\t\t\"DUMP\":                    true,\n\t\t\"ORDER\":                   true,\n\t\t\"VARYING\":                 true,\n\t\t\"ELSE\":                    true,\n\t\t\"OUTER\":                   true,\n\t\t\"VIEW\":                    true,\n\t\t\"END\":                     true,\n\t\t\"OVER\":                    true,\n\t\t\"WAITFOR\":                 true,\n\t\t\"ERRLVL\":                  true,\n\t\t\"PERCENT\":                 true,\n\t\t\"WHEN\":                    true,\n\t\t\"ESCAPE\":                  true,\n\t\t\"PIVOT\":                   true,\n\t\t\"WHERE\":                   true,\n\t\t\"EXCEPT\":                  true,\n\t\t\"PLAN\":                    true,\n\t\t\"WHILE\":                   true,\n\t\t\"EXEC\":                    true,\n\t\t\"PRECISION\":               true,\n\t\t\"WITH\":                    true,\n\t\t\"EXECUTE\":                 true,\n\t\t\"PRIMARY\":                 true,\n\t\t\"WITHIN\":                  true,\n\t\t\"EXISTS\":                  true,\n\t\t\"PRINT\":                   true,\n\t\t\"WRITETEXT\":               true,\n\t\t\"EXIT\":                    true,\n\t\t\"PROC\":                    true,\n\t}\n)\n\ntype mssql struct {\n\tcore.Base\n}\n\nfunc (db *mssql) Init(d *core.DB, uri *core.Uri, drivername, dataSourceName string) error {\n\treturn db.Base.Init(d, db, uri, drivername, dataSourceName)\n}\n\nfunc (db *mssql) SqlType(c *core.Column) string {\n\tvar res string\n\tswitch t := c.SQLType.Name; t {\n\tcase core.Bool:\n\t\tres = core.TinyInt\n\t\tif c.Default == \"true\" {\n\t\t\tc.Default = \"1\"\n\t\t} else if c.Default == \"false\" {\n\t\t\tc.Default = \"0\"\n\t\t}\n\tcase core.Serial:\n\t\tc.IsAutoIncrement = true\n\t\tc.IsPrimaryKey = true\n\t\tc.Nullable = false\n\t\tres = core.Int\n\tcase core.BigSerial:\n\t\tc.IsAutoIncrement = true\n\t\tc.IsPrimaryKey = true\n\t\tc.Nullable = false\n\t\tres = core.BigInt\n\tcase core.Bytea, core.Blob, core.Binary, core.TinyBlob, core.MediumBlob, core.LongBlob:\n\t\tres = core.VarBinary\n\t\tif c.Length == 0 {\n\t\t\tc.Length = 50\n\t\t}\n\tcase core.TimeStamp:\n\t\tres = core.DateTime\n\tcase core.TimeStampz:\n\t\tres = \"DATETIMEOFFSET\"\n\t\tc.Length = 7\n\tcase core.MediumInt:\n\t\tres = core.Int\n\tcase core.MediumText, core.TinyText, core.LongText, core.Json:\n\t\tres = core.Text\n\tcase core.Double:\n\t\tres = core.Real\n\tdefault:\n\t\tres = t\n\t}\n\n\tif res == core.Int {\n\t\treturn core.Int\n\t}\n\n\tvar hasLen1 bool = (c.Length > 0)\n\tvar hasLen2 bool = (c.Length2 > 0)\n\tif hasLen2 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \",\" + strconv.Itoa(c.Length2) + \")\"\n\t} else if hasLen1 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \")\"\n\t}\n\treturn res\n}\n\nfunc (db *mssql) SupportInsertMany() bool {\n\treturn true\n}\n\nfunc (db *mssql) IsReserved(name string) bool {\n\t_, ok := mssqlReservedWords[name]\n\treturn ok\n}\n\nfunc (db *mssql) Quote(name string) string {\n\treturn \"\\\"\" + name + \"\\\"\"\n}\n\nfunc (db *mssql) QuoteStr() string {\n\treturn \"\\\"\"\n}\n\nfunc (db *mssql) SupportEngine() bool {\n\treturn false\n}\n\nfunc (db *mssql) AutoIncrStr() string {\n\treturn \"IDENTITY\"\n}\n\nfunc (db *mssql) DropTableSql(tableName string) string {\n\treturn fmt.Sprintf(\"IF EXISTS (SELECT * FROM sysobjects WHERE id = \"+\n\t\t\"object_id(N'%s') and OBJECTPROPERTY(id, N'IsUserTable') = 1) \"+\n\t\t\"DROP TABLE \\\"%s\\\"\", tableName, tableName)\n}\n\nfunc (db *mssql) SupportCharset() bool {\n\treturn false\n}\n\nfunc (db *mssql) IndexOnTable() bool {\n\treturn true\n}\n\nfunc (db *mssql) IndexCheckSql(tableName, idxName string) (string, []interface{}) {\n\targs := []interface{}{idxName}\n\tsql := \"select name from sysindexes where id=object_id('\" + tableName + \"') and name=?\"\n\treturn sql, args\n}\n\n/*func (db *mssql) ColumnCheckSql(tableName, colName string) (string, []interface{}) {\n\targs := []interface{}{tableName, colName}\n\tsql := `SELECT \"COLUMN_NAME\" FROM \"INFORMATION_SCHEMA\".\"COLUMNS\" WHERE \"TABLE_NAME\" = ? AND \"COLUMN_NAME\" = ?`\n\treturn sql, args\n}*/\n\nfunc (db *mssql) IsColumnExist(tableName, colName string) (bool, error) {\n\tquery := `SELECT \"COLUMN_NAME\" FROM \"INFORMATION_SCHEMA\".\"COLUMNS\" WHERE \"TABLE_NAME\" = ? AND \"COLUMN_NAME\" = ?`\n\n\treturn db.HasRecords(query, tableName, colName)\n}\n\nfunc (db *mssql) TableCheckSql(tableName string) (string, []interface{}) {\n\targs := []interface{}{}\n\tsql := \"select * from sysobjects where id = object_id(N'\" + tableName + \"') and OBJECTPROPERTY(id, N'IsUserTable') = 1\"\n\treturn sql, args\n}\n\nfunc (db *mssql) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {\n\targs := []interface{}{}\n\ts := `select a.name as name, b.name as ctype,a.max_length,a.precision,a.scale\nfrom sys.columns a left join sys.types b on a.user_type_id=b.user_type_id\nwhere a.object_id=object_id('` + tableName + `')`\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer rows.Close()\n\n\tcols := make(map[string]*core.Column)\n\tcolSeq := make([]string, 0)\n\tfor rows.Next() {\n\t\tvar name, ctype, precision, scale string\n\t\tvar maxLen int\n\t\terr = rows.Scan(&name, &ctype, &maxLen, &precision, &scale)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tcol := new(core.Column)\n\t\tcol.Indexes = make(map[string]int)\n\t\tcol.Length = maxLen\n\t\tcol.Name = strings.Trim(name, \"` \")\n\n\t\tct := strings.ToUpper(ctype)\n\t\tswitch ct {\n\t\tcase \"DATETIMEOFFSET\":\n\t\t\tcol.SQLType = core.SQLType{core.TimeStampz, 0, 0}\n\t\tcase \"NVARCHAR\":\n\t\t\tcol.SQLType = core.SQLType{core.NVarchar, 0, 0}\n\t\tcase \"IMAGE\":\n\t\t\tcol.SQLType = core.SQLType{core.VarBinary, 0, 0}\n\t\tdefault:\n\t\t\tif _, ok := core.SqlTypes[ct]; ok {\n\t\t\t\tcol.SQLType = core.SQLType{ct, 0, 0}\n\t\t\t} else {\n\t\t\t\treturn nil, nil, errors.New(fmt.Sprintf(\"unknow colType %v for %v - %v\",\n\t\t\t\t\tct, tableName, col.Name))\n\t\t\t}\n\t\t}\n\n\t\tif col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\tif col.Default != \"\" {\n\t\t\t\tcol.Default = \"'\" + col.Default + \"'\"\n\t\t\t} else {\n\t\t\t\tif col.DefaultIsEmpty {\n\t\t\t\t\tcol.Default = \"''\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcols[col.Name] = col\n\t\tcolSeq = append(colSeq, col.Name)\n\t}\n\treturn colSeq, cols, nil\n}\n\nfunc (db *mssql) GetTables() ([]*core.Table, error) {\n\targs := []interface{}{}\n\ts := `select name from sysobjects where xtype ='U'`\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttables := make([]*core.Table, 0)\n\tfor rows.Next() {\n\t\ttable := core.NewEmptyTable()\n\t\tvar name string\n\t\terr = rows.Scan(&name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttable.Name = strings.Trim(name, \"` \")\n\t\ttables = append(tables, table)\n\t}\n\treturn tables, nil\n}\n\nfunc (db *mssql) GetIndexes(tableName string) (map[string]*core.Index, error) {\n\targs := []interface{}{tableName}\n\ts := `SELECT\nIXS.NAME                    AS  [INDEX_NAME],\nC.NAME                      AS  [COLUMN_NAME],\nIXS.is_unique AS [IS_UNIQUE]\nFROM SYS.INDEXES IXS\nINNER JOIN SYS.INDEX_COLUMNS   IXCS\nON IXS.OBJECT_ID=IXCS.OBJECT_ID  AND IXS.INDEX_ID = IXCS.INDEX_ID\nINNER   JOIN SYS.COLUMNS C  ON IXS.OBJECT_ID=C.OBJECT_ID\nAND IXCS.COLUMN_ID=C.COLUMN_ID\nWHERE IXS.TYPE_DESC='NONCLUSTERED' and OBJECT_NAME(IXS.OBJECT_ID) =?\n`\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tindexes := make(map[string]*core.Index, 0)\n\tfor rows.Next() {\n\t\tvar indexType int\n\t\tvar indexName, colName, isUnique string\n\n\t\terr = rows.Scan(&indexName, &colName, &isUnique)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ti, err := strconv.ParseBool(isUnique)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif i {\n\t\t\tindexType = core.UniqueType\n\t\t} else {\n\t\t\tindexType = core.IndexType\n\t\t}\n\n\t\tcolName = strings.Trim(colName, \"` \")\n\n\t\tif strings.HasPrefix(indexName, \"IDX_\"+tableName) || strings.HasPrefix(indexName, \"UQE_\"+tableName) {\n\t\t\tindexName = indexName[5+len(tableName) : len(indexName)]\n\t\t}\n\n\t\tvar index *core.Index\n\t\tvar ok bool\n\t\tif index, ok = indexes[indexName]; !ok {\n\t\t\tindex = new(core.Index)\n\t\t\tindex.Type = indexType\n\t\t\tindex.Name = indexName\n\t\t\tindexes[indexName] = index\n\t\t}\n\t\tindex.AddColumn(colName)\n\t}\n\treturn indexes, nil\n}\n\nfunc (db *mssql) CreateTableSql(table *core.Table, tableName, storeEngine, charset string) string {\n\tvar sql string\n\tif tableName == \"\" {\n\t\ttableName = table.Name\n\t}\n\n\tsql = \"IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = '\" + tableName + \"' ) CREATE TABLE \"\n\n\tsql += db.QuoteStr() + tableName + db.QuoteStr() + \" (\"\n\n\tpkList := table.PrimaryKeys\n\n\tfor _, colName := range table.ColumnsSeq() {\n\t\tcol := table.GetColumn(colName)\n\t\tif col.IsPrimaryKey && len(pkList) == 1 {\n\t\t\tsql += col.String(db)\n\t\t} else {\n\t\t\tsql += col.StringNoPk(db)\n\t\t}\n\t\tsql = strings.TrimSpace(sql)\n\t\tsql += \", \"\n\t}\n\n\tif len(pkList) > 1 {\n\t\tsql += \"PRIMARY KEY ( \"\n\t\tsql += strings.Join(pkList, \",\")\n\t\tsql += \" ), \"\n\t}\n\n\tsql = sql[:len(sql)-2] + \")\"\n\tsql += \";\"\n\treturn sql\n}\n\nfunc (db *mssql) ForUpdateSql(query string) string {\n\treturn query\n}\n\nfunc (db *mssql) Filters() []core.Filter {\n\treturn []core.Filter{&core.IdFilter{}, &core.QuoteFilter{}}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/mymysql_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype mymysqlDriver struct {\n}\n\nfunc (p *mymysqlDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tdb := &core.Uri{DbType: core.MYSQL}\n\n\tpd := strings.SplitN(dataSourceName, \"*\", 2)\n\tif len(pd) == 2 {\n\t\t// Parse protocol part of URI\n\t\tp := strings.SplitN(pd[0], \":\", 2)\n\t\tif len(p) != 2 {\n\t\t\treturn nil, errors.New(\"Wrong protocol part of URI\")\n\t\t}\n\t\tdb.Proto = p[0]\n\t\toptions := strings.Split(p[1], \",\")\n\t\tdb.Raddr = options[0]\n\t\tfor _, o := range options[1:] {\n\t\t\tkv := strings.SplitN(o, \"=\", 2)\n\t\t\tvar k, v string\n\t\t\tif len(kv) == 2 {\n\t\t\t\tk, v = kv[0], kv[1]\n\t\t\t} else {\n\t\t\t\tk, v = o, \"true\"\n\t\t\t}\n\t\t\tswitch k {\n\t\t\tcase \"laddr\":\n\t\t\t\tdb.Laddr = v\n\t\t\tcase \"timeout\":\n\t\t\t\tto, err := time.ParseDuration(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tdb.Timeout = to\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"Unknown option: \" + k)\n\t\t\t}\n\t\t}\n\t\t// Remove protocol part\n\t\tpd = pd[1:]\n\t}\n\t// Parse database part of URI\n\tdup := strings.SplitN(pd[0], \"/\", 3)\n\tif len(dup) != 3 {\n\t\treturn nil, errors.New(\"Wrong database part of URI\")\n\t}\n\tdb.DbName = dup[0]\n\tdb.User = dup[1]\n\tdb.Passwd = dup[2]\n\n\treturn db, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/mysql_dialect.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"crypto/tls\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar (\n\tmysqlReservedWords = map[string]bool{\n\t\t\"ADD\":               true,\n\t\t\"ALL\":               true,\n\t\t\"ALTER\":             true,\n\t\t\"ANALYZE\":           true,\n\t\t\"AND\":               true,\n\t\t\"AS\":                true,\n\t\t\"ASC\":               true,\n\t\t\"ASENSITIVE\":        true,\n\t\t\"BEFORE\":            true,\n\t\t\"BETWEEN\":           true,\n\t\t\"BIGINT\":            true,\n\t\t\"BINARY\":            true,\n\t\t\"BLOB\":              true,\n\t\t\"BOTH\":              true,\n\t\t\"BY\":                true,\n\t\t\"CALL\":              true,\n\t\t\"CASCADE\":           true,\n\t\t\"CASE\":              true,\n\t\t\"CHANGE\":            true,\n\t\t\"CHAR\":              true,\n\t\t\"CHARACTER\":         true,\n\t\t\"CHECK\":             true,\n\t\t\"COLLATE\":           true,\n\t\t\"COLUMN\":            true,\n\t\t\"CONDITION\":         true,\n\t\t\"CONNECTION\":        true,\n\t\t\"CONSTRAINT\":        true,\n\t\t\"CONTINUE\":          true,\n\t\t\"CONVERT\":           true,\n\t\t\"CREATE\":            true,\n\t\t\"CROSS\":             true,\n\t\t\"CURRENT_DATE\":      true,\n\t\t\"CURRENT_TIME\":      true,\n\t\t\"CURRENT_TIMESTAMP\": true,\n\t\t\"CURRENT_USER\":      true,\n\t\t\"CURSOR\":            true,\n\t\t\"DATABASE\":          true,\n\t\t\"DATABASES\":         true,\n\t\t\"DAY_HOUR\":          true,\n\t\t\"DAY_MICROSECOND\":   true,\n\t\t\"DAY_MINUTE\":        true,\n\t\t\"DAY_SECOND\":        true,\n\t\t\"DEC\":               true,\n\t\t\"DECIMAL\":           true,\n\t\t\"DECLARE\":           true,\n\t\t\"DEFAULT\":           true,\n\t\t\"DELAYED\":           true,\n\t\t\"DELETE\":            true,\n\t\t\"DESC\":              true,\n\t\t\"DESCRIBE\":          true,\n\t\t\"DETERMINISTIC\":     true,\n\t\t\"DISTINCT\":          true,\n\t\t\"DISTINCTROW\":       true,\n\t\t\"DIV\":               true,\n\t\t\"DOUBLE\":            true,\n\t\t\"DROP\":              true,\n\t\t\"DUAL\":              true,\n\t\t\"EACH\":              true,\n\t\t\"ELSE\":              true,\n\t\t\"ELSEIF\":            true,\n\t\t\"ENCLOSED\":          true,\n\t\t\"ESCAPED\":           true,\n\t\t\"EXISTS\":            true,\n\t\t\"EXIT\":              true,\n\t\t\"EXPLAIN\":           true,\n\t\t\"FALSE\":             true,\n\t\t\"FETCH\":             true,\n\t\t\"FLOAT\":             true,\n\t\t\"FLOAT4\":            true,\n\t\t\"FLOAT8\":            true,\n\t\t\"FOR\":               true,\n\t\t\"FORCE\":             true,\n\t\t\"FOREIGN\":           true,\n\t\t\"FROM\":              true,\n\t\t\"FULLTEXT\":          true,\n\t\t\"GOTO\":              true,\n\t\t\"GRANT\":             true,\n\t\t\"GROUP\":             true,\n\t\t\"HAVING\":            true,\n\t\t\"HIGH_PRIORITY\":     true,\n\t\t\"HOUR_MICROSECOND\":  true,\n\t\t\"HOUR_MINUTE\":       true,\n\t\t\"HOUR_SECOND\":       true,\n\t\t\"IF\":                true,\n\t\t\"IGNORE\":            true,\n\t\t\"IN\":                true, \"INDEX\": true,\n\t\t\"INFILE\": true, \"INNER\": true, \"INOUT\": true,\n\t\t\"INSENSITIVE\": true, \"INSERT\": true, \"INT\": true,\n\t\t\"INT1\": true, \"INT2\": true, \"INT3\": true,\n\t\t\"INT4\": true, \"INT8\": true, \"INTEGER\": true,\n\t\t\"INTERVAL\": true, \"INTO\": true, \"IS\": true,\n\t\t\"ITERATE\": true, \"JOIN\": true, \"KEY\": true,\n\t\t\"KEYS\": true, \"KILL\": true, \"LABEL\": true,\n\t\t\"LEADING\": true, \"LEAVE\": true, \"LEFT\": true,\n\t\t\"LIKE\": true, \"LIMIT\": true, \"LINEAR\": true,\n\t\t\"LINES\": true, \"LOAD\": true, \"LOCALTIME\": true,\n\t\t\"LOCALTIMESTAMP\": true, \"LOCK\": true, \"LONG\": true,\n\t\t\"LONGBLOB\": true, \"LONGTEXT\": true, \"LOOP\": true,\n\t\t\"LOW_PRIORITY\": true, \"MATCH\": true, \"MEDIUMBLOB\": true,\n\t\t\"MEDIUMINT\": true, \"MEDIUMTEXT\": true, \"MIDDLEINT\": true,\n\t\t\"MINUTE_MICROSECOND\": true, \"MINUTE_SECOND\": true, \"MOD\": true,\n\t\t\"MODIFIES\": true, \"NATURAL\": true, \"NOT\": true,\n\t\t\"NO_WRITE_TO_BINLOG\": true, \"NULL\": true, \"NUMERIC\": true,\n\t\t\"ON\tOPTIMIZE\": true, \"OPTION\": true,\n\t\t\"OPTIONALLY\": true, \"OR\": true, \"ORDER\": true,\n\t\t\"OUT\": true, \"OUTER\": true, \"OUTFILE\": true,\n\t\t\"PRECISION\": true, \"PRIMARY\": true, \"PROCEDURE\": true,\n\t\t\"PURGE\": true, \"RAID0\": true, \"RANGE\": true,\n\t\t\"READ\": true, \"READS\": true, \"REAL\": true,\n\t\t\"REFERENCES\": true, \"REGEXP\": true, \"RELEASE\": true,\n\t\t\"RENAME\": true, \"REPEAT\": true, \"REPLACE\": true,\n\t\t\"REQUIRE\": true, \"RESTRICT\": true, \"RETURN\": true,\n\t\t\"REVOKE\": true, \"RIGHT\": true, \"RLIKE\": true,\n\t\t\"SCHEMA\": true, \"SCHEMAS\": true, \"SECOND_MICROSECOND\": true,\n\t\t\"SELECT\": true, \"SENSITIVE\": true, \"SEPARATOR\": true,\n\t\t\"SET\": true, \"SHOW\": true, \"SMALLINT\": true,\n\t\t\"SPATIAL\": true, \"SPECIFIC\": true, \"SQL\": true,\n\t\t\"SQLEXCEPTION\": true, \"SQLSTATE\": true, \"SQLWARNING\": true,\n\t\t\"SQL_BIG_RESULT\": true, \"SQL_CALC_FOUND_ROWS\": true, \"SQL_SMALL_RESULT\": true,\n\t\t\"SSL\": true, \"STARTING\": true, \"STRAIGHT_JOIN\": true,\n\t\t\"TABLE\": true, \"TERMINATED\": true, \"THEN\": true,\n\t\t\"TINYBLOB\": true, \"TINYINT\": true, \"TINYTEXT\": true,\n\t\t\"TO\": true, \"TRAILING\": true, \"TRIGGER\": true,\n\t\t\"TRUE\": true, \"UNDO\": true, \"UNION\": true,\n\t\t\"UNIQUE\": true, \"UNLOCK\": true, \"UNSIGNED\": true,\n\t\t\"UPDATE\": true, \"USAGE\": true, \"USE\": true,\n\t\t\"USING\": true, \"UTC_DATE\": true, \"UTC_TIME\": true,\n\t\t\"UTC_TIMESTAMP\": true, \"VALUES\": true, \"VARBINARY\": true,\n\t\t\"VARCHAR\":      true,\n\t\t\"VARCHARACTER\": true,\n\t\t\"VARYING\":      true,\n\t\t\"WHEN\":         true,\n\t\t\"WHERE\":        true,\n\t\t\"WHILE\":        true,\n\t\t\"WITH\":         true,\n\t\t\"WRITE\":        true,\n\t\t\"X509\":         true,\n\t\t\"XOR\":          true,\n\t\t\"YEAR_MONTH\":   true,\n\t\t\"ZEROFILL\":     true,\n\t}\n)\n\ntype mysql struct {\n\tcore.Base\n\tnet               string\n\taddr              string\n\tparams            map[string]string\n\tloc               *time.Location\n\ttimeout           time.Duration\n\ttls               *tls.Config\n\tallowAllFiles     bool\n\tallowOldPasswords bool\n\tclientFoundRows   bool\n}\n\nfunc (db *mysql) Init(d *core.DB, uri *core.Uri, drivername, dataSourceName string) error {\n\treturn db.Base.Init(d, db, uri, drivername, dataSourceName)\n}\n\nfunc (db *mysql) SqlType(c *core.Column) string {\n\tvar res string\n\tswitch t := c.SQLType.Name; t {\n\tcase core.Bool:\n\t\tres = core.TinyInt\n\t\tc.Length = 1\n\tcase core.Serial:\n\t\tc.IsAutoIncrement = true\n\t\tc.IsPrimaryKey = true\n\t\tc.Nullable = false\n\t\tres = core.Int\n\tcase core.BigSerial:\n\t\tc.IsAutoIncrement = true\n\t\tc.IsPrimaryKey = true\n\t\tc.Nullable = false\n\t\tres = core.BigInt\n\tcase core.Bytea:\n\t\tres = core.Blob\n\tcase core.TimeStampz:\n\t\tres = core.Char\n\t\tc.Length = 64\n\tcase core.Enum: //mysql enum\n\t\tres = core.Enum\n\t\tres += \"(\"\n\t\topts := \"\"\n\t\tfor v, _ := range c.EnumOptions {\n\t\t\topts += fmt.Sprintf(\",'%v'\", v)\n\t\t}\n\t\tres += strings.TrimLeft(opts, \",\")\n\t\tres += \")\"\n\tcase core.Set: //mysql set\n\t\tres = core.Set\n\t\tres += \"(\"\n\t\topts := \"\"\n\t\tfor v, _ := range c.SetOptions {\n\t\t\topts += fmt.Sprintf(\",'%v'\", v)\n\t\t}\n\t\tres += strings.TrimLeft(opts, \",\")\n\t\tres += \")\"\n\tcase core.NVarchar:\n\t\tres = core.Varchar\n\tcase core.Uuid:\n\t\tres = core.Varchar\n\t\tc.Length = 40\n\tcase core.Json:\n\t\tres = core.Text\n\tdefault:\n\t\tres = t\n\t}\n\n\tvar hasLen1 bool = (c.Length > 0)\n\tvar hasLen2 bool = (c.Length2 > 0)\n\n\tif res == core.BigInt && !hasLen1 && !hasLen2 {\n\t\tc.Length = 20\n\t\thasLen1 = true\n\t}\n\n\tif hasLen2 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \",\" + strconv.Itoa(c.Length2) + \")\"\n\t} else if hasLen1 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \")\"\n\t}\n\treturn res\n}\n\nfunc (db *mysql) SupportInsertMany() bool {\n\treturn true\n}\n\nfunc (db *mysql) IsReserved(name string) bool {\n\t_, ok := mysqlReservedWords[name]\n\treturn ok\n}\n\nfunc (db *mysql) Quote(name string) string {\n\treturn \"`\" + name + \"`\"\n}\n\nfunc (db *mysql) QuoteStr() string {\n\treturn \"`\"\n}\n\nfunc (db *mysql) SupportEngine() bool {\n\treturn true\n}\n\nfunc (db *mysql) AutoIncrStr() string {\n\treturn \"AUTO_INCREMENT\"\n}\n\nfunc (db *mysql) SupportCharset() bool {\n\treturn true\n}\n\nfunc (db *mysql) IndexOnTable() bool {\n\treturn true\n}\n\nfunc (db *mysql) IndexCheckSql(tableName, idxName string) (string, []interface{}) {\n\targs := []interface{}{db.DbName, tableName, idxName}\n\tsql := \"SELECT `INDEX_NAME` FROM `INFORMATION_SCHEMA`.`STATISTICS`\"\n\tsql += \" WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `INDEX_NAME`=?\"\n\treturn sql, args\n}\n\n/*func (db *mysql) ColumnCheckSql(tableName, colName string) (string, []interface{}) {\n\targs := []interface{}{db.DbName, tableName, colName}\n\tsql := \"SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ?\"\n\treturn sql, args\n}*/\n\nfunc (db *mysql) TableCheckSql(tableName string) (string, []interface{}) {\n\targs := []interface{}{db.DbName, tableName}\n\tsql := \"SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=?\"\n\treturn sql, args\n}\n\nfunc (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {\n\targs := []interface{}{db.DbName, tableName}\n\ts := \"SELECT `COLUMN_NAME`, `IS_NULLABLE`, `COLUMN_DEFAULT`, `COLUMN_TYPE`,\" +\n\t\t\" `COLUMN_KEY`, `EXTRA` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer rows.Close()\n\n\tcols := make(map[string]*core.Column)\n\tcolSeq := make([]string, 0)\n\tfor rows.Next() {\n\t\tcol := new(core.Column)\n\t\tcol.Indexes = make(map[string]int)\n\n\t\tvar columnName, isNullable, colType, colKey, extra string\n\t\tvar colDefault *string\n\t\terr = rows.Scan(&columnName, &isNullable, &colDefault, &colType, &colKey, &extra)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tcol.Name = strings.Trim(columnName, \"` \")\n\t\tif \"YES\" == isNullable {\n\t\t\tcol.Nullable = true\n\t\t}\n\n\t\tif colDefault != nil {\n\t\t\tcol.Default = *colDefault\n\t\t\tif col.Default == \"\" {\n\t\t\t\tcol.DefaultIsEmpty = true\n\t\t\t}\n\t\t}\n\n\t\tcts := strings.Split(colType, \"(\")\n\t\tcolName := cts[0]\n\t\tcolType = strings.ToUpper(colName)\n\t\tvar len1, len2 int\n\t\tif len(cts) == 2 {\n\t\t\tidx := strings.Index(cts[1], \")\")\n\t\t\tif colType == core.Enum && cts[1][0] == '\\'' { //enum\n\t\t\t\toptions := strings.Split(cts[1][0:idx], \",\")\n\t\t\t\tcol.EnumOptions = make(map[string]int)\n\t\t\t\tfor k, v := range options {\n\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\tv = strings.Trim(v, \"'\")\n\t\t\t\t\tcol.EnumOptions[v] = k\n\t\t\t\t}\n\t\t\t} else if colType == core.Set && cts[1][0] == '\\'' {\n\t\t\t\toptions := strings.Split(cts[1][0:idx], \",\")\n\t\t\t\tcol.SetOptions = make(map[string]int)\n\t\t\t\tfor k, v := range options {\n\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\tv = strings.Trim(v, \"'\")\n\t\t\t\t\tcol.SetOptions[v] = k\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlens := strings.Split(cts[1][0:idx], \",\")\n\t\t\t\tlen1, err = strconv.Atoi(strings.TrimSpace(lens[0]))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, err\n\t\t\t\t}\n\t\t\t\tif len(lens) == 2 {\n\t\t\t\t\tlen2, err = strconv.Atoi(lens[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, nil, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif colType == \"FLOAT UNSIGNED\" {\n\t\t\tcolType = \"FLOAT\"\n\t\t}\n\t\tcol.Length = len1\n\t\tcol.Length2 = len2\n\t\tif _, ok := core.SqlTypes[colType]; ok {\n\t\t\tcol.SQLType = core.SQLType{colType, len1, len2}\n\t\t} else {\n\t\t\treturn nil, nil, errors.New(fmt.Sprintf(\"unkonw colType %v\", colType))\n\t\t}\n\n\t\tif colKey == \"PRI\" {\n\t\t\tcol.IsPrimaryKey = true\n\t\t}\n\t\tif colKey == \"UNI\" {\n\t\t\t//col.is\n\t\t}\n\n\t\tif extra == \"auto_increment\" {\n\t\t\tcol.IsAutoIncrement = true\n\t\t}\n\n\t\tif col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\tif col.Default != \"\" {\n\t\t\t\tcol.Default = \"'\" + col.Default + \"'\"\n\t\t\t} else {\n\t\t\t\tif col.DefaultIsEmpty {\n\t\t\t\t\tcol.Default = \"''\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcols[col.Name] = col\n\t\tcolSeq = append(colSeq, col.Name)\n\t}\n\treturn colSeq, cols, nil\n}\n\nfunc (db *mysql) GetTables() ([]*core.Table, error) {\n\targs := []interface{}{db.DbName}\n\ts := \"SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT` from \" +\n\t\t\"`INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB')\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttables := make([]*core.Table, 0)\n\tfor rows.Next() {\n\t\ttable := core.NewEmptyTable()\n\t\tvar name, engine, tableRows string\n\t\tvar autoIncr *string\n\t\terr = rows.Scan(&name, &engine, &tableRows, &autoIncr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttable.Name = name\n\t\ttable.StoreEngine = engine\n\t\ttables = append(tables, table)\n\t}\n\treturn tables, nil\n}\n\nfunc (db *mysql) GetIndexes(tableName string) (map[string]*core.Index, error) {\n\targs := []interface{}{db.DbName, tableName}\n\ts := \"SELECT `INDEX_NAME`, `NON_UNIQUE`, `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`STATISTICS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tindexes := make(map[string]*core.Index, 0)\n\tfor rows.Next() {\n\t\tvar indexType int\n\t\tvar indexName, colName, nonUnique string\n\t\terr = rows.Scan(&indexName, &nonUnique, &colName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif indexName == \"PRIMARY\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif \"YES\" == nonUnique || nonUnique == \"1\" {\n\t\t\tindexType = core.IndexType\n\t\t} else {\n\t\t\tindexType = core.UniqueType\n\t\t}\n\n\t\tcolName = strings.Trim(colName, \"` \")\n\t\tvar isRegular bool\n\t\tif strings.HasPrefix(indexName, \"IDX_\"+tableName) || strings.HasPrefix(indexName, \"UQE_\"+tableName) {\n\t\t\tindexName = indexName[5+len(tableName) : len(indexName)]\n\t\t\tisRegular = true\n\t\t}\n\n\t\tvar index *core.Index\n\t\tvar ok bool\n\t\tif index, ok = indexes[indexName]; !ok {\n\t\t\tindex = new(core.Index)\n\t\t\tindex.IsRegular = isRegular\n\t\t\tindex.Type = indexType\n\t\t\tindex.Name = indexName\n\t\t\tindexes[indexName] = index\n\t\t}\n\t\tindex.AddColumn(colName)\n\t}\n\treturn indexes, nil\n}\n\nfunc (db *mysql) Filters() []core.Filter {\n\treturn []core.Filter{&core.IdFilter{}}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/mysql_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"regexp\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype mysqlDriver struct {\n}\n\nfunc (p *mysqlDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tdsnPattern := regexp.MustCompile(\n\t\t`^(?:(?P<user>.*?)(?::(?P<passwd>.*))?@)?` + // [user[:password]@]\n\t\t\t`(?:(?P<net>[^\\(]*)(?:\\((?P<addr>[^\\)]*)\\))?)?` + // [net[(addr)]]\n\t\t\t`\\/(?P<dbname>.*?)` + // /dbname\n\t\t\t`(?:\\?(?P<params>[^\\?]*))?$`) // [?param1=value1&paramN=valueN]\n\tmatches := dsnPattern.FindStringSubmatch(dataSourceName)\n\t//tlsConfigRegister := make(map[string]*tls.Config)\n\tnames := dsnPattern.SubexpNames()\n\n\turi := &core.Uri{DbType: core.MYSQL}\n\n\tfor i, match := range matches {\n\t\tswitch names[i] {\n\t\tcase \"dbname\":\n\t\t\turi.DbName = match\n\t\tcase \"params\":\n\t\t\tif len(match) > 0 {\n\t\t\t\tkvs := strings.Split(match, \"&\")\n\t\t\t\tfor _, kv := range kvs {\n\t\t\t\t\tsplits := strings.Split(kv, \"=\")\n\t\t\t\t\tif len(splits) == 2 {\n\t\t\t\t\t\tswitch splits[0] {\n\t\t\t\t\t\tcase \"charset\":\n\t\t\t\t\t\t\turi.Charset = splits[1]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\treturn uri, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/oci8_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"regexp\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype oci8Driver struct {\n}\n\n//dataSourceName=user/password@ipv4:port/dbname\n//dataSourceName=user/password@[ipv6]:port/dbname\nfunc (p *oci8Driver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tdb := &core.Uri{DbType: core.ORACLE}\n\tdsnPattern := regexp.MustCompile(\n\t\t`^(?P<user>.*)\\/(?P<password>.*)@` + // user:password@\n\t\t\t`(?P<net>.*)` + // ip:port\n\t\t\t`\\/(?P<dbname>.*)`) // dbname\n\tmatches := dsnPattern.FindStringSubmatch(dataSourceName)\n\tnames := dsnPattern.SubexpNames()\n\tfor i, match := range matches {\n\t\tswitch names[i] {\n\t\tcase \"dbname\":\n\t\t\tdb.DbName = match\n\t\t}\n\t}\n\tif db.DbName == \"\" {\n\t\treturn nil, errors.New(\"dbname is empty\")\n\t}\n\treturn db, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/odbc_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype odbcDriver struct {\n}\n\nfunc (p *odbcDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tkv := strings.Split(dataSourceName, \";\")\n\tvar dbName string\n\n\tfor _, c := range kv {\n\t\tvv := strings.Split(strings.TrimSpace(c), \"=\")\n\t\tif len(vv) == 2 {\n\t\t\tswitch strings.ToLower(vv[0]) {\n\t\t\tcase \"database\":\n\t\t\t\tdbName = vv[1]\n\t\t\t}\n\t\t}\n\t}\n\tif dbName == \"\" {\n\t\treturn nil, errors.New(\"no db name provided\")\n\t}\n\treturn &core.Uri{DbName: dbName, DbType: core.MSSQL}, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/oracle_dialect.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar (\n\toracleReservedWords = map[string]bool{\n\t\t\"ACCESS\":                    true,\n\t\t\"ACCOUNT\":                   true,\n\t\t\"ACTIVATE\":                  true,\n\t\t\"ADD\":                       true,\n\t\t\"ADMIN\":                     true,\n\t\t\"ADVISE\":                    true,\n\t\t\"AFTER\":                     true,\n\t\t\"ALL\":                       true,\n\t\t\"ALL_ROWS\":                  true,\n\t\t\"ALLOCATE\":                  true,\n\t\t\"ALTER\":                     true,\n\t\t\"ANALYZE\":                   true,\n\t\t\"AND\":                       true,\n\t\t\"ANY\":                       true,\n\t\t\"ARCHIVE\":                   true,\n\t\t\"ARCHIVELOG\":                true,\n\t\t\"ARRAY\":                     true,\n\t\t\"AS\":                        true,\n\t\t\"ASC\":                       true,\n\t\t\"AT\":                        true,\n\t\t\"AUDIT\":                     true,\n\t\t\"AUTHENTICATED\":             true,\n\t\t\"AUTHORIZATION\":             true,\n\t\t\"AUTOEXTEND\":                true,\n\t\t\"AUTOMATIC\":                 true,\n\t\t\"BACKUP\":                    true,\n\t\t\"BECOME\":                    true,\n\t\t\"BEFORE\":                    true,\n\t\t\"BEGIN\":                     true,\n\t\t\"BETWEEN\":                   true,\n\t\t\"BFILE\":                     true,\n\t\t\"BITMAP\":                    true,\n\t\t\"BLOB\":                      true,\n\t\t\"BLOCK\":                     true,\n\t\t\"BODY\":                      true,\n\t\t\"BY\":                        true,\n\t\t\"CACHE\":                     true,\n\t\t\"CACHE_INSTANCES\":           true,\n\t\t\"CANCEL\":                    true,\n\t\t\"CASCADE\":                   true,\n\t\t\"CAST\":                      true,\n\t\t\"CFILE\":                     true,\n\t\t\"CHAINED\":                   true,\n\t\t\"CHANGE\":                    true,\n\t\t\"CHAR\":                      true,\n\t\t\"CHAR_CS\":                   true,\n\t\t\"CHARACTER\":                 true,\n\t\t\"CHECK\":                     true,\n\t\t\"CHECKPOINT\":                true,\n\t\t\"CHOOSE\":                    true,\n\t\t\"CHUNK\":                     true,\n\t\t\"CLEAR\":                     true,\n\t\t\"CLOB\":                      true,\n\t\t\"CLONE\":                     true,\n\t\t\"CLOSE\":                     true,\n\t\t\"CLOSE_CACHED_OPEN_CURSORS\": true,\n\t\t\"CLUSTER\":                   true,\n\t\t\"COALESCE\":                  true,\n\t\t\"COLUMN\":                    true,\n\t\t\"COLUMNS\":                   true,\n\t\t\"COMMENT\":                   true,\n\t\t\"COMMIT\":                    true,\n\t\t\"COMMITTED\":                 true,\n\t\t\"COMPATIBILITY\":             true,\n\t\t\"COMPILE\":                   true,\n\t\t\"COMPLETE\":                  true,\n\t\t\"COMPOSITE_LIMIT\":           true,\n\t\t\"COMPRESS\":                  true,\n\t\t\"COMPUTE\":                   true,\n\t\t\"CONNECT\":                   true,\n\t\t\"CONNECT_TIME\":              true,\n\t\t\"CONSTRAINT\":                true,\n\t\t\"CONSTRAINTS\":               true,\n\t\t\"CONTENTS\":                  true,\n\t\t\"CONTINUE\":                  true,\n\t\t\"CONTROLFILE\":               true,\n\t\t\"CONVERT\":                   true,\n\t\t\"COST\":                      true,\n\t\t\"CPU_PER_CALL\":              true,\n\t\t\"CPU_PER_SESSION\":           true,\n\t\t\"CREATE\":                    true,\n\t\t\"CURRENT\":                   true,\n\t\t\"CURRENT_SCHEMA\":            true,\n\t\t\"CURREN_USER\":               true,\n\t\t\"CURSOR\":                    true,\n\t\t\"CYCLE\":                     true,\n\t\t\"DANGLING\":                  true,\n\t\t\"DATABASE\":                  true,\n\t\t\"DATAFILE\":                  true,\n\t\t\"DATAFILES\":                 true,\n\t\t\"DATAOBJNO\":                 true,\n\t\t\"DATE\":                      true,\n\t\t\"DBA\":                       true,\n\t\t\"DBHIGH\":                    true,\n\t\t\"DBLOW\":                     true,\n\t\t\"DBMAC\":                     true,\n\t\t\"DEALLOCATE\":                true,\n\t\t\"DEBUG\":                     true,\n\t\t\"DEC\":                       true,\n\t\t\"DECIMAL\":                   true,\n\t\t\"DECLARE\":                   true,\n\t\t\"DEFAULT\":                   true,\n\t\t\"DEFERRABLE\":                true,\n\t\t\"DEFERRED\":                  true,\n\t\t\"DEGREE\":                    true,\n\t\t\"DELETE\":                    true,\n\t\t\"DEREF\":                     true,\n\t\t\"DESC\":                      true,\n\t\t\"DIRECTORY\":                 true,\n\t\t\"DISABLE\":                   true,\n\t\t\"DISCONNECT\":                true,\n\t\t\"DISMOUNT\":                  true,\n\t\t\"DISTINCT\":                  true,\n\t\t\"DISTRIBUTED\":               true,\n\t\t\"DML\":                       true,\n\t\t\"DOUBLE\":                    true,\n\t\t\"DROP\":                      true,\n\t\t\"DUMP\":                      true,\n\t\t\"EACH\":                      true,\n\t\t\"ELSE\":                      true,\n\t\t\"ENABLE\":                    true,\n\t\t\"END\":                       true,\n\t\t\"ENFORCE\":                   true,\n\t\t\"ENTRY\":                     true,\n\t\t\"ESCAPE\":                    true,\n\t\t\"EXCEPT\":                    true,\n\t\t\"EXCEPTIONS\":                true,\n\t\t\"EXCHANGE\":                  true,\n\t\t\"EXCLUDING\":                 true,\n\t\t\"EXCLUSIVE\":                 true,\n\t\t\"EXECUTE\":                   true,\n\t\t\"EXISTS\":                    true,\n\t\t\"EXPIRE\":                    true,\n\t\t\"EXPLAIN\":                   true,\n\t\t\"EXTENT\":                    true,\n\t\t\"EXTENTS\":                   true,\n\t\t\"EXTERNALLY\":                true,\n\t\t\"FAILED_LOGIN_ATTEMPTS\":     true,\n\t\t\"FALSE\":                     true,\n\t\t\"FAST\":                      true,\n\t\t\"FILE\":                      true,\n\t\t\"FIRST_ROWS\":                true,\n\t\t\"FLAGGER\":                   true,\n\t\t\"FLOAT\":                     true,\n\t\t\"FLOB\":                      true,\n\t\t\"FLUSH\":                     true,\n\t\t\"FOR\":                       true,\n\t\t\"FORCE\":                     true,\n\t\t\"FOREIGN\":                   true,\n\t\t\"FREELIST\":                  true,\n\t\t\"FREELISTS\":                 true,\n\t\t\"FROM\":                      true,\n\t\t\"FULL\":                      true,\n\t\t\"FUNCTION\":                  true,\n\t\t\"GLOBAL\":                    true,\n\t\t\"GLOBALLY\":                  true,\n\t\t\"GLOBAL_NAME\":               true,\n\t\t\"GRANT\":                     true,\n\t\t\"GROUP\":                     true,\n\t\t\"GROUPS\":                    true,\n\t\t\"HASH\":                      true,\n\t\t\"HASHKEYS\":                  true,\n\t\t\"HAVING\":                    true,\n\t\t\"HEADER\":                    true,\n\t\t\"HEAP\":                      true,\n\t\t\"IDENTIFIED\":                true,\n\t\t\"IDGENERATORS\":              true,\n\t\t\"IDLE_TIME\":                 true,\n\t\t\"IF\":                        true,\n\t\t\"IMMEDIATE\":                 true,\n\t\t\"IN\":                        true,\n\t\t\"INCLUDING\":                 true,\n\t\t\"INCREMENT\":                 true,\n\t\t\"INDEX\":                     true,\n\t\t\"INDEXED\":                   true,\n\t\t\"INDEXES\":                   true,\n\t\t\"INDICATOR\":                 true,\n\t\t\"IND_PARTITION\":             true,\n\t\t\"INITIAL\":                   true,\n\t\t\"INITIALLY\":                 true,\n\t\t\"INITRANS\":                  true,\n\t\t\"INSERT\":                    true,\n\t\t\"INSTANCE\":                  true,\n\t\t\"INSTANCES\":                 true,\n\t\t\"INSTEAD\":                   true,\n\t\t\"INT\":                       true,\n\t\t\"INTEGER\":                   true,\n\t\t\"INTERMEDIATE\":              true,\n\t\t\"INTERSECT\":                 true,\n\t\t\"INTO\":                      true,\n\t\t\"IS\":                        true,\n\t\t\"ISOLATION\":                 true,\n\t\t\"ISOLATION_LEVEL\":           true,\n\t\t\"KEEP\":                      true,\n\t\t\"KEY\":                       true,\n\t\t\"KILL\":                      true,\n\t\t\"LABEL\":                     true,\n\t\t\"LAYER\":                     true,\n\t\t\"LESS\":                      true,\n\t\t\"LEVEL\":                     true,\n\t\t\"LIBRARY\":                   true,\n\t\t\"LIKE\":                      true,\n\t\t\"LIMIT\":                     true,\n\t\t\"LINK\":                      true,\n\t\t\"LIST\":                      true,\n\t\t\"LOB\":                       true,\n\t\t\"LOCAL\":                     true,\n\t\t\"LOCK\":                      true,\n\t\t\"LOCKED\":                    true,\n\t\t\"LOG\":                       true,\n\t\t\"LOGFILE\":                   true,\n\t\t\"LOGGING\":                   true,\n\t\t\"LOGICAL_READS_PER_CALL\":    true,\n\t\t\"LOGICAL_READS_PER_SESSION\": true,\n\t\t\"LONG\":                     true,\n\t\t\"MANAGE\":                   true,\n\t\t\"MASTER\":                   true,\n\t\t\"MAX\":                      true,\n\t\t\"MAXARCHLOGS\":              true,\n\t\t\"MAXDATAFILES\":             true,\n\t\t\"MAXEXTENTS\":               true,\n\t\t\"MAXINSTANCES\":             true,\n\t\t\"MAXLOGFILES\":              true,\n\t\t\"MAXLOGHISTORY\":            true,\n\t\t\"MAXLOGMEMBERS\":            true,\n\t\t\"MAXSIZE\":                  true,\n\t\t\"MAXTRANS\":                 true,\n\t\t\"MAXVALUE\":                 true,\n\t\t\"MIN\":                      true,\n\t\t\"MEMBER\":                   true,\n\t\t\"MINIMUM\":                  true,\n\t\t\"MINEXTENTS\":               true,\n\t\t\"MINUS\":                    true,\n\t\t\"MINVALUE\":                 true,\n\t\t\"MLSLABEL\":                 true,\n\t\t\"MLS_LABEL_FORMAT\":         true,\n\t\t\"MODE\":                     true,\n\t\t\"MODIFY\":                   true,\n\t\t\"MOUNT\":                    true,\n\t\t\"MOVE\":                     true,\n\t\t\"MTS_DISPATCHERS\":          true,\n\t\t\"MULTISET\":                 true,\n\t\t\"NATIONAL\":                 true,\n\t\t\"NCHAR\":                    true,\n\t\t\"NCHAR_CS\":                 true,\n\t\t\"NCLOB\":                    true,\n\t\t\"NEEDED\":                   true,\n\t\t\"NESTED\":                   true,\n\t\t\"NETWORK\":                  true,\n\t\t\"NEW\":                      true,\n\t\t\"NEXT\":                     true,\n\t\t\"NOARCHIVELOG\":             true,\n\t\t\"NOAUDIT\":                  true,\n\t\t\"NOCACHE\":                  true,\n\t\t\"NOCOMPRESS\":               true,\n\t\t\"NOCYCLE\":                  true,\n\t\t\"NOFORCE\":                  true,\n\t\t\"NOLOGGING\":                true,\n\t\t\"NOMAXVALUE\":               true,\n\t\t\"NOMINVALUE\":               true,\n\t\t\"NONE\":                     true,\n\t\t\"NOORDER\":                  true,\n\t\t\"NOOVERRIDE\":               true,\n\t\t\"NOPARALLEL\":               true,\n\t\t\"NOREVERSE\":                true,\n\t\t\"NORMAL\":                   true,\n\t\t\"NOSORT\":                   true,\n\t\t\"NOT\":                      true,\n\t\t\"NOTHING\":                  true,\n\t\t\"NOWAIT\":                   true,\n\t\t\"NULL\":                     true,\n\t\t\"NUMBER\":                   true,\n\t\t\"NUMERIC\":                  true,\n\t\t\"NVARCHAR2\":                true,\n\t\t\"OBJECT\":                   true,\n\t\t\"OBJNO\":                    true,\n\t\t\"OBJNO_REUSE\":              true,\n\t\t\"OF\":                       true,\n\t\t\"OFF\":                      true,\n\t\t\"OFFLINE\":                  true,\n\t\t\"OID\":                      true,\n\t\t\"OIDINDEX\":                 true,\n\t\t\"OLD\":                      true,\n\t\t\"ON\":                       true,\n\t\t\"ONLINE\":                   true,\n\t\t\"ONLY\":                     true,\n\t\t\"OPCODE\":                   true,\n\t\t\"OPEN\":                     true,\n\t\t\"OPTIMAL\":                  true,\n\t\t\"OPTIMIZER_GOAL\":           true,\n\t\t\"OPTION\":                   true,\n\t\t\"OR\":                       true,\n\t\t\"ORDER\":                    true,\n\t\t\"ORGANIZATION\":             true,\n\t\t\"OSLABEL\":                  true,\n\t\t\"OVERFLOW\":                 true,\n\t\t\"OWN\":                      true,\n\t\t\"PACKAGE\":                  true,\n\t\t\"PARALLEL\":                 true,\n\t\t\"PARTITION\":                true,\n\t\t\"PASSWORD\":                 true,\n\t\t\"PASSWORD_GRACE_TIME\":      true,\n\t\t\"PASSWORD_LIFE_TIME\":       true,\n\t\t\"PASSWORD_LOCK_TIME\":       true,\n\t\t\"PASSWORD_REUSE_MAX\":       true,\n\t\t\"PASSWORD_REUSE_TIME\":      true,\n\t\t\"PASSWORD_VERIFY_FUNCTION\": true,\n\t\t\"PCTFREE\":                  true,\n\t\t\"PCTINCREASE\":              true,\n\t\t\"PCTTHRESHOLD\":             true,\n\t\t\"PCTUSED\":                  true,\n\t\t\"PCTVERSION\":               true,\n\t\t\"PERCENT\":                  true,\n\t\t\"PERMANENT\":                true,\n\t\t\"PLAN\":                     true,\n\t\t\"PLSQL_DEBUG\":              true,\n\t\t\"POST_TRANSACTION\":         true,\n\t\t\"PRECISION\":                true,\n\t\t\"PRESERVE\":                 true,\n\t\t\"PRIMARY\":                  true,\n\t\t\"PRIOR\":                    true,\n\t\t\"PRIVATE\":                  true,\n\t\t\"PRIVATE_SGA\":              true,\n\t\t\"PRIVILEGE\":                true,\n\t\t\"PRIVILEGES\":               true,\n\t\t\"PROCEDURE\":                true,\n\t\t\"PROFILE\":                  true,\n\t\t\"PUBLIC\":                   true,\n\t\t\"PURGE\":                    true,\n\t\t\"QUEUE\":                    true,\n\t\t\"QUOTA\":                    true,\n\t\t\"RANGE\":                    true,\n\t\t\"RAW\":                      true,\n\t\t\"RBA\":                      true,\n\t\t\"READ\":                     true,\n\t\t\"READUP\":                   true,\n\t\t\"REAL\":                     true,\n\t\t\"REBUILD\":                  true,\n\t\t\"RECOVER\":                  true,\n\t\t\"RECOVERABLE\":              true,\n\t\t\"RECOVERY\":                 true,\n\t\t\"REF\":                      true,\n\t\t\"REFERENCES\":               true,\n\t\t\"REFERENCING\":              true,\n\t\t\"REFRESH\":                  true,\n\t\t\"RENAME\":                   true,\n\t\t\"REPLACE\":                  true,\n\t\t\"RESET\":                    true,\n\t\t\"RESETLOGS\":                true,\n\t\t\"RESIZE\":                   true,\n\t\t\"RESOURCE\":                 true,\n\t\t\"RESTRICTED\":               true,\n\t\t\"RETURN\":                   true,\n\t\t\"RETURNING\":                true,\n\t\t\"REUSE\":                    true,\n\t\t\"REVERSE\":                  true,\n\t\t\"REVOKE\":                   true,\n\t\t\"ROLE\":                     true,\n\t\t\"ROLES\":                    true,\n\t\t\"ROLLBACK\":                 true,\n\t\t\"ROW\":                      true,\n\t\t\"ROWID\":                    true,\n\t\t\"ROWNUM\":                   true,\n\t\t\"ROWS\":                     true,\n\t\t\"RULE\":                     true,\n\t\t\"SAMPLE\":                   true,\n\t\t\"SAVEPOINT\":                true,\n\t\t\"SB4\":                      true,\n\t\t\"SCAN_INSTANCES\":           true,\n\t\t\"SCHEMA\":                   true,\n\t\t\"SCN\":                      true,\n\t\t\"SCOPE\":                    true,\n\t\t\"SD_ALL\":                   true,\n\t\t\"SD_INHIBIT\":               true,\n\t\t\"SD_SHOW\":                  true,\n\t\t\"SEGMENT\":                  true,\n\t\t\"SEG_BLOCK\":                true,\n\t\t\"SEG_FILE\":                 true,\n\t\t\"SELECT\":                   true,\n\t\t\"SEQUENCE\":                 true,\n\t\t\"SERIALIZABLE\":             true,\n\t\t\"SESSION\":                  true,\n\t\t\"SESSION_CACHED_CURSORS\":   true,\n\t\t\"SESSIONS_PER_USER\":        true,\n\t\t\"SET\":                      true,\n\t\t\"SHARE\":                    true,\n\t\t\"SHARED\":                   true,\n\t\t\"SHARED_POOL\":              true,\n\t\t\"SHRINK\":                   true,\n\t\t\"SIZE\":                     true,\n\t\t\"SKIP\":                     true,\n\t\t\"SKIP_UNUSABLE_INDEXES\":    true,\n\t\t\"SMALLINT\":                 true,\n\t\t\"SNAPSHOT\":                 true,\n\t\t\"SOME\":                     true,\n\t\t\"SORT\":                     true,\n\t\t\"SPECIFICATION\":            true,\n\t\t\"SPLIT\":                    true,\n\t\t\"SQL_TRACE\":                true,\n\t\t\"STANDBY\":                  true,\n\t\t\"START\":                    true,\n\t\t\"STATEMENT_ID\":             true,\n\t\t\"STATISTICS\":               true,\n\t\t\"STOP\":                     true,\n\t\t\"STORAGE\":                  true,\n\t\t\"STORE\":                    true,\n\t\t\"STRUCTURE\":                true,\n\t\t\"SUCCESSFUL\":               true,\n\t\t\"SWITCH\":                   true,\n\t\t\"SYS_OP_ENFORCE_NOT_NULL$\": true,\n\t\t\"SYS_OP_NTCIMG$\":           true,\n\t\t\"SYNONYM\":                  true,\n\t\t\"SYSDATE\":                  true,\n\t\t\"SYSDBA\":                   true,\n\t\t\"SYSOPER\":                  true,\n\t\t\"SYSTEM\":                   true,\n\t\t\"TABLE\":                    true,\n\t\t\"TABLES\":                   true,\n\t\t\"TABLESPACE\":               true,\n\t\t\"TABLESPACE_NO\":            true,\n\t\t\"TABNO\":                    true,\n\t\t\"TEMPORARY\":                true,\n\t\t\"THAN\":                     true,\n\t\t\"THE\":                      true,\n\t\t\"THEN\":                     true,\n\t\t\"THREAD\":                   true,\n\t\t\"TIMESTAMP\":                true,\n\t\t\"TIME\":                     true,\n\t\t\"TO\":                       true,\n\t\t\"TOPLEVEL\":                 true,\n\t\t\"TRACE\":                    true,\n\t\t\"TRACING\":                  true,\n\t\t\"TRANSACTION\":              true,\n\t\t\"TRANSITIONAL\":             true,\n\t\t\"TRIGGER\":                  true,\n\t\t\"TRIGGERS\":                 true,\n\t\t\"TRUE\":                     true,\n\t\t\"TRUNCATE\":                 true,\n\t\t\"TX\":                       true,\n\t\t\"TYPE\":                     true,\n\t\t\"UB2\":                      true,\n\t\t\"UBA\":                      true,\n\t\t\"UID\":                      true,\n\t\t\"UNARCHIVED\":               true,\n\t\t\"UNDO\":                     true,\n\t\t\"UNION\":                    true,\n\t\t\"UNIQUE\":                   true,\n\t\t\"UNLIMITED\":                true,\n\t\t\"UNLOCK\":                   true,\n\t\t\"UNRECOVERABLE\":            true,\n\t\t\"UNTIL\":                    true,\n\t\t\"UNUSABLE\":                 true,\n\t\t\"UNUSED\":                   true,\n\t\t\"UPDATABLE\":                true,\n\t\t\"UPDATE\":                   true,\n\t\t\"USAGE\":                    true,\n\t\t\"USE\":                      true,\n\t\t\"USER\":                     true,\n\t\t\"USING\":                    true,\n\t\t\"VALIDATE\":                 true,\n\t\t\"VALIDATION\":               true,\n\t\t\"VALUE\":                    true,\n\t\t\"VALUES\":                   true,\n\t\t\"VARCHAR\":                  true,\n\t\t\"VARCHAR2\":                 true,\n\t\t\"VARYING\":                  true,\n\t\t\"VIEW\":                     true,\n\t\t\"WHEN\":                     true,\n\t\t\"WHENEVER\":                 true,\n\t\t\"WHERE\":                    true,\n\t\t\"WITH\":                     true,\n\t\t\"WITHOUT\":                  true,\n\t\t\"WORK\":                     true,\n\t\t\"WRITE\":                    true,\n\t\t\"WRITEDOWN\":                true,\n\t\t\"WRITEUP\":                  true,\n\t\t\"XID\":                      true,\n\t\t\"YEAR\":                     true,\n\t\t\"ZONE\":                     true,\n\t}\n)\n\ntype oracle struct {\n\tcore.Base\n}\n\nfunc (db *oracle) Init(d *core.DB, uri *core.Uri, drivername, dataSourceName string) error {\n\treturn db.Base.Init(d, db, uri, drivername, dataSourceName)\n}\n\nfunc (db *oracle) SqlType(c *core.Column) string {\n\tvar res string\n\tswitch t := c.SQLType.Name; t {\n\tcase core.Bit, core.TinyInt, core.SmallInt, core.MediumInt, core.Int, core.Integer, core.BigInt, core.Bool, core.Serial, core.BigSerial:\n\t\tres = \"NUMBER\"\n\tcase core.Binary, core.VarBinary, core.Blob, core.TinyBlob, core.MediumBlob, core.LongBlob, core.Bytea:\n\t\treturn core.Blob\n\tcase core.Time, core.DateTime, core.TimeStamp:\n\t\tres = core.TimeStamp\n\tcase core.TimeStampz:\n\t\tres = \"TIMESTAMP WITH TIME ZONE\"\n\tcase core.Float, core.Double, core.Numeric, core.Decimal:\n\t\tres = \"NUMBER\"\n\tcase core.Text, core.MediumText, core.LongText, core.Json:\n\t\tres = \"CLOB\"\n\tcase core.Char, core.Varchar, core.TinyText:\n\t\tres = \"VARCHAR2\"\n\tdefault:\n\t\tres = t\n\t}\n\n\tvar hasLen1 bool = (c.Length > 0)\n\tvar hasLen2 bool = (c.Length2 > 0)\n\tif hasLen2 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \",\" + strconv.Itoa(c.Length2) + \")\"\n\t} else if hasLen1 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \")\"\n\t}\n\treturn res\n}\n\nfunc (db *oracle) AutoIncrStr() string {\n\treturn \"AUTO_INCREMENT\"\n}\n\nfunc (db *oracle) SupportInsertMany() bool {\n\treturn true\n}\n\nfunc (db *oracle) IsReserved(name string) bool {\n\t_, ok := oracleReservedWords[name]\n\treturn ok\n}\n\nfunc (db *oracle) Quote(name string) string {\n\treturn \"\\\"\" + name + \"\\\"\"\n}\n\nfunc (db *oracle) QuoteStr() string {\n\treturn \"\\\"\"\n}\n\nfunc (db *oracle) SupportEngine() bool {\n\treturn false\n}\n\nfunc (db *oracle) SupportCharset() bool {\n\treturn false\n}\n\nfunc (db *oracle) SupportDropIfExists() bool {\n\treturn false\n}\n\nfunc (db *oracle) IndexOnTable() bool {\n\treturn false\n}\n\nfunc (db *oracle) DropTableSql(tableName string) string {\n\treturn fmt.Sprintf(\"DROP TABLE `%s`\", tableName)\n}\n\nfunc (b *oracle) CreateTableSql(table *core.Table, tableName, storeEngine, charset string) string {\n\tvar sql string\n\tsql = \"CREATE TABLE \"\n\tif tableName == \"\" {\n\t\ttableName = table.Name\n\t}\n\n\tsql += b.Quote(tableName) + \" (\"\n\n\tpkList := table.PrimaryKeys\n\n\tfor _, colName := range table.ColumnsSeq() {\n\t\tcol := table.GetColumn(colName)\n\t\t/*if col.IsPrimaryKey && len(pkList) == 1 {\n\t\t\tsql += col.String(b.dialect)\n\t\t} else {*/\n\t\tsql += col.StringNoPk(b)\n\t\t//}\n\t\tsql = strings.TrimSpace(sql)\n\t\tsql += \", \"\n\t}\n\n\tif len(pkList) > 0 {\n\t\tsql += \"PRIMARY KEY ( \"\n\t\tsql += b.Quote(strings.Join(pkList, b.Quote(\",\")))\n\t\tsql += \" ), \"\n\t}\n\n\tsql = sql[:len(sql)-2] + \")\"\n\tif b.SupportEngine() && storeEngine != \"\" {\n\t\tsql += \" ENGINE=\" + storeEngine\n\t}\n\tif b.SupportCharset() {\n\t\tif len(charset) == 0 {\n\t\t\tcharset = b.URI().Charset\n\t\t}\n\t\tif len(charset) > 0 {\n\t\t\tsql += \" DEFAULT CHARSET \" + charset\n\t\t}\n\t}\n\treturn sql\n}\n\nfunc (db *oracle) IndexCheckSql(tableName, idxName string) (string, []interface{}) {\n\targs := []interface{}{tableName, idxName}\n\treturn `SELECT INDEX_NAME FROM USER_INDEXES ` +\n\t\t`WHERE TABLE_NAME = :1 AND INDEX_NAME = :2`, args\n}\n\nfunc (db *oracle) TableCheckSql(tableName string) (string, []interface{}) {\n\targs := []interface{}{tableName}\n\treturn `SELECT table_name FROM user_tables WHERE table_name = :1`, args\n}\n\nfunc (db *oracle) MustDropTable(tableName string) error {\n\tsql, args := db.TableCheckSql(tableName)\n\tdb.LogSQL(sql, args)\n\n\trows, err := db.DB().Query(sql, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tif !rows.Next() {\n\t\treturn nil\n\t}\n\n\tsql = \"Drop Table \\\"\" + tableName + \"\\\"\"\n\tdb.LogSQL(sql, args)\n\n\t_, err = db.DB().Exec(sql)\n\treturn err\n}\n\n/*func (db *oracle) ColumnCheckSql(tableName, colName string) (string, []interface{}) {\n\targs := []interface{}{strings.ToUpper(tableName), strings.ToUpper(colName)}\n\treturn \"SELECT column_name FROM USER_TAB_COLUMNS WHERE table_name = ?\" +\n\t\t\" AND column_name = ?\", args\n}*/\n\nfunc (db *oracle) IsColumnExist(tableName, colName string) (bool, error) {\n\targs := []interface{}{tableName, colName}\n\tquery := \"SELECT column_name FROM USER_TAB_COLUMNS WHERE table_name = :1\" +\n\t\t\" AND column_name = :2\"\n\tdb.LogSQL(query, args)\n\n\trows, err := db.DB().Query(query, args...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer rows.Close()\n\n\tif rows.Next() {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}\n\nfunc (db *oracle) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {\n\targs := []interface{}{tableName}\n\ts := \"SELECT column_name,data_default,data_type,data_length,data_precision,data_scale,\" +\n\t\t\"nullable FROM USER_TAB_COLUMNS WHERE table_name = :1\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer rows.Close()\n\n\tcols := make(map[string]*core.Column)\n\tcolSeq := make([]string, 0)\n\tfor rows.Next() {\n\t\tcol := new(core.Column)\n\t\tcol.Indexes = make(map[string]int)\n\n\t\tvar colName, colDefault, nullable, dataType, dataPrecision, dataScale *string\n\t\tvar dataLen int\n\n\t\terr = rows.Scan(&colName, &colDefault, &dataType, &dataLen, &dataPrecision,\n\t\t\t&dataScale, &nullable)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tcol.Name = strings.Trim(*colName, `\" `)\n\t\tif colDefault != nil {\n\t\t\tcol.Default = *colDefault\n\t\t\tcol.DefaultIsEmpty = false\n\t\t}\n\n\t\tif *nullable == \"Y\" {\n\t\t\tcol.Nullable = true\n\t\t} else {\n\t\t\tcol.Nullable = false\n\t\t}\n\n\t\tvar ignore bool\n\n\t\tvar dt string\n\t\tvar len1, len2 int\n\t\tdts := strings.Split(*dataType, \"(\")\n\t\tdt = dts[0]\n\t\tif len(dts) > 1 {\n\t\t\tlens := strings.Split(dts[1][:len(dts[1])-1], \",\")\n\t\t\tif len(lens) > 1 {\n\t\t\t\tlen1, _ = strconv.Atoi(lens[0])\n\t\t\t\tlen2, _ = strconv.Atoi(lens[1])\n\t\t\t} else {\n\t\t\t\tlen1, _ = strconv.Atoi(lens[0])\n\t\t\t}\n\t\t}\n\n\t\tswitch dt {\n\t\tcase \"VARCHAR2\":\n\t\t\tcol.SQLType = core.SQLType{core.Varchar, len1, len2}\n\t\tcase \"NVARCHAR2\":\n\t\t\tcol.SQLType = core.SQLType{core.NVarchar, len1, len2}\n\t\tcase \"TIMESTAMP WITH TIME ZONE\":\n\t\t\tcol.SQLType = core.SQLType{core.TimeStampz, 0, 0}\n\t\tcase \"NUMBER\":\n\t\t\tcol.SQLType = core.SQLType{core.Double, len1, len2}\n\t\tcase \"LONG\", \"LONG RAW\":\n\t\t\tcol.SQLType = core.SQLType{core.Text, 0, 0}\n\t\tcase \"RAW\":\n\t\t\tcol.SQLType = core.SQLType{core.Binary, 0, 0}\n\t\tcase \"ROWID\":\n\t\t\tcol.SQLType = core.SQLType{core.Varchar, 18, 0}\n\t\tcase \"AQ$_SUBSCRIBERS\":\n\t\t\tignore = true\n\t\tdefault:\n\t\t\tcol.SQLType = core.SQLType{strings.ToUpper(dt), len1, len2}\n\t\t}\n\n\t\tif ignore {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := core.SqlTypes[col.SQLType.Name]; !ok {\n\t\t\treturn nil, nil, errors.New(fmt.Sprintf(\"unkonw colType %v %v\", *dataType, col.SQLType))\n\t\t}\n\n\t\tcol.Length = dataLen\n\n\t\tif col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\tif !col.DefaultIsEmpty {\n\t\t\t\tcol.Default = \"'\" + col.Default + \"'\"\n\t\t\t}\n\t\t}\n\t\tcols[col.Name] = col\n\t\tcolSeq = append(colSeq, col.Name)\n\t}\n\n\treturn colSeq, cols, nil\n}\n\nfunc (db *oracle) GetTables() ([]*core.Table, error) {\n\targs := []interface{}{}\n\ts := \"SELECT table_name FROM user_tables\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttables := make([]*core.Table, 0)\n\tfor rows.Next() {\n\t\ttable := core.NewEmptyTable()\n\t\terr = rows.Scan(&table.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttables = append(tables, table)\n\t}\n\treturn tables, nil\n}\n\nfunc (db *oracle) GetIndexes(tableName string) (map[string]*core.Index, error) {\n\targs := []interface{}{tableName}\n\ts := \"SELECT t.column_name,i.uniqueness,i.index_name FROM user_ind_columns t,user_indexes i \" +\n\t\t\"WHERE t.index_name = i.index_name and t.table_name = i.table_name and t.table_name =:1\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tindexes := make(map[string]*core.Index, 0)\n\tfor rows.Next() {\n\t\tvar indexType int\n\t\tvar indexName, colName, uniqueness string\n\n\t\terr = rows.Scan(&colName, &uniqueness, &indexName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tindexName = strings.Trim(indexName, `\" `)\n\n\t\tif uniqueness == \"UNIQUE\" {\n\t\t\tindexType = core.UniqueType\n\t\t} else {\n\t\t\tindexType = core.IndexType\n\t\t}\n\n\t\tvar index *core.Index\n\t\tvar ok bool\n\t\tif index, ok = indexes[indexName]; !ok {\n\t\t\tindex = new(core.Index)\n\t\t\tindex.Type = indexType\n\t\t\tindex.Name = indexName\n\t\t\tindexes[indexName] = index\n\t\t}\n\t\tindex.AddColumn(colName)\n\t}\n\treturn indexes, nil\n}\n\nfunc (db *oracle) Filters() []core.Filter {\n\treturn []core.Filter{&core.QuoteFilter{}, &core.SeqFilter{\":\", 1}, &core.IdFilter{}}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/pg_reserved.txt",
    "content": "A\t \tnon-reserved\tnon-reserved\t \nABORT\tnon-reserved\t \t \t \nABS\t \treserved\treserved\t \nABSENT\t \tnon-reserved\tnon-reserved\t \nABSOLUTE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nACCESS\tnon-reserved\t \t \t \nACCORDING\t \tnon-reserved\tnon-reserved\t \nACTION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nADA\t \tnon-reserved\tnon-reserved\tnon-reserved\nADD\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nADMIN\tnon-reserved\tnon-reserved\tnon-reserved\t \nAFTER\tnon-reserved\tnon-reserved\tnon-reserved\t \nAGGREGATE\tnon-reserved\t \t \t \nALL\treserved\treserved\treserved\treserved\nALLOCATE\t \treserved\treserved\treserved\nALSO\tnon-reserved\t \t \t \nALTER\tnon-reserved\treserved\treserved\treserved\nALWAYS\tnon-reserved\tnon-reserved\tnon-reserved\t \nANALYSE\treserved\t \t \t \nANALYZE\treserved\t \t \t \nAND\treserved\treserved\treserved\treserved\nANY\treserved\treserved\treserved\treserved\nARE\t \treserved\treserved\treserved\nARRAY\treserved\treserved\treserved\t \nARRAY_AGG\t \treserved\treserved\t \nARRAY_MAX_CARDINALITY\t \treserved\t \t \nAS\treserved\treserved\treserved\treserved\nASC\treserved\tnon-reserved\tnon-reserved\treserved\nASENSITIVE\t \treserved\treserved\t \nASSERTION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nASSIGNMENT\tnon-reserved\tnon-reserved\tnon-reserved\t \nASYMMETRIC\treserved\treserved\treserved\t \nAT\tnon-reserved\treserved\treserved\treserved\nATOMIC\t \treserved\treserved\t \nATTRIBUTE\tnon-reserved\tnon-reserved\tnon-reserved\t \nATTRIBUTES\t \tnon-reserved\tnon-reserved\t \nAUTHORIZATION\treserved (can be function or type)\treserved\treserved\treserved\nAVG\t \treserved\treserved\treserved\nBACKWARD\tnon-reserved\t \t \t \nBASE64\t \tnon-reserved\tnon-reserved\t \nBEFORE\tnon-reserved\tnon-reserved\tnon-reserved\t \nBEGIN\tnon-reserved\treserved\treserved\treserved\nBEGIN_FRAME\t \treserved\t \t \nBEGIN_PARTITION\t \treserved\t \t \nBERNOULLI\t \tnon-reserved\tnon-reserved\t \nBETWEEN\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nBIGINT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nBINARY\treserved (can be function or type)\treserved\treserved\t \nBIT\tnon-reserved (cannot be function or type)\t \t \treserved\nBIT_LENGTH\t \t \t \treserved\nBLOB\t \treserved\treserved\t \nBLOCKED\t \tnon-reserved\tnon-reserved\t \nBOM\t \tnon-reserved\tnon-reserved\t \nBOOLEAN\tnon-reserved (cannot be function or type)\treserved\treserved\t \nBOTH\treserved\treserved\treserved\treserved\nBREADTH\t \tnon-reserved\tnon-reserved\t \nBY\tnon-reserved\treserved\treserved\treserved\nC\t \tnon-reserved\tnon-reserved\tnon-reserved\nCACHE\tnon-reserved\t \t \t \nCALL\t \treserved\treserved\t \nCALLED\tnon-reserved\treserved\treserved\t \nCARDINALITY\t \treserved\treserved\t \nCASCADE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nCASCADED\tnon-reserved\treserved\treserved\treserved\nCASE\treserved\treserved\treserved\treserved\nCAST\treserved\treserved\treserved\treserved\nCATALOG\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nCATALOG_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCEIL\t \treserved\treserved\t \nCEILING\t \treserved\treserved\t \nCHAIN\tnon-reserved\tnon-reserved\tnon-reserved\t \nCHAR\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nCHARACTER\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nCHARACTERISTICS\tnon-reserved\tnon-reserved\tnon-reserved\t \nCHARACTERS\t \tnon-reserved\tnon-reserved\t \nCHARACTER_LENGTH\t \treserved\treserved\treserved\nCHARACTER_SET_CATALOG\t \tnon-reserved\tnon-reserved\tnon-reserved\nCHARACTER_SET_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCHARACTER_SET_SCHEMA\t \tnon-reserved\tnon-reserved\tnon-reserved\nCHAR_LENGTH\t \treserved\treserved\treserved\nCHECK\treserved\treserved\treserved\treserved\nCHECKPOINT\tnon-reserved\t \t \t \nCLASS\tnon-reserved\t \t \t \nCLASS_ORIGIN\t \tnon-reserved\tnon-reserved\tnon-reserved\nCLOB\t \treserved\treserved\t \nCLOSE\tnon-reserved\treserved\treserved\treserved\nCLUSTER\tnon-reserved\t \t \t \nCOALESCE\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nCOBOL\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOLLATE\treserved\treserved\treserved\treserved\nCOLLATION\treserved (can be function or type)\tnon-reserved\tnon-reserved\treserved\nCOLLATION_CATALOG\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOLLATION_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOLLATION_SCHEMA\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOLLECT\t \treserved\treserved\t \nCOLUMN\treserved\treserved\treserved\treserved\nCOLUMNS\t \tnon-reserved\tnon-reserved\t \nCOLUMN_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOMMAND_FUNCTION\t \tnon-reserved\tnon-reserved\tnon-reserved\nCOMMAND_FUNCTION_CODE\t \tnon-reserved\tnon-reserved\t \nCOMMENT\tnon-reserved\t \t \t \nCOMMENTS\tnon-reserved\t \t \t \nCOMMIT\tnon-reserved\treserved\treserved\treserved\nCOMMITTED\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nCONCURRENTLY\treserved (can be function or type)\t \t \t \nCONDITION\t \treserved\treserved\t \nCONDITION_NUMBER\t \tnon-reserved\tnon-reserved\tnon-reserved\nCONFIGURATION\tnon-reserved\t \t \t \nCONNECT\t \treserved\treserved\treserved\nCONNECTION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nCONNECTION_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCONSTRAINT\treserved\treserved\treserved\treserved\nCONSTRAINTS\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nCONSTRAINT_CATALOG\t \tnon-reserved\tnon-reserved\tnon-reserved\nCONSTRAINT_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCONSTRAINT_SCHEMA\t \tnon-reserved\tnon-reserved\tnon-reserved\nCONSTRUCTOR\t \tnon-reserved\tnon-reserved\t \nCONTAINS\t \treserved\tnon-reserved\t \nCONTENT\tnon-reserved\tnon-reserved\tnon-reserved\t \nCONTINUE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nCONTROL\t \tnon-reserved\tnon-reserved\t \nCONVERSION\tnon-reserved\t \t \t \nCONVERT\t \treserved\treserved\treserved\nCOPY\tnon-reserved\t \t \t \nCORR\t \treserved\treserved\t \nCORRESPONDING\t \treserved\treserved\treserved\nCOST\tnon-reserved\t \t \t \nCOUNT\t \treserved\treserved\treserved\nCOVAR_POP\t \treserved\treserved\t \nCOVAR_SAMP\t \treserved\treserved\t \nCREATE\treserved\treserved\treserved\treserved\nCROSS\treserved (can be function or type)\treserved\treserved\treserved\nCSV\tnon-reserved\t \t \t \nCUBE\t \treserved\treserved\t \nCUME_DIST\t \treserved\treserved\t \nCURRENT\tnon-reserved\treserved\treserved\treserved\nCURRENT_CATALOG\treserved\treserved\treserved\t \nCURRENT_DATE\treserved\treserved\treserved\treserved\nCURRENT_DEFAULT_TRANSFORM_GROUP\t \treserved\treserved\t \nCURRENT_PATH\t \treserved\treserved\t \nCURRENT_ROLE\treserved\treserved\treserved\t \nCURRENT_ROW\t \treserved\t \t \nCURRENT_SCHEMA\treserved (can be function or type)\treserved\treserved\t \nCURRENT_TIME\treserved\treserved\treserved\treserved\nCURRENT_TIMESTAMP\treserved\treserved\treserved\treserved\nCURRENT_TRANSFORM_GROUP_FOR_TYPE\t \treserved\treserved\t \nCURRENT_USER\treserved\treserved\treserved\treserved\nCURSOR\tnon-reserved\treserved\treserved\treserved\nCURSOR_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nCYCLE\tnon-reserved\treserved\treserved\t \nDATA\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nDATABASE\tnon-reserved\t \t \t \nDATALINK\t \treserved\treserved\t \nDATE\t \treserved\treserved\treserved\nDATETIME_INTERVAL_CODE\t \tnon-reserved\tnon-reserved\tnon-reserved\nDATETIME_INTERVAL_PRECISION\t \tnon-reserved\tnon-reserved\tnon-reserved\nDAY\tnon-reserved\treserved\treserved\treserved\nDB\t \tnon-reserved\tnon-reserved\t \nDEALLOCATE\tnon-reserved\treserved\treserved\treserved\nDEC\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nDECIMAL\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nDECLARE\tnon-reserved\treserved\treserved\treserved\nDEFAULT\treserved\treserved\treserved\treserved\nDEFAULTS\tnon-reserved\tnon-reserved\tnon-reserved\t \nDEFERRABLE\treserved\tnon-reserved\tnon-reserved\treserved\nDEFERRED\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nDEFINED\t \tnon-reserved\tnon-reserved\t \nDEFINER\tnon-reserved\tnon-reserved\tnon-reserved\t \nDEGREE\t \tnon-reserved\tnon-reserved\t \nDELETE\tnon-reserved\treserved\treserved\treserved\nDELIMITER\tnon-reserved\t \t \t \nDELIMITERS\tnon-reserved\t \t \t \nDENSE_RANK\t \treserved\treserved\t \nDEPTH\t \tnon-reserved\tnon-reserved\t \nDEREF\t \treserved\treserved\t \nDERIVED\t \tnon-reserved\tnon-reserved\t \nDESC\treserved\tnon-reserved\tnon-reserved\treserved\nDESCRIBE\t \treserved\treserved\treserved\nDESCRIPTOR\t \tnon-reserved\tnon-reserved\treserved\nDETERMINISTIC\t \treserved\treserved\t \nDIAGNOSTICS\t \tnon-reserved\tnon-reserved\treserved\nDICTIONARY\tnon-reserved\t \t \t \nDISABLE\tnon-reserved\t \t \t \nDISCARD\tnon-reserved\t \t \t \nDISCONNECT\t \treserved\treserved\treserved\nDISPATCH\t \tnon-reserved\tnon-reserved\t \nDISTINCT\treserved\treserved\treserved\treserved\nDLNEWCOPY\t \treserved\treserved\t \nDLPREVIOUSCOPY\t \treserved\treserved\t \nDLURLCOMPLETE\t \treserved\treserved\t \nDLURLCOMPLETEONLY\t \treserved\treserved\t \nDLURLCOMPLETEWRITE\t \treserved\treserved\t \nDLURLPATH\t \treserved\treserved\t \nDLURLPATHONLY\t \treserved\treserved\t \nDLURLPATHWRITE\t \treserved\treserved\t \nDLURLSCHEME\t \treserved\treserved\t \nDLURLSERVER\t \treserved\treserved\t \nDLVALUE\t \treserved\treserved\t \nDO\treserved\t \t \t \nDOCUMENT\tnon-reserved\tnon-reserved\tnon-reserved\t \nDOMAIN\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nDOUBLE\tnon-reserved\treserved\treserved\treserved\nDROP\tnon-reserved\treserved\treserved\treserved\nDYNAMIC\t \treserved\treserved\t \nDYNAMIC_FUNCTION\t \tnon-reserved\tnon-reserved\tnon-reserved\nDYNAMIC_FUNCTION_CODE\t \tnon-reserved\tnon-reserved\t \nEACH\tnon-reserved\treserved\treserved\t \nELEMENT\t \treserved\treserved\t \nELSE\treserved\treserved\treserved\treserved\nEMPTY\t \tnon-reserved\tnon-reserved\t \nENABLE\tnon-reserved\t \t \t \nENCODING\tnon-reserved\tnon-reserved\tnon-reserved\t \nENCRYPTED\tnon-reserved\t \t \t \nEND\treserved\treserved\treserved\treserved\nEND-EXEC\t \treserved\treserved\treserved\nEND_FRAME\t \treserved\t \t \nEND_PARTITION\t \treserved\t \t \nENFORCED\t \tnon-reserved\t \t \nENUM\tnon-reserved\t \t \t \nEQUALS\t \treserved\tnon-reserved\t \nESCAPE\tnon-reserved\treserved\treserved\treserved\nEVENT\tnon-reserved\t \t \t \nEVERY\t \treserved\treserved\t \nEXCEPT\treserved\treserved\treserved\treserved\nEXCEPTION\t \t \t \treserved\nEXCLUDE\tnon-reserved\tnon-reserved\tnon-reserved\t \nEXCLUDING\tnon-reserved\tnon-reserved\tnon-reserved\t \nEXCLUSIVE\tnon-reserved\t \t \t \nEXEC\t \treserved\treserved\treserved\nEXECUTE\tnon-reserved\treserved\treserved\treserved\nEXISTS\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nEXP\t \treserved\treserved\t \nEXPLAIN\tnon-reserved\t \t \t \nEXPRESSION\t \tnon-reserved\t \t \nEXTENSION\tnon-reserved\t \t \t \nEXTERNAL\tnon-reserved\treserved\treserved\treserved\nEXTRACT\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nFALSE\treserved\treserved\treserved\treserved\nFAMILY\tnon-reserved\t \t \t \nFETCH\treserved\treserved\treserved\treserved\nFILE\t \tnon-reserved\tnon-reserved\t \nFILTER\t \treserved\treserved\t \nFINAL\t \tnon-reserved\tnon-reserved\t \nFIRST\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nFIRST_VALUE\t \treserved\treserved\t \nFLAG\t \tnon-reserved\tnon-reserved\t \nFLOAT\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nFLOOR\t \treserved\treserved\t \nFOLLOWING\tnon-reserved\tnon-reserved\tnon-reserved\t \nFOR\treserved\treserved\treserved\treserved\nFORCE\tnon-reserved\t \t \t \nFOREIGN\treserved\treserved\treserved\treserved\nFORTRAN\t \tnon-reserved\tnon-reserved\tnon-reserved\nFORWARD\tnon-reserved\t \t \t \nFOUND\t \tnon-reserved\tnon-reserved\treserved\nFRAME_ROW\t \treserved\t \t \nFREE\t \treserved\treserved\t \nFREEZE\treserved (can be function or type)\t \t \t \nFROM\treserved\treserved\treserved\treserved\nFS\t \tnon-reserved\tnon-reserved\t \nFULL\treserved (can be function or type)\treserved\treserved\treserved\nFUNCTION\tnon-reserved\treserved\treserved\t \nFUNCTIONS\tnon-reserved\t \t \t \nFUSION\t \treserved\treserved\t \nG\t \tnon-reserved\tnon-reserved\t \nGENERAL\t \tnon-reserved\tnon-reserved\t \nGENERATED\t \tnon-reserved\tnon-reserved\t \nGET\t \treserved\treserved\treserved\nGLOBAL\tnon-reserved\treserved\treserved\treserved\nGO\t \tnon-reserved\tnon-reserved\treserved\nGOTO\t \tnon-reserved\tnon-reserved\treserved\nGRANT\treserved\treserved\treserved\treserved\nGRANTED\tnon-reserved\tnon-reserved\tnon-reserved\t \nGREATEST\tnon-reserved (cannot be function or type)\t \t \t \nGROUP\treserved\treserved\treserved\treserved\nGROUPING\t \treserved\treserved\t \nGROUPS\t \treserved\t \t \nHANDLER\tnon-reserved\t \t \t \nHAVING\treserved\treserved\treserved\treserved\nHEADER\tnon-reserved\t \t \t \nHEX\t \tnon-reserved\tnon-reserved\t \nHIERARCHY\t \tnon-reserved\tnon-reserved\t \nHOLD\tnon-reserved\treserved\treserved\t \nHOUR\tnon-reserved\treserved\treserved\treserved\nID\t \tnon-reserved\tnon-reserved\t \nIDENTITY\tnon-reserved\treserved\treserved\treserved\nIF\tnon-reserved\t \t \t \nIGNORE\t \tnon-reserved\tnon-reserved\t \nILIKE\treserved (can be function or type)\t \t \t \nIMMEDIATE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nIMMEDIATELY\t \tnon-reserved\t \t \nIMMUTABLE\tnon-reserved\t \t \t \nIMPLEMENTATION\t \tnon-reserved\tnon-reserved\t \nIMPLICIT\tnon-reserved\t \t \t \nIMPORT\t \treserved\treserved\t \nIN\treserved\treserved\treserved\treserved\nINCLUDING\tnon-reserved\tnon-reserved\tnon-reserved\t \nINCREMENT\tnon-reserved\tnon-reserved\tnon-reserved\t \nINDENT\t \tnon-reserved\tnon-reserved\t \nINDEX\tnon-reserved\t \t \t \nINDEXES\tnon-reserved\t \t \t \nINDICATOR\t \treserved\treserved\treserved\nINHERIT\tnon-reserved\t \t \t \nINHERITS\tnon-reserved\t \t \t \nINITIALLY\treserved\tnon-reserved\tnon-reserved\treserved\nINLINE\tnon-reserved\t \t \t \nINNER\treserved (can be function or type)\treserved\treserved\treserved\nINOUT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nINPUT\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nINSENSITIVE\tnon-reserved\treserved\treserved\treserved\nINSERT\tnon-reserved\treserved\treserved\treserved\nINSTANCE\t \tnon-reserved\tnon-reserved\t \nINSTANTIABLE\t \tnon-reserved\tnon-reserved\t \nINSTEAD\tnon-reserved\tnon-reserved\tnon-reserved\t \nINT\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nINTEGER\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nINTEGRITY\t \tnon-reserved\tnon-reserved\t \nINTERSECT\treserved\treserved\treserved\treserved\nINTERSECTION\t \treserved\treserved\t \nINTERVAL\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nINTO\treserved\treserved\treserved\treserved\nINVOKER\tnon-reserved\tnon-reserved\tnon-reserved\t \nIS\treserved (can be function or type)\treserved\treserved\treserved\nISNULL\treserved (can be function or type)\t \t \t \nISOLATION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nJOIN\treserved (can be function or type)\treserved\treserved\treserved\nK\t \tnon-reserved\tnon-reserved\t \nKEY\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nKEY_MEMBER\t \tnon-reserved\tnon-reserved\t \nKEY_TYPE\t \tnon-reserved\tnon-reserved\t \nLABEL\tnon-reserved\t \t \t \nLAG\t \treserved\treserved\t \nLANGUAGE\tnon-reserved\treserved\treserved\treserved\nLARGE\tnon-reserved\treserved\treserved\t \nLAST\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nLAST_VALUE\t \treserved\treserved\t \nLATERAL\treserved\treserved\treserved\t \nLC_COLLATE\tnon-reserved\t \t \t \nLC_CTYPE\tnon-reserved\t \t \t \nLEAD\t \treserved\treserved\t \nLEADING\treserved\treserved\treserved\treserved\nLEAKPROOF\tnon-reserved\t \t \t \nLEAST\tnon-reserved (cannot be function or type)\t \t \t \nLEFT\treserved (can be function or type)\treserved\treserved\treserved\nLENGTH\t \tnon-reserved\tnon-reserved\tnon-reserved\nLEVEL\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nLIBRARY\t \tnon-reserved\tnon-reserved\t \nLIKE\treserved (can be function or type)\treserved\treserved\treserved\nLIKE_REGEX\t \treserved\treserved\t \nLIMIT\treserved\tnon-reserved\tnon-reserved\t \nLINK\t \tnon-reserved\tnon-reserved\t \nLISTEN\tnon-reserved\t \t \t \nLN\t \treserved\treserved\t \nLOAD\tnon-reserved\t \t \t \nLOCAL\tnon-reserved\treserved\treserved\treserved\nLOCALTIME\treserved\treserved\treserved\t \nLOCALTIMESTAMP\treserved\treserved\treserved\t \nLOCATION\tnon-reserved\tnon-reserved\tnon-reserved\t \nLOCATOR\t \tnon-reserved\tnon-reserved\t \nLOCK\tnon-reserved\t \t \t \nLOWER\t \treserved\treserved\treserved\nM\t \tnon-reserved\tnon-reserved\t \nMAP\t \tnon-reserved\tnon-reserved\t \nMAPPING\tnon-reserved\tnon-reserved\tnon-reserved\t \nMATCH\tnon-reserved\treserved\treserved\treserved\nMATCHED\t \tnon-reserved\tnon-reserved\t \nMATERIALIZED\tnon-reserved\t \t \t \nMAX\t \treserved\treserved\treserved\nMAXVALUE\tnon-reserved\tnon-reserved\tnon-reserved\t \nMAX_CARDINALITY\t \t \treserved\t \nMEMBER\t \treserved\treserved\t \nMERGE\t \treserved\treserved\t \nMESSAGE_LENGTH\t \tnon-reserved\tnon-reserved\tnon-reserved\nMESSAGE_OCTET_LENGTH\t \tnon-reserved\tnon-reserved\tnon-reserved\nMESSAGE_TEXT\t \tnon-reserved\tnon-reserved\tnon-reserved\nMETHOD\t \treserved\treserved\t \nMIN\t \treserved\treserved\treserved\nMINUTE\tnon-reserved\treserved\treserved\treserved\nMINVALUE\tnon-reserved\tnon-reserved\tnon-reserved\t \nMOD\t \treserved\treserved\t \nMODE\tnon-reserved\t \t \t \nMODIFIES\t \treserved\treserved\t \nMODULE\t \treserved\treserved\treserved\nMONTH\tnon-reserved\treserved\treserved\treserved\nMORE\t \tnon-reserved\tnon-reserved\tnon-reserved\nMOVE\tnon-reserved\t \t \t \nMULTISET\t \treserved\treserved\t \nMUMPS\t \tnon-reserved\tnon-reserved\tnon-reserved\nNAME\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nNAMES\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nNAMESPACE\t \tnon-reserved\tnon-reserved\t \nNATIONAL\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nNATURAL\treserved (can be function or type)\treserved\treserved\treserved\nNCHAR\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nNCLOB\t \treserved\treserved\t \nNESTING\t \tnon-reserved\tnon-reserved\t \nNEW\t \treserved\treserved\t \nNEXT\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nNFC\t \tnon-reserved\tnon-reserved\t \nNFD\t \tnon-reserved\tnon-reserved\t \nNFKC\t \tnon-reserved\tnon-reserved\t \nNFKD\t \tnon-reserved\tnon-reserved\t \nNIL\t \tnon-reserved\tnon-reserved\t \nNO\tnon-reserved\treserved\treserved\treserved\nNONE\tnon-reserved (cannot be function or type)\treserved\treserved\t \nNORMALIZE\t \treserved\treserved\t \nNORMALIZED\t \tnon-reserved\tnon-reserved\t \nNOT\treserved\treserved\treserved\treserved\nNOTHING\tnon-reserved\t \t \t \nNOTIFY\tnon-reserved\t \t \t \nNOTNULL\treserved (can be function or type)\t \t \t \nNOWAIT\tnon-reserved\t \t \t \nNTH_VALUE\t \treserved\treserved\t \nNTILE\t \treserved\treserved\t \nNULL\treserved\treserved\treserved\treserved\nNULLABLE\t \tnon-reserved\tnon-reserved\tnon-reserved\nNULLIF\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nNULLS\tnon-reserved\tnon-reserved\tnon-reserved\t \nNUMBER\t \tnon-reserved\tnon-reserved\tnon-reserved\nNUMERIC\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nOBJECT\tnon-reserved\tnon-reserved\tnon-reserved\t \nOCCURRENCES_REGEX\t \treserved\treserved\t \nOCTETS\t \tnon-reserved\tnon-reserved\t \nOCTET_LENGTH\t \treserved\treserved\treserved\nOF\tnon-reserved\treserved\treserved\treserved\nOFF\tnon-reserved\tnon-reserved\tnon-reserved\t \nOFFSET\treserved\treserved\treserved\t \nOIDS\tnon-reserved\t \t \t \nOLD\t \treserved\treserved\t \nON\treserved\treserved\treserved\treserved\nONLY\treserved\treserved\treserved\treserved\nOPEN\t \treserved\treserved\treserved\nOPERATOR\tnon-reserved\t \t \t \nOPTION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nOPTIONS\tnon-reserved\tnon-reserved\tnon-reserved\t \nOR\treserved\treserved\treserved\treserved\nORDER\treserved\treserved\treserved\treserved\nORDERING\t \tnon-reserved\tnon-reserved\t \nORDINALITY\t \tnon-reserved\tnon-reserved\t \nOTHERS\t \tnon-reserved\tnon-reserved\t \nOUT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nOUTER\treserved (can be function or type)\treserved\treserved\treserved\nOUTPUT\t \tnon-reserved\tnon-reserved\treserved\nOVER\treserved (can be function or type)\treserved\treserved\t \nOVERLAPS\treserved (can be function or type)\treserved\treserved\treserved\nOVERLAY\tnon-reserved (cannot be function or type)\treserved\treserved\t \nOVERRIDING\t \tnon-reserved\tnon-reserved\t \nOWNED\tnon-reserved\t \t \t \nOWNER\tnon-reserved\t \t \t \nP\t \tnon-reserved\tnon-reserved\t \nPAD\t \tnon-reserved\tnon-reserved\treserved\nPARAMETER\t \treserved\treserved\t \nPARAMETER_MODE\t \tnon-reserved\tnon-reserved\t \nPARAMETER_NAME\t \tnon-reserved\tnon-reserved\t \nPARAMETER_ORDINAL_POSITION\t \tnon-reserved\tnon-reserved\t \nPARAMETER_SPECIFIC_CATALOG\t \tnon-reserved\tnon-reserved\t \nPARAMETER_SPECIFIC_NAME\t \tnon-reserved\tnon-reserved\t \nPARAMETER_SPECIFIC_SCHEMA\t \tnon-reserved\tnon-reserved\t \nPARSER\tnon-reserved\t \t \t \nPARTIAL\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nPARTITION\tnon-reserved\treserved\treserved\t \nPASCAL\t \tnon-reserved\tnon-reserved\tnon-reserved\nPASSING\tnon-reserved\tnon-reserved\tnon-reserved\t \nPASSTHROUGH\t \tnon-reserved\tnon-reserved\t \nPASSWORD\tnon-reserved\t \t \t \nPATH\t \tnon-reserved\tnon-reserved\t \nPERCENT\t \treserved\t \t \nPERCENTILE_CONT\t \treserved\treserved\t \nPERCENTILE_DISC\t \treserved\treserved\t \nPERCENT_RANK\t \treserved\treserved\t \nPERIOD\t \treserved\t \t \nPERMISSION\t \tnon-reserved\tnon-reserved\t \nPLACING\treserved\tnon-reserved\tnon-reserved\t \nPLANS\tnon-reserved\t \t \t \nPLI\t \tnon-reserved\tnon-reserved\tnon-reserved\nPORTION\t \treserved\t \t \nPOSITION\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nPOSITION_REGEX\t \treserved\treserved\t \nPOWER\t \treserved\treserved\t \nPRECEDES\t \treserved\t \t \nPRECEDING\tnon-reserved\tnon-reserved\tnon-reserved\t \nPRECISION\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nPREPARE\tnon-reserved\treserved\treserved\treserved\nPREPARED\tnon-reserved\t \t \t \nPRESERVE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nPRIMARY\treserved\treserved\treserved\treserved\nPRIOR\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nPRIVILEGES\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nPROCEDURAL\tnon-reserved\t \t \t \nPROCEDURE\tnon-reserved\treserved\treserved\treserved\nPROGRAM\tnon-reserved\t \t \t \nPUBLIC\t \tnon-reserved\tnon-reserved\treserved\nQUOTE\tnon-reserved\t \t \t \nRANGE\tnon-reserved\treserved\treserved\t \nRANK\t \treserved\treserved\t \nREAD\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nREADS\t \treserved\treserved\t \nREAL\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nREASSIGN\tnon-reserved\t \t \t \nRECHECK\tnon-reserved\t \t \t \nRECOVERY\t \tnon-reserved\tnon-reserved\t \nRECURSIVE\tnon-reserved\treserved\treserved\t \nREF\tnon-reserved\treserved\treserved\t \nREFERENCES\treserved\treserved\treserved\treserved\nREFERENCING\t \treserved\treserved\t \nREFRESH\tnon-reserved\t \t \t \nREGR_AVGX\t \treserved\treserved\t \nREGR_AVGY\t \treserved\treserved\t \nREGR_COUNT\t \treserved\treserved\t \nREGR_INTERCEPT\t \treserved\treserved\t \nREGR_R2\t \treserved\treserved\t \nREGR_SLOPE\t \treserved\treserved\t \nREGR_SXX\t \treserved\treserved\t \nREGR_SXY\t \treserved\treserved\t \nREGR_SYY\t \treserved\treserved\t \nREINDEX\tnon-reserved\t \t \t \nRELATIVE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nRELEASE\tnon-reserved\treserved\treserved\t \nRENAME\tnon-reserved\t \t \t \nREPEATABLE\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nREPLACE\tnon-reserved\t \t \t \nREPLICA\tnon-reserved\t \t \t \nREQUIRING\t \tnon-reserved\tnon-reserved\t \nRESET\tnon-reserved\t \t \t \nRESPECT\t \tnon-reserved\tnon-reserved\t \nRESTART\tnon-reserved\tnon-reserved\tnon-reserved\t \nRESTORE\t \tnon-reserved\tnon-reserved\t \nRESTRICT\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nRESULT\t \treserved\treserved\t \nRETURN\t \treserved\treserved\t \nRETURNED_CARDINALITY\t \tnon-reserved\tnon-reserved\t \nRETURNED_LENGTH\t \tnon-reserved\tnon-reserved\tnon-reserved\nRETURNED_OCTET_LENGTH\t \tnon-reserved\tnon-reserved\tnon-reserved\nRETURNED_SQLSTATE\t \tnon-reserved\tnon-reserved\tnon-reserved\nRETURNING\treserved\tnon-reserved\tnon-reserved\t \nRETURNS\tnon-reserved\treserved\treserved\t \nREVOKE\tnon-reserved\treserved\treserved\treserved\nRIGHT\treserved (can be function or type)\treserved\treserved\treserved\nROLE\tnon-reserved\tnon-reserved\tnon-reserved\t \nROLLBACK\tnon-reserved\treserved\treserved\treserved\nROLLUP\t \treserved\treserved\t \nROUTINE\t \tnon-reserved\tnon-reserved\t \nROUTINE_CATALOG\t \tnon-reserved\tnon-reserved\t \nROUTINE_NAME\t \tnon-reserved\tnon-reserved\t \nROUTINE_SCHEMA\t \tnon-reserved\tnon-reserved\t \nROW\tnon-reserved (cannot be function or type)\treserved\treserved\t \nROWS\tnon-reserved\treserved\treserved\treserved\nROW_COUNT\t \tnon-reserved\tnon-reserved\tnon-reserved\nROW_NUMBER\t \treserved\treserved\t \nRULE\tnon-reserved\t \t \t \nSAVEPOINT\tnon-reserved\treserved\treserved\t \nSCALE\t \tnon-reserved\tnon-reserved\tnon-reserved\nSCHEMA\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nSCHEMA_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nSCOPE\t \treserved\treserved\t \nSCOPE_CATALOG\t \tnon-reserved\tnon-reserved\t \nSCOPE_NAME\t \tnon-reserved\tnon-reserved\t \nSCOPE_SCHEMA\t \tnon-reserved\tnon-reserved\t \nSCROLL\tnon-reserved\treserved\treserved\treserved\nSEARCH\tnon-reserved\treserved\treserved\t \nSECOND\tnon-reserved\treserved\treserved\treserved\nSECTION\t \tnon-reserved\tnon-reserved\treserved\nSECURITY\tnon-reserved\tnon-reserved\tnon-reserved\t \nSELECT\treserved\treserved\treserved\treserved\nSELECTIVE\t \tnon-reserved\tnon-reserved\t \nSELF\t \tnon-reserved\tnon-reserved\t \nSENSITIVE\t \treserved\treserved\t \nSEQUENCE\tnon-reserved\tnon-reserved\tnon-reserved\t \nSEQUENCES\tnon-reserved\t \t \t \nSERIALIZABLE\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nSERVER\tnon-reserved\tnon-reserved\tnon-reserved\t \nSERVER_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nSESSION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nSESSION_USER\treserved\treserved\treserved\treserved\nSET\tnon-reserved\treserved\treserved\treserved\nSETOF\tnon-reserved (cannot be function or type)\t \t \t \nSETS\t \tnon-reserved\tnon-reserved\t \nSHARE\tnon-reserved\t \t \t \nSHOW\tnon-reserved\t \t \t \nSIMILAR\treserved (can be function or type)\treserved\treserved\t \nSIMPLE\tnon-reserved\tnon-reserved\tnon-reserved\t \nSIZE\t \tnon-reserved\tnon-reserved\treserved\nSMALLINT\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nSNAPSHOT\tnon-reserved\t \t \t \nSOME\treserved\treserved\treserved\treserved\nSOURCE\t \tnon-reserved\tnon-reserved\t \nSPACE\t \tnon-reserved\tnon-reserved\treserved\nSPECIFIC\t \treserved\treserved\t \nSPECIFICTYPE\t \treserved\treserved\t \nSPECIFIC_NAME\t \tnon-reserved\tnon-reserved\t \nSQL\t \treserved\treserved\treserved\nSQLCODE\t \t \t \treserved\nSQLERROR\t \t \t \treserved\nSQLEXCEPTION\t \treserved\treserved\t \nSQLSTATE\t \treserved\treserved\treserved\nSQLWARNING\t \treserved\treserved\t \nSQRT\t \treserved\treserved\t \nSTABLE\tnon-reserved\t \t \t \nSTANDALONE\tnon-reserved\tnon-reserved\tnon-reserved\t \nSTART\tnon-reserved\treserved\treserved\t \nSTATE\t \tnon-reserved\tnon-reserved\t \nSTATEMENT\tnon-reserved\tnon-reserved\tnon-reserved\t \nSTATIC\t \treserved\treserved\t \nSTATISTICS\tnon-reserved\t \t \t \nSTDDEV_POP\t \treserved\treserved\t \nSTDDEV_SAMP\t \treserved\treserved\t \nSTDIN\tnon-reserved\t \t \t \nSTDOUT\tnon-reserved\t \t \t \nSTORAGE\tnon-reserved\t \t \t \nSTRICT\tnon-reserved\t \t \t \nSTRIP\tnon-reserved\tnon-reserved\tnon-reserved\t \nSTRUCTURE\t \tnon-reserved\tnon-reserved\t \nSTYLE\t \tnon-reserved\tnon-reserved\t \nSUBCLASS_ORIGIN\t \tnon-reserved\tnon-reserved\tnon-reserved\nSUBMULTISET\t \treserved\treserved\t \nSUBSTRING\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nSUBSTRING_REGEX\t \treserved\treserved\t \nSUCCEEDS\t \treserved\t \t \nSUM\t \treserved\treserved\treserved\nSYMMETRIC\treserved\treserved\treserved\t \nSYSID\tnon-reserved\t \t \t \nSYSTEM\tnon-reserved\treserved\treserved\t \nSYSTEM_TIME\t \treserved\t \t \nSYSTEM_USER\t \treserved\treserved\treserved\nT\t \tnon-reserved\tnon-reserved\t \nTABLE\treserved\treserved\treserved\treserved\nTABLES\tnon-reserved\t \t \t \nTABLESAMPLE\t \treserved\treserved\t \nTABLESPACE\tnon-reserved\t \t \t \nTABLE_NAME\t \tnon-reserved\tnon-reserved\tnon-reserved\nTEMP\tnon-reserved\t \t \t \nTEMPLATE\tnon-reserved\t \t \t \nTEMPORARY\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nTEXT\tnon-reserved\t \t \t \nTHEN\treserved\treserved\treserved\treserved\nTIES\t \tnon-reserved\tnon-reserved\t \nTIME\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nTIMESTAMP\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nTIMEZONE_HOUR\t \treserved\treserved\treserved\nTIMEZONE_MINUTE\t \treserved\treserved\treserved\nTO\treserved\treserved\treserved\treserved\nTOKEN\t \tnon-reserved\tnon-reserved\t \nTOP_LEVEL_COUNT\t \tnon-reserved\tnon-reserved\t \nTRAILING\treserved\treserved\treserved\treserved\nTRANSACTION\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nTRANSACTIONS_COMMITTED\t \tnon-reserved\tnon-reserved\t \nTRANSACTIONS_ROLLED_BACK\t \tnon-reserved\tnon-reserved\t \nTRANSACTION_ACTIVE\t \tnon-reserved\tnon-reserved\t \nTRANSFORM\t \tnon-reserved\tnon-reserved\t \nTRANSFORMS\t \tnon-reserved\tnon-reserved\t \nTRANSLATE\t \treserved\treserved\treserved\nTRANSLATE_REGEX\t \treserved\treserved\t \nTRANSLATION\t \treserved\treserved\treserved\nTREAT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nTRIGGER\tnon-reserved\treserved\treserved\t \nTRIGGER_CATALOG\t \tnon-reserved\tnon-reserved\t \nTRIGGER_NAME\t \tnon-reserved\tnon-reserved\t \nTRIGGER_SCHEMA\t \tnon-reserved\tnon-reserved\t \nTRIM\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nTRIM_ARRAY\t \treserved\treserved\t \nTRUE\treserved\treserved\treserved\treserved\nTRUNCATE\tnon-reserved\treserved\treserved\t \nTRUSTED\tnon-reserved\t \t \t \nTYPE\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nTYPES\tnon-reserved\t \t \t \nUESCAPE\t \treserved\treserved\t \nUNBOUNDED\tnon-reserved\tnon-reserved\tnon-reserved\t \nUNCOMMITTED\tnon-reserved\tnon-reserved\tnon-reserved\tnon-reserved\nUNDER\t \tnon-reserved\tnon-reserved\t \nUNENCRYPTED\tnon-reserved\t \t \t \nUNION\treserved\treserved\treserved\treserved\nUNIQUE\treserved\treserved\treserved\treserved\nUNKNOWN\tnon-reserved\treserved\treserved\treserved\nUNLINK\t \tnon-reserved\tnon-reserved\t \nUNLISTEN\tnon-reserved\t \t \t \nUNLOGGED\tnon-reserved\t \t \t \nUNNAMED\t \tnon-reserved\tnon-reserved\tnon-reserved\nUNNEST\t \treserved\treserved\t \nUNTIL\tnon-reserved\t \t \t \nUNTYPED\t \tnon-reserved\tnon-reserved\t \nUPDATE\tnon-reserved\treserved\treserved\treserved\nUPPER\t \treserved\treserved\treserved\nURI\t \tnon-reserved\tnon-reserved\t \nUSAGE\t \tnon-reserved\tnon-reserved\treserved\nUSER\treserved\treserved\treserved\treserved\nUSER_DEFINED_TYPE_CATALOG\t \tnon-reserved\tnon-reserved\t \nUSER_DEFINED_TYPE_CODE\t \tnon-reserved\tnon-reserved\t \nUSER_DEFINED_TYPE_NAME\t \tnon-reserved\tnon-reserved\t \nUSER_DEFINED_TYPE_SCHEMA\t \tnon-reserved\tnon-reserved\t \nUSING\treserved\treserved\treserved\treserved\nVACUUM\tnon-reserved\t \t \t \nVALID\tnon-reserved\tnon-reserved\tnon-reserved\t \nVALIDATE\tnon-reserved\t \t \t \nVALIDATOR\tnon-reserved\t \t \t \nVALUE\tnon-reserved\treserved\treserved\treserved\nVALUES\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nVALUE_OF\t \treserved\t \t \nVARBINARY\t \treserved\treserved\t \nVARCHAR\tnon-reserved (cannot be function or type)\treserved\treserved\treserved\nVARIADIC\treserved\t \t \t \nVARYING\tnon-reserved\treserved\treserved\treserved\nVAR_POP\t \treserved\treserved\t \nVAR_SAMP\t \treserved\treserved\t \nVERBOSE\treserved (can be function or type)\t \t \t \nVERSION\tnon-reserved\tnon-reserved\tnon-reserved\t \nVERSIONING\t \treserved\t \t \nVIEW\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nVOLATILE\tnon-reserved\t \t \t \nWHEN\treserved\treserved\treserved\treserved\nWHENEVER\t \treserved\treserved\treserved\nWHERE\treserved\treserved\treserved\treserved\nWHITESPACE\tnon-reserved\tnon-reserved\tnon-reserved\t \nWIDTH_BUCKET\t \treserved\treserved\t \nWINDOW\treserved\treserved\treserved\t \nWITH\treserved\treserved\treserved\treserved\nWITHIN\t \treserved\treserved\t \nWITHOUT\tnon-reserved\treserved\treserved\t \nWORK\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nWRAPPER\tnon-reserved\tnon-reserved\tnon-reserved\t \nWRITE\tnon-reserved\tnon-reserved\tnon-reserved\treserved\nXML\tnon-reserved\treserved\treserved\t \nXMLAGG\t \treserved\treserved\t \nXMLATTRIBUTES\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLBINARY\t \treserved\treserved\t \nXMLCAST\t \treserved\treserved\t \nXMLCOMMENT\t \treserved\treserved\t \nXMLCONCAT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLDECLARATION\t \tnon-reserved\tnon-reserved\t \nXMLDOCUMENT\t \treserved\treserved\t \nXMLELEMENT\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLEXISTS\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLFOREST\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLITERATE\t \treserved\treserved\t \nXMLNAMESPACES\t \treserved\treserved\t \nXMLPARSE\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLPI\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLQUERY\t \treserved\treserved\t \nXMLROOT\tnon-reserved (cannot be function or type)\t \t \t \nXMLSCHEMA\t \tnon-reserved\tnon-reserved\t \nXMLSERIALIZE\tnon-reserved (cannot be function or type)\treserved\treserved\t \nXMLTABLE\t \treserved\treserved\t \nXMLTEXT\t \treserved\treserved\t \nXMLVALIDATE\t \treserved\treserved\t \nYEAR\tnon-reserved\treserved\treserved\treserved\nYES\tnon-reserved\tnon-reserved\tnon-reserved\t \nZONE\tnon-reserved\tnon-reserved\tnon-reserved\treserved"
  },
  {
    "path": "src/github.com/go-xorm/xorm/postgres_dialect.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// from http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html\nvar (\n\tpostgresReservedWords = map[string]bool{\n\t\t\"A\":                     true,\n\t\t\"ABORT\":                 true,\n\t\t\"ABS\":                   true,\n\t\t\"ABSENT\":                true,\n\t\t\"ABSOLUTE\":              true,\n\t\t\"ACCESS\":                true,\n\t\t\"ACCORDING\":             true,\n\t\t\"ACTION\":                true,\n\t\t\"ADA\":                   true,\n\t\t\"ADD\":                   true,\n\t\t\"ADMIN\":                 true,\n\t\t\"AFTER\":                 true,\n\t\t\"AGGREGATE\":             true,\n\t\t\"ALL\":                   true,\n\t\t\"ALLOCATE\":              true,\n\t\t\"ALSO\":                  true,\n\t\t\"ALTER\":                 true,\n\t\t\"ALWAYS\":                true,\n\t\t\"ANALYSE\":               true,\n\t\t\"ANALYZE\":               true,\n\t\t\"AND\":                   true,\n\t\t\"ANY\":                   true,\n\t\t\"ARE\":                   true,\n\t\t\"ARRAY\":                 true,\n\t\t\"ARRAY_AGG\":             true,\n\t\t\"ARRAY_MAX_CARDINALITY\": true,\n\t\t\"AS\":                               true,\n\t\t\"ASC\":                              true,\n\t\t\"ASENSITIVE\":                       true,\n\t\t\"ASSERTION\":                        true,\n\t\t\"ASSIGNMENT\":                       true,\n\t\t\"ASYMMETRIC\":                       true,\n\t\t\"AT\":                               true,\n\t\t\"ATOMIC\":                           true,\n\t\t\"ATTRIBUTE\":                        true,\n\t\t\"ATTRIBUTES\":                       true,\n\t\t\"AUTHORIZATION\":                    true,\n\t\t\"AVG\":                              true,\n\t\t\"BACKWARD\":                         true,\n\t\t\"BASE64\":                           true,\n\t\t\"BEFORE\":                           true,\n\t\t\"BEGIN\":                            true,\n\t\t\"BEGIN_FRAME\":                      true,\n\t\t\"BEGIN_PARTITION\":                  true,\n\t\t\"BERNOULLI\":                        true,\n\t\t\"BETWEEN\":                          true,\n\t\t\"BIGINT\":                           true,\n\t\t\"BINARY\":                           true,\n\t\t\"BIT\":                              true,\n\t\t\"BIT_LENGTH\":                       true,\n\t\t\"BLOB\":                             true,\n\t\t\"BLOCKED\":                          true,\n\t\t\"BOM\":                              true,\n\t\t\"BOOLEAN\":                          true,\n\t\t\"BOTH\":                             true,\n\t\t\"BREADTH\":                          true,\n\t\t\"BY\":                               true,\n\t\t\"C\":                                true,\n\t\t\"CACHE\":                            true,\n\t\t\"CALL\":                             true,\n\t\t\"CALLED\":                           true,\n\t\t\"CARDINALITY\":                      true,\n\t\t\"CASCADE\":                          true,\n\t\t\"CASCADED\":                         true,\n\t\t\"CASE\":                             true,\n\t\t\"CAST\":                             true,\n\t\t\"CATALOG\":                          true,\n\t\t\"CATALOG_NAME\":                     true,\n\t\t\"CEIL\":                             true,\n\t\t\"CEILING\":                          true,\n\t\t\"CHAIN\":                            true,\n\t\t\"CHAR\":                             true,\n\t\t\"CHARACTER\":                        true,\n\t\t\"CHARACTERISTICS\":                  true,\n\t\t\"CHARACTERS\":                       true,\n\t\t\"CHARACTER_LENGTH\":                 true,\n\t\t\"CHARACTER_SET_CATALOG\":            true,\n\t\t\"CHARACTER_SET_NAME\":               true,\n\t\t\"CHARACTER_SET_SCHEMA\":             true,\n\t\t\"CHAR_LENGTH\":                      true,\n\t\t\"CHECK\":                            true,\n\t\t\"CHECKPOINT\":                       true,\n\t\t\"CLASS\":                            true,\n\t\t\"CLASS_ORIGIN\":                     true,\n\t\t\"CLOB\":                             true,\n\t\t\"CLOSE\":                            true,\n\t\t\"CLUSTER\":                          true,\n\t\t\"COALESCE\":                         true,\n\t\t\"COBOL\":                            true,\n\t\t\"COLLATE\":                          true,\n\t\t\"COLLATION\":                        true,\n\t\t\"COLLATION_CATALOG\":                true,\n\t\t\"COLLATION_NAME\":                   true,\n\t\t\"COLLATION_SCHEMA\":                 true,\n\t\t\"COLLECT\":                          true,\n\t\t\"COLUMN\":                           true,\n\t\t\"COLUMNS\":                          true,\n\t\t\"COLUMN_NAME\":                      true,\n\t\t\"COMMAND_FUNCTION\":                 true,\n\t\t\"COMMAND_FUNCTION_CODE\":            true,\n\t\t\"COMMENT\":                          true,\n\t\t\"COMMENTS\":                         true,\n\t\t\"COMMIT\":                           true,\n\t\t\"COMMITTED\":                        true,\n\t\t\"CONCURRENTLY\":                     true,\n\t\t\"CONDITION\":                        true,\n\t\t\"CONDITION_NUMBER\":                 true,\n\t\t\"CONFIGURATION\":                    true,\n\t\t\"CONNECT\":                          true,\n\t\t\"CONNECTION\":                       true,\n\t\t\"CONNECTION_NAME\":                  true,\n\t\t\"CONSTRAINT\":                       true,\n\t\t\"CONSTRAINTS\":                      true,\n\t\t\"CONSTRAINT_CATALOG\":               true,\n\t\t\"CONSTRAINT_NAME\":                  true,\n\t\t\"CONSTRAINT_SCHEMA\":                true,\n\t\t\"CONSTRUCTOR\":                      true,\n\t\t\"CONTAINS\":                         true,\n\t\t\"CONTENT\":                          true,\n\t\t\"CONTINUE\":                         true,\n\t\t\"CONTROL\":                          true,\n\t\t\"CONVERSION\":                       true,\n\t\t\"CONVERT\":                          true,\n\t\t\"COPY\":                             true,\n\t\t\"CORR\":                             true,\n\t\t\"CORRESPONDING\":                    true,\n\t\t\"COST\":                             true,\n\t\t\"COUNT\":                            true,\n\t\t\"COVAR_POP\":                        true,\n\t\t\"COVAR_SAMP\":                       true,\n\t\t\"CREATE\":                           true,\n\t\t\"CROSS\":                            true,\n\t\t\"CSV\":                              true,\n\t\t\"CUBE\":                             true,\n\t\t\"CUME_DIST\":                        true,\n\t\t\"CURRENT\":                          true,\n\t\t\"CURRENT_CATALOG\":                  true,\n\t\t\"CURRENT_DATE\":                     true,\n\t\t\"CURRENT_DEFAULT_TRANSFORM_GROUP\":  true,\n\t\t\"CURRENT_PATH\":                     true,\n\t\t\"CURRENT_ROLE\":                     true,\n\t\t\"CURRENT_ROW\":                      true,\n\t\t\"CURRENT_SCHEMA\":                   true,\n\t\t\"CURRENT_TIME\":                     true,\n\t\t\"CURRENT_TIMESTAMP\":                true,\n\t\t\"CURRENT_TRANSFORM_GROUP_FOR_TYPE\": true,\n\t\t\"CURRENT_USER\":                     true,\n\t\t\"CURSOR\":                           true,\n\t\t\"CURSOR_NAME\":                      true,\n\t\t\"CYCLE\":                            true,\n\t\t\"DATA\":                             true,\n\t\t\"DATABASE\":                         true,\n\t\t\"DATALINK\":                         true,\n\t\t\"DATE\":                             true,\n\t\t\"DATETIME_INTERVAL_CODE\":      true,\n\t\t\"DATETIME_INTERVAL_PRECISION\": true,\n\t\t\"DAY\":                        true,\n\t\t\"DB\":                         true,\n\t\t\"DEALLOCATE\":                 true,\n\t\t\"DEC\":                        true,\n\t\t\"DECIMAL\":                    true,\n\t\t\"DECLARE\":                    true,\n\t\t\"DEFAULT\":                    true,\n\t\t\"DEFAULTS\":                   true,\n\t\t\"DEFERRABLE\":                 true,\n\t\t\"DEFERRED\":                   true,\n\t\t\"DEFINED\":                    true,\n\t\t\"DEFINER\":                    true,\n\t\t\"DEGREE\":                     true,\n\t\t\"DELETE\":                     true,\n\t\t\"DELIMITER\":                  true,\n\t\t\"DELIMITERS\":                 true,\n\t\t\"DENSE_RANK\":                 true,\n\t\t\"DEPTH\":                      true,\n\t\t\"DEREF\":                      true,\n\t\t\"DERIVED\":                    true,\n\t\t\"DESC\":                       true,\n\t\t\"DESCRIBE\":                   true,\n\t\t\"DESCRIPTOR\":                 true,\n\t\t\"DETERMINISTIC\":              true,\n\t\t\"DIAGNOSTICS\":                true,\n\t\t\"DICTIONARY\":                 true,\n\t\t\"DISABLE\":                    true,\n\t\t\"DISCARD\":                    true,\n\t\t\"DISCONNECT\":                 true,\n\t\t\"DISPATCH\":                   true,\n\t\t\"DISTINCT\":                   true,\n\t\t\"DLNEWCOPY\":                  true,\n\t\t\"DLPREVIOUSCOPY\":             true,\n\t\t\"DLURLCOMPLETE\":              true,\n\t\t\"DLURLCOMPLETEONLY\":          true,\n\t\t\"DLURLCOMPLETEWRITE\":         true,\n\t\t\"DLURLPATH\":                  true,\n\t\t\"DLURLPATHONLY\":              true,\n\t\t\"DLURLPATHWRITE\":             true,\n\t\t\"DLURLSCHEME\":                true,\n\t\t\"DLURLSERVER\":                true,\n\t\t\"DLVALUE\":                    true,\n\t\t\"DO\":                         true,\n\t\t\"DOCUMENT\":                   true,\n\t\t\"DOMAIN\":                     true,\n\t\t\"DOUBLE\":                     true,\n\t\t\"DROP\":                       true,\n\t\t\"DYNAMIC\":                    true,\n\t\t\"DYNAMIC_FUNCTION\":           true,\n\t\t\"DYNAMIC_FUNCTION_CODE\":      true,\n\t\t\"EACH\":                       true,\n\t\t\"ELEMENT\":                    true,\n\t\t\"ELSE\":                       true,\n\t\t\"EMPTY\":                      true,\n\t\t\"ENABLE\":                     true,\n\t\t\"ENCODING\":                   true,\n\t\t\"ENCRYPTED\":                  true,\n\t\t\"END\":                        true,\n\t\t\"END-EXEC\":                   true,\n\t\t\"END_FRAME\":                  true,\n\t\t\"END_PARTITION\":              true,\n\t\t\"ENFORCED\":                   true,\n\t\t\"ENUM\":                       true,\n\t\t\"EQUALS\":                     true,\n\t\t\"ESCAPE\":                     true,\n\t\t\"EVENT\":                      true,\n\t\t\"EVERY\":                      true,\n\t\t\"EXCEPT\":                     true,\n\t\t\"EXCEPTION\":                  true,\n\t\t\"EXCLUDE\":                    true,\n\t\t\"EXCLUDING\":                  true,\n\t\t\"EXCLUSIVE\":                  true,\n\t\t\"EXEC\":                       true,\n\t\t\"EXECUTE\":                    true,\n\t\t\"EXISTS\":                     true,\n\t\t\"EXP\":                        true,\n\t\t\"EXPLAIN\":                    true,\n\t\t\"EXPRESSION\":                 true,\n\t\t\"EXTENSION\":                  true,\n\t\t\"EXTERNAL\":                   true,\n\t\t\"EXTRACT\":                    true,\n\t\t\"FALSE\":                      true,\n\t\t\"FAMILY\":                     true,\n\t\t\"FETCH\":                      true,\n\t\t\"FILE\":                       true,\n\t\t\"FILTER\":                     true,\n\t\t\"FINAL\":                      true,\n\t\t\"FIRST\":                      true,\n\t\t\"FIRST_VALUE\":                true,\n\t\t\"FLAG\":                       true,\n\t\t\"FLOAT\":                      true,\n\t\t\"FLOOR\":                      true,\n\t\t\"FOLLOWING\":                  true,\n\t\t\"FOR\":                        true,\n\t\t\"FORCE\":                      true,\n\t\t\"FOREIGN\":                    true,\n\t\t\"FORTRAN\":                    true,\n\t\t\"FORWARD\":                    true,\n\t\t\"FOUND\":                      true,\n\t\t\"FRAME_ROW\":                  true,\n\t\t\"FREE\":                       true,\n\t\t\"FREEZE\":                     true,\n\t\t\"FROM\":                       true,\n\t\t\"FS\":                         true,\n\t\t\"FULL\":                       true,\n\t\t\"FUNCTION\":                   true,\n\t\t\"FUNCTIONS\":                  true,\n\t\t\"FUSION\":                     true,\n\t\t\"G\":                          true,\n\t\t\"GENERAL\":                    true,\n\t\t\"GENERATED\":                  true,\n\t\t\"GET\":                        true,\n\t\t\"GLOBAL\":                     true,\n\t\t\"GO\":                         true,\n\t\t\"GOTO\":                       true,\n\t\t\"GRANT\":                      true,\n\t\t\"GRANTED\":                    true,\n\t\t\"GREATEST\":                   true,\n\t\t\"GROUP\":                      true,\n\t\t\"GROUPING\":                   true,\n\t\t\"GROUPS\":                     true,\n\t\t\"HANDLER\":                    true,\n\t\t\"HAVING\":                     true,\n\t\t\"HEADER\":                     true,\n\t\t\"HEX\":                        true,\n\t\t\"HIERARCHY\":                  true,\n\t\t\"HOLD\":                       true,\n\t\t\"HOUR\":                       true,\n\t\t\"ID\":                         true,\n\t\t\"IDENTITY\":                   true,\n\t\t\"IF\":                         true,\n\t\t\"IGNORE\":                     true,\n\t\t\"ILIKE\":                      true,\n\t\t\"IMMEDIATE\":                  true,\n\t\t\"IMMEDIATELY\":                true,\n\t\t\"IMMUTABLE\":                  true,\n\t\t\"IMPLEMENTATION\":             true,\n\t\t\"IMPLICIT\":                   true,\n\t\t\"IMPORT\":                     true,\n\t\t\"IN\":                         true,\n\t\t\"INCLUDING\":                  true,\n\t\t\"INCREMENT\":                  true,\n\t\t\"INDENT\":                     true,\n\t\t\"INDEX\":                      true,\n\t\t\"INDEXES\":                    true,\n\t\t\"INDICATOR\":                  true,\n\t\t\"INHERIT\":                    true,\n\t\t\"INHERITS\":                   true,\n\t\t\"INITIALLY\":                  true,\n\t\t\"INLINE\":                     true,\n\t\t\"INNER\":                      true,\n\t\t\"INOUT\":                      true,\n\t\t\"INPUT\":                      true,\n\t\t\"INSENSITIVE\":                true,\n\t\t\"INSERT\":                     true,\n\t\t\"INSTANCE\":                   true,\n\t\t\"INSTANTIABLE\":               true,\n\t\t\"INSTEAD\":                    true,\n\t\t\"INT\":                        true,\n\t\t\"INTEGER\":                    true,\n\t\t\"INTEGRITY\":                  true,\n\t\t\"INTERSECT\":                  true,\n\t\t\"INTERSECTION\":               true,\n\t\t\"INTERVAL\":                   true,\n\t\t\"INTO\":                       true,\n\t\t\"INVOKER\":                    true,\n\t\t\"IS\":                         true,\n\t\t\"ISNULL\":                     true,\n\t\t\"ISOLATION\":                  true,\n\t\t\"JOIN\":                       true,\n\t\t\"K\":                          true,\n\t\t\"KEY\":                        true,\n\t\t\"KEY_MEMBER\":                 true,\n\t\t\"KEY_TYPE\":                   true,\n\t\t\"LABEL\":                      true,\n\t\t\"LAG\":                        true,\n\t\t\"LANGUAGE\":                   true,\n\t\t\"LARGE\":                      true,\n\t\t\"LAST\":                       true,\n\t\t\"LAST_VALUE\":                 true,\n\t\t\"LATERAL\":                    true,\n\t\t\"LC_COLLATE\":                 true,\n\t\t\"LC_CTYPE\":                   true,\n\t\t\"LEAD\":                       true,\n\t\t\"LEADING\":                    true,\n\t\t\"LEAKPROOF\":                  true,\n\t\t\"LEAST\":                      true,\n\t\t\"LEFT\":                       true,\n\t\t\"LENGTH\":                     true,\n\t\t\"LEVEL\":                      true,\n\t\t\"LIBRARY\":                    true,\n\t\t\"LIKE\":                       true,\n\t\t\"LIKE_REGEX\":                 true,\n\t\t\"LIMIT\":                      true,\n\t\t\"LINK\":                       true,\n\t\t\"LISTEN\":                     true,\n\t\t\"LN\":                         true,\n\t\t\"LOAD\":                       true,\n\t\t\"LOCAL\":                      true,\n\t\t\"LOCALTIME\":                  true,\n\t\t\"LOCALTIMESTAMP\":             true,\n\t\t\"LOCATION\":                   true,\n\t\t\"LOCATOR\":                    true,\n\t\t\"LOCK\":                       true,\n\t\t\"LOWER\":                      true,\n\t\t\"M\":                          true,\n\t\t\"MAP\":                        true,\n\t\t\"MAPPING\":                    true,\n\t\t\"MATCH\":                      true,\n\t\t\"MATCHED\":                    true,\n\t\t\"MATERIALIZED\":               true,\n\t\t\"MAX\":                        true,\n\t\t\"MAXVALUE\":                   true,\n\t\t\"MAX_CARDINALITY\":            true,\n\t\t\"MEMBER\":                     true,\n\t\t\"MERGE\":                      true,\n\t\t\"MESSAGE_LENGTH\":             true,\n\t\t\"MESSAGE_OCTET_LENGTH\":       true,\n\t\t\"MESSAGE_TEXT\":               true,\n\t\t\"METHOD\":                     true,\n\t\t\"MIN\":                        true,\n\t\t\"MINUTE\":                     true,\n\t\t\"MINVALUE\":                   true,\n\t\t\"MOD\":                        true,\n\t\t\"MODE\":                       true,\n\t\t\"MODIFIES\":                   true,\n\t\t\"MODULE\":                     true,\n\t\t\"MONTH\":                      true,\n\t\t\"MORE\":                       true,\n\t\t\"MOVE\":                       true,\n\t\t\"MULTISET\":                   true,\n\t\t\"MUMPS\":                      true,\n\t\t\"NAME\":                       true,\n\t\t\"NAMES\":                      true,\n\t\t\"NAMESPACE\":                  true,\n\t\t\"NATIONAL\":                   true,\n\t\t\"NATURAL\":                    true,\n\t\t\"NCHAR\":                      true,\n\t\t\"NCLOB\":                      true,\n\t\t\"NESTING\":                    true,\n\t\t\"NEW\":                        true,\n\t\t\"NEXT\":                       true,\n\t\t\"NFC\":                        true,\n\t\t\"NFD\":                        true,\n\t\t\"NFKC\":                       true,\n\t\t\"NFKD\":                       true,\n\t\t\"NIL\":                        true,\n\t\t\"NO\":                         true,\n\t\t\"NONE\":                       true,\n\t\t\"NORMALIZE\":                  true,\n\t\t\"NORMALIZED\":                 true,\n\t\t\"NOT\":                        true,\n\t\t\"NOTHING\":                    true,\n\t\t\"NOTIFY\":                     true,\n\t\t\"NOTNULL\":                    true,\n\t\t\"NOWAIT\":                     true,\n\t\t\"NTH_VALUE\":                  true,\n\t\t\"NTILE\":                      true,\n\t\t\"NULL\":                       true,\n\t\t\"NULLABLE\":                   true,\n\t\t\"NULLIF\":                     true,\n\t\t\"NULLS\":                      true,\n\t\t\"NUMBER\":                     true,\n\t\t\"NUMERIC\":                    true,\n\t\t\"OBJECT\":                     true,\n\t\t\"OCCURRENCES_REGEX\":          true,\n\t\t\"OCTETS\":                     true,\n\t\t\"OCTET_LENGTH\":               true,\n\t\t\"OF\":                         true,\n\t\t\"OFF\":                        true,\n\t\t\"OFFSET\":                     true,\n\t\t\"OIDS\":                       true,\n\t\t\"OLD\":                        true,\n\t\t\"ON\":                         true,\n\t\t\"ONLY\":                       true,\n\t\t\"OPEN\":                       true,\n\t\t\"OPERATOR\":                   true,\n\t\t\"OPTION\":                     true,\n\t\t\"OPTIONS\":                    true,\n\t\t\"OR\":                         true,\n\t\t\"ORDER\":                      true,\n\t\t\"ORDERING\":                   true,\n\t\t\"ORDINALITY\":                 true,\n\t\t\"OTHERS\":                     true,\n\t\t\"OUT\":                        true,\n\t\t\"OUTER\":                      true,\n\t\t\"OUTPUT\":                     true,\n\t\t\"OVER\":                       true,\n\t\t\"OVERLAPS\":                   true,\n\t\t\"OVERLAY\":                    true,\n\t\t\"OVERRIDING\":                 true,\n\t\t\"OWNED\":                      true,\n\t\t\"OWNER\":                      true,\n\t\t\"P\":                          true,\n\t\t\"PAD\":                        true,\n\t\t\"PARAMETER\":                  true,\n\t\t\"PARAMETER_MODE\":             true,\n\t\t\"PARAMETER_NAME\":             true,\n\t\t\"PARAMETER_ORDINAL_POSITION\": true,\n\t\t\"PARAMETER_SPECIFIC_CATALOG\": true,\n\t\t\"PARAMETER_SPECIFIC_NAME\":    true,\n\t\t\"PARAMETER_SPECIFIC_SCHEMA\":  true,\n\t\t\"PARSER\":                     true,\n\t\t\"PARTIAL\":                    true,\n\t\t\"PARTITION\":                  true,\n\t\t\"PASCAL\":                     true,\n\t\t\"PASSING\":                    true,\n\t\t\"PASSTHROUGH\":                true,\n\t\t\"PASSWORD\":                   true,\n\t\t\"PATH\":                       true,\n\t\t\"PERCENT\":                    true,\n\t\t\"PERCENTILE_CONT\":            true,\n\t\t\"PERCENTILE_DISC\":            true,\n\t\t\"PERCENT_RANK\":               true,\n\t\t\"PERIOD\":                     true,\n\t\t\"PERMISSION\":                 true,\n\t\t\"PLACING\":                    true,\n\t\t\"PLANS\":                      true,\n\t\t\"PLI\":                        true,\n\t\t\"PORTION\":                    true,\n\t\t\"POSITION\":                   true,\n\t\t\"POSITION_REGEX\":             true,\n\t\t\"POWER\":                      true,\n\t\t\"PRECEDES\":                   true,\n\t\t\"PRECEDING\":                  true,\n\t\t\"PRECISION\":                  true,\n\t\t\"PREPARE\":                    true,\n\t\t\"PREPARED\":                   true,\n\t\t\"PRESERVE\":                   true,\n\t\t\"PRIMARY\":                    true,\n\t\t\"PRIOR\":                      true,\n\t\t\"PRIVILEGES\":                 true,\n\t\t\"PROCEDURAL\":                 true,\n\t\t\"PROCEDURE\":                  true,\n\t\t\"PROGRAM\":                    true,\n\t\t\"PUBLIC\":                     true,\n\t\t\"QUOTE\":                      true,\n\t\t\"RANGE\":                      true,\n\t\t\"RANK\":                       true,\n\t\t\"READ\":                       true,\n\t\t\"READS\":                      true,\n\t\t\"REAL\":                       true,\n\t\t\"REASSIGN\":                   true,\n\t\t\"RECHECK\":                    true,\n\t\t\"RECOVERY\":                   true,\n\t\t\"RECURSIVE\":                  true,\n\t\t\"REF\":                        true,\n\t\t\"REFERENCES\":                 true,\n\t\t\"REFERENCING\":                true,\n\t\t\"REFRESH\":                    true,\n\t\t\"REGR_AVGX\":                  true,\n\t\t\"REGR_AVGY\":                  true,\n\t\t\"REGR_COUNT\":                 true,\n\t\t\"REGR_INTERCEPT\":             true,\n\t\t\"REGR_R2\":                    true,\n\t\t\"REGR_SLOPE\":                 true,\n\t\t\"REGR_SXX\":                   true,\n\t\t\"REGR_SXY\":                   true,\n\t\t\"REGR_SYY\":                   true,\n\t\t\"REINDEX\":                    true,\n\t\t\"RELATIVE\":                   true,\n\t\t\"RELEASE\":                    true,\n\t\t\"RENAME\":                     true,\n\t\t\"REPEATABLE\":                 true,\n\t\t\"REPLACE\":                    true,\n\t\t\"REPLICA\":                    true,\n\t\t\"REQUIRING\":                  true,\n\t\t\"RESET\":                      true,\n\t\t\"RESPECT\":                    true,\n\t\t\"RESTART\":                    true,\n\t\t\"RESTORE\":                    true,\n\t\t\"RESTRICT\":                   true,\n\t\t\"RESULT\":                     true,\n\t\t\"RETURN\":                     true,\n\t\t\"RETURNED_CARDINALITY\":       true,\n\t\t\"RETURNED_LENGTH\":            true,\n\t\t\"RETURNED_OCTET_LENGTH\":      true,\n\t\t\"RETURNED_SQLSTATE\":          true,\n\t\t\"RETURNING\":                  true,\n\t\t\"RETURNS\":                    true,\n\t\t\"REVOKE\":                     true,\n\t\t\"RIGHT\":                      true,\n\t\t\"ROLE\":                       true,\n\t\t\"ROLLBACK\":                   true,\n\t\t\"ROLLUP\":                     true,\n\t\t\"ROUTINE\":                    true,\n\t\t\"ROUTINE_CATALOG\":            true,\n\t\t\"ROUTINE_NAME\":               true,\n\t\t\"ROUTINE_SCHEMA\":             true,\n\t\t\"ROW\":                        true,\n\t\t\"ROWS\":                       true,\n\t\t\"ROW_COUNT\":                  true,\n\t\t\"ROW_NUMBER\":                 true,\n\t\t\"RULE\":                       true,\n\t\t\"SAVEPOINT\":                  true,\n\t\t\"SCALE\":                      true,\n\t\t\"SCHEMA\":                     true,\n\t\t\"SCHEMA_NAME\":                true,\n\t\t\"SCOPE\":                      true,\n\t\t\"SCOPE_CATALOG\":              true,\n\t\t\"SCOPE_NAME\":                 true,\n\t\t\"SCOPE_SCHEMA\":               true,\n\t\t\"SCROLL\":                     true,\n\t\t\"SEARCH\":                     true,\n\t\t\"SECOND\":                     true,\n\t\t\"SECTION\":                    true,\n\t\t\"SECURITY\":                   true,\n\t\t\"SELECT\":                     true,\n\t\t\"SELECTIVE\":                  true,\n\t\t\"SELF\":                       true,\n\t\t\"SENSITIVE\":                  true,\n\t\t\"SEQUENCE\":                   true,\n\t\t\"SEQUENCES\":                  true,\n\t\t\"SERIALIZABLE\":               true,\n\t\t\"SERVER\":                     true,\n\t\t\"SERVER_NAME\":                true,\n\t\t\"SESSION\":                    true,\n\t\t\"SESSION_USER\":               true,\n\t\t\"SET\":                        true,\n\t\t\"SETOF\":                      true,\n\t\t\"SETS\":                       true,\n\t\t\"SHARE\":                      true,\n\t\t\"SHOW\":                       true,\n\t\t\"SIMILAR\":                    true,\n\t\t\"SIMPLE\":                     true,\n\t\t\"SIZE\":                       true,\n\t\t\"SMALLINT\":                   true,\n\t\t\"SNAPSHOT\":                   true,\n\t\t\"SOME\":                       true,\n\t\t\"SOURCE\":                     true,\n\t\t\"SPACE\":                      true,\n\t\t\"SPECIFIC\":                   true,\n\t\t\"SPECIFICTYPE\":               true,\n\t\t\"SPECIFIC_NAME\":              true,\n\t\t\"SQL\":                        true,\n\t\t\"SQLCODE\":                    true,\n\t\t\"SQLERROR\":                   true,\n\t\t\"SQLEXCEPTION\":               true,\n\t\t\"SQLSTATE\":                   true,\n\t\t\"SQLWARNING\":                 true,\n\t\t\"SQRT\":                       true,\n\t\t\"STABLE\":                     true,\n\t\t\"STANDALONE\":                 true,\n\t\t\"START\":                      true,\n\t\t\"STATE\":                      true,\n\t\t\"STATEMENT\":                  true,\n\t\t\"STATIC\":                     true,\n\t\t\"STATISTICS\":                 true,\n\t\t\"STDDEV_POP\":                 true,\n\t\t\"STDDEV_SAMP\":                true,\n\t\t\"STDIN\":                      true,\n\t\t\"STDOUT\":                     true,\n\t\t\"STORAGE\":                    true,\n\t\t\"STRICT\":                     true,\n\t\t\"STRIP\":                      true,\n\t\t\"STRUCTURE\":                  true,\n\t\t\"STYLE\":                      true,\n\t\t\"SUBCLASS_ORIGIN\":            true,\n\t\t\"SUBMULTISET\":                true,\n\t\t\"SUBSTRING\":                  true,\n\t\t\"SUBSTRING_REGEX\":            true,\n\t\t\"SUCCEEDS\":                   true,\n\t\t\"SUM\":                        true,\n\t\t\"SYMMETRIC\":                  true,\n\t\t\"SYSID\":                      true,\n\t\t\"SYSTEM\":                     true,\n\t\t\"SYSTEM_TIME\":                true,\n\t\t\"SYSTEM_USER\":                true,\n\t\t\"T\":                          true,\n\t\t\"TABLE\":                      true,\n\t\t\"TABLES\":                     true,\n\t\t\"TABLESAMPLE\":                true,\n\t\t\"TABLESPACE\":                 true,\n\t\t\"TABLE_NAME\":                 true,\n\t\t\"TEMP\":                       true,\n\t\t\"TEMPLATE\":                   true,\n\t\t\"TEMPORARY\":                  true,\n\t\t\"TEXT\":                       true,\n\t\t\"THEN\":                       true,\n\t\t\"TIES\":                       true,\n\t\t\"TIME\":                       true,\n\t\t\"TIMESTAMP\":                  true,\n\t\t\"TIMEZONE_HOUR\":              true,\n\t\t\"TIMEZONE_MINUTE\":            true,\n\t\t\"TO\":                         true,\n\t\t\"TOKEN\":                      true,\n\t\t\"TOP_LEVEL_COUNT\":            true,\n\t\t\"TRAILING\":                   true,\n\t\t\"TRANSACTION\":                true,\n\t\t\"TRANSACTIONS_COMMITTED\":     true,\n\t\t\"TRANSACTIONS_ROLLED_BACK\":   true,\n\t\t\"TRANSACTION_ACTIVE\":         true,\n\t\t\"TRANSFORM\":                  true,\n\t\t\"TRANSFORMS\":                 true,\n\t\t\"TRANSLATE\":                  true,\n\t\t\"TRANSLATE_REGEX\":            true,\n\t\t\"TRANSLATION\":                true,\n\t\t\"TREAT\":                      true,\n\t\t\"TRIGGER\":                    true,\n\t\t\"TRIGGER_CATALOG\":            true,\n\t\t\"TRIGGER_NAME\":               true,\n\t\t\"TRIGGER_SCHEMA\":             true,\n\t\t\"TRIM\":                       true,\n\t\t\"TRIM_ARRAY\":                 true,\n\t\t\"TRUE\":                       true,\n\t\t\"TRUNCATE\":                   true,\n\t\t\"TRUSTED\":                    true,\n\t\t\"TYPE\":                       true,\n\t\t\"TYPES\":                      true,\n\t\t\"UESCAPE\":                    true,\n\t\t\"UNBOUNDED\":                  true,\n\t\t\"UNCOMMITTED\":                true,\n\t\t\"UNDER\":                      true,\n\t\t\"UNENCRYPTED\":                true,\n\t\t\"UNION\":                      true,\n\t\t\"UNIQUE\":                     true,\n\t\t\"UNKNOWN\":                    true,\n\t\t\"UNLINK\":                     true,\n\t\t\"UNLISTEN\":                   true,\n\t\t\"UNLOGGED\":                   true,\n\t\t\"UNNAMED\":                    true,\n\t\t\"UNNEST\":                     true,\n\t\t\"UNTIL\":                      true,\n\t\t\"UNTYPED\":                    true,\n\t\t\"UPDATE\":                     true,\n\t\t\"UPPER\":                      true,\n\t\t\"URI\":                        true,\n\t\t\"USAGE\":                      true,\n\t\t\"USER\":                       true,\n\t\t\"USER_DEFINED_TYPE_CATALOG\": true,\n\t\t\"USER_DEFINED_TYPE_CODE\":    true,\n\t\t\"USER_DEFINED_TYPE_NAME\":    true,\n\t\t\"USER_DEFINED_TYPE_SCHEMA\":  true,\n\t\t\"USING\":                     true,\n\t\t\"VACUUM\":                    true,\n\t\t\"VALID\":                     true,\n\t\t\"VALIDATE\":                  true,\n\t\t\"VALIDATOR\":                 true,\n\t\t\"VALUE\":                     true,\n\t\t\"VALUES\":                    true,\n\t\t\"VALUE_OF\":                  true,\n\t\t\"VARBINARY\":                 true,\n\t\t\"VARCHAR\":                   true,\n\t\t\"VARIADIC\":                  true,\n\t\t\"VARYING\":                   true,\n\t\t\"VAR_POP\":                   true,\n\t\t\"VAR_SAMP\":                  true,\n\t\t\"VERBOSE\":                   true,\n\t\t\"VERSION\":                   true,\n\t\t\"VERSIONING\":                true,\n\t\t\"VIEW\":                      true,\n\t\t\"VOLATILE\":                  true,\n\t\t\"WHEN\":                      true,\n\t\t\"WHENEVER\":                  true,\n\t\t\"WHERE\":                     true,\n\t\t\"WHITESPACE\":                true,\n\t\t\"WIDTH_BUCKET\":              true,\n\t\t\"WINDOW\":                    true,\n\t\t\"WITH\":                      true,\n\t\t\"WITHIN\":                    true,\n\t\t\"WITHOUT\":                   true,\n\t\t\"WORK\":                      true,\n\t\t\"WRAPPER\":                   true,\n\t\t\"WRITE\":                     true,\n\t\t\"XML\":                       true,\n\t\t\"XMLAGG\":                    true,\n\t\t\"XMLATTRIBUTES\":             true,\n\t\t\"XMLBINARY\":                 true,\n\t\t\"XMLCAST\":                   true,\n\t\t\"XMLCOMMENT\":                true,\n\t\t\"XMLCONCAT\":                 true,\n\t\t\"XMLDECLARATION\":            true,\n\t\t\"XMLDOCUMENT\":               true,\n\t\t\"XMLELEMENT\":                true,\n\t\t\"XMLEXISTS\":                 true,\n\t\t\"XMLFOREST\":                 true,\n\t\t\"XMLITERATE\":                true,\n\t\t\"XMLNAMESPACES\":             true,\n\t\t\"XMLPARSE\":                  true,\n\t\t\"XMLPI\":                     true,\n\t\t\"XMLQUERY\":                  true,\n\t\t\"XMLROOT\":                   true,\n\t\t\"XMLSCHEMA\":                 true,\n\t\t\"XMLSERIALIZE\":              true,\n\t\t\"XMLTABLE\":                  true,\n\t\t\"XMLTEXT\":                   true,\n\t\t\"XMLVALIDATE\":               true,\n\t\t\"YEAR\":                      true,\n\t\t\"YES\":                       true,\n\t\t\"ZONE\":                      true,\n\t}\n)\n\ntype postgres struct {\n\tcore.Base\n}\n\nfunc (db *postgres) Init(d *core.DB, uri *core.Uri, drivername, dataSourceName string) error {\n\treturn db.Base.Init(d, db, uri, drivername, dataSourceName)\n}\n\nfunc (db *postgres) SqlType(c *core.Column) string {\n\tvar res string\n\tswitch t := c.SQLType.Name; t {\n\tcase core.TinyInt:\n\t\tres = core.SmallInt\n\t\treturn res\n\tcase core.MediumInt, core.Int, core.Integer:\n\t\tif c.IsAutoIncrement {\n\t\t\treturn core.Serial\n\t\t}\n\t\treturn core.Integer\n\tcase core.Serial, core.BigSerial:\n\t\tc.IsAutoIncrement = true\n\t\tc.Nullable = false\n\t\tres = t\n\tcase core.Binary, core.VarBinary:\n\t\treturn core.Bytea\n\tcase core.DateTime:\n\t\tres = core.TimeStamp\n\tcase core.TimeStampz:\n\t\treturn \"timestamp with time zone\"\n\tcase core.Float:\n\t\tres = core.Real\n\tcase core.TinyText, core.MediumText, core.LongText:\n\t\tres = core.Text\n\tcase core.NVarchar:\n\t\tres = core.Varchar\n\tcase core.Uuid:\n\t\tres = core.Uuid\n\tcase core.Blob, core.TinyBlob, core.MediumBlob, core.LongBlob:\n\t\treturn core.Bytea\n\tcase core.Double:\n\t\treturn \"DOUBLE PRECISION\"\n\tdefault:\n\t\tif c.IsAutoIncrement {\n\t\t\treturn core.Serial\n\t\t}\n\t\tres = t\n\t}\n\n\tvar hasLen1 bool = (c.Length > 0)\n\tvar hasLen2 bool = (c.Length2 > 0)\n\tif hasLen2 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \",\" + strconv.Itoa(c.Length2) + \")\"\n\t} else if hasLen1 {\n\t\tres += \"(\" + strconv.Itoa(c.Length) + \")\"\n\t}\n\treturn res\n}\n\nfunc (db *postgres) SupportInsertMany() bool {\n\treturn true\n}\n\nfunc (db *postgres) IsReserved(name string) bool {\n\t_, ok := postgresReservedWords[name]\n\treturn ok\n}\n\nfunc (db *postgres) Quote(name string) string {\n\tname = strings.Replace(name, \".\", `\".\"`, -1)\n\treturn \"\\\"\" + name + \"\\\"\"\n}\n\nfunc (db *postgres) QuoteStr() string {\n\treturn \"\\\"\"\n}\n\nfunc (db *postgres) AutoIncrStr() string {\n\treturn \"\"\n}\n\nfunc (db *postgres) SupportEngine() bool {\n\treturn false\n}\n\nfunc (db *postgres) SupportCharset() bool {\n\treturn false\n}\n\nfunc (db *postgres) IndexOnTable() bool {\n\treturn false\n}\n\nfunc (db *postgres) IndexCheckSql(tableName, idxName string) (string, []interface{}) {\n\targs := []interface{}{tableName, idxName}\n\treturn `SELECT indexname FROM pg_indexes ` +\n\t\t`WHERE tablename = ? AND indexname = ?`, args\n}\n\nfunc (db *postgres) TableCheckSql(tableName string) (string, []interface{}) {\n\targs := []interface{}{tableName}\n\treturn `SELECT tablename FROM pg_tables WHERE tablename = ?`, args\n}\n\n/*func (db *postgres) ColumnCheckSql(tableName, colName string) (string, []interface{}) {\n\targs := []interface{}{tableName, colName}\n\treturn \"SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ?\" +\n\t\t\" AND column_name = ?\", args\n}*/\n\nfunc (db *postgres) ModifyColumnSql(tableName string, col *core.Column) string {\n\treturn fmt.Sprintf(\"alter table %s ALTER COLUMN %s TYPE %s\",\n\t\ttableName, col.Name, db.SqlType(col))\n}\n\nfunc (db *postgres) DropIndexSql(tableName string, index *core.Index) string {\n\tquote := db.Quote\n\t//var unique string\n\tvar idxName string = index.Name\n\tif !strings.HasPrefix(idxName, \"UQE_\") &&\n\t\t!strings.HasPrefix(idxName, \"IDX_\") {\n\t\tif index.Type == core.UniqueType {\n\t\t\tidxName = fmt.Sprintf(\"UQE_%v_%v\", tableName, index.Name)\n\t\t} else {\n\t\t\tidxName = fmt.Sprintf(\"IDX_%v_%v\", tableName, index.Name)\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"DROP INDEX %v\", quote(idxName))\n}\n\nfunc (db *postgres) IsColumnExist(tableName, colName string) (bool, error) {\n\targs := []interface{}{tableName, colName}\n\tquery := \"SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $1\" +\n\t\t\" AND column_name = $2\"\n\tdb.LogSQL(query, args)\n\n\trows, err := db.DB().Query(query, args...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer rows.Close()\n\n\treturn rows.Next(), nil\n}\n\nfunc (db *postgres) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {\n\t// FIXME: the schema should be replaced by user custom's\n\targs := []interface{}{tableName, \"public\"}\n\ts := `SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix ,\n    CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,\n    CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey\nFROM pg_attribute f\n    JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid\n    LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum\n    LEFT JOIN pg_namespace n ON n.oid = c.relnamespace\n    LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey)\n    LEFT JOIN pg_class AS g ON p.confrelid = g.oid\n    LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name\nWHERE c.relkind = 'r'::char AND c.relname = $1 AND s.table_schema = $2 AND f.attnum > 0 ORDER BY f.attnum;`\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer rows.Close()\n\n\tcols := make(map[string]*core.Column)\n\tcolSeq := make([]string, 0)\n\n\tfor rows.Next() {\n\t\tcol := new(core.Column)\n\t\tcol.Indexes = make(map[string]int)\n\n\t\tvar colName, isNullable, dataType string\n\t\tvar maxLenStr, colDefault, numPrecision, numRadix *string\n\t\tvar isPK, isUnique bool\n\t\terr = rows.Scan(&colName, &colDefault, &isNullable, &dataType, &maxLenStr, &numPrecision, &numRadix, &isPK, &isUnique)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t//fmt.Println(args, colName, isNullable, dataType, maxLenStr, colDefault, numPrecision, numRadix, isPK, isUnique)\n\t\tvar maxLen int\n\t\tif maxLenStr != nil {\n\t\t\tmaxLen, err = strconv.Atoi(*maxLenStr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t}\n\n\t\tcol.Name = strings.Trim(colName, `\" `)\n\n\t\tif colDefault != nil || isPK {\n\t\t\tif isPK {\n\t\t\t\tcol.IsPrimaryKey = true\n\t\t\t} else {\n\t\t\t\tcol.Default = *colDefault\n\t\t\t}\n\t\t}\n\n\t\tif colDefault != nil && strings.HasPrefix(*colDefault, \"nextval(\") {\n\t\t\tcol.IsAutoIncrement = true\n\t\t}\n\n\t\tcol.Nullable = (isNullable == \"YES\")\n\n\t\tswitch dataType {\n\t\tcase \"character varying\", \"character\":\n\t\t\tcol.SQLType = core.SQLType{core.Varchar, 0, 0}\n\t\tcase \"timestamp without time zone\":\n\t\t\tcol.SQLType = core.SQLType{core.DateTime, 0, 0}\n\t\tcase \"timestamp with time zone\":\n\t\t\tcol.SQLType = core.SQLType{core.TimeStampz, 0, 0}\n\t\tcase \"double precision\":\n\t\t\tcol.SQLType = core.SQLType{core.Double, 0, 0}\n\t\tcase \"boolean\":\n\t\t\tcol.SQLType = core.SQLType{core.Bool, 0, 0}\n\t\tcase \"time without time zone\":\n\t\t\tcol.SQLType = core.SQLType{core.Time, 0, 0}\n\t\tcase \"oid\":\n\t\t\tcol.SQLType = core.SQLType{core.BigInt, 0, 0}\n\t\tdefault:\n\t\t\tcol.SQLType = core.SQLType{strings.ToUpper(dataType), 0, 0}\n\t\t}\n\t\tif _, ok := core.SqlTypes[col.SQLType.Name]; !ok {\n\t\t\treturn nil, nil, errors.New(fmt.Sprintf(\"unknow colType: %v\", dataType))\n\t\t}\n\n\t\tcol.Length = maxLen\n\n\t\tif col.SQLType.IsText() || col.SQLType.IsTime() {\n\t\t\tif col.Default != \"\" {\n\t\t\t\tcol.Default = \"'\" + col.Default + \"'\"\n\t\t\t} else {\n\t\t\t\tif col.DefaultIsEmpty {\n\t\t\t\t\tcol.Default = \"''\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcols[col.Name] = col\n\t\tcolSeq = append(colSeq, col.Name)\n\t}\n\n\treturn colSeq, cols, nil\n}\n\nfunc (db *postgres) GetTables() ([]*core.Table, error) {\n\t// FIXME: replace public to user customrize schema\n\targs := []interface{}{\"public\"}\n\ts := fmt.Sprintf(\"SELECT tablename FROM pg_tables WHERE schemaname = $1\")\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttables := make([]*core.Table, 0)\n\tfor rows.Next() {\n\t\ttable := core.NewEmptyTable()\n\t\tvar name string\n\t\terr = rows.Scan(&name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttable.Name = name\n\t\ttables = append(tables, table)\n\t}\n\treturn tables, nil\n}\n\nfunc (db *postgres) GetIndexes(tableName string) (map[string]*core.Index, error) {\n\t// FIXME: replace the public schema to user specify schema\n\targs := []interface{}{\"public\", tableName}\n\ts := fmt.Sprintf(\"SELECT indexname, indexdef FROM pg_indexes WHERE schemaname=$1 AND tablename=$2\")\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tindexes := make(map[string]*core.Index, 0)\n\tfor rows.Next() {\n\t\tvar indexType int\n\t\tvar indexName, indexdef string\n\t\tvar colNames []string\n\t\terr = rows.Scan(&indexName, &indexdef)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tindexName = strings.Trim(indexName, `\" `)\n\t\tif strings.HasSuffix(indexName, \"_pkey\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(indexdef, \"CREATE UNIQUE INDEX\") {\n\t\t\tindexType = core.UniqueType\n\t\t} else {\n\t\t\tindexType = core.IndexType\n\t\t}\n\t\tcs := strings.Split(indexdef, \"(\")\n\t\tcolNames = strings.Split(cs[1][0:len(cs[1])-1], \",\")\n\n\t\tif strings.HasPrefix(indexName, \"IDX_\"+tableName) || strings.HasPrefix(indexName, \"UQE_\"+tableName) {\n\t\t\tnewIdxName := indexName[5+len(tableName) : len(indexName)]\n\t\t\tif newIdxName != \"\" {\n\t\t\t\tindexName = newIdxName\n\t\t\t}\n\t\t}\n\n\t\tindex := &core.Index{Name: indexName, Type: indexType, Cols: make([]string, 0)}\n\t\tfor _, colName := range colNames {\n\t\t\tindex.Cols = append(index.Cols, strings.Trim(colName, `\" `))\n\t\t}\n\t\tindexes[index.Name] = index\n\t}\n\treturn indexes, nil\n}\n\nfunc (db *postgres) Filters() []core.Filter {\n\treturn []core.Filter{&core.IdFilter{}, &core.QuoteFilter{}, &core.SeqFilter{\"$\", 1}}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/pq_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"net/url\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype pqDriver struct {\n}\n\ntype values map[string]string\n\nfunc (vs values) Set(k, v string) {\n\tvs[k] = v\n}\n\nfunc (vs values) Get(k string) (v string) {\n\treturn vs[k]\n}\n\nfunc errorf(s string, args ...interface{}) {\n\tpanic(fmt.Errorf(\"pq: %s\", fmt.Sprintf(s, args...)))\n}\n\nfunc parseURL(connstr string) (string, error) {\n\tu, err := url.Parse(connstr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif u.Scheme != \"postgresql\" && u.Scheme != \"postgres\" {\n\t\treturn \"\", fmt.Errorf(\"invalid connection protocol: %s\", u.Scheme)\n\t}\n\n\tvar kvs []string\n\tescaper := strings.NewReplacer(` `, `\\ `, `'`, `\\'`, `\\`, `\\\\`)\n\taccrue := func(k, v string) {\n\t\tif v != \"\" {\n\t\t\tkvs = append(kvs, k+\"=\"+escaper.Replace(v))\n\t\t}\n\t}\n\n\tif u.User != nil {\n\t\tv := u.User.Username()\n\t\taccrue(\"user\", v)\n\n\t\tv, _ = u.User.Password()\n\t\taccrue(\"password\", v)\n\t}\n\n\ti := strings.Index(u.Host, \":\")\n\tif i < 0 {\n\t\taccrue(\"host\", u.Host)\n\t} else {\n\t\taccrue(\"host\", u.Host[:i])\n\t\taccrue(\"port\", u.Host[i+1:])\n\t}\n\n\tif u.Path != \"\" {\n\t\taccrue(\"dbname\", u.Path[1:])\n\t}\n\n\tq := u.Query()\n\tfor k := range q {\n\t\taccrue(k, q.Get(k))\n\t}\n\n\tsort.Strings(kvs) // Makes testing easier (not a performance concern)\n\treturn strings.Join(kvs, \" \"), nil\n}\n\nfunc parseOpts(name string, o values) {\n\tif len(name) == 0 {\n\t\treturn\n\t}\n\n\tname = strings.TrimSpace(name)\n\n\tps := strings.Split(name, \" \")\n\tfor _, p := range ps {\n\t\tkv := strings.Split(p, \"=\")\n\t\tif len(kv) < 2 {\n\t\t\terrorf(\"invalid option: %q\", p)\n\t\t}\n\t\to.Set(kv[0], kv[1])\n\t}\n}\n\nfunc (p *pqDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\tdb := &core.Uri{DbType: core.POSTGRES}\n\to := make(values)\n\tvar err error\n\tif strings.HasPrefix(dataSourceName, \"postgresql://\") || strings.HasPrefix(dataSourceName, \"postgres://\") {\n\t\tdataSourceName, err = parseURL(dataSourceName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tparseOpts(dataSourceName, o)\n\n\tdb.DbName = o.Get(\"dbname\")\n\tif db.DbName == \"\" {\n\t\treturn nil, errors.New(\"dbname is empty\")\n\t}\n\t/*db.Schema = o.Get(\"schema\")\n\tif len(db.Schema) == 0 {\n\t\tdb.Schema = \"public\"\n\t}*/\n\treturn db, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/processors.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\n// Executed before an object is initially persisted to the database\ntype BeforeInsertProcessor interface {\n\tBeforeInsert()\n}\n\n// Executed before an object is updated\ntype BeforeUpdateProcessor interface {\n\tBeforeUpdate()\n}\n\n// Executed before an object is deleted\ntype BeforeDeleteProcessor interface {\n\tBeforeDelete()\n}\n\ntype BeforeSetProcessor interface {\n\tBeforeSet(string, Cell)\n}\n\ntype AfterSetProcessor interface {\n\tAfterSet(string, Cell)\n}\n\n// !nashtsai! TODO enable BeforeValidateProcessor when xorm start to support validations\n//// Executed before an object is validated\n//type BeforeValidateProcessor interface {\n//    BeforeValidate()\n//}\n// --\n\n// Executed after an object is persisted to the database\ntype AfterInsertProcessor interface {\n\tAfterInsert()\n}\n\n// Executed after an object has been updated\ntype AfterUpdateProcessor interface {\n\tAfterUpdate()\n}\n\n// Executed after an object has been deleted\ntype AfterDeleteProcessor interface {\n\tAfterDelete()\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/rows.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"database/sql\"\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// Rows rows wrapper a rows to\ntype Rows struct {\n\tNoTypeCheck bool\n\n\tsession     *Session\n\tstmt        *core.Stmt\n\trows        *core.Rows\n\tfields      []string\n\tfieldsCount int\n\tbeanType    reflect.Type\n\tlastError   error\n}\n\nfunc newRows(session *Session, bean interface{}) (*Rows, error) {\n\trows := new(Rows)\n\trows.session = session\n\trows.beanType = reflect.Indirect(reflect.ValueOf(bean)).Type()\n\n\tdefer rows.session.resetStatement()\n\n\tvar sqlStr string\n\tvar args []interface{}\n\n\trows.session.Statement.setRefValue(rValue(bean))\n\tif len(session.Statement.TableName()) <= 0 {\n\t\treturn nil, ErrTableNotFound\n\t}\n\n\tif rows.session.Statement.RawSQL == \"\" {\n\t\tsqlStr, args = rows.session.Statement.genGetSql(bean)\n\t} else {\n\t\tsqlStr = rows.session.Statement.RawSQL\n\t\targs = rows.session.Statement.RawParams\n\t}\n\n\tfor _, filter := range rows.session.Engine.dialect.Filters() {\n\t\tsqlStr = filter.Do(sqlStr, session.Engine.dialect, rows.session.Statement.RefTable)\n\t}\n\n\trows.session.saveLastSQL(sqlStr, args)\n\tvar err error\n\tif rows.session.prepareStmt {\n\t\trows.stmt, err = rows.session.DB().Prepare(sqlStr)\n\t\tif err != nil {\n\t\t\trows.lastError = err\n\t\t\trows.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\trows.rows, err = rows.stmt.Query(args...)\n\t\tif err != nil {\n\t\t\trows.lastError = err\n\t\t\trows.Close()\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\trows.rows, err = rows.session.DB().Query(sqlStr, args...)\n\t\tif err != nil {\n\t\t\trows.lastError = err\n\t\t\trows.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\trows.fields, err = rows.rows.Columns()\n\tif err != nil {\n\t\trows.lastError = err\n\t\trows.Close()\n\t\treturn nil, err\n\t}\n\trows.fieldsCount = len(rows.fields)\n\n\treturn rows, nil\n}\n\n// Next move cursor to next record, return false if end has reached\nfunc (rows *Rows) Next() bool {\n\tif rows.lastError == nil && rows.rows != nil {\n\t\thasNext := rows.rows.Next()\n\t\tif !hasNext {\n\t\t\trows.lastError = sql.ErrNoRows\n\t\t}\n\t\treturn hasNext\n\t}\n\treturn false\n}\n\n// Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.\nfunc (rows *Rows) Err() error {\n\treturn rows.lastError\n}\n\n// Scan row record to bean properties\nfunc (rows *Rows) Scan(bean interface{}) error {\n\tif rows.lastError != nil {\n\t\treturn rows.lastError\n\t}\n\n\tif !rows.NoTypeCheck && reflect.Indirect(reflect.ValueOf(bean)).Type() != rows.beanType {\n\t\treturn fmt.Errorf(\"scan arg is incompatible type to [%v]\", rows.beanType)\n\t}\n\n\treturn rows.session.row2Bean(rows.rows, rows.fields, rows.fieldsCount, bean)\n}\n\n// Close session if session.IsAutoClose is true, and claimed any opened resources\nfunc (rows *Rows) Close() error {\n\tif rows.session.IsAutoClose {\n\t\tdefer rows.session.Close()\n\t}\n\n\tif rows.lastError == nil {\n\t\tif rows.rows != nil {\n\t\t\trows.lastError = rows.rows.Close()\n\t\t\tif rows.lastError != nil {\n\t\t\t\tdefer rows.stmt.Close()\n\t\t\t\treturn rows.lastError\n\t\t\t}\n\t\t}\n\t\tif rows.stmt != nil {\n\t\t\trows.lastError = rows.stmt.Close()\n\t\t}\n\t} else {\n\t\tif rows.stmt != nil {\n\t\t\tdefer rows.stmt.Close()\n\t\t}\n\t\tif rows.rows != nil {\n\t\t\tdefer rows.rows.Close()\n\t\t}\n\t}\n\treturn rows.lastError\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/session.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"database/sql\"\n\t\"database/sql/driver\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"hash/crc32\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// Session keep a pointer to sql.DB and provides all execution of all\n// kind of database operations.\ntype Session struct {\n\tdb                     *core.DB\n\tEngine                 *Engine\n\tTx                     *core.Tx\n\tStatement              Statement\n\tIsAutoCommit           bool\n\tIsCommitedOrRollbacked bool\n\tTransType              string\n\tIsAutoClose            bool\n\n\t// Automatically reset the statement after operations that execute a SQL\n\t// query such as Count(), Find(), Get(), ...\n\tAutoResetStatement bool\n\n\t// !nashtsai! storing these beans due to yet committed tx\n\tafterInsertBeans map[interface{}]*[]func(interface{})\n\tafterUpdateBeans map[interface{}]*[]func(interface{})\n\tafterDeleteBeans map[interface{}]*[]func(interface{})\n\t// --\n\n\tbeforeClosures []func(interface{})\n\tafterClosures  []func(interface{})\n\n\tprepareStmt bool\n\tstmtCache   map[uint32]*core.Stmt //key: hash.Hash32 of (queryStr, len(queryStr))\n\tcascadeDeep int\n\n\t// !evalphobia! stored the last executed query on this session\n\t//beforeSQLExec func(string, ...interface{})\n\tlastSQL     string\n\tlastSQLArgs []interface{}\n}\n\n// Clone copy all the session's content and return a new session\nfunc (session *Session) Clone() *Session {\n\tvar sess = *session\n\treturn &sess\n}\n\n// Init reset the session as the init status.\nfunc (session *Session) Init() {\n\tsession.Statement.Init()\n\tsession.Statement.Engine = session.Engine\n\tsession.IsAutoCommit = true\n\tsession.IsCommitedOrRollbacked = false\n\tsession.IsAutoClose = false\n\tsession.AutoResetStatement = true\n\tsession.prepareStmt = false\n\n\t// !nashtsai! is lazy init better?\n\tsession.afterInsertBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.afterUpdateBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.afterDeleteBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.beforeClosures = make([]func(interface{}), 0)\n\tsession.afterClosures = make([]func(interface{}), 0)\n\n\tsession.lastSQL = \"\"\n\tsession.lastSQLArgs = []interface{}{}\n}\n\n// Close release the connection from pool\nfunc (session *Session) Close() {\n\tfor _, v := range session.stmtCache {\n\t\tv.Close()\n\t}\n\n\tif session.db != nil {\n\t\t// When Close be called, if session is a transaction and do not call\n\t\t// Commit or Rollback, then call Rollback.\n\t\tif session.Tx != nil && !session.IsCommitedOrRollbacked {\n\t\t\tsession.Rollback()\n\t\t}\n\t\tsession.Tx = nil\n\t\tsession.stmtCache = nil\n\t\tsession.Init()\n\t\tsession.db = nil\n\t}\n}\n\nfunc (session *Session) resetStatement() {\n\tif session.AutoResetStatement {\n\t\tsession.Statement.Init()\n\t}\n}\n\n// Prepare set a flag to session that should be prepare statment before execute query\nfunc (session *Session) Prepare() *Session {\n\tsession.prepareStmt = true\n\treturn session\n}\n\n// Sql will be deprecated, please use SQL instead.\nfunc (session *Session) Sql(querystring string, args ...interface{}) *Session {\n\tsession.Statement.Sql(querystring, args...)\n\treturn session\n}\n\n// SQL provides raw sql input parameter. When you have a complex SQL statement\n// and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.\nfunc (session *Session) SQL(querystring string, args ...interface{}) *Session {\n\tsession.Statement.Sql(querystring, args...)\n\treturn session\n}\n\n// Where provides custom query condition.\nfunc (session *Session) Where(querystring string, args ...interface{}) *Session {\n\tsession.Statement.Where(querystring, args...)\n\treturn session\n}\n\n// And provides custom query condition.\nfunc (session *Session) And(querystring string, args ...interface{}) *Session {\n\tsession.Statement.And(querystring, args...)\n\treturn session\n}\n\n// Or provides custom query condition.\nfunc (session *Session) Or(querystring string, args ...interface{}) *Session {\n\tsession.Statement.Or(querystring, args...)\n\treturn session\n}\n\n// Id will be deprecated, please use ID instead\nfunc (session *Session) Id(id interface{}) *Session {\n\tsession.Statement.Id(id)\n\treturn session\n}\n\n// ID provides converting id as a query condition\nfunc (session *Session) ID(id interface{}) *Session {\n\tsession.Statement.Id(id)\n\treturn session\n}\n\n// Before Apply before Processor, affected bean is passed to closure arg\nfunc (session *Session) Before(closures func(interface{})) *Session {\n\tif closures != nil {\n\t\tsession.beforeClosures = append(session.beforeClosures, closures)\n\t}\n\treturn session\n}\n\n// After Apply after Processor, affected bean is passed to closure arg\nfunc (session *Session) After(closures func(interface{})) *Session {\n\tif closures != nil {\n\t\tsession.afterClosures = append(session.afterClosures, closures)\n\t}\n\treturn session\n}\n\n// Table can input a string or pointer to struct for special a table to operate.\nfunc (session *Session) Table(tableNameOrBean interface{}) *Session {\n\tsession.Statement.Table(tableNameOrBean)\n\treturn session\n}\n\n// Alias set the table alias\nfunc (session *Session) Alias(alias string) *Session {\n\tsession.Statement.Alias(alias)\n\treturn session\n}\n\n// In provides a query string like \"id in (1, 2, 3)\"\nfunc (session *Session) In(column string, args ...interface{}) *Session {\n\tsession.Statement.In(column, args...)\n\treturn session\n}\n\n// Incr provides a query string like \"count = count + 1\"\nfunc (session *Session) Incr(column string, arg ...interface{}) *Session {\n\tsession.Statement.Incr(column, arg...)\n\treturn session\n}\n\n// Decr provides a query string like \"count = count - 1\"\nfunc (session *Session) Decr(column string, arg ...interface{}) *Session {\n\tsession.Statement.Decr(column, arg...)\n\treturn session\n}\n\n// SetExpr provides a query string like \"column = {expression}\"\nfunc (session *Session) SetExpr(column string, expression string) *Session {\n\tsession.Statement.SetExpr(column, expression)\n\treturn session\n}\n\n// Select provides some columns to special\nfunc (session *Session) Select(str string) *Session {\n\tsession.Statement.Select(str)\n\treturn session\n}\n\n// Cols provides some columns to special\nfunc (session *Session) Cols(columns ...string) *Session {\n\tsession.Statement.Cols(columns...)\n\treturn session\n}\n\n// AllCols ask all columns\nfunc (session *Session) AllCols() *Session {\n\tsession.Statement.AllCols()\n\treturn session\n}\n\n// MustCols specify some columns must use even if they are empty\nfunc (session *Session) MustCols(columns ...string) *Session {\n\tsession.Statement.MustCols(columns...)\n\treturn session\n}\n\n// NoCascade indicate that no cascade load child object\nfunc (session *Session) NoCascade() *Session {\n\tsession.Statement.UseCascade = false\n\treturn session\n}\n\n// UseBool automatically retrieve condition according struct, but\n// if struct has bool field, it will ignore them. So use UseBool\n// to tell system to do not ignore them.\n// If no paramters, it will use all the bool field of struct, or\n// it will use paramters's columns\nfunc (session *Session) UseBool(columns ...string) *Session {\n\tsession.Statement.UseBool(columns...)\n\treturn session\n}\n\n// Distinct use for distinct columns. Caution: when you are using cache,\n// distinct will not be cached because cache system need id,\n// but distinct will not provide id\nfunc (session *Session) Distinct(columns ...string) *Session {\n\tsession.Statement.Distinct(columns...)\n\treturn session\n}\n\n// ForUpdate Set Read/Write locking for UPDATE\nfunc (session *Session) ForUpdate() *Session {\n\tsession.Statement.IsForUpdate = true\n\treturn session\n}\n\n// Omit Only not use the paramters as select or update columns\nfunc (session *Session) Omit(columns ...string) *Session {\n\tsession.Statement.Omit(columns...)\n\treturn session\n}\n\n// Nullable Set null when column is zero-value and nullable for update\nfunc (session *Session) Nullable(columns ...string) *Session {\n\tsession.Statement.Nullable(columns...)\n\treturn session\n}\n\n// NoAutoTime means do not automatically give created field and updated field\n// the current time on the current session temporarily\nfunc (session *Session) NoAutoTime() *Session {\n\tsession.Statement.UseAutoTime = false\n\treturn session\n}\n\n// NoAutoCondition disable generate SQL condition from beans\nfunc (session *Session) NoAutoCondition(no ...bool) *Session {\n\tsession.Statement.NoAutoCondition(no...)\n\treturn session\n}\n\n// Limit provide limit and offset query condition\nfunc (session *Session) Limit(limit int, start ...int) *Session {\n\tsession.Statement.Limit(limit, start...)\n\treturn session\n}\n\n// OrderBy provide order by query condition, the input parameter is the content\n// after order by on a sql statement.\nfunc (session *Session) OrderBy(order string) *Session {\n\tsession.Statement.OrderBy(order)\n\treturn session\n}\n\n// Desc provide desc order by query condition, the input parameters are columns.\nfunc (session *Session) Desc(colNames ...string) *Session {\n\tsession.Statement.Desc(colNames...)\n\treturn session\n}\n\n// Asc provide asc order by query condition, the input parameters are columns.\nfunc (session *Session) Asc(colNames ...string) *Session {\n\tsession.Statement.Asc(colNames...)\n\treturn session\n}\n\n// StoreEngine is only avialble mysql dialect currently\nfunc (session *Session) StoreEngine(storeEngine string) *Session {\n\tsession.Statement.StoreEngine = storeEngine\n\treturn session\n}\n\n// Charset is only avialble mysql dialect currently\nfunc (session *Session) Charset(charset string) *Session {\n\tsession.Statement.Charset = charset\n\treturn session\n}\n\n// Cascade indicates if loading sub Struct\nfunc (session *Session) Cascade(trueOrFalse ...bool) *Session {\n\tif len(trueOrFalse) >= 1 {\n\t\tsession.Statement.UseCascade = trueOrFalse[0]\n\t}\n\treturn session\n}\n\n// NoCache ask this session do not retrieve data from cache system and\n// get data from database directly.\nfunc (session *Session) NoCache() *Session {\n\tsession.Statement.UseCache = false\n\treturn session\n}\n\n// Join join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN\nfunc (session *Session) Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session {\n\tsession.Statement.Join(joinOperator, tablename, condition, args...)\n\treturn session\n}\n\n// GroupBy Generate Group By statement\nfunc (session *Session) GroupBy(keys string) *Session {\n\tsession.Statement.GroupBy(keys)\n\treturn session\n}\n\n// Having Generate Having statement\nfunc (session *Session) Having(conditions string) *Session {\n\tsession.Statement.Having(conditions)\n\treturn session\n}\n\n// DB db return the wrapper of sql.DB\nfunc (session *Session) DB() *core.DB {\n\tif session.db == nil {\n\t\tsession.db = session.Engine.db\n\t\tsession.stmtCache = make(map[uint32]*core.Stmt, 0)\n\t}\n\treturn session.db\n}\n\n// Begin a transaction\nfunc (session *Session) Begin() error {\n\tif session.IsAutoCommit {\n\t\ttx, err := session.DB().Begin()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsession.IsAutoCommit = false\n\t\tsession.IsCommitedOrRollbacked = false\n\t\tsession.Tx = tx\n\t\tsession.saveLastSQL(\"BEGIN TRANSACTION\")\n\t}\n\treturn nil\n}\n\n// Rollback When using transaction, you can rollback if any error\nfunc (session *Session) Rollback() error {\n\tif !session.IsAutoCommit && !session.IsCommitedOrRollbacked {\n\t\tsession.saveLastSQL(session.Engine.dialect.RollBackStr())\n\t\tsession.IsCommitedOrRollbacked = true\n\t\treturn session.Tx.Rollback()\n\t}\n\treturn nil\n}\n\n// Commit When using transaction, Commit will commit all operations.\nfunc (session *Session) Commit() error {\n\tif !session.IsAutoCommit && !session.IsCommitedOrRollbacked {\n\t\tsession.saveLastSQL(\"COMMIT\")\n\t\tsession.IsCommitedOrRollbacked = true\n\t\tvar err error\n\t\tif err = session.Tx.Commit(); err == nil {\n\t\t\t// handle processors after tx committed\n\n\t\t\tclosureCallFunc := func(closuresPtr *[]func(interface{}), bean interface{}) {\n\n\t\t\t\tif closuresPtr != nil {\n\t\t\t\t\tfor _, closure := range *closuresPtr {\n\t\t\t\t\t\tclosure(bean)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor bean, closuresPtr := range session.afterInsertBeans {\n\t\t\t\tclosureCallFunc(closuresPtr, bean)\n\n\t\t\t\tif processor, ok := interface{}(bean).(AfterInsertProcessor); ok {\n\t\t\t\t\tprocessor.AfterInsert()\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor bean, closuresPtr := range session.afterUpdateBeans {\n\t\t\t\tclosureCallFunc(closuresPtr, bean)\n\n\t\t\t\tif processor, ok := interface{}(bean).(AfterUpdateProcessor); ok {\n\t\t\t\t\tprocessor.AfterUpdate()\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor bean, closuresPtr := range session.afterDeleteBeans {\n\t\t\t\tclosureCallFunc(closuresPtr, bean)\n\n\t\t\t\tif processor, ok := interface{}(bean).(AfterDeleteProcessor); ok {\n\t\t\t\t\tprocessor.AfterDelete()\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanUpFunc := func(slices *map[interface{}]*[]func(interface{})) {\n\t\t\t\tif len(*slices) > 0 {\n\t\t\t\t\t*slices = make(map[interface{}]*[]func(interface{}), 0)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanUpFunc(&session.afterInsertBeans)\n\t\t\tcleanUpFunc(&session.afterUpdateBeans)\n\t\t\tcleanUpFunc(&session.afterDeleteBeans)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc cleanupProcessorsClosures(slices *[]func(interface{})) {\n\tif len(*slices) > 0 {\n\t\t*slices = make([]func(interface{}), 0)\n\t}\n}\n\nfunc (session *Session) scanMapIntoStruct(obj interface{}, objMap map[string][]byte) error {\n\tdataStruct := rValue(obj)\n\tif dataStruct.Kind() != reflect.Struct {\n\t\treturn errors.New(\"Expected a pointer to a struct\")\n\t}\n\n\tvar col *core.Column\n\tsession.Statement.setRefValue(dataStruct)\n\ttable := session.Statement.RefTable\n\ttableName := session.Statement.tableName\n\n\tfor key, data := range objMap {\n\t\tif col = table.GetColumn(key); col == nil {\n\t\t\tsession.Engine.logger.Warnf(\"struct %v's has not field %v. %v\",\n\t\t\t\ttable.Type.Name(), key, table.ColumnsSeq())\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName := col.FieldName\n\t\tfieldPath := strings.Split(fieldName, \".\")\n\t\tvar fieldValue reflect.Value\n\t\tif len(fieldPath) > 2 {\n\t\t\tsession.Engine.logger.Error(\"Unsupported mutliderive\", fieldName)\n\t\t\tcontinue\n\t\t} else if len(fieldPath) == 2 {\n\t\t\tparentField := dataStruct.FieldByName(fieldPath[0])\n\t\t\tif parentField.IsValid() {\n\t\t\t\tfieldValue = parentField.FieldByName(fieldPath[1])\n\t\t\t}\n\t\t} else {\n\t\t\tfieldValue = dataStruct.FieldByName(fieldName)\n\t\t}\n\t\tif !fieldValue.IsValid() || !fieldValue.CanSet() {\n\t\t\tsession.Engine.logger.Warnf(\"table %v's column %v is not valid or cannot set\", tableName, key)\n\t\t\tcontinue\n\t\t}\n\n\t\terr := session.bytes2Value(col, &fieldValue, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// Execute sql\nfunc (session *Session) innerExec(sqlStr string, args ...interface{}) (sql.Result, error) {\n\tif session.prepareStmt {\n\t\tstmt, err := session.doPrepare(sqlStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres, err := stmt.Exec(args...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn res, nil\n\t}\n\n\treturn session.DB().Exec(sqlStr, args...)\n}\n\nfunc (session *Session) exec(sqlStr string, args ...interface{}) (sql.Result, error) {\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\t// TODO: for table name, it's no need to RefTable\n\t\tsqlStr = filter.Do(sqlStr, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\n\tsession.saveLastSQL(sqlStr, args...)\n\n\treturn session.Engine.logSQLExecutionTime(sqlStr, args, func() (sql.Result, error) {\n\t\tif session.IsAutoCommit {\n\t\t\t// FIXME: oci8 can not auto commit (github.com/mattn/go-oci8)\n\t\t\tif session.Engine.dialect.DBType() == core.ORACLE {\n\t\t\t\tsession.Begin()\n\t\t\t\tr, err := session.Tx.Exec(sqlStr, args...)\n\t\t\t\tsession.Commit()\n\t\t\t\treturn r, err\n\t\t\t}\n\t\t\treturn session.innerExec(sqlStr, args...)\n\t\t}\n\t\treturn session.Tx.Exec(sqlStr, args...)\n\t})\n}\n\n// Exec raw sql\nfunc (session *Session) Exec(sqlStr string, args ...interface{}) (sql.Result, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\treturn session.exec(sqlStr, args...)\n}\n\n// CreateTable create a table according a bean\nfunc (session *Session) CreateTable(bean interface{}) error {\n\tv := rValue(bean)\n\tsession.Statement.setRefValue(v)\n\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\treturn session.createOneTable()\n}\n\n// CreateIndexes create indexes\nfunc (session *Session) CreateIndexes(bean interface{}) error {\n\tv := rValue(bean)\n\tsession.Statement.setRefValue(v)\n\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsqls := session.Statement.genIndexSQL()\n\tfor _, sqlStr := range sqls {\n\t\t_, err := session.exec(sqlStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// CreateUniques create uniques\nfunc (session *Session) CreateUniques(bean interface{}) error {\n\tv := rValue(bean)\n\tsession.Statement.setRefValue(v)\n\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsqls := session.Statement.genUniqueSQL()\n\tfor _, sqlStr := range sqls {\n\t\t_, err := session.exec(sqlStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (session *Session) createOneTable() error {\n\tsqlStr := session.Statement.genCreateTableSQL()\n\t_, err := session.exec(sqlStr)\n\treturn err\n}\n\n// to be deleted\nfunc (session *Session) createAll() error {\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tfor _, table := range session.Engine.Tables {\n\t\tsession.Statement.RefTable = table\n\t\tsession.Statement.tableName = table.Name\n\t\terr := session.createOneTable()\n\t\tsession.resetStatement()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// DropIndexes drop indexes\nfunc (session *Session) DropIndexes(bean interface{}) error {\n\tv := rValue(bean)\n\tsession.Statement.setRefValue(v)\n\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsqls := session.Statement.genDelIndexSQL()\n\tfor _, sqlStr := range sqls {\n\t\t_, err := session.exec(sqlStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// DropTable drop table will drop table if exist, if drop failed, it will return error\nfunc (session *Session) DropTable(beanOrTableName interface{}) error {\n\ttableName, err := session.Engine.tableName(beanOrTableName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar needDrop = true\n\tif !session.Engine.dialect.SupportDropIfExists() {\n\t\tsqlStr, args := session.Engine.dialect.TableCheckSql(tableName)\n\t\tresults, err := session.query(sqlStr, args...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tneedDrop = len(results) > 0\n\t}\n\n\tif needDrop {\n\t\tsqlStr := session.Engine.Dialect().DropTableSql(tableName)\n\t\t_, err = session.exec(sqlStr)\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (session *Session) canCache() bool {\n\tif session.Statement.RefTable == nil ||\n\t\tsession.Statement.JoinStr != \"\" ||\n\t\tsession.Statement.RawSQL != \"\" ||\n\t\tsession.Tx != nil ||\n\t\tlen(session.Statement.selectStr) > 0 {\n\t\treturn false\n\t}\n\treturn true\n}\n\nfunc (session *Session) cacheGet(bean interface{}, sqlStr string, args ...interface{}) (has bool, err error) {\n\t// if has no reftable, then don't use cache currently\n\tif !session.canCache() {\n\t\treturn false, ErrCacheFailed\n\t}\n\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\tsqlStr = filter.Do(sqlStr, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\tnewsql := session.Statement.convertIdSql(sqlStr)\n\tif newsql == \"\" {\n\t\treturn false, ErrCacheFailed\n\t}\n\n\tcacher := session.Engine.getCacher2(session.Statement.RefTable)\n\ttableName := session.Statement.TableName()\n\tsession.Engine.logger.Debug(\"[cacheGet] find sql:\", newsql, args)\n\tids, err := core.GetCacheSql(cacher, tableName, newsql, args)\n\ttable := session.Statement.RefTable\n\tif err != nil {\n\t\tvar res = make([]string, len(table.PrimaryKeys))\n\t\trows, err := session.DB().Query(newsql, args...)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tif rows.Next() {\n\t\t\terr = rows.ScanSlice(&res)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t} else {\n\t\t\treturn false, ErrCacheFailed\n\t\t}\n\n\t\tvar pk core.PK = make([]interface{}, len(table.PrimaryKeys))\n\t\tfor i, col := range table.PKColumns() {\n\t\t\tif col.SQLType.IsText() {\n\t\t\t\tpk[i] = res[i]\n\t\t\t} else if col.SQLType.IsNumeric() {\n\t\t\t\tn, err := strconv.ParseInt(res[i], 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t\tpk[i] = n\n\t\t\t} else {\n\t\t\t\treturn false, errors.New(\"unsupported\")\n\t\t\t}\n\t\t}\n\n\t\tids = []core.PK{pk}\n\t\tsession.Engine.logger.Debug(\"[cacheGet] cache ids:\", newsql, ids)\n\t\terr = core.PutCacheSql(cacher, ids, tableName, newsql, args)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t} else {\n\t\tsession.Engine.logger.Debug(\"[cacheGet] cache hit sql:\", newsql)\n\t}\n\n\tif len(ids) > 0 {\n\t\tstructValue := reflect.Indirect(reflect.ValueOf(bean))\n\t\tid := ids[0]\n\t\tsession.Engine.logger.Debug(\"[cacheGet] get bean:\", tableName, id)\n\t\tsid, err := id.ToString()\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tcacheBean := cacher.GetBean(tableName, sid)\n\t\tif cacheBean == nil {\n\t\t\tnewSession := session.Engine.NewSession()\n\t\t\tdefer newSession.Close()\n\t\t\tcacheBean = reflect.New(structValue.Type()).Interface()\n\t\t\tnewSession.Id(id).NoCache()\n\t\t\tif session.Statement.AltTableName != \"\" {\n\t\t\t\tnewSession.Table(session.Statement.AltTableName)\n\t\t\t}\n\t\t\tif !session.Statement.UseCascade {\n\t\t\t\tnewSession.NoCascade()\n\t\t\t}\n\t\t\thas, err = newSession.Get(cacheBean)\n\t\t\tif err != nil || !has {\n\t\t\t\treturn has, err\n\t\t\t}\n\n\t\t\tsession.Engine.logger.Debug(\"[cacheGet] cache bean:\", tableName, id, cacheBean)\n\t\t\tcacher.PutBean(tableName, sid, cacheBean)\n\t\t} else {\n\t\t\tsession.Engine.logger.Debug(\"[cacheGet] cache hit bean:\", tableName, id, cacheBean)\n\t\t\thas = true\n\t\t}\n\t\tstructValue.Set(reflect.Indirect(reflect.ValueOf(cacheBean)))\n\n\t\treturn has, nil\n\t}\n\treturn false, nil\n}\n\nfunc (session *Session) cacheFind(t reflect.Type, sqlStr string, rowsSlicePtr interface{}, args ...interface{}) (err error) {\n\tif !session.canCache() ||\n\t\tindexNoCase(sqlStr, \"having\") != -1 ||\n\t\tindexNoCase(sqlStr, \"group by\") != -1 {\n\t\treturn ErrCacheFailed\n\t}\n\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\tsqlStr = filter.Do(sqlStr, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\n\tnewsql := session.Statement.convertIdSql(sqlStr)\n\tif newsql == \"\" {\n\t\treturn ErrCacheFailed\n\t}\n\n\ttableName := session.Statement.TableName()\n\n\ttable := session.Statement.RefTable\n\tcacher := session.Engine.getCacher2(table)\n\tids, err := core.GetCacheSql(cacher, tableName, newsql, args)\n\tif err != nil {\n\t\trows, err := session.DB().Query(newsql, args...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tvar i int\n\t\tids = make([]core.PK, 0)\n\t\tfor rows.Next() {\n\t\t\ti++\n\t\t\tif i > 500 {\n\t\t\t\tsession.Engine.logger.Debug(\"[cacheFind] ids length > 500, no cache\")\n\t\t\t\treturn ErrCacheFailed\n\t\t\t}\n\t\t\tvar res = make([]string, len(table.PrimaryKeys))\n\t\t\terr = rows.ScanSlice(&res)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar pk core.PK = make([]interface{}, len(table.PrimaryKeys))\n\t\t\tfor i, col := range table.PKColumns() {\n\t\t\t\tif col.SQLType.IsNumeric() {\n\t\t\t\t\tn, err := strconv.ParseInt(res[i], 10, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tpk[i] = n\n\t\t\t\t} else if col.SQLType.IsText() {\n\t\t\t\t\tpk[i] = res[i]\n\t\t\t\t} else {\n\t\t\t\t\treturn errors.New(\"not supported\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tids = append(ids, pk)\n\t\t}\n\n\t\tsession.Engine.logger.Debug(\"[cacheFind] cache sql:\", ids, tableName, newsql, args)\n\t\terr = core.PutCacheSql(cacher, ids, tableName, newsql, args)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tsession.Engine.logger.Debug(\"[cacheFind] cache hit sql:\", newsql, args)\n\t}\n\n\tsliceValue := reflect.Indirect(reflect.ValueOf(rowsSlicePtr))\n\n\tididxes := make(map[string]int)\n\tvar ides []core.PK\n\tvar temps = make([]interface{}, len(ids))\n\n\tfor idx, id := range ids {\n\t\tsid, err := id.ToString()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbean := cacher.GetBean(tableName, sid)\n\t\tif bean == nil {\n\t\t\tides = append(ides, id)\n\t\t\tididxes[sid] = idx\n\t\t} else {\n\t\t\tsession.Engine.logger.Debug(\"[cacheFind] cache hit bean:\", tableName, id, bean)\n\n\t\t\tpk := session.Engine.IdOf(bean)\n\t\t\txid, err := pk.ToString()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif sid != xid {\n\t\t\t\tsession.Engine.logger.Error(\"[cacheFind] error cache\", xid, sid, bean)\n\t\t\t\treturn ErrCacheFailed\n\t\t\t}\n\t\t\ttemps[idx] = bean\n\t\t}\n\t}\n\n\tif len(ides) > 0 {\n\t\tnewSession := session.Engine.NewSession()\n\t\tdefer newSession.Close()\n\n\t\tslices := reflect.New(reflect.SliceOf(t))\n\t\tbeans := slices.Interface()\n\n\t\tif len(table.PrimaryKeys) == 1 {\n\t\t\tff := make([]interface{}, 0, len(ides))\n\t\t\tfor _, ie := range ides {\n\t\t\t\tff = append(ff, ie[0])\n\t\t\t}\n\n\t\t\tnewSession.In(table.PrimaryKeys[0], ff...)\n\t\t} else {\n\t\t\tvar kn = make([]string, 0)\n\t\t\tfor _, name := range table.PrimaryKeys {\n\t\t\t\tkn = append(kn, name+\" = ?\")\n\t\t\t}\n\t\t\tcondi := \"(\" + strings.Join(kn, \" AND \") + \")\"\n\t\t\tfor _, ie := range ides {\n\t\t\t\tnewSession.Or(condi, ie...)\n\t\t\t}\n\t\t}\n\n\t\terr = newSession.NoCache().Find(beans)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvs := reflect.Indirect(reflect.ValueOf(beans))\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\trv := vs.Index(i)\n\t\t\tif rv.Kind() != reflect.Ptr {\n\t\t\t\trv = rv.Addr()\n\t\t\t}\n\t\t\tbean := rv.Interface()\n\t\t\tid := session.Engine.IdOf(bean)\n\t\t\tsid, err := id.ToString()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttemps[ididxes[sid]] = bean\n\t\t\tsession.Engine.logger.Debug(\"[cacheFind] cache bean:\", tableName, id, bean, temps)\n\t\t\tcacher.PutBean(tableName, sid, bean)\n\t\t}\n\t}\n\n\tfor j := 0; j < len(temps); j++ {\n\t\tbean := temps[j]\n\t\tif bean == nil {\n\t\t\tsession.Engine.logger.Warn(\"[cacheFind] cache no hit:\", tableName, ids[j], temps)\n\t\t\t// return errors.New(\"cache error\") // !nashtsai! no need to return error, but continue instead\n\t\t\tcontinue\n\t\t}\n\t\tif sliceValue.Kind() == reflect.Slice {\n\t\t\tif t.Kind() == reflect.Ptr {\n\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, reflect.ValueOf(bean)))\n\t\t\t} else {\n\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, reflect.Indirect(reflect.ValueOf(bean))))\n\t\t\t}\n\t\t} else if sliceValue.Kind() == reflect.Map {\n\t\t\tvar key = ids[j]\n\t\t\tkeyType := sliceValue.Type().Key()\n\t\t\tvar ikey interface{}\n\t\t\tif len(key) == 1 {\n\t\t\t\tikey, err = str2PK(fmt.Sprintf(\"%v\", key[0]), keyType)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif keyType.Kind() != reflect.Slice {\n\t\t\t\t\treturn errors.New(\"table have multiple primary keys, key is not core.PK or slice\")\n\t\t\t\t}\n\t\t\t\tikey = key\n\t\t\t}\n\n\t\t\tif t.Kind() == reflect.Ptr {\n\t\t\t\tsliceValue.SetMapIndex(reflect.ValueOf(ikey), reflect.ValueOf(bean))\n\t\t\t} else {\n\t\t\t\tsliceValue.SetMapIndex(reflect.ValueOf(ikey), reflect.Indirect(reflect.ValueOf(bean)))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// IterFunc only use by Iterate\ntype IterFunc func(idx int, bean interface{}) error\n\n// Rows return sql.Rows compatible Rows obj, as a forward Iterator object for iterating record by record, bean's non-empty fields\n// are conditions.\nfunc (session *Session) Rows(bean interface{}) (*Rows, error) {\n\treturn newRows(session, bean)\n}\n\n// Iterate record by record handle records from table, condiBeans's non-empty fields\n// are conditions. beans could be []Struct, []*Struct, map[int64]Struct\n// map[int64]*Struct\nfunc (session *Session) Iterate(bean interface{}, fun IterFunc) error {\n\trows, err := session.Rows(bean)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\t//b := reflect.New(iterator.beanType).Interface()\n\ti := 0\n\tfor rows.Next() {\n\t\tb := reflect.New(rows.beanType).Interface()\n\t\terr = rows.Scan(b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = fun(i, b)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti++\n\t}\n\treturn err\n}\n\nfunc (session *Session) doPrepare(sqlStr string) (stmt *core.Stmt, err error) {\n\tcrc := crc32.ChecksumIEEE([]byte(sqlStr))\n\t// TODO try hash(sqlStr+len(sqlStr))\n\tvar has bool\n\tstmt, has = session.stmtCache[crc]\n\tif !has {\n\t\tstmt, err = session.DB().Prepare(sqlStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsession.stmtCache[crc] = stmt\n\t}\n\treturn\n}\n\n// Get retrieve one record from database, bean's non-empty fields\n// will be as conditions\nfunc (session *Session) Get(bean interface{}) (bool, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsession.Statement.setRefValue(rValue(bean))\n\n\tvar sqlStr string\n\tvar args []interface{}\n\n\tif session.Statement.RawSQL == \"\" {\n\t\tif len(session.Statement.TableName()) <= 0 {\n\t\t\treturn false, ErrTableNotFound\n\t\t}\n\t\tsession.Statement.Limit(1)\n\t\tsqlStr, args = session.Statement.genGetSql(bean)\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tif session.Statement.JoinStr == \"\" {\n\t\tif cacher := session.Engine.getCacher2(session.Statement.RefTable); cacher != nil &&\n\t\t\tsession.Statement.UseCache &&\n\t\t\t!session.Statement.unscoped {\n\t\t\thas, err := session.cacheGet(bean, sqlStr, args...)\n\t\t\tif err != ErrCacheFailed {\n\t\t\t\treturn has, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar rawRows *core.Rows\n\tvar err error\n\tsession.queryPreprocess(&sqlStr, args...)\n\tif session.IsAutoCommit {\n\t\t_, rawRows, err = session.innerQuery(sqlStr, args...)\n\t} else {\n\t\trawRows, err = session.Tx.Query(sqlStr, args...)\n\t}\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tdefer rawRows.Close()\n\n\tif rawRows.Next() {\n\t\tif fields, err := rawRows.Columns(); err == nil {\n\t\t\terr = session.row2Bean(rawRows, fields, len(fields), bean)\n\t\t}\n\t\treturn true, err\n\t}\n\treturn false, nil\n}\n\n// Count counts the records. bean's non-empty fields\n// are conditions.\nfunc (session *Session) Count(bean interface{}) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tif session.Statement.RawSQL == \"\" {\n\t\tsqlStr, args = session.Statement.genCountSql(bean)\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tsession.queryPreprocess(&sqlStr, args...)\n\n\tvar err error\n\tvar total int64\n\tif session.IsAutoCommit {\n\t\terr = session.DB().QueryRow(sqlStr, args...).Scan(&total)\n\t} else {\n\t\terr = session.Tx.QueryRow(sqlStr, args...).Scan(&total)\n\t}\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn total, nil\n}\n\n// Sum call sum some column. bean's non-empty fields are conditions.\nfunc (session *Session) Sum(bean interface{}, columnName string) (float64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tif len(session.Statement.RawSQL) == 0 {\n\t\tsqlStr, args = session.Statement.genSumSql(bean, columnName)\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tsession.queryPreprocess(&sqlStr, args...)\n\n\tvar err error\n\tvar res float64\n\tif session.IsAutoCommit {\n\t\terr = session.DB().QueryRow(sqlStr, args...).Scan(&res)\n\t} else {\n\t\terr = session.Tx.QueryRow(sqlStr, args...).Scan(&res)\n\t}\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res, nil\n}\n\n// Sums call sum some columns. bean's non-empty fields are conditions.\nfunc (session *Session) Sums(bean interface{}, columnNames ...string) ([]float64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tif len(session.Statement.RawSQL) == 0 {\n\t\tsqlStr, args = session.Statement.genSumSql(bean, columnNames...)\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tsession.queryPreprocess(&sqlStr, args...)\n\n\tvar err error\n\tvar res = make([]float64, len(columnNames), len(columnNames))\n\tif session.IsAutoCommit {\n\t\terr = session.DB().QueryRow(sqlStr, args...).ScanSlice(&res)\n\t} else {\n\t\terr = session.Tx.QueryRow(sqlStr, args...).ScanSlice(&res)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}\n\n// SumsInt sum specify columns and return as []int64 instead of []float64\nfunc (session *Session) SumsInt(bean interface{}, columnNames ...string) ([]int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tif len(session.Statement.RawSQL) == 0 {\n\t\tsqlStr, args = session.Statement.genSumSql(bean, columnNames...)\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tsession.queryPreprocess(&sqlStr, args...)\n\n\tvar err error\n\tvar res = make([]int64, 0, len(columnNames))\n\tif session.IsAutoCommit {\n\t\terr = session.DB().QueryRow(sqlStr, args...).ScanSlice(&res)\n\t} else {\n\t\terr = session.Tx.QueryRow(sqlStr, args...).ScanSlice(&res)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}\n\n// Find retrieve records from table, condiBeans's non-empty fields\n// are conditions. beans could be []Struct, []*Struct, map[int64]Struct\n// map[int64]*Struct\nfunc (session *Session) Find(rowsSlicePtr interface{}, condiBean ...interface{}) error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsliceValue := reflect.Indirect(reflect.ValueOf(rowsSlicePtr))\n\tif sliceValue.Kind() != reflect.Slice && sliceValue.Kind() != reflect.Map {\n\t\treturn errors.New(\"needs a pointer to a slice or a map\")\n\t}\n\n\tsliceElementType := sliceValue.Type().Elem()\n\n\tif session.Statement.RefTable == nil {\n\t\tif sliceElementType.Kind() == reflect.Ptr {\n\t\t\tif sliceElementType.Elem().Kind() == reflect.Struct {\n\t\t\t\tpv := reflect.New(sliceElementType.Elem())\n\t\t\t\tsession.Statement.setRefValue(pv.Elem())\n\t\t\t} else {\n\t\t\t\treturn errors.New(\"slice type\")\n\t\t\t}\n\t\t} else if sliceElementType.Kind() == reflect.Struct {\n\t\t\tpv := reflect.New(sliceElementType)\n\t\t\tsession.Statement.setRefValue(pv.Elem())\n\t\t} else {\n\t\t\treturn errors.New(\"slice type\")\n\t\t}\n\t}\n\n\tvar table = session.Statement.RefTable\n\n\tvar addedTableName = (len(session.Statement.JoinStr) > 0)\n\tif !session.Statement.noAutoCondition && len(condiBean) > 0 {\n\t\tcolNames, args := session.Statement.buildConditions(table, condiBean[0], true, true, false, true, addedTableName)\n\t\tsession.Statement.ConditionStr = strings.Join(colNames, \" AND \")\n\t\tsession.Statement.BeanArgs = args\n\t} else {\n\t\t// !oinume! Add \"<col> IS NULL\" to WHERE whatever condiBean is given.\n\t\t// See https://github.com/go-xorm/xorm/issues/179\n\t\tif col := table.DeletedColumn(); col != nil && !session.Statement.unscoped { // tag \"deleted\" is enabled\n\t\t\tvar colName = session.Engine.Quote(col.Name)\n\t\t\tif addedTableName {\n\t\t\t\tvar nm = session.Statement.TableName()\n\t\t\t\tif len(session.Statement.TableAlias) > 0 {\n\t\t\t\t\tnm = session.Statement.TableAlias\n\t\t\t\t}\n\t\t\t\tcolName = session.Engine.Quote(nm) + \".\" + colName\n\t\t\t}\n\t\t\tsession.Statement.ConditionStr = fmt.Sprintf(\"(%v IS NULL OR %v = '0001-01-01 00:00:00')\",\n\t\t\t\tcolName, colName)\n\t\t}\n\t}\n\n\tvar sqlStr string\n\tvar args []interface{}\n\tif session.Statement.RawSQL == \"\" {\n\t\tif len(session.Statement.TableName()) <= 0 {\n\t\t\treturn ErrTableNotFound\n\t\t}\n\n\t\tvar columnStr = session.Statement.ColumnStr\n\t\tif len(session.Statement.selectStr) > 0 {\n\t\t\tcolumnStr = session.Statement.selectStr\n\t\t} else {\n\t\t\tif session.Statement.JoinStr == \"\" {\n\t\t\t\tif columnStr == \"\" {\n\t\t\t\t\tif session.Statement.GroupByStr != \"\" {\n\t\t\t\t\t\tcolumnStr = session.Statement.Engine.Quote(strings.Replace(session.Statement.GroupByStr, \",\", session.Engine.Quote(\",\"), -1))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumnStr = session.Statement.genColumnStr()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif columnStr == \"\" {\n\t\t\t\t\tif session.Statement.GroupByStr != \"\" {\n\t\t\t\t\t\tcolumnStr = session.Statement.Engine.Quote(strings.Replace(session.Statement.GroupByStr, \",\", session.Engine.Quote(\",\"), -1))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumnStr = \"*\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsession.Statement.Params = append(session.Statement.joinArgs, append(session.Statement.Params, session.Statement.BeanArgs...)...)\n\n\t\tsession.Statement.attachInSql()\n\n\t\tsqlStr = session.Statement.genSelectSQL(columnStr)\n\t\targs = session.Statement.Params\n\t\t// for mssql and use limit\n\t\tqs := strings.Count(sqlStr, \"?\")\n\t\tif len(args)*2 == qs {\n\t\t\targs = append(args, args...)\n\t\t}\n\t} else {\n\t\tsqlStr = session.Statement.RawSQL\n\t\targs = session.Statement.RawParams\n\t}\n\n\tvar err error\n\tif session.Statement.JoinStr == \"\" {\n\t\tif cacher := session.Engine.getCacher2(table); cacher != nil &&\n\t\t\tsession.Statement.UseCache &&\n\t\t\t!session.Statement.IsDistinct &&\n\t\t\t!session.Statement.unscoped {\n\t\t\terr = session.cacheFind(sliceElementType, sqlStr, rowsSlicePtr, args...)\n\t\t\tif err != ErrCacheFailed {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = nil // !nashtsai! reset err to nil for ErrCacheFailed\n\t\t\tsession.Engine.logger.Warn(\"Cache Find Failed\")\n\t\t}\n\t}\n\n\tif sliceValue.Kind() != reflect.Map {\n\t\tvar rawRows *core.Rows\n\n\t\tsession.queryPreprocess(&sqlStr, args...)\n\t\tif session.IsAutoCommit {\n\t\t\t_, rawRows, err = session.innerQuery(sqlStr, args...)\n\t\t} else {\n\t\t\trawRows, err = session.Tx.Query(sqlStr, args...)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rawRows.Close()\n\n\t\tfields, err := rawRows.Columns()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar newElemFunc func() reflect.Value\n\t\tif sliceElementType.Kind() == reflect.Ptr {\n\t\t\tnewElemFunc = func() reflect.Value {\n\t\t\t\treturn reflect.New(sliceElementType.Elem())\n\t\t\t}\n\t\t} else {\n\t\t\tnewElemFunc = func() reflect.Value {\n\t\t\t\treturn reflect.New(sliceElementType)\n\t\t\t}\n\t\t}\n\n\t\tvar sliceValueSetFunc func(*reflect.Value)\n\n\t\tif sliceValue.Kind() == reflect.Slice {\n\t\t\tif sliceElementType.Kind() == reflect.Ptr {\n\t\t\t\tsliceValueSetFunc = func(newValue *reflect.Value) {\n\t\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, reflect.ValueOf(newValue.Interface())))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsliceValueSetFunc = func(newValue *reflect.Value) {\n\t\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, reflect.Indirect(reflect.ValueOf(newValue.Interface()))))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar newValue = newElemFunc()\n\t\tdataStruct := rValue(newValue.Interface())\n\t\tif dataStruct.Kind() != reflect.Struct {\n\t\t\treturn errors.New(\"Expected a pointer to a struct\")\n\t\t}\n\n\t\treturn session.rows2Beans(rawRows, fields, len(fields), session.Engine.autoMapType(dataStruct), newElemFunc, sliceValueSetFunc)\n\t}\n\n\tresultsSlice, err := session.query(sqlStr, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkeyType := sliceValue.Type().Key()\n\n\tfor _, results := range resultsSlice {\n\t\tvar newValue reflect.Value\n\t\tif sliceElementType.Kind() == reflect.Ptr {\n\t\t\tnewValue = reflect.New(sliceElementType.Elem())\n\t\t} else {\n\t\t\tnewValue = reflect.New(sliceElementType)\n\t\t}\n\t\terr := session.scanMapIntoStruct(newValue.Interface(), results)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar key interface{}\n\t\t// if there is only one pk, we can put the id as map key.\n\t\tif len(table.PrimaryKeys) == 1 {\n\t\t\tkey, err = str2PK(string(results[table.PrimaryKeys[0]]), keyType)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tif keyType.Kind() != reflect.Slice {\n\t\t\t\tpanic(\"don't support multiple primary key's map has non-slice key type\")\n\t\t\t} else {\n\t\t\t\tvar keys core.PK = make([]interface{}, 0, len(table.PrimaryKeys))\n\t\t\t\tfor _, pk := range table.PrimaryKeys {\n\t\t\t\t\tskey, err := str2PK(string(results[pk]), keyType)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tkeys = append(keys, skey)\n\t\t\t\t}\n\t\t\t\tkey = keys\n\t\t\t}\n\t\t}\n\n\t\tif sliceElementType.Kind() == reflect.Ptr {\n\t\t\tsliceValue.SetMapIndex(reflect.ValueOf(key), reflect.ValueOf(newValue.Interface()))\n\t\t} else {\n\t\t\tsliceValue.SetMapIndex(reflect.ValueOf(key), reflect.Indirect(reflect.ValueOf(newValue.Interface())))\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// Ping test if database is ok\nfunc (session *Session) Ping() error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\treturn session.DB().Ping()\n}\n\n// IsTableExist if a table is exist\nfunc (session *Session) IsTableExist(beanOrTableName interface{}) (bool, error) {\n\ttableName, err := session.Engine.tableName(beanOrTableName)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn session.isTableExist(tableName)\n}\n\nfunc (session *Session) isTableExist(tableName string) (bool, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\tsqlStr, args := session.Engine.dialect.TableCheckSql(tableName)\n\tresults, err := session.query(sqlStr, args...)\n\treturn len(results) > 0, err\n}\n\n// IsTableEmpty if table have any records\nfunc (session *Session) IsTableEmpty(bean interface{}) (bool, error) {\n\tv := rValue(bean)\n\tt := v.Type()\n\n\tif t.Kind() == reflect.String {\n\t\treturn session.isTableEmpty(bean.(string))\n\t} else if t.Kind() == reflect.Struct {\n\t\trows, err := session.Count(bean)\n\t\treturn rows == 0, err\n\t}\n\treturn false, errors.New(\"bean should be a struct or struct's point\")\n}\n\nfunc (session *Session) isTableEmpty(tableName string) (bool, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tvar total int64\n\tsql := fmt.Sprintf(\"select count(*) from %s\", session.Engine.Quote(tableName))\n\terr := session.DB().QueryRow(sql).Scan(&total)\n\tsession.saveLastSQL(sql)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\n\treturn total == 0, nil\n}\n\nfunc (session *Session) isIndexExist(tableName, idxName string, unique bool) (bool, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\tvar idx string\n\tif unique {\n\t\tidx = uniqueName(tableName, idxName)\n\t} else {\n\t\tidx = indexName(tableName, idxName)\n\t}\n\tsqlStr, args := session.Engine.dialect.IndexCheckSql(tableName, idx)\n\tresults, err := session.query(sqlStr, args...)\n\treturn len(results) > 0, err\n}\n\n// find if index is exist according cols\nfunc (session *Session) isIndexExist2(tableName string, cols []string, unique bool) (bool, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tindexes, err := session.Engine.dialect.GetIndexes(tableName)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor _, index := range indexes {\n\t\tif sliceEq(index.Cols, cols) {\n\t\t\tif unique {\n\t\t\t\treturn index.Type == core.UniqueType, nil\n\t\t\t}\n\t\t\treturn index.Type == core.IndexType, nil\n\t\t}\n\t}\n\treturn false, nil\n}\n\nfunc (session *Session) addColumn(colName string) error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tcol := session.Statement.RefTable.GetColumn(colName)\n\tsql, args := session.Statement.genAddColumnStr(col)\n\t_, err := session.exec(sql, args...)\n\treturn err\n}\n\nfunc (session *Session) addIndex(tableName, idxName string) error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\tindex := session.Statement.RefTable.Indexes[idxName]\n\tsqlStr := session.Engine.dialect.CreateIndexSql(tableName, index)\n\n\t_, err := session.exec(sqlStr)\n\treturn err\n}\n\nfunc (session *Session) addUnique(tableName, uqeName string) error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\tindex := session.Statement.RefTable.Indexes[uqeName]\n\tsqlStr := session.Engine.dialect.CreateIndexSql(tableName, index)\n\t_, err := session.exec(sqlStr)\n\treturn err\n}\n\n// To be deleted\nfunc (session *Session) dropAll() error {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tfor _, table := range session.Engine.Tables {\n\t\tsession.Statement.Init()\n\t\tsession.Statement.RefTable = table\n\t\tsqlStr := session.Engine.Dialect().DropTableSql(session.Statement.TableName())\n\t\t_, err := session.exec(sqlStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (session *Session) getField(dataStruct *reflect.Value, key string, table *core.Table, idx int) *reflect.Value {\n\tvar col *core.Column\n\tif col = table.GetColumnIdx(key, idx); col == nil {\n\t\tsession.Engine.logger.Warnf(\"table %v has no column %v. %v\", table.Name, key, table.ColumnsSeq())\n\t\treturn nil\n\t}\n\n\tfieldValue, err := col.ValueOfV(dataStruct)\n\tif err != nil {\n\t\tsession.Engine.logger.Error(err)\n\t\treturn nil\n\t}\n\n\tif !fieldValue.IsValid() || !fieldValue.CanSet() {\n\t\tsession.Engine.logger.Warnf(\"table %v's column %v is not valid or cannot set\",\n\t\t\ttable.Name, key)\n\t\treturn nil\n\t}\n\treturn fieldValue\n}\n\n// Cell cell is a result of one column field\ntype Cell *interface{}\n\nfunc (session *Session) rows2Beans(rows *core.Rows, fields []string, fieldsCount int,\n\ttable *core.Table, newElemFunc func() reflect.Value,\n\tsliceValueSetFunc func(*reflect.Value)) error {\n\tfor rows.Next() {\n\t\tvar newValue = newElemFunc()\n\t\tbean := newValue.Interface()\n\t\tdataStruct := rValue(bean)\n\t\terr := session._row2Bean(rows, fields, fieldsCount, bean, &dataStruct, table)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsliceValueSetFunc(&newValue)\n\t}\n\treturn nil\n}\n\nfunc (session *Session) row2Bean(rows *core.Rows, fields []string, fieldsCount int, bean interface{}) error {\n\tdataStruct := rValue(bean)\n\tif dataStruct.Kind() != reflect.Struct {\n\t\treturn errors.New(\"Expected a pointer to a struct\")\n\t}\n\n\tsession.Statement.setRefValue(dataStruct)\n\n\treturn session._row2Bean(rows, fields, fieldsCount, bean, &dataStruct, session.Statement.RefTable)\n}\n\nfunc (session *Session) _row2Bean(rows *core.Rows, fields []string, fieldsCount int, bean interface{}, dataStruct *reflect.Value, table *core.Table) error {\n\tscanResults := make([]interface{}, fieldsCount)\n\tfor i := 0; i < len(fields); i++ {\n\t\tvar cell interface{}\n\t\tscanResults[i] = &cell\n\t}\n\tif err := rows.Scan(scanResults...); err != nil {\n\t\treturn err\n\t}\n\n\tif b, hasBeforeSet := bean.(BeforeSetProcessor); hasBeforeSet {\n\t\tfor ii, key := range fields {\n\t\t\tb.BeforeSet(key, Cell(scanResults[ii].(*interface{})))\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif b, hasAfterSet := bean.(AfterSetProcessor); hasAfterSet {\n\t\t\tfor ii, key := range fields {\n\t\t\t\tb.AfterSet(key, Cell(scanResults[ii].(*interface{})))\n\t\t\t}\n\t\t}\n\t}()\n\n\tvar tempMap = make(map[string]int)\n\tfor ii, key := range fields {\n\t\tvar idx int\n\t\tvar ok bool\n\t\tvar lKey = strings.ToLower(key)\n\t\tif idx, ok = tempMap[lKey]; !ok {\n\t\t\tidx = 0\n\t\t} else {\n\t\t\tidx = idx + 1\n\t\t}\n\t\ttempMap[lKey] = idx\n\n\t\tif fieldValue := session.getField(dataStruct, key, table, idx); fieldValue != nil {\n\t\t\trawValue := reflect.Indirect(reflect.ValueOf(scanResults[ii]))\n\n\t\t\t// if row is null then ignore\n\t\t\tif rawValue.Interface() == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif fieldValue.CanAddr() {\n\t\t\t\tif structConvert, ok := fieldValue.Addr().Interface().(core.Conversion); ok {\n\t\t\t\t\tif data, err := value2Bytes(&rawValue); err == nil {\n\t\t\t\t\t\tstructConvert.FromDB(data)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif _, ok := fieldValue.Interface().(core.Conversion); ok {\n\t\t\t\tif data, err := value2Bytes(&rawValue); err == nil {\n\t\t\t\t\tif fieldValue.Kind() == reflect.Ptr && fieldValue.IsNil() {\n\t\t\t\t\t\tfieldValue.Set(reflect.New(fieldValue.Type().Elem()))\n\t\t\t\t\t}\n\t\t\t\t\tfieldValue.Interface().(core.Conversion).FromDB(data)\n\t\t\t\t} else {\n\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trawValueType := reflect.TypeOf(rawValue.Interface())\n\t\t\tvv := reflect.ValueOf(rawValue.Interface())\n\n\t\t\tfieldType := fieldValue.Type()\n\t\t\thasAssigned := false\n\t\t\tcol := table.GetColumnIdx(key, idx)\n\n\t\t\tif col.SQLType.IsJson() {\n\t\t\t\tvar bs []byte\n\t\t\t\tif rawValueType.Kind() == reflect.String {\n\t\t\t\t\tbs = []byte(vv.String())\n\t\t\t\t} else if rawValueType.ConvertibleTo(core.BytesType) {\n\t\t\t\t\tbs = vv.Bytes()\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"unsupported database data type: %s %v\", key, rawValueType.Kind())\n\t\t\t\t}\n\n\t\t\t\thasAssigned = true\n\n\t\t\t\tif len(bs) > 0 {\n\t\t\t\t\tif fieldValue.CanAddr() {\n\t\t\t\t\t\terr := json.Unmarshal(bs, fieldValue.Addr().Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(key, err)\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx := reflect.New(fieldType)\n\t\t\t\t\t\terr := json.Unmarshal(bs, x.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(key, err)\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch fieldType.Kind() {\n\t\t\tcase reflect.Complex64, reflect.Complex128:\n\t\t\t\t// TODO: reimplement this\n\t\t\t\tvar bs []byte\n\t\t\t\tif rawValueType.Kind() == reflect.String {\n\t\t\t\t\tbs = []byte(vv.String())\n\t\t\t\t} else if rawValueType.ConvertibleTo(core.BytesType) {\n\t\t\t\t\tbs = vv.Bytes()\n\t\t\t\t}\n\n\t\t\t\thasAssigned = true\n\t\t\t\tif len(bs) > 0 {\n\t\t\t\t\tif fieldValue.CanAddr() {\n\t\t\t\t\t\terr := json.Unmarshal(bs, fieldValue.Addr().Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx := reflect.New(fieldType)\n\t\t\t\t\t\terr := json.Unmarshal(bs, x.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase reflect.Slice, reflect.Array:\n\t\t\t\tswitch rawValueType.Kind() {\n\t\t\t\tcase reflect.Slice, reflect.Array:\n\t\t\t\t\tswitch rawValueType.Elem().Kind() {\n\t\t\t\t\tcase reflect.Uint8:\n\t\t\t\t\t\tif fieldType.Elem().Kind() == reflect.Uint8 {\n\t\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\t\tfieldValue.Set(vv)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tif rawValueType.Kind() == reflect.String {\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetString(vv.String())\n\t\t\t\t}\n\t\t\tcase reflect.Bool:\n\t\t\t\tif rawValueType.Kind() == reflect.Bool {\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetBool(vv.Bool())\n\t\t\t\t}\n\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\t\tswitch rawValueType.Kind() {\n\t\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetInt(vv.Int())\n\t\t\t\t}\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tswitch rawValueType.Kind() {\n\t\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetFloat(vv.Float())\n\t\t\t\t}\n\t\t\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\t\t\tswitch rawValueType.Kind() {\n\t\t\t\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetUint(vv.Uint())\n\t\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tfieldValue.SetUint(uint64(vv.Int()))\n\t\t\t\t}\n\t\t\tcase reflect.Struct:\n\t\t\t\tif fieldType.ConvertibleTo(core.TimeType) {\n\t\t\t\t\tif rawValueType == core.TimeType {\n\t\t\t\t\t\thasAssigned = true\n\n\t\t\t\t\t\tt := vv.Convert(core.TimeType).Interface().(time.Time)\n\t\t\t\t\t\tz, _ := t.Zone()\n\t\t\t\t\t\tif len(z) == 0 || t.Year() == 0 { // !nashtsai! HACK tmp work around for lib/pq doesn't properly time with location\n\t\t\t\t\t\t\tdbTZ := session.Engine.DatabaseTZ\n\t\t\t\t\t\t\tif dbTZ == nil {\n\t\t\t\t\t\t\t\tdbTZ = time.Local\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsession.Engine.logger.Debugf(\"empty zone key[%v] : %v | zone: %v | location: %+v\\n\", key, t, z, *t.Location())\n\t\t\t\t\t\t\tt = time.Date(t.Year(), t.Month(), t.Day(), t.Hour(),\n\t\t\t\t\t\t\t\tt.Minute(), t.Second(), t.Nanosecond(), dbTZ)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// !nashtsai! convert to engine location\n\t\t\t\t\t\tif col.TimeZone == nil {\n\t\t\t\t\t\t\tt = t.In(session.Engine.TZLocation)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt = t.In(col.TimeZone)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(t).Convert(fieldType))\n\n\t\t\t\t\t\t// t = fieldValue.Interface().(time.Time)\n\t\t\t\t\t\t// z, _ = t.Zone()\n\t\t\t\t\t\t// session.Engine.LogDebug(\"fieldValue key[%v]: %v | zone: %v | location: %+v\\n\", key, t, z, *t.Location())\n\t\t\t\t\t} else if rawValueType == core.IntType || rawValueType == core.Int64Type ||\n\t\t\t\t\t\trawValueType == core.Int32Type {\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tvar tz *time.Location\n\t\t\t\t\t\tif col.TimeZone == nil {\n\t\t\t\t\t\t\ttz = session.Engine.TZLocation\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttz = col.TimeZone\n\t\t\t\t\t\t}\n\t\t\t\t\t\tt := time.Unix(vv.Int(), 0).In(tz)\n\t\t\t\t\t\t//vv = reflect.ValueOf(t)\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(t).Convert(fieldType))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif d, ok := vv.Interface().([]uint8); ok {\n\t\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\t\tt, err := session.byte2Time(col, d)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tsession.Engine.logger.Error(\"byte2Time error:\", err.Error())\n\t\t\t\t\t\t\t\thasAssigned = false\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(t).Convert(fieldType))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if d, ok := vv.Interface().(string); ok {\n\t\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\t\tt, err := session.str2Time(col, d)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tsession.Engine.logger.Error(\"byte2Time error:\", err.Error())\n\t\t\t\t\t\t\t\thasAssigned = false\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(t).Convert(fieldType))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpanic(fmt.Sprintf(\"rawValueType is %v, value is %v\", rawValueType, vv.Interface()))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if nulVal, ok := fieldValue.Addr().Interface().(sql.Scanner); ok {\n\t\t\t\t\t// !<winxxp>! 增加支持sql.Scanner接口的结构，如sql.NullString\n\t\t\t\t\thasAssigned = true\n\t\t\t\t\tif err := nulVal.Scan(vv.Interface()); err != nil {\n\t\t\t\t\t\t//fmt.Println(\"sql.Sanner error:\", err.Error())\n\t\t\t\t\t\tsession.Engine.logger.Error(\"sql.Sanner error:\", err.Error())\n\t\t\t\t\t\thasAssigned = false\n\t\t\t\t\t}\n\t\t\t\t} else if col.SQLType.IsJson() {\n\t\t\t\t\tif rawValueType.Kind() == reflect.String {\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tx := reflect.New(fieldType)\n\t\t\t\t\t\tif len([]byte(vv.String())) > 0 {\n\t\t\t\t\t\t\terr := json.Unmarshal([]byte(vv.String()), x.Interface())\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if rawValueType.Kind() == reflect.Slice {\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tx := reflect.New(fieldType)\n\t\t\t\t\t\tif len(vv.Bytes()) > 0 {\n\t\t\t\t\t\t\terr := json.Unmarshal(vv.Bytes(), x.Interface())\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if session.Statement.UseCascade {\n\t\t\t\t\ttable := session.Engine.autoMapType(*fieldValue)\n\t\t\t\t\tif table != nil {\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tif len(table.PrimaryKeys) != 1 {\n\t\t\t\t\t\t\tpanic(\"unsupported non or composited primary key cascade\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar pk = make(core.PK, len(table.PrimaryKeys))\n\n\t\t\t\t\t\tswitch rawValueType.Kind() {\n\t\t\t\t\t\tcase reflect.Int64:\n\t\t\t\t\t\t\tpk[0] = vv.Int()\n\t\t\t\t\t\tcase reflect.Int:\n\t\t\t\t\t\t\tpk[0] = int(vv.Int())\n\t\t\t\t\t\tcase reflect.Int32:\n\t\t\t\t\t\t\tpk[0] = int32(vv.Int())\n\t\t\t\t\t\tcase reflect.Int16:\n\t\t\t\t\t\t\tpk[0] = int16(vv.Int())\n\t\t\t\t\t\tcase reflect.Int8:\n\t\t\t\t\t\t\tpk[0] = int8(vv.Int())\n\t\t\t\t\t\tcase reflect.Uint64:\n\t\t\t\t\t\t\tpk[0] = vv.Uint()\n\t\t\t\t\t\tcase reflect.Uint:\n\t\t\t\t\t\t\tpk[0] = uint(vv.Uint())\n\t\t\t\t\t\tcase reflect.Uint32:\n\t\t\t\t\t\t\tpk[0] = uint32(vv.Uint())\n\t\t\t\t\t\tcase reflect.Uint16:\n\t\t\t\t\t\t\tpk[0] = uint16(vv.Uint())\n\t\t\t\t\t\tcase reflect.Uint8:\n\t\t\t\t\t\t\tpk[0] = uint8(vv.Uint())\n\t\t\t\t\t\tcase reflect.String:\n\t\t\t\t\t\t\tpk[0] = vv.String()\n\t\t\t\t\t\tcase reflect.Slice:\n\t\t\t\t\t\t\tpk[0], _ = strconv.ParseInt(string(rawValue.Interface().([]byte)), 10, 64)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tpanic(fmt.Sprintf(\"unsupported primary key type: %v, %v\", rawValueType, fieldValue))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif !isPKZero(pk) {\n\t\t\t\t\t\t\t// !nashtsai! TODO for hasOne relationship, it's preferred to use join query for eager fetch\n\t\t\t\t\t\t\t// however, also need to consider adding a 'lazy' attribute to xorm tag which allow hasOne\n\t\t\t\t\t\t\t// property to be fetched lazily\n\t\t\t\t\t\t\tstructInter := reflect.New(fieldValue.Type())\n\t\t\t\t\t\t\tnewsession := session.Engine.NewSession()\n\t\t\t\t\t\t\tdefer newsession.Close()\n\t\t\t\t\t\t\thas, err := newsession.Id(pk).NoCascade().Get(structInter.Interface())\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif has {\n\t\t\t\t\t\t\t\t//v := structInter.Elem().Interface()\n\t\t\t\t\t\t\t\t//fieldValue.Set(reflect.ValueOf(v))\n\t\t\t\t\t\t\t\tfieldValue.Set(structInter.Elem())\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn errors.New(\"cascade obj is not exist\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsession.Engine.logger.Error(\"unsupported struct type in Scan: \", fieldValue.Type().String())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase reflect.Ptr:\n\t\t\t\t// !nashtsai! TODO merge duplicated codes above\n\t\t\t\t//typeStr := fieldType.String()\n\t\t\t\tswitch fieldType {\n\t\t\t\t// following types case matching ptr's native type, therefore assign ptr directly\n\t\t\t\tcase core.PtrStringType:\n\t\t\t\t\tif rawValueType.Kind() == reflect.String {\n\t\t\t\t\t\tx := vv.String()\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrBoolType:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Bool {\n\t\t\t\t\t\tx := vv.Bool()\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrTimeType:\n\t\t\t\t\tif rawValueType == core.PtrTimeType {\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tvar x = rawValue.Interface().(time.Time)\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrFloat64Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Float64 {\n\t\t\t\t\t\tx := vv.Float()\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrUint64Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = uint64(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrInt64Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tx := vv.Int()\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrFloat32Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Float64 {\n\t\t\t\t\t\tvar x = float32(vv.Float())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrIntType:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = int(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrInt32Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = int32(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrInt8Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = int8(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrInt16Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = int16(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrUintType:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = uint(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.PtrUint32Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = uint32(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.Uint8Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = uint8(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.Uint16Type:\n\t\t\t\t\tif rawValueType.Kind() == reflect.Int64 {\n\t\t\t\t\t\tvar x = uint16(vv.Int())\n\t\t\t\t\t\thasAssigned = true\n\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t}\n\t\t\t\tcase core.Complex64Type:\n\t\t\t\t\tvar x complex64\n\t\t\t\t\tif len([]byte(vv.String())) > 0 {\n\t\t\t\t\t\terr := json.Unmarshal([]byte(vv.String()), &x)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\thasAssigned = true\n\t\t\t\tcase core.Complex128Type:\n\t\t\t\t\tvar x complex128\n\t\t\t\t\tif len([]byte(vv.String())) > 0 {\n\t\t\t\t\t\terr := json.Unmarshal([]byte(vv.String()), &x)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\thasAssigned = true\n\t\t\t\t} // switch fieldType\n\t\t\t\t// default:\n\t\t\t\t// \tsession.Engine.LogError(\"unsupported type in Scan: \", reflect.TypeOf(v).String())\n\t\t\t} // switch fieldType.Kind()\n\n\t\t\t// !nashtsai! for value can't be assigned directly fallback to convert to []byte then back to value\n\t\t\tif !hasAssigned {\n\t\t\t\tdata, err := value2Bytes(&rawValue)\n\t\t\t\tif err == nil {\n\t\t\t\t\tsession.bytes2Value(col, fieldValue, data)\n\t\t\t\t} else {\n\t\t\t\t\tsession.Engine.logger.Error(err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n\n}\n\nfunc (session *Session) queryPreprocess(sqlStr *string, paramStr ...interface{}) {\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\t*sqlStr = filter.Do(*sqlStr, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\n\tsession.saveLastSQL(*sqlStr, paramStr...)\n}\n\nfunc (session *Session) query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) {\n\n\tsession.queryPreprocess(&sqlStr, paramStr...)\n\n\tif session.IsAutoCommit {\n\t\treturn session.innerQuery2(sqlStr, paramStr...)\n\t}\n\treturn session.txQuery(session.Tx, sqlStr, paramStr...)\n}\n\nfunc (session *Session) txQuery(tx *core.Tx, sqlStr string, params ...interface{}) (resultsSlice []map[string][]byte, err error) {\n\trows, err := tx.Query(sqlStr, params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\treturn rows2maps(rows)\n}\n\nfunc (session *Session) innerQuery(sqlStr string, params ...interface{}) (*core.Stmt, *core.Rows, error) {\n\tvar callback func() (*core.Stmt, *core.Rows, error)\n\tif session.prepareStmt {\n\t\tcallback = func() (*core.Stmt, *core.Rows, error) {\n\t\t\tstmt, err := session.doPrepare(sqlStr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\trows, err := stmt.Query(params...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\treturn stmt, rows, nil\n\t\t}\n\t} else {\n\t\tcallback = func() (*core.Stmt, *core.Rows, error) {\n\t\t\trows, err := session.DB().Query(sqlStr, params...)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\treturn nil, rows, err\n\t\t}\n\t}\n\tstmt, rows, err := session.Engine.logSQLQueryTime(sqlStr, params, callback)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn stmt, rows, nil\n}\n\nfunc (session *Session) innerQuery2(sqlStr string, params ...interface{}) ([]map[string][]byte, error) {\n\t_, rows, err := session.innerQuery(sqlStr, params...)\n\tif rows != nil {\n\t\tdefer rows.Close()\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rows2maps(rows)\n}\n\n// Query a raw sql and return records as []map[string][]byte\nfunc (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\treturn session.query(sqlStr, paramStr...)\n}\n\n// =============================\n// for string\n// =============================\nfunc (session *Session) query2(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string]string, err error) {\n\tsession.queryPreprocess(&sqlStr, paramStr...)\n\n\tif session.IsAutoCommit {\n\t\treturn query2(session.DB(), sqlStr, paramStr...)\n\t}\n\treturn txQuery2(session.Tx, sqlStr, paramStr...)\n}\n\n// Insert insert one or more beans\nfunc (session *Session) Insert(beans ...interface{}) (int64, error) {\n\tvar affected int64\n\tvar err error\n\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tfor _, bean := range beans {\n\t\tsliceValue := reflect.Indirect(reflect.ValueOf(bean))\n\t\tif sliceValue.Kind() == reflect.Slice {\n\t\t\tsize := sliceValue.Len()\n\t\t\tif size > 0 {\n\t\t\t\tif session.Engine.SupportInsertMany() {\n\t\t\t\t\tcnt, err := session.innerInsertMulti(bean)\n\t\t\t\t\tsession.resetStatement()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn affected, err\n\t\t\t\t\t}\n\t\t\t\t\taffected += cnt\n\t\t\t\t} else {\n\t\t\t\t\tfor i := 0; i < size; i++ {\n\t\t\t\t\t\tcnt, err := session.innerInsert(sliceValue.Index(i).Interface())\n\t\t\t\t\t\tsession.resetStatement()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn affected, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\taffected += cnt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcnt, err := session.innerInsert(bean)\n\t\t\tsession.resetStatement()\n\t\t\tif err != nil {\n\t\t\t\treturn affected, err\n\t\t\t}\n\t\t\taffected += cnt\n\t\t}\n\t}\n\n\treturn affected, err\n}\n\nfunc (session *Session) innerInsertMulti(rowsSlicePtr interface{}) (int64, error) {\n\tsliceValue := reflect.Indirect(reflect.ValueOf(rowsSlicePtr))\n\tif sliceValue.Kind() != reflect.Slice {\n\t\treturn 0, errors.New(\"needs a pointer to a slice\")\n\t}\n\n\tbean := sliceValue.Index(0).Interface()\n\telementValue := rValue(bean)\n\tsession.Statement.setRefValue(elementValue)\n\tif len(session.Statement.TableName()) <= 0 {\n\t\treturn 0, ErrTableNotFound\n\t}\n\n\ttable := session.Statement.RefTable\n\tsize := sliceValue.Len()\n\n\tvar colNames []string\n\tvar colMultiPlaces []string\n\tvar args []interface{}\n\tvar cols []*core.Column\n\n\tfor i := 0; i < size; i++ {\n\t\tv := sliceValue.Index(i)\n\t\tvv := reflect.Indirect(v)\n\t\telemValue := v.Interface()\n\t\tvar colPlaces []string\n\n\t\t// handle BeforeInsertProcessor\n\t\t// !nashtsai! does user expect it's same slice to passed closure when using Before()/After() when insert multi??\n\t\tfor _, closure := range session.beforeClosures {\n\t\t\tclosure(elemValue)\n\t\t}\n\n\t\tif processor, ok := interface{}(elemValue).(BeforeInsertProcessor); ok {\n\t\t\tprocessor.BeforeInsert()\n\t\t}\n\t\t// --\n\n\t\tif i == 0 {\n\t\t\tfor _, col := range table.Columns() {\n\t\t\t\tptrFieldValue, err := col.ValueOfV(&vv)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\tfieldValue := *ptrFieldValue\n\t\t\t\tif col.IsAutoIncrement && isZero(fieldValue.Interface()) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif col.MapType == core.ONLYFROMDB {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif col.IsDeleted {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif session.Statement.ColumnStr != \"\" {\n\t\t\t\t\tif _, ok := session.Statement.columnMap[strings.ToLower(col.Name)]; !ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif session.Statement.OmitStr != \"\" {\n\t\t\t\t\tif _, ok := session.Statement.columnMap[strings.ToLower(col.Name)]; ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (col.IsCreated || col.IsUpdated) && session.Statement.UseAutoTime {\n\t\t\t\t\tval, t := session.Engine.NowTime2(col.SQLType.Name)\n\t\t\t\t\targs = append(args, val)\n\n\t\t\t\t\tvar colName = col.Name\n\t\t\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\t\t\tsetColumnTime(bean, col, t)\n\t\t\t\t\t})\n\t\t\t\t} else if col.IsVersion && session.Statement.checkVersion {\n\t\t\t\t\targs = append(args, 1)\n\t\t\t\t\tvar colName = col.Name\n\t\t\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\t\t\tsetColumnInt(bean, col, 1)\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\targ, err := session.value2Interface(col, fieldValue)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn 0, err\n\t\t\t\t\t}\n\t\t\t\t\targs = append(args, arg)\n\t\t\t\t}\n\n\t\t\t\tcolNames = append(colNames, col.Name)\n\t\t\t\tcols = append(cols, col)\n\t\t\t\tcolPlaces = append(colPlaces, \"?\")\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, col := range cols {\n\t\t\t\tptrFieldValue, err := col.ValueOfV(&vv)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\tfieldValue := *ptrFieldValue\n\n\t\t\t\tif col.IsAutoIncrement && isZero(fieldValue.Interface()) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif col.MapType == core.ONLYFROMDB {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif col.IsDeleted {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif session.Statement.ColumnStr != \"\" {\n\t\t\t\t\tif _, ok := session.Statement.columnMap[strings.ToLower(col.Name)]; !ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif session.Statement.OmitStr != \"\" {\n\t\t\t\t\tif _, ok := session.Statement.columnMap[strings.ToLower(col.Name)]; ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (col.IsCreated || col.IsUpdated) && session.Statement.UseAutoTime {\n\t\t\t\t\tval, t := session.Engine.NowTime2(col.SQLType.Name)\n\t\t\t\t\targs = append(args, val)\n\n\t\t\t\t\tvar colName = col.Name\n\t\t\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\t\t\tsetColumnTime(bean, col, t)\n\t\t\t\t\t})\n\t\t\t\t} else if col.IsVersion && session.Statement.checkVersion {\n\t\t\t\t\targs = append(args, 1)\n\t\t\t\t\tvar colName = col.Name\n\t\t\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\t\t\tsetColumnInt(bean, col, 1)\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\targ, err := session.value2Interface(col, fieldValue)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn 0, err\n\t\t\t\t\t}\n\t\t\t\t\targs = append(args, arg)\n\t\t\t\t}\n\n\t\t\t\tcolPlaces = append(colPlaces, \"?\")\n\t\t\t}\n\t\t}\n\t\tcolMultiPlaces = append(colMultiPlaces, strings.Join(colPlaces, \", \"))\n\t}\n\tcleanupProcessorsClosures(&session.beforeClosures)\n\n\tstatement := fmt.Sprintf(\"INSERT INTO %s (%v%v%v) VALUES (%v)\",\n\t\tsession.Engine.Quote(session.Statement.TableName()),\n\t\tsession.Engine.QuoteStr(),\n\t\tstrings.Join(colNames, session.Engine.QuoteStr()+\", \"+session.Engine.QuoteStr()),\n\t\tsession.Engine.QuoteStr(),\n\t\tstrings.Join(colMultiPlaces, \"),(\"))\n\n\tres, err := session.exec(statement, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {\n\t\tsession.cacheInsert(session.Statement.TableName())\n\t}\n\n\tlenAfterClosures := len(session.afterClosures)\n\tfor i := 0; i < size; i++ {\n\t\telemValue := reflect.Indirect(sliceValue.Index(i)).Addr().Interface()\n\n\t\t// handle AfterInsertProcessor\n\t\tif session.IsAutoCommit {\n\t\t\t// !nashtsai! does user expect it's same slice to passed closure when using Before()/After() when insert multi??\n\t\t\tfor _, closure := range session.afterClosures {\n\t\t\t\tclosure(elemValue)\n\t\t\t}\n\t\t\tif processor, ok := interface{}(elemValue).(AfterInsertProcessor); ok {\n\t\t\t\tprocessor.AfterInsert()\n\t\t\t}\n\t\t} else {\n\t\t\tif lenAfterClosures > 0 {\n\t\t\t\tif value, has := session.afterInsertBeans[elemValue]; has && value != nil {\n\t\t\t\t\t*value = append(*value, session.afterClosures...)\n\t\t\t\t} else {\n\t\t\t\t\tafterClosures := make([]func(interface{}), lenAfterClosures)\n\t\t\t\t\tcopy(afterClosures, session.afterClosures)\n\t\t\t\t\tsession.afterInsertBeans[elemValue] = &afterClosures\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, ok := interface{}(elemValue).(AfterInsertProcessor); ok {\n\t\t\t\t\tsession.afterInsertBeans[elemValue] = nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcleanupProcessorsClosures(&session.afterClosures)\n\treturn res.RowsAffected()\n}\n\n// InsertMulti insert multiple records\nfunc (session *Session) InsertMulti(rowsSlicePtr interface{}) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsliceValue := reflect.Indirect(reflect.ValueOf(rowsSlicePtr))\n\tif sliceValue.Kind() != reflect.Slice {\n\t\treturn 0, ErrParamsType\n\n\t}\n\n\tif sliceValue.Len() <= 0 {\n\t\treturn 0, nil\n\t}\n\n\treturn session.innerInsertMulti(rowsSlicePtr)\n}\n\nfunc (session *Session) str2Time(col *core.Column, data string) (outTime time.Time, outErr error) {\n\tsdata := strings.TrimSpace(data)\n\tvar x time.Time\n\tvar err error\n\n\tif sdata == \"0000-00-00 00:00:00\" ||\n\t\tsdata == \"0001-01-01 00:00:00\" {\n\t} else if !strings.ContainsAny(sdata, \"- :\") { // !nashtsai! has only found that mymysql driver is using this for time type column\n\t\t// time stamp\n\t\tsd, err := strconv.ParseInt(sdata, 10, 64)\n\t\tif err == nil {\n\t\t\tx = time.Unix(sd, 0)\n\t\t\t// !nashtsai! HACK mymysql driver is casuing Local location being change to CHAT and cause wrong time conversion\n\t\t\t//fmt.Println(x.In(session.Engine.TZLocation), \"===\")\n\t\t\tif col.TimeZone == nil {\n\t\t\t\tx = x.In(session.Engine.TZLocation)\n\t\t\t} else {\n\t\t\t\tx = x.In(col.TimeZone)\n\t\t\t}\n\t\t\t//fmt.Println(x, \"=====\")\n\t\t\tsession.Engine.logger.Debugf(\"time(0) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t\t} else {\n\t\t\tsession.Engine.logger.Debugf(\"time(0) err key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t\t}\n\t} else if len(sdata) > 19 && strings.Contains(sdata, \"-\") {\n\t\tx, err = time.ParseInLocation(time.RFC3339Nano, sdata, session.Engine.TZLocation)\n\t\tsession.Engine.logger.Debugf(\"time(1) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t\tif err != nil {\n\t\t\tx, err = time.ParseInLocation(\"2006-01-02 15:04:05.999999999\", sdata, session.Engine.TZLocation)\n\t\t\tsession.Engine.logger.Debugf(\"time(2) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t\t}\n\t\tif err != nil {\n\t\t\tx, err = time.ParseInLocation(\"2006-01-02 15:04:05.9999999 Z07:00\", sdata, session.Engine.TZLocation)\n\t\t\tsession.Engine.logger.Debugf(\"time(3) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t\t}\n\n\t} else if len(sdata) == 19 && strings.Contains(sdata, \"-\") {\n\t\tx, err = time.ParseInLocation(\"2006-01-02 15:04:05\", sdata, session.Engine.TZLocation)\n\t\tsession.Engine.logger.Debugf(\"time(4) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t} else if len(sdata) == 10 && sdata[4] == '-' && sdata[7] == '-' {\n\t\tx, err = time.ParseInLocation(\"2006-01-02\", sdata, session.Engine.TZLocation)\n\t\tsession.Engine.logger.Debugf(\"time(5) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t} else if col.SQLType.Name == core.Time {\n\t\tif strings.Contains(sdata, \" \") {\n\t\t\tssd := strings.Split(sdata, \" \")\n\t\t\tsdata = ssd[1]\n\t\t}\n\n\t\tsdata = strings.TrimSpace(sdata)\n\t\tif session.Engine.dialect.DBType() == core.MYSQL && len(sdata) > 8 {\n\t\t\tsdata = sdata[len(sdata)-8:]\n\t\t}\n\n\t\tst := fmt.Sprintf(\"2006-01-02 %v\", sdata)\n\t\tx, err = time.ParseInLocation(\"2006-01-02 15:04:05\", st, session.Engine.TZLocation)\n\t\tsession.Engine.logger.Debugf(\"time(6) key[%v]: %+v | sdata: [%v]\\n\", col.FieldName, x, sdata)\n\t} else {\n\t\toutErr = fmt.Errorf(\"unsupported time format %v\", sdata)\n\t\treturn\n\t}\n\tif err != nil {\n\t\toutErr = fmt.Errorf(\"unsupported time format %v: %v\", sdata, err)\n\t\treturn\n\t}\n\toutTime = x\n\treturn\n}\n\nfunc (session *Session) byte2Time(col *core.Column, data []byte) (outTime time.Time, outErr error) {\n\treturn session.str2Time(col, string(data))\n}\n\n// convert a db data([]byte) to a field value\nfunc (session *Session) bytes2Value(col *core.Column, fieldValue *reflect.Value, data []byte) error {\n\tif structConvert, ok := fieldValue.Addr().Interface().(core.Conversion); ok {\n\t\treturn structConvert.FromDB(data)\n\t}\n\n\tif structConvert, ok := fieldValue.Interface().(core.Conversion); ok {\n\t\treturn structConvert.FromDB(data)\n\t}\n\n\tvar v interface{}\n\tkey := col.Name\n\tfieldType := fieldValue.Type()\n\n\tswitch fieldType.Kind() {\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tx := reflect.New(fieldType)\n\t\tif len(data) > 0 {\n\t\t\terr := json.Unmarshal(data, x.Interface())\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfieldValue.Set(x.Elem())\n\t\t}\n\tcase reflect.Slice, reflect.Array, reflect.Map:\n\t\tv = data\n\t\tt := fieldType.Elem()\n\t\tk := t.Kind()\n\t\tif col.SQLType.IsText() {\n\t\t\tx := reflect.New(fieldType)\n\t\t\tif len(data) > 0 {\n\t\t\t\terr := json.Unmarshal(data, x.Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t}\n\t\t} else if col.SQLType.IsBlob() {\n\t\t\tif k == reflect.Uint8 {\n\t\t\t\tfieldValue.Set(reflect.ValueOf(v))\n\t\t\t} else {\n\t\t\t\tx := reflect.New(fieldType)\n\t\t\t\tif len(data) > 0 {\n\t\t\t\t\terr := json.Unmarshal(data, x.Interface())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfieldValue.Set(x.Elem())\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn ErrUnSupportedType\n\t\t}\n\tcase reflect.String:\n\t\tfieldValue.SetString(string(data))\n\tcase reflect.Bool:\n\t\td := string(data)\n\t\tv, err := strconv.ParseBool(d)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"arg %v as bool: %s\", key, err.Error())\n\t\t}\n\t\tfieldValue.Set(reflect.ValueOf(v))\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tsdata := string(data)\n\t\tvar x int64\n\t\tvar err error\n\t\t// for mysql, when use bit, it returned \\x01\n\t\tif col.SQLType.Name == core.Bit &&\n\t\t\tsession.Engine.dialect.DBType() == core.MYSQL { // !nashtsai! TODO dialect needs to provide conversion interface API\n\t\t\tif len(data) == 1 {\n\t\t\t\tx = int64(data[0])\n\t\t\t} else {\n\t\t\t\tx = 0\n\t\t\t}\n\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\tx, err = strconv.ParseInt(sdata, 16, 64)\n\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\tx, err = strconv.ParseInt(sdata, 8, 64)\n\t\t} else if strings.ToLower(sdata) == \"true\" {\n\t\t\tx = 1\n\t\t} else if strings.ToLower(sdata) == \"false\" {\n\t\t\tx = 0\n\t\t} else {\n\t\t\tx, err = strconv.ParseInt(sdata, 10, 64)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t}\n\t\tfieldValue.SetInt(x)\n\tcase reflect.Float32, reflect.Float64:\n\t\tx, err := strconv.ParseFloat(string(data), 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"arg %v as float64: %s\", key, err.Error())\n\t\t}\n\t\tfieldValue.SetFloat(x)\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tx, err := strconv.ParseUint(string(data), 10, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t}\n\t\tfieldValue.SetUint(x)\n\t//Currently only support Time type\n\tcase reflect.Struct:\n\t\t// !<winxxp>! 增加支持sql.Scanner接口的结构，如sql.NullString\n\t\tif nulVal, ok := fieldValue.Addr().Interface().(sql.Scanner); ok {\n\t\t\tif err := nulVal.Scan(data); err != nil {\n\t\t\t\treturn fmt.Errorf(\"sql.Scan(%v) failed: %s \", data, err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif fieldType.ConvertibleTo(core.TimeType) {\n\t\t\t\tx, err := session.byte2Time(col, data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tv = x\n\t\t\t\tfieldValue.Set(reflect.ValueOf(v).Convert(fieldType))\n\t\t\t} else if session.Statement.UseCascade {\n\t\t\t\ttable := session.Engine.autoMapType(*fieldValue)\n\t\t\t\tif table != nil {\n\t\t\t\t\t// TODO: current only support 1 primary key\n\t\t\t\t\tif len(table.PrimaryKeys) > 1 {\n\t\t\t\t\t\tpanic(\"unsupported composited primary key cascade\")\n\t\t\t\t\t}\n\t\t\t\t\tvar pk = make(core.PK, len(table.PrimaryKeys))\n\t\t\t\t\trawValueType := table.ColumnType(table.PKColumns()[0].FieldName)\n\t\t\t\t\tvar err error\n\t\t\t\t\tpk[0], err = str2PK(string(data), rawValueType)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\tif !isPKZero(pk) {\n\t\t\t\t\t\t// !nashtsai! TODO for hasOne relationship, it's preferred to use join query for eager fetch\n\t\t\t\t\t\t// however, also need to consider adding a 'lazy' attribute to xorm tag which allow hasOne\n\t\t\t\t\t\t// property to be fetched lazily\n\t\t\t\t\t\tstructInter := reflect.New(fieldValue.Type())\n\t\t\t\t\t\tnewsession := session.Engine.NewSession()\n\t\t\t\t\t\tdefer newsession.Close()\n\t\t\t\t\t\thas, err := newsession.Id(pk).NoCascade().Get(structInter.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif has {\n\t\t\t\t\t\t\tv = structInter.Elem().Interface()\n\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(v))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn errors.New(\"cascade obj is not exist\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"unsupported struct type in Scan: %s\", fieldValue.Type().String())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase reflect.Ptr:\n\t\t// !nashtsai! TODO merge duplicated codes above\n\t\t//typeStr := fieldType.String()\n\t\tswitch fieldType.Elem().Kind() {\n\t\t// case \"*string\":\n\t\tcase core.StringType.Kind():\n\t\t\tx := string(data)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*bool\":\n\t\tcase core.BoolType.Kind():\n\t\t\td := string(data)\n\t\t\tv, err := strconv.ParseBool(d)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as bool: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&v).Convert(fieldType))\n\t\t// case \"*complex64\":\n\t\tcase core.Complex64Type.Kind():\n\t\t\tvar x complex64\n\t\t\tif len(data) > 0 {\n\t\t\t\terr := json.Unmarshal(data, &x)\n\t\t\t\tif err != nil {\n\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t\t}\n\t\t// case \"*complex128\":\n\t\tcase core.Complex128Type.Kind():\n\t\t\tvar x complex128\n\t\t\tif len(data) > 0 {\n\t\t\t\terr := json.Unmarshal(data, &x)\n\t\t\t\tif err != nil {\n\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t\t}\n\t\t// case \"*float64\":\n\t\tcase core.Float64Type.Kind():\n\t\t\tx, err := strconv.ParseFloat(string(data), 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as float64: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*float32\":\n\t\tcase core.Float32Type.Kind():\n\t\t\tvar x float32\n\t\t\tx1, err := strconv.ParseFloat(string(data), 32)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as float32: %s\", key, err.Error())\n\t\t\t}\n\t\t\tx = float32(x1)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*uint64\":\n\t\tcase core.Uint64Type.Kind():\n\t\t\tvar x uint64\n\t\t\tx, err := strconv.ParseUint(string(data), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*uint\":\n\t\tcase core.UintType.Kind():\n\t\t\tvar x uint\n\t\t\tx1, err := strconv.ParseUint(string(data), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tx = uint(x1)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*uint32\":\n\t\tcase core.Uint32Type.Kind():\n\t\t\tvar x uint32\n\t\t\tx1, err := strconv.ParseUint(string(data), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tx = uint32(x1)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*uint8\":\n\t\tcase core.Uint8Type.Kind():\n\t\t\tvar x uint8\n\t\t\tx1, err := strconv.ParseUint(string(data), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tx = uint8(x1)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*uint16\":\n\t\tcase core.Uint16Type.Kind():\n\t\t\tvar x uint16\n\t\t\tx1, err := strconv.ParseUint(string(data), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tx = uint16(x1)\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*int64\":\n\t\tcase core.Int64Type.Kind():\n\t\t\tsdata := string(data)\n\t\t\tvar x int64\n\t\t\tvar err error\n\t\t\t// for mysql, when use bit, it returned \\x01\n\t\t\tif col.SQLType.Name == core.Bit &&\n\t\t\t\tstrings.Contains(session.Engine.DriverName(), \"mysql\") {\n\t\t\t\tif len(data) == 1 {\n\t\t\t\t\tx = int64(data[0])\n\t\t\t\t} else {\n\t\t\t\t\tx = 0\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\t\tx, err = strconv.ParseInt(sdata, 16, 64)\n\t\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\t\tx, err = strconv.ParseInt(sdata, 8, 64)\n\t\t\t} else {\n\t\t\t\tx, err = strconv.ParseInt(sdata, 10, 64)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*int\":\n\t\tcase core.IntType.Kind():\n\t\t\tsdata := string(data)\n\t\t\tvar x int\n\t\t\tvar x1 int64\n\t\t\tvar err error\n\t\t\t// for mysql, when use bit, it returned \\x01\n\t\t\tif col.SQLType.Name == core.Bit &&\n\t\t\t\tstrings.Contains(session.Engine.DriverName(), \"mysql\") {\n\t\t\t\tif len(data) == 1 {\n\t\t\t\t\tx = int(data[0])\n\t\t\t\t} else {\n\t\t\t\t\tx = 0\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 16, 64)\n\t\t\t\tx = int(x1)\n\t\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 8, 64)\n\t\t\t\tx = int(x1)\n\t\t\t} else {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 10, 64)\n\t\t\t\tx = int(x1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*int32\":\n\t\tcase core.Int32Type.Kind():\n\t\t\tsdata := string(data)\n\t\t\tvar x int32\n\t\t\tvar x1 int64\n\t\t\tvar err error\n\t\t\t// for mysql, when use bit, it returned \\x01\n\t\t\tif col.SQLType.Name == core.Bit &&\n\t\t\t\tsession.Engine.dialect.DBType() == core.MYSQL {\n\t\t\t\tif len(data) == 1 {\n\t\t\t\t\tx = int32(data[0])\n\t\t\t\t} else {\n\t\t\t\t\tx = 0\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 16, 64)\n\t\t\t\tx = int32(x1)\n\t\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 8, 64)\n\t\t\t\tx = int32(x1)\n\t\t\t} else {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 10, 64)\n\t\t\t\tx = int32(x1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*int8\":\n\t\tcase core.Int8Type.Kind():\n\t\t\tsdata := string(data)\n\t\t\tvar x int8\n\t\t\tvar x1 int64\n\t\t\tvar err error\n\t\t\t// for mysql, when use bit, it returned \\x01\n\t\t\tif col.SQLType.Name == core.Bit &&\n\t\t\t\tstrings.Contains(session.Engine.DriverName(), \"mysql\") {\n\t\t\t\tif len(data) == 1 {\n\t\t\t\t\tx = int8(data[0])\n\t\t\t\t} else {\n\t\t\t\t\tx = 0\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 16, 64)\n\t\t\t\tx = int8(x1)\n\t\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 8, 64)\n\t\t\t\tx = int8(x1)\n\t\t\t} else {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 10, 64)\n\t\t\t\tx = int8(x1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*int16\":\n\t\tcase core.Int16Type.Kind():\n\t\t\tsdata := string(data)\n\t\t\tvar x int16\n\t\t\tvar x1 int64\n\t\t\tvar err error\n\t\t\t// for mysql, when use bit, it returned \\x01\n\t\t\tif col.SQLType.Name == core.Bit &&\n\t\t\t\tstrings.Contains(session.Engine.DriverName(), \"mysql\") {\n\t\t\t\tif len(data) == 1 {\n\t\t\t\t\tx = int16(data[0])\n\t\t\t\t} else {\n\t\t\t\t\tx = 0\n\t\t\t\t}\n\t\t\t} else if strings.HasPrefix(sdata, \"0x\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 16, 64)\n\t\t\t\tx = int16(x1)\n\t\t\t} else if strings.HasPrefix(sdata, \"0\") {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 8, 64)\n\t\t\t\tx = int16(x1)\n\t\t\t} else {\n\t\t\t\tx1, err = strconv.ParseInt(sdata, 10, 64)\n\t\t\t\tx = int16(x1)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"arg %v as int: %s\", key, err.Error())\n\t\t\t}\n\t\t\tfieldValue.Set(reflect.ValueOf(&x).Convert(fieldType))\n\t\t// case \"*SomeStruct\":\n\t\tcase reflect.Struct:\n\t\t\tswitch fieldType {\n\t\t\t// case \"*.time.Time\":\n\t\t\tcase core.PtrTimeType:\n\t\t\t\tx, err := session.byte2Time(col, data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tv = x\n\t\t\t\tfieldValue.Set(reflect.ValueOf(&x))\n\t\t\tdefault:\n\t\t\t\tif session.Statement.UseCascade {\n\t\t\t\t\tstructInter := reflect.New(fieldType.Elem())\n\t\t\t\t\ttable := session.Engine.autoMapType(structInter.Elem())\n\t\t\t\t\tif table != nil {\n\t\t\t\t\t\tif len(table.PrimaryKeys) > 1 {\n\t\t\t\t\t\t\tpanic(\"unsupported composited primary key cascade\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar pk = make(core.PK, len(table.PrimaryKeys))\n\t\t\t\t\t\tvar err error\n\t\t\t\t\t\trawValueType := table.ColumnType(table.PKColumns()[0].FieldName)\n\t\t\t\t\t\tpk[0], err = str2PK(string(data), rawValueType)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif !isPKZero(pk) {\n\t\t\t\t\t\t\t// !nashtsai! TODO for hasOne relationship, it's preferred to use join query for eager fetch\n\t\t\t\t\t\t\t// however, also need to consider adding a 'lazy' attribute to xorm tag which allow hasOne\n\t\t\t\t\t\t\t// property to be fetched lazily\n\t\t\t\t\t\t\tnewsession := session.Engine.NewSession()\n\t\t\t\t\t\t\tdefer newsession.Close()\n\t\t\t\t\t\t\thas, err := newsession.Id(pk).NoCascade().Get(structInter.Interface())\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif has {\n\t\t\t\t\t\t\t\tv = structInter.Interface()\n\t\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(v))\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn errors.New(\"cascade obj is not exist\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"unsupported struct type in Scan: %s\", fieldValue.Type().String())\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported type in Scan: %s\", fieldValue.Type().String())\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported type in Scan: %s\", fieldValue.Type().String())\n\t}\n\n\treturn nil\n}\n\n// convert a field value of a struct to interface for put into db\nfunc (session *Session) value2Interface(col *core.Column, fieldValue reflect.Value) (interface{}, error) {\n\tif fieldValue.CanAddr() {\n\t\tif fieldConvert, ok := fieldValue.Addr().Interface().(core.Conversion); ok {\n\t\t\tdata, err := fieldConvert.ToDB()\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn string(data), nil\n\t\t}\n\t}\n\n\tif fieldConvert, ok := fieldValue.Interface().(core.Conversion); ok {\n\t\tdata, err := fieldConvert.ToDB()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn string(data), nil\n\t}\n\n\tfieldType := fieldValue.Type()\n\tk := fieldType.Kind()\n\tif k == reflect.Ptr {\n\t\tif fieldValue.IsNil() {\n\t\t\treturn nil, nil\n\t\t} else if !fieldValue.IsValid() {\n\t\t\tsession.Engine.logger.Warn(\"the field[\", col.FieldName, \"] is invalid\")\n\t\t\treturn nil, nil\n\t\t} else {\n\t\t\t// !nashtsai! deference pointer type to instance type\n\t\t\tfieldValue = fieldValue.Elem()\n\t\t\tfieldType = fieldValue.Type()\n\t\t\tk = fieldType.Kind()\n\t\t}\n\t}\n\n\tswitch k {\n\tcase reflect.Bool:\n\t\treturn fieldValue.Bool(), nil\n\tcase reflect.String:\n\t\treturn fieldValue.String(), nil\n\tcase reflect.Struct:\n\t\tif fieldType.ConvertibleTo(core.TimeType) {\n\t\t\tt := fieldValue.Convert(core.TimeType).Interface().(time.Time)\n\t\t\tif session.Engine.dialect.DBType() == core.MSSQL {\n\t\t\t\tif t.IsZero() {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\ttf := session.Engine.FormatTime(col.SQLType.Name, t)\n\t\t\treturn tf, nil\n\t\t}\n\n\t\tif !col.SQLType.IsJson() {\n\t\t\t// !<winxxp>! 增加支持driver.Valuer接口的结构，如sql.NullString\n\t\t\tif v, ok := fieldValue.Interface().(driver.Valuer); ok {\n\t\t\t\treturn v.Value()\n\t\t\t}\n\n\t\t\tfieldTable := session.Engine.autoMapType(fieldValue)\n\t\t\tif len(fieldTable.PrimaryKeys) == 1 {\n\t\t\t\tpkField := reflect.Indirect(fieldValue).FieldByName(fieldTable.PKColumns()[0].FieldName)\n\t\t\t\treturn pkField.Interface(), nil\n\t\t\t}\n\t\t\treturn 0, fmt.Errorf(\"no primary key for col %v\", col.Name)\n\t\t}\n\n\t\tif col.SQLType.IsText() {\n\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn string(bytes), nil\n\t\t} else if col.SQLType.IsBlob() {\n\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn bytes, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Unsupported type %v\", fieldValue.Type())\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\tif err != nil {\n\t\t\tsession.Engine.logger.Error(err)\n\t\t\treturn 0, err\n\t\t}\n\t\treturn string(bytes), nil\n\tcase reflect.Array, reflect.Slice, reflect.Map:\n\t\tif !fieldValue.IsValid() {\n\t\t\treturn fieldValue.Interface(), nil\n\t\t}\n\n\t\tif col.SQLType.IsText() {\n\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn string(bytes), nil\n\t\t} else if col.SQLType.IsBlob() {\n\t\t\tvar bytes []byte\n\t\t\tvar err error\n\t\t\tif (k == reflect.Array || k == reflect.Slice) &&\n\t\t\t\t(fieldValue.Type().Elem().Kind() == reflect.Uint8) {\n\t\t\t\tbytes = fieldValue.Bytes()\n\t\t\t} else {\n\t\t\t\tbytes, err = json.Marshal(fieldValue.Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bytes, nil\n\t\t}\n\t\treturn nil, ErrUnSupportedType\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn int64(fieldValue.Uint()), nil\n\tdefault:\n\t\treturn fieldValue.Interface(), nil\n\t}\n}\n\nfunc (session *Session) innerInsert(bean interface{}) (int64, error) {\n\tsession.Statement.setRefValue(rValue(bean))\n\tif len(session.Statement.TableName()) <= 0 {\n\t\treturn 0, ErrTableNotFound\n\t}\n\n\ttable := session.Statement.RefTable\n\n\t// handle BeforeInsertProcessor\n\tfor _, closure := range session.beforeClosures {\n\t\tclosure(bean)\n\t}\n\tcleanupProcessorsClosures(&session.beforeClosures) // cleanup after used\n\n\tif processor, ok := interface{}(bean).(BeforeInsertProcessor); ok {\n\t\tprocessor.BeforeInsert()\n\t}\n\t// --\n\tcolNames, args, err := genCols(session.Statement.RefTable, session, bean, false, false)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t// insert expr columns, override if exists\n\texprColumns := session.Statement.getExpr()\n\texprColVals := make([]string, 0, len(exprColumns))\n\tfor _, v := range exprColumns {\n\t\t// remove the expr columns\n\t\tfor i, colName := range colNames {\n\t\t\tif colName == v.colName {\n\t\t\t\tcolNames = append(colNames[:i], colNames[i+1:]...)\n\t\t\t\targs = append(args[:i], args[i+1:]...)\n\t\t\t}\n\t\t}\n\n\t\t// append expr column to the end\n\t\tcolNames = append(colNames, v.colName)\n\t\texprColVals = append(exprColVals, v.expr)\n\t}\n\n\tcolPlaces := strings.Repeat(\"?, \", len(colNames)-len(exprColumns))\n\tif len(exprColVals) > 0 {\n\t\tcolPlaces = colPlaces + strings.Join(exprColVals, \", \")\n\t} else {\n\t\tcolPlaces = colPlaces[0 : len(colPlaces)-2]\n\t}\n\n\tsqlStr := fmt.Sprintf(\"INSERT INTO %s (%v%v%v) VALUES (%v)\",\n\t\tsession.Engine.Quote(session.Statement.TableName()),\n\t\tsession.Engine.QuoteStr(),\n\t\tstrings.Join(colNames, session.Engine.Quote(\", \")),\n\t\tsession.Engine.QuoteStr(),\n\t\tcolPlaces)\n\n\thandleAfterInsertProcessorFunc := func(bean interface{}) {\n\n\t\tif session.IsAutoCommit {\n\t\t\tfor _, closure := range session.afterClosures {\n\t\t\t\tclosure(bean)\n\t\t\t}\n\t\t\tif processor, ok := interface{}(bean).(AfterInsertProcessor); ok {\n\t\t\t\tprocessor.AfterInsert()\n\t\t\t}\n\t\t} else {\n\t\t\tlenAfterClosures := len(session.afterClosures)\n\t\t\tif lenAfterClosures > 0 {\n\t\t\t\tif value, has := session.afterInsertBeans[bean]; has && value != nil {\n\t\t\t\t\t*value = append(*value, session.afterClosures...)\n\t\t\t\t} else {\n\t\t\t\t\tafterClosures := make([]func(interface{}), lenAfterClosures)\n\t\t\t\t\tcopy(afterClosures, session.afterClosures)\n\t\t\t\t\tsession.afterInsertBeans[bean] = &afterClosures\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tif _, ok := interface{}(bean).(AfterInsertProcessor); ok {\n\t\t\t\t\tsession.afterInsertBeans[bean] = nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcleanupProcessorsClosures(&session.afterClosures) // cleanup after used\n\t}\n\n\t// for postgres, many of them didn't implement lastInsertId, so we should\n\t// implemented it ourself.\n\tif session.Engine.dialect.DBType() == core.ORACLE && len(table.AutoIncrement) > 0 {\n\t\t//assert table.AutoIncrement != \"\"\n\t\tres, err := session.query(\"select seq_atable.currval from dual\", args...)\n\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\thandleAfterInsertProcessorFunc(bean)\n\n\t\tif cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {\n\t\t\tsession.cacheInsert(session.Statement.TableName())\n\t\t}\n\n\t\tif table.Version != \"\" && session.Statement.checkVersion {\n\t\t\tverValue, err := table.VersionColumn().ValueOf(bean)\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t} else if verValue.IsValid() && verValue.CanSet() {\n\t\t\t\tverValue.SetInt(1)\n\t\t\t}\n\t\t}\n\n\t\tif len(res) < 1 {\n\t\t\treturn 0, errors.New(\"insert no error but not returned id\")\n\t\t}\n\n\t\tidByte := res[0][table.AutoIncrement]\n\t\tid, err := strconv.ParseInt(string(idByte), 10, 64)\n\t\tif err != nil || id <= 0 {\n\t\t\treturn 1, err\n\t\t}\n\n\t\taiValue, err := table.AutoIncrColumn().ValueOf(bean)\n\t\tif err != nil {\n\t\t\tsession.Engine.logger.Error(err)\n\t\t}\n\n\t\tif aiValue == nil || !aiValue.IsValid() || !aiValue.CanSet() {\n\t\t\treturn 1, nil\n\t\t}\n\n\t\taiValue.Set(int64ToIntValue(id, aiValue.Type()))\n\n\t\treturn 1, nil\n\t} else if session.Engine.dialect.DBType() == core.POSTGRES && len(table.AutoIncrement) > 0 {\n\t\t//assert table.AutoIncrement != \"\"\n\t\tsqlStr = sqlStr + \" RETURNING \" + session.Engine.Quote(table.AutoIncrement)\n\t\tres, err := session.query(sqlStr, args...)\n\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\thandleAfterInsertProcessorFunc(bean)\n\n\t\tif cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {\n\t\t\tsession.cacheInsert(session.Statement.TableName())\n\t\t}\n\n\t\tif table.Version != \"\" && session.Statement.checkVersion {\n\t\t\tverValue, err := table.VersionColumn().ValueOf(bean)\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t} else if verValue.IsValid() && verValue.CanSet() {\n\t\t\t\tverValue.SetInt(1)\n\t\t\t}\n\t\t}\n\n\t\tif len(res) < 1 {\n\t\t\treturn 0, errors.New(\"insert no error but not returned id\")\n\t\t}\n\n\t\tidByte := res[0][table.AutoIncrement]\n\t\tid, err := strconv.ParseInt(string(idByte), 10, 64)\n\t\tif err != nil || id <= 0 {\n\t\t\treturn 1, err\n\t\t}\n\n\t\taiValue, err := table.AutoIncrColumn().ValueOf(bean)\n\t\tif err != nil {\n\t\t\tsession.Engine.logger.Error(err)\n\t\t}\n\n\t\tif aiValue == nil || !aiValue.IsValid() || !aiValue.CanSet() {\n\t\t\treturn 1, nil\n\t\t}\n\n\t\taiValue.Set(int64ToIntValue(id, aiValue.Type()))\n\n\t\treturn 1, nil\n\t} else {\n\t\tres, err := session.exec(sqlStr, args...)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\thandleAfterInsertProcessorFunc(bean)\n\n\t\tif cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {\n\t\t\tsession.cacheInsert(session.Statement.TableName())\n\t\t}\n\n\t\tif table.Version != \"\" && session.Statement.checkVersion {\n\t\t\tverValue, err := table.VersionColumn().ValueOf(bean)\n\t\t\tif err != nil {\n\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t} else if verValue.IsValid() && verValue.CanSet() {\n\t\t\t\tverValue.SetInt(1)\n\t\t\t}\n\t\t}\n\n\t\tif table.AutoIncrement == \"\" {\n\t\t\treturn res.RowsAffected()\n\t\t}\n\n\t\tvar id int64\n\t\tid, err = res.LastInsertId()\n\t\tif err != nil || id <= 0 {\n\t\t\treturn res.RowsAffected()\n\t\t}\n\n\t\taiValue, err := table.AutoIncrColumn().ValueOf(bean)\n\t\tif err != nil {\n\t\t\tsession.Engine.logger.Error(err)\n\t\t}\n\n\t\tif aiValue == nil || !aiValue.IsValid() || !aiValue.CanSet() {\n\t\t\treturn res.RowsAffected()\n\t\t}\n\n\t\taiValue.Set(int64ToIntValue(id, aiValue.Type()))\n\n\t\treturn res.RowsAffected()\n\t}\n}\n\n// InsertOne insert only one struct into database as a record.\n// The in parameter bean must a struct or a point to struct. The return\n// parameter is inserted and error\nfunc (session *Session) InsertOne(bean interface{}) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\treturn session.innerInsert(bean)\n}\n\nfunc (session *Session) cacheInsert(tables ...string) error {\n\tif session.Statement.RefTable == nil {\n\t\treturn ErrCacheFailed\n\t}\n\n\ttable := session.Statement.RefTable\n\tcacher := session.Engine.getCacher2(table)\n\n\tfor _, t := range tables {\n\t\tsession.Engine.logger.Debug(\"[cache] clear sql:\", t)\n\t\tcacher.ClearIds(t)\n\t}\n\n\treturn nil\n}\n\nfunc (session *Session) cacheUpdate(sqlStr string, args ...interface{}) error {\n\tif session.Statement.RefTable == nil ||\n\t\tsession.Tx != nil {\n\t\treturn ErrCacheFailed\n\t}\n\n\toldhead, newsql := session.Statement.convertUpdateSQL(sqlStr)\n\tif newsql == \"\" {\n\t\treturn ErrCacheFailed\n\t}\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\tnewsql = filter.Do(newsql, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\tsession.Engine.logger.Debug(\"[cacheUpdate] new sql\", oldhead, newsql)\n\n\tvar nStart int\n\tif len(args) > 0 {\n\t\tif strings.Index(sqlStr, \"?\") > -1 {\n\t\t\tnStart = strings.Count(oldhead, \"?\")\n\t\t} else {\n\t\t\t// only for pq, TODO: if any other databse?\n\t\t\tnStart = strings.Count(oldhead, \"$\")\n\t\t}\n\t}\n\ttable := session.Statement.RefTable\n\tcacher := session.Engine.getCacher2(table)\n\ttableName := session.Statement.TableName()\n\tsession.Engine.logger.Debug(\"[cacheUpdate] get cache sql\", newsql, args[nStart:])\n\tids, err := core.GetCacheSql(cacher, tableName, newsql, args[nStart:])\n\tif err != nil {\n\t\trows, err := session.DB().Query(newsql, args[nStart:]...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tids = make([]core.PK, 0)\n\t\tfor rows.Next() {\n\t\t\tvar res = make([]string, len(table.PrimaryKeys))\n\t\t\terr = rows.ScanSlice(&res)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvar pk core.PK = make([]interface{}, len(table.PrimaryKeys))\n\t\t\tfor i, col := range table.PKColumns() {\n\t\t\t\tif col.SQLType.IsNumeric() {\n\t\t\t\t\tn, err := strconv.ParseInt(res[i], 10, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tpk[i] = n\n\t\t\t\t} else if col.SQLType.IsText() {\n\t\t\t\t\tpk[i] = res[i]\n\t\t\t\t} else {\n\t\t\t\t\treturn errors.New(\"not supported\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tids = append(ids, pk)\n\t\t}\n\t\tsession.Engine.logger.Debug(\"[cacheUpdate] find updated id\", ids)\n\t} /*else {\n\t    session.Engine.LogDebug(\"[xorm:cacheUpdate] del cached sql:\", tableName, newsql, args)\n\t    cacher.DelIds(tableName, genSqlKey(newsql, args))\n\t}*/\n\n\tfor _, id := range ids {\n\t\tsid, err := id.ToString()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif bean := cacher.GetBean(tableName, sid); bean != nil {\n\t\t\tsqls := splitNNoCase(sqlStr, \"where\", 2)\n\t\t\tif len(sqls) == 0 || len(sqls) > 2 {\n\t\t\t\treturn ErrCacheFailed\n\t\t\t}\n\n\t\t\tsqls = splitNNoCase(sqls[0], \"set\", 2)\n\t\t\tif len(sqls) != 2 {\n\t\t\t\treturn ErrCacheFailed\n\t\t\t}\n\t\t\tkvs := strings.Split(strings.TrimSpace(sqls[1]), \",\")\n\t\t\tfor idx, kv := range kvs {\n\t\t\t\tsps := strings.SplitN(kv, \"=\", 2)\n\t\t\t\tsps2 := strings.Split(sps[0], \".\")\n\t\t\t\tcolName := sps2[len(sps2)-1]\n\t\t\t\tif strings.Contains(colName, \"`\") {\n\t\t\t\t\tcolName = strings.TrimSpace(strings.Replace(colName, \"`\", \"\", -1))\n\t\t\t\t} else if strings.Contains(colName, session.Engine.QuoteStr()) {\n\t\t\t\t\tcolName = strings.TrimSpace(strings.Replace(colName, session.Engine.QuoteStr(), \"\", -1))\n\t\t\t\t} else {\n\t\t\t\t\tsession.Engine.logger.Debug(\"[cacheUpdate] cannot find column\", tableName, colName)\n\t\t\t\t\treturn ErrCacheFailed\n\t\t\t\t}\n\n\t\t\t\tif col := table.GetColumn(colName); col != nil {\n\t\t\t\t\tfieldValue, err := col.ValueOf(bean)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tsession.Engine.logger.Error(err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsession.Engine.logger.Debug(\"[cacheUpdate] set bean field\", bean, colName, fieldValue.Interface())\n\t\t\t\t\t\tif col.IsVersion && session.Statement.checkVersion {\n\t\t\t\t\t\t\tfieldValue.SetInt(fieldValue.Int() + 1)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfieldValue.Set(reflect.ValueOf(args[idx]))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsession.Engine.logger.Errorf(\"[cacheUpdate] ERROR: column %v is not table %v's\",\n\t\t\t\t\t\tcolName, table.Name)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsession.Engine.logger.Debug(\"[cacheUpdate] update cache\", tableName, id, bean)\n\t\t\tcacher.PutBean(tableName, sid, bean)\n\t\t}\n\t}\n\tsession.Engine.logger.Debug(\"[cacheUpdate] clear cached table sql:\", tableName)\n\tcacher.ClearIds(tableName)\n\treturn nil\n}\n\n// Update records, bean's non-empty fields are updated contents,\n// condiBean' non-empty filds are conditions\n// CAUTION:\n//        1.bool will defaultly be updated content nor conditions\n//         You should call UseBool if you have bool to use.\n//        2.float32 & float64 may be not inexact as conditions\nfunc (session *Session) Update(bean interface{}, condiBean ...interface{}) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tv := rValue(bean)\n\tt := v.Type()\n\n\tvar colNames []string\n\tvar args []interface{}\n\n\t// handle before update processors\n\tfor _, closure := range session.beforeClosures {\n\t\tclosure(bean)\n\t}\n\tcleanupProcessorsClosures(&session.beforeClosures) // cleanup after used\n\tif processor, ok := interface{}(bean).(BeforeUpdateProcessor); ok {\n\t\tprocessor.BeforeUpdate()\n\t}\n\t// --\n\n\tvar err error\n\tvar isMap = t.Kind() == reflect.Map\n\tvar isStruct = t.Kind() == reflect.Struct\n\tif isStruct {\n\t\tsession.Statement.setRefValue(v)\n\n\t\tif len(session.Statement.TableName()) <= 0 {\n\t\t\treturn 0, ErrTableNotFound\n\t\t}\n\n\t\tif session.Statement.ColumnStr == \"\" {\n\t\t\tcolNames, args = buildUpdates(session.Engine, session.Statement.RefTable, bean, false, false,\n\t\t\t\tfalse, false, session.Statement.allUseBool, session.Statement.useAllCols,\n\t\t\t\tsession.Statement.mustColumnMap, session.Statement.nullableMap,\n\t\t\t\tsession.Statement.columnMap, true, session.Statement.unscoped)\n\t\t} else {\n\t\t\tcolNames, args, err = genCols(session.Statement.RefTable, session, bean, true, true)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t} else if isMap {\n\t\tcolNames = make([]string, 0)\n\t\targs = make([]interface{}, 0)\n\t\tbValue := reflect.Indirect(reflect.ValueOf(bean))\n\n\t\tfor _, v := range bValue.MapKeys() {\n\t\t\tcolNames = append(colNames, session.Engine.Quote(v.String())+\" = ?\")\n\t\t\targs = append(args, bValue.MapIndex(v).Interface())\n\t\t}\n\t} else {\n\t\treturn 0, ErrParamsType\n\t}\n\n\ttable := session.Statement.RefTable\n\n\tif session.Statement.UseAutoTime && table != nil && table.Updated != \"\" {\n\t\tcolNames = append(colNames, session.Engine.Quote(table.Updated)+\" = ?\")\n\t\tcol := table.UpdatedColumn()\n\t\tval, t := session.Engine.NowTime2(col.SQLType.Name)\n\t\targs = append(args, val)\n\n\t\tvar colName = col.Name\n\t\tif isStruct {\n\t\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\t\tcol := table.GetColumn(colName)\n\t\t\t\tsetColumnTime(bean, col, t)\n\t\t\t})\n\t\t}\n\t}\n\n\t//for update action to like \"column = column + ?\"\n\tincColumns := session.Statement.getInc()\n\tfor _, v := range incColumns {\n\t\tcolNames = append(colNames, session.Engine.Quote(v.colName)+\" = \"+session.Engine.Quote(v.colName)+\" + ?\")\n\t\targs = append(args, v.arg)\n\t}\n\t//for update action to like \"column = column - ?\"\n\tdecColumns := session.Statement.getDec()\n\tfor _, v := range decColumns {\n\t\tcolNames = append(colNames, session.Engine.Quote(v.colName)+\" = \"+session.Engine.Quote(v.colName)+\" - ?\")\n\t\targs = append(args, v.arg)\n\t}\n\t//for update action to like \"column = expression\"\n\texprColumns := session.Statement.getExpr()\n\tfor _, v := range exprColumns {\n\t\tcolNames = append(colNames, session.Engine.Quote(v.colName)+\" = \"+v.expr)\n\t}\n\n\tvar condiColNames []string\n\tvar condiArgs []interface{}\n\n\tif !session.Statement.noAutoCondition && len(condiBean) > 0 {\n\t\tcondiColNames, condiArgs = session.Statement.buildConditions(session.Statement.RefTable, condiBean[0], true, true, false, true, false)\n\t}\n\n\tvar condition = \"\"\n\tsession.Statement.processIdParam()\n\tst := session.Statement\n\tdefer session.resetStatement()\n\tif st.WhereStr != \"\" {\n\t\tcondition = fmt.Sprintf(\"%v\", st.WhereStr)\n\t}\n\n\tif condition == \"\" {\n\t\tif len(condiColNames) > 0 {\n\t\t\tcondition = fmt.Sprintf(\"%v\", strings.Join(condiColNames, \" \"+session.Engine.Dialect().AndStr()+\" \"))\n\t\t}\n\t} else {\n\t\tif len(condiColNames) > 0 {\n\t\t\tcondition = fmt.Sprintf(\"(%v) %v (%v)\", condition,\n\t\t\t\tsession.Engine.Dialect().AndStr(), strings.Join(condiColNames, \" \"+session.Engine.Dialect().AndStr()+\" \"))\n\t\t}\n\t}\n\n\tvar sqlStr, inSQL string\n\tvar inArgs []interface{}\n\tdoIncVer := false\n\tvar verValue *reflect.Value\n\tif table != nil && table.Version != \"\" && session.Statement.checkVersion {\n\t\tif condition != \"\" {\n\t\t\tcondition = fmt.Sprintf(\"WHERE (%v) %v %v = ?\", condition, session.Engine.Dialect().AndStr(),\n\t\t\t\tsession.Engine.Quote(table.Version))\n\t\t} else {\n\t\t\tcondition = fmt.Sprintf(\"WHERE %v = ?\", session.Engine.Quote(table.Version))\n\t\t}\n\t\tinSQL, inArgs = session.Statement.genInSql()\n\t\tif len(inSQL) > 0 {\n\t\t\tif condition != \"\" {\n\t\t\t\tcondition += \" \" + session.Engine.Dialect().AndStr() + \" \" + inSQL\n\t\t\t} else {\n\t\t\t\tcondition = \"WHERE \" + inSQL\n\t\t\t}\n\t\t}\n\n\t\tif st.LimitN > 0 {\n\t\t\tcondition = condition + fmt.Sprintf(\" LIMIT %d\", st.LimitN)\n\t\t}\n\n\t\tsqlStr = fmt.Sprintf(\"UPDATE %v SET %v, %v %v\",\n\t\t\tsession.Engine.Quote(session.Statement.TableName()),\n\t\t\tstrings.Join(colNames, \", \"),\n\t\t\tsession.Engine.Quote(table.Version)+\" = \"+session.Engine.Quote(table.Version)+\" + 1\",\n\t\t\tcondition)\n\n\t\tverValue, err = table.VersionColumn().ValueOf(bean)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tcondiArgs = append(condiArgs, verValue.Interface())\n\t\tdoIncVer = true\n\t} else {\n\t\tif condition != \"\" {\n\t\t\tcondition = \"WHERE \" + condition\n\t\t}\n\t\tinSQL, inArgs = session.Statement.genInSql()\n\t\tif len(inSQL) > 0 {\n\t\t\tif condition != \"\" {\n\t\t\t\tcondition += \" \" + session.Engine.Dialect().AndStr() + \" \" + inSQL\n\t\t\t} else {\n\t\t\t\tcondition = \"WHERE \" + inSQL\n\t\t\t}\n\t\t}\n\n\t\tif st.LimitN > 0 {\n\t\t\tcondition = condition + fmt.Sprintf(\" LIMIT %d\", st.LimitN)\n\t\t}\n\n\t\tsqlStr = fmt.Sprintf(\"UPDATE %v SET %v %v\",\n\t\t\tsession.Engine.Quote(session.Statement.TableName()),\n\t\t\tstrings.Join(colNames, \", \"),\n\t\t\tcondition)\n\t}\n\n\targs = append(args, st.Params...)\n\targs = append(args, inArgs...)\n\targs = append(args, condiArgs...)\n\n\tres, err := session.exec(sqlStr, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t} else if doIncVer {\n\t\tif verValue != nil && verValue.IsValid() && verValue.CanSet() {\n\t\t\tverValue.SetInt(verValue.Int() + 1)\n\t\t}\n\t}\n\n\tif table != nil {\n\t\tif cacher := session.Engine.getCacher2(table); cacher != nil && session.Statement.UseCache {\n\t\t\tcacher.ClearIds(session.Statement.TableName())\n\t\t\tcacher.ClearBeans(session.Statement.TableName())\n\t\t}\n\t}\n\n\t// handle after update processors\n\tif session.IsAutoCommit {\n\t\tfor _, closure := range session.afterClosures {\n\t\t\tclosure(bean)\n\t\t}\n\t\tif processor, ok := interface{}(bean).(AfterUpdateProcessor); ok {\n\t\t\tsession.Engine.logger.Debug(\"[event]\", session.Statement.TableName(), \" has after update processor\")\n\t\t\tprocessor.AfterUpdate()\n\t\t}\n\t} else {\n\t\tlenAfterClosures := len(session.afterClosures)\n\t\tif lenAfterClosures > 0 {\n\t\t\tif value, has := session.afterUpdateBeans[bean]; has && value != nil {\n\t\t\t\t*value = append(*value, session.afterClosures...)\n\t\t\t} else {\n\t\t\t\tafterClosures := make([]func(interface{}), lenAfterClosures)\n\t\t\t\tcopy(afterClosures, session.afterClosures)\n\t\t\t\t// FIXME: if bean is a map type, it will panic because map cannot be as map key\n\t\t\t\tsession.afterUpdateBeans[bean] = &afterClosures\n\t\t\t}\n\n\t\t} else {\n\t\t\tif _, ok := interface{}(bean).(AfterInsertProcessor); ok {\n\t\t\t\tsession.afterUpdateBeans[bean] = nil\n\t\t\t}\n\t\t}\n\t}\n\tcleanupProcessorsClosures(&session.afterClosures) // cleanup after used\n\t// --\n\n\treturn res.RowsAffected()\n}\n\nfunc (session *Session) cacheDelete(sqlStr string, args ...interface{}) error {\n\tif session.Statement.RefTable == nil ||\n\t\tsession.Tx != nil {\n\t\treturn ErrCacheFailed\n\t}\n\n\tfor _, filter := range session.Engine.dialect.Filters() {\n\t\tsqlStr = filter.Do(sqlStr, session.Engine.dialect, session.Statement.RefTable)\n\t}\n\n\tnewsql := session.Statement.convertIdSql(sqlStr)\n\tif newsql == \"\" {\n\t\treturn ErrCacheFailed\n\t}\n\n\tcacher := session.Engine.getCacher2(session.Statement.RefTable)\n\ttableName := session.Statement.TableName()\n\tids, err := core.GetCacheSql(cacher, tableName, newsql, args)\n\tif err != nil {\n\t\tresultsSlice, err := session.query(newsql, args...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tids = make([]core.PK, 0)\n\t\tif len(resultsSlice) > 0 {\n\t\t\tfor _, data := range resultsSlice {\n\t\t\t\tvar id int64\n\t\t\t\tvar pk core.PK = make([]interface{}, 0)\n\t\t\t\tfor _, col := range session.Statement.RefTable.PKColumns() {\n\t\t\t\t\tif v, ok := data[col.Name]; !ok {\n\t\t\t\t\t\treturn errors.New(\"no id\")\n\t\t\t\t\t} else if col.SQLType.IsText() {\n\t\t\t\t\t\tpk = append(pk, string(v))\n\t\t\t\t\t} else if col.SQLType.IsNumeric() {\n\t\t\t\t\t\tid, err = strconv.ParseInt(string(v), 10, 64)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpk = append(pk, id)\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn errors.New(\"not supported primary key type\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tids = append(ids, pk)\n\t\t\t}\n\t\t}\n\t} /*else {\n\t    session.Engine.LogDebug(\"delete cache sql %v\", newsql)\n\t    cacher.DelIds(tableName, genSqlKey(newsql, args))\n\t}*/\n\n\tfor _, id := range ids {\n\t\tsession.Engine.logger.Debug(\"[cacheDelete] delete cache obj\", tableName, id)\n\t\tsid, err := id.ToString()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcacher.DelBean(tableName, sid)\n\t}\n\tsession.Engine.logger.Debug(\"[cacheDelete] clear cache sql\", tableName)\n\tcacher.ClearIds(tableName)\n\treturn nil\n}\n\n// Delete records, bean's non-empty fields are conditions\nfunc (session *Session) Delete(bean interface{}) (int64, error) {\n\tdefer session.resetStatement()\n\tif session.IsAutoClose {\n\t\tdefer session.Close()\n\t}\n\n\tsession.Statement.setRefValue(rValue(bean))\n\tvar table = session.Statement.RefTable\n\n\t// handle before delete processors\n\tfor _, closure := range session.beforeClosures {\n\t\tclosure(bean)\n\t}\n\tcleanupProcessorsClosures(&session.beforeClosures)\n\n\tif processor, ok := interface{}(bean).(BeforeDeleteProcessor); ok {\n\t\tprocessor.BeforeDelete()\n\t}\n\t// --\n\n\tvar colNames []string\n\tvar args []interface{}\n\n\tif !session.Statement.noAutoCondition {\n\t\tcolNames, args = session.Statement.buildConditions(table, bean, true, true, false, true, false)\n\t}\n\tvar condition = \"\"\n\tvar andStr = session.Engine.dialect.AndStr()\n\n\tsession.Statement.processIdParam()\n\tif session.Statement.WhereStr != \"\" {\n\t\tcondition = session.Statement.WhereStr\n\t\tif len(colNames) > 0 {\n\t\t\tcondition += \" \" + andStr + \" \" + strings.Join(colNames, \" \"+andStr+\" \")\n\t\t}\n\t} else {\n\t\tcondition = strings.Join(colNames, \" \"+andStr+\" \")\n\t}\n\tinSQL, inArgs := session.Statement.genInSql()\n\tif len(inSQL) > 0 {\n\t\tif len(condition) > 0 {\n\t\t\tcondition += \" \" + andStr + \" \"\n\t\t}\n\t\tcondition += inSQL\n\t\targs = append(args, inArgs...)\n\t}\n\tif len(condition) == 0 && session.Statement.LimitN == 0 {\n\t\treturn 0, ErrNeedDeletedCond\n\t}\n\n\tvar deleteSQL, realSQL string\n\tvar tableName = session.Engine.Quote(session.Statement.TableName())\n\n\tif len(condition) > 0 {\n\t\tdeleteSQL = fmt.Sprintf(\"DELETE FROM %v WHERE %v\", tableName, condition)\n\t} else {\n\t\tdeleteSQL = fmt.Sprintf(\"DELETE FROM %v\", tableName)\n\t}\n\n\tvar orderSQL string\n\tif len(session.Statement.OrderStr) > 0 {\n\t\torderSQL += fmt.Sprintf(\" ORDER BY %s\", session.Statement.OrderStr)\n\t}\n\tif session.Statement.LimitN > 0 {\n\t\torderSQL += fmt.Sprintf(\" LIMIT %d\", session.Statement.LimitN)\n\t}\n\n\tif len(orderSQL) > 0 {\n\t\tswitch session.Engine.dialect.DBType() {\n\t\tcase core.POSTGRES:\n\t\t\tinSQL := fmt.Sprintf(\"ctid IN (SELECT ctid FROM %s%s)\", tableName, orderSQL)\n\t\t\tif len(condition) > 0 {\n\t\t\t\tdeleteSQL += \" AND \" + inSQL\n\t\t\t} else {\n\t\t\t\tdeleteSQL += \" WHERE \" + inSQL\n\t\t\t}\n\t\tcase core.SQLITE:\n\t\t\tinSQL := fmt.Sprintf(\"rowid IN (SELECT rowid FROM %s%s)\", tableName, orderSQL)\n\t\t\tif len(condition) > 0 {\n\t\t\t\tdeleteSQL += \" AND \" + inSQL\n\t\t\t} else {\n\t\t\t\tdeleteSQL += \" WHERE \" + inSQL\n\t\t\t}\n\t\t// TODO: how to handle delete limit on mssql?\n\t\tcase core.MSSQL:\n\t\t\treturn 0, ErrNotImplemented\n\t\tdefault:\n\t\t\tdeleteSQL += orderSQL\n\t\t}\n\t}\n\n\targsForCache := make([]interface{}, 0, len(args)*2)\n\tif session.Statement.unscoped || table.DeletedColumn() == nil { // tag \"deleted\" is disabled\n\t\trealSQL = deleteSQL\n\t\tcopy(argsForCache, args)\n\t\targsForCache = append(session.Statement.Params, argsForCache...)\n\t} else {\n\t\t// !oinume! sqlStrForCache and argsForCache is needed to behave as executing \"DELETE FROM ...\" for cache.\n\t\tcopy(argsForCache, args)\n\t\targsForCache = append(session.Statement.Params, argsForCache...)\n\n\t\tdeletedColumn := table.DeletedColumn()\n\t\trealSQL = fmt.Sprintf(\"UPDATE %v SET %v = ? WHERE %v\",\n\t\t\tsession.Engine.Quote(session.Statement.TableName()),\n\t\t\tsession.Engine.Quote(deletedColumn.Name),\n\t\t\tcondition)\n\n\t\tif len(orderSQL) > 0 {\n\t\t\tswitch session.Engine.dialect.DBType() {\n\t\t\tcase core.POSTGRES:\n\t\t\t\tinSQL := fmt.Sprintf(\"ctid IN (SELECT ctid FROM %s%s)\", tableName, orderSQL)\n\t\t\t\tif len(condition) > 0 {\n\t\t\t\t\trealSQL += \" AND \" + inSQL\n\t\t\t\t} else {\n\t\t\t\t\trealSQL += \" WHERE \" + inSQL\n\t\t\t\t}\n\t\t\tcase core.SQLITE:\n\t\t\t\tinSQL := fmt.Sprintf(\"rowid IN (SELECT rowid FROM %s%s)\", tableName, orderSQL)\n\t\t\t\tif len(condition) > 0 {\n\t\t\t\t\trealSQL += \" AND \" + inSQL\n\t\t\t\t} else {\n\t\t\t\t\trealSQL += \" WHERE \" + inSQL\n\t\t\t\t}\n\t\t\t// TODO: how to handle delete limit on mssql?\n\t\t\tcase core.MSSQL:\n\t\t\t\treturn 0, ErrNotImplemented\n\t\t\tdefault:\n\t\t\t\trealSQL += orderSQL\n\t\t\t}\n\t\t}\n\n\t\t// !oinume! Insert NowTime to the head of session.Statement.Params\n\t\tsession.Statement.Params = append(session.Statement.Params, \"\")\n\t\tparamsLen := len(session.Statement.Params)\n\t\tcopy(session.Statement.Params[1:paramsLen], session.Statement.Params[0:paramsLen-1])\n\n\t\tval, t := session.Engine.NowTime2(deletedColumn.SQLType.Name)\n\t\tsession.Statement.Params[0] = val\n\n\t\tvar colName = deletedColumn.Name\n\t\tsession.afterClosures = append(session.afterClosures, func(bean interface{}) {\n\t\t\tcol := table.GetColumn(colName)\n\t\t\tsetColumnTime(bean, col, t)\n\t\t})\n\t}\n\n\targs = append(session.Statement.Params, args...)\n\n\tif cacher := session.Engine.getCacher2(session.Statement.RefTable); cacher != nil && session.Statement.UseCache {\n\t\tsession.cacheDelete(deleteSQL, argsForCache...)\n\t}\n\n\tres, err := session.exec(realSQL, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// handle after delete processors\n\tif session.IsAutoCommit {\n\t\tfor _, closure := range session.afterClosures {\n\t\t\tclosure(bean)\n\t\t}\n\t\tif processor, ok := interface{}(bean).(AfterDeleteProcessor); ok {\n\t\t\tprocessor.AfterDelete()\n\t\t}\n\t} else {\n\t\tlenAfterClosures := len(session.afterClosures)\n\t\tif lenAfterClosures > 0 {\n\t\t\tif value, has := session.afterDeleteBeans[bean]; has && value != nil {\n\t\t\t\t*value = append(*value, session.afterClosures...)\n\t\t\t} else {\n\t\t\t\tafterClosures := make([]func(interface{}), lenAfterClosures)\n\t\t\t\tcopy(afterClosures, session.afterClosures)\n\t\t\t\tsession.afterDeleteBeans[bean] = &afterClosures\n\t\t\t}\n\t\t} else {\n\t\t\tif _, ok := interface{}(bean).(AfterInsertProcessor); ok {\n\t\t\t\tsession.afterDeleteBeans[bean] = nil\n\t\t\t}\n\t\t}\n\t}\n\tcleanupProcessorsClosures(&session.afterClosures)\n\t// --\n\n\treturn res.RowsAffected()\n}\n\n// saveLastSQL stores executed query information\nfunc (session *Session) saveLastSQL(sql string, args ...interface{}) {\n\tsession.lastSQL = sql\n\tsession.lastSQLArgs = args\n\tsession.Engine.logSQL(sql, args...)\n}\n\n// LastSQL returns last query information\nfunc (session *Session) LastSQL() (string, []interface{}) {\n\treturn session.lastSQL, session.lastSQLArgs\n}\n\n// tbName get some table's table name\nfunc (session *Session) tbNameNoSchema(table *core.Table) string {\n\tif len(session.Statement.AltTableName) > 0 {\n\t\treturn session.Statement.AltTableName\n\t}\n\n\treturn table.Name\n}\n\n// Sync2 synchronize structs to database tables\nfunc (session *Session) Sync2(beans ...interface{}) error {\n\tengine := session.Engine\n\n\ttables, err := engine.DBMetas()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar structTables []*core.Table\n\n\tfor _, bean := range beans {\n\t\tv := rValue(bean)\n\t\ttable := engine.mapType(v)\n\t\tstructTables = append(structTables, table)\n\t\tvar tbName = session.tbNameNoSchema(table)\n\n\t\tvar oriTable *core.Table\n\t\tfor _, tb := range tables {\n\t\t\tif equalNoCase(tb.Name, tbName) {\n\t\t\t\toriTable = tb\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif oriTable == nil {\n\t\t\terr = session.StoreEngine(session.Statement.StoreEngine).CreateTable(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = session.CreateUniques(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = session.CreateIndexes(bean)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, col := range table.Columns() {\n\t\t\t\tvar oriCol *core.Column\n\t\t\t\tfor _, col2 := range oriTable.Columns() {\n\t\t\t\t\tif equalNoCase(col.Name, col2.Name) {\n\t\t\t\t\t\toriCol = col2\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif oriCol != nil {\n\t\t\t\t\texpectedType := engine.dialect.SqlType(col)\n\t\t\t\t\tcurType := engine.dialect.SqlType(oriCol)\n\t\t\t\t\tif expectedType != curType {\n\t\t\t\t\t\tif expectedType == core.Text &&\n\t\t\t\t\t\t\tstrings.HasPrefix(curType, core.Varchar) {\n\t\t\t\t\t\t\t// currently only support mysql & postgres\n\t\t\t\t\t\t\tif engine.dialect.DBType() == core.MYSQL ||\n\t\t\t\t\t\t\t\tengine.dialect.DBType() == core.POSTGRES {\n\t\t\t\t\t\t\t\tengine.logger.Infof(\"Table %s column %s change type from %s to %s\\n\",\n\t\t\t\t\t\t\t\t\ttbName, col.Name, curType, expectedType)\n\t\t\t\t\t\t\t\t_, err = engine.Exec(engine.dialect.ModifyColumnSql(table.Name, col))\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tengine.logger.Warnf(\"Table %s column %s db type is %s, struct type is %s\\n\",\n\t\t\t\t\t\t\t\t\ttbName, col.Name, curType, expectedType)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if strings.HasPrefix(curType, core.Varchar) && strings.HasPrefix(expectedType, core.Varchar) {\n\t\t\t\t\t\t\tif engine.dialect.DBType() == core.MYSQL {\n\t\t\t\t\t\t\t\tif oriCol.Length < col.Length {\n\t\t\t\t\t\t\t\t\tengine.logger.Infof(\"Table %s column %s change type from varchar(%d) to varchar(%d)\\n\",\n\t\t\t\t\t\t\t\t\t\ttbName, col.Name, oriCol.Length, col.Length)\n\t\t\t\t\t\t\t\t\t_, err = engine.Exec(engine.dialect.ModifyColumnSql(table.Name, col))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif !(strings.HasPrefix(curType, expectedType) && curType[len(expectedType)] == '(') {\n\t\t\t\t\t\t\t\tengine.logger.Warnf(\"Table %s column %s db type is %s, struct type is %s\",\n\t\t\t\t\t\t\t\t\ttbName, col.Name, curType, expectedType)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if expectedType == core.Varchar {\n\t\t\t\t\t\tif engine.dialect.DBType() == core.MYSQL {\n\t\t\t\t\t\t\tif oriCol.Length < col.Length {\n\t\t\t\t\t\t\t\tengine.logger.Infof(\"Table %s column %s change type from varchar(%d) to varchar(%d)\\n\",\n\t\t\t\t\t\t\t\t\ttbName, col.Name, oriCol.Length, col.Length)\n\t\t\t\t\t\t\t\t_, err = engine.Exec(engine.dialect.ModifyColumnSql(table.Name, col))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif col.Default != oriCol.Default {\n\t\t\t\t\t\tengine.logger.Warnf(\"Table %s Column %s db default is %s, struct default is %s\",\n\t\t\t\t\t\t\ttbName, col.Name, oriCol.Default, col.Default)\n\t\t\t\t\t}\n\t\t\t\t\tif col.Nullable != oriCol.Nullable {\n\t\t\t\t\t\tengine.logger.Warnf(\"Table %s Column %s db nullable is %v, struct nullable is %v\",\n\t\t\t\t\t\t\ttbName, col.Name, oriCol.Nullable, col.Nullable)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\tsession.Statement.tableName = tbName\n\t\t\t\t\tdefer session.Close()\n\t\t\t\t\terr = session.addColumn(col.Name)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar foundIndexNames = make(map[string]bool)\n\t\t\tvar addedNames = make(map[string]*core.Index)\n\n\t\t\tfor name, index := range table.Indexes {\n\t\t\t\tvar oriIndex *core.Index\n\t\t\t\tfor name2, index2 := range oriTable.Indexes {\n\t\t\t\t\tif index.Equal(index2) {\n\t\t\t\t\t\toriIndex = index2\n\t\t\t\t\t\tfoundIndexNames[name2] = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif oriIndex != nil {\n\t\t\t\t\tif oriIndex.Type != index.Type {\n\t\t\t\t\t\tsql := engine.dialect.DropIndexSql(tbName, oriIndex)\n\t\t\t\t\t\t_, err = engine.Exec(sql)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\toriIndex = nil\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif oriIndex == nil {\n\t\t\t\t\taddedNames[name] = index\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor name2, index2 := range oriTable.Indexes {\n\t\t\t\tif _, ok := foundIndexNames[name2]; !ok {\n\t\t\t\t\tsql := engine.dialect.DropIndexSql(tbName, index2)\n\t\t\t\t\t_, err = engine.Exec(sql)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor name, index := range addedNames {\n\t\t\t\tif index.Type == core.UniqueType {\n\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\tsession.Statement.tableName = tbName\n\t\t\t\t\tdefer session.Close()\n\t\t\t\t\terr = session.addUnique(tbName, name)\n\t\t\t\t} else if index.Type == core.IndexType {\n\t\t\t\t\tsession := engine.NewSession()\n\t\t\t\t\tsession.Statement.RefTable = table\n\t\t\t\t\tsession.Statement.tableName = tbName\n\t\t\t\t\tdefer session.Close()\n\t\t\t\t\terr = session.addIndex(tbName, name)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, table := range tables {\n\t\tvar oriTable *core.Table\n\t\tfor _, structTable := range structTables {\n\t\t\tif equalNoCase(table.Name, session.tbNameNoSchema(structTable)) {\n\t\t\t\toriTable = structTable\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif oriTable == nil {\n\t\t\t//engine.LogWarnf(\"Table %s has no struct to mapping it\", table.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, colName := range table.ColumnsSeq() {\n\t\t\tif oriTable.GetColumn(colName) == nil {\n\t\t\t\tengine.logger.Warnf(\"Table %s has column %s but struct has not related field\", table.Name, colName)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Unscoped always disable struct tag \"deleted\"\nfunc (session *Session) Unscoped() *Session {\n\tsession.Statement.Unscoped()\n\treturn session\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/sqlite3_dialect.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"database/sql\"\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"strings\"\n\n\t\"github.com/go-xorm/core\"\n)\n\n// func init() {\n// \tRegisterDialect(\"sqlite3\", &sqlite3{})\n// }\n\nvar (\n\tsqlite3ReservedWords = map[string]bool{\n\t\t\"ABORT\":             true,\n\t\t\"ACTION\":            true,\n\t\t\"ADD\":               true,\n\t\t\"AFTER\":             true,\n\t\t\"ALL\":               true,\n\t\t\"ALTER\":             true,\n\t\t\"ANALYZE\":           true,\n\t\t\"AND\":               true,\n\t\t\"AS\":                true,\n\t\t\"ASC\":               true,\n\t\t\"ATTACH\":            true,\n\t\t\"AUTOINCREMENT\":     true,\n\t\t\"BEFORE\":            true,\n\t\t\"BEGIN\":             true,\n\t\t\"BETWEEN\":           true,\n\t\t\"BY\":                true,\n\t\t\"CASCADE\":           true,\n\t\t\"CASE\":              true,\n\t\t\"CAST\":              true,\n\t\t\"CHECK\":             true,\n\t\t\"COLLATE\":           true,\n\t\t\"COLUMN\":            true,\n\t\t\"COMMIT\":            true,\n\t\t\"CONFLICT\":          true,\n\t\t\"CONSTRAINT\":        true,\n\t\t\"CREATE\":            true,\n\t\t\"CROSS\":             true,\n\t\t\"CURRENT_DATE\":      true,\n\t\t\"CURRENT_TIME\":      true,\n\t\t\"CURRENT_TIMESTAMP\": true,\n\t\t\"DATABASE\":          true,\n\t\t\"DEFAULT\":           true,\n\t\t\"DEFERRABLE\":        true,\n\t\t\"DEFERRED\":          true,\n\t\t\"DELETE\":            true,\n\t\t\"DESC\":              true,\n\t\t\"DETACH\":            true,\n\t\t\"DISTINCT\":          true,\n\t\t\"DROP\":              true,\n\t\t\"EACH\":              true,\n\t\t\"ELSE\":              true,\n\t\t\"END\":               true,\n\t\t\"ESCAPE\":            true,\n\t\t\"EXCEPT\":            true,\n\t\t\"EXCLUSIVE\":         true,\n\t\t\"EXISTS\":            true,\n\t\t\"EXPLAIN\":           true,\n\t\t\"FAIL\":              true,\n\t\t\"FOR\":               true,\n\t\t\"FOREIGN\":           true,\n\t\t\"FROM\":              true,\n\t\t\"FULL\":              true,\n\t\t\"GLOB\":              true,\n\t\t\"GROUP\":             true,\n\t\t\"HAVING\":            true,\n\t\t\"IF\":                true,\n\t\t\"IGNORE\":            true,\n\t\t\"IMMEDIATE\":         true,\n\t\t\"IN\":                true,\n\t\t\"INDEX\":             true,\n\t\t\"INDEXED\":           true,\n\t\t\"INITIALLY\":         true,\n\t\t\"INNER\":             true,\n\t\t\"INSERT\":            true,\n\t\t\"INSTEAD\":           true,\n\t\t\"INTERSECT\":         true,\n\t\t\"INTO\":              true,\n\t\t\"IS\":                true,\n\t\t\"ISNULL\":            true,\n\t\t\"JOIN\":              true,\n\t\t\"KEY\":               true,\n\t\t\"LEFT\":              true,\n\t\t\"LIKE\":              true,\n\t\t\"LIMIT\":             true,\n\t\t\"MATCH\":             true,\n\t\t\"NATURAL\":           true,\n\t\t\"NO\":                true,\n\t\t\"NOT\":               true,\n\t\t\"NOTNULL\":           true,\n\t\t\"NULL\":              true,\n\t\t\"OF\":                true,\n\t\t\"OFFSET\":            true,\n\t\t\"ON\":                true,\n\t\t\"OR\":                true,\n\t\t\"ORDER\":             true,\n\t\t\"OUTER\":             true,\n\t\t\"PLAN\":              true,\n\t\t\"PRAGMA\":            true,\n\t\t\"PRIMARY\":           true,\n\t\t\"QUERY\":             true,\n\t\t\"RAISE\":             true,\n\t\t\"RECURSIVE\":         true,\n\t\t\"REFERENCES\":        true,\n\t\t\"REGEXP\":            true,\n\t\t\"REINDEX\":           true,\n\t\t\"RELEASE\":           true,\n\t\t\"RENAME\":            true,\n\t\t\"REPLACE\":           true,\n\t\t\"RESTRICT\":          true,\n\t\t\"RIGHT\":             true,\n\t\t\"ROLLBACK\":          true,\n\t\t\"ROW\":               true,\n\t\t\"SAVEPOINT\":         true,\n\t\t\"SELECT\":            true,\n\t\t\"SET\":               true,\n\t\t\"TABLE\":             true,\n\t\t\"TEMP\":              true,\n\t\t\"TEMPORARY\":         true,\n\t\t\"THEN\":              true,\n\t\t\"TO\":                true,\n\t\t\"TRANSACTI\":         true,\n\t\t\"TRIGGER\":           true,\n\t\t\"UNION\":             true,\n\t\t\"UNIQUE\":            true,\n\t\t\"UPDATE\":            true,\n\t\t\"USING\":             true,\n\t\t\"VACUUM\":            true,\n\t\t\"VALUES\":            true,\n\t\t\"VIEW\":              true,\n\t\t\"VIRTUAL\":           true,\n\t\t\"WHEN\":              true,\n\t\t\"WHERE\":             true,\n\t\t\"WITH\":              true,\n\t\t\"WITHOUT\":           true,\n\t}\n)\n\ntype sqlite3 struct {\n\tcore.Base\n}\n\nfunc (db *sqlite3) Init(d *core.DB, uri *core.Uri, drivername, dataSourceName string) error {\n\treturn db.Base.Init(d, db, uri, drivername, dataSourceName)\n}\n\nfunc (db *sqlite3) SqlType(c *core.Column) string {\n\tswitch t := c.SQLType.Name; t {\n\tcase core.Bool:\n\t\tif c.Default == \"true\" {\n\t\t\tc.Default = \"1\"\n\t\t} else if c.Default == \"false\" {\n\t\t\tc.Default = \"0\"\n\t\t}\n\t\treturn core.Integer\n\tcase core.Date, core.DateTime, core.TimeStamp, core.Time:\n\t\treturn core.DateTime\n\tcase core.TimeStampz:\n\t\treturn core.Text\n\tcase core.Char, core.Varchar, core.NVarchar, core.TinyText,\n\t\tcore.Text, core.MediumText, core.LongText, core.Json:\n\t\treturn core.Text\n\tcase core.Bit, core.TinyInt, core.SmallInt, core.MediumInt, core.Int, core.Integer, core.BigInt:\n\t\treturn core.Integer\n\tcase core.Float, core.Double, core.Real:\n\t\treturn core.Real\n\tcase core.Decimal, core.Numeric:\n\t\treturn core.Numeric\n\tcase core.TinyBlob, core.Blob, core.MediumBlob, core.LongBlob, core.Bytea, core.Binary, core.VarBinary:\n\t\treturn core.Blob\n\tcase core.Serial, core.BigSerial:\n\t\tc.IsPrimaryKey = true\n\t\tc.IsAutoIncrement = true\n\t\tc.Nullable = false\n\t\treturn core.Integer\n\tdefault:\n\t\treturn t\n\t}\n}\n\nfunc (db *sqlite3) FormatBytes(bs []byte) string {\n\treturn fmt.Sprintf(\"X'%x'\", bs)\n}\n\nfunc (db *sqlite3) SupportInsertMany() bool {\n\treturn true\n}\n\nfunc (db *sqlite3) IsReserved(name string) bool {\n\t_, ok := sqlite3ReservedWords[name]\n\treturn ok\n}\n\nfunc (db *sqlite3) Quote(name string) string {\n\treturn \"`\" + name + \"`\"\n}\n\nfunc (db *sqlite3) QuoteStr() string {\n\treturn \"`\"\n}\n\nfunc (db *sqlite3) AutoIncrStr() string {\n\treturn \"AUTOINCREMENT\"\n}\n\nfunc (db *sqlite3) SupportEngine() bool {\n\treturn false\n}\n\nfunc (db *sqlite3) SupportCharset() bool {\n\treturn false\n}\n\nfunc (db *sqlite3) IndexOnTable() bool {\n\treturn false\n}\n\nfunc (db *sqlite3) IndexCheckSql(tableName, idxName string) (string, []interface{}) {\n\targs := []interface{}{idxName}\n\treturn \"SELECT name FROM sqlite_master WHERE type='index' and name = ?\", args\n}\n\nfunc (db *sqlite3) TableCheckSql(tableName string) (string, []interface{}) {\n\targs := []interface{}{tableName}\n\treturn \"SELECT name FROM sqlite_master WHERE type='table' and name = ?\", args\n}\n\nfunc (db *sqlite3) DropIndexSql(tableName string, index *core.Index) string {\n\tquote := db.Quote\n\t//var unique string\n\tvar idxName string = index.Name\n\tif !strings.HasPrefix(idxName, \"UQE_\") &&\n\t\t!strings.HasPrefix(idxName, \"IDX_\") {\n\t\tif index.Type == core.UniqueType {\n\t\t\tidxName = fmt.Sprintf(\"UQE_%v_%v\", tableName, index.Name)\n\t\t} else {\n\t\t\tidxName = fmt.Sprintf(\"IDX_%v_%v\", tableName, index.Name)\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"DROP INDEX %v\", quote(idxName))\n}\n\nfunc (db *sqlite3) ForUpdateSql(query string) string {\n\treturn query\n}\n\n/*func (db *sqlite3) ColumnCheckSql(tableName, colName string) (string, []interface{}) {\n\targs := []interface{}{tableName}\n\tsql := \"SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%`\" + colName + \"`%') or (sql like '%[\" + colName + \"]%'))\"\n\treturn sql, args\n}*/\n\nfunc (db *sqlite3) IsColumnExist(tableName, colName string) (bool, error) {\n\targs := []interface{}{tableName}\n\tquery := \"SELECT name FROM sqlite_master WHERE type='table' and name = ? and ((sql like '%`\" + colName + \"`%') or (sql like '%[\" + colName + \"]%'))\"\n\tdb.LogSQL(query, args)\n\trows, err := db.DB().Query(query, args...)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer rows.Close()\n\n\tif rows.Next() {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}\n\nfunc (db *sqlite3) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {\n\targs := []interface{}{tableName}\n\ts := \"SELECT sql FROM sqlite_master WHERE type='table' and name = ?\"\n\tdb.LogSQL(s, args)\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar name string\n\tfor rows.Next() {\n\t\terr = rows.Scan(&name)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tbreak\n\t}\n\n\tif name == \"\" {\n\t\treturn nil, nil, errors.New(\"no table named \" + tableName)\n\t}\n\n\tnStart := strings.Index(name, \"(\")\n\tnEnd := strings.LastIndex(name, \")\")\n\treg := regexp.MustCompile(`[^\\(,\\)]*(\\([^\\(]*\\))?`)\n\tcolCreates := reg.FindAllString(name[nStart+1:nEnd], -1)\n\tcols := make(map[string]*core.Column)\n\tcolSeq := make([]string, 0)\n\tfor _, colStr := range colCreates {\n\t\treg = regexp.MustCompile(`,\\s`)\n\t\tcolStr = reg.ReplaceAllString(colStr, \",\")\n\t\tfields := strings.Fields(strings.TrimSpace(colStr))\n\t\tcol := new(core.Column)\n\t\tcol.Indexes = make(map[string]int)\n\t\tcol.Nullable = true\n\t\tcol.DefaultIsEmpty = true\n\t\tfor idx, field := range fields {\n\t\t\tif idx == 0 {\n\t\t\t\tcol.Name = strings.Trim(field, \"`[] \")\n\t\t\t\tcontinue\n\t\t\t} else if idx == 1 {\n\t\t\t\tcol.SQLType = core.SQLType{field, 0, 0}\n\t\t\t}\n\t\t\tswitch field {\n\t\t\tcase \"PRIMARY\":\n\t\t\t\tcol.IsPrimaryKey = true\n\t\t\tcase \"AUTOINCREMENT\":\n\t\t\t\tcol.IsAutoIncrement = true\n\t\t\tcase \"NULL\":\n\t\t\t\tif fields[idx-1] == \"NOT\" {\n\t\t\t\t\tcol.Nullable = false\n\t\t\t\t} else {\n\t\t\t\t\tcol.Nullable = true\n\t\t\t\t}\n\t\t\tcase \"DEFAULT\":\n\t\t\t\tcol.Default = fields[idx+1]\n\t\t\t\tcol.DefaultIsEmpty = false\n\t\t\t}\n\t\t}\n\t\tif !col.SQLType.IsNumeric() && !col.DefaultIsEmpty {\n\t\t\tcol.Default = \"'\" + col.Default + \"'\"\n\t\t}\n\t\tcols[col.Name] = col\n\t\tcolSeq = append(colSeq, col.Name)\n\t}\n\treturn colSeq, cols, nil\n}\n\nfunc (db *sqlite3) GetTables() ([]*core.Table, error) {\n\targs := []interface{}{}\n\ts := \"SELECT name FROM sqlite_master WHERE type='table'\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\ttables := make([]*core.Table, 0)\n\tfor rows.Next() {\n\t\ttable := core.NewEmptyTable()\n\t\terr = rows.Scan(&table.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif table.Name == \"sqlite_sequence\" {\n\t\t\tcontinue\n\t\t}\n\t\ttables = append(tables, table)\n\t}\n\treturn tables, nil\n}\n\nfunc (db *sqlite3) GetIndexes(tableName string) (map[string]*core.Index, error) {\n\targs := []interface{}{tableName}\n\ts := \"SELECT sql FROM sqlite_master WHERE type='index' and tbl_name = ?\"\n\tdb.LogSQL(s, args)\n\n\trows, err := db.DB().Query(s, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tindexes := make(map[string]*core.Index, 0)\n\tfor rows.Next() {\n\t\tvar tmpSql sql.NullString\n\t\terr = rows.Scan(&tmpSql)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif !tmpSql.Valid {\n\t\t\tcontinue\n\t\t}\n\t\tsql := tmpSql.String\n\n\t\tindex := new(core.Index)\n\t\tnNStart := strings.Index(sql, \"INDEX\")\n\t\tnNEnd := strings.Index(sql, \"ON\")\n\t\tif nNStart == -1 || nNEnd == -1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tindexName := strings.Trim(sql[nNStart+6:nNEnd], \"` []\")\n\t\tif strings.HasPrefix(indexName, \"IDX_\"+tableName) || strings.HasPrefix(indexName, \"UQE_\"+tableName) {\n\t\t\tindex.Name = indexName[5+len(tableName) : len(indexName)]\n\t\t} else {\n\t\t\tindex.Name = indexName\n\t\t}\n\n\t\tif strings.HasPrefix(sql, \"CREATE UNIQUE INDEX\") {\n\t\t\tindex.Type = core.UniqueType\n\t\t} else {\n\t\t\tindex.Type = core.IndexType\n\t\t}\n\n\t\tnStart := strings.Index(sql, \"(\")\n\t\tnEnd := strings.Index(sql, \")\")\n\t\tcolIndexes := strings.Split(sql[nStart+1:nEnd], \",\")\n\n\t\tindex.Cols = make([]string, 0)\n\t\tfor _, col := range colIndexes {\n\t\t\tindex.Cols = append(index.Cols, strings.Trim(col, \"` []\"))\n\t\t}\n\t\tindexes[index.Name] = index\n\t}\n\n\treturn indexes, nil\n}\n\nfunc (db *sqlite3) Filters() []core.Filter {\n\treturn []core.Filter{&core.IdFilter{}}\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/sqlite3_driver.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"github.com/go-xorm/core\"\n)\n\n// func init() {\n// \tcore.RegisterDriver(\"sqlite3\", &sqlite3Driver{})\n// }\n\ntype sqlite3Driver struct {\n}\n\nfunc (p *sqlite3Driver) Parse(driverName, dataSourceName string) (*core.Uri, error) {\n\treturn &core.Uri{DbType: core.SQLITE, DbName: dataSourceName}, nil\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/statement.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"bytes\"\n\t\"database/sql/driver\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\ntype inParam struct {\n\tcolName string\n\targs    []interface{}\n}\n\ntype incrParam struct {\n\tcolName string\n\targ     interface{}\n}\n\ntype decrParam struct {\n\tcolName string\n\targ     interface{}\n}\n\ntype exprParam struct {\n\tcolName string\n\texpr    string\n}\n\n// Statement save all the sql info for executing SQL\ntype Statement struct {\n\tRefTable        *core.Table\n\tEngine          *Engine\n\tStart           int\n\tLimitN          int\n\tWhereStr        string\n\tIdParam         *core.PK\n\tParams          []interface{}\n\tOrderStr        string\n\tJoinStr         string\n\tjoinArgs        []interface{}\n\tGroupByStr      string\n\tHavingStr       string\n\tColumnStr       string\n\tselectStr       string\n\tcolumnMap       map[string]bool\n\tuseAllCols      bool\n\tOmitStr         string\n\tConditionStr    string\n\tAltTableName    string\n\ttableName       string\n\tRawSQL          string\n\tRawParams       []interface{}\n\tUseCascade      bool\n\tUseAutoJoin     bool\n\tStoreEngine     string\n\tCharset         string\n\tBeanArgs        []interface{}\n\tUseCache        bool\n\tUseAutoTime     bool\n\tnoAutoCondition bool\n\tIsDistinct      bool\n\tIsForUpdate     bool\n\tTableAlias      string\n\tallUseBool      bool\n\tcheckVersion    bool\n\tunscoped        bool\n\tmustColumnMap   map[string]bool\n\tnullableMap     map[string]bool\n\tinColumns       map[string]*inParam\n\tincrColumns     map[string]incrParam\n\tdecrColumns     map[string]decrParam\n\texprColumns     map[string]exprParam\n}\n\n// Init reset all the statment's fields\nfunc (statement *Statement) Init() {\n\tstatement.RefTable = nil\n\tstatement.Start = 0\n\tstatement.LimitN = 0\n\tstatement.WhereStr = \"\"\n\tstatement.Params = make([]interface{}, 0)\n\tstatement.OrderStr = \"\"\n\tstatement.UseCascade = true\n\tstatement.JoinStr = \"\"\n\tstatement.joinArgs = make([]interface{}, 0)\n\tstatement.GroupByStr = \"\"\n\tstatement.HavingStr = \"\"\n\tstatement.ColumnStr = \"\"\n\tstatement.OmitStr = \"\"\n\tstatement.columnMap = make(map[string]bool)\n\tstatement.ConditionStr = \"\"\n\tstatement.AltTableName = \"\"\n\tstatement.tableName = \"\"\n\tstatement.IdParam = nil\n\tstatement.RawSQL = \"\"\n\tstatement.RawParams = make([]interface{}, 0)\n\tstatement.BeanArgs = make([]interface{}, 0)\n\tstatement.UseCache = true\n\tstatement.UseAutoTime = true\n\tstatement.noAutoCondition = false\n\tstatement.IsDistinct = false\n\tstatement.IsForUpdate = false\n\tstatement.TableAlias = \"\"\n\tstatement.selectStr = \"\"\n\tstatement.allUseBool = false\n\tstatement.useAllCols = false\n\tstatement.mustColumnMap = make(map[string]bool)\n\tstatement.nullableMap = make(map[string]bool)\n\tstatement.checkVersion = true\n\tstatement.unscoped = false\n\tstatement.inColumns = make(map[string]*inParam)\n\tstatement.incrColumns = make(map[string]incrParam)\n\tstatement.decrColumns = make(map[string]decrParam)\n\tstatement.exprColumns = make(map[string]exprParam)\n}\n\n// NoAutoCondition if you do not want convert bean's field as query condition, then use this function\nfunc (statement *Statement) NoAutoCondition(no ...bool) *Statement {\n\tstatement.noAutoCondition = true\n\tif len(no) > 0 {\n\t\tstatement.noAutoCondition = no[0]\n\t}\n\treturn statement\n}\n\n// Sql add the raw sql statement\nfunc (statement *Statement) Sql(querystring string, args ...interface{}) *Statement {\n\tstatement.RawSQL = querystring\n\tstatement.RawParams = args\n\treturn statement\n}\n\n// Alias set the table alias\nfunc (statement *Statement) Alias(alias string) *Statement {\n\tstatement.TableAlias = alias\n\treturn statement\n}\n\n// Where add Where statment\nfunc (statement *Statement) Where(querystring string, args ...interface{}) *Statement {\n\t// The second where will be triggered as And\n\tif len(statement.WhereStr) > 0 {\n\t\treturn statement.And(querystring, args...)\n\t}\n\n\tif !strings.Contains(querystring, statement.Engine.dialect.EqStr()) {\n\t\tquerystring = strings.Replace(querystring, \"=\", statement.Engine.dialect.EqStr(), -1)\n\t}\n\tstatement.WhereStr = querystring\n\tstatement.Params = args\n\treturn statement\n}\n\n// And add Where & and statment\nfunc (statement *Statement) And(querystring string, args ...interface{}) *Statement {\n\tif len(statement.WhereStr) > 0 {\n\t\tvar buf bytes.Buffer\n\t\tfmt.Fprintf(&buf, \"(%v) %s (%v)\", statement.WhereStr,\n\t\t\tstatement.Engine.dialect.AndStr(), querystring)\n\t\tstatement.WhereStr = buf.String()\n\t} else {\n\t\tstatement.WhereStr = querystring\n\t}\n\tstatement.Params = append(statement.Params, args...)\n\treturn statement\n}\n\n// Or add Where & Or statment\nfunc (statement *Statement) Or(querystring string, args ...interface{}) *Statement {\n\tif len(statement.WhereStr) > 0 {\n\t\tvar buf bytes.Buffer\n\t\tfmt.Fprintf(&buf, \"(%v) %s (%v)\", statement.WhereStr,\n\t\t\tstatement.Engine.dialect.OrStr(), querystring)\n\t\tstatement.WhereStr = buf.String()\n\t} else {\n\t\tstatement.WhereStr = querystring\n\t}\n\tstatement.Params = append(statement.Params, args...)\n\treturn statement\n}\n\nfunc (statement *Statement) setRefValue(v reflect.Value) {\n\tstatement.RefTable = statement.Engine.autoMapType(v)\n\tstatement.tableName = statement.Engine.tbName(v)\n}\n\n// Table tempororily set table name, the parameter could be a string or a pointer of struct\nfunc (statement *Statement) Table(tableNameOrBean interface{}) *Statement {\n\tv := rValue(tableNameOrBean)\n\tt := v.Type()\n\tif t.Kind() == reflect.String {\n\t\tstatement.AltTableName = tableNameOrBean.(string)\n\t} else if t.Kind() == reflect.Struct {\n\t\tstatement.RefTable = statement.Engine.autoMapType(v)\n\t\tstatement.AltTableName = statement.Engine.tbName(v)\n\t}\n\treturn statement\n}\n\n// Auto generating update columnes and values according a struct\nfunc buildUpdates(engine *Engine, table *core.Table, bean interface{},\n\tincludeVersion bool, includeUpdated bool, includeNil bool,\n\tincludeAutoIncr bool, allUseBool bool, useAllCols bool,\n\tmustColumnMap map[string]bool, nullableMap map[string]bool,\n\tcolumnMap map[string]bool, update, unscoped bool) ([]string, []interface{}) {\n\n\tvar colNames = make([]string, 0)\n\tvar args = make([]interface{}, 0)\n\tfor _, col := range table.Columns() {\n\t\tif !includeVersion && col.IsVersion {\n\t\t\tcontinue\n\t\t}\n\t\tif col.IsCreated {\n\t\t\tcontinue\n\t\t}\n\t\tif !includeUpdated && col.IsUpdated {\n\t\t\tcontinue\n\t\t}\n\t\tif !includeAutoIncr && col.IsAutoIncrement {\n\t\t\tcontinue\n\t\t}\n\t\tif col.IsDeleted && !unscoped {\n\t\t\tcontinue\n\t\t}\n\t\tif use, ok := columnMap[col.Name]; ok && !use {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldValuePtr, err := col.ValueOf(bean)\n\t\tif err != nil {\n\t\t\tengine.logger.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldValue := *fieldValuePtr\n\t\tfieldType := reflect.TypeOf(fieldValue.Interface())\n\n\t\trequiredField := useAllCols\n\t\tincludeNil := useAllCols\n\t\tlColName := strings.ToLower(col.Name)\n\n\t\tif b, ok := mustColumnMap[lColName]; ok {\n\t\t\tif b {\n\t\t\t\trequiredField = true\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// !evalphobia! set fieldValue as nil when column is nullable and zero-value\n\t\tif b, ok := nullableMap[lColName]; ok {\n\t\t\tif b && col.Nullable && isZero(fieldValue.Interface()) {\n\t\t\t\tvar nilValue *int\n\t\t\t\tfieldValue = reflect.ValueOf(nilValue)\n\t\t\t\tfieldType = reflect.TypeOf(fieldValue.Interface())\n\t\t\t\tincludeNil = true\n\t\t\t}\n\t\t}\n\n\t\tvar val interface{}\n\n\t\tif fieldValue.CanAddr() {\n\t\t\tif structConvert, ok := fieldValue.Addr().Interface().(core.Conversion); ok {\n\t\t\t\tdata, err := structConvert.ToDB()\n\t\t\t\tif err != nil {\n\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t} else {\n\t\t\t\t\tval = data\n\t\t\t\t}\n\t\t\t\tgoto APPEND\n\t\t\t}\n\t\t}\n\n\t\tif structConvert, ok := fieldValue.Interface().(core.Conversion); ok {\n\t\t\tdata, err := structConvert.ToDB()\n\t\t\tif err != nil {\n\t\t\t\tengine.logger.Error(err)\n\t\t\t} else {\n\t\t\t\tval = data\n\t\t\t}\n\t\t\tgoto APPEND\n\t\t}\n\n\t\tif fieldType.Kind() == reflect.Ptr {\n\t\t\tif fieldValue.IsNil() {\n\t\t\t\tif includeNil {\n\t\t\t\t\targs = append(args, nil)\n\t\t\t\t\tcolNames = append(colNames, fmt.Sprintf(\"%v=?\", engine.Quote(col.Name)))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t} else if !fieldValue.IsValid() {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\t// dereference ptr type to instance type\n\t\t\t\tfieldValue = fieldValue.Elem()\n\t\t\t\tfieldType = reflect.TypeOf(fieldValue.Interface())\n\t\t\t\trequiredField = true\n\t\t\t}\n\t\t}\n\n\t\tswitch fieldType.Kind() {\n\t\tcase reflect.Bool:\n\t\t\tif allUseBool || requiredField {\n\t\t\t\tval = fieldValue.Interface()\n\t\t\t} else {\n\t\t\t\t// if a bool in a struct, it will not be as a condition because it default is false,\n\t\t\t\t// please use Where() instead\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\tif !requiredField && fieldValue.String() == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// for MyString, should convert to string or panic\n\t\t\tif fieldType.String() != reflect.String.String() {\n\t\t\t\tval = fieldValue.String()\n\t\t\t} else {\n\t\t\t\tval = fieldValue.Interface()\n\t\t\t}\n\t\tcase reflect.Int8, reflect.Int16, reflect.Int, reflect.Int32, reflect.Int64:\n\t\t\tif !requiredField && fieldValue.Int() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval = fieldValue.Interface()\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tif !requiredField && fieldValue.Float() == 0.0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval = fieldValue.Interface()\n\t\tcase reflect.Uint8, reflect.Uint16, reflect.Uint, reflect.Uint32, reflect.Uint64:\n\t\t\tif !requiredField && fieldValue.Uint() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt := int64(fieldValue.Uint())\n\t\t\tval = reflect.ValueOf(&t).Interface()\n\t\tcase reflect.Struct:\n\t\t\tif fieldType.ConvertibleTo(core.TimeType) {\n\t\t\t\tt := fieldValue.Convert(core.TimeType).Interface().(time.Time)\n\t\t\t\tif !requiredField && (t.IsZero() || !fieldValue.IsValid()) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tval = engine.FormatTime(col.SQLType.Name, t)\n\t\t\t} else if nulType, ok := fieldValue.Interface().(driver.Valuer); ok {\n\t\t\t\tval, _ = nulType.Value()\n\t\t\t} else {\n\t\t\t\tif !col.SQLType.IsJson() {\n\t\t\t\t\tengine.autoMapType(fieldValue)\n\t\t\t\t\tif table, ok := engine.Tables[fieldValue.Type()]; ok {\n\t\t\t\t\t\tif len(table.PrimaryKeys) == 1 {\n\t\t\t\t\t\t\tpkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)\n\t\t\t\t\t\t\t// fix non-int pk issues\n\t\t\t\t\t\t\tif pkField.IsValid() && (!requiredField && !isZero(pkField.Interface())) {\n\t\t\t\t\t\t\t\tval = pkField.Interface()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//TODO: how to handler?\n\t\t\t\t\t\t\tpanic(\"not supported\")\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tval = fieldValue.Interface()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Blank struct could not be as update data\n\t\t\t\t\tif requiredField || !isStructZero(fieldValue) {\n\t\t\t\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tpanic(fmt.Sprintf(\"mashal %v failed\", fieldValue.Interface()))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif col.SQLType.IsText() {\n\t\t\t\t\t\t\tval = string(bytes)\n\t\t\t\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\t\t\t\tval = bytes\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Array, reflect.Slice, reflect.Map:\n\t\t\tif !requiredField {\n\t\t\t\tif fieldValue == reflect.Zero(fieldType) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif fieldValue.IsNil() || !fieldValue.IsValid() || fieldValue.Len() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif col.SQLType.IsText() {\n\t\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tval = string(bytes)\n\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\tvar bytes []byte\n\t\t\t\tvar err error\n\t\t\t\tif (fieldType.Kind() == reflect.Array || fieldType.Kind() == reflect.Slice) &&\n\t\t\t\t\tfieldType.Elem().Kind() == reflect.Uint8 {\n\t\t\t\t\tif fieldValue.Len() > 0 {\n\t\t\t\t\t\tval = fieldValue.Bytes()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbytes, err = json.Marshal(fieldValue.Interface())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tval = bytes\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tval = fieldValue.Interface()\n\t\t}\n\n\tAPPEND:\n\t\t//fmt.Println(\"==\", col.Name, \"==\", fmt.Sprintf(\"%v\", val))\n\t\targs = append(args, val)\n\t\tif col.IsPrimaryKey && engine.dialect.DBType() == \"ql\" {\n\t\t\tcontinue\n\t\t}\n\t\tcolNames = append(colNames, fmt.Sprintf(\"%v = ?\", engine.Quote(col.Name)))\n\t}\n\n\treturn colNames, args\n}\n\nfunc (statement *Statement) needTableName() bool {\n\treturn len(statement.JoinStr) > 0\n}\n\nfunc (statement *Statement) colName(col *core.Column, tableName string) string {\n\tif statement.needTableName() {\n\t\tvar nm = tableName\n\t\tif len(statement.TableAlias) > 0 {\n\t\t\tnm = statement.TableAlias\n\t\t}\n\t\treturn statement.Engine.Quote(nm) + \".\" + statement.Engine.Quote(col.Name)\n\t}\n\treturn statement.Engine.Quote(col.Name)\n}\n\n// Auto generating conditions according a struct\nfunc buildConditions(engine *Engine, table *core.Table, bean interface{},\n\tincludeVersion bool, includeUpdated bool, includeNil bool,\n\tincludeAutoIncr bool, allUseBool bool, useAllCols bool, unscoped bool,\n\tmustColumnMap map[string]bool, tableName, aliasName string, addedTableName bool) ([]string, []interface{}) {\n\tvar colNames []string\n\tvar args = make([]interface{}, 0)\n\tfor _, col := range table.Columns() {\n\t\tif !includeVersion && col.IsVersion {\n\t\t\tcontinue\n\t\t}\n\t\tif !includeUpdated && col.IsUpdated {\n\t\t\tcontinue\n\t\t}\n\t\tif !includeAutoIncr && col.IsAutoIncrement {\n\t\t\tcontinue\n\t\t}\n\n\t\tif engine.dialect.DBType() == core.MSSQL && col.SQLType.Name == core.Text {\n\t\t\tcontinue\n\t\t}\n\t\tif col.SQLType.IsJson() {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar colName string\n\t\tif addedTableName {\n\t\t\tvar nm = tableName\n\t\t\tif len(aliasName) > 0 {\n\t\t\t\tnm = aliasName\n\t\t\t}\n\t\t\tcolName = engine.Quote(nm) + \".\" + engine.Quote(col.Name)\n\t\t} else {\n\t\t\tcolName = engine.Quote(col.Name)\n\t\t}\n\n\t\tfieldValuePtr, err := col.ValueOf(bean)\n\t\tif err != nil {\n\t\t\tengine.logger.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif col.IsDeleted && !unscoped { // tag \"deleted\" is enabled\n\t\t\tcolNames = append(colNames, fmt.Sprintf(\"(%v IS NULL OR %v = '0001-01-01 00:00:00')\",\n\t\t\t\tcolName, colName))\n\t\t}\n\n\t\tfieldValue := *fieldValuePtr\n\t\tif fieldValue.Interface() == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldType := reflect.TypeOf(fieldValue.Interface())\n\t\trequiredField := useAllCols\n\t\tif b, ok := mustColumnMap[strings.ToLower(col.Name)]; ok {\n\t\t\tif b {\n\t\t\t\trequiredField = true\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif fieldType.Kind() == reflect.Ptr {\n\t\t\tif fieldValue.IsNil() {\n\t\t\t\tif includeNil {\n\t\t\t\t\targs = append(args, nil)\n\t\t\t\t\tcolNames = append(colNames, fmt.Sprintf(\"%v %s ?\", colName, engine.dialect.EqStr()))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t} else if !fieldValue.IsValid() {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\t// dereference ptr type to instance type\n\t\t\t\tfieldValue = fieldValue.Elem()\n\t\t\t\tfieldType = reflect.TypeOf(fieldValue.Interface())\n\t\t\t\trequiredField = true\n\t\t\t}\n\t\t}\n\n\t\tvar val interface{}\n\t\tswitch fieldType.Kind() {\n\t\tcase reflect.Bool:\n\t\t\tif allUseBool || requiredField {\n\t\t\t\tval = fieldValue.Interface()\n\t\t\t} else {\n\t\t\t\t// if a bool in a struct, it will not be as a condition because it default is false,\n\t\t\t\t// please use Where() instead\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\tif !requiredField && fieldValue.String() == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// for MyString, should convert to string or panic\n\t\t\tif fieldType.String() != reflect.String.String() {\n\t\t\t\tval = fieldValue.String()\n\t\t\t} else {\n\t\t\t\tval = fieldValue.Interface()\n\t\t\t}\n\t\tcase reflect.Int8, reflect.Int16, reflect.Int, reflect.Int32, reflect.Int64:\n\t\t\tif !requiredField && fieldValue.Int() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval = fieldValue.Interface()\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tif !requiredField && fieldValue.Float() == 0.0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tval = fieldValue.Interface()\n\t\tcase reflect.Uint8, reflect.Uint16, reflect.Uint, reflect.Uint32, reflect.Uint64:\n\t\t\tif !requiredField && fieldValue.Uint() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt := int64(fieldValue.Uint())\n\t\t\tval = reflect.ValueOf(&t).Interface()\n\t\tcase reflect.Struct:\n\t\t\tif fieldType.ConvertibleTo(core.TimeType) {\n\t\t\t\tt := fieldValue.Convert(core.TimeType).Interface().(time.Time)\n\t\t\t\tif !requiredField && (t.IsZero() || !fieldValue.IsValid()) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tval = engine.FormatTime(col.SQLType.Name, t)\n\t\t\t} else if _, ok := reflect.New(fieldType).Interface().(core.Conversion); ok {\n\t\t\t\tcontinue\n\t\t\t} else if valNul, ok := fieldValue.Interface().(driver.Valuer); ok {\n\t\t\t\tval, _ = valNul.Value()\n\t\t\t\tif val == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif col.SQLType.IsJson() {\n\t\t\t\t\tif col.SQLType.IsText() {\n\t\t\t\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tval = string(bytes)\n\t\t\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\t\t\tvar bytes []byte\n\t\t\t\t\t\tvar err error\n\t\t\t\t\t\tbytes, err = json.Marshal(fieldValue.Interface())\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tval = bytes\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tengine.autoMapType(fieldValue)\n\t\t\t\t\tif table, ok := engine.Tables[fieldValue.Type()]; ok {\n\t\t\t\t\t\tif len(table.PrimaryKeys) == 1 {\n\t\t\t\t\t\t\tpkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)\n\t\t\t\t\t\t\t// fix non-int pk issues\n\t\t\t\t\t\t\t//if pkField.Int() != 0 {\n\t\t\t\t\t\t\tif pkField.IsValid() && !isZero(pkField.Interface()) {\n\t\t\t\t\t\t\t\tval = pkField.Interface()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//TODO: how to handler?\n\t\t\t\t\t\t\tpanic(fmt.Sprintln(\"not supported\", fieldValue.Interface(), \"as\", table.PrimaryKeys))\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tval = fieldValue.Interface()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Array, reflect.Slice, reflect.Map:\n\t\t\tif fieldValue == reflect.Zero(fieldType) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif fieldValue.IsNil() || !fieldValue.IsValid() || fieldValue.Len() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif col.SQLType.IsText() {\n\t\t\t\tbytes, err := json.Marshal(fieldValue.Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tval = string(bytes)\n\t\t\t} else if col.SQLType.IsBlob() {\n\t\t\t\tvar bytes []byte\n\t\t\t\tvar err error\n\t\t\t\tif (fieldType.Kind() == reflect.Array || fieldType.Kind() == reflect.Slice) &&\n\t\t\t\t\tfieldType.Elem().Kind() == reflect.Uint8 {\n\t\t\t\t\tif fieldValue.Len() > 0 {\n\t\t\t\t\t\tval = fieldValue.Bytes()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbytes, err = json.Marshal(fieldValue.Interface())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tengine.logger.Error(err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tval = bytes\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tval = fieldValue.Interface()\n\t\t}\n\n\t\targs = append(args, val)\n\t\tvar condi string\n\t\tif col.IsPrimaryKey && engine.dialect.DBType() == \"ql\" {\n\t\t\tcondi = \"id() == ?\"\n\t\t} else {\n\t\t\tcondi = fmt.Sprintf(\"%v %s ?\", colName, engine.dialect.EqStr())\n\t\t}\n\t\tcolNames = append(colNames, condi)\n\t}\n\n\treturn colNames, args\n}\n\n// TableName return current tableName\nfunc (statement *Statement) TableName() string {\n\tif statement.AltTableName != \"\" {\n\t\treturn statement.AltTableName\n\t}\n\n\treturn statement.tableName\n}\n\n// Id generate \"where id = ? \" statment or for composite key \"where key1 = ? and key2 = ?\"\nfunc (statement *Statement) Id(id interface{}) *Statement {\n\tidValue := reflect.ValueOf(id)\n\tidType := reflect.TypeOf(idValue.Interface())\n\n\tswitch idType {\n\tcase ptrPkType:\n\t\tif pkPtr, ok := (id).(*core.PK); ok {\n\t\t\tstatement.IdParam = pkPtr\n\t\t\treturn statement\n\t\t}\n\tcase pkType:\n\t\tif pk, ok := (id).(core.PK); ok {\n\t\t\tstatement.IdParam = &pk\n\t\t\treturn statement\n\t\t}\n\t}\n\n\tswitch idType.Kind() {\n\tcase reflect.String:\n\t\tstatement.IdParam = &core.PK{idValue.Convert(reflect.TypeOf(\"\")).Interface()}\n\t\treturn statement\n\t}\n\n\tstatement.IdParam = &core.PK{id}\n\treturn statement\n}\n\n// Incr Generate  \"Update ... Set column = column + arg\" statment\nfunc (statement *Statement) Incr(column string, arg ...interface{}) *Statement {\n\tk := strings.ToLower(column)\n\tif len(arg) > 0 {\n\t\tstatement.incrColumns[k] = incrParam{column, arg[0]}\n\t} else {\n\t\tstatement.incrColumns[k] = incrParam{column, 1}\n\t}\n\treturn statement\n}\n\n// Decr Generate  \"Update ... Set column = column - arg\" statment\nfunc (statement *Statement) Decr(column string, arg ...interface{}) *Statement {\n\tk := strings.ToLower(column)\n\tif len(arg) > 0 {\n\t\tstatement.decrColumns[k] = decrParam{column, arg[0]}\n\t} else {\n\t\tstatement.decrColumns[k] = decrParam{column, 1}\n\t}\n\treturn statement\n}\n\n// SetExpr Generate  \"Update ... Set column = {expression}\" statment\nfunc (statement *Statement) SetExpr(column string, expression string) *Statement {\n\tk := strings.ToLower(column)\n\tstatement.exprColumns[k] = exprParam{column, expression}\n\treturn statement\n}\n\n// Generate  \"Update ... Set column = column + arg\" statment\nfunc (statement *Statement) getInc() map[string]incrParam {\n\treturn statement.incrColumns\n}\n\n// Generate  \"Update ... Set column = column - arg\" statment\nfunc (statement *Statement) getDec() map[string]decrParam {\n\treturn statement.decrColumns\n}\n\n// Generate  \"Update ... Set column = {expression}\" statment\nfunc (statement *Statement) getExpr() map[string]exprParam {\n\treturn statement.exprColumns\n}\n\n// In generate \"Where column IN (?) \" statment\nfunc (statement *Statement) In(column string, args ...interface{}) *Statement {\n\tlength := len(args)\n\tif length == 0 {\n\t\treturn statement\n\t}\n\n\tk := strings.ToLower(column)\n\tvar newargs []interface{}\n\tif length == 1 &&\n\t\treflect.TypeOf(args[0]).Kind() == reflect.Slice {\n\t\tnewargs = make([]interface{}, 0)\n\t\tv := reflect.ValueOf(args[0])\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tnewargs = append(newargs, v.Index(i).Interface())\n\t\t}\n\t} else {\n\t\tnewargs = args\n\t}\n\n\tif _, ok := statement.inColumns[k]; ok {\n\t\tstatement.inColumns[k].args = append(statement.inColumns[k].args, newargs...)\n\t} else {\n\t\tstatement.inColumns[k] = &inParam{column, newargs}\n\t}\n\treturn statement\n}\n\nfunc (statement *Statement) genInSql() (string, []interface{}) {\n\tif len(statement.inColumns) == 0 {\n\t\treturn \"\", []interface{}{}\n\t}\n\n\tinStrs := make([]string, len(statement.inColumns), len(statement.inColumns))\n\targs := make([]interface{}, 0, len(statement.inColumns))\n\tvar buf bytes.Buffer\n\tvar i int\n\tfor _, params := range statement.inColumns {\n\t\tbuf.Reset()\n\t\tfmt.Fprintf(&buf, \"(%v IN (%v))\",\n\t\t\tstatement.Engine.quoteColumn(params.colName),\n\t\t\tstrings.Join(makeArray(\"?\", len(params.args)), \",\"))\n\t\tinStrs[i] = buf.String()\n\t\ti++\n\t\targs = append(args, params.args...)\n\t}\n\n\tif len(statement.inColumns) == 1 {\n\t\treturn inStrs[0], args\n\t}\n\treturn fmt.Sprintf(\"(%v)\", strings.Join(inStrs, \" \"+statement.Engine.dialect.AndStr()+\" \")), args\n}\n\nfunc (statement *Statement) attachInSql() {\n\tinSql, inArgs := statement.genInSql()\n\tif len(inSql) > 0 {\n\t\tif len(statement.ConditionStr) > 0 {\n\t\t\tstatement.ConditionStr += \" \" + statement.Engine.dialect.AndStr() + \" \"\n\t\t}\n\t\tstatement.ConditionStr += inSql\n\t\tstatement.Params = append(statement.Params, inArgs...)\n\t}\n}\n\nfunc (statement *Statement) col2NewColsWithQuote(columns ...string) []string {\n\tnewColumns := make([]string, 0)\n\tfor _, col := range columns {\n\t\tcol = strings.Replace(col, \"`\", \"\", -1)\n\t\tcol = strings.Replace(col, statement.Engine.QuoteStr(), \"\", -1)\n\t\tccols := strings.Split(col, \",\")\n\t\tfor _, c := range ccols {\n\t\t\tfields := strings.Split(strings.TrimSpace(c), \".\")\n\t\t\tif len(fields) == 1 {\n\t\t\t\tnewColumns = append(newColumns, statement.Engine.quote(fields[0]))\n\t\t\t} else if len(fields) == 2 {\n\t\t\t\tnewColumns = append(newColumns, statement.Engine.quote(fields[0])+\".\"+\n\t\t\t\t\tstatement.Engine.quote(fields[1]))\n\t\t\t} else {\n\t\t\t\tpanic(errors.New(\"unwanted colnames\"))\n\t\t\t}\n\t\t}\n\t}\n\treturn newColumns\n}\n\n// Generate \"Distince col1, col2 \" statment\nfunc (statement *Statement) Distinct(columns ...string) *Statement {\n\tstatement.IsDistinct = true\n\tstatement.Cols(columns...)\n\treturn statement\n}\n\n// Generate \"SELECT ... FOR UPDATE\" statment\nfunc (statement *Statement) ForUpdate() *Statement {\n\tstatement.IsForUpdate = true\n\treturn statement\n}\n\n// Select replace select\nfunc (s *Statement) Select(str string) *Statement {\n\ts.selectStr = str\n\treturn s\n}\n\n// Cols generate \"col1, col2\" statement\nfunc (statement *Statement) Cols(columns ...string) *Statement {\n\tcols := col2NewCols(columns...)\n\tfor _, nc := range cols {\n\t\tstatement.columnMap[strings.ToLower(nc)] = true\n\t}\n\n\tnewColumns := statement.col2NewColsWithQuote(columns...)\n\t//fmt.Println(\"=====\", columns, newColumns, cols)\n\tstatement.ColumnStr = strings.Join(newColumns, \", \")\n\tstatement.ColumnStr = strings.Replace(statement.ColumnStr, statement.Engine.quote(\"*\"), \"*\", -1)\n\treturn statement\n}\n\n// AllCols update use only: update all columns\nfunc (statement *Statement) AllCols() *Statement {\n\tstatement.useAllCols = true\n\treturn statement\n}\n\n// MustCols update use only: must update columns\nfunc (statement *Statement) MustCols(columns ...string) *Statement {\n\tnewColumns := col2NewCols(columns...)\n\tfor _, nc := range newColumns {\n\t\tstatement.mustColumnMap[strings.ToLower(nc)] = true\n\t}\n\treturn statement\n}\n\n// UseBool indicates that use bool fields as update contents and query contiditions\nfunc (statement *Statement) UseBool(columns ...string) *Statement {\n\tif len(columns) > 0 {\n\t\tstatement.MustCols(columns...)\n\t} else {\n\t\tstatement.allUseBool = true\n\t}\n\treturn statement\n}\n\n// Omit do not use the columns\nfunc (statement *Statement) Omit(columns ...string) {\n\tnewColumns := col2NewCols(columns...)\n\tfor _, nc := range newColumns {\n\t\tstatement.columnMap[strings.ToLower(nc)] = false\n\t}\n\tstatement.OmitStr = statement.Engine.Quote(strings.Join(newColumns, statement.Engine.Quote(\", \")))\n}\n\n// Nullable Update use only: update columns to null when value is nullable and zero-value\nfunc (statement *Statement) Nullable(columns ...string) {\n\tnewColumns := col2NewCols(columns...)\n\tfor _, nc := range newColumns {\n\t\tstatement.nullableMap[strings.ToLower(nc)] = true\n\t}\n}\n\n// Top generate LIMIT limit statement\nfunc (statement *Statement) Top(limit int) *Statement {\n\tstatement.Limit(limit)\n\treturn statement\n}\n\n// Limit generate LIMIT start, limit statement\nfunc (statement *Statement) Limit(limit int, start ...int) *Statement {\n\tstatement.LimitN = limit\n\tif len(start) > 0 {\n\t\tstatement.Start = start[0]\n\t}\n\treturn statement\n}\n\n// OrderBy generate \"Order By order\" statement\nfunc (statement *Statement) OrderBy(order string) *Statement {\n\tif len(statement.OrderStr) > 0 {\n\t\tstatement.OrderStr += \", \"\n\t}\n\tstatement.OrderStr += order\n\treturn statement\n}\n\n// Desc generate `ORDER BY xx DESC`\nfunc (statement *Statement) Desc(colNames ...string) *Statement {\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, statement.OrderStr)\n\tif len(statement.OrderStr) > 0 {\n\t\tfmt.Fprint(&buf, \", \")\n\t}\n\tnewColNames := statement.col2NewColsWithQuote(colNames...)\n\tfmt.Fprintf(&buf, \"%v DESC\", strings.Join(newColNames, \" DESC, \"))\n\tstatement.OrderStr = buf.String()\n\treturn statement\n}\n\n// Asc provide asc order by query condition, the input parameters are columns.\nfunc (statement *Statement) Asc(colNames ...string) *Statement {\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, statement.OrderStr)\n\tif len(statement.OrderStr) > 0 {\n\t\tfmt.Fprint(&buf, \", \")\n\t}\n\tnewColNames := statement.col2NewColsWithQuote(colNames...)\n\tfmt.Fprintf(&buf, \"%v ASC\", strings.Join(newColNames, \" ASC, \"))\n\tstatement.OrderStr = buf.String()\n\treturn statement\n}\n\n// Join The joinOP should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN\nfunc (statement *Statement) Join(joinOP string, tablename interface{}, condition string, args ...interface{}) *Statement {\n\tvar buf bytes.Buffer\n\tif len(statement.JoinStr) > 0 {\n\t\tfmt.Fprintf(&buf, \"%v %v JOIN \", statement.JoinStr, joinOP)\n\t} else {\n\t\tfmt.Fprintf(&buf, \"%v JOIN \", joinOP)\n\t}\n\n\tswitch tablename.(type) {\n\tcase []string:\n\t\tt := tablename.([]string)\n\t\tif len(t) > 1 {\n\t\t\tfmt.Fprintf(&buf, \"%v AS %v\", statement.Engine.Quote(t[0]), statement.Engine.Quote(t[1]))\n\t\t} else if len(t) == 1 {\n\t\t\tfmt.Fprintf(&buf, statement.Engine.Quote(t[0]))\n\t\t}\n\tcase []interface{}:\n\t\tt := tablename.([]interface{})\n\t\tl := len(t)\n\t\tvar table string\n\t\tif l > 0 {\n\t\t\tf := t[0]\n\t\t\tv := rValue(f)\n\t\t\tt := v.Type()\n\t\t\tif t.Kind() == reflect.String {\n\t\t\t\ttable = f.(string)\n\t\t\t} else if t.Kind() == reflect.Struct {\n\t\t\t\ttable = statement.Engine.tbName(v)\n\t\t\t}\n\t\t}\n\t\tif l > 1 {\n\t\t\tfmt.Fprintf(&buf, \"%v AS %v\", statement.Engine.Quote(table),\n\t\t\t\tstatement.Engine.Quote(fmt.Sprintf(\"%v\", t[1])))\n\t\t} else if l == 1 {\n\t\t\tfmt.Fprintf(&buf, statement.Engine.Quote(table))\n\t\t}\n\tdefault:\n\t\tfmt.Fprintf(&buf, statement.Engine.Quote(fmt.Sprintf(\"%v\", tablename)))\n\t}\n\n\tfmt.Fprintf(&buf, \" ON %v\", condition)\n\tstatement.JoinStr = buf.String()\n\tstatement.joinArgs = append(statement.joinArgs, args...)\n\treturn statement\n}\n\n// GroupBy generate \"Group By keys\" statement\nfunc (statement *Statement) GroupBy(keys string) *Statement {\n\tstatement.GroupByStr = keys\n\treturn statement\n}\n\n// Having generate \"Having conditions\" statement\nfunc (statement *Statement) Having(conditions string) *Statement {\n\tstatement.HavingStr = fmt.Sprintf(\"HAVING %v\", conditions)\n\treturn statement\n}\n\n// Unscoped always disable struct tag \"deleted\"\nfunc (statement *Statement) Unscoped() *Statement {\n\tstatement.unscoped = true\n\treturn statement\n}\n\nfunc (statement *Statement) genColumnStr() string {\n\ttable := statement.RefTable\n\tvar colNames []string\n\tfor _, col := range table.Columns() {\n\t\tif statement.OmitStr != \"\" {\n\t\t\tif _, ok := statement.columnMap[strings.ToLower(col.Name)]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif col.MapType == core.ONLYTODB {\n\t\t\tcontinue\n\t\t}\n\n\t\tif statement.JoinStr != \"\" {\n\t\t\tvar name string\n\t\t\tif statement.TableAlias != \"\" {\n\t\t\t\tname = statement.Engine.Quote(statement.TableAlias)\n\t\t\t} else {\n\t\t\t\tname = statement.Engine.Quote(statement.TableName())\n\t\t\t}\n\t\t\tname += \".\" + statement.Engine.Quote(col.Name)\n\t\t\tif col.IsPrimaryKey && statement.Engine.Dialect().DBType() == \"ql\" {\n\t\t\t\tcolNames = append(colNames, \"id() AS \"+name)\n\t\t\t} else {\n\t\t\t\tcolNames = append(colNames, name)\n\t\t\t}\n\t\t} else {\n\t\t\tname := statement.Engine.Quote(col.Name)\n\t\t\tif col.IsPrimaryKey && statement.Engine.Dialect().DBType() == \"ql\" {\n\t\t\t\tcolNames = append(colNames, \"id() AS \"+name)\n\t\t\t} else {\n\t\t\t\tcolNames = append(colNames, name)\n\t\t\t}\n\t\t}\n\t}\n\treturn strings.Join(colNames, \", \")\n}\n\nfunc (statement *Statement) genCreateTableSQL() string {\n\treturn statement.Engine.dialect.CreateTableSql(statement.RefTable, statement.TableName(),\n\t\tstatement.StoreEngine, statement.Charset)\n}\n\nfunc (s *Statement) genIndexSQL() []string {\n\tvar sqls []string\n\ttbName := s.TableName()\n\tquote := s.Engine.Quote\n\tfor idxName, index := range s.RefTable.Indexes {\n\t\tif index.Type == core.IndexType {\n\t\t\tsql := fmt.Sprintf(\"CREATE INDEX %v ON %v (%v);\", quote(indexName(tbName, idxName)),\n\t\t\t\tquote(tbName), quote(strings.Join(index.Cols, quote(\",\"))))\n\t\t\tsqls = append(sqls, sql)\n\t\t}\n\t}\n\treturn sqls\n}\n\nfunc uniqueName(tableName, uqeName string) string {\n\treturn fmt.Sprintf(\"UQE_%v_%v\", tableName, uqeName)\n}\n\nfunc (s *Statement) genUniqueSQL() []string {\n\tvar sqls []string\n\ttbName := s.TableName()\n\tfor _, index := range s.RefTable.Indexes {\n\t\tif index.Type == core.UniqueType {\n\t\t\tsql := s.Engine.dialect.CreateIndexSql(tbName, index)\n\t\t\tsqls = append(sqls, sql)\n\t\t}\n\t}\n\treturn sqls\n}\n\nfunc (s *Statement) genDelIndexSQL() []string {\n\tvar sqls []string\n\ttbName := s.TableName()\n\tfor idxName, index := range s.RefTable.Indexes {\n\t\tvar rIdxName string\n\t\tif index.Type == core.UniqueType {\n\t\t\trIdxName = uniqueName(tbName, idxName)\n\t\t} else if index.Type == core.IndexType {\n\t\t\trIdxName = indexName(tbName, idxName)\n\t\t}\n\t\tsql := fmt.Sprintf(\"DROP INDEX %v\", s.Engine.Quote(rIdxName))\n\t\tif s.Engine.dialect.IndexOnTable() {\n\t\t\tsql += fmt.Sprintf(\" ON %v\", s.Engine.Quote(s.TableName()))\n\t\t}\n\t\tsqls = append(sqls, sql)\n\t}\n\treturn sqls\n}\n\nfunc (statement *Statement) genGetSql(bean interface{}) (string, []interface{}) {\n\tstatement.setRefValue(rValue(bean))\n\n\tvar table = statement.RefTable\n\tvar addedTableName = (len(statement.JoinStr) > 0)\n\n\tif !statement.noAutoCondition {\n\t\tcolNames, args := statement.buildConditions(table, bean, true, true, false, true, addedTableName)\n\n\t\tstatement.ConditionStr = strings.Join(colNames, \" \"+statement.Engine.dialect.AndStr()+\" \")\n\t\tstatement.BeanArgs = args\n\t}\n\n\tvar columnStr = statement.ColumnStr\n\tif len(statement.selectStr) > 0 {\n\t\tcolumnStr = statement.selectStr\n\t} else {\n\t\t// TODO: always generate column names, not use * even if join\n\t\tif len(statement.JoinStr) == 0 {\n\t\t\tif len(columnStr) == 0 {\n\t\t\t\tif len(statement.GroupByStr) > 0 {\n\t\t\t\t\tcolumnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, \",\", statement.Engine.Quote(\",\"), -1))\n\t\t\t\t} else {\n\t\t\t\t\tcolumnStr = statement.genColumnStr()\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif len(columnStr) == 0 {\n\t\t\t\tif len(statement.GroupByStr) > 0 {\n\t\t\t\t\tcolumnStr = statement.Engine.Quote(strings.Replace(statement.GroupByStr, \",\", statement.Engine.Quote(\",\"), -1))\n\t\t\t\t} else {\n\t\t\t\t\tcolumnStr = \"*\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tstatement.attachInSql() // !admpub!  fix bug:Iterate func missing \"... IN (...)\"\n\treturn statement.genSelectSQL(columnStr), append(append(statement.joinArgs, statement.Params...), statement.BeanArgs...)\n}\n\nfunc (s *Statement) genAddColumnStr(col *core.Column) (string, []interface{}) {\n\tquote := s.Engine.Quote\n\tsql := fmt.Sprintf(\"ALTER TABLE %v ADD %v;\", quote(s.TableName()),\n\t\tcol.String(s.Engine.dialect))\n\treturn sql, []interface{}{}\n}\n\n/*func (s *Statement) genAddIndexStr(idxName string, cols []string) (string, []interface{}) {\n\tquote := s.Engine.Quote\n\tcolstr := quote(strings.Join(cols, quote(\", \")))\n\tsql := fmt.Sprintf(\"CREATE INDEX %v ON %v (%v);\", quote(idxName), quote(s.TableName()), colstr)\n\treturn sql, []interface{}{}\n}\n\nfunc (s *Statement) genAddUniqueStr(uqeName string, cols []string) (string, []interface{}) {\n\tquote := s.Engine.Quote\n\tcolstr := quote(strings.Join(cols, quote(\", \")))\n\tsql := fmt.Sprintf(\"CREATE UNIQUE INDEX %v ON %v (%v);\", quote(uqeName), quote(s.TableName()), colstr)\n\treturn sql, []interface{}{}\n}*/\n\nfunc (statement *Statement) buildConditions(table *core.Table, bean interface{}, includeVersion bool, includeUpdated bool, includeNil bool, includeAutoIncr bool, addedTableName bool) ([]string, []interface{}) {\n\treturn buildConditions(statement.Engine, table, bean, includeVersion, includeUpdated, includeNil, includeAutoIncr, statement.allUseBool, statement.useAllCols,\n\t\tstatement.unscoped, statement.mustColumnMap, statement.TableName(), statement.TableAlias, addedTableName)\n}\n\nfunc (statement *Statement) genCountSql(bean interface{}) (string, []interface{}) {\n\tstatement.setRefValue(rValue(bean))\n\n\tvar addedTableName = (len(statement.JoinStr) > 0)\n\n\tif !statement.noAutoCondition {\n\t\tcolNames, args := statement.buildConditions(statement.RefTable, bean, true, true, false, true, addedTableName)\n\n\t\tstatement.ConditionStr = strings.Join(colNames, \" \"+statement.Engine.Dialect().AndStr()+\" \")\n\t\tstatement.BeanArgs = args\n\t}\n\n\t// count(index fieldname) > count(0) > count(*)\n\tvar id = \"*\"\n\tif statement.Engine.Dialect().DBType() == \"ql\" {\n\t\tid = \"\"\n\t}\n\tstatement.attachInSql()\n\treturn statement.genSelectSQL(fmt.Sprintf(\"count(%v)\", id)), append(append(statement.joinArgs, statement.Params...), statement.BeanArgs...)\n}\n\nfunc (statement *Statement) genSumSql(bean interface{}, columns ...string) (string, []interface{}) {\n\tstatement.setRefValue(rValue(bean))\n\n\tvar addedTableName = (len(statement.JoinStr) > 0)\n\n\tif !statement.noAutoCondition {\n\t\tcolNames, args := statement.buildConditions(statement.RefTable, bean, true, true, false, true, addedTableName)\n\n\t\tstatement.ConditionStr = strings.Join(colNames, \" \"+statement.Engine.Dialect().AndStr()+\" \")\n\t\tstatement.BeanArgs = args\n\t}\n\n\tstatement.attachInSql()\n\tvar sumStrs = make([]string, 0, len(columns))\n\tfor _, colName := range columns {\n\t\tsumStrs = append(sumStrs, fmt.Sprintf(\"sum(%s)\", colName))\n\t}\n\treturn statement.genSelectSQL(strings.Join(sumStrs, \", \")), append(append(statement.joinArgs, statement.Params...), statement.BeanArgs...)\n}\n\nfunc (statement *Statement) genSelectSQL(columnStr string) (a string) {\n\tvar distinct string\n\tif statement.IsDistinct {\n\t\tdistinct = \"DISTINCT \"\n\t}\n\n\tvar dialect = statement.Engine.Dialect()\n\tvar quote = statement.Engine.Quote\n\tvar top string\n\tvar mssqlCondi string\n\n\tstatement.processIdParam()\n\n\tvar buf bytes.Buffer\n\tif len(statement.WhereStr) > 0 {\n\t\tif len(statement.ConditionStr) > 0 {\n\t\t\tfmt.Fprintf(&buf, \" WHERE (%v)\", statement.WhereStr)\n\t\t} else {\n\t\t\tfmt.Fprintf(&buf, \" WHERE %v\", statement.WhereStr)\n\t\t}\n\t\tif statement.ConditionStr != \"\" {\n\t\t\tfmt.Fprintf(&buf, \" %s (%v)\", dialect.AndStr(), statement.ConditionStr)\n\t\t}\n\t} else if len(statement.ConditionStr) > 0 {\n\t\tfmt.Fprintf(&buf, \" WHERE %v\", statement.ConditionStr)\n\t}\n\tvar whereStr = buf.String()\n\n\tvar fromStr = \" FROM \" + quote(statement.TableName())\n\tif statement.TableAlias != \"\" {\n\t\tif dialect.DBType() == core.ORACLE {\n\t\t\tfromStr += \" \" + quote(statement.TableAlias)\n\t\t} else {\n\t\t\tfromStr += \" AS \" + quote(statement.TableAlias)\n\t\t}\n\t}\n\tif statement.JoinStr != \"\" {\n\t\tfromStr = fmt.Sprintf(\"%v %v\", fromStr, statement.JoinStr)\n\t}\n\n\tif dialect.DBType() == core.MSSQL {\n\t\tif statement.LimitN > 0 {\n\t\t\ttop = fmt.Sprintf(\" TOP %d \", statement.LimitN)\n\t\t}\n\t\tif statement.Start > 0 {\n\t\t\tvar column = \"(id)\"\n\t\t\tif len(statement.RefTable.PKColumns()) == 0 {\n\t\t\t\tfor _, index := range statement.RefTable.Indexes {\n\t\t\t\t\tif len(index.Cols) == 1 {\n\t\t\t\t\t\tcolumn = index.Cols[0]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(column) == 0 {\n\t\t\t\t\tcolumn = statement.RefTable.ColumnsSeq()[0]\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar orderStr string\n\t\t\tif len(statement.OrderStr) > 0 {\n\t\t\t\torderStr = \" ORDER BY \" + statement.OrderStr\n\t\t\t}\n\t\t\tvar groupStr string\n\t\t\tif len(statement.GroupByStr) > 0 {\n\t\t\t\tgroupStr = \" GROUP BY \" + statement.GroupByStr\n\t\t\t}\n\t\t\tmssqlCondi = fmt.Sprintf(\"(%s NOT IN (SELECT TOP %d %s%s%s%s%s))\",\n\t\t\t\tcolumn, statement.Start, column, fromStr, whereStr, orderStr, groupStr)\n\t\t}\n\t}\n\n\t// !nashtsai! REVIEW Sprintf is considered slowest mean of string concatnation, better to work with builder pattern\n\ta = fmt.Sprintf(\"SELECT %v%v%v%v%v\", top, distinct, columnStr, fromStr, whereStr)\n\tif len(mssqlCondi) > 0 {\n\t\tif len(whereStr) > 0 {\n\t\t\ta += \" AND \" + mssqlCondi\n\t\t} else {\n\t\t\ta += \" WHERE \" + mssqlCondi\n\t\t}\n\t}\n\n\tif statement.GroupByStr != \"\" {\n\t\ta = fmt.Sprintf(\"%v GROUP BY %v\", a, statement.GroupByStr)\n\t}\n\tif statement.HavingStr != \"\" {\n\t\ta = fmt.Sprintf(\"%v %v\", a, statement.HavingStr)\n\t}\n\tif statement.OrderStr != \"\" {\n\t\ta = fmt.Sprintf(\"%v ORDER BY %v\", a, statement.OrderStr)\n\t}\n\tif dialect.DBType() != core.MSSQL && dialect.DBType() != core.ORACLE {\n\t\tif statement.Start > 0 {\n\t\t\ta = fmt.Sprintf(\"%v LIMIT %v OFFSET %v\", a, statement.LimitN, statement.Start)\n\t\t} else if statement.LimitN > 0 {\n\t\t\ta = fmt.Sprintf(\"%v LIMIT %v\", a, statement.LimitN)\n\t\t}\n\t} else if dialect.DBType() == core.ORACLE {\n\t\tif statement.Start != 0 || statement.LimitN != 0 {\n\t\t\ta = fmt.Sprintf(\"SELECT %v FROM (SELECT %v,ROWNUM RN FROM (%v) at WHERE ROWNUM <= %d) aat WHERE RN > %d\", columnStr, columnStr, a, statement.Start+statement.LimitN, statement.Start)\n\t\t}\n\t}\n\tif statement.IsForUpdate {\n\t\ta = dialect.ForUpdateSql(a)\n\t}\n\n\treturn\n}\n\nfunc (statement *Statement) processIdParam() {\n\tif statement.IdParam != nil {\n\t\tif statement.Engine.dialect.DBType() != \"ql\" {\n\t\t\tfor i, col := range statement.RefTable.PKColumns() {\n\t\t\t\tvar colName = statement.colName(col, statement.TableName())\n\t\t\t\tif i < len(*(statement.IdParam)) {\n\t\t\t\t\tstatement.And(fmt.Sprintf(\"%v %s ?\", colName,\n\t\t\t\t\t\tstatement.Engine.dialect.EqStr()), (*(statement.IdParam))[i])\n\t\t\t\t} else {\n\t\t\t\t\tstatement.And(fmt.Sprintf(\"%v %s ?\", colName,\n\t\t\t\t\t\tstatement.Engine.dialect.EqStr()), \"\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif len(*(statement.IdParam)) <= 1 {\n\t\t\t\tstatement.And(\"id() == ?\", (*(statement.IdParam))[0])\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (statement *Statement) JoinColumns(cols []*core.Column, includeTableName bool) string {\n\tvar colnames = make([]string, len(cols))\n\tfor i, col := range cols {\n\t\tif includeTableName {\n\t\t\tcolnames[i] = statement.Engine.Quote(statement.TableName()) +\n\t\t\t\t\".\" + statement.Engine.Quote(col.Name)\n\t\t} else {\n\t\t\tcolnames[i] = statement.Engine.Quote(col.Name)\n\t\t}\n\t}\n\treturn strings.Join(colnames, \", \")\n}\n\nfunc (statement *Statement) convertIdSql(sqlStr string) string {\n\tif statement.RefTable != nil {\n\t\tcols := statement.RefTable.PKColumns()\n\t\tif len(cols) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\n\t\tcolstrs := statement.JoinColumns(cols, false)\n\t\tsqls := splitNNoCase(sqlStr, \" from \", 2)\n\t\tif len(sqls) != 2 {\n\t\t\treturn \"\"\n\t\t}\n\t\tif statement.Engine.dialect.DBType() == \"ql\" {\n\t\t\treturn fmt.Sprintf(\"SELECT id() FROM %v\", sqls[1])\n\t\t}\n\t\treturn fmt.Sprintf(\"SELECT %s FROM %v\", colstrs, sqls[1])\n\t}\n\treturn \"\"\n}\n\nfunc (statement *Statement) convertUpdateSQL(sqlStr string) (string, string) {\n\tif statement.RefTable == nil || len(statement.RefTable.PrimaryKeys) != 1 {\n\t\treturn \"\", \"\"\n\t}\n\n\tcolstrs := statement.JoinColumns(statement.RefTable.PKColumns(), true)\n\tsqls := splitNNoCase(sqlStr, \"where\", 2)\n\tif len(sqls) != 2 {\n\t\tif len(sqls) == 1 {\n\t\t\treturn sqls[0], fmt.Sprintf(\"SELECT %v FROM %v\",\n\t\t\t\tcolstrs, statement.Engine.Quote(statement.TableName()))\n\t\t}\n\t\treturn \"\", \"\"\n\t}\n\n\tvar whereStr = sqls[1]\n\n\t//TODO: for postgres only, if any other database?\n\tvar paraStr string\n\tif statement.Engine.dialect.DBType() == core.POSTGRES {\n\t\tparaStr = \"$\"\n\t} else if statement.Engine.dialect.DBType() == core.MSSQL {\n\t\tparaStr = \":\"\n\t}\n\n\tif paraStr != \"\" {\n\t\tif strings.Contains(sqls[1], paraStr) {\n\t\t\tdollers := strings.Split(sqls[1], paraStr)\n\t\t\twhereStr = dollers[0]\n\t\t\tfor i, c := range dollers[1:] {\n\t\t\t\tccs := strings.SplitN(c, \" \", 2)\n\t\t\t\twhereStr += fmt.Sprintf(paraStr+\"%v %v\", i+1, ccs[1])\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sqls[0], fmt.Sprintf(\"SELECT %v FROM %v WHERE %v\",\n\t\tcolstrs, statement.Engine.Quote(statement.TableName()),\n\t\twhereStr)\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/syslogger.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build !windows,!nacl,!plan9\n\npackage xorm\n\nimport (\n\t\"fmt\"\n\t\"log/syslog\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar _ core.ILogger = &SyslogLogger{}\n\n// SyslogLogger will be depricated\ntype SyslogLogger struct {\n\tw       *syslog.Writer\n\tshowSQL bool\n}\n\nfunc NewSyslogLogger(w *syslog.Writer) *SyslogLogger {\n\treturn &SyslogLogger{w: w}\n}\n\nfunc (s *SyslogLogger) Debug(v ...interface{}) {\n\ts.w.Debug(fmt.Sprint(v...))\n}\n\nfunc (s *SyslogLogger) Debugf(format string, v ...interface{}) {\n\ts.w.Debug(fmt.Sprintf(format, v...))\n}\n\nfunc (s *SyslogLogger) Error(v ...interface{}) {\n\ts.w.Err(fmt.Sprint(v...))\n}\n\nfunc (s *SyslogLogger) Errorf(format string, v ...interface{}) {\n\ts.w.Err(fmt.Sprintf(format, v...))\n}\n\nfunc (s *SyslogLogger) Info(v ...interface{}) {\n\ts.w.Info(fmt.Sprint(v...))\n}\n\nfunc (s *SyslogLogger) Infof(format string, v ...interface{}) {\n\ts.w.Info(fmt.Sprintf(format, v...))\n}\n\nfunc (s *SyslogLogger) Warn(v ...interface{}) {\n\ts.w.Warning(fmt.Sprint(v...))\n}\n\nfunc (s *SyslogLogger) Warnf(format string, v ...interface{}) {\n\ts.w.Warning(fmt.Sprintf(format, v...))\n}\n\nfunc (s *SyslogLogger) Level() core.LogLevel {\n\treturn core.LOG_UNKNOWN\n}\n\n// SetLevel always return error, as current log/syslog package doesn't allow to set priority level after syslog.Writer created\nfunc (s *SyslogLogger) SetLevel(l core.LogLevel) {}\n\nfunc (s *SyslogLogger) ShowSQL(show ...bool) {\n\tif len(show) == 0 {\n\t\ts.showSQL = true\n\t\treturn\n\t}\n\ts.showSQL = show[0]\n}\n\nfunc (s *SyslogLogger) IsShowSQL() bool {\n\treturn s.showSQL\n}\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/types.go",
    "content": "package xorm\n\nimport (\n\t\"reflect\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nvar (\n\tptrPkType = reflect.TypeOf(&core.PK{})\n\tpkType    = reflect.TypeOf(core.PK{})\n)\n"
  },
  {
    "path": "src/github.com/go-xorm/xorm/xorm.go",
    "content": "// Copyright 2015 The Xorm Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage xorm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/go-xorm/core\"\n)\n\nconst (\n\t// Version show the xorm's version\n\tVersion string = \"0.5.5.0711\"\n)\n\nfunc regDrvsNDialects() bool {\n\tprovidedDrvsNDialects := map[string]struct {\n\t\tdbType     core.DbType\n\t\tgetDriver  func() core.Driver\n\t\tgetDialect func() core.Dialect\n\t}{\n\t\t\"mssql\":    {\"mssql\", func() core.Driver { return &odbcDriver{} }, func() core.Dialect { return &mssql{} }},\n\t\t\"odbc\":     {\"mssql\", func() core.Driver { return &odbcDriver{} }, func() core.Dialect { return &mssql{} }}, // !nashtsai! TODO change this when supporting MS Access\n\t\t\"mysql\":    {\"mysql\", func() core.Driver { return &mysqlDriver{} }, func() core.Dialect { return &mysql{} }},\n\t\t\"mymysql\":  {\"mysql\", func() core.Driver { return &mymysqlDriver{} }, func() core.Dialect { return &mysql{} }},\n\t\t\"postgres\": {\"postgres\", func() core.Driver { return &pqDriver{} }, func() core.Dialect { return &postgres{} }},\n\t\t\"sqlite3\":  {\"sqlite3\", func() core.Driver { return &sqlite3Driver{} }, func() core.Dialect { return &sqlite3{} }},\n\t\t\"oci8\":     {\"oracle\", func() core.Driver { return &oci8Driver{} }, func() core.Dialect { return &oracle{} }},\n\t\t\"goracle\":  {\"oracle\", func() core.Driver { return &goracleDriver{} }, func() core.Dialect { return &oracle{} }},\n\t}\n\n\tfor driverName, v := range providedDrvsNDialects {\n\t\tif driver := core.QueryDriver(driverName); driver == nil {\n\t\t\tcore.RegisterDriver(driverName, v.getDriver())\n\t\t\tcore.RegisterDialect(v.dbType, v.getDialect)\n\t\t}\n\t}\n\treturn true\n}\n\nfunc close(engine *Engine) {\n\tengine.Close()\n}\n\n// NewEngine new a db manager according to the parameter. Currently support four\n// drivers\nfunc NewEngine(driverName string, dataSourceName string) (*Engine, error) {\n\tregDrvsNDialects()\n\tdriver := core.QueryDriver(driverName)\n\tif driver == nil {\n\t\treturn nil, fmt.Errorf(\"Unsupported driver name: %v\", driverName)\n\t}\n\n\turi, err := driver.Parse(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdialect := core.QueryDialect(uri.DbType)\n\tif dialect == nil {\n\t\treturn nil, fmt.Errorf(\"Unsupported dialect type: %v\", uri.DbType)\n\t}\n\n\tdb, err := core.Open(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = dialect.Init(db, uri, driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tengine := &Engine{\n\t\tdb:            db,\n\t\tdialect:       dialect,\n\t\tTables:        make(map[reflect.Type]*core.Table),\n\t\tmutex:         &sync.RWMutex{},\n\t\tTagIdentifier: \"xorm\",\n\t\tTZLocation:    time.Local,\n\t}\n\n\tlogger := NewSimpleLogger(os.Stdout)\n\tlogger.SetLevel(core.LOG_INFO)\n\tengine.SetLogger(logger)\n\tengine.SetMapper(core.NewCacheMapper(new(core.SnakeMapper)))\n\n\truntime.SetFinalizer(engine, close)\n\n\treturn engine, nil\n}\n\n// Clone clone an engine\nfunc (engine *Engine) Clone() (*Engine, error) {\n\treturn NewEngine(engine.DriverName(), engine.DataSourceName())\n}\n"
  },
  {
    "path": "src/github.com/golang/glog/glog.go",
    "content": "// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/\n//\n// Copyright 2013 Google Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.\n// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as\n// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags.\n//\n// Basic examples:\n//\n//\tglog.Info(\"Prepare to repel boarders\")\n//\n//\tglog.Fatalf(\"Initialization failed: %s\", err)\n//\n// See the documentation for the V function for an explanation of these examples:\n//\n//\tif glog.V(2) {\n//\t\tglog.Info(\"Starting transaction...\")\n//\t}\n//\n//\tglog.V(2).Infoln(\"Processed\", nItems, \"elements\")\n//\n// Log output is buffered and written periodically using Flush. Programs\n// should call Flush before exiting to guarantee all glog output is written.\n//\n// By default, all glog statements write to files in a temporary directory.\n// This package provides several flags that modify this behavior.\n// As a result, flag.Parse must be called before any logging is done.\n//\n//\t-logtostderr=false\n//\t\tLogs are written to standard error instead of to files.\n//\t-alsologtostderr=false\n//\t\tLogs are written to standard error as well as to files.\n//\t-stderrthreshold=ERROR\n//\t\tLog events at or above this severity are logged to standard\n//\t\terror as well as to files.\n//\t-log_dir=\"\"\n//\t\tLog files will be written to this directory instead of the\n//\t\tdefault temporary directory.\n//\n//\tOther flags provide aids to debugging.\n//\n//\t-log_backtrace_at=\"\"\n//\t\tWhen set to a file and line number holding a logging statement,\n//\t\tsuch as\n//\t\t\t-log_backtrace_at=gopherflakes.go:234\n//\t\ta stack trace will be written to the Info glog whenever execution\n//\t\thits that statement. (Unlike with -vmodule, the \".go\" must be\n//\t\tpresent.)\n//\t-v=0\n//\t\tEnable V-leveled logging at the specified level.\n//\t-vmodule=\"\"\n//\t\tThe syntax of the argument is a comma-separated list of pattern=N,\n//\t\twhere pattern is a literal file name (minus the \".go\" suffix) or\n//\t\t\"glob\" pattern and N is a V level. For instance,\n//\t\t\t-vmodule=gopher*=3\n//\t\tsets the V level to 3 in all Go files whose names begin \"gopher\".\n//\npackage glog\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"errors\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io\"\n\tstdLog \"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"sync/atomic\"\n\t\"time\"\n)\n\n// severity identifies the sort of glog: info, warning etc. It also implements\n// the flag.Value interface. The -stderrthreshold flag is of type severity and\n// should be modified only through the flag.Value interface. The values match\n// the corresponding constants in C++.\ntype severity int32 // sync/atomic int32\n\n// These constants identify the glog levels in order of increasing severity.\n// A message written to a high-severity glog file is also written to each\n// lower-severity glog file.\nconst (\n\tinfoLog     severity = iota\n\twarningLog\n\terrorLog\n\tfatalLog\n\tnumSeverity = 4\n)\n\nconst severityChar = \"IWEF\"\n\nvar severityName = []string{\n\tinfoLog:    \"INFO\",\n\twarningLog: \"WARNING\",\n\terrorLog:   \"ERROR\",\n\tfatalLog:   \"FATAL\",\n}\n\n// get returns the value of the severity.\nfunc (s *severity) get() severity {\n\treturn severity(atomic.LoadInt32((*int32)(s)))\n}\n\n// set sets the value of the severity.\nfunc (s *severity) set(val severity) {\n\tatomic.StoreInt32((*int32)(s), int32(val))\n}\n\n// String is part of the flag.Value interface.\nfunc (s *severity) String() string {\n\treturn strconv.FormatInt(int64(*s), 10)\n}\n\n// Get is part of the flag.Value interface.\nfunc (s *severity) Get() interface{} {\n\treturn *s\n}\n\n// Set is part of the flag.Value interface.\nfunc (s *severity) Set(value string) error {\n\tvar threshold severity\n\t// Is it a known name?\n\tif v, ok := severityByName(value); ok {\n\t\tthreshold = v\n\t} else {\n\t\tv, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tthreshold = severity(v)\n\t}\n\tlogging.stderrThreshold.set(threshold)\n\treturn nil\n}\n\nfunc severityByName(s string) (severity, bool) {\n\ts = strings.ToUpper(s)\n\tfor i, name := range severityName {\n\t\tif name == s {\n\t\t\treturn severity(i), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// OutputStats tracks the number of output lines and bytes written.\ntype OutputStats struct {\n\tlines int64\n\tbytes int64\n}\n\n// Lines returns the number of lines written.\nfunc (s *OutputStats) Lines() int64 {\n\treturn atomic.LoadInt64(&s.lines)\n}\n\n// Bytes returns the number of bytes written.\nfunc (s *OutputStats) Bytes() int64 {\n\treturn atomic.LoadInt64(&s.bytes)\n}\n\n// Stats tracks the number of lines of output and number of bytes\n// per severity level. Values must be read with atomic.LoadInt64.\nvar Stats struct {\n\tInfo, Warning, Error OutputStats\n}\n\nvar severityStats = [numSeverity]*OutputStats{\n\tinfoLog:    &Stats.Info,\n\twarningLog: &Stats.Warning,\n\terrorLog:   &Stats.Error,\n}\n\n// Level is exported because it appears in the arguments to V and is\n// the type of the v flag, which can be set programmatically.\n// It's a distinct type because we want to discriminate it from logType.\n// Variables of type level are only changed under logging.mu.\n// The -v flag is read only with atomic ops, so the state of the logging\n// module is consistent.\n\n// Level is treated as a sync/atomic int32.\n\n// Level specifies a level of verbosity for V logs. *Level implements\n// flag.Value; the -v flag is of type Level and should be modified\n// only through the flag.Value interface.\ntype Level int32\n\n// get returns the value of the Level.\nfunc (l *Level) get() Level {\n\treturn Level(atomic.LoadInt32((*int32)(l)))\n}\n\n// set sets the value of the Level.\nfunc (l *Level) set(val Level) {\n\tatomic.StoreInt32((*int32)(l), int32(val))\n}\n\n// String is part of the flag.Value interface.\nfunc (l *Level) String() string {\n\treturn strconv.FormatInt(int64(*l), 10)\n}\n\n// Get is part of the flag.Value interface.\nfunc (l *Level) Get() interface{} {\n\treturn *l\n}\n\n// Set is part of the flag.Value interface.\nfunc (l *Level) Set(value string) error {\n\tv, err := strconv.Atoi(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\tlogging.setVState(Level(v), logging.vmodule.filter, false)\n\treturn nil\n}\n\n// moduleSpec represents the setting of the -vmodule flag.\ntype moduleSpec struct {\n\tfilter []modulePat\n}\n\n// modulePat contains a filter for the -vmodule flag.\n// It holds a verbosity level and a file pattern to match.\ntype modulePat struct {\n\tpattern string\n\tliteral bool // The pattern is a literal string\n\tlevel   Level\n}\n\n// match reports whether the file matches the pattern. It uses a string\n// comparison if the pattern contains no metacharacters.\nfunc (m *modulePat) match(file string) bool {\n\tif m.literal {\n\t\treturn file == m.pattern\n\t}\n\tmatch, _ := filepath.Match(m.pattern, file)\n\treturn match\n}\n\nfunc (m *moduleSpec) String() string {\n\t// Lock because the type is not atomic. TODO: clean this up.\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\tvar b bytes.Buffer\n\tfor i, f := range m.filter {\n\t\tif i > 0 {\n\t\t\tb.WriteRune(',')\n\t\t}\n\t\tfmt.Fprintf(&b, \"%s=%d\", f.pattern, f.level)\n\t}\n\treturn b.String()\n}\n\n// Get is part of the (Go 1.2)  flag.Getter interface. It always returns nil for this flag type since the\n// struct is not exported.\nfunc (m *moduleSpec) Get() interface{} {\n\treturn nil\n}\n\nvar errVmoduleSyntax = errors.New(\"syntax error: expect comma-separated list of filename=N\")\n\n// Syntax: -vmodule=recordio=2,file=1,gfs*=3\nfunc (m *moduleSpec) Set(value string) error {\n\tvar filter []modulePat\n\tfor _, pat := range strings.Split(value, \",\") {\n\t\tif len(pat) == 0 {\n\t\t\t// Empty strings such as from a trailing comma can be ignored.\n\t\t\tcontinue\n\t\t}\n\t\tpatLev := strings.Split(pat, \"=\")\n\t\tif len(patLev) != 2 || len(patLev[0]) == 0 || len(patLev[1]) == 0 {\n\t\t\treturn errVmoduleSyntax\n\t\t}\n\t\tpattern := patLev[0]\n\t\tv, err := strconv.Atoi(patLev[1])\n\t\tif err != nil {\n\t\t\treturn errors.New(\"syntax error: expect comma-separated list of filename=N\")\n\t\t}\n\t\tif v < 0 {\n\t\t\treturn errors.New(\"negative value for vmodule level\")\n\t\t}\n\t\tif v == 0 {\n\t\t\tcontinue // Ignore. It's harmless but no point in paying the overhead.\n\t\t}\n\t\t// TODO: check syntax of filter?\n\t\tfilter = append(filter, modulePat{pattern, isLiteral(pattern), Level(v)})\n\t}\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\tlogging.setVState(logging.verbosity, filter, true)\n\treturn nil\n}\n\n// isLiteral reports whether the pattern is a literal string, that is, has no metacharacters\n// that require filepath.Match to be called to match the pattern.\nfunc isLiteral(pattern string) bool {\n\treturn !strings.ContainsAny(pattern, `\\*?[]`)\n}\n\n// traceLocation represents the setting of the -log_backtrace_at flag.\ntype traceLocation struct {\n\tfile string\n\tline int\n}\n\n// isSet reports whether the trace location has been specified.\n// logging.mu is held.\nfunc (t *traceLocation) isSet() bool {\n\treturn t.line > 0\n}\n\n// match reports whether the specified file and line matches the trace location.\n// The argument file name is the full path, not the basename specified in the flag.\n// logging.mu is held.\nfunc (t *traceLocation) match(file string, line int) bool {\n\tif t.line != line {\n\t\treturn false\n\t}\n\tif i := strings.LastIndex(file, \"/\"); i >= 0 {\n\t\tfile = file[i+1:]\n\t}\n\treturn t.file == file\n}\n\nfunc (t *traceLocation) String() string {\n\t// Lock because the type is not atomic. TODO: clean this up.\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\treturn fmt.Sprintf(\"%s:%d\", t.file, t.line)\n}\n\n// Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the\n// struct is not exported\nfunc (t *traceLocation) Get() interface{} {\n\treturn nil\n}\n\nvar errTraceSyntax = errors.New(\"syntax error: expect file.go:234\")\n\n// Syntax: -log_backtrace_at=gopherflakes.go:234\n// Note that unlike vmodule the file extension is included here.\nfunc (t *traceLocation) Set(value string) error {\n\tif value == \"\" {\n\t\t// Unset.\n\t\tt.line = 0\n\t\tt.file = \"\"\n\t}\n\tfields := strings.Split(value, \":\")\n\tif len(fields) != 2 {\n\t\treturn errTraceSyntax\n\t}\n\tfile, line := fields[0], fields[1]\n\tif !strings.Contains(file, \".\") {\n\t\treturn errTraceSyntax\n\t}\n\tv, err := strconv.Atoi(line)\n\tif err != nil {\n\t\treturn errTraceSyntax\n\t}\n\tif v <= 0 {\n\t\treturn errors.New(\"negative or zero value for level\")\n\t}\n\tlogging.mu.Lock()\n\tdefer logging.mu.Unlock()\n\tt.line = v\n\tt.file = file\n\treturn nil\n}\n\n// flushSyncWriter is the interface satisfied by logging destinations.\ntype flushSyncWriter interface {\n\tFlush() error\n\tSync() error\n\tio.Writer\n}\n\nfunc init() {\n\tflag.BoolVar(&logging.toStderr, \"logtostderr\", false, \"glog to standard error instead of files\")\n\tflag.BoolVar(&logging.alsoToStderr, \"alsologtostderr\", false, \"glog to standard error as well as files\")\n\tflag.Var(&logging.verbosity, \"v\", \"glog level for V logs\")\n\tflag.Var(&logging.stderrThreshold, \"stderrthreshold\", \"logs at or above this threshold go to stderr\")\n\tflag.Var(&logging.vmodule, \"vmodule\", \"comma-separated list of pattern=N settings for file-filtered logging\")\n\tflag.Var(&logging.traceLocation, \"log_backtrace_at\", \"when logging hits line file:N, emit a stack trace\")\n\n\t// Default stderrThreshold is ERROR.\n\tlogging.stderrThreshold = errorLog\n\n\tlogging.setVState(0, nil, false)\n\tgo logging.flushDaemon()\n}\n\n// Flush flushes all pending glog I/O.\nfunc Flush() {\n\tlogging.lockAndFlushAll()\n}\n\n// loggingT collects all the global state of the logging setup.\ntype loggingT struct {\n\t// Boolean flags. Not handled atomically because the flag.Value interface\n\t// does not let us avoid the =true, and that shorthand is necessary for\n\t// compatibility. TODO: does this matter enough to fix? Seems unlikely.\n\ttoStderr     bool // The -logtostderr flag.\n\talsoToStderr bool // The -alsologtostderr flag.\n\n\t// Level flag. Handled atomically.\n\tstderrThreshold severity // The -stderrthreshold flag.\n\n\t// freeList is a list of byte buffers, maintained under freeListMu.\n\tfreeList *buffer\n\t// freeListMu maintains the free list. It is separate from the main mutex\n\t// so buffers can be grabbed and printed to without holding the main lock,\n\t// for better parallelization.\n\tfreeListMu sync.Mutex\n\n\t// mu protects the remaining elements of this structure and is\n\t// used to synchronize logging.\n\tmu sync.Mutex\n\t// file holds writer for each of the glog types.\n\tfile [numSeverity]flushSyncWriter\n\t// pcs is used in V to avoid an allocation when computing the caller's PC.\n\tpcs [1]uintptr\n\t// vmap is a cache of the V Level for each V() call site, identified by PC.\n\t// It is wiped whenever the vmodule flag changes state.\n\tvmap map[uintptr]Level\n\t// filterLength stores the length of the vmodule filter chain. If greater\n\t// than zero, it means vmodule is enabled. It may be read safely\n\t// using sync.LoadInt32, but is only modified under mu.\n\tfilterLength int32\n\t// traceLocation is the state of the -log_backtrace_at flag.\n\ttraceLocation traceLocation\n\t// These flags are modified only under lock, although verbosity may be fetched\n\t// safely using atomic.LoadInt32.\n\tvmodule   moduleSpec // The state of the -vmodule flag.\n\tverbosity Level      // V logging level, the value of the -v flag/\n}\n\n// buffer holds a byte Buffer for reuse. The zero value is ready for use.\ntype buffer struct {\n\tbytes.Buffer\n\ttmp  [64]byte // temporary byte array for creating headers.\n\tnext *buffer\n}\n\nvar logging loggingT\n\n// setVState sets a consistent state for V logging.\n// l.mu is held.\nfunc (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) {\n\t// Turn verbosity off so V will not fire while we are in transition.\n\tlogging.verbosity.set(0)\n\t// Ditto for filter length.\n\tatomic.StoreInt32(&logging.filterLength, 0)\n\n\t// Set the new filters and wipe the pc->Level map if the filter has changed.\n\tif setFilter {\n\t\tlogging.vmodule.filter = filter\n\t\tlogging.vmap = make(map[uintptr]Level)\n\t}\n\n\t// Things are consistent now, so enable filtering and verbosity.\n\t// They are enabled in order opposite to that in V.\n\tatomic.StoreInt32(&logging.filterLength, int32(len(filter)))\n\tlogging.verbosity.set(verbosity)\n}\n\n// getBuffer returns a new, ready-to-use buffer.\nfunc (l *loggingT) getBuffer() *buffer {\n\tl.freeListMu.Lock()\n\tb := l.freeList\n\tif b != nil {\n\t\tl.freeList = b.next\n\t}\n\tl.freeListMu.Unlock()\n\tif b == nil {\n\t\tb = new(buffer)\n\t} else {\n\t\tb.next = nil\n\t\tb.Reset()\n\t}\n\treturn b\n}\n\n// putBuffer returns a buffer to the free list.\nfunc (l *loggingT) putBuffer(b *buffer) {\n\tif b.Len() >= 256 {\n\t\t// Let big buffers die a natural death.\n\t\treturn\n\t}\n\tl.freeListMu.Lock()\n\tb.next = l.freeList\n\tl.freeList = b\n\tl.freeListMu.Unlock()\n}\n\nvar timeNow = time.Now // Stubbed out for testing.\n\n/*\nheader formats a glog header as defined by the C++ implementation.\nIt returns a buffer containing the formatted header and the user's file and line number.\nThe depth specifies how many stack frames above lives the source line to be identified in the glog message.\n\nLog lines have this form:\n\tLmmdd hh:mm:ss.uuuuuu threadid file:line] msg...\nwhere the fields are defined as follows:\n\tL                A single character, representing the glog level (eg 'I' for INFO)\n\tmm               The month (zero padded; ie May is '05')\n\tdd               The day (zero padded)\n\thh:mm:ss.uuuuuu  Time in hours, minutes and fractional seconds\n\tthreadid         The space-padded thread ID as returned by GetTID()\n\tfile             The file name\n\tline             The line number\n\tmsg              The user-supplied message\n*/\nfunc (l *loggingT) header(s severity, depth int) (*buffer, string, int) {\n\t_, file, line, ok := runtime.Caller(3 + depth)\n\tif !ok {\n\t\tfile = \"???\"\n\t\tline = 1\n\t} else {\n\t\tslash := strings.LastIndex(file, \"/\")\n\t\tif slash >= 0 {\n\t\t\tfile = file[slash+1:]\n\t\t}\n\t}\n\treturn l.formatHeader(s, file, line), file, line\n}\n\n// formatHeader formats a glog header using the provided file name and line number.\nfunc (l *loggingT) formatHeader(s severity, file string, line int) *buffer {\n\tnow := timeNow()\n\tif line < 0 {\n\t\tline = 0 // not a real line number, but acceptable to someDigits\n\t}\n\tif s > fatalLog {\n\t\ts = infoLog // for safety.\n\t}\n\tbuf := l.getBuffer()\n\n\t// Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.\n\t// It's worth about 3X. Fprintf is hard.\n\t_, month, day := now.Date()\n\thour, minute, second := now.Clock()\n\t// Lmmdd hh:mm:ss.uuuuuu threadid file:line]\n\tbuf.tmp[0] = severityChar[s]\n\tbuf.twoDigits(1, int(month))\n\tbuf.twoDigits(3, day)\n\tbuf.tmp[5] = ' '\n\tbuf.twoDigits(6, hour)\n\tbuf.tmp[8] = ':'\n\tbuf.twoDigits(9, minute)\n\tbuf.tmp[11] = ':'\n\tbuf.twoDigits(12, second)\n\tbuf.tmp[14] = '.'\n\tbuf.nDigits(6, 15, now.Nanosecond()/1000, '0')\n\tbuf.tmp[21] = ' '\n\tbuf.nDigits(7, 22, pid, ' ') // TODO: should be TID\n\tbuf.tmp[29] = ' '\n\tbuf.Write(buf.tmp[:30])\n\tbuf.WriteString(file)\n\tbuf.tmp[0] = ':'\n\tn := buf.someDigits(1, line)\n\tbuf.tmp[n+1] = ']'\n\tbuf.tmp[n+2] = ' '\n\tbuf.Write(buf.tmp[:n+3])\n\treturn buf\n}\n\n// Some custom tiny helper functions to print the glog header efficiently.\n\nconst digits = \"0123456789\"\n\n// twoDigits formats a zero-prefixed two-digit integer at buf.tmp[i].\nfunc (buf *buffer) twoDigits(i, d int) {\n\tbuf.tmp[i+1] = digits[d%10]\n\td /= 10\n\tbuf.tmp[i] = digits[d%10]\n}\n\n// nDigits formats an n-digit integer at buf.tmp[i],\n// padding with pad on the left.\n// It assumes d >= 0.\nfunc (buf *buffer) nDigits(n, i, d int, pad byte) {\n\tj := n - 1\n\tfor ; j >= 0 && d > 0; j-- {\n\t\tbuf.tmp[i+j] = digits[d%10]\n\t\td /= 10\n\t}\n\tfor ; j >= 0; j-- {\n\t\tbuf.tmp[i+j] = pad\n\t}\n}\n\n// someDigits formats a zero-prefixed variable-width integer at buf.tmp[i].\nfunc (buf *buffer) someDigits(i, d int) int {\n\t// Print into the top, then copy down. We know there's space for at least\n\t// a 10-digit number.\n\tj := len(buf.tmp)\n\tfor {\n\t\tj--\n\t\tbuf.tmp[j] = digits[d%10]\n\t\td /= 10\n\t\tif d == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn copy(buf.tmp[i:], buf.tmp[j:])\n}\n\nfunc (l *loggingT) println(depth int, s severity, args ...interface{}) {\n\tbuf, file, line := l.header(s, depth)\n\tfmt.Fprintln(buf, args...)\n\tl.output(s, buf, file, line, false)\n}\n\nfunc (l *loggingT) print(s severity, args ...interface{}) {\n\tl.printDepth(s, 1, args...)\n}\n\nfunc (l *loggingT) printDepth(s severity, depth int, args ...interface{}) {\n\tbuf, file, line := l.header(s, depth)\n\tfmt.Fprint(buf, args...)\n\tif buf.Bytes()[buf.Len()-1] != '\\n' {\n\t\tbuf.WriteByte('\\n')\n\t}\n\tl.output(s, buf, file, line, false)\n}\n\nfunc (l *loggingT) printf(depth int, s severity, format string, args ...interface{}) {\n\tbuf, file, line := l.header(s, depth)\n\tfmt.Fprintf(buf, format, args...)\n\tif buf.Bytes()[buf.Len()-1] != '\\n' {\n\t\tbuf.WriteByte('\\n')\n\t}\n\tl.output(s, buf, file, line, false)\n}\n\n// printWithFileLine behaves like print but uses the provided file and line number.  If\n// alsoLogToStderr is true, the glog message always appears on standard error; it\n// will also appear in the glog file unless --logtostderr is set.\nfunc (l *loggingT) printWithFileLine(s severity, file string, line int, alsoToStderr bool, args ...interface{}) {\n\tbuf := l.formatHeader(s, file, line)\n\tfmt.Fprint(buf, args...)\n\tif buf.Bytes()[buf.Len()-1] != '\\n' {\n\t\tbuf.WriteByte('\\n')\n\t}\n\tl.output(s, buf, file, line, alsoToStderr)\n}\n\n// output writes the data to the glog files and releases the buffer.\nfunc (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoToStderr bool) {\n\tl.mu.Lock()\n\tif l.traceLocation.isSet() {\n\t\tif l.traceLocation.match(file, line) {\n\t\t\tbuf.Write(stacks(false))\n\t\t}\n\t}\n\tdata := buf.Bytes()\n\tif !flag.Parsed() {\n\t\tos.Stderr.Write([]byte(\"ERROR: logging before flag.Parse: \"))\n\t\tos.Stderr.Write(data)\n\t} else if l.toStderr {\n\t\tos.Stderr.Write(data)\n\t} else {\n\t\tif alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() {\n\t\t\tos.Stderr.Write(data)\n\t\t}\n\t\tif l.file[s] == nil {\n\t\t\tif err := l.createFiles(s); err != nil {\n\t\t\t\tos.Stderr.Write(data) // Make sure the message appears somewhere.\n\t\t\t\tl.exit(err)\n\t\t\t}\n\t\t}\n\t\tswitch s {\n\t\tcase fatalLog:\n\t\t\tl.file[fatalLog].Write(data)\n\t\t\tfallthrough\n\t\tcase errorLog:\n\t\t\tl.file[errorLog].Write(data)\n\t\t\tfallthrough\n\t\tcase warningLog:\n\t\t\tl.file[warningLog].Write(data)\n\t\t\tfallthrough\n\t\tcase infoLog:\n\t\t\tl.file[infoLog].Write(data)\n\t\t}\n\t}\n\tif s == fatalLog {\n\t\t// If we got here via Exit rather than Fatal, print no stacks.\n\t\tif atomic.LoadUint32(&fatalNoStacks) > 0 {\n\t\t\tl.mu.Unlock()\n\t\t\ttimeoutFlush(10 * time.Second)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// Dump all goroutine stacks before exiting.\n\t\t// First, make sure we see the trace for the current goroutine on standard error.\n\t\t// If -logtostderr has been specified, the loop below will do that anyway\n\t\t// as the first stack in the full dump.\n\t\tif !l.toStderr {\n\t\t\tos.Stderr.Write(stacks(false))\n\t\t}\n\t\t// Write the stack trace for all goroutines to the files.\n\t\ttrace := stacks(true)\n\t\tlogExitFunc = func(error) {} // If we get a write error, we'll still exit below.\n\t\tfor log := fatalLog; log >= infoLog; log-- {\n\t\t\tif f := l.file[log]; f != nil { // Can be nil if -logtostderr is set.\n\t\t\t\tf.Write(trace)\n\t\t\t}\n\t\t}\n\t\tl.mu.Unlock()\n\t\ttimeoutFlush(10 * time.Second)\n\t\tos.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway.\n\t}\n\tl.putBuffer(buf)\n\tl.mu.Unlock()\n\tif stats := severityStats[s]; stats != nil {\n\t\tatomic.AddInt64(&stats.lines, 1)\n\t\tatomic.AddInt64(&stats.bytes, int64(len(data)))\n\t}\n}\n\n// timeoutFlush calls Flush and returns when it completes or after timeout\n// elapses, whichever happens first.  This is needed because the hooks invoked\n// by Flush may deadlock when glog.Fatal is called from a hook that holds\n// a lock.\nfunc timeoutFlush(timeout time.Duration) {\n\tdone := make(chan bool, 1)\n\tgo func() {\n\t\tFlush() // calls logging.lockAndFlushAll()\n\t\tdone <- true\n\t}()\n\tselect {\n\tcase <-done:\n\tcase <-time.After(timeout):\n\t\tfmt.Fprintln(os.Stderr, \"glog: Flush took longer than\", timeout)\n\t}\n}\n\n// stacks is a wrapper for runtime.Stack that attempts to recover the data for all goroutines.\nfunc stacks(all bool) []byte {\n\t// We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.\n\tn := 10000\n\tif all {\n\t\tn = 100000\n\t}\n\tvar trace []byte\n\tfor i := 0; i < 5; i++ {\n\t\ttrace = make([]byte, n)\n\t\tnbytes := runtime.Stack(trace, all)\n\t\tif nbytes < len(trace) {\n\t\t\treturn trace[:nbytes]\n\t\t}\n\t\tn *= 2\n\t}\n\treturn trace\n}\n\n// logExitFunc provides a simple mechanism to override the default behavior\n// of exiting on error. Used in testing and to guarantee we reach a required exit\n// for fatal logs. Instead, exit could be a function rather than a method but that\n// would make its use clumsier.\nvar logExitFunc func(error)\n\n// exit is called if there is trouble creating or writing glog files.\n// It flushes the logs and exits the program; there's no point in hanging around.\n// l.mu is held.\nfunc (l *loggingT) exit(err error) {\n\tfmt.Fprintf(os.Stderr, \"glog: exiting because of error: %s\\n\", err)\n\t// If logExitFunc is set, we do that instead of exiting.\n\tif logExitFunc != nil {\n\t\tlogExitFunc(err)\n\t\treturn\n\t}\n\tl.flushAll()\n\tos.Exit(2)\n}\n\n// syncBuffer joins a bufio.Writer to its underlying file, providing access to the\n// file's Sync method and providing a wrapper for the Write method that provides glog\n// file rotation. There are conflicting methods, so the file cannot be embedded.\n// l.mu is held for all its methods.\ntype syncBuffer struct {\n\tlogger *loggingT\n\t*bufio.Writer\n\tfile   *os.File\n\tsev    severity\n\tnbytes uint64 // The number of bytes written to this file\n}\n\nfunc (sb *syncBuffer) Sync() error {\n\treturn sb.file.Sync()\n}\n\nfunc (sb *syncBuffer) Write(p []byte) (n int, err error) {\n\tif sb.nbytes+uint64(len(p)) >= MaxSize {\n\t\tif err := sb.rotateFile(time.Now()); err != nil {\n\t\t\tsb.logger.exit(err)\n\t\t}\n\t}\n\tn, err = sb.Writer.Write(p)\n\tsb.nbytes += uint64(n)\n\tif err != nil {\n\t\tsb.logger.exit(err)\n\t}\n\treturn\n}\n\n// rotateFile closes the syncBuffer's file and starts a new one.\nfunc (sb *syncBuffer) rotateFile(now time.Time) error {\n\tif sb.file != nil {\n\t\tsb.Flush()\n\t\tsb.file.Close()\n\t}\n\tvar err error\n\tsb.file, _, err = create(severityName[sb.sev], now)\n\tsb.nbytes = 0\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsb.Writer = bufio.NewWriterSize(sb.file, bufferSize)\n\n\t// Write header.\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, \"Log file created at: %s\\n\", now.Format(\"2006/01/02 15:04:05\"))\n\tfmt.Fprintf(&buf, \"Running on machine: %s\\n\", host)\n\tfmt.Fprintf(&buf, \"Binary: Built with %s %s for %s/%s\\n\", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH)\n\tfmt.Fprintf(&buf, \"Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\\n\")\n\tn, err := sb.file.Write(buf.Bytes())\n\tsb.nbytes += uint64(n)\n\treturn err\n}\n\n// bufferSize sizes the buffer associated with each glog file. It's large\n// so that glog records can accumulate without the logging thread blocking\n// on disk I/O. The flushDaemon will block instead.\nconst bufferSize = 256 * 1024\n\n// createFiles creates all the glog files for severity from sev down to infoLog.\n// l.mu is held.\nfunc (l *loggingT) createFiles(sev severity) error {\n\tnow := time.Now()\n\t// Files are created in decreasing severity order, so as soon as we find one\n\t// has already been created, we can stop.\n\tfor s := sev; s >= infoLog && l.file[s] == nil; s-- {\n\t\tsb := &syncBuffer{\n\t\t\tlogger: l,\n\t\t\tsev:    s,\n\t\t}\n\t\tif err := sb.rotateFile(now); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tl.file[s] = sb\n\t}\n\treturn nil\n}\n\nconst flushInterval = 30 * time.Second\n\n// flushDaemon periodically flushes the glog file buffers.\nfunc (l *loggingT) flushDaemon() {\n\tfor _ = range time.NewTicker(flushInterval).C {\n\t\tl.lockAndFlushAll()\n\t}\n}\n\n// lockAndFlushAll is like flushAll but locks l.mu first.\nfunc (l *loggingT) lockAndFlushAll() {\n\tl.mu.Lock()\n\tl.flushAll()\n\tl.mu.Unlock()\n}\n\n// flushAll flushes all the logs and attempts to \"sync\" their data to disk.\n// l.mu is held.\nfunc (l *loggingT) flushAll() {\n\t// Flush from fatal down, in case there's trouble flushing.\n\tfor s := fatalLog; s >= infoLog; s-- {\n\t\tfile := l.file[s]\n\t\tif file != nil {\n\t\t\tfile.Flush() // ignore error\n\t\t\tfile.Sync()  // ignore error\n\t\t}\n\t}\n}\n\n// CopyStandardLogTo arranges for messages written to the Go \"glog\" package's\n// default logs to also appear in the Google logs for the named and lower\n// severities.  Subsequent changes to the standard glog's default output location\n// or format may break this behavior.\n//\n// Valid names are \"INFO\", \"WARNING\", \"ERROR\", and \"FATAL\".  If the name is not\n// recognized, CopyStandardLogTo panics.\nfunc CopyStandardLogTo(name string) {\n\tsev, ok := severityByName(name)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"glog.CopyStandardLogTo(%q): unrecognized severity name\", name))\n\t}\n\t// Set a glog format that captures the user's file and line:\n\t//   d.go:23: message\n\tstdLog.SetFlags(stdLog.Lshortfile)\n\tstdLog.SetOutput(logBridge(sev))\n}\n\n// logBridge provides the Write method that enables CopyStandardLogTo to connect\n// Go's standard logs to the logs provided by this package.\ntype logBridge severity\n\n// Write parses the standard logging line and passes its components to the\n// logger for severity(lb).\nfunc (lb logBridge) Write(b []byte) (n int, err error) {\n\tvar (\n\t\tfile = \"???\"\n\t\tline = 1\n\t\ttext string\n\t)\n\t// Split \"d.go:23: message\" into \"d.go\", \"23\", and \"message\".\n\tif parts := bytes.SplitN(b, []byte{':'}, 3); len(parts) != 3 || len(parts[0]) < 1 || len(parts[2]) < 1 {\n\t\ttext = fmt.Sprintf(\"bad glog format: %s\", b)\n\t} else {\n\t\tfile = string(parts[0])\n\t\ttext = string(parts[2][1:]) // skip leading space\n\t\tline, err = strconv.Atoi(string(parts[1]))\n\t\tif err != nil {\n\t\t\ttext = fmt.Sprintf(\"bad line number: %s\", b)\n\t\t\tline = 1\n\t\t}\n\t}\n\t// printWithFileLine with alsoToStderr=true, so standard glog messages\n\t// always appear on standard error.\n\tlogging.printWithFileLine(severity(lb), file, line, true, text)\n\treturn len(b), nil\n}\n\n// setV computes and remembers the V level for a given PC\n// when vmodule is enabled.\n// File pattern matching takes the basename of the file, stripped\n// of its .go suffix, and uses filepath.Match, which is a little more\n// general than the *? matching used in C++.\n// l.mu is held.\nfunc (l *loggingT) setV(pc uintptr) Level {\n\tfn := runtime.FuncForPC(pc)\n\tfile, _ := fn.FileLine(pc)\n\t// The file is something like /a/b/c/d.go. We want just the d.\n\tif strings.HasSuffix(file, \".go\") {\n\t\tfile = file[:len(file)-3]\n\t}\n\tif slash := strings.LastIndex(file, \"/\"); slash >= 0 {\n\t\tfile = file[slash+1:]\n\t}\n\tfor _, filter := range l.vmodule.filter {\n\t\tif filter.match(file) {\n\t\t\tl.vmap[pc] = filter.level\n\t\t\treturn filter.level\n\t\t}\n\t}\n\tl.vmap[pc] = 0\n\treturn 0\n}\n\n// Verbose is a boolean type that implements Infof (like Printf) etc.\n// See the documentation of V for more information.\ntype Verbose bool\n\n// V reports whether verbosity at the call site is at least the requested level.\n// The returned value is a boolean of type Verbose, which implements Info, Infoln\n// and Infof. These methods will write to the Info glog if called.\n// Thus, one may write either\n//\tif glog.V(2) { glog.Info(\"glog this\") }\n// or\n//\tglog.V(2).Info(\"glog this\")\n// The second form is shorter but the first is cheaper if logging is off because it does\n// not evaluate its arguments.\n//\n// Whether an individual call to V generates a glog record depends on the setting of\n// the -v and --vmodule flags; both are off by default. If the level in the call to\n// V is at least the value of -v, or of -vmodule for the source file containing the\n// call, the V call will glog.\nfunc V(level Level) Verbose {\n\t// This function tries hard to be cheap unless there's work to do.\n\t// The fast path is two atomic loads and compares.\n\n\t// Here is a cheap but safe test to see if V logging is enabled globally.\n\tif logging.verbosity.get() >= level {\n\t\treturn Verbose(true)\n\t}\n\n\t// It's off globally but it vmodule may still be set.\n\t// Here is another cheap but safe test to see if vmodule is enabled.\n\tif atomic.LoadInt32(&logging.filterLength) > 0 {\n\t\t// Now we need a proper lock to use the logging structure. The pcs field\n\t\t// is shared so we must lock before accessing it. This is fairly expensive,\n\t\t// but if V logging is enabled we're slow anyway.\n\t\tlogging.mu.Lock()\n\t\tdefer logging.mu.Unlock()\n\t\tif runtime.Callers(2, logging.pcs[:]) == 0 {\n\t\t\treturn Verbose(false)\n\t\t}\n\t\tv, ok := logging.vmap[logging.pcs[0]]\n\t\tif !ok {\n\t\t\tv = logging.setV(logging.pcs[0])\n\t\t}\n\t\treturn Verbose(v >= level)\n\t}\n\treturn Verbose(false)\n}\n\n// Info is equivalent to the global Info function, guarded by the value of v.\n// See the documentation of V for usage.\nfunc (v Verbose) Info(args ...interface{}) {\n\tif v {\n\t\tlogging.print(infoLog, args...)\n\t}\n}\n\n// Infoln is equivalent to the global Infoln function, guarded by the value of v.\n// See the documentation of V for usage.\nfunc (v Verbose) Infoln(args ...interface{}) {\n\tif v {\n\t\tlogging.println(0, infoLog, args...)\n\t}\n}\n\n// Infof is equivalent to the global Infof function, guarded by the value of v.\n// See the documentation of V for usage.\nfunc (v Verbose) Infof(format string, args ...interface{}) {\n\tif v {\n\t\tlogging.printf(0, infoLog, format, args...)\n\t}\n}\n\n// Info logs to the INFO glog.\n// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.\nfunc Info(args ...interface{}) {\n\tlogging.print(infoLog, args...)\n}\n\n// InfoDepth acts as Info but uses depth to determine which call frame to glog.\n// InfoDepth(0, \"msg\") is the same as Info(\"msg\").\nfunc InfoDepth(depth int, args ...interface{}) {\n\tlogging.printDepth(infoLog, depth, args...)\n}\nfunc InfofDepth(depth int, format string, args ...interface{}) {\n\tlogging.printf(depth, infoLog, format, args...)\n}\n\n// Infoln logs to the INFO glog.\n// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.\nfunc Infoln(args ...interface{}) {\n\tlogging.println(0, infoLog, args...)\n}\n\n// Infof logs to the INFO glog.\n// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.\nfunc Infof(format string, args ...interface{}) {\n\tlogging.printf(0, infoLog, format, args...)\n}\n\n// Warning logs to the WARNING and INFO logs.\n// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.\nfunc Warning(args ...interface{}) {\n\tlogging.print(warningLog, args...)\n}\n\n// WarningDepth acts as Warning but uses depth to determine which call frame to glog.\n// WarningDepth(0, \"msg\") is the same as Warning(\"msg\").\nfunc WarningDepth(depth int, args ...interface{}) {\n\tlogging.printDepth(warningLog, depth, args...)\n}\n\n// Warningln logs to the WARNING and INFO logs.\n// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.\nfunc Warningln(args ...interface{}) {\n\tlogging.println(0, warningLog, args...)\n}\n\n// Warningf logs to the WARNING and INFO logs.\n// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.\nfunc Warningf(format string, args ...interface{}) {\n\tlogging.printf(0, warningLog, format, args...)\n}\n\n// Error logs to the ERROR, WARNING, and INFO logs.\n// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.\nfunc Error(args ...interface{}) {\n\tlogging.print(errorLog, args...)\n}\n\n// ErrorDepth acts as Error but uses depth to determine which call frame to glog.\n// ErrorDepth(0, \"msg\") is the same as Error(\"msg\").\nfunc ErrorDepth(depth int, args ...interface{}) {\n\tlogging.printDepth(errorLog, depth, args...)\n}\n\nfunc ErrorfDepth(depth int, format string, args ...interface{}) {\n\tlogging.printf(depth, errorLog, format, args...)\n}\n\n// Errorln logs to the ERROR, WARNING, and INFO logs.\n// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.\nfunc Errorln(args ...interface{}) {\n\tlogging.println(0, errorLog, args...)\n}\n\n// Errorf logs to the ERROR, WARNING, and INFO logs.\n// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.\nfunc Errorf(format string, args ...interface{}) {\n\tlogging.printf(0, errorLog, format, args...)\n}\n\n// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,\n// including a stack trace of all running goroutines, then calls os.Exit(255).\n// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.\nfunc Fatal(args ...interface{}) {\n\tlogging.print(fatalLog, args...)\n}\n\n// FatalDepth acts as Fatal but uses depth to determine which call frame to glog.\n// FatalDepth(0, \"msg\") is the same as Fatal(\"msg\").\nfunc FatalDepth(depth int, args ...interface{}) {\n\tlogging.printDepth(fatalLog, depth, args...)\n}\n\n// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs,\n// including a stack trace of all running goroutines, then calls os.Exit(255).\n// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.\nfunc Fatalln(args ...interface{}) {\n\tlogging.println(0, fatalLog, args...)\n}\n\n// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs,\n// including a stack trace of all running goroutines, then calls os.Exit(255).\n// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.\nfunc Fatalf(format string, args ...interface{}) {\n\tlogging.printf(0, fatalLog, format, args...)\n}\n\n// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks.\n// It allows Exit and relatives to use the Fatal logs.\nvar fatalNoStacks uint32\n\n// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).\n// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.\nfunc Exit(args ...interface{}) {\n\tatomic.StoreUint32(&fatalNoStacks, 1)\n\tlogging.print(fatalLog, args...)\n}\n\n// ExitDepth acts as Exit but uses depth to determine which call frame to glog.\n// ExitDepth(0, \"msg\") is the same as Exit(\"msg\").\nfunc ExitDepth(depth int, args ...interface{}) {\n\tatomic.StoreUint32(&fatalNoStacks, 1)\n\tlogging.printDepth(fatalLog, depth, args...)\n}\n\n// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).\nfunc Exitln(args ...interface{}) {\n\tatomic.StoreUint32(&fatalNoStacks, 1)\n\tlogging.println(0, fatalLog, args...)\n}\n\n// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).\n// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.\nfunc Exitf(format string, args ...interface{}) {\n\tatomic.StoreUint32(&fatalNoStacks, 1)\n\tlogging.printf(0, fatalLog, format, args...)\n}\n"
  },
  {
    "path": "src/github.com/golang/glog/glog_file.go",
    "content": "// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/\n//\n// Copyright 2013 Google Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// File I/O for logs.\n\npackage glog\n\nimport (\n\t\"errors\"\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"os/user\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n)\n\n// MaxSize is the maximum size of a glog file in bytes.\nvar MaxSize uint64 = 1024 * 1024 * 1800\n\n// logDirs lists the candidate directories for new glog files.\nvar logDirs []string\n\n// If non-empty, overrides the choice of directory in which to write logs.\n// See createLogDirs for the full list of possible destinations.\nvar logDir = flag.String(\"log_dir\", \"\", \"If non-empty, write glog files in this directory\")\n\nfunc createLogDirs() {\n\tif *logDir != \"\" {\n\t\tlogDirs = append(logDirs, *logDir)\n\t}\n\tlogDirs = append(logDirs, os.TempDir())\n}\n\nvar (\n\tpid      = os.Getpid()\n\tprogram  = filepath.Base(os.Args[0])\n\thost     = \"unknownhost\"\n\tuserName = \"unknownuser\"\n)\n\nfunc init() {\n\th, err := os.Hostname()\n\tif err == nil {\n\t\thost = shortHostname(h)\n\t}\n\n\tcurrent, err := user.Current()\n\tif err == nil {\n\t\tuserName = current.Username\n\t}\n\n\t// Sanitize userName since it may contain filepath separators on Windows.\n\tuserName = strings.Replace(userName, `\\`, \"_\", -1)\n}\n\n// shortHostname returns its argument, truncating at the first period.\n// For instance, given \"www.google.com\" it returns \"www\".\nfunc shortHostname(hostname string) string {\n\tif i := strings.Index(hostname, \".\"); i >= 0 {\n\t\treturn hostname[:i]\n\t}\n\treturn hostname\n}\n\n// logName returns a new glog file name containing tag, with start time t, and\n// the name for the symlink for tag.\nfunc logName(tag string, t time.Time) (name, link string) {\n\tname = fmt.Sprintf(\"%s.%s.%s.glog.%s.%04d%02d%02d-%02d%02d%02d.%d\",\n\t\tprogram,\n\t\thost,\n\t\tuserName,\n\t\ttag,\n\t\tt.Year(),\n\t\tt.Month(),\n\t\tt.Day(),\n\t\tt.Hour(),\n\t\tt.Minute(),\n\t\tt.Second(),\n\t\tpid)\n\treturn name, program + \".\" + tag\n}\n\nvar onceLogDirs sync.Once\n\n// create creates a new glog file and returns the file and its filename, which\n// contains tag (\"INFO\", \"FATAL\", etc.) and t.  If the file is created\n// successfully, create also attempts to update the symlink for that tag, ignoring\n// errors.\nfunc create(tag string, t time.Time) (f *os.File, filename string, err error) {\n\tonceLogDirs.Do(createLogDirs)\n\tif len(logDirs) == 0 {\n\t\treturn nil, \"\", errors.New(\"glog: no glog dirs\")\n\t}\n\tname, link := logName(tag, t)\n\tvar lastErr error\n\tfor _, dir := range logDirs {\n\t\tfname := filepath.Join(dir, name)\n\t\tf, err := os.Create(fname)\n\t\tif err == nil {\n\t\t\tsymlink := filepath.Join(dir, link)\n\t\t\tos.Remove(symlink)        // ignore err\n\t\t\tos.Symlink(name, symlink) // ignore err\n\t\t\treturn f, fname, nil\n\t\t}\n\t\tlastErr = err\n\t}\n\treturn nil, \"\", fmt.Errorf(\"glog: cannot create glog: %v\", lastErr)\n}\n"
  },
  {
    "path": "src/github.com/golang/glog/glog_test.go",
    "content": "// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/\n//\n// Copyright 2013 Google Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage glog\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\tstdLog \"log\"\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n)\n\n// Test that shortHostname works as advertised.\nfunc TestShortHostname(t *testing.T) {\n\tfor hostname, expect := range map[string]string{\n\t\t\"\":                \"\",\n\t\t\"host\":            \"host\",\n\t\t\"host.google.com\": \"host\",\n\t} {\n\t\tif got := shortHostname(hostname); expect != got {\n\t\t\tt.Errorf(\"shortHostname(%q): expected %q, got %q\", hostname, expect, got)\n\t\t}\n\t}\n}\n\n// flushBuffer wraps a bytes.Buffer to satisfy flushSyncWriter.\ntype flushBuffer struct {\n\tbytes.Buffer\n}\n\nfunc (f *flushBuffer) Flush() error {\n\treturn nil\n}\n\nfunc (f *flushBuffer) Sync() error {\n\treturn nil\n}\n\n// swap sets the glog writers and returns the old array.\nfunc (l *loggingT) swap(writers [numSeverity]flushSyncWriter) (old [numSeverity]flushSyncWriter) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\told = l.file\n\tfor i, w := range writers {\n\t\tlogging.file[i] = w\n\t}\n\treturn\n}\n\n// newBuffers sets the glog writers to all new byte buffers and returns the old array.\nfunc (l *loggingT) newBuffers() [numSeverity]flushSyncWriter {\n\treturn l.swap([numSeverity]flushSyncWriter{new(flushBuffer), new(flushBuffer), new(flushBuffer), new(flushBuffer)})\n}\n\n// contents returns the specified glog value as a string.\nfunc contents(s severity) string {\n\treturn logging.file[s].(*flushBuffer).String()\n}\n\n// contains reports whether the string is contained in the glog.\nfunc contains(s severity, str string, t *testing.T) bool {\n\treturn strings.Contains(contents(s), str)\n}\n\n// setFlags configures the logging flags how the test expects them.\nfunc setFlags() {\n\tlogging.toStderr = false\n}\n\n// Test that Info works as advertised.\nfunc TestInfo(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tInfo(\"test\")\n\tif !contains(infoLog, \"I\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", contents(infoLog))\n\t}\n\tif !contains(infoLog, \"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\nfunc TestInfoDepth(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\n\tf := func() { InfoDepth(1, \"depth-test1\") }\n\n\t// The next three lines must stay together\n\t_, _, wantLine, _ := runtime.Caller(0)\n\tInfoDepth(0, \"depth-test0\")\n\tf()\n\n\tmsgs := strings.Split(strings.TrimSuffix(contents(infoLog), \"\\n\"), \"\\n\")\n\tif len(msgs) != 2 {\n\t\tt.Fatalf(\"Got %d lines, expected 2\", len(msgs))\n\t}\n\n\tfor i, m := range msgs {\n\t\tif !strings.HasPrefix(m, \"I\") {\n\t\t\tt.Errorf(\"InfoDepth[%d] has wrong character: %q\", i, m)\n\t\t}\n\t\tw := fmt.Sprintf(\"depth-test%d\", i)\n\t\tif !strings.Contains(m, w) {\n\t\t\tt.Errorf(\"InfoDepth[%d] missing %q: %q\", i, w, m)\n\t\t}\n\n\t\t// pull out the line number (between : and ])\n\t\tmsg := m[strings.LastIndex(m, \":\")+1:]\n\t\tx := strings.Index(msg, \"]\")\n\t\tif x < 0 {\n\t\t\tt.Errorf(\"InfoDepth[%d]: missing ']': %q\", i, m)\n\t\t\tcontinue\n\t\t}\n\t\tline, err := strconv.Atoi(msg[:x])\n\t\tif err != nil {\n\t\t\tt.Errorf(\"InfoDepth[%d]: bad line number: %q\", i, m)\n\t\t\tcontinue\n\t\t}\n\t\twantLine++\n\t\tif wantLine != line {\n\t\t\tt.Errorf(\"InfoDepth[%d]: got line %d, want %d\", i, line, wantLine)\n\t\t}\n\t}\n}\n\nfunc init() {\n\tCopyStandardLogTo(\"INFO\")\n}\n\n// Test that CopyStandardLogTo panics on bad input.\nfunc TestCopyStandardLogToPanic(t *testing.T) {\n\tdefer func() {\n\t\tif s, ok := recover().(string); !ok || !strings.Contains(s, \"LOG\") {\n\t\t\tt.Errorf(`CopyStandardLogTo(\"LOG\") should have panicked: %v`, s)\n\t\t}\n\t}()\n\tCopyStandardLogTo(\"LOG\")\n}\n\n// Test that using the standard glog package logs to INFO.\nfunc TestStandardLog(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tstdLog.Print(\"test\")\n\tif !contains(infoLog, \"I\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", contents(infoLog))\n\t}\n\tif !contains(infoLog, \"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\n// Test that the header has the correct format.\nfunc TestHeader(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tdefer func(previous func() time.Time) { timeNow = previous }(timeNow)\n\ttimeNow = func() time.Time {\n\t\treturn time.Date(2006, 1, 2, 15, 4, 5, .067890e9, time.Local)\n\t}\n\tpid = 1234\n\tInfo(\"test\")\n\tvar line int\n\tformat := \"I0102 15:04:05.067890    1234 glog_test.go:%d] test\\n\"\n\tn, err := fmt.Sscanf(contents(infoLog), format, &line)\n\tif n != 1 || err != nil {\n\t\tt.Errorf(\"glog format error: %d elements, error %s:\\n%s\", n, err, contents(infoLog))\n\t}\n\t// Scanf treats multiple spaces as equivalent to a single space,\n\t// so check for correct space-padding also.\n\twant := fmt.Sprintf(format, line)\n\tif contents(infoLog) != want {\n\t\tt.Errorf(\"glog format error: got:\\n\\t%q\\nwant:\\t%q\", contents(infoLog), want)\n\t}\n}\n\n// Test that an Error glog goes to Warning and Info.\n// Even in the Info glog, the source character will be E, so the data should\n// all be identical.\nfunc TestError(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tError(\"test\")\n\tif !contains(errorLog, \"E\", t) {\n\t\tt.Errorf(\"Error has wrong character: %q\", contents(errorLog))\n\t}\n\tif !contains(errorLog, \"test\", t) {\n\t\tt.Error(\"Error failed\")\n\t}\n\tstr := contents(errorLog)\n\tif !contains(warningLog, str, t) {\n\t\tt.Error(\"Warning failed\")\n\t}\n\tif !contains(infoLog, str, t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\n// Test that a Warning glog goes to Info.\n// Even in the Info glog, the source character will be W, so the data should\n// all be identical.\nfunc TestWarning(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tWarning(\"test\")\n\tif !contains(warningLog, \"W\", t) {\n\t\tt.Errorf(\"Warning has wrong character: %q\", contents(warningLog))\n\t}\n\tif !contains(warningLog, \"test\", t) {\n\t\tt.Error(\"Warning failed\")\n\t}\n\tstr := contents(warningLog)\n\tif !contains(infoLog, str, t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\n// Test that a V glog goes to Info.\nfunc TestV(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tlogging.verbosity.Set(\"2\")\n\tdefer logging.verbosity.Set(\"0\")\n\tV(2).Info(\"test\")\n\tif !contains(infoLog, \"I\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", contents(infoLog))\n\t}\n\tif !contains(infoLog, \"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\n// Test that a vmodule enables a glog in this file.\nfunc TestVmoduleOn(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tlogging.vmodule.Set(\"glog_test=2\")\n\tdefer logging.vmodule.Set(\"\")\n\tif !V(1) {\n\t\tt.Error(\"V not enabled for 1\")\n\t}\n\tif !V(2) {\n\t\tt.Error(\"V not enabled for 2\")\n\t}\n\tif V(3) {\n\t\tt.Error(\"V enabled for 3\")\n\t}\n\tV(2).Info(\"test\")\n\tif !contains(infoLog, \"I\", t) {\n\t\tt.Errorf(\"Info has wrong character: %q\", contents(infoLog))\n\t}\n\tif !contains(infoLog, \"test\", t) {\n\t\tt.Error(\"Info failed\")\n\t}\n}\n\n// Test that a vmodule of another file does not enable a glog in this file.\nfunc TestVmoduleOff(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tlogging.vmodule.Set(\"notthisfile=2\")\n\tdefer logging.vmodule.Set(\"\")\n\tfor i := 1; i <= 3; i++ {\n\t\tif V(Level(i)) {\n\t\t\tt.Errorf(\"V enabled for %d\", i)\n\t\t}\n\t}\n\tV(2).Info(\"test\")\n\tif contents(infoLog) != \"\" {\n\t\tt.Error(\"V logged incorrectly\")\n\t}\n}\n\n// vGlobs are patterns that match/don't match this file at V=2.\nvar vGlobs = map[string]bool{\n\t// Easy to test the numeric match here.\n\t\"glog_test=1\": false, // If -vmodule sets V to 1, V(2) will fail.\n\t\"glog_test=2\": true,\n\t\"glog_test=3\": true, // If -vmodule sets V to 1, V(3) will succeed.\n\t// These all use 2 and check the patterns. All are true.\n\t\"*=2\":           true,\n\t\"?l*=2\":         true,\n\t\"????_*=2\":      true,\n\t\"??[mno]?_*t=2\": true,\n\t// These all use 2 and check the patterns. All are false.\n\t\"*x=2\":         false,\n\t\"m*=2\":         false,\n\t\"??_*=2\":       false,\n\t\"?[abc]?_*t=2\": false,\n}\n\n// Test that vmodule globbing works as advertised.\nfunc testVmoduleGlob(pat string, match bool, t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\tdefer logging.vmodule.Set(\"\")\n\tlogging.vmodule.Set(pat)\n\tif V(2) != Verbose(match) {\n\t\tt.Errorf(\"incorrect match for %q: got %t expected %t\", pat, V(2), match)\n\t}\n}\n\n// Test that a vmodule globbing works as advertised.\nfunc TestVmoduleGlob(t *testing.T) {\n\tfor glob, match := range vGlobs {\n\t\ttestVmoduleGlob(glob, match, t)\n\t}\n}\n\nfunc TestRollover(t *testing.T) {\n\tsetFlags()\n\tvar err error\n\tdefer func(previous func(error)) { logExitFunc = previous }(logExitFunc)\n\tlogExitFunc = func(e error) {\n\t\terr = e\n\t}\n\tdefer func(previous uint64) { MaxSize = previous }(MaxSize)\n\tMaxSize = 512\n\n\tInfo(\"x\") // Be sure we have a file.\n\tinfo, ok := logging.file[infoLog].(*syncBuffer)\n\tif !ok {\n\t\tt.Fatal(\"info wasn't created\")\n\t}\n\tif err != nil {\n\t\tt.Fatalf(\"info has initial error: %v\", err)\n\t}\n\tfname0 := info.file.Name()\n\tInfo(strings.Repeat(\"x\", int(MaxSize))) // force a rollover\n\tif err != nil {\n\t\tt.Fatalf(\"info has error after big write: %v\", err)\n\t}\n\n\t// Make sure the next glog file gets a file name with a different\n\t// time stamp.\n\t//\n\t// TODO: determine whether we need to support subsecond glog\n\t// rotation.  C++ does not appear to handle this case (nor does it\n\t// handle Daylight Savings Time properly).\n\ttime.Sleep(1 * time.Second)\n\n\tInfo(\"x\") // create a new file\n\tif err != nil {\n\t\tt.Fatalf(\"error after rotation: %v\", err)\n\t}\n\tfname1 := info.file.Name()\n\tif fname0 == fname1 {\n\t\tt.Errorf(\"info.f.Name did not change: %v\", fname0)\n\t}\n\tif info.nbytes >= MaxSize {\n\t\tt.Errorf(\"file size was not reset: %d\", info.nbytes)\n\t}\n}\n\nfunc TestLogBacktraceAt(t *testing.T) {\n\tsetFlags()\n\tdefer logging.swap(logging.newBuffers())\n\t// The peculiar style of this code simplifies line counting and maintenance of the\n\t// tracing block below.\n\tvar infoLine string\n\tsetTraceLocation := func(file string, line int, ok bool, delta int) {\n\t\tif !ok {\n\t\t\tt.Fatal(\"could not get file:line\")\n\t\t}\n\t\t_, file = filepath.Split(file)\n\t\tinfoLine = fmt.Sprintf(\"%s:%d\", file, line+delta)\n\t\terr := logging.traceLocation.Set(infoLine)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"error setting log_backtrace_at: \", err)\n\t\t}\n\t}\n\t{\n\t\t// Start of tracing block. These lines know about each other's relative position.\n\t\t_, file, line, ok := runtime.Caller(0)\n\t\tsetTraceLocation(file, line, ok, +2) // Two lines between Caller and Info calls.\n\t\tInfo(\"we want a stack trace here\")\n\t}\n\tnumAppearances := strings.Count(contents(infoLog), infoLine)\n\tif numAppearances < 2 {\n\t\t// Need 2 appearances, one in the glog header and one in the trace:\n\t\t//   log_test.go:281: I0511 16:36:06.952398 02238 log_test.go:280] we want a stack trace here\n\t\t//   ...\n\t\t//   github.com/glog/glog_test.go:280 (0x41ba91)\n\t\t//   ...\n\t\t// We could be more precise but that would require knowing the details\n\t\t// of the traceback format, which may not be dependable.\n\t\tt.Fatal(\"got no trace back; glog is \", contents(infoLog))\n\t}\n}\n\nfunc BenchmarkHeader(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tbuf, _, _ := logging.header(infoLog, 0)\n\t\tlogging.putBuffer(buf)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/.gitignore",
    "content": ".DS_Store\n*.[568ao]\n*.ao\n*.so\n*.pyc\n._*\n.nfs.*\n[568a].out\n*~\n*.orig\ncore\n_obj\n_test\n_testmain.go\nprotoc-gen-go/testdata/multi/*.pb.go\n_conformance/_conformance\n"
  },
  {
    "path": "src/github.com/golang/protobuf/.travis.yml",
    "content": "sudo: false\nlanguage: go\ngo:\n- 1.6.x\n- 1.7.x\n- 1.8.x\n- 1.9.x\n\ninstall:\n  - go get -v -d -t github.com/golang/protobuf/...\n  - curl -L https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip -o /tmp/protoc.zip\n  - unzip /tmp/protoc.zip -d $HOME/protoc\n\nenv:\n  - PATH=$HOME/protoc/bin:$PATH\n\nscript:\n  - make all test\n"
  },
  {
    "path": "src/github.com/golang/protobuf/AUTHORS",
    "content": "# This source code refers to The Go Authors for copyright purposes.\n# The master list of authors is in the main Go distribution,\n# visible at http://tip.golang.org/AUTHORS.\n"
  },
  {
    "path": "src/github.com/golang/protobuf/CONTRIBUTORS",
    "content": "# This source code was written by the Go contributors.\n# The master list of contributors is in the main Go distribution,\n# visible at http://tip.golang.org/CONTRIBUTORS.\n"
  },
  {
    "path": "src/github.com/golang/protobuf/LICENSE",
    "content": "Go support for Protocol Buffers - Google's data interchange format\n\nCopyright 2010 The Go Authors.  All rights reserved.\nhttps://github.com/golang/protobuf\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n    * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/Make.protobuf",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Includable Makefile to add a rule for generating .pb.go files from .proto files\n# (Google protocol buffer descriptions).\n# Typical use if myproto.proto is a file in package mypackage in this directory:\n#\n#\tinclude $(GOROOT)/src/pkg/github.com/golang/protobuf/Make.protobuf\n\n%.pb.go:\t%.proto\n\tprotoc --go_out=. $<\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nall:\tinstall\n\ninstall:\n\tgo install ./proto ./jsonpb ./ptypes\n\tgo install ./protoc-gen-go\n\ntest:\n\tgo test ./proto ./jsonpb ./ptypes\n\tmake -C protoc-gen-go/testdata test\n\nclean:\n\tgo clean ./...\n\nnuke:\n\tgo clean -i ./...\n\nregenerate:\n\tmake -C protoc-gen-go/descriptor regenerate\n\tmake -C protoc-gen-go/plugin regenerate\n\tmake -C protoc-gen-go/testdata regenerate\n\tmake -C proto/testdata regenerate\n\tmake -C jsonpb/jsonpb_test_proto regenerate\n\tmake -C _conformance regenerate\n"
  },
  {
    "path": "src/github.com/golang/protobuf/README.md",
    "content": "# Go support for Protocol Buffers\n\n[![Build Status](https://travis-ci.org/golang/protobuf.svg?branch=master)](https://travis-ci.org/golang/protobuf)\n[![GoDoc](https://godoc.org/github.com/golang/protobuf?status.svg)](https://godoc.org/github.com/golang/protobuf)\n\nGoogle's data interchange format.\nCopyright 2010 The Go Authors.\nhttps://github.com/golang/protobuf\n\nThis package and the code it generates requires at least Go 1.4.\n\nThis software implements Go bindings for protocol buffers.  For\ninformation about protocol buffers themselves, see\n\thttps://developers.google.com/protocol-buffers/\n\n## Installation ##\n\nTo use this software, you must:\n- Install the standard C++ implementation of protocol buffers from\n\thttps://developers.google.com/protocol-buffers/\n- Of course, install the Go compiler and tools from\n\thttps://golang.org/\n  See\n\thttps://golang.org/doc/install\n  for details or, if you are using gccgo, follow the instructions at\n\thttps://golang.org/doc/install/gccgo\n- Grab the code from the repository and install the proto package.\n  The simplest way is to run `go get -u github.com/golang/protobuf/protoc-gen-go`.\n  The compiler plugin, protoc-gen-go, will be installed in $GOBIN,\n  defaulting to $GOPATH/bin.  It must be in your $PATH for the protocol\n  compiler, protoc, to find it.\n\nThis software has two parts: a 'protocol compiler plugin' that\ngenerates Go source files that, once compiled, can access and manage\nprotocol buffers; and a library that implements run-time support for\nencoding (marshaling), decoding (unmarshaling), and accessing protocol\nbuffers.\n\nThere is support for gRPC in Go using protocol buffers.\nSee the note at the bottom of this file for details.\n\nThere are no insertion points in the plugin.\n\n\n## Using protocol buffers with Go ##\n\nOnce the software is installed, there are two steps to using it.\nFirst you must compile the protocol buffer definitions and then import\nthem, with the support library, into your program.\n\nTo compile the protocol buffer definition, run protoc with the --go_out\nparameter set to the directory you want to output the Go code to.\n\n\tprotoc --go_out=. *.proto\n\nThe generated files will be suffixed .pb.go.  See the Test code below\nfor an example using such a file.\n\n\nThe package comment for the proto library contains text describing\nthe interface provided in Go for protocol buffers. Here is an edited\nversion.\n\n==========\n\nThe proto package converts data structures to and from the\nwire format of protocol buffers.  It works in concert with the\nGo source code generated for .proto files by the protocol compiler.\n\nA summary of the properties of the protocol buffer interface\nfor a protocol buffer variable v:\n\n  - Names are turned from camel_case to CamelCase for export.\n  - There are no methods on v to set fields; just treat\n  \tthem as structure fields.\n  - There are getters that return a field's value if set,\n\tand return the field's default value if unset.\n\tThe getters work even if the receiver is a nil message.\n  - The zero value for a struct is its correct initialization state.\n\tAll desired fields must be set before marshaling.\n  - A Reset() method will restore a protobuf struct to its zero state.\n  - Non-repeated fields are pointers to the values; nil means unset.\n\tThat is, optional or required field int32 f becomes F *int32.\n  - Repeated fields are slices.\n  - Helper functions are available to aid the setting of fields.\n\tHelpers for getting values are superseded by the\n\tGetFoo methods and their use is deprecated.\n\t\tmsg.Foo = proto.String(\"hello\") // set field\n  - Constants are defined to hold the default values of all fields that\n\thave them.  They have the form Default_StructName_FieldName.\n\tBecause the getter methods handle defaulted values,\n\tdirect use of these constants should be rare.\n  - Enums are given type names and maps from names to values.\n\tEnum values are prefixed with the enum's type name. Enum types have\n\ta String method, and a Enum method to assist in message construction.\n  - Nested groups and enums have type names prefixed with the name of\n  \tthe surrounding message type.\n  - Extensions are given descriptor names that start with E_,\n\tfollowed by an underscore-delimited list of the nested messages\n\tthat contain it (if any) followed by the CamelCased name of the\n\textension field itself.  HasExtension, ClearExtension, GetExtension\n\tand SetExtension are functions for manipulating extensions.\n  - Oneof field sets are given a single field in their message,\n\twith distinguished wrapper types for each possible field value.\n  - Marshal and Unmarshal are functions to encode and decode the wire format.\n\nWhen the .proto file specifies `syntax=\"proto3\"`, there are some differences:\n\n  - Non-repeated fields of non-message type are values instead of pointers.\n  - Enum types do not get an Enum method.\n\nConsider file test.proto, containing\n\n```proto\n\tsyntax = \"proto2\";\n\tpackage example;\n\t\n\tenum FOO { X = 17; };\n\t\n\tmessage Test {\n\t  required string label = 1;\n\t  optional int32 type = 2 [default=77];\n\t  repeated int64 reps = 3;\n\t  optional group OptionalGroup = 4 {\n\t    required string RequiredField = 5;\n\t  }\n\t}\n```\n\nTo create and play with a Test object from the example package,\n\n```go\n\tpackage main\n\n\timport (\n\t\t\"log\"\n\n\t\t\"github.com/golang/protobuf/proto\"\n\t\t\"path/to/example\"\n\t)\n\n\tfunc main() {\n\t\ttest := &example.Test {\n\t\t\tLabel: proto.String(\"hello\"),\n\t\t\tType:  proto.Int32(17),\n\t\t\tReps:  []int64{1, 2, 3},\n\t\t\tOptionalgroup: &example.Test_OptionalGroup {\n\t\t\t\tRequiredField: proto.String(\"good bye\"),\n\t\t\t},\n\t\t}\n\t\tdata, err := proto.Marshal(test)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"marshaling error: \", err)\n\t\t}\n\t\tnewTest := &example.Test{}\n\t\terr = proto.Unmarshal(data, newTest)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"unmarshaling error: \", err)\n\t\t}\n\t\t// Now test and newTest contain the same data.\n\t\tif test.GetLabel() != newTest.GetLabel() {\n\t\t\tlog.Fatalf(\"data mismatch %q != %q\", test.GetLabel(), newTest.GetLabel())\n\t\t}\n\t\t// etc.\n\t}\n```\n\n## Parameters ##\n\nTo pass extra parameters to the plugin, use a comma-separated\nparameter list separated from the output directory by a colon:\n\n\n\tprotoc --go_out=plugins=grpc,import_path=mypackage:. *.proto\n\n\n- `import_prefix=xxx` - a prefix that is added onto the beginning of\n  all imports. Useful for things like generating protos in a\n  subdirectory, or regenerating vendored protobufs in-place.\n- `import_path=foo/bar` - used as the package if no input files\n  declare `go_package`. If it contains slashes, everything up to the\n  rightmost slash is ignored.\n- `plugins=plugin1+plugin2` - specifies the list of sub-plugins to\n  load. The only plugin in this repo is `grpc`.\n- `Mfoo/bar.proto=quux/shme` - declares that foo/bar.proto is\n  associated with Go package quux/shme.  This is subject to the\n  import_prefix parameter.\n\n## gRPC Support ##\n\nIf a proto file specifies RPC services, protoc-gen-go can be instructed to\ngenerate code compatible with gRPC (http://www.grpc.io/). To do this, pass\nthe `plugins` parameter to protoc-gen-go; the usual way is to insert it into\nthe --go_out argument to protoc:\n\n\tprotoc --go_out=plugins=grpc:. *.proto\n\n## Compatibility ##\n\nThe library and the generated code are expected to be stable over time.\nHowever, we reserve the right to make breaking changes without notice for the\nfollowing reasons:\n\n- Security. A security issue in the specification or implementation may come to\n  light whose resolution requires breaking compatibility. We reserve the right\n  to address such security issues.\n- Unspecified behavior.  There are some aspects of the Protocol Buffers\n  specification that are undefined.  Programs that depend on such unspecified\n  behavior may break in future releases.\n- Specification errors or changes. If it becomes necessary to address an\n  inconsistency, incompleteness, or change in the Protocol Buffers\n  specification, resolving the issue could affect the meaning or legality of\n  existing programs.  We reserve the right to address such issues, including\n  updating the implementations.\n- Bugs.  If the library has a bug that violates the specification, a program\n  that depends on the buggy behavior may break if the bug is fixed.  We reserve\n  the right to fix such bugs.\n- Adding methods or fields to generated structs.  These may conflict with field\n  names that already exist in a schema, causing applications to break.  When the\n  code generator encounters a field in the schema that would collide with a\n  generated field or method name, the code generator will append an underscore\n  to the generated field or method name.\n- Adding, removing, or changing methods or fields in generated structs that\n  start with `XXX`.  These parts of the generated code are exported out of\n  necessity, but should not be considered part of the public API.\n- Adding, removing, or changing unexported symbols in generated code.\n\nAny breaking changes outside of these will be announced 6 months in advance to\nprotobuf@googlegroups.com.\n\nYou should, whenever possible, use generated code created by the `protoc-gen-go`\ntool built at the same commit as the `proto` package.  The `proto` package\ndeclares package-level constants in the form `ProtoPackageIsVersionX`.\nApplication code and generated code may depend on one of these constants to\nensure that compilation will fail if the available version of the proto library\nis too old.  Whenever we make a change to the generated code that requires newer\nlibrary support, in the same commit we will increment the version number of the\ngenerated code and declare a new package-level constant whose name incorporates\nthe latest version number.  Removing a compatibility constant is considered a\nbreaking change and would be subject to the announcement policy stated above.\n\nThe `protoc-gen-go/generator` package exposes a plugin interface,\nwhich is used by the gRPC code generation. This interface is not\nsupported and is subject to incompatible changes without notice.\n"
  },
  {
    "path": "src/github.com/golang/protobuf/_conformance/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2016 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nregenerate:\n\tprotoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers,Mgoogle/protobuf/field_mask.proto=google.golang.org/genproto/protobuf:. conformance_proto/conformance.proto\n"
  },
  {
    "path": "src/github.com/golang/protobuf/_conformance/conformance.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// conformance implements the conformance test subprocess protocol as\n// documented in conformance.proto.\npackage main\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\n\tpb \"github.com/golang/protobuf/_conformance/conformance_proto\"\n\t\"github.com/golang/protobuf/jsonpb\"\n\t\"github.com/golang/protobuf/proto\"\n)\n\nfunc main() {\n\tvar sizeBuf [4]byte\n\tinbuf := make([]byte, 0, 4096)\n\toutbuf := proto.NewBuffer(nil)\n\tfor {\n\t\tif _, err := io.ReadFull(os.Stdin, sizeBuf[:]); err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: read request:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tsize := binary.LittleEndian.Uint32(sizeBuf[:])\n\t\tif int(size) > cap(inbuf) {\n\t\t\tinbuf = make([]byte, size)\n\t\t}\n\t\tinbuf = inbuf[:size]\n\t\tif _, err := io.ReadFull(os.Stdin, inbuf); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: read request:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\treq := new(pb.ConformanceRequest)\n\t\tif err := proto.Unmarshal(inbuf, req); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: parse request:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tres := handle(req)\n\n\t\tif err := outbuf.Marshal(res); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: marshal response:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tbinary.LittleEndian.PutUint32(sizeBuf[:], uint32(len(outbuf.Bytes())))\n\t\tif _, err := os.Stdout.Write(sizeBuf[:]); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: write response:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif _, err := os.Stdout.Write(outbuf.Bytes()); err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"go conformance: write response:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\toutbuf.Reset()\n\t}\n}\n\nvar jsonMarshaler = jsonpb.Marshaler{\n\tOrigName: true,\n}\n\nfunc handle(req *pb.ConformanceRequest) *pb.ConformanceResponse {\n\tvar err error\n\tvar msg pb.TestAllTypes\n\tswitch p := req.Payload.(type) {\n\tcase *pb.ConformanceRequest_ProtobufPayload:\n\t\terr = proto.Unmarshal(p.ProtobufPayload, &msg)\n\tcase *pb.ConformanceRequest_JsonPayload:\n\t\terr = jsonpb.UnmarshalString(p.JsonPayload, &msg)\n\t\tif err != nil && err.Error() == \"unmarshaling Any not supported yet\" {\n\t\t\treturn &pb.ConformanceResponse{\n\t\t\t\tResult: &pb.ConformanceResponse_Skipped{\n\t\t\t\t\tSkipped: err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn &pb.ConformanceResponse{\n\t\t\tResult: &pb.ConformanceResponse_RuntimeError{\n\t\t\t\tRuntimeError: \"unknown request payload type\",\n\t\t\t},\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn &pb.ConformanceResponse{\n\t\t\tResult: &pb.ConformanceResponse_ParseError{\n\t\t\t\tParseError: err.Error(),\n\t\t\t},\n\t\t}\n\t}\n\tswitch req.RequestedOutputFormat {\n\tcase pb.WireFormat_PROTOBUF:\n\t\tp, err := proto.Marshal(&msg)\n\t\tif err != nil {\n\t\t\treturn &pb.ConformanceResponse{\n\t\t\t\tResult: &pb.ConformanceResponse_SerializeError{\n\t\t\t\t\tSerializeError: err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\treturn &pb.ConformanceResponse{\n\t\t\tResult: &pb.ConformanceResponse_ProtobufPayload{\n\t\t\t\tProtobufPayload: p,\n\t\t\t},\n\t\t}\n\tcase pb.WireFormat_JSON:\n\t\tp, err := jsonMarshaler.MarshalToString(&msg)\n\t\tif err != nil {\n\t\t\treturn &pb.ConformanceResponse{\n\t\t\t\tResult: &pb.ConformanceResponse_SerializeError{\n\t\t\t\t\tSerializeError: err.Error(),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\treturn &pb.ConformanceResponse{\n\t\t\tResult: &pb.ConformanceResponse_JsonPayload{\n\t\t\t\tJsonPayload: p,\n\t\t\t},\n\t\t}\n\tdefault:\n\t\treturn &pb.ConformanceResponse{\n\t\t\tResult: &pb.ConformanceResponse_RuntimeError{\n\t\t\t\tRuntimeError: \"unknown output format\",\n\t\t\t},\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/_conformance/conformance_proto/conformance.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: conformance_proto/conformance.proto\n\n/*\nPackage conformance is a generated protocol buffer package.\n\nIt is generated from these files:\n\tconformance_proto/conformance.proto\n\nIt has these top-level messages:\n\tConformanceRequest\n\tConformanceResponse\n\tTestAllTypes\n\tForeignMessage\n*/\npackage conformance\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport google_protobuf \"github.com/golang/protobuf/ptypes/any\"\nimport google_protobuf1 \"github.com/golang/protobuf/ptypes/duration\"\nimport google_protobuf2 \"google.golang.org/genproto/protobuf\"\nimport google_protobuf3 \"github.com/golang/protobuf/ptypes/struct\"\nimport google_protobuf4 \"github.com/golang/protobuf/ptypes/timestamp\"\nimport google_protobuf5 \"github.com/golang/protobuf/ptypes/wrappers\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype WireFormat int32\n\nconst (\n\tWireFormat_UNSPECIFIED WireFormat = 0\n\tWireFormat_PROTOBUF    WireFormat = 1\n\tWireFormat_JSON        WireFormat = 2\n)\n\nvar WireFormat_name = map[int32]string{\n\t0: \"UNSPECIFIED\",\n\t1: \"PROTOBUF\",\n\t2: \"JSON\",\n}\nvar WireFormat_value = map[string]int32{\n\t\"UNSPECIFIED\": 0,\n\t\"PROTOBUF\":    1,\n\t\"JSON\":        2,\n}\n\nfunc (x WireFormat) String() string {\n\treturn proto.EnumName(WireFormat_name, int32(x))\n}\nfunc (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\ntype ForeignEnum int32\n\nconst (\n\tForeignEnum_FOREIGN_FOO ForeignEnum = 0\n\tForeignEnum_FOREIGN_BAR ForeignEnum = 1\n\tForeignEnum_FOREIGN_BAZ ForeignEnum = 2\n)\n\nvar ForeignEnum_name = map[int32]string{\n\t0: \"FOREIGN_FOO\",\n\t1: \"FOREIGN_BAR\",\n\t2: \"FOREIGN_BAZ\",\n}\nvar ForeignEnum_value = map[string]int32{\n\t\"FOREIGN_FOO\": 0,\n\t\"FOREIGN_BAR\": 1,\n\t\"FOREIGN_BAZ\": 2,\n}\n\nfunc (x ForeignEnum) String() string {\n\treturn proto.EnumName(ForeignEnum_name, int32(x))\n}\nfunc (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\ntype TestAllTypes_NestedEnum int32\n\nconst (\n\tTestAllTypes_FOO TestAllTypes_NestedEnum = 0\n\tTestAllTypes_BAR TestAllTypes_NestedEnum = 1\n\tTestAllTypes_BAZ TestAllTypes_NestedEnum = 2\n\tTestAllTypes_NEG TestAllTypes_NestedEnum = -1\n)\n\nvar TestAllTypes_NestedEnum_name = map[int32]string{\n\t0:  \"FOO\",\n\t1:  \"BAR\",\n\t2:  \"BAZ\",\n\t-1: \"NEG\",\n}\nvar TestAllTypes_NestedEnum_value = map[string]int32{\n\t\"FOO\": 0,\n\t\"BAR\": 1,\n\t\"BAZ\": 2,\n\t\"NEG\": -1,\n}\n\nfunc (x TestAllTypes_NestedEnum) String() string {\n\treturn proto.EnumName(TestAllTypes_NestedEnum_name, int32(x))\n}\nfunc (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }\n\n// Represents a single test case's input.  The testee should:\n//\n//   1. parse this proto (which should always succeed)\n//   2. parse the protobuf or JSON payload in \"payload\" (which may fail)\n//   3. if the parse succeeded, serialize the message in the requested format.\ntype ConformanceRequest struct {\n\t// The payload (whether protobuf of JSON) is always for a TestAllTypes proto\n\t// (see below).\n\t//\n\t// Types that are valid to be assigned to Payload:\n\t//\t*ConformanceRequest_ProtobufPayload\n\t//\t*ConformanceRequest_JsonPayload\n\tPayload isConformanceRequest_Payload `protobuf_oneof:\"payload\"`\n\t// Which format should the testee serialize its message to?\n\tRequestedOutputFormat WireFormat `protobuf:\"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,enum=conformance.WireFormat\" json:\"requested_output_format,omitempty\"`\n}\n\nfunc (m *ConformanceRequest) Reset()                    { *m = ConformanceRequest{} }\nfunc (m *ConformanceRequest) String() string            { return proto.CompactTextString(m) }\nfunc (*ConformanceRequest) ProtoMessage()               {}\nfunc (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\ntype isConformanceRequest_Payload interface {\n\tisConformanceRequest_Payload()\n}\n\ntype ConformanceRequest_ProtobufPayload struct {\n\tProtobufPayload []byte `protobuf:\"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof\"`\n}\ntype ConformanceRequest_JsonPayload struct {\n\tJsonPayload string `protobuf:\"bytes,2,opt,name=json_payload,json=jsonPayload,oneof\"`\n}\n\nfunc (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {}\nfunc (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload()     {}\n\nfunc (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload {\n\tif m != nil {\n\t\treturn m.Payload\n\t}\n\treturn nil\n}\n\nfunc (m *ConformanceRequest) GetProtobufPayload() []byte {\n\tif x, ok := m.GetPayload().(*ConformanceRequest_ProtobufPayload); ok {\n\t\treturn x.ProtobufPayload\n\t}\n\treturn nil\n}\n\nfunc (m *ConformanceRequest) GetJsonPayload() string {\n\tif x, ok := m.GetPayload().(*ConformanceRequest_JsonPayload); ok {\n\t\treturn x.JsonPayload\n\t}\n\treturn \"\"\n}\n\nfunc (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat {\n\tif m != nil {\n\t\treturn m.RequestedOutputFormat\n\t}\n\treturn WireFormat_UNSPECIFIED\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*ConformanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ConformanceRequest_OneofMarshaler, _ConformanceRequest_OneofUnmarshaler, _ConformanceRequest_OneofSizer, []interface{}{\n\t\t(*ConformanceRequest_ProtobufPayload)(nil),\n\t\t(*ConformanceRequest_JsonPayload)(nil),\n\t}\n}\n\nfunc _ConformanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*ConformanceRequest)\n\t// payload\n\tswitch x := m.Payload.(type) {\n\tcase *ConformanceRequest_ProtobufPayload:\n\t\tb.EncodeVarint(1<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.ProtobufPayload)\n\tcase *ConformanceRequest_JsonPayload:\n\t\tb.EncodeVarint(2<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.JsonPayload)\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"ConformanceRequest.Payload has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _ConformanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*ConformanceRequest)\n\tswitch tag {\n\tcase 1: // payload.protobuf_payload\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Payload = &ConformanceRequest_ProtobufPayload{x}\n\t\treturn true, err\n\tcase 2: // payload.json_payload\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Payload = &ConformanceRequest_JsonPayload{x}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _ConformanceRequest_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*ConformanceRequest)\n\t// payload\n\tswitch x := m.Payload.(type) {\n\tcase *ConformanceRequest_ProtobufPayload:\n\t\tn += proto.SizeVarint(1<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.ProtobufPayload)))\n\t\tn += len(x.ProtobufPayload)\n\tcase *ConformanceRequest_JsonPayload:\n\t\tn += proto.SizeVarint(2<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.JsonPayload)))\n\t\tn += len(x.JsonPayload)\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\n// Represents a single test case's output.\ntype ConformanceResponse struct {\n\t// Types that are valid to be assigned to Result:\n\t//\t*ConformanceResponse_ParseError\n\t//\t*ConformanceResponse_SerializeError\n\t//\t*ConformanceResponse_RuntimeError\n\t//\t*ConformanceResponse_ProtobufPayload\n\t//\t*ConformanceResponse_JsonPayload\n\t//\t*ConformanceResponse_Skipped\n\tResult isConformanceResponse_Result `protobuf_oneof:\"result\"`\n}\n\nfunc (m *ConformanceResponse) Reset()                    { *m = ConformanceResponse{} }\nfunc (m *ConformanceResponse) String() string            { return proto.CompactTextString(m) }\nfunc (*ConformanceResponse) ProtoMessage()               {}\nfunc (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\ntype isConformanceResponse_Result interface {\n\tisConformanceResponse_Result()\n}\n\ntype ConformanceResponse_ParseError struct {\n\tParseError string `protobuf:\"bytes,1,opt,name=parse_error,json=parseError,oneof\"`\n}\ntype ConformanceResponse_SerializeError struct {\n\tSerializeError string `protobuf:\"bytes,6,opt,name=serialize_error,json=serializeError,oneof\"`\n}\ntype ConformanceResponse_RuntimeError struct {\n\tRuntimeError string `protobuf:\"bytes,2,opt,name=runtime_error,json=runtimeError,oneof\"`\n}\ntype ConformanceResponse_ProtobufPayload struct {\n\tProtobufPayload []byte `protobuf:\"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof\"`\n}\ntype ConformanceResponse_JsonPayload struct {\n\tJsonPayload string `protobuf:\"bytes,4,opt,name=json_payload,json=jsonPayload,oneof\"`\n}\ntype ConformanceResponse_Skipped struct {\n\tSkipped string `protobuf:\"bytes,5,opt,name=skipped,oneof\"`\n}\n\nfunc (*ConformanceResponse_ParseError) isConformanceResponse_Result()      {}\nfunc (*ConformanceResponse_SerializeError) isConformanceResponse_Result()  {}\nfunc (*ConformanceResponse_RuntimeError) isConformanceResponse_Result()    {}\nfunc (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {}\nfunc (*ConformanceResponse_JsonPayload) isConformanceResponse_Result()     {}\nfunc (*ConformanceResponse_Skipped) isConformanceResponse_Result()         {}\n\nfunc (m *ConformanceResponse) GetResult() isConformanceResponse_Result {\n\tif m != nil {\n\t\treturn m.Result\n\t}\n\treturn nil\n}\n\nfunc (m *ConformanceResponse) GetParseError() string {\n\tif x, ok := m.GetResult().(*ConformanceResponse_ParseError); ok {\n\t\treturn x.ParseError\n\t}\n\treturn \"\"\n}\n\nfunc (m *ConformanceResponse) GetSerializeError() string {\n\tif x, ok := m.GetResult().(*ConformanceResponse_SerializeError); ok {\n\t\treturn x.SerializeError\n\t}\n\treturn \"\"\n}\n\nfunc (m *ConformanceResponse) GetRuntimeError() string {\n\tif x, ok := m.GetResult().(*ConformanceResponse_RuntimeError); ok {\n\t\treturn x.RuntimeError\n\t}\n\treturn \"\"\n}\n\nfunc (m *ConformanceResponse) GetProtobufPayload() []byte {\n\tif x, ok := m.GetResult().(*ConformanceResponse_ProtobufPayload); ok {\n\t\treturn x.ProtobufPayload\n\t}\n\treturn nil\n}\n\nfunc (m *ConformanceResponse) GetJsonPayload() string {\n\tif x, ok := m.GetResult().(*ConformanceResponse_JsonPayload); ok {\n\t\treturn x.JsonPayload\n\t}\n\treturn \"\"\n}\n\nfunc (m *ConformanceResponse) GetSkipped() string {\n\tif x, ok := m.GetResult().(*ConformanceResponse_Skipped); ok {\n\t\treturn x.Skipped\n\t}\n\treturn \"\"\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _ConformanceResponse_OneofMarshaler, _ConformanceResponse_OneofUnmarshaler, _ConformanceResponse_OneofSizer, []interface{}{\n\t\t(*ConformanceResponse_ParseError)(nil),\n\t\t(*ConformanceResponse_SerializeError)(nil),\n\t\t(*ConformanceResponse_RuntimeError)(nil),\n\t\t(*ConformanceResponse_ProtobufPayload)(nil),\n\t\t(*ConformanceResponse_JsonPayload)(nil),\n\t\t(*ConformanceResponse_Skipped)(nil),\n\t}\n}\n\nfunc _ConformanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*ConformanceResponse)\n\t// result\n\tswitch x := m.Result.(type) {\n\tcase *ConformanceResponse_ParseError:\n\t\tb.EncodeVarint(1<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.ParseError)\n\tcase *ConformanceResponse_SerializeError:\n\t\tb.EncodeVarint(6<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.SerializeError)\n\tcase *ConformanceResponse_RuntimeError:\n\t\tb.EncodeVarint(2<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.RuntimeError)\n\tcase *ConformanceResponse_ProtobufPayload:\n\t\tb.EncodeVarint(3<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.ProtobufPayload)\n\tcase *ConformanceResponse_JsonPayload:\n\t\tb.EncodeVarint(4<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.JsonPayload)\n\tcase *ConformanceResponse_Skipped:\n\t\tb.EncodeVarint(5<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Skipped)\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"ConformanceResponse.Result has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _ConformanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*ConformanceResponse)\n\tswitch tag {\n\tcase 1: // result.parse_error\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Result = &ConformanceResponse_ParseError{x}\n\t\treturn true, err\n\tcase 6: // result.serialize_error\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Result = &ConformanceResponse_SerializeError{x}\n\t\treturn true, err\n\tcase 2: // result.runtime_error\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Result = &ConformanceResponse_RuntimeError{x}\n\t\treturn true, err\n\tcase 3: // result.protobuf_payload\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Result = &ConformanceResponse_ProtobufPayload{x}\n\t\treturn true, err\n\tcase 4: // result.json_payload\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Result = &ConformanceResponse_JsonPayload{x}\n\t\treturn true, err\n\tcase 5: // result.skipped\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Result = &ConformanceResponse_Skipped{x}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _ConformanceResponse_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*ConformanceResponse)\n\t// result\n\tswitch x := m.Result.(type) {\n\tcase *ConformanceResponse_ParseError:\n\t\tn += proto.SizeVarint(1<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.ParseError)))\n\t\tn += len(x.ParseError)\n\tcase *ConformanceResponse_SerializeError:\n\t\tn += proto.SizeVarint(6<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.SerializeError)))\n\t\tn += len(x.SerializeError)\n\tcase *ConformanceResponse_RuntimeError:\n\t\tn += proto.SizeVarint(2<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.RuntimeError)))\n\t\tn += len(x.RuntimeError)\n\tcase *ConformanceResponse_ProtobufPayload:\n\t\tn += proto.SizeVarint(3<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.ProtobufPayload)))\n\t\tn += len(x.ProtobufPayload)\n\tcase *ConformanceResponse_JsonPayload:\n\t\tn += proto.SizeVarint(4<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.JsonPayload)))\n\t\tn += len(x.JsonPayload)\n\tcase *ConformanceResponse_Skipped:\n\t\tn += proto.SizeVarint(5<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Skipped)))\n\t\tn += len(x.Skipped)\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\n// This proto includes every type of field in both singular and repeated\n// forms.\ntype TestAllTypes struct {\n\t// Singular\n\tOptionalInt32          int32                       `protobuf:\"varint,1,opt,name=optional_int32,json=optionalInt32\" json:\"optional_int32,omitempty\"`\n\tOptionalInt64          int64                       `protobuf:\"varint,2,opt,name=optional_int64,json=optionalInt64\" json:\"optional_int64,omitempty\"`\n\tOptionalUint32         uint32                      `protobuf:\"varint,3,opt,name=optional_uint32,json=optionalUint32\" json:\"optional_uint32,omitempty\"`\n\tOptionalUint64         uint64                      `protobuf:\"varint,4,opt,name=optional_uint64,json=optionalUint64\" json:\"optional_uint64,omitempty\"`\n\tOptionalSint32         int32                       `protobuf:\"zigzag32,5,opt,name=optional_sint32,json=optionalSint32\" json:\"optional_sint32,omitempty\"`\n\tOptionalSint64         int64                       `protobuf:\"zigzag64,6,opt,name=optional_sint64,json=optionalSint64\" json:\"optional_sint64,omitempty\"`\n\tOptionalFixed32        uint32                      `protobuf:\"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32\" json:\"optional_fixed32,omitempty\"`\n\tOptionalFixed64        uint64                      `protobuf:\"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64\" json:\"optional_fixed64,omitempty\"`\n\tOptionalSfixed32       int32                       `protobuf:\"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32\" json:\"optional_sfixed32,omitempty\"`\n\tOptionalSfixed64       int64                       `protobuf:\"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64\" json:\"optional_sfixed64,omitempty\"`\n\tOptionalFloat          float32                     `protobuf:\"fixed32,11,opt,name=optional_float,json=optionalFloat\" json:\"optional_float,omitempty\"`\n\tOptionalDouble         float64                     `protobuf:\"fixed64,12,opt,name=optional_double,json=optionalDouble\" json:\"optional_double,omitempty\"`\n\tOptionalBool           bool                        `protobuf:\"varint,13,opt,name=optional_bool,json=optionalBool\" json:\"optional_bool,omitempty\"`\n\tOptionalString         string                      `protobuf:\"bytes,14,opt,name=optional_string,json=optionalString\" json:\"optional_string,omitempty\"`\n\tOptionalBytes          []byte                      `protobuf:\"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3\" json:\"optional_bytes,omitempty\"`\n\tOptionalNestedMessage  *TestAllTypes_NestedMessage `protobuf:\"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage\" json:\"optional_nested_message,omitempty\"`\n\tOptionalForeignMessage *ForeignMessage             `protobuf:\"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage\" json:\"optional_foreign_message,omitempty\"`\n\tOptionalNestedEnum     TestAllTypes_NestedEnum     `protobuf:\"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,enum=conformance.TestAllTypes_NestedEnum\" json:\"optional_nested_enum,omitempty\"`\n\tOptionalForeignEnum    ForeignEnum                 `protobuf:\"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,enum=conformance.ForeignEnum\" json:\"optional_foreign_enum,omitempty\"`\n\tOptionalStringPiece    string                      `protobuf:\"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece\" json:\"optional_string_piece,omitempty\"`\n\tOptionalCord           string                      `protobuf:\"bytes,25,opt,name=optional_cord,json=optionalCord\" json:\"optional_cord,omitempty\"`\n\tRecursiveMessage       *TestAllTypes               `protobuf:\"bytes,27,opt,name=recursive_message,json=recursiveMessage\" json:\"recursive_message,omitempty\"`\n\t// Repeated\n\tRepeatedInt32          []int32                       `protobuf:\"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32\" json:\"repeated_int32,omitempty\"`\n\tRepeatedInt64          []int64                       `protobuf:\"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64\" json:\"repeated_int64,omitempty\"`\n\tRepeatedUint32         []uint32                      `protobuf:\"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32\" json:\"repeated_uint32,omitempty\"`\n\tRepeatedUint64         []uint64                      `protobuf:\"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64\" json:\"repeated_uint64,omitempty\"`\n\tRepeatedSint32         []int32                       `protobuf:\"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32\" json:\"repeated_sint32,omitempty\"`\n\tRepeatedSint64         []int64                       `protobuf:\"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64\" json:\"repeated_sint64,omitempty\"`\n\tRepeatedFixed32        []uint32                      `protobuf:\"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32\" json:\"repeated_fixed32,omitempty\"`\n\tRepeatedFixed64        []uint64                      `protobuf:\"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64\" json:\"repeated_fixed64,omitempty\"`\n\tRepeatedSfixed32       []int32                       `protobuf:\"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32\" json:\"repeated_sfixed32,omitempty\"`\n\tRepeatedSfixed64       []int64                       `protobuf:\"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64\" json:\"repeated_sfixed64,omitempty\"`\n\tRepeatedFloat          []float32                     `protobuf:\"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat\" json:\"repeated_float,omitempty\"`\n\tRepeatedDouble         []float64                     `protobuf:\"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble\" json:\"repeated_double,omitempty\"`\n\tRepeatedBool           []bool                        `protobuf:\"varint,43,rep,packed,name=repeated_bool,json=repeatedBool\" json:\"repeated_bool,omitempty\"`\n\tRepeatedString         []string                      `protobuf:\"bytes,44,rep,name=repeated_string,json=repeatedString\" json:\"repeated_string,omitempty\"`\n\tRepeatedBytes          [][]byte                      `protobuf:\"bytes,45,rep,name=repeated_bytes,json=repeatedBytes,proto3\" json:\"repeated_bytes,omitempty\"`\n\tRepeatedNestedMessage  []*TestAllTypes_NestedMessage `protobuf:\"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage\" json:\"repeated_nested_message,omitempty\"`\n\tRepeatedForeignMessage []*ForeignMessage             `protobuf:\"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage\" json:\"repeated_foreign_message,omitempty\"`\n\tRepeatedNestedEnum     []TestAllTypes_NestedEnum     `protobuf:\"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,enum=conformance.TestAllTypes_NestedEnum\" json:\"repeated_nested_enum,omitempty\"`\n\tRepeatedForeignEnum    []ForeignEnum                 `protobuf:\"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,enum=conformance.ForeignEnum\" json:\"repeated_foreign_enum,omitempty\"`\n\tRepeatedStringPiece    []string                      `protobuf:\"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece\" json:\"repeated_string_piece,omitempty\"`\n\tRepeatedCord           []string                      `protobuf:\"bytes,55,rep,name=repeated_cord,json=repeatedCord\" json:\"repeated_cord,omitempty\"`\n\t// Map\n\tMapInt32Int32           map[int32]int32                        `protobuf:\"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32\" json:\"map_int32_int32,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tMapInt64Int64           map[int64]int64                        `protobuf:\"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64\" json:\"map_int64_int64,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tMapUint32Uint32         map[uint32]uint32                      `protobuf:\"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32\" json:\"map_uint32_uint32,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tMapUint64Uint64         map[uint64]uint64                      `protobuf:\"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64\" json:\"map_uint64_uint64,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tMapSint32Sint32         map[int32]int32                        `protobuf:\"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32\" json:\"map_sint32_sint32,omitempty\" protobuf_key:\"zigzag32,1,opt,name=key\" protobuf_val:\"zigzag32,2,opt,name=value\"`\n\tMapSint64Sint64         map[int64]int64                        `protobuf:\"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64\" json:\"map_sint64_sint64,omitempty\" protobuf_key:\"zigzag64,1,opt,name=key\" protobuf_val:\"zigzag64,2,opt,name=value\"`\n\tMapFixed32Fixed32       map[uint32]uint32                      `protobuf:\"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32\" json:\"map_fixed32_fixed32,omitempty\" protobuf_key:\"fixed32,1,opt,name=key\" protobuf_val:\"fixed32,2,opt,name=value\"`\n\tMapFixed64Fixed64       map[uint64]uint64                      `protobuf:\"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64\" json:\"map_fixed64_fixed64,omitempty\" protobuf_key:\"fixed64,1,opt,name=key\" protobuf_val:\"fixed64,2,opt,name=value\"`\n\tMapSfixed32Sfixed32     map[int32]int32                        `protobuf:\"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32\" json:\"map_sfixed32_sfixed32,omitempty\" protobuf_key:\"fixed32,1,opt,name=key\" protobuf_val:\"fixed32,2,opt,name=value\"`\n\tMapSfixed64Sfixed64     map[int64]int64                        `protobuf:\"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64\" json:\"map_sfixed64_sfixed64,omitempty\" protobuf_key:\"fixed64,1,opt,name=key\" protobuf_val:\"fixed64,2,opt,name=value\"`\n\tMapInt32Float           map[int32]float32                      `protobuf:\"bytes,66,rep,name=map_int32_float,json=mapInt32Float\" json:\"map_int32_float,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"fixed32,2,opt,name=value\"`\n\tMapInt32Double          map[int32]float64                      `protobuf:\"bytes,67,rep,name=map_int32_double,json=mapInt32Double\" json:\"map_int32_double,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"fixed64,2,opt,name=value\"`\n\tMapBoolBool             map[bool]bool                          `protobuf:\"bytes,68,rep,name=map_bool_bool,json=mapBoolBool\" json:\"map_bool_bool,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tMapStringString         map[string]string                      `protobuf:\"bytes,69,rep,name=map_string_string,json=mapStringString\" json:\"map_string_string,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMapStringBytes          map[string][]byte                      `protobuf:\"bytes,70,rep,name=map_string_bytes,json=mapStringBytes\" json:\"map_string_bytes,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n\tMapStringNestedMessage  map[string]*TestAllTypes_NestedMessage `protobuf:\"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage\" json:\"map_string_nested_message,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMapStringForeignMessage map[string]*ForeignMessage             `protobuf:\"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage\" json:\"map_string_foreign_message,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMapStringNestedEnum     map[string]TestAllTypes_NestedEnum     `protobuf:\"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum\" json:\"map_string_nested_enum,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value,enum=conformance.TestAllTypes_NestedEnum\"`\n\tMapStringForeignEnum    map[string]ForeignEnum                 `protobuf:\"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum\" json:\"map_string_foreign_enum,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value,enum=conformance.ForeignEnum\"`\n\t// Types that are valid to be assigned to OneofField:\n\t//\t*TestAllTypes_OneofUint32\n\t//\t*TestAllTypes_OneofNestedMessage\n\t//\t*TestAllTypes_OneofString\n\t//\t*TestAllTypes_OneofBytes\n\t//\t*TestAllTypes_OneofBool\n\t//\t*TestAllTypes_OneofUint64\n\t//\t*TestAllTypes_OneofFloat\n\t//\t*TestAllTypes_OneofDouble\n\t//\t*TestAllTypes_OneofEnum\n\tOneofField isTestAllTypes_OneofField `protobuf_oneof:\"oneof_field\"`\n\t// Well-known types\n\tOptionalBoolWrapper   *google_protobuf5.BoolValue     `protobuf:\"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper\" json:\"optional_bool_wrapper,omitempty\"`\n\tOptionalInt32Wrapper  *google_protobuf5.Int32Value    `protobuf:\"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper\" json:\"optional_int32_wrapper,omitempty\"`\n\tOptionalInt64Wrapper  *google_protobuf5.Int64Value    `protobuf:\"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper\" json:\"optional_int64_wrapper,omitempty\"`\n\tOptionalUint32Wrapper *google_protobuf5.UInt32Value   `protobuf:\"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper\" json:\"optional_uint32_wrapper,omitempty\"`\n\tOptionalUint64Wrapper *google_protobuf5.UInt64Value   `protobuf:\"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper\" json:\"optional_uint64_wrapper,omitempty\"`\n\tOptionalFloatWrapper  *google_protobuf5.FloatValue    `protobuf:\"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper\" json:\"optional_float_wrapper,omitempty\"`\n\tOptionalDoubleWrapper *google_protobuf5.DoubleValue   `protobuf:\"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper\" json:\"optional_double_wrapper,omitempty\"`\n\tOptionalStringWrapper *google_protobuf5.StringValue   `protobuf:\"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper\" json:\"optional_string_wrapper,omitempty\"`\n\tOptionalBytesWrapper  *google_protobuf5.BytesValue    `protobuf:\"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper\" json:\"optional_bytes_wrapper,omitempty\"`\n\tRepeatedBoolWrapper   []*google_protobuf5.BoolValue   `protobuf:\"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper\" json:\"repeated_bool_wrapper,omitempty\"`\n\tRepeatedInt32Wrapper  []*google_protobuf5.Int32Value  `protobuf:\"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper\" json:\"repeated_int32_wrapper,omitempty\"`\n\tRepeatedInt64Wrapper  []*google_protobuf5.Int64Value  `protobuf:\"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper\" json:\"repeated_int64_wrapper,omitempty\"`\n\tRepeatedUint32Wrapper []*google_protobuf5.UInt32Value `protobuf:\"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper\" json:\"repeated_uint32_wrapper,omitempty\"`\n\tRepeatedUint64Wrapper []*google_protobuf5.UInt64Value `protobuf:\"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper\" json:\"repeated_uint64_wrapper,omitempty\"`\n\tRepeatedFloatWrapper  []*google_protobuf5.FloatValue  `protobuf:\"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper\" json:\"repeated_float_wrapper,omitempty\"`\n\tRepeatedDoubleWrapper []*google_protobuf5.DoubleValue `protobuf:\"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper\" json:\"repeated_double_wrapper,omitempty\"`\n\tRepeatedStringWrapper []*google_protobuf5.StringValue `protobuf:\"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper\" json:\"repeated_string_wrapper,omitempty\"`\n\tRepeatedBytesWrapper  []*google_protobuf5.BytesValue  `protobuf:\"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper\" json:\"repeated_bytes_wrapper,omitempty\"`\n\tOptionalDuration      *google_protobuf1.Duration      `protobuf:\"bytes,301,opt,name=optional_duration,json=optionalDuration\" json:\"optional_duration,omitempty\"`\n\tOptionalTimestamp     *google_protobuf4.Timestamp     `protobuf:\"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp\" json:\"optional_timestamp,omitempty\"`\n\tOptionalFieldMask     *google_protobuf2.FieldMask     `protobuf:\"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask\" json:\"optional_field_mask,omitempty\"`\n\tOptionalStruct        *google_protobuf3.Struct        `protobuf:\"bytes,304,opt,name=optional_struct,json=optionalStruct\" json:\"optional_struct,omitempty\"`\n\tOptionalAny           *google_protobuf.Any            `protobuf:\"bytes,305,opt,name=optional_any,json=optionalAny\" json:\"optional_any,omitempty\"`\n\tOptionalValue         *google_protobuf3.Value         `protobuf:\"bytes,306,opt,name=optional_value,json=optionalValue\" json:\"optional_value,omitempty\"`\n\tRepeatedDuration      []*google_protobuf1.Duration    `protobuf:\"bytes,311,rep,name=repeated_duration,json=repeatedDuration\" json:\"repeated_duration,omitempty\"`\n\tRepeatedTimestamp     []*google_protobuf4.Timestamp   `protobuf:\"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp\" json:\"repeated_timestamp,omitempty\"`\n\tRepeatedFieldmask     []*google_protobuf2.FieldMask   `protobuf:\"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask\" json:\"repeated_fieldmask,omitempty\"`\n\tRepeatedStruct        []*google_protobuf3.Struct      `protobuf:\"bytes,324,rep,name=repeated_struct,json=repeatedStruct\" json:\"repeated_struct,omitempty\"`\n\tRepeatedAny           []*google_protobuf.Any          `protobuf:\"bytes,315,rep,name=repeated_any,json=repeatedAny\" json:\"repeated_any,omitempty\"`\n\tRepeatedValue         []*google_protobuf3.Value       `protobuf:\"bytes,316,rep,name=repeated_value,json=repeatedValue\" json:\"repeated_value,omitempty\"`\n\t// Test field-name-to-JSON-name convention.\n\t// (protobuf says names can be any valid C/C++ identifier.)\n\tFieldname1    int32 `protobuf:\"varint,401,opt,name=fieldname1\" json:\"fieldname1,omitempty\"`\n\tFieldName2    int32 `protobuf:\"varint,402,opt,name=field_name2,json=fieldName2\" json:\"field_name2,omitempty\"`\n\tXFieldName3   int32 `protobuf:\"varint,403,opt,name=_field_name3,json=FieldName3\" json:\"_field_name3,omitempty\"`\n\tField_Name4_  int32 `protobuf:\"varint,404,opt,name=field__name4_,json=fieldName4\" json:\"field__name4_,omitempty\"`\n\tField0Name5   int32 `protobuf:\"varint,405,opt,name=field0name5\" json:\"field0name5,omitempty\"`\n\tField_0Name6  int32 `protobuf:\"varint,406,opt,name=field_0_name6,json=field0Name6\" json:\"field_0_name6,omitempty\"`\n\tFieldName7    int32 `protobuf:\"varint,407,opt,name=fieldName7\" json:\"fieldName7,omitempty\"`\n\tFieldName8    int32 `protobuf:\"varint,408,opt,name=FieldName8\" json:\"FieldName8,omitempty\"`\n\tField_Name9   int32 `protobuf:\"varint,409,opt,name=field_Name9,json=fieldName9\" json:\"field_Name9,omitempty\"`\n\tField_Name10  int32 `protobuf:\"varint,410,opt,name=Field_Name10,json=FieldName10\" json:\"Field_Name10,omitempty\"`\n\tFIELD_NAME11  int32 `protobuf:\"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11\" json:\"FIELD_NAME11,omitempty\"`\n\tFIELDName12   int32 `protobuf:\"varint,412,opt,name=FIELD_name12,json=FIELDName12\" json:\"FIELD_name12,omitempty\"`\n\tXFieldName13  int32 `protobuf:\"varint,413,opt,name=__field_name13,json=FieldName13\" json:\"__field_name13,omitempty\"`\n\tX_FieldName14 int32 `protobuf:\"varint,414,opt,name=__Field_name14,json=FieldName14\" json:\"__Field_name14,omitempty\"`\n\tField_Name15  int32 `protobuf:\"varint,415,opt,name=field__name15,json=fieldName15\" json:\"field__name15,omitempty\"`\n\tField__Name16 int32 `protobuf:\"varint,416,opt,name=field__Name16,json=fieldName16\" json:\"field__Name16,omitempty\"`\n\tFieldName17__ int32 `protobuf:\"varint,417,opt,name=field_name17__,json=fieldName17\" json:\"field_name17__,omitempty\"`\n\tFieldName18__ int32 `protobuf:\"varint,418,opt,name=Field_name18__,json=FieldName18\" json:\"Field_name18__,omitempty\"`\n}\n\nfunc (m *TestAllTypes) Reset()                    { *m = TestAllTypes{} }\nfunc (m *TestAllTypes) String() string            { return proto.CompactTextString(m) }\nfunc (*TestAllTypes) ProtoMessage()               {}\nfunc (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\ntype isTestAllTypes_OneofField interface {\n\tisTestAllTypes_OneofField()\n}\n\ntype TestAllTypes_OneofUint32 struct {\n\tOneofUint32 uint32 `protobuf:\"varint,111,opt,name=oneof_uint32,json=oneofUint32,oneof\"`\n}\ntype TestAllTypes_OneofNestedMessage struct {\n\tOneofNestedMessage *TestAllTypes_NestedMessage `protobuf:\"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof\"`\n}\ntype TestAllTypes_OneofString struct {\n\tOneofString string `protobuf:\"bytes,113,opt,name=oneof_string,json=oneofString,oneof\"`\n}\ntype TestAllTypes_OneofBytes struct {\n\tOneofBytes []byte `protobuf:\"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof\"`\n}\ntype TestAllTypes_OneofBool struct {\n\tOneofBool bool `protobuf:\"varint,115,opt,name=oneof_bool,json=oneofBool,oneof\"`\n}\ntype TestAllTypes_OneofUint64 struct {\n\tOneofUint64 uint64 `protobuf:\"varint,116,opt,name=oneof_uint64,json=oneofUint64,oneof\"`\n}\ntype TestAllTypes_OneofFloat struct {\n\tOneofFloat float32 `protobuf:\"fixed32,117,opt,name=oneof_float,json=oneofFloat,oneof\"`\n}\ntype TestAllTypes_OneofDouble struct {\n\tOneofDouble float64 `protobuf:\"fixed64,118,opt,name=oneof_double,json=oneofDouble,oneof\"`\n}\ntype TestAllTypes_OneofEnum struct {\n\tOneofEnum TestAllTypes_NestedEnum `protobuf:\"varint,119,opt,name=oneof_enum,json=oneofEnum,enum=conformance.TestAllTypes_NestedEnum,oneof\"`\n}\n\nfunc (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField()        {}\nfunc (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}\nfunc (*TestAllTypes_OneofString) isTestAllTypes_OneofField()        {}\nfunc (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField()         {}\nfunc (*TestAllTypes_OneofBool) isTestAllTypes_OneofField()          {}\nfunc (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField()        {}\nfunc (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField()         {}\nfunc (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField()        {}\nfunc (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField()          {}\n\nfunc (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {\n\tif m != nil {\n\t\treturn m.OneofField\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalInt32() int32 {\n\tif m != nil {\n\t\treturn m.OptionalInt32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalInt64() int64 {\n\tif m != nil {\n\t\treturn m.OptionalInt64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalUint32() uint32 {\n\tif m != nil {\n\t\treturn m.OptionalUint32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalUint64() uint64 {\n\tif m != nil {\n\t\treturn m.OptionalUint64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalSint32() int32 {\n\tif m != nil {\n\t\treturn m.OptionalSint32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalSint64() int64 {\n\tif m != nil {\n\t\treturn m.OptionalSint64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalFixed32() uint32 {\n\tif m != nil {\n\t\treturn m.OptionalFixed32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalFixed64() uint64 {\n\tif m != nil {\n\t\treturn m.OptionalFixed64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalSfixed32() int32 {\n\tif m != nil {\n\t\treturn m.OptionalSfixed32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalSfixed64() int64 {\n\tif m != nil {\n\t\treturn m.OptionalSfixed64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalFloat() float32 {\n\tif m != nil {\n\t\treturn m.OptionalFloat\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalDouble() float64 {\n\tif m != nil {\n\t\treturn m.OptionalDouble\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOptionalBool() bool {\n\tif m != nil {\n\t\treturn m.OptionalBool\n\t}\n\treturn false\n}\n\nfunc (m *TestAllTypes) GetOptionalString() string {\n\tif m != nil {\n\t\treturn m.OptionalString\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestAllTypes) GetOptionalBytes() []byte {\n\tif m != nil {\n\t\treturn m.OptionalBytes\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalNestedMessage() *TestAllTypes_NestedMessage {\n\tif m != nil {\n\t\treturn m.OptionalNestedMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalForeignMessage() *ForeignMessage {\n\tif m != nil {\n\t\treturn m.OptionalForeignMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalNestedEnum() TestAllTypes_NestedEnum {\n\tif m != nil {\n\t\treturn m.OptionalNestedEnum\n\t}\n\treturn TestAllTypes_FOO\n}\n\nfunc (m *TestAllTypes) GetOptionalForeignEnum() ForeignEnum {\n\tif m != nil {\n\t\treturn m.OptionalForeignEnum\n\t}\n\treturn ForeignEnum_FOREIGN_FOO\n}\n\nfunc (m *TestAllTypes) GetOptionalStringPiece() string {\n\tif m != nil {\n\t\treturn m.OptionalStringPiece\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestAllTypes) GetOptionalCord() string {\n\tif m != nil {\n\t\treturn m.OptionalCord\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestAllTypes) GetRecursiveMessage() *TestAllTypes {\n\tif m != nil {\n\t\treturn m.RecursiveMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedInt32() []int32 {\n\tif m != nil {\n\t\treturn m.RepeatedInt32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedInt64() []int64 {\n\tif m != nil {\n\t\treturn m.RepeatedInt64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedUint32() []uint32 {\n\tif m != nil {\n\t\treturn m.RepeatedUint32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedUint64() []uint64 {\n\tif m != nil {\n\t\treturn m.RepeatedUint64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedSint32() []int32 {\n\tif m != nil {\n\t\treturn m.RepeatedSint32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedSint64() []int64 {\n\tif m != nil {\n\t\treturn m.RepeatedSint64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedFixed32() []uint32 {\n\tif m != nil {\n\t\treturn m.RepeatedFixed32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedFixed64() []uint64 {\n\tif m != nil {\n\t\treturn m.RepeatedFixed64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedSfixed32() []int32 {\n\tif m != nil {\n\t\treturn m.RepeatedSfixed32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedSfixed64() []int64 {\n\tif m != nil {\n\t\treturn m.RepeatedSfixed64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedFloat() []float32 {\n\tif m != nil {\n\t\treturn m.RepeatedFloat\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedDouble() []float64 {\n\tif m != nil {\n\t\treturn m.RepeatedDouble\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedBool() []bool {\n\tif m != nil {\n\t\treturn m.RepeatedBool\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedString() []string {\n\tif m != nil {\n\t\treturn m.RepeatedString\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedBytes() [][]byte {\n\tif m != nil {\n\t\treturn m.RepeatedBytes\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedNestedMessage() []*TestAllTypes_NestedMessage {\n\tif m != nil {\n\t\treturn m.RepeatedNestedMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedForeignMessage() []*ForeignMessage {\n\tif m != nil {\n\t\treturn m.RepeatedForeignMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedNestedEnum() []TestAllTypes_NestedEnum {\n\tif m != nil {\n\t\treturn m.RepeatedNestedEnum\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedForeignEnum() []ForeignEnum {\n\tif m != nil {\n\t\treturn m.RepeatedForeignEnum\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedStringPiece() []string {\n\tif m != nil {\n\t\treturn m.RepeatedStringPiece\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedCord() []string {\n\tif m != nil {\n\t\treturn m.RepeatedCord\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapInt32Int32() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.MapInt32Int32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapInt64Int64() map[int64]int64 {\n\tif m != nil {\n\t\treturn m.MapInt64Int64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapUint32Uint32() map[uint32]uint32 {\n\tif m != nil {\n\t\treturn m.MapUint32Uint32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapUint64Uint64() map[uint64]uint64 {\n\tif m != nil {\n\t\treturn m.MapUint64Uint64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapSint32Sint32() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.MapSint32Sint32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapSint64Sint64() map[int64]int64 {\n\tif m != nil {\n\t\treturn m.MapSint64Sint64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapFixed32Fixed32() map[uint32]uint32 {\n\tif m != nil {\n\t\treturn m.MapFixed32Fixed32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapFixed64Fixed64() map[uint64]uint64 {\n\tif m != nil {\n\t\treturn m.MapFixed64Fixed64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapSfixed32Sfixed32() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.MapSfixed32Sfixed32\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapSfixed64Sfixed64() map[int64]int64 {\n\tif m != nil {\n\t\treturn m.MapSfixed64Sfixed64\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapInt32Float() map[int32]float32 {\n\tif m != nil {\n\t\treturn m.MapInt32Float\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapInt32Double() map[int32]float64 {\n\tif m != nil {\n\t\treturn m.MapInt32Double\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapBoolBool() map[bool]bool {\n\tif m != nil {\n\t\treturn m.MapBoolBool\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringString() map[string]string {\n\tif m != nil {\n\t\treturn m.MapStringString\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringBytes() map[string][]byte {\n\tif m != nil {\n\t\treturn m.MapStringBytes\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringNestedMessage() map[string]*TestAllTypes_NestedMessage {\n\tif m != nil {\n\t\treturn m.MapStringNestedMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringForeignMessage() map[string]*ForeignMessage {\n\tif m != nil {\n\t\treturn m.MapStringForeignMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEnum {\n\tif m != nil {\n\t\treturn m.MapStringNestedEnum\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum {\n\tif m != nil {\n\t\treturn m.MapStringForeignEnum\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOneofUint32() uint32 {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok {\n\t\treturn x.OneofUint32\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOneofNestedMessage() *TestAllTypes_NestedMessage {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofNestedMessage); ok {\n\t\treturn x.OneofNestedMessage\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOneofString() string {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofString); ok {\n\t\treturn x.OneofString\n\t}\n\treturn \"\"\n}\n\nfunc (m *TestAllTypes) GetOneofBytes() []byte {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofBytes); ok {\n\t\treturn x.OneofBytes\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOneofBool() bool {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofBool); ok {\n\t\treturn x.OneofBool\n\t}\n\treturn false\n}\n\nfunc (m *TestAllTypes) GetOneofUint64() uint64 {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofUint64); ok {\n\t\treturn x.OneofUint64\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOneofFloat() float32 {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofFloat); ok {\n\t\treturn x.OneofFloat\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOneofDouble() float64 {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofDouble); ok {\n\t\treturn x.OneofDouble\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetOneofEnum() TestAllTypes_NestedEnum {\n\tif x, ok := m.GetOneofField().(*TestAllTypes_OneofEnum); ok {\n\t\treturn x.OneofEnum\n\t}\n\treturn TestAllTypes_FOO\n}\n\nfunc (m *TestAllTypes) GetOptionalBoolWrapper() *google_protobuf5.BoolValue {\n\tif m != nil {\n\t\treturn m.OptionalBoolWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalInt32Wrapper() *google_protobuf5.Int32Value {\n\tif m != nil {\n\t\treturn m.OptionalInt32Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalInt64Wrapper() *google_protobuf5.Int64Value {\n\tif m != nil {\n\t\treturn m.OptionalInt64Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalUint32Wrapper() *google_protobuf5.UInt32Value {\n\tif m != nil {\n\t\treturn m.OptionalUint32Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalUint64Wrapper() *google_protobuf5.UInt64Value {\n\tif m != nil {\n\t\treturn m.OptionalUint64Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalFloatWrapper() *google_protobuf5.FloatValue {\n\tif m != nil {\n\t\treturn m.OptionalFloatWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalDoubleWrapper() *google_protobuf5.DoubleValue {\n\tif m != nil {\n\t\treturn m.OptionalDoubleWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalStringWrapper() *google_protobuf5.StringValue {\n\tif m != nil {\n\t\treturn m.OptionalStringWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalBytesWrapper() *google_protobuf5.BytesValue {\n\tif m != nil {\n\t\treturn m.OptionalBytesWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedBoolWrapper() []*google_protobuf5.BoolValue {\n\tif m != nil {\n\t\treturn m.RepeatedBoolWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedInt32Wrapper() []*google_protobuf5.Int32Value {\n\tif m != nil {\n\t\treturn m.RepeatedInt32Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedInt64Wrapper() []*google_protobuf5.Int64Value {\n\tif m != nil {\n\t\treturn m.RepeatedInt64Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedUint32Wrapper() []*google_protobuf5.UInt32Value {\n\tif m != nil {\n\t\treturn m.RepeatedUint32Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedUint64Wrapper() []*google_protobuf5.UInt64Value {\n\tif m != nil {\n\t\treturn m.RepeatedUint64Wrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedFloatWrapper() []*google_protobuf5.FloatValue {\n\tif m != nil {\n\t\treturn m.RepeatedFloatWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedDoubleWrapper() []*google_protobuf5.DoubleValue {\n\tif m != nil {\n\t\treturn m.RepeatedDoubleWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedStringWrapper() []*google_protobuf5.StringValue {\n\tif m != nil {\n\t\treturn m.RepeatedStringWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedBytesWrapper() []*google_protobuf5.BytesValue {\n\tif m != nil {\n\t\treturn m.RepeatedBytesWrapper\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalDuration() *google_protobuf1.Duration {\n\tif m != nil {\n\t\treturn m.OptionalDuration\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalTimestamp() *google_protobuf4.Timestamp {\n\tif m != nil {\n\t\treturn m.OptionalTimestamp\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalFieldMask() *google_protobuf2.FieldMask {\n\tif m != nil {\n\t\treturn m.OptionalFieldMask\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalStruct() *google_protobuf3.Struct {\n\tif m != nil {\n\t\treturn m.OptionalStruct\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalAny() *google_protobuf.Any {\n\tif m != nil {\n\t\treturn m.OptionalAny\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetOptionalValue() *google_protobuf3.Value {\n\tif m != nil {\n\t\treturn m.OptionalValue\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedDuration() []*google_protobuf1.Duration {\n\tif m != nil {\n\t\treturn m.RepeatedDuration\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedTimestamp() []*google_protobuf4.Timestamp {\n\tif m != nil {\n\t\treturn m.RepeatedTimestamp\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedFieldmask() []*google_protobuf2.FieldMask {\n\tif m != nil {\n\t\treturn m.RepeatedFieldmask\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedStruct() []*google_protobuf3.Struct {\n\tif m != nil {\n\t\treturn m.RepeatedStruct\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedAny() []*google_protobuf.Any {\n\tif m != nil {\n\t\treturn m.RepeatedAny\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetRepeatedValue() []*google_protobuf3.Value {\n\tif m != nil {\n\t\treturn m.RepeatedValue\n\t}\n\treturn nil\n}\n\nfunc (m *TestAllTypes) GetFieldname1() int32 {\n\tif m != nil {\n\t\treturn m.Fieldname1\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFieldName2() int32 {\n\tif m != nil {\n\t\treturn m.FieldName2\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetXFieldName3() int32 {\n\tif m != nil {\n\t\treturn m.XFieldName3\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField_Name4_() int32 {\n\tif m != nil {\n\t\treturn m.Field_Name4_\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField0Name5() int32 {\n\tif m != nil {\n\t\treturn m.Field0Name5\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField_0Name6() int32 {\n\tif m != nil {\n\t\treturn m.Field_0Name6\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFieldName7() int32 {\n\tif m != nil {\n\t\treturn m.FieldName7\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFieldName8() int32 {\n\tif m != nil {\n\t\treturn m.FieldName8\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField_Name9() int32 {\n\tif m != nil {\n\t\treturn m.Field_Name9\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField_Name10() int32 {\n\tif m != nil {\n\t\treturn m.Field_Name10\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFIELD_NAME11() int32 {\n\tif m != nil {\n\t\treturn m.FIELD_NAME11\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFIELDName12() int32 {\n\tif m != nil {\n\t\treturn m.FIELDName12\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetXFieldName13() int32 {\n\tif m != nil {\n\t\treturn m.XFieldName13\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetX_FieldName14() int32 {\n\tif m != nil {\n\t\treturn m.X_FieldName14\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField_Name15() int32 {\n\tif m != nil {\n\t\treturn m.Field_Name15\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetField__Name16() int32 {\n\tif m != nil {\n\t\treturn m.Field__Name16\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFieldName17__() int32 {\n\tif m != nil {\n\t\treturn m.FieldName17__\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes) GetFieldName18__() int32 {\n\tif m != nil {\n\t\treturn m.FieldName18__\n\t}\n\treturn 0\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{\n\t\t(*TestAllTypes_OneofUint32)(nil),\n\t\t(*TestAllTypes_OneofNestedMessage)(nil),\n\t\t(*TestAllTypes_OneofString)(nil),\n\t\t(*TestAllTypes_OneofBytes)(nil),\n\t\t(*TestAllTypes_OneofBool)(nil),\n\t\t(*TestAllTypes_OneofUint64)(nil),\n\t\t(*TestAllTypes_OneofFloat)(nil),\n\t\t(*TestAllTypes_OneofDouble)(nil),\n\t\t(*TestAllTypes_OneofEnum)(nil),\n\t}\n}\n\nfunc _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*TestAllTypes)\n\t// oneof_field\n\tswitch x := m.OneofField.(type) {\n\tcase *TestAllTypes_OneofUint32:\n\t\tb.EncodeVarint(111<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.OneofUint32))\n\tcase *TestAllTypes_OneofNestedMessage:\n\t\tb.EncodeVarint(112<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.OneofNestedMessage); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *TestAllTypes_OneofString:\n\t\tb.EncodeVarint(113<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.OneofString)\n\tcase *TestAllTypes_OneofBytes:\n\t\tb.EncodeVarint(114<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.OneofBytes)\n\tcase *TestAllTypes_OneofBool:\n\t\tt := uint64(0)\n\t\tif x.OneofBool {\n\t\t\tt = 1\n\t\t}\n\t\tb.EncodeVarint(115<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(t)\n\tcase *TestAllTypes_OneofUint64:\n\t\tb.EncodeVarint(116<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.OneofUint64))\n\tcase *TestAllTypes_OneofFloat:\n\t\tb.EncodeVarint(117<<3 | proto.WireFixed32)\n\t\tb.EncodeFixed32(uint64(math.Float32bits(x.OneofFloat)))\n\tcase *TestAllTypes_OneofDouble:\n\t\tb.EncodeVarint(118<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.OneofDouble))\n\tcase *TestAllTypes_OneofEnum:\n\t\tb.EncodeVarint(119<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.OneofEnum))\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"TestAllTypes.OneofField has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*TestAllTypes)\n\tswitch tag {\n\tcase 111: // oneof_field.oneof_uint32\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.OneofField = &TestAllTypes_OneofUint32{uint32(x)}\n\t\treturn true, err\n\tcase 112: // oneof_field.oneof_nested_message\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(TestAllTypes_NestedMessage)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.OneofField = &TestAllTypes_OneofNestedMessage{msg}\n\t\treturn true, err\n\tcase 113: // oneof_field.oneof_string\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.OneofField = &TestAllTypes_OneofString{x}\n\t\treturn true, err\n\tcase 114: // oneof_field.oneof_bytes\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.OneofField = &TestAllTypes_OneofBytes{x}\n\t\treturn true, err\n\tcase 115: // oneof_field.oneof_bool\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.OneofField = &TestAllTypes_OneofBool{x != 0}\n\t\treturn true, err\n\tcase 116: // oneof_field.oneof_uint64\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.OneofField = &TestAllTypes_OneofUint64{x}\n\t\treturn true, err\n\tcase 117: // oneof_field.oneof_float\n\t\tif wire != proto.WireFixed32 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed32()\n\t\tm.OneofField = &TestAllTypes_OneofFloat{math.Float32frombits(uint32(x))}\n\t\treturn true, err\n\tcase 118: // oneof_field.oneof_double\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.OneofField = &TestAllTypes_OneofDouble{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 119: // oneof_field.oneof_enum\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.OneofField = &TestAllTypes_OneofEnum{TestAllTypes_NestedEnum(x)}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _TestAllTypes_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*TestAllTypes)\n\t// oneof_field\n\tswitch x := m.OneofField.(type) {\n\tcase *TestAllTypes_OneofUint32:\n\t\tn += proto.SizeVarint(111<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.OneofUint32))\n\tcase *TestAllTypes_OneofNestedMessage:\n\t\ts := proto.Size(x.OneofNestedMessage)\n\t\tn += proto.SizeVarint(112<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase *TestAllTypes_OneofString:\n\t\tn += proto.SizeVarint(113<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.OneofString)))\n\t\tn += len(x.OneofString)\n\tcase *TestAllTypes_OneofBytes:\n\t\tn += proto.SizeVarint(114<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.OneofBytes)))\n\t\tn += len(x.OneofBytes)\n\tcase *TestAllTypes_OneofBool:\n\t\tn += proto.SizeVarint(115<<3 | proto.WireVarint)\n\t\tn += 1\n\tcase *TestAllTypes_OneofUint64:\n\t\tn += proto.SizeVarint(116<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.OneofUint64))\n\tcase *TestAllTypes_OneofFloat:\n\t\tn += proto.SizeVarint(117<<3 | proto.WireFixed32)\n\t\tn += 4\n\tcase *TestAllTypes_OneofDouble:\n\t\tn += proto.SizeVarint(118<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *TestAllTypes_OneofEnum:\n\t\tn += proto.SizeVarint(119<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.OneofEnum))\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\ntype TestAllTypes_NestedMessage struct {\n\tA           int32         `protobuf:\"varint,1,opt,name=a\" json:\"a,omitempty\"`\n\tCorecursive *TestAllTypes `protobuf:\"bytes,2,opt,name=corecursive\" json:\"corecursive,omitempty\"`\n}\n\nfunc (m *TestAllTypes_NestedMessage) Reset()                    { *m = TestAllTypes_NestedMessage{} }\nfunc (m *TestAllTypes_NestedMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*TestAllTypes_NestedMessage) ProtoMessage()               {}\nfunc (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }\n\nfunc (m *TestAllTypes_NestedMessage) GetA() int32 {\n\tif m != nil {\n\t\treturn m.A\n\t}\n\treturn 0\n}\n\nfunc (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes {\n\tif m != nil {\n\t\treturn m.Corecursive\n\t}\n\treturn nil\n}\n\ntype ForeignMessage struct {\n\tC int32 `protobuf:\"varint,1,opt,name=c\" json:\"c,omitempty\"`\n}\n\nfunc (m *ForeignMessage) Reset()                    { *m = ForeignMessage{} }\nfunc (m *ForeignMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*ForeignMessage) ProtoMessage()               {}\nfunc (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\n\nfunc (m *ForeignMessage) GetC() int32 {\n\tif m != nil {\n\t\treturn m.C\n\t}\n\treturn 0\n}\n\nfunc init() {\n\tproto.RegisterType((*ConformanceRequest)(nil), \"conformance.ConformanceRequest\")\n\tproto.RegisterType((*ConformanceResponse)(nil), \"conformance.ConformanceResponse\")\n\tproto.RegisterType((*TestAllTypes)(nil), \"conformance.TestAllTypes\")\n\tproto.RegisterType((*TestAllTypes_NestedMessage)(nil), \"conformance.TestAllTypes.NestedMessage\")\n\tproto.RegisterType((*ForeignMessage)(nil), \"conformance.ForeignMessage\")\n\tproto.RegisterEnum(\"conformance.WireFormat\", WireFormat_name, WireFormat_value)\n\tproto.RegisterEnum(\"conformance.ForeignEnum\", ForeignEnum_name, ForeignEnum_value)\n\tproto.RegisterEnum(\"conformance.TestAllTypes_NestedEnum\", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value)\n}\n\nfunc init() { proto.RegisterFile(\"conformance_proto/conformance.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 2737 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x72, 0xdb, 0xc8,\n\t0xd5, 0x16, 0x08, 0x59, 0x4b, 0x93, 0x92, 0xa8, 0xd6, 0xd6, 0x96, 0x5d, 0x63, 0x58, 0xb2, 0x7f,\n\t0xd3, 0xf6, 0x8c, 0xac, 0x05, 0x86, 0x65, 0xcf, 0x3f, 0x8e, 0x45, 0x9b, 0xb4, 0xe4, 0x8c, 0x25,\n\t0x17, 0x64, 0x8d, 0xab, 0x9c, 0x0b, 0x06, 0xa6, 0x20, 0x15, 0xc7, 0x24, 0xc1, 0x01, 0x48, 0x4f,\n\t0x94, 0xcb, 0xbc, 0x41, 0xf6, 0x7d, 0xbd, 0xcf, 0x7a, 0x93, 0xa4, 0x92, 0xab, 0x54, 0x6e, 0xb2,\n\t0x27, 0x95, 0x3d, 0x79, 0x85, 0xbc, 0x43, 0x52, 0xbd, 0xa2, 0xbb, 0x01, 0x50, 0xf4, 0x54, 0x0d,\n\t0x25, 0x1e, 0x7c, 0xfd, 0x9d, 0xd3, 0xe7, 0x1c, 0x7c, 0x2d, 0x1c, 0x18, 0x2c, 0xd7, 0x83, 0xf6,\n\t0x51, 0x10, 0xb6, 0xbc, 0x76, 0xdd, 0xaf, 0x75, 0xc2, 0xa0, 0x1b, 0xdc, 0x90, 0x2c, 0x2b, 0xc4,\n\t0x02, 0xf3, 0x92, 0x69, 0xf1, 0xec, 0x71, 0x10, 0x1c, 0x37, 0xfd, 0x1b, 0xe4, 0xd2, 0x8b, 0xde,\n\t0xd1, 0x0d, 0xaf, 0x7d, 0x42, 0x71, 0x8b, 0x6f, 0xe8, 0x97, 0x0e, 0x7b, 0xa1, 0xd7, 0x6d, 0x04,\n\t0x6d, 0x76, 0xdd, 0xd2, 0xaf, 0x1f, 0x35, 0xfc, 0xe6, 0x61, 0xad, 0xe5, 0x45, 0x2f, 0x19, 0xe2,\n\t0xbc, 0x8e, 0x88, 0xba, 0x61, 0xaf, 0xde, 0x65, 0x57, 0x2f, 0xe8, 0x57, 0xbb, 0x8d, 0x96, 0x1f,\n\t0x75, 0xbd, 0x56, 0x27, 0x2b, 0x80, 0x0f, 0x43, 0xaf, 0xd3, 0xf1, 0xc3, 0x88, 0x5e, 0x5f, 0xfa,\n\t0x85, 0x01, 0xe0, 0xfd, 0x78, 0x2f, 0xae, 0xff, 0x41, 0xcf, 0x8f, 0xba, 0xf0, 0x3a, 0x28, 0xf2,\n\t0x15, 0xb5, 0x8e, 0x77, 0xd2, 0x0c, 0xbc, 0x43, 0x64, 0x58, 0x46, 0xa9, 0xb0, 0x3d, 0xe4, 0x4e,\n\t0xf1, 0x2b, 0x4f, 0xe8, 0x05, 0xb8, 0x0c, 0x0a, 0xef, 0x47, 0x41, 0x5b, 0x00, 0x73, 0x96, 0x51,\n\t0x1a, 0xdf, 0x1e, 0x72, 0xf3, 0xd8, 0xca, 0x41, 0x7b, 0x60, 0x21, 0xa4, 0xe4, 0xfe, 0x61, 0x2d,\n\t0xe8, 0x75, 0x3b, 0xbd, 0x6e, 0x8d, 0x78, 0xed, 0x22, 0xd3, 0x32, 0x4a, 0x93, 0xeb, 0x0b, 0x2b,\n\t0x72, 0x9a, 0x9f, 0x35, 0x42, 0xbf, 0x4a, 0x2e, 0xbb, 0x73, 0x62, 0xdd, 0x1e, 0x59, 0x46, 0xcd,\n\t0xe5, 0x71, 0x30, 0xca, 0x1c, 0x2e, 0x7d, 0x2a, 0x07, 0x66, 0x94, 0x4d, 0x44, 0x9d, 0xa0, 0x1d,\n\t0xf9, 0xf0, 0x22, 0xc8, 0x77, 0xbc, 0x30, 0xf2, 0x6b, 0x7e, 0x18, 0x06, 0x21, 0xd9, 0x00, 0x8e,\n\t0x0b, 0x10, 0x63, 0x05, 0xdb, 0xe0, 0x55, 0x30, 0x15, 0xf9, 0x61, 0xc3, 0x6b, 0x36, 0x3e, 0xc9,\n\t0x61, 0x23, 0x0c, 0x36, 0x29, 0x2e, 0x50, 0xe8, 0x65, 0x30, 0x11, 0xf6, 0xda, 0x38, 0xc1, 0x0c,\n\t0xc8, 0xf7, 0x59, 0x60, 0x66, 0x0a, 0x4b, 0x4b, 0x9d, 0x39, 0x68, 0xea, 0x86, 0xd3, 0x52, 0xb7,\n\t0x08, 0x46, 0xa3, 0x97, 0x8d, 0x4e, 0xc7, 0x3f, 0x44, 0x67, 0xd8, 0x75, 0x6e, 0x28, 0x8f, 0x81,\n\t0x91, 0xd0, 0x8f, 0x7a, 0xcd, 0xee, 0xd2, 0x7f, 0xaa, 0xa0, 0xf0, 0xd4, 0x8f, 0xba, 0x5b, 0xcd,\n\t0xe6, 0xd3, 0x93, 0x8e, 0x1f, 0xc1, 0xcb, 0x60, 0x32, 0xe8, 0xe0, 0x5e, 0xf3, 0x9a, 0xb5, 0x46,\n\t0xbb, 0xbb, 0xb1, 0x4e, 0x12, 0x70, 0xc6, 0x9d, 0xe0, 0xd6, 0x1d, 0x6c, 0xd4, 0x61, 0x8e, 0x4d,\n\t0xf6, 0x65, 0x2a, 0x30, 0xc7, 0x86, 0x57, 0xc0, 0x94, 0x80, 0xf5, 0x28, 0x1d, 0xde, 0xd5, 0x84,\n\t0x2b, 0x56, 0x1f, 0x10, 0x6b, 0x02, 0xe8, 0xd8, 0x64, 0x57, 0xc3, 0x2a, 0x50, 0x63, 0x8c, 0x28,\n\t0x23, 0xde, 0xde, 0x74, 0x0c, 0xdc, 0x4f, 0x32, 0x46, 0x94, 0x11, 0xd7, 0x08, 0xaa, 0x40, 0xc7,\n\t0x86, 0x57, 0x41, 0x51, 0x00, 0x8f, 0x1a, 0x9f, 0xf0, 0x0f, 0x37, 0xd6, 0xd1, 0xa8, 0x65, 0x94,\n\t0x46, 0x5d, 0x41, 0x50, 0xa5, 0xe6, 0x24, 0xd4, 0xb1, 0xd1, 0x98, 0x65, 0x94, 0x46, 0x34, 0xa8,\n\t0x63, 0xc3, 0xeb, 0x60, 0x3a, 0x76, 0xcf, 0x69, 0xc7, 0x2d, 0xa3, 0x34, 0xe5, 0x0a, 0x8e, 0x7d,\n\t0x66, 0x4f, 0x01, 0x3b, 0x36, 0x02, 0x96, 0x51, 0x2a, 0xea, 0x60, 0xc7, 0x56, 0x52, 0x7f, 0xd4,\n\t0x0c, 0xbc, 0x2e, 0xca, 0x5b, 0x46, 0x29, 0x17, 0xa7, 0xbe, 0x8a, 0x8d, 0xca, 0xfe, 0x0f, 0x83,\n\t0xde, 0x8b, 0xa6, 0x8f, 0x0a, 0x96, 0x51, 0x32, 0xe2, 0xfd, 0x3f, 0x20, 0x56, 0xb8, 0x0c, 0xc4,\n\t0xca, 0xda, 0x8b, 0x20, 0x68, 0xa2, 0x09, 0xcb, 0x28, 0x8d, 0xb9, 0x05, 0x6e, 0x2c, 0x07, 0x41,\n\t0x53, 0xcd, 0x66, 0x37, 0x6c, 0xb4, 0x8f, 0xd1, 0x24, 0xee, 0x2a, 0x29, 0x9b, 0xc4, 0xaa, 0x44,\n\t0xf7, 0xe2, 0xa4, 0xeb, 0x47, 0x68, 0x0a, 0xb7, 0x71, 0x1c, 0x5d, 0x19, 0x1b, 0x61, 0x0d, 0x2c,\n\t0x08, 0x58, 0x9b, 0xde, 0xde, 0x2d, 0x3f, 0x8a, 0xbc, 0x63, 0x1f, 0x41, 0xcb, 0x28, 0xe5, 0xd7,\n\t0xaf, 0x28, 0x37, 0xb6, 0xdc, 0xa2, 0x2b, 0xbb, 0x04, 0xff, 0x98, 0xc2, 0xdd, 0x39, 0xce, 0xa3,\n\t0x98, 0xe1, 0x01, 0x40, 0x71, 0x96, 0x82, 0xd0, 0x6f, 0x1c, 0xb7, 0x85, 0x87, 0x19, 0xe2, 0xe1,\n\t0x9c, 0xe2, 0xa1, 0x4a, 0x31, 0x9c, 0x75, 0x5e, 0x24, 0x53, 0xb1, 0xc3, 0xf7, 0xc0, 0xac, 0x1e,\n\t0xb7, 0xdf, 0xee, 0xb5, 0xd0, 0x1c, 0x51, 0xa3, 0x4b, 0xa7, 0x05, 0x5d, 0x69, 0xf7, 0x5a, 0x2e,\n\t0x54, 0x23, 0xc6, 0x36, 0xf8, 0x2e, 0x98, 0x4b, 0x84, 0x4b, 0x88, 0xe7, 0x09, 0x31, 0x4a, 0x8b,\n\t0x95, 0x90, 0xcd, 0x68, 0x81, 0x12, 0x36, 0x47, 0x62, 0xa3, 0xd5, 0xaa, 0x75, 0x1a, 0x7e, 0xdd,\n\t0x47, 0x08, 0xd7, 0xac, 0x9c, 0x1b, 0xcb, 0xc5, 0xeb, 0x68, 0xdd, 0x9e, 0xe0, 0xcb, 0xf0, 0x8a,\n\t0xd4, 0x0a, 0xf5, 0x20, 0x3c, 0x44, 0x67, 0x19, 0xde, 0x88, 0xdb, 0xe1, 0x7e, 0x10, 0x1e, 0xc2,\n\t0x2a, 0x98, 0x0e, 0xfd, 0x7a, 0x2f, 0x8c, 0x1a, 0xaf, 0x7c, 0x91, 0xd6, 0x73, 0x24, 0xad, 0x67,\n\t0x33, 0x73, 0xe0, 0x16, 0xc5, 0x1a, 0x9e, 0xce, 0xcb, 0x60, 0x32, 0xf4, 0x3b, 0xbe, 0x87, 0xf3,\n\t0x48, 0x6f, 0xe6, 0x0b, 0x96, 0x89, 0xd5, 0x86, 0x5b, 0x85, 0xda, 0xc8, 0x30, 0xc7, 0x46, 0x96,\n\t0x65, 0x62, 0xb5, 0x91, 0x60, 0x54, 0x1b, 0x04, 0x8c, 0xa9, 0xcd, 0x45, 0xcb, 0xc4, 0x6a, 0xc3,\n\t0xcd, 0xb1, 0xda, 0x28, 0x40, 0xc7, 0x46, 0x4b, 0x96, 0x89, 0xd5, 0x46, 0x06, 0x6a, 0x8c, 0x4c,\n\t0x6d, 0x96, 0x2d, 0x13, 0xab, 0x0d, 0x37, 0xef, 0x27, 0x19, 0x99, 0xda, 0x5c, 0xb2, 0x4c, 0xac,\n\t0x36, 0x32, 0x90, 0xaa, 0x8d, 0x00, 0x72, 0x59, 0xb8, 0x6c, 0x99, 0x58, 0x6d, 0xb8, 0x5d, 0x52,\n\t0x1b, 0x15, 0xea, 0xd8, 0xe8, 0xff, 0x2c, 0x13, 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x13, 0xbb, 0xe7,\n\t0xb4, 0x57, 0x2c, 0x13, 0xab, 0x8d, 0x08, 0x40, 0x52, 0x1b, 0x0d, 0xec, 0xd8, 0xa8, 0x64, 0x99,\n\t0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x38, 0x08, 0xa2, 0x36, 0x57, 0x2d, 0x13, 0xab, 0x8d, 0x08,\n\t0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0x66, 0x99, 0x58, 0x6d, 0xb8, 0x39, 0x56, 0x1b, 0x01,\n\t0x24, 0x6a, 0x73, 0xdd, 0x32, 0xb1, 0xda, 0x70, 0x23, 0x57, 0x9b, 0x38, 0x42, 0xaa, 0x36, 0x6f,\n\t0x5a, 0x26, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, 0x98, 0x8d, 0xa8, 0xcd, 0x5b, 0x96, 0x89, 0xd5,\n\t0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, 0x56, 0x2d, 0xf3, 0xb5, 0xd4, 0x86, 0xf3, 0x24,\n\t0xd4, 0x26, 0xce, 0x92, 0xa6, 0x36, 0x6b, 0xc4, 0x43, 0x7f, 0xb5, 0x11, 0xc9, 0x4c, 0xa8, 0x8d,\n\t0x1e, 0x37, 0x11, 0x85, 0x0d, 0xcb, 0x1c, 0x5c, 0x6d, 0xd4, 0x88, 0xb9, 0xda, 0x24, 0xc2, 0x25,\n\t0xc4, 0x36, 0x21, 0xee, 0xa3, 0x36, 0x5a, 0xa0, 0x5c, 0x6d, 0xb4, 0x6a, 0x31, 0xb5, 0x71, 0x70,\n\t0xcd, 0xa8, 0xda, 0xa8, 0x75, 0x13, 0x6a, 0x23, 0xd6, 0x11, 0xb5, 0xb9, 0xc5, 0xf0, 0x46, 0xdc,\n\t0x0e, 0x44, 0x6d, 0x9e, 0x82, 0xa9, 0x96, 0xd7, 0xa1, 0x02, 0xc1, 0x64, 0x62, 0x93, 0x24, 0xf5,\n\t0xcd, 0xec, 0x0c, 0x3c, 0xf6, 0x3a, 0x44, 0x3b, 0xc8, 0x47, 0xa5, 0xdd, 0x0d, 0x4f, 0xdc, 0x89,\n\t0x96, 0x6c, 0x93, 0x58, 0x1d, 0x9b, 0xa9, 0xca, 0xed, 0xc1, 0x58, 0x1d, 0x9b, 0x7c, 0x28, 0xac,\n\t0xcc, 0x06, 0x9f, 0x83, 0x69, 0xcc, 0x4a, 0xe5, 0x87, 0xab, 0xd0, 0x1d, 0xc2, 0xbb, 0xd2, 0x97,\n\t0x97, 0x4a, 0x13, 0xfd, 0xa4, 0xcc, 0x38, 0x3c, 0xd9, 0x2a, 0x73, 0x3b, 0x36, 0x17, 0xae, 0xb7,\n\t0x07, 0xe4, 0x76, 0x6c, 0xfa, 0xa9, 0x72, 0x73, 0x2b, 0xe7, 0xa6, 0x22, 0xc7, 0xb5, 0xee, 0xff,\n\t0x07, 0xe0, 0xa6, 0x02, 0xb8, 0xaf, 0xc5, 0x2d, 0x5b, 0x65, 0x6e, 0xc7, 0xe6, 0xf2, 0xf8, 0xce,\n\t0x80, 0xdc, 0x8e, 0xbd, 0xaf, 0xc5, 0x2d, 0x5b, 0xe1, 0xc7, 0xc1, 0x0c, 0xe6, 0x66, 0xda, 0x26,\n\t0x24, 0xf5, 0x2e, 0x61, 0x5f, 0xed, 0xcb, 0xce, 0x74, 0x96, 0xfd, 0xa0, 0xfc, 0x38, 0x50, 0xd5,\n\t0xae, 0x78, 0x70, 0x6c, 0xa1, 0xc4, 0x1f, 0x19, 0xd4, 0x83, 0x63, 0xb3, 0x1f, 0x9a, 0x07, 0x61,\n\t0x87, 0x47, 0x60, 0x8e, 0xe4, 0x87, 0x6f, 0x42, 0x28, 0xf8, 0x3d, 0xe2, 0x63, 0xbd, 0x7f, 0x8e,\n\t0x18, 0x98, 0xff, 0xa4, 0x5e, 0x70, 0xc8, 0xfa, 0x15, 0xd5, 0x0f, 0xae, 0x04, 0xdf, 0xcb, 0xd6,\n\t0xc0, 0x7e, 0x1c, 0x9b, 0xff, 0xd4, 0xfd, 0xc4, 0x57, 0xd4, 0xfb, 0x95, 0x1e, 0x1a, 0xe5, 0x41,\n\t0xef, 0x57, 0x72, 0x9c, 0x68, 0xf7, 0x2b, 0x3d, 0x62, 0x9e, 0x81, 0x62, 0xcc, 0xca, 0xce, 0x98,\n\t0xfb, 0x84, 0xf6, 0xad, 0xd3, 0x69, 0xe9, 0xe9, 0x43, 0x79, 0x27, 0x5b, 0x8a, 0x11, 0xee, 0x02,\n\t0xec, 0x89, 0x9c, 0x46, 0xf4, 0x48, 0x7a, 0x40, 0x58, 0xaf, 0xf5, 0x65, 0xc5, 0xe7, 0x14, 0xfe,\n\t0x9f, 0x52, 0xe6, 0x5b, 0xb1, 0x45, 0xb4, 0x3b, 0x95, 0x42, 0x76, 0x7e, 0x55, 0x06, 0x69, 0x77,\n\t0x02, 0xa5, 0x9f, 0x52, 0xbb, 0x4b, 0x56, 0x9e, 0x04, 0xc6, 0x4d, 0x8f, 0xbc, 0xea, 0x00, 0x49,\n\t0xa0, 0xcb, 0xc9, 0x69, 0x18, 0x27, 0x41, 0x32, 0xc2, 0x0e, 0x38, 0x2b, 0x11, 0x6b, 0x87, 0xe4,\n\t0x43, 0xe2, 0xe1, 0xe6, 0x00, 0x1e, 0x94, 0x63, 0x91, 0x7a, 0x9a, 0x6f, 0xa5, 0x5e, 0x84, 0x11,\n\t0x58, 0x94, 0x3c, 0xea, 0xa7, 0xe6, 0x36, 0x71, 0xe9, 0x0c, 0xe0, 0x52, 0x3d, 0x33, 0xa9, 0xcf,\n\t0x85, 0x56, 0xfa, 0x55, 0x78, 0x0c, 0xe6, 0x93, 0xdb, 0x24, 0x47, 0xdf, 0xce, 0x20, 0xf7, 0x80,\n\t0xb4, 0x0d, 0x7c, 0xf4, 0x49, 0xf7, 0x80, 0x76, 0x05, 0xbe, 0x0f, 0x16, 0x52, 0x76, 0x47, 0x3c,\n\t0x3d, 0x22, 0x9e, 0x36, 0x06, 0xdf, 0x5a, 0xec, 0x6a, 0xb6, 0x95, 0x72, 0x09, 0x2e, 0x83, 0x42,\n\t0xd0, 0xf6, 0x83, 0x23, 0x7e, 0xdc, 0x04, 0xf8, 0x11, 0x7b, 0x7b, 0xc8, 0xcd, 0x13, 0x2b, 0x3b,\n\t0x3c, 0x3e, 0x06, 0x66, 0x29, 0x48, 0xab, 0x6d, 0xe7, 0xb5, 0x1e, 0xb7, 0xb6, 0x87, 0x5c, 0x48,\n\t0x68, 0xd4, 0x5a, 0x8a, 0x08, 0x58, 0xb7, 0x7f, 0xc0, 0x27, 0x12, 0xc4, 0xca, 0x7a, 0xf7, 0x22,\n\t0xa0, 0x5f, 0x59, 0xdb, 0x86, 0x6c, 0xbc, 0x01, 0x88, 0x91, 0x76, 0xe1, 0x05, 0x00, 0x18, 0x04,\n\t0xdf, 0x87, 0x11, 0x7e, 0x10, 0xdd, 0x1e, 0x72, 0xc7, 0x29, 0x02, 0xdf, 0x5b, 0xca, 0x56, 0x1d,\n\t0x1b, 0x75, 0x2d, 0xa3, 0x34, 0xac, 0x6c, 0xd5, 0xb1, 0x63, 0x47, 0x54, 0x7b, 0x7a, 0xf8, 0xf1,\n\t0x58, 0x38, 0xa2, 0x62, 0x22, 0x78, 0x98, 0x90, 0xbc, 0xc2, 0x8f, 0xc6, 0x82, 0x87, 0x09, 0x43,\n\t0x85, 0x47, 0x43, 0xca, 0xf6, 0xe1, 0xe0, 0x8f, 0x78, 0x22, 0x66, 0x52, 0x9e, 0x3d, 0xe9, 0x69,\n\t0x8c, 0x88, 0x0c, 0x9b, 0xa6, 0xa1, 0x5f, 0x19, 0x24, 0xf7, 0x8b, 0x2b, 0x74, 0xdc, 0xb6, 0xc2,\n\t0xe7, 0x3c, 0x2b, 0x78, 0xab, 0xef, 0x79, 0xcd, 0x9e, 0x1f, 0x3f, 0xa6, 0x61, 0xd3, 0x33, 0xba,\n\t0x0e, 0xba, 0x60, 0x5e, 0x9d, 0xd1, 0x08, 0xc6, 0x5f, 0x1b, 0xec, 0xd1, 0x56, 0x67, 0x24, 0x7a,\n\t0x47, 0x29, 0x67, 0x95, 0x49, 0x4e, 0x06, 0xa7, 0x63, 0x0b, 0xce, 0xdf, 0xf4, 0xe1, 0x74, 0xec,\n\t0x24, 0xa7, 0x63, 0x73, 0xce, 0x03, 0xe9, 0x21, 0xbf, 0xa7, 0x06, 0xfa, 0x5b, 0x4a, 0x7a, 0x3e,\n\t0x41, 0x7a, 0x20, 0x45, 0x3a, 0xa7, 0x0e, 0x89, 0xb2, 0x68, 0xa5, 0x58, 0x7f, 0xd7, 0x8f, 0x96,\n\t0x07, 0x3b, 0xa7, 0x8e, 0x94, 0xd2, 0x32, 0x40, 0x1a, 0x47, 0xb0, 0xfe, 0x3e, 0x2b, 0x03, 0xa4,\n\t0x97, 0xb4, 0x0c, 0x10, 0x5b, 0x5a, 0xa8, 0xb4, 0xd3, 0x04, 0xe9, 0x1f, 0xb2, 0x42, 0xa5, 0xcd,\n\t0xa7, 0x85, 0x4a, 0x8d, 0x69, 0xb4, 0x4c, 0x61, 0x38, 0xed, 0x1f, 0xb3, 0x68, 0xe9, 0x4d, 0xa8,\n\t0xd1, 0x52, 0x63, 0x5a, 0x06, 0xc8, 0x3d, 0x2a, 0x58, 0xff, 0x94, 0x95, 0x01, 0x72, 0xdb, 0x6a,\n\t0x19, 0x20, 0x36, 0xce, 0xb9, 0x27, 0x3d, 0x1c, 0x28, 0xcd, 0xff, 0x67, 0x83, 0xc8, 0x60, 0xdf,\n\t0xe6, 0x97, 0x1f, 0x0a, 0xa5, 0x20, 0xd5, 0x91, 0x81, 0x60, 0xfc, 0x8b, 0xc1, 0x9e, 0xb4, 0xfa,\n\t0x35, 0xbf, 0x32, 0x58, 0xc8, 0xe0, 0x94, 0x1a, 0xea, 0xaf, 0x7d, 0x38, 0x45, 0xf3, 0x2b, 0x53,\n\t0x08, 0xa9, 0x46, 0xda, 0x30, 0x42, 0x90, 0xfe, 0x8d, 0x92, 0x9e, 0xd2, 0xfc, 0xea, 0xcc, 0x22,\n\t0x8b, 0x56, 0x8a, 0xf5, 0xef, 0xfd, 0x68, 0x45, 0xf3, 0xab, 0x13, 0x8e, 0xb4, 0x0c, 0xa8, 0xcd,\n\t0xff, 0x8f, 0xac, 0x0c, 0xc8, 0xcd, 0xaf, 0x0c, 0x03, 0xd2, 0x42, 0xd5, 0x9a, 0xff, 0x9f, 0x59,\n\t0xa1, 0x2a, 0xcd, 0xaf, 0x8e, 0x0e, 0xd2, 0x68, 0xb5, 0xe6, 0xff, 0x57, 0x16, 0xad, 0xd2, 0xfc,\n\t0xea, 0xb3, 0x68, 0x5a, 0x06, 0xd4, 0xe6, 0xff, 0x77, 0x56, 0x06, 0xe4, 0xe6, 0x57, 0x06, 0x0e,\n\t0x9c, 0xf3, 0xa1, 0x34, 0xd7, 0xe5, 0xef, 0x70, 0xd0, 0x77, 0x73, 0x6c, 0x4e, 0x96, 0xd8, 0x3b,\n\t0x43, 0xc4, 0x33, 0x5f, 0x6e, 0x81, 0x8f, 0x80, 0x18, 0x1a, 0xd6, 0xc4, 0xcb, 0x1a, 0xf4, 0xbd,\n\t0x5c, 0xc6, 0xf9, 0xf1, 0x94, 0x43, 0x5c, 0xe1, 0x5f, 0x98, 0xe0, 0x47, 0xc1, 0x8c, 0x34, 0xc4,\n\t0xe6, 0x2f, 0x8e, 0xd0, 0xf7, 0xb3, 0xc8, 0xaa, 0x18, 0xf3, 0xd8, 0x8b, 0x5e, 0xc6, 0x64, 0xc2,\n\t0x04, 0xb7, 0xd4, 0xb9, 0x70, 0xaf, 0xde, 0x45, 0x3f, 0xa0, 0x44, 0x0b, 0x69, 0x45, 0xe8, 0xd5,\n\t0xbb, 0xca, 0xc4, 0xb8, 0x57, 0xef, 0xc2, 0x4d, 0x20, 0x66, 0x8b, 0x35, 0xaf, 0x7d, 0x82, 0x7e,\n\t0x48, 0xd7, 0xcf, 0x26, 0xd6, 0x6f, 0xb5, 0x4f, 0xdc, 0x3c, 0x87, 0x6e, 0xb5, 0x4f, 0xe0, 0x5d,\n\t0x69, 0xd6, 0xfc, 0x0a, 0x97, 0x01, 0xfd, 0x88, 0xae, 0x9d, 0x4f, 0xac, 0xa5, 0x55, 0x12, 0xd3,\n\t0x4d, 0xf2, 0x15, 0x97, 0x27, 0x6e, 0x50, 0x5e, 0x9e, 0x1f, 0xe7, 0x48, 0xb5, 0xfb, 0x95, 0x47,\n\t0xf4, 0xa5, 0x54, 0x1e, 0x41, 0x14, 0x97, 0xe7, 0x27, 0xb9, 0x0c, 0x85, 0x93, 0xca, 0xc3, 0x97,\n\t0xc5, 0xe5, 0x91, 0xb9, 0x48, 0x79, 0x48, 0x75, 0x7e, 0x9a, 0xc5, 0x25, 0x55, 0x27, 0x1e, 0x0a,\n\t0xb2, 0x55, 0xb8, 0x3a, 0xf2, 0xad, 0x82, 0xab, 0xf3, 0x4b, 0x4a, 0x94, 0x5d, 0x1d, 0xe9, 0xee,\n\t0x60, 0xd5, 0x11, 0x14, 0xb8, 0x3a, 0x3f, 0xa3, 0xeb, 0x33, 0xaa, 0xc3, 0xa1, 0xac, 0x3a, 0x62,\n\t0x25, 0xad, 0xce, 0xcf, 0xe9, 0xda, 0xcc, 0xea, 0x70, 0x38, 0xad, 0xce, 0x05, 0x00, 0xc8, 0xfe,\n\t0xdb, 0x5e, 0xcb, 0x5f, 0x43, 0x9f, 0x36, 0xc9, 0x6b, 0x28, 0xc9, 0x04, 0x2d, 0x90, 0xa7, 0xfd,\n\t0x8b, 0xbf, 0xae, 0xa3, 0xcf, 0xc8, 0x88, 0x5d, 0x6c, 0x82, 0x17, 0x41, 0xa1, 0x16, 0x43, 0x36,\n\t0xd0, 0x67, 0x19, 0xa4, 0xca, 0x21, 0x1b, 0x70, 0x09, 0x4c, 0x50, 0x04, 0x81, 0xd8, 0x35, 0xf4,\n\t0x39, 0x9d, 0x86, 0xfc, 0x3d, 0x49, 0xbe, 0xad, 0x62, 0xc8, 0x4d, 0xf4, 0x79, 0x8a, 0x90, 0x6d,\n\t0x70, 0x99, 0xd3, 0xac, 0x12, 0x1e, 0x07, 0x7d, 0x41, 0x01, 0x61, 0x1e, 0x47, 0xec, 0x08, 0x7f,\n\t0xbb, 0x85, 0xbe, 0xa8, 0x3b, 0xba, 0x85, 0x01, 0x22, 0xb4, 0x4d, 0xf4, 0x25, 0x3d, 0xda, 0xcd,\n\t0x78, 0xcb, 0xf8, 0xeb, 0x6d, 0xf4, 0x65, 0x9d, 0xe2, 0x36, 0x5c, 0x02, 0x85, 0xaa, 0x40, 0xac,\n\t0xad, 0xa2, 0xaf, 0xb0, 0x38, 0x04, 0xc9, 0xda, 0x2a, 0xc1, 0xec, 0x54, 0xde, 0x7d, 0x50, 0xdb,\n\t0xdd, 0x7a, 0x5c, 0x59, 0x5b, 0x43, 0x5f, 0xe5, 0x18, 0x6c, 0xa4, 0xb6, 0x18, 0x43, 0x72, 0xbd,\n\t0x8e, 0xbe, 0xa6, 0x60, 0x88, 0x0d, 0x5e, 0x02, 0x93, 0x35, 0x29, 0xbf, 0x6b, 0x1b, 0xe8, 0xeb,\n\t0x09, 0x6f, 0x1b, 0x14, 0x55, 0x8d, 0x51, 0x36, 0xfa, 0x46, 0x02, 0x65, 0xc7, 0x09, 0xa4, 0xa0,\n\t0x9b, 0xe8, 0x9b, 0x72, 0x02, 0x09, 0x48, 0xca, 0x32, 0xdd, 0x9d, 0x83, 0xbe, 0x95, 0x00, 0x39,\n\t0xd8, 0x9f, 0x14, 0xd3, 0xad, 0x5a, 0x0d, 0x7d, 0x3b, 0x81, 0xba, 0x85, 0x51, 0x52, 0x4c, 0x9b,\n\t0xb5, 0x1a, 0xfa, 0x4e, 0x22, 0xaa, 0xcd, 0xc5, 0xe7, 0x60, 0x42, 0x7d, 0xd0, 0x29, 0x00, 0xc3,\n\t0x63, 0x6f, 0x44, 0x0d, 0x0f, 0xbe, 0x0d, 0xf2, 0xf5, 0x40, 0xbc, 0xd4, 0x40, 0xb9, 0xd3, 0x5e,\n\t0x80, 0xc8, 0xe8, 0xc5, 0x7b, 0x00, 0x26, 0x87, 0x94, 0xb0, 0x08, 0xcc, 0x97, 0xfe, 0x09, 0x73,\n\t0x81, 0x7f, 0x85, 0xb3, 0xe0, 0x0c, 0xbd, 0x7d, 0x72, 0xc4, 0x46, 0xbf, 0xdc, 0xc9, 0x6d, 0x1a,\n\t0x31, 0x83, 0x3c, 0x90, 0x94, 0x19, 0xcc, 0x14, 0x06, 0x53, 0x66, 0x28, 0x83, 0xd9, 0xb4, 0xd1,\n\t0xa3, 0xcc, 0x31, 0x91, 0xc2, 0x31, 0x91, 0xce, 0xa1, 0x8c, 0x18, 0x65, 0x8e, 0xe1, 0x14, 0x8e,\n\t0xe1, 0x24, 0x47, 0x62, 0x94, 0x28, 0x73, 0x4c, 0xa7, 0x70, 0x4c, 0xa7, 0x73, 0x28, 0x23, 0x43,\n\t0x99, 0x03, 0xa6, 0x70, 0x40, 0x99, 0xe3, 0x01, 0x98, 0x4f, 0x1f, 0x0c, 0xca, 0x2c, 0xa3, 0x29,\n\t0x2c, 0xa3, 0x19, 0x2c, 0xea, 0xf0, 0x4f, 0x66, 0x19, 0x49, 0x61, 0x19, 0x91, 0x59, 0xaa, 0x00,\n\t0x65, 0x8d, 0xf7, 0x64, 0x9e, 0xa9, 0x14, 0x9e, 0xa9, 0x2c, 0x1e, 0x6d, 0x7c, 0x27, 0xf3, 0x14,\n\t0x53, 0x78, 0x8a, 0xa9, 0xdd, 0x26, 0x0f, 0xe9, 0x4e, 0xeb, 0xd7, 0x9c, 0xcc, 0xb0, 0x05, 0x66,\n\t0x52, 0xe6, 0x71, 0xa7, 0x51, 0x18, 0x32, 0xc5, 0x5d, 0x50, 0xd4, 0x87, 0x6f, 0xf2, 0xfa, 0xb1,\n\t0x94, 0xf5, 0x63, 0x29, 0x4d, 0xa2, 0x0f, 0xda, 0x64, 0x8e, 0xf1, 0x14, 0x8e, 0xf1, 0xe4, 0x36,\n\t0xf4, 0x89, 0xda, 0x69, 0x14, 0x05, 0x99, 0x22, 0x04, 0xe7, 0xfa, 0x8c, 0xcc, 0x52, 0xa8, 0xde,\n\t0x91, 0xa9, 0x5e, 0xe3, 0x7d, 0x95, 0xe4, 0xf3, 0x18, 0x9c, 0xef, 0x37, 0x33, 0x4b, 0x71, 0xba,\n\t0xa6, 0x3a, 0xed, 0xfb, 0x0a, 0x4b, 0x72, 0xd4, 0xa4, 0x0d, 0x97, 0x36, 0x2b, 0x4b, 0x71, 0x72,\n\t0x47, 0x76, 0x32, 0xe8, 0x4b, 0x2d, 0xc9, 0x9b, 0x07, 0xce, 0x66, 0xce, 0xcb, 0x52, 0xdc, 0xad,\n\t0xa8, 0xee, 0xb2, 0x5f, 0x75, 0xc5, 0x2e, 0x96, 0x6e, 0x03, 0x20, 0x4d, 0xf6, 0x46, 0x81, 0x59,\n\t0xdd, 0xdb, 0x2b, 0x0e, 0xe1, 0x5f, 0xca, 0x5b, 0x6e, 0xd1, 0xa0, 0xbf, 0x3c, 0x2f, 0xe6, 0xb0,\n\t0xbb, 0xdd, 0xca, 0xc3, 0xe2, 0x7f, 0xf9, 0x7f, 0x46, 0x79, 0x42, 0x8c, 0xa2, 0xf0, 0xa9, 0xb2,\n\t0xf4, 0x06, 0x98, 0xd4, 0x06, 0x92, 0x05, 0x60, 0xd4, 0xf9, 0x81, 0x52, 0xbf, 0x76, 0x13, 0x80,\n\t0xf8, 0xdf, 0x30, 0xc1, 0x29, 0x90, 0x3f, 0xd8, 0xdd, 0x7f, 0x52, 0xb9, 0xbf, 0x53, 0xdd, 0xa9,\n\t0x3c, 0x28, 0x0e, 0xc1, 0x02, 0x18, 0x7b, 0xe2, 0xee, 0x3d, 0xdd, 0x2b, 0x1f, 0x54, 0x8b, 0x06,\n\t0x1c, 0x03, 0xc3, 0x8f, 0xf6, 0xf7, 0x76, 0x8b, 0xb9, 0x6b, 0xf7, 0x40, 0x5e, 0x9e, 0x07, 0x4e,\n\t0x81, 0x7c, 0x75, 0xcf, 0xad, 0xec, 0x3c, 0xdc, 0xad, 0xd1, 0x48, 0x25, 0x03, 0x8d, 0x58, 0x31,\n\t0x3c, 0x2f, 0xe6, 0xca, 0x17, 0xc1, 0x85, 0x7a, 0xd0, 0x4a, 0xfc, 0x61, 0x26, 0x25, 0xe7, 0xc5,\n\t0x08, 0xb1, 0x6e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc2, 0x0c, 0xb6, 0xeb, 0x26, 0x00,\n\t0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/_conformance/conformance_proto/conformance.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\npackage conformance;\noption java_package = \"com.google.protobuf.conformance\";\n\nimport \"google/protobuf/any.proto\";\nimport \"google/protobuf/duration.proto\";\nimport \"google/protobuf/field_mask.proto\";\nimport \"google/protobuf/struct.proto\";\nimport \"google/protobuf/timestamp.proto\";\nimport \"google/protobuf/wrappers.proto\";\n\n// This defines the conformance testing protocol.  This protocol exists between\n// the conformance test suite itself and the code being tested.  For each test,\n// the suite will send a ConformanceRequest message and expect a\n// ConformanceResponse message.\n//\n// You can either run the tests in two different ways:\n//\n//   1. in-process (using the interface in conformance_test.h).\n//\n//   2. as a sub-process communicating over a pipe.  Information about how to\n//      do this is in conformance_test_runner.cc.\n//\n// Pros/cons of the two approaches:\n//\n//   - running as a sub-process is much simpler for languages other than C/C++.\n//\n//   - running as a sub-process may be more tricky in unusual environments like\n//     iOS apps, where fork/stdin/stdout are not available.\n\nenum WireFormat {\n  UNSPECIFIED = 0;\n  PROTOBUF = 1;\n  JSON = 2;\n}\n\n// Represents a single test case's input.  The testee should:\n//\n//   1. parse this proto (which should always succeed)\n//   2. parse the protobuf or JSON payload in \"payload\" (which may fail)\n//   3. if the parse succeeded, serialize the message in the requested format.\nmessage ConformanceRequest {\n  // The payload (whether protobuf of JSON) is always for a TestAllTypes proto\n  // (see below).\n  oneof payload {\n    bytes protobuf_payload = 1;\n    string json_payload = 2;\n  }\n\n  // Which format should the testee serialize its message to?\n  WireFormat requested_output_format = 3;\n}\n\n// Represents a single test case's output.\nmessage ConformanceResponse {\n  oneof result {\n    // This string should be set to indicate parsing failed.  The string can\n    // provide more information about the parse error if it is available.\n    //\n    // Setting this string does not necessarily mean the testee failed the\n    // test.  Some of the test cases are intentionally invalid input.\n    string parse_error = 1;\n\n    // If the input was successfully parsed but errors occurred when\n    // serializing it to the requested output format, set the error message in\n    // this field.\n    string serialize_error = 6;\n\n    // This should be set if some other error occurred.  This will always\n    // indicate that the test failed.  The string can provide more information\n    // about the failure.\n    string runtime_error = 2;\n\n    // If the input was successfully parsed and the requested output was\n    // protobuf, serialize it to protobuf and set it in this field.\n    bytes protobuf_payload = 3;\n\n    // If the input was successfully parsed and the requested output was JSON,\n    // serialize to JSON and set it in this field.\n    string json_payload = 4;\n\n    // For when the testee skipped the test, likely because a certain feature\n    // wasn't supported, like JSON input/output.\n    string skipped = 5;\n  }\n}\n\n// This proto includes every type of field in both singular and repeated\n// forms.\nmessage TestAllTypes {\n  message NestedMessage {\n    int32 a = 1;\n    TestAllTypes corecursive = 2;\n  }\n\n  enum NestedEnum {\n    FOO = 0;\n    BAR = 1;\n    BAZ = 2;\n    NEG = -1;  // Intentionally negative.\n  }\n\n  // Singular\n  int32 optional_int32    =  1;\n  int64 optional_int64    =  2;\n  uint32 optional_uint32   =  3;\n  uint64 optional_uint64   =  4;\n  sint32 optional_sint32   =  5;\n  sint64 optional_sint64   =  6;\n  fixed32 optional_fixed32  =  7;\n  fixed64 optional_fixed64  =  8;\n  sfixed32 optional_sfixed32 =  9;\n  sfixed64 optional_sfixed64 = 10;\n  float optional_float    = 11;\n  double optional_double   = 12;\n  bool optional_bool     = 13;\n  string optional_string   = 14;\n  bytes optional_bytes    = 15;\n\n  NestedMessage                        optional_nested_message  = 18;\n  ForeignMessage                       optional_foreign_message = 19;\n\n  NestedEnum                           optional_nested_enum     = 21;\n  ForeignEnum                          optional_foreign_enum    = 22;\n\n  string optional_string_piece = 24 [ctype=STRING_PIECE];\n  string optional_cord = 25 [ctype=CORD];\n\n  TestAllTypes recursive_message = 27;\n\n  // Repeated\n  repeated    int32 repeated_int32    = 31;\n  repeated    int64 repeated_int64    = 32;\n  repeated   uint32 repeated_uint32   = 33;\n  repeated   uint64 repeated_uint64   = 34;\n  repeated   sint32 repeated_sint32   = 35;\n  repeated   sint64 repeated_sint64   = 36;\n  repeated  fixed32 repeated_fixed32  = 37;\n  repeated  fixed64 repeated_fixed64  = 38;\n  repeated sfixed32 repeated_sfixed32 = 39;\n  repeated sfixed64 repeated_sfixed64 = 40;\n  repeated    float repeated_float    = 41;\n  repeated   double repeated_double   = 42;\n  repeated     bool repeated_bool     = 43;\n  repeated   string repeated_string   = 44;\n  repeated    bytes repeated_bytes    = 45;\n\n  repeated NestedMessage                        repeated_nested_message  = 48;\n  repeated ForeignMessage                       repeated_foreign_message = 49;\n\n  repeated NestedEnum                           repeated_nested_enum     = 51;\n  repeated ForeignEnum                          repeated_foreign_enum    = 52;\n\n  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];\n  repeated string repeated_cord = 55 [ctype=CORD];\n\n  // Map\n  map <   int32, int32>    map_int32_int32 = 56;\n  map <   int64, int64>    map_int64_int64 = 57;\n  map <  uint32, uint32>   map_uint32_uint32 = 58;\n  map <  uint64, uint64>   map_uint64_uint64 = 59;\n  map <  sint32, sint32>   map_sint32_sint32 = 60;\n  map <  sint64, sint64>   map_sint64_sint64 = 61;\n  map < fixed32, fixed32>  map_fixed32_fixed32 = 62;\n  map < fixed64, fixed64>  map_fixed64_fixed64 = 63;\n  map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;\n  map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;\n  map <   int32, float>    map_int32_float = 66;\n  map <   int32, double>   map_int32_double = 67;\n  map <    bool, bool>     map_bool_bool = 68;\n  map <  string, string>   map_string_string = 69;\n  map <  string, bytes>    map_string_bytes = 70;\n  map <  string, NestedMessage>  map_string_nested_message = 71;\n  map <  string, ForeignMessage> map_string_foreign_message = 72;\n  map <  string, NestedEnum>     map_string_nested_enum = 73;\n  map <  string, ForeignEnum>    map_string_foreign_enum = 74;\n\n  oneof oneof_field {\n    uint32 oneof_uint32 = 111;\n    NestedMessage oneof_nested_message = 112;\n    string oneof_string = 113;\n    bytes oneof_bytes = 114;\n    bool oneof_bool = 115;\n    uint64 oneof_uint64 = 116;\n    float oneof_float = 117;\n    double oneof_double = 118;\n    NestedEnum oneof_enum = 119;\n  }\n\n  // Well-known types\n  google.protobuf.BoolValue optional_bool_wrapper = 201;\n  google.protobuf.Int32Value optional_int32_wrapper = 202;\n  google.protobuf.Int64Value optional_int64_wrapper = 203;\n  google.protobuf.UInt32Value optional_uint32_wrapper = 204;\n  google.protobuf.UInt64Value optional_uint64_wrapper = 205;\n  google.protobuf.FloatValue optional_float_wrapper = 206;\n  google.protobuf.DoubleValue optional_double_wrapper = 207;\n  google.protobuf.StringValue optional_string_wrapper = 208;\n  google.protobuf.BytesValue optional_bytes_wrapper = 209;\n\n  repeated google.protobuf.BoolValue repeated_bool_wrapper = 211;\n  repeated google.protobuf.Int32Value repeated_int32_wrapper = 212;\n  repeated google.protobuf.Int64Value repeated_int64_wrapper = 213;\n  repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214;\n  repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215;\n  repeated google.protobuf.FloatValue repeated_float_wrapper = 216;\n  repeated google.protobuf.DoubleValue repeated_double_wrapper = 217;\n  repeated google.protobuf.StringValue repeated_string_wrapper = 218;\n  repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219;\n\n  google.protobuf.Duration optional_duration = 301;\n  google.protobuf.Timestamp optional_timestamp = 302;\n  google.protobuf.FieldMask optional_field_mask = 303;\n  google.protobuf.Struct optional_struct = 304;\n  google.protobuf.Any optional_any = 305;\n  google.protobuf.Value optional_value = 306;\n\n  repeated google.protobuf.Duration repeated_duration = 311;\n  repeated google.protobuf.Timestamp repeated_timestamp = 312;\n  repeated google.protobuf.FieldMask repeated_fieldmask = 313;\n  repeated google.protobuf.Struct repeated_struct = 324;\n  repeated google.protobuf.Any repeated_any = 315;\n  repeated google.protobuf.Value repeated_value = 316;\n\n  // Test field-name-to-JSON-name convention.\n  // (protobuf says names can be any valid C/C++ identifier.)\n  int32 fieldname1 = 401;\n  int32 field_name2 = 402;\n  int32 _field_name3 = 403;\n  int32 field__name4_ = 404;\n  int32 field0name5 = 405;\n  int32 field_0_name6 = 406;\n  int32 fieldName7 = 407;\n  int32 FieldName8 = 408;\n  int32 field_Name9 = 409;\n  int32 Field_Name10 = 410;\n  int32 FIELD_NAME11 = 411;\n  int32 FIELD_name12 = 412;\n  int32 __field_name13 = 413;\n  int32 __Field_name14 = 414;\n  int32 field__name15 = 415;\n  int32 field__Name16 = 416;\n  int32 field_name17__ = 417;\n  int32 Field_name18__ = 418;\n}\n\nmessage ForeignMessage {\n  int32 c = 1;\n}\n\nenum ForeignEnum {\n  FOREIGN_FOO = 0;\n  FOREIGN_BAR = 1;\n  FOREIGN_BAZ = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/descriptor/descriptor.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Package descriptor provides functions for obtaining protocol buffer\n// descriptors for generated Go types.\n//\n// These functions cannot go in package proto because they depend on the\n// generated protobuf descriptor messages, which themselves depend on proto.\npackage descriptor\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tprotobuf \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\n// extractFile extracts a FileDescriptorProto from a gzip'd buffer.\nfunc extractFile(gz []byte) (*protobuf.FileDescriptorProto, error) {\n\tr, err := gzip.NewReader(bytes.NewReader(gz))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open gzip reader: %v\", err)\n\t}\n\tdefer r.Close()\n\n\tb, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to uncompress descriptor: %v\", err)\n\t}\n\n\tfd := new(protobuf.FileDescriptorProto)\n\tif err := proto.Unmarshal(b, fd); err != nil {\n\t\treturn nil, fmt.Errorf(\"malformed FileDescriptorProto: %v\", err)\n\t}\n\n\treturn fd, nil\n}\n\n// Message is a proto.Message with a method to return its descriptor.\n//\n// Message types generated by the protocol compiler always satisfy\n// the Message interface.\ntype Message interface {\n\tproto.Message\n\tDescriptor() ([]byte, []int)\n}\n\n// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it\n// describing the given message.\nfunc ForMessage(msg Message) (fd *protobuf.FileDescriptorProto, md *protobuf.DescriptorProto) {\n\tgz, path := msg.Descriptor()\n\tfd, err := extractFile(gz)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"invalid FileDescriptorProto for %T: %v\", msg, err))\n\t}\n\n\tmd = fd.MessageType[path[0]]\n\tfor _, i := range path[1:] {\n\t\tmd = md.NestedType[i]\n\t}\n\treturn fd, md\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/descriptor/descriptor_test.go",
    "content": "package descriptor_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/descriptor\"\n\ttpb \"github.com/golang/protobuf/proto/testdata\"\n\tprotobuf \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\nfunc TestMessage(t *testing.T) {\n\tvar msg *protobuf.DescriptorProto\n\tfd, md := descriptor.ForMessage(msg)\n\tif pkg, want := fd.GetPackage(), \"google.protobuf\"; pkg != want {\n\t\tt.Errorf(\"descriptor.ForMessage(%T).GetPackage() = %q; want %q\", msg, pkg, want)\n\t}\n\tif name, want := md.GetName(), \"DescriptorProto\"; name != want {\n\t\tt.Fatalf(\"descriptor.ForMessage(%T).GetName() = %q; want %q\", msg, name, want)\n\t}\n}\n\nfunc Example_Options() {\n\tvar msg *tpb.MyMessageSet\n\t_, md := descriptor.ForMessage(msg)\n\tif md.GetOptions().GetMessageSetWireFormat() {\n\t\tfmt.Printf(\"%v uses option message_set_wire_format.\\n\", md.GetName())\n\t}\n\n\t// Output:\n\t// MyMessageSet uses option message_set_wire_format.\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/*\nPackage jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.\nIt follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json.\n\nThis package produces a different output than the standard \"encoding/json\" package,\nwhich does not operate correctly on protocol buffers.\n*/\npackage jsonpb\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tstpb \"github.com/golang/protobuf/ptypes/struct\"\n)\n\n// Marshaler is a configurable object for converting between\n// protocol buffer objects and a JSON representation for them.\ntype Marshaler struct {\n\t// Whether to render enum values as integers, as opposed to string values.\n\tEnumsAsInts bool\n\n\t// Whether to render fields with zero values.\n\tEmitDefaults bool\n\n\t// A string to indent each level by. The presence of this field will\n\t// also cause a space to appear between the field separator and\n\t// value, and for newlines to be appear between fields and array\n\t// elements.\n\tIndent string\n\n\t// Whether to use the original (.proto) name for fields.\n\tOrigName bool\n\n\t// A custom URL resolver to use when marshaling Any messages to JSON.\n\t// If unset, the default resolution strategy is to extract the\n\t// fully-qualified type name from the type URL and pass that to\n\t// proto.MessageType(string).\n\tAnyResolver AnyResolver\n}\n\n// AnyResolver takes a type URL, present in an Any message, and resolves it into\n// an instance of the associated message.\ntype AnyResolver interface {\n\tResolve(typeUrl string) (proto.Message, error)\n}\n\nfunc defaultResolveAny(typeUrl string) (proto.Message, error) {\n\t// Only the part of typeUrl after the last slash is relevant.\n\tmname := typeUrl\n\tif slash := strings.LastIndex(mname, \"/\"); slash >= 0 {\n\t\tmname = mname[slash+1:]\n\t}\n\tmt := proto.MessageType(mname)\n\tif mt == nil {\n\t\treturn nil, fmt.Errorf(\"unknown message type %q\", mname)\n\t}\n\treturn reflect.New(mt.Elem()).Interface().(proto.Message), nil\n}\n\n// JSONPBMarshaler is implemented by protobuf messages that customize the\n// way they are marshaled to JSON. Messages that implement this should\n// also implement JSONPBUnmarshaler so that the custom format can be\n// parsed.\ntype JSONPBMarshaler interface {\n\tMarshalJSONPB(*Marshaler) ([]byte, error)\n}\n\n// JSONPBUnmarshaler is implemented by protobuf messages that customize\n// the way they are unmarshaled from JSON. Messages that implement this\n// should also implement JSONPBMarshaler so that the custom format can be\n// produced.\ntype JSONPBUnmarshaler interface {\n\tUnmarshalJSONPB(*Unmarshaler, []byte) error\n}\n\n// Marshal marshals a protocol buffer into JSON.\nfunc (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error {\n\twriter := &errWriter{writer: out}\n\treturn m.marshalObject(writer, pb, \"\", \"\")\n}\n\n// MarshalToString converts a protocol buffer object to JSON string.\nfunc (m *Marshaler) MarshalToString(pb proto.Message) (string, error) {\n\tvar buf bytes.Buffer\n\tif err := m.Marshal(&buf, pb); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}\n\ntype int32Slice []int32\n\nvar nonFinite = map[string]float64{\n\t`\"NaN\"`:       math.NaN(),\n\t`\"Infinity\"`:  math.Inf(1),\n\t`\"-Infinity\"`: math.Inf(-1),\n}\n\n// For sorting extensions ids to ensure stable output.\nfunc (s int32Slice) Len() int           { return len(s) }\nfunc (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }\nfunc (s int32Slice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }\n\ntype wkt interface {\n\tXXX_WellKnownType() string\n}\n\n// marshalObject writes a struct to the Writer.\nfunc (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error {\n\tif jsm, ok := v.(JSONPBMarshaler); ok {\n\t\tb, err := jsm.MarshalJSONPB(m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif typeURL != \"\" {\n\t\t\t// we are marshaling this object to an Any type\n\t\t\tvar js map[string]*json.RawMessage\n\t\t\tif err = json.Unmarshal(b, &js); err != nil {\n\t\t\t\treturn fmt.Errorf(\"type %T produced invalid JSON: %v\", v, err)\n\t\t\t}\n\t\t\tturl, err := json.Marshal(typeURL)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to marshal type URL %q to JSON: %v\", typeURL, err)\n\t\t\t}\n\t\t\tjs[\"@type\"] = (*json.RawMessage)(&turl)\n\t\t\tif b, err = json.Marshal(js); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tout.write(string(b))\n\t\treturn out.err\n\t}\n\n\ts := reflect.ValueOf(v).Elem()\n\n\t// Handle well-known types.\n\tif wkt, ok := v.(wkt); ok {\n\t\tswitch wkt.XXX_WellKnownType() {\n\t\tcase \"DoubleValue\", \"FloatValue\", \"Int64Value\", \"UInt64Value\",\n\t\t\t\"Int32Value\", \"UInt32Value\", \"BoolValue\", \"StringValue\", \"BytesValue\":\n\t\t\t// \"Wrappers use the same representation in JSON\n\t\t\t//  as the wrapped primitive type, ...\"\n\t\t\tsprop := proto.GetProperties(s.Type())\n\t\t\treturn m.marshalValue(out, sprop.Prop[0], s.Field(0), indent)\n\t\tcase \"Any\":\n\t\t\t// Any is a bit more involved.\n\t\t\treturn m.marshalAny(out, v, indent)\n\t\tcase \"Duration\":\n\t\t\t// \"Generated output always contains 3, 6, or 9 fractional digits,\n\t\t\t//  depending on required precision.\"\n\t\t\ts, ns := s.Field(0).Int(), s.Field(1).Int()\n\t\t\td := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond\n\t\t\tx := fmt.Sprintf(\"%.9f\", d.Seconds())\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tout.write(`\"`)\n\t\t\tout.write(x)\n\t\t\tout.write(`s\"`)\n\t\t\treturn out.err\n\t\tcase \"Struct\", \"ListValue\":\n\t\t\t// Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice.\n\t\t\t// TODO: pass the correct Properties if needed.\n\t\t\treturn m.marshalValue(out, &proto.Properties{}, s.Field(0), indent)\n\t\tcase \"Timestamp\":\n\t\t\t// \"RFC 3339, where generated output will always be Z-normalized\n\t\t\t//  and uses 3, 6 or 9 fractional digits.\"\n\t\t\ts, ns := s.Field(0).Int(), s.Field(1).Int()\n\t\t\tt := time.Unix(s, ns).UTC()\n\t\t\t// time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits).\n\t\t\tx := t.Format(\"2006-01-02T15:04:05.000000000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tx = strings.TrimSuffix(x, \"000\")\n\t\t\tout.write(`\"`)\n\t\t\tout.write(x)\n\t\t\tout.write(`Z\"`)\n\t\t\treturn out.err\n\t\tcase \"Value\":\n\t\t\t// Value has a single oneof.\n\t\t\tkind := s.Field(0)\n\t\t\tif kind.IsNil() {\n\t\t\t\t// \"absence of any variant indicates an error\"\n\t\t\t\treturn errors.New(\"nil Value\")\n\t\t\t}\n\t\t\t// oneof -> *T -> T -> T.F\n\t\t\tx := kind.Elem().Elem().Field(0)\n\t\t\t// TODO: pass the correct Properties if needed.\n\t\t\treturn m.marshalValue(out, &proto.Properties{}, x, indent)\n\t\t}\n\t}\n\n\tout.write(\"{\")\n\tif m.Indent != \"\" {\n\t\tout.write(\"\\n\")\n\t}\n\n\tfirstField := true\n\n\tif typeURL != \"\" {\n\t\tif err := m.marshalTypeURL(out, indent, typeURL); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfirstField = false\n\t}\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tvalue := s.Field(i)\n\t\tvalueField := s.Type().Field(i)\n\t\tif strings.HasPrefix(valueField.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// IsNil will panic on most value kinds.\n\t\tswitch value.Kind() {\n\t\tcase reflect.Chan, reflect.Func, reflect.Interface:\n\t\t\tif value.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif !m.EmitDefaults {\n\t\t\tswitch value.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\tif !value.Bool() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Int32, reflect.Int64:\n\t\t\t\tif value.Int() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Uint32, reflect.Uint64:\n\t\t\t\tif value.Uint() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\tif value.Float() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.String:\n\t\t\t\tif value.Len() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase reflect.Map, reflect.Ptr, reflect.Slice:\n\t\t\t\tif value.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Oneof fields need special handling.\n\t\tif valueField.Tag.Get(\"protobuf_oneof\") != \"\" {\n\t\t\t// value is an interface containing &T{real_value}.\n\t\t\tsv := value.Elem().Elem() // interface -> *T -> T\n\t\t\tvalue = sv.Field(0)\n\t\t\tvalueField = sv.Type().Field(0)\n\t\t}\n\t\tprop := jsonProperties(valueField, m.OrigName)\n\t\tif !firstField {\n\t\t\tm.writeSep(out)\n\t\t}\n\t\tif err := m.marshalField(out, prop, value, indent); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfirstField = false\n\t}\n\n\t// Handle proto2 extensions.\n\tif ep, ok := v.(proto.Message); ok {\n\t\textensions := proto.RegisteredExtensions(v)\n\t\t// Sort extensions for stable output.\n\t\tids := make([]int32, 0, len(extensions))\n\t\tfor id, desc := range extensions {\n\t\t\tif !proto.HasExtension(ep, desc) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tids = append(ids, id)\n\t\t}\n\t\tsort.Sort(int32Slice(ids))\n\t\tfor _, id := range ids {\n\t\t\tdesc := extensions[id]\n\t\t\tif desc == nil {\n\t\t\t\t// unknown extension\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\text, extErr := proto.GetExtension(ep, desc)\n\t\t\tif extErr != nil {\n\t\t\t\treturn extErr\n\t\t\t}\n\t\t\tvalue := reflect.ValueOf(ext)\n\t\t\tvar prop proto.Properties\n\t\t\tprop.Parse(desc.Tag)\n\t\t\tprop.JSONName = fmt.Sprintf(\"[%s]\", desc.Name)\n\t\t\tif !firstField {\n\t\t\t\tm.writeSep(out)\n\t\t\t}\n\t\t\tif err := m.marshalField(out, &prop, value, indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfirstField = false\n\t\t}\n\n\t}\n\n\tif m.Indent != \"\" {\n\t\tout.write(\"\\n\")\n\t\tout.write(indent)\n\t}\n\tout.write(\"}\")\n\treturn out.err\n}\n\nfunc (m *Marshaler) writeSep(out *errWriter) {\n\tif m.Indent != \"\" {\n\t\tout.write(\",\\n\")\n\t} else {\n\t\tout.write(\",\")\n\t}\n}\n\nfunc (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error {\n\t// \"If the Any contains a value that has a special JSON mapping,\n\t//  it will be converted as follows: {\"@type\": xxx, \"value\": yyy}.\n\t//  Otherwise, the value will be converted into a JSON object,\n\t//  and the \"@type\" field will be inserted to indicate the actual data type.\"\n\tv := reflect.ValueOf(any).Elem()\n\tturl := v.Field(0).String()\n\tval := v.Field(1).Bytes()\n\n\tvar msg proto.Message\n\tvar err error\n\tif m.AnyResolver != nil {\n\t\tmsg, err = m.AnyResolver.Resolve(turl)\n\t} else {\n\t\tmsg, err = defaultResolveAny(turl)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := proto.Unmarshal(val, msg); err != nil {\n\t\treturn err\n\t}\n\n\tif _, ok := msg.(wkt); ok {\n\t\tout.write(\"{\")\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t}\n\t\tif err := m.marshalTypeURL(out, indent, turl); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.writeSep(out)\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t\tout.write(`\"value\": `)\n\t\t} else {\n\t\t\tout.write(`\"value\":`)\n\t\t}\n\t\tif err := m.marshalObject(out, msg, indent+m.Indent, \"\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t}\n\t\tout.write(\"}\")\n\t\treturn out.err\n\t}\n\n\treturn m.marshalObject(out, msg, indent, turl)\n}\n\nfunc (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error {\n\tif m.Indent != \"\" {\n\t\tout.write(indent)\n\t\tout.write(m.Indent)\n\t}\n\tout.write(`\"@type\":`)\n\tif m.Indent != \"\" {\n\t\tout.write(\" \")\n\t}\n\tb, err := json.Marshal(typeURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tout.write(string(b))\n\treturn out.err\n}\n\n// marshalField writes field description and value to the Writer.\nfunc (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {\n\tif m.Indent != \"\" {\n\t\tout.write(indent)\n\t\tout.write(m.Indent)\n\t}\n\tout.write(`\"`)\n\tout.write(prop.JSONName)\n\tout.write(`\":`)\n\tif m.Indent != \"\" {\n\t\tout.write(\" \")\n\t}\n\tif err := m.marshalValue(out, prop, v, indent); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// marshalValue writes the value to the Writer.\nfunc (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {\n\tvar err error\n\tv = reflect.Indirect(v)\n\n\t// Handle nil pointer\n\tif v.Kind() == reflect.Invalid {\n\t\tout.write(\"null\")\n\t\treturn out.err\n\t}\n\n\t// Handle repeated elements.\n\tif v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 {\n\t\tout.write(\"[\")\n\t\tcomma := \"\"\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tsliceVal := v.Index(i)\n\t\t\tout.write(comma)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\t\t\tif err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcomma = \",\"\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(\"]\")\n\t\treturn out.err\n\t}\n\n\t// Handle well-known types.\n\t// Most are handled up in marshalObject (because 99% are messages).\n\tif wkt, ok := v.Interface().(wkt); ok {\n\t\tswitch wkt.XXX_WellKnownType() {\n\t\tcase \"NullValue\":\n\t\t\tout.write(\"null\")\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\t// Handle enumerations.\n\tif !m.EnumsAsInts && prop.Enum != \"\" {\n\t\t// Unknown enum values will are stringified by the proto library as their\n\t\t// value. Such values should _not_ be quoted or they will be interpreted\n\t\t// as an enum string instead of their value.\n\t\tenumStr := v.Interface().(fmt.Stringer).String()\n\t\tvar valStr string\n\t\tif v.Kind() == reflect.Ptr {\n\t\t\tvalStr = strconv.Itoa(int(v.Elem().Int()))\n\t\t} else {\n\t\t\tvalStr = strconv.Itoa(int(v.Int()))\n\t\t}\n\t\tisKnownEnum := enumStr != valStr\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\tout.write(enumStr)\n\t\tif isKnownEnum {\n\t\t\tout.write(`\"`)\n\t\t}\n\t\treturn out.err\n\t}\n\n\t// Handle nested messages.\n\tif v.Kind() == reflect.Struct {\n\t\treturn m.marshalObject(out, v.Addr().Interface().(proto.Message), indent+m.Indent, \"\")\n\t}\n\n\t// Handle maps.\n\t// Since Go randomizes map iteration, we sort keys for stable output.\n\tif v.Kind() == reflect.Map {\n\t\tout.write(`{`)\n\t\tkeys := v.MapKeys()\n\t\tsort.Sort(mapKeys(keys))\n\t\tfor i, k := range keys {\n\t\t\tif i > 0 {\n\t\t\t\tout.write(`,`)\n\t\t\t}\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(\"\\n\")\n\t\t\t\tout.write(indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t\tout.write(m.Indent)\n\t\t\t}\n\n\t\t\tb, err := json.Marshal(k.Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ts := string(b)\n\n\t\t\t// If the JSON is not a string value, encode it again to make it one.\n\t\t\tif !strings.HasPrefix(s, `\"`) {\n\t\t\t\tb, err := json.Marshal(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts = string(b)\n\t\t\t}\n\n\t\t\tout.write(s)\n\t\t\tout.write(`:`)\n\t\t\tif m.Indent != \"\" {\n\t\t\t\tout.write(` `)\n\t\t\t}\n\n\t\t\tif err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif m.Indent != \"\" {\n\t\t\tout.write(\"\\n\")\n\t\t\tout.write(indent)\n\t\t\tout.write(m.Indent)\n\t\t}\n\t\tout.write(`}`)\n\t\treturn out.err\n\t}\n\n\t// Handle non-finite floats, e.g. NaN, Infinity and -Infinity.\n\tif v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {\n\t\tf := v.Float()\n\t\tvar sval string\n\t\tswitch {\n\t\tcase math.IsInf(f, 1):\n\t\t\tsval = `\"Infinity\"`\n\t\tcase math.IsInf(f, -1):\n\t\t\tsval = `\"-Infinity\"`\n\t\tcase math.IsNaN(f):\n\t\t\tsval = `\"NaN\"`\n\t\t}\n\t\tif sval != \"\" {\n\t\t\tout.write(sval)\n\t\t\treturn out.err\n\t\t}\n\t}\n\n\t// Default handling defers to the encoding/json library.\n\tb, err := json.Marshal(v.Interface())\n\tif err != nil {\n\t\treturn err\n\t}\n\tneedToQuote := string(b[0]) != `\"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64)\n\tif needToQuote {\n\t\tout.write(`\"`)\n\t}\n\tout.write(string(b))\n\tif needToQuote {\n\t\tout.write(`\"`)\n\t}\n\treturn out.err\n}\n\n// Unmarshaler is a configurable object for converting from a JSON\n// representation to a protocol buffer object.\ntype Unmarshaler struct {\n\t// Whether to allow messages to contain unknown fields, as opposed to\n\t// failing to unmarshal.\n\tAllowUnknownFields bool\n\n\t// A custom URL resolver to use when unmarshaling Any messages from JSON.\n\t// If unset, the default resolution strategy is to extract the\n\t// fully-qualified type name from the type URL and pass that to\n\t// proto.MessageType(string).\n\tAnyResolver AnyResolver\n}\n\n// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream.\n// This function is lenient and will decode any options permutations of the\n// related Marshaler.\nfunc (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error {\n\tinputValue := json.RawMessage{}\n\tif err := dec.Decode(&inputValue); err != nil {\n\t\treturn err\n\t}\n\treturn u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil)\n}\n\n// Unmarshal unmarshals a JSON object stream into a protocol\n// buffer. This function is lenient and will decode any options\n// permutations of the related Marshaler.\nfunc (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error {\n\tdec := json.NewDecoder(r)\n\treturn u.UnmarshalNext(dec, pb)\n}\n\n// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream.\n// This function is lenient and will decode any options permutations of the\n// related Marshaler.\nfunc UnmarshalNext(dec *json.Decoder, pb proto.Message) error {\n\treturn new(Unmarshaler).UnmarshalNext(dec, pb)\n}\n\n// Unmarshal unmarshals a JSON object stream into a protocol\n// buffer. This function is lenient and will decode any options\n// permutations of the related Marshaler.\nfunc Unmarshal(r io.Reader, pb proto.Message) error {\n\treturn new(Unmarshaler).Unmarshal(r, pb)\n}\n\n// UnmarshalString will populate the fields of a protocol buffer based\n// on a JSON string. This function is lenient and will decode any options\n// permutations of the related Marshaler.\nfunc UnmarshalString(str string, pb proto.Message) error {\n\treturn new(Unmarshaler).Unmarshal(strings.NewReader(str), pb)\n}\n\n// unmarshalValue converts/copies a value into the target.\n// prop may be nil.\nfunc (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error {\n\ttargetType := target.Type()\n\n\t// Allocate memory for pointer fields.\n\tif targetType.Kind() == reflect.Ptr {\n\t\t// If input value is \"null\" and target is a pointer type, then the field should be treated as not set\n\t\t// UNLESS the target is structpb.Value, in which case it should be set to structpb.NullValue.\n\t\t_, isJSONPBUnmarshaler := target.Interface().(JSONPBUnmarshaler)\n\t\tif string(inputValue) == \"null\" && targetType != reflect.TypeOf(&stpb.Value{}) && !isJSONPBUnmarshaler {\n\t\t\treturn nil\n\t\t}\n\t\ttarget.Set(reflect.New(targetType.Elem()))\n\n\t\treturn u.unmarshalValue(target.Elem(), inputValue, prop)\n\t}\n\n\tif jsu, ok := target.Addr().Interface().(JSONPBUnmarshaler); ok {\n\t\treturn jsu.UnmarshalJSONPB(u, []byte(inputValue))\n\t}\n\n\t// Handle well-known types that are not pointers.\n\tif w, ok := target.Addr().Interface().(wkt); ok {\n\t\tswitch w.XXX_WellKnownType() {\n\t\tcase \"DoubleValue\", \"FloatValue\", \"Int64Value\", \"UInt64Value\",\n\t\t\t\"Int32Value\", \"UInt32Value\", \"BoolValue\", \"StringValue\", \"BytesValue\":\n\t\t\treturn u.unmarshalValue(target.Field(0), inputValue, prop)\n\t\tcase \"Any\":\n\t\t\t// Use json.RawMessage pointer type instead of value to support pre-1.8 version.\n\t\t\t// 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see\n\t\t\t// https://github.com/golang/go/issues/14493\n\t\t\tvar jsonFields map[string]*json.RawMessage\n\t\t\tif err := json.Unmarshal(inputValue, &jsonFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tval, ok := jsonFields[\"@type\"]\n\t\t\tif !ok || val == nil {\n\t\t\t\treturn errors.New(\"Any JSON doesn't have '@type'\")\n\t\t\t}\n\n\t\t\tvar turl string\n\t\t\tif err := json.Unmarshal([]byte(*val), &turl); err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't unmarshal Any's '@type': %q\", *val)\n\t\t\t}\n\t\t\ttarget.Field(0).SetString(turl)\n\n\t\t\tvar m proto.Message\n\t\t\tvar err error\n\t\t\tif u.AnyResolver != nil {\n\t\t\t\tm, err = u.AnyResolver.Resolve(turl)\n\t\t\t} else {\n\t\t\t\tm, err = defaultResolveAny(turl)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif _, ok := m.(wkt); ok {\n\t\t\t\tval, ok := jsonFields[\"value\"]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn errors.New(\"Any JSON doesn't have 'value'\")\n\t\t\t\t}\n\n\t\t\t\tif err := u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"can't unmarshal Any nested proto %T: %v\", m, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete(jsonFields, \"@type\")\n\t\t\t\tnestedProto, err := json.Marshal(jsonFields)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"can't generate JSON for Any's nested proto to be unmarshaled: %v\", err)\n\t\t\t\t}\n\n\t\t\t\tif err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"can't unmarshal Any nested proto %T: %v\", m, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tb, err := proto.Marshal(m)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't marshal proto %T into Any.Value: %v\", m, err)\n\t\t\t}\n\t\t\ttarget.Field(1).SetBytes(b)\n\n\t\t\treturn nil\n\t\tcase \"Duration\":\n\t\t\tunq, err := strconv.Unquote(string(inputValue))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\td, err := time.ParseDuration(unq)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"bad Duration: %v\", err)\n\t\t\t}\n\n\t\t\tns := d.Nanoseconds()\n\t\t\ts := ns / 1e9\n\t\t\tns %= 1e9\n\t\t\ttarget.Field(0).SetInt(s)\n\t\t\ttarget.Field(1).SetInt(ns)\n\t\t\treturn nil\n\t\tcase \"Timestamp\":\n\t\t\tunq, err := strconv.Unquote(string(inputValue))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tt, err := time.Parse(time.RFC3339Nano, unq)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"bad Timestamp: %v\", err)\n\t\t\t}\n\n\t\t\ttarget.Field(0).SetInt(t.Unix())\n\t\t\ttarget.Field(1).SetInt(int64(t.Nanosecond()))\n\t\t\treturn nil\n\t\tcase \"Struct\":\n\t\t\tvar m map[string]json.RawMessage\n\t\t\tif err := json.Unmarshal(inputValue, &m); err != nil {\n\t\t\t\treturn fmt.Errorf(\"bad StructValue: %v\", err)\n\t\t\t}\n\n\t\t\ttarget.Field(0).Set(reflect.ValueOf(map[string]*stpb.Value{}))\n\t\t\tfor k, jv := range m {\n\t\t\t\tpv := &stpb.Value{}\n\t\t\t\tif err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"bad value in StructValue for key %q: %v\", k, err)\n\t\t\t\t}\n\t\t\t\ttarget.Field(0).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv))\n\t\t\t}\n\t\t\treturn nil\n\t\tcase \"ListValue\":\n\t\t\tvar s []json.RawMessage\n\t\t\tif err := json.Unmarshal(inputValue, &s); err != nil {\n\t\t\t\treturn fmt.Errorf(\"bad ListValue: %v\", err)\n\t\t\t}\n\n\t\t\ttarget.Field(0).Set(reflect.ValueOf(make([]*stpb.Value, len(s), len(s))))\n\t\t\tfor i, sv := range s {\n\t\t\t\tif err := u.unmarshalValue(target.Field(0).Index(i), sv, prop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\tcase \"Value\":\n\t\t\tivStr := string(inputValue)\n\t\t\tif ivStr == \"null\" {\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_NullValue{}))\n\t\t\t} else if v, err := strconv.ParseFloat(ivStr, 0); err == nil {\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_NumberValue{v}))\n\t\t\t} else if v, err := strconv.Unquote(ivStr); err == nil {\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_StringValue{v}))\n\t\t\t} else if v, err := strconv.ParseBool(ivStr); err == nil {\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_BoolValue{v}))\n\t\t\t} else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil {\n\t\t\t\tlv := &stpb.ListValue{}\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_ListValue{lv}))\n\t\t\t\treturn u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop)\n\t\t\t} else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil {\n\t\t\t\tsv := &stpb.Struct{}\n\t\t\t\ttarget.Field(0).Set(reflect.ValueOf(&stpb.Value_StructValue{sv}))\n\t\t\t\treturn u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"unrecognized type for Value %q\", ivStr)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Handle enums, which have an underlying type of int32,\n\t// and may appear as strings.\n\t// The case of an enum appearing as a number is handled\n\t// at the bottom of this function.\n\tif inputValue[0] == '\"' && prop != nil && prop.Enum != \"\" {\n\t\tvmap := proto.EnumValueMap(prop.Enum)\n\t\t// Don't need to do unquoting; valid enum names\n\t\t// are from a limited character set.\n\t\ts := inputValue[1 : len(inputValue)-1]\n\t\tn, ok := vmap[string(s)]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unknown value %q for enum %s\", s, prop.Enum)\n\t\t}\n\t\tif target.Kind() == reflect.Ptr { // proto2\n\t\t\ttarget.Set(reflect.New(targetType.Elem()))\n\t\t\ttarget = target.Elem()\n\t\t}\n\t\ttarget.SetInt(int64(n))\n\t\treturn nil\n\t}\n\n\t// Handle nested messages.\n\tif targetType.Kind() == reflect.Struct {\n\t\tvar jsonFields map[string]json.RawMessage\n\t\tif err := json.Unmarshal(inputValue, &jsonFields); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tconsumeField := func(prop *proto.Properties) (json.RawMessage, bool) {\n\t\t\t// Be liberal in what names we accept; both orig_name and camelName are okay.\n\t\t\tfieldNames := acceptedJSONFieldNames(prop)\n\n\t\t\tvOrig, okOrig := jsonFields[fieldNames.orig]\n\t\t\tvCamel, okCamel := jsonFields[fieldNames.camel]\n\t\t\tif !okOrig && !okCamel {\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\t\t// If, for some reason, both are present in the data, favour the camelName.\n\t\t\tvar raw json.RawMessage\n\t\t\tif okOrig {\n\t\t\t\traw = vOrig\n\t\t\t\tdelete(jsonFields, fieldNames.orig)\n\t\t\t}\n\t\t\tif okCamel {\n\t\t\t\traw = vCamel\n\t\t\t\tdelete(jsonFields, fieldNames.camel)\n\t\t\t}\n\t\t\treturn raw, true\n\t\t}\n\n\t\tsprops := proto.GetProperties(targetType)\n\t\tfor i := 0; i < target.NumField(); i++ {\n\t\t\tft := target.Type().Field(i)\n\t\t\tif strings.HasPrefix(ft.Name, \"XXX_\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvalueForField, ok := consumeField(sprops.Prop[i])\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// Check for any oneof fields.\n\t\tif len(jsonFields) > 0 {\n\t\t\tfor _, oop := range sprops.OneofTypes {\n\t\t\t\traw, ok := consumeField(oop.Prop)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnv := reflect.New(oop.Type.Elem())\n\t\t\t\ttarget.Field(oop.Field).Set(nv)\n\t\t\t\tif err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Handle proto2 extensions.\n\t\tif len(jsonFields) > 0 {\n\t\t\tif ep, ok := target.Addr().Interface().(proto.Message); ok {\n\t\t\t\tfor _, ext := range proto.RegisteredExtensions(ep) {\n\t\t\t\t\tname := fmt.Sprintf(\"[%s]\", ext.Name)\n\t\t\t\t\traw, ok := jsonFields[name]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tdelete(jsonFields, name)\n\t\t\t\t\tnv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem())\n\t\t\t\t\tif err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := proto.SetExtension(ep, ext, nv.Interface()); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !u.AllowUnknownFields && len(jsonFields) > 0 {\n\t\t\t// Pick any field to be the scapegoat.\n\t\t\tvar f string\n\t\t\tfor fname := range jsonFields {\n\t\t\t\tf = fname\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"unknown field %q in %v\", f, targetType)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Handle arrays (which aren't encoded bytes)\n\tif targetType.Kind() == reflect.Slice && targetType.Elem().Kind() != reflect.Uint8 {\n\t\tvar slc []json.RawMessage\n\t\tif err := json.Unmarshal(inputValue, &slc); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif slc != nil {\n\t\t\tl := len(slc)\n\t\t\ttarget.Set(reflect.MakeSlice(targetType, l, l))\n\t\t\tfor i := 0; i < l; i++ {\n\t\t\t\tif err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Handle maps (whose keys are always strings)\n\tif targetType.Kind() == reflect.Map {\n\t\tvar mp map[string]json.RawMessage\n\t\tif err := json.Unmarshal(inputValue, &mp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif mp != nil {\n\t\t\ttarget.Set(reflect.MakeMap(targetType))\n\t\t\tvar keyprop, valprop *proto.Properties\n\t\t\tif prop != nil {\n\t\t\t\t// These could still be nil if the protobuf metadata is broken somehow.\n\t\t\t\t// TODO: This won't work because the fields are unexported.\n\t\t\t\t// We should probably just reparse them.\n\t\t\t\t//keyprop, valprop = prop.mkeyprop, prop.mvalprop\n\t\t\t}\n\t\t\tfor ks, raw := range mp {\n\t\t\t\t// Unmarshal map key. The core json library already decoded the key into a\n\t\t\t\t// string, so we handle that specially. Other types were quoted post-serialization.\n\t\t\t\tvar k reflect.Value\n\t\t\t\tif targetType.Key().Kind() == reflect.String {\n\t\t\t\t\tk = reflect.ValueOf(ks)\n\t\t\t\t} else {\n\t\t\t\t\tk = reflect.New(targetType.Key()).Elem()\n\t\t\t\t\tif err := u.unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Unmarshal map value.\n\t\t\t\tv := reflect.New(targetType.Elem()).Elem()\n\t\t\t\tif err := u.unmarshalValue(v, raw, valprop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttarget.SetMapIndex(k, v)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// 64-bit integers can be encoded as strings. In this case we drop\n\t// the quotes and proceed as normal.\n\tisNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64\n\tif isNum && strings.HasPrefix(string(inputValue), `\"`) {\n\t\tinputValue = inputValue[1 : len(inputValue)-1]\n\t}\n\n\t// Non-finite numbers can be encoded as strings.\n\tisFloat := targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64\n\tif isFloat {\n\t\tif num, ok := nonFinite[string(inputValue)]; ok {\n\t\t\ttarget.SetFloat(num)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Use the encoding/json for parsing other value types.\n\treturn json.Unmarshal(inputValue, target.Addr().Interface())\n}\n\n// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute.\nfunc jsonProperties(f reflect.StructField, origName bool) *proto.Properties {\n\tvar prop proto.Properties\n\tprop.Init(f.Type, f.Name, f.Tag.Get(\"protobuf\"), &f)\n\tif origName || prop.JSONName == \"\" {\n\t\tprop.JSONName = prop.OrigName\n\t}\n\treturn &prop\n}\n\ntype fieldNames struct {\n\torig, camel string\n}\n\nfunc acceptedJSONFieldNames(prop *proto.Properties) fieldNames {\n\topts := fieldNames{orig: prop.OrigName, camel: prop.OrigName}\n\tif prop.JSONName != \"\" {\n\t\topts.camel = prop.JSONName\n\t}\n\treturn opts\n}\n\n// Writer wrapper inspired by https://blog.golang.org/errors-are-values\ntype errWriter struct {\n\twriter io.Writer\n\terr    error\n}\n\nfunc (w *errWriter) write(str string) {\n\tif w.err != nil {\n\t\treturn\n\t}\n\t_, w.err = w.writer.Write([]byte(str))\n}\n\n// Map fields may have key types of non-float scalars, strings and enums.\n// The easiest way to sort them in some deterministic order is to use fmt.\n// If this turns out to be inefficient we can always consider other options,\n// such as doing a Schwartzian transform.\n//\n// Numeric keys are sorted in numeric order per\n// https://developers.google.com/protocol-buffers/docs/proto#maps.\ntype mapKeys []reflect.Value\n\nfunc (s mapKeys) Len() int      { return len(s) }\nfunc (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }\nfunc (s mapKeys) Less(i, j int) bool {\n\tif k := s[i].Kind(); k == s[j].Kind() {\n\t\tswitch k {\n\t\tcase reflect.Int32, reflect.Int64:\n\t\t\treturn s[i].Int() < s[j].Int()\n\t\tcase reflect.Uint32, reflect.Uint64:\n\t\t\treturn s[i].Uint() < s[j].Uint()\n\t\t}\n\t}\n\treturn fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface())\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage jsonpb\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"io\"\n\t\"math\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tpb \"github.com/golang/protobuf/jsonpb/jsonpb_test_proto\"\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\t\"github.com/golang/protobuf/ptypes\"\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n\tdurpb \"github.com/golang/protobuf/ptypes/duration\"\n\tstpb \"github.com/golang/protobuf/ptypes/struct\"\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n\twpb \"github.com/golang/protobuf/ptypes/wrappers\"\n)\n\nvar (\n\tmarshaler = Marshaler{}\n\n\tmarshalerAllOptions = Marshaler{\n\t\tIndent: \"  \",\n\t}\n\n\tsimpleObject = &pb.Simple{\n\t\tOInt32:  proto.Int32(-32),\n\t\tOInt64:  proto.Int64(-6400000000),\n\t\tOUint32: proto.Uint32(32),\n\t\tOUint64: proto.Uint64(6400000000),\n\t\tOSint32: proto.Int32(-13),\n\t\tOSint64: proto.Int64(-2600000000),\n\t\tOFloat:  proto.Float32(3.14),\n\t\tODouble: proto.Float64(6.02214179e23),\n\t\tOBool:   proto.Bool(true),\n\t\tOString: proto.String(\"hello \\\"there\\\"\"),\n\t\tOBytes:  []byte(\"beep boop\"),\n\t}\n\n\tsimpleObjectJSON = `{` +\n\t\t`\"oBool\":true,` +\n\t\t`\"oInt32\":-32,` +\n\t\t`\"oInt64\":\"-6400000000\",` +\n\t\t`\"oUint32\":32,` +\n\t\t`\"oUint64\":\"6400000000\",` +\n\t\t`\"oSint32\":-13,` +\n\t\t`\"oSint64\":\"-2600000000\",` +\n\t\t`\"oFloat\":3.14,` +\n\t\t`\"oDouble\":6.02214179e+23,` +\n\t\t`\"oString\":\"hello \\\"there\\\"\",` +\n\t\t`\"oBytes\":\"YmVlcCBib29w\"` +\n\t\t`}`\n\n\tsimpleObjectPrettyJSON = `{\n  \"oBool\": true,\n  \"oInt32\": -32,\n  \"oInt64\": \"-6400000000\",\n  \"oUint32\": 32,\n  \"oUint64\": \"6400000000\",\n  \"oSint32\": -13,\n  \"oSint64\": \"-2600000000\",\n  \"oFloat\": 3.14,\n  \"oDouble\": 6.02214179e+23,\n  \"oString\": \"hello \\\"there\\\"\",\n  \"oBytes\": \"YmVlcCBib29w\"\n}`\n\n\trepeatsObject = &pb.Repeats{\n\t\tRBool:   []bool{true, false, true},\n\t\tRInt32:  []int32{-3, -4, -5},\n\t\tRInt64:  []int64{-123456789, -987654321},\n\t\tRUint32: []uint32{1, 2, 3},\n\t\tRUint64: []uint64{6789012345, 3456789012},\n\t\tRSint32: []int32{-1, -2, -3},\n\t\tRSint64: []int64{-6789012345, -3456789012},\n\t\tRFloat:  []float32{3.14, 6.28},\n\t\tRDouble: []float64{299792458 * 1e20, 6.62606957e-34},\n\t\tRString: []string{\"happy\", \"days\"},\n\t\tRBytes:  [][]byte{[]byte(\"skittles\"), []byte(\"m&m's\")},\n\t}\n\n\trepeatsObjectJSON = `{` +\n\t\t`\"rBool\":[true,false,true],` +\n\t\t`\"rInt32\":[-3,-4,-5],` +\n\t\t`\"rInt64\":[\"-123456789\",\"-987654321\"],` +\n\t\t`\"rUint32\":[1,2,3],` +\n\t\t`\"rUint64\":[\"6789012345\",\"3456789012\"],` +\n\t\t`\"rSint32\":[-1,-2,-3],` +\n\t\t`\"rSint64\":[\"-6789012345\",\"-3456789012\"],` +\n\t\t`\"rFloat\":[3.14,6.28],` +\n\t\t`\"rDouble\":[2.99792458e+28,6.62606957e-34],` +\n\t\t`\"rString\":[\"happy\",\"days\"],` +\n\t\t`\"rBytes\":[\"c2tpdHRsZXM=\",\"bSZtJ3M=\"]` +\n\t\t`}`\n\n\trepeatsObjectPrettyJSON = `{\n  \"rBool\": [\n    true,\n    false,\n    true\n  ],\n  \"rInt32\": [\n    -3,\n    -4,\n    -5\n  ],\n  \"rInt64\": [\n    \"-123456789\",\n    \"-987654321\"\n  ],\n  \"rUint32\": [\n    1,\n    2,\n    3\n  ],\n  \"rUint64\": [\n    \"6789012345\",\n    \"3456789012\"\n  ],\n  \"rSint32\": [\n    -1,\n    -2,\n    -3\n  ],\n  \"rSint64\": [\n    \"-6789012345\",\n    \"-3456789012\"\n  ],\n  \"rFloat\": [\n    3.14,\n    6.28\n  ],\n  \"rDouble\": [\n    2.99792458e+28,\n    6.62606957e-34\n  ],\n  \"rString\": [\n    \"happy\",\n    \"days\"\n  ],\n  \"rBytes\": [\n    \"c2tpdHRsZXM=\",\n    \"bSZtJ3M=\"\n  ]\n}`\n\n\tinnerSimple   = &pb.Simple{OInt32: proto.Int32(-32)}\n\tinnerSimple2  = &pb.Simple{OInt64: proto.Int64(25)}\n\tinnerRepeats  = &pb.Repeats{RString: []string{\"roses\", \"red\"}}\n\tinnerRepeats2 = &pb.Repeats{RString: []string{\"violets\", \"blue\"}}\n\tcomplexObject = &pb.Widget{\n\t\tColor:    pb.Widget_GREEN.Enum(),\n\t\tRColor:   []pb.Widget_Color{pb.Widget_RED, pb.Widget_GREEN, pb.Widget_BLUE},\n\t\tSimple:   innerSimple,\n\t\tRSimple:  []*pb.Simple{innerSimple, innerSimple2},\n\t\tRepeats:  innerRepeats,\n\t\tRRepeats: []*pb.Repeats{innerRepeats, innerRepeats2},\n\t}\n\n\tcomplexObjectJSON = `{\"color\":\"GREEN\",` +\n\t\t`\"rColor\":[\"RED\",\"GREEN\",\"BLUE\"],` +\n\t\t`\"simple\":{\"oInt32\":-32},` +\n\t\t`\"rSimple\":[{\"oInt32\":-32},{\"oInt64\":\"25\"}],` +\n\t\t`\"repeats\":{\"rString\":[\"roses\",\"red\"]},` +\n\t\t`\"rRepeats\":[{\"rString\":[\"roses\",\"red\"]},{\"rString\":[\"violets\",\"blue\"]}]` +\n\t\t`}`\n\n\tcomplexObjectPrettyJSON = `{\n  \"color\": \"GREEN\",\n  \"rColor\": [\n    \"RED\",\n    \"GREEN\",\n    \"BLUE\"\n  ],\n  \"simple\": {\n    \"oInt32\": -32\n  },\n  \"rSimple\": [\n    {\n      \"oInt32\": -32\n    },\n    {\n      \"oInt64\": \"25\"\n    }\n  ],\n  \"repeats\": {\n    \"rString\": [\n      \"roses\",\n      \"red\"\n    ]\n  },\n  \"rRepeats\": [\n    {\n      \"rString\": [\n        \"roses\",\n        \"red\"\n      ]\n    },\n    {\n      \"rString\": [\n        \"violets\",\n        \"blue\"\n      ]\n    }\n  ]\n}`\n\n\tcolorPrettyJSON = `{\n \"color\": 2\n}`\n\n\tcolorListPrettyJSON = `{\n  \"color\": 1000,\n  \"rColor\": [\n    \"RED\"\n  ]\n}`\n\n\tnummyPrettyJSON = `{\n  \"nummy\": {\n    \"1\": 2,\n    \"3\": 4\n  }\n}`\n\n\tobjjyPrettyJSON = `{\n  \"objjy\": {\n    \"1\": {\n      \"dub\": 1\n    }\n  }\n}`\n\trealNumber     = &pb.Real{Value: proto.Float64(3.14159265359)}\n\trealNumberName = \"Pi\"\n\tcomplexNumber  = &pb.Complex{Imaginary: proto.Float64(0.5772156649)}\n\trealNumberJSON = `{` +\n\t\t`\"value\":3.14159265359,` +\n\t\t`\"[jsonpb.Complex.real_extension]\":{\"imaginary\":0.5772156649},` +\n\t\t`\"[jsonpb.name]\":\"Pi\"` +\n\t\t`}`\n\n\tanySimple = &pb.KnownTypes{\n\t\tAn: &anypb.Any{\n\t\t\tTypeUrl: \"something.example.com/jsonpb.Simple\",\n\t\t\tValue: []byte{\n\t\t\t\t// &pb.Simple{OBool:true}\n\t\t\t\t1 << 3, 1,\n\t\t\t},\n\t\t},\n\t}\n\tanySimpleJSON       = `{\"an\":{\"@type\":\"something.example.com/jsonpb.Simple\",\"oBool\":true}}`\n\tanySimplePrettyJSON = `{\n  \"an\": {\n    \"@type\": \"something.example.com/jsonpb.Simple\",\n    \"oBool\": true\n  }\n}`\n\n\tanyWellKnown = &pb.KnownTypes{\n\t\tAn: &anypb.Any{\n\t\t\tTypeUrl: \"type.googleapis.com/google.protobuf.Duration\",\n\t\t\tValue: []byte{\n\t\t\t\t// &durpb.Duration{Seconds: 1, Nanos: 212000000 }\n\t\t\t\t1 << 3, 1, // seconds\n\t\t\t\t2 << 3, 0x80, 0xba, 0x8b, 0x65, // nanos\n\t\t\t},\n\t\t},\n\t}\n\tanyWellKnownJSON       = `{\"an\":{\"@type\":\"type.googleapis.com/google.protobuf.Duration\",\"value\":\"1.212s\"}}`\n\tanyWellKnownPrettyJSON = `{\n  \"an\": {\n    \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n    \"value\": \"1.212s\"\n  }\n}`\n\n\tnonFinites = &pb.NonFinites{\n\t\tFNan:  proto.Float32(float32(math.NaN())),\n\t\tFPinf: proto.Float32(float32(math.Inf(1))),\n\t\tFNinf: proto.Float32(float32(math.Inf(-1))),\n\t\tDNan:  proto.Float64(float64(math.NaN())),\n\t\tDPinf: proto.Float64(float64(math.Inf(1))),\n\t\tDNinf: proto.Float64(float64(math.Inf(-1))),\n\t}\n\tnonFinitesJSON = `{` +\n\t\t`\"fNan\":\"NaN\",` +\n\t\t`\"fPinf\":\"Infinity\",` +\n\t\t`\"fNinf\":\"-Infinity\",` +\n\t\t`\"dNan\":\"NaN\",` +\n\t\t`\"dPinf\":\"Infinity\",` +\n\t\t`\"dNinf\":\"-Infinity\"` +\n\t\t`}`\n)\n\nfunc init() {\n\tif err := proto.SetExtension(realNumber, pb.E_Name, &realNumberName); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := proto.SetExtension(realNumber, pb.E_Complex_RealExtension, complexNumber); err != nil {\n\t\tpanic(err)\n\t}\n}\n\nvar marshalingTests = []struct {\n\tdesc      string\n\tmarshaler Marshaler\n\tpb        proto.Message\n\tjson      string\n}{\n\t{\"simple flat object\", marshaler, simpleObject, simpleObjectJSON},\n\t{\"simple pretty object\", marshalerAllOptions, simpleObject, simpleObjectPrettyJSON},\n\t{\"non-finite floats fields object\", marshaler, nonFinites, nonFinitesJSON},\n\t{\"repeated fields flat object\", marshaler, repeatsObject, repeatsObjectJSON},\n\t{\"repeated fields pretty object\", marshalerAllOptions, repeatsObject, repeatsObjectPrettyJSON},\n\t{\"nested message/enum flat object\", marshaler, complexObject, complexObjectJSON},\n\t{\"nested message/enum pretty object\", marshalerAllOptions, complexObject, complexObjectPrettyJSON},\n\t{\"enum-string flat object\", Marshaler{},\n\t\t&pb.Widget{Color: pb.Widget_BLUE.Enum()}, `{\"color\":\"BLUE\"}`},\n\t{\"enum-value pretty object\", Marshaler{EnumsAsInts: true, Indent: \" \"},\n\t\t&pb.Widget{Color: pb.Widget_BLUE.Enum()}, colorPrettyJSON},\n\t{\"unknown enum value object\", marshalerAllOptions,\n\t\t&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}, colorListPrettyJSON},\n\t{\"repeated proto3 enum\", Marshaler{},\n\t\t&proto3pb.Message{RFunny: []proto3pb.Message_Humour{\n\t\t\tproto3pb.Message_PUNS,\n\t\t\tproto3pb.Message_SLAPSTICK,\n\t\t}},\n\t\t`{\"rFunny\":[\"PUNS\",\"SLAPSTICK\"]}`},\n\t{\"repeated proto3 enum as int\", Marshaler{EnumsAsInts: true},\n\t\t&proto3pb.Message{RFunny: []proto3pb.Message_Humour{\n\t\t\tproto3pb.Message_PUNS,\n\t\t\tproto3pb.Message_SLAPSTICK,\n\t\t}},\n\t\t`{\"rFunny\":[1,2]}`},\n\t{\"empty value\", marshaler, &pb.Simple3{}, `{}`},\n\t{\"empty value emitted\", Marshaler{EmitDefaults: true}, &pb.Simple3{}, `{\"dub\":0}`},\n\t{\"empty repeated emitted\", Marshaler{EmitDefaults: true}, &pb.SimpleSlice3{}, `{\"slices\":[]}`},\n\t{\"empty map emitted\", Marshaler{EmitDefaults: true}, &pb.SimpleMap3{}, `{\"stringy\":{}}`},\n\t{\"nested struct null\", Marshaler{EmitDefaults: true}, &pb.SimpleNull3{}, `{\"simple\":null}`},\n\t{\"map<int64, int32>\", marshaler, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{\"nummy\":{\"1\":2,\"3\":4}}`},\n\t{\"map<int64, int32>\", marshalerAllOptions, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON},\n\t{\"map<string, string>\", marshaler,\n\t\t&pb.Mappy{Strry: map[string]string{`\"one\"`: \"two\", \"three\": \"four\"}},\n\t\t`{\"strry\":{\"\\\"one\\\"\":\"two\",\"three\":\"four\"}}`},\n\t{\"map<int32, Object>\", marshaler,\n\t\t&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, `{\"objjy\":{\"1\":{\"dub\":1}}}`},\n\t{\"map<int32, Object>\", marshalerAllOptions,\n\t\t&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}, objjyPrettyJSON},\n\t{\"map<int64, string>\", marshaler, &pb.Mappy{Buggy: map[int64]string{1234: \"yup\"}},\n\t\t`{\"buggy\":{\"1234\":\"yup\"}}`},\n\t{\"map<bool, bool>\", marshaler, &pb.Mappy{Booly: map[bool]bool{false: true}}, `{\"booly\":{\"false\":true}}`},\n\t// TODO: This is broken.\n\t//{\"map<string, enum>\", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{\"XIV\": pb.Numeral_ROMAN}}, `{\"enumy\":{\"XIV\":\"ROMAN\"}`},\n\t{\"map<string, enum as int>\", Marshaler{EnumsAsInts: true}, &pb.Mappy{Enumy: map[string]pb.Numeral{\"XIV\": pb.Numeral_ROMAN}}, `{\"enumy\":{\"XIV\":2}}`},\n\t{\"map<int32, bool>\", marshaler, &pb.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{\"s32booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<int64, bool>\", marshaler, &pb.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{\"s64booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<uint32, bool>\", marshaler, &pb.Mappy{U32Booly: map[uint32]bool{1: true, 3: false, 10: true, 12: false}}, `{\"u32booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"map<uint64, bool>\", marshaler, &pb.Mappy{U64Booly: map[uint64]bool{1: true, 3: false, 10: true, 12: false}}, `{\"u64booly\":{\"1\":true,\"3\":false,\"10\":true,\"12\":false}}`},\n\t{\"proto2 map<int64, string>\", marshaler, &pb.Maps{MInt64Str: map[int64]string{213: \"cat\"}},\n\t\t`{\"mInt64Str\":{\"213\":\"cat\"}}`},\n\t{\"proto2 map<bool, Object>\", marshaler,\n\t\t&pb.Maps{MBoolSimple: map[bool]*pb.Simple{true: {OInt32: proto.Int32(1)}}},\n\t\t`{\"mBoolSimple\":{\"true\":{\"oInt32\":1}}}`},\n\t{\"oneof, not set\", marshaler, &pb.MsgWithOneof{}, `{}`},\n\t{\"oneof, set\", marshaler, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Title{\"Grand Poobah\"}}, `{\"title\":\"Grand Poobah\"}`},\n\t{\"force orig_name\", Marshaler{OrigName: true}, &pb.Simple{OInt32: proto.Int32(4)},\n\t\t`{\"o_int32\":4}`},\n\t{\"proto2 extension\", marshaler, realNumber, realNumberJSON},\n\t{\"Any with message\", marshaler, anySimple, anySimpleJSON},\n\t{\"Any with message and indent\", marshalerAllOptions, anySimple, anySimplePrettyJSON},\n\t{\"Any with WKT\", marshaler, anyWellKnown, anyWellKnownJSON},\n\t{\"Any with WKT and indent\", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON},\n\t{\"Duration\", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{\"dur\":\"3.000s\"}`},\n\t{\"Struct\", marshaler, &pb.KnownTypes{St: &stpb.Struct{\n\t\tFields: map[string]*stpb.Value{\n\t\t\t\"one\": {Kind: &stpb.Value_StringValue{\"loneliest number\"}},\n\t\t\t\"two\": {Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}},\n\t\t},\n\t}}, `{\"st\":{\"one\":\"loneliest number\",\"two\":null}}`},\n\t{\"empty ListValue\", marshaler, &pb.KnownTypes{Lv: &stpb.ListValue{}}, `{\"lv\":[]}`},\n\t{\"basic ListValue\", marshaler, &pb.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{\n\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t{Kind: &stpb.Value_NullValue{}},\n\t\t{Kind: &stpb.Value_NumberValue{3}},\n\t\t{Kind: &stpb.Value_BoolValue{true}},\n\t}}}, `{\"lv\":[\"x\",null,3,true]}`},\n\t{\"Timestamp\", marshaler, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{\"ts\":\"2014-05-13T16:53:20.021Z\"}`},\n\t{\"number Value\", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}, `{\"val\":1}`},\n\t{\"null Value\", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}, `{\"val\":null}`},\n\t{\"string number value\", marshaler, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"9223372036854775807\"}}}, `{\"val\":\"9223372036854775807\"}`},\n\t{\"list of lists Value\", marshaler, &pb.KnownTypes{Val: &stpb.Value{\n\t\tKind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\tValues: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\tValues: []*stpb.Value{\n\t\t\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\t\t\tValues: []*stpb.Value{{Kind: &stpb.Value_StringValue{\"y\"}}},\n\t\t\t\t\t\t}}},\n\t\t\t\t\t\t{Kind: &stpb.Value_StringValue{\"z\"}},\n\t\t\t\t\t},\n\t\t\t\t}}},\n\t\t\t},\n\t\t}},\n\t}}, `{\"val\":[\"x\",[[\"y\"],\"z\"]]}`},\n\n\t{\"DoubleValue\", marshaler, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{\"dbl\":1.2}`},\n\t{\"FloatValue\", marshaler, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}, `{\"flt\":1.2}`},\n\t{\"Int64Value\", marshaler, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}, `{\"i64\":\"-3\"}`},\n\t{\"UInt64Value\", marshaler, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}, `{\"u64\":\"3\"}`},\n\t{\"Int32Value\", marshaler, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}, `{\"i32\":-4}`},\n\t{\"UInt32Value\", marshaler, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}, `{\"u32\":4}`},\n\t{\"BoolValue\", marshaler, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}, `{\"bool\":true}`},\n\t{\"StringValue\", marshaler, &pb.KnownTypes{Str: &wpb.StringValue{Value: \"plush\"}}, `{\"str\":\"plush\"}`},\n\t{\"BytesValue\", marshaler, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte(\"wow\")}}, `{\"bytes\":\"d293\"}`},\n}\n\nfunc TestMarshaling(t *testing.T) {\n\tfor _, tt := range marshalingTests {\n\t\tjson, err := tt.marshaler.MarshalToString(tt.pb)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: marshaling error: %v\", tt.desc, err)\n\t\t} else if tt.json != json {\n\t\t\tt.Errorf(\"%s: got [%v] want [%v]\", tt.desc, json, tt.json)\n\t\t}\n\t}\n}\n\nfunc TestMarshalJSONPBMarshaler(t *testing.T) {\n\trawJson := `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tmsg := dynamicMessage{rawJson: rawJson}\n\tstr, err := new(Marshaler).MarshalToString(&msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshalling JSONPBMarshaler: %v\", err)\n\t}\n\tif str != rawJson {\n\t\tt.Errorf(\"marshalling JSON produced incorrect output: got %s, wanted %s\", str, rawJson)\n\t}\n}\n\nfunc TestMarshalAnyJSONPBMarshaler(t *testing.T) {\n\tmsg := dynamicMessage{rawJson: `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`}\n\ta, err := ptypes.MarshalAny(&msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshalling to Any: %v\", err)\n\t}\n\tstr, err := new(Marshaler).MarshalToString(a)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshalling Any to JSON: %v\", err)\n\t}\n\t// after custom marshaling, it's round-tripped through JSON decoding/encoding already,\n\t// so the keys are sorted, whitespace is compacted, and \"@type\" key has been added\n\texpected := `{\"@type\":\"type.googleapis.com/` + dynamicMessageName + `\",\"baz\":[0,1,2,3],\"foo\":\"bar\"}`\n\tif str != expected {\n\t\tt.Errorf(\"marshalling JSON produced incorrect output: got %s, wanted %s\", str, expected)\n\t}\n}\n\nvar unmarshalingTests = []struct {\n\tdesc        string\n\tunmarshaler Unmarshaler\n\tjson        string\n\tpb          proto.Message\n}{\n\t{\"simple flat object\", Unmarshaler{}, simpleObjectJSON, simpleObject},\n\t{\"simple pretty object\", Unmarshaler{}, simpleObjectPrettyJSON, simpleObject},\n\t{\"repeated fields flat object\", Unmarshaler{}, repeatsObjectJSON, repeatsObject},\n\t{\"repeated fields pretty object\", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject},\n\t{\"nested message/enum flat object\", Unmarshaler{}, complexObjectJSON, complexObject},\n\t{\"nested message/enum pretty object\", Unmarshaler{}, complexObjectPrettyJSON, complexObject},\n\t{\"enum-string object\", Unmarshaler{}, `{\"color\":\"BLUE\"}`, &pb.Widget{Color: pb.Widget_BLUE.Enum()}},\n\t{\"enum-value object\", Unmarshaler{}, \"{\\n \\\"color\\\": 2\\n}\", &pb.Widget{Color: pb.Widget_BLUE.Enum()}},\n\t{\"unknown field with allowed option\", Unmarshaler{AllowUnknownFields: true}, `{\"unknown\": \"foo\"}`, new(pb.Simple)},\n\t{\"proto3 enum string\", Unmarshaler{}, `{\"hilarity\":\"PUNS\"}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},\n\t{\"proto3 enum value\", Unmarshaler{}, `{\"hilarity\":1}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},\n\t{\"unknown enum value object\",\n\t\tUnmarshaler{},\n\t\t\"{\\n  \\\"color\\\": 1000,\\n  \\\"r_color\\\": [\\n    \\\"RED\\\"\\n  ]\\n}\",\n\t\t&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}},\n\t{\"repeated proto3 enum\", Unmarshaler{}, `{\"rFunny\":[\"PUNS\",\"SLAPSTICK\"]}`,\n\t\t&proto3pb.Message{RFunny: []proto3pb.Message_Humour{\n\t\t\tproto3pb.Message_PUNS,\n\t\t\tproto3pb.Message_SLAPSTICK,\n\t\t}}},\n\t{\"repeated proto3 enum as int\", Unmarshaler{}, `{\"rFunny\":[1,2]}`,\n\t\t&proto3pb.Message{RFunny: []proto3pb.Message_Humour{\n\t\t\tproto3pb.Message_PUNS,\n\t\t\tproto3pb.Message_SLAPSTICK,\n\t\t}}},\n\t{\"repeated proto3 enum as mix of strings and ints\", Unmarshaler{}, `{\"rFunny\":[\"PUNS\",2]}`,\n\t\t&proto3pb.Message{RFunny: []proto3pb.Message_Humour{\n\t\t\tproto3pb.Message_PUNS,\n\t\t\tproto3pb.Message_SLAPSTICK,\n\t\t}}},\n\t{\"unquoted int64 object\", Unmarshaler{}, `{\"oInt64\":-314}`, &pb.Simple{OInt64: proto.Int64(-314)}},\n\t{\"unquoted uint64 object\", Unmarshaler{}, `{\"oUint64\":123}`, &pb.Simple{OUint64: proto.Uint64(123)}},\n\t{\"NaN\", Unmarshaler{}, `{\"oDouble\":\"NaN\"}`, &pb.Simple{ODouble: proto.Float64(math.NaN())}},\n\t{\"Inf\", Unmarshaler{}, `{\"oFloat\":\"Infinity\"}`, &pb.Simple{OFloat: proto.Float32(float32(math.Inf(1)))}},\n\t{\"-Inf\", Unmarshaler{}, `{\"oDouble\":\"-Infinity\"}`, &pb.Simple{ODouble: proto.Float64(math.Inf(-1))}},\n\t{\"map<int64, int32>\", Unmarshaler{}, `{\"nummy\":{\"1\":2,\"3\":4}}`, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}},\n\t{\"map<string, string>\", Unmarshaler{}, `{\"strry\":{\"\\\"one\\\"\":\"two\",\"three\":\"four\"}}`, &pb.Mappy{Strry: map[string]string{`\"one\"`: \"two\", \"three\": \"four\"}}},\n\t{\"map<int32, Object>\", Unmarshaler{}, `{\"objjy\":{\"1\":{\"dub\":1}}}`, &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: {Dub: 1}}}},\n\t{\"proto2 extension\", Unmarshaler{}, realNumberJSON, realNumber},\n\t{\"Any with message\", Unmarshaler{}, anySimpleJSON, anySimple},\n\t{\"Any with message and indent\", Unmarshaler{}, anySimplePrettyJSON, anySimple},\n\t{\"Any with WKT\", Unmarshaler{}, anyWellKnownJSON, anyWellKnown},\n\t{\"Any with WKT and indent\", Unmarshaler{}, anyWellKnownPrettyJSON, anyWellKnown},\n\t// TODO: This is broken.\n\t//{\"map<string, enum>\", Unmarshaler{}, `{\"enumy\":{\"XIV\":\"ROMAN\"}`, &pb.Mappy{Enumy: map[string]pb.Numeral{\"XIV\": pb.Numeral_ROMAN}}},\n\t{\"map<string, enum as int>\", Unmarshaler{}, `{\"enumy\":{\"XIV\":2}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{\"XIV\": pb.Numeral_ROMAN}}},\n\t{\"oneof\", Unmarshaler{}, `{\"salary\":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{31000}}},\n\t{\"oneof spec name\", Unmarshaler{}, `{\"Country\":\"Australia\"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{\"Australia\"}}},\n\t{\"oneof orig_name\", Unmarshaler{}, `{\"Country\":\"Australia\"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{\"Australia\"}}},\n\t{\"oneof spec name2\", Unmarshaler{}, `{\"homeAddress\":\"Australia\"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{\"Australia\"}}},\n\t{\"oneof orig_name2\", Unmarshaler{}, `{\"home_address\":\"Australia\"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_HomeAddress{\"Australia\"}}},\n\t{\"orig_name input\", Unmarshaler{}, `{\"o_bool\":true}`, &pb.Simple{OBool: proto.Bool(true)}},\n\t{\"camelName input\", Unmarshaler{}, `{\"oBool\":true}`, &pb.Simple{OBool: proto.Bool(true)}},\n\n\t{\"Duration\", Unmarshaler{}, `{\"dur\":\"3.000s\"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},\n\t{\"null Duration\", Unmarshaler{}, `{\"dur\":null}`, &pb.KnownTypes{Dur: nil}},\n\t{\"Timestamp\", Unmarshaler{}, `{\"ts\":\"2014-05-13T16:53:20.021Z\"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}},\n\t{\"PreEpochTimestamp\", Unmarshaler{}, `{\"ts\":\"1969-12-31T23:59:58.999999995Z\"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -2, Nanos: 999999995}}},\n\t{\"ZeroTimeTimestamp\", Unmarshaler{}, `{\"ts\":\"0001-01-01T00:00:00Z\"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -62135596800, Nanos: 0}}},\n\t{\"null Timestamp\", Unmarshaler{}, `{\"ts\":null}`, &pb.KnownTypes{Ts: nil}},\n\t{\"null Struct\", Unmarshaler{}, `{\"st\": null}`, &pb.KnownTypes{St: nil}},\n\t{\"empty Struct\", Unmarshaler{}, `{\"st\": {}}`, &pb.KnownTypes{St: &stpb.Struct{}}},\n\t{\"basic Struct\", Unmarshaler{}, `{\"st\": {\"a\": \"x\", \"b\": null, \"c\": 3, \"d\": true}}`, &pb.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\"a\": {Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\"b\": {Kind: &stpb.Value_NullValue{}},\n\t\t\"c\": {Kind: &stpb.Value_NumberValue{3}},\n\t\t\"d\": {Kind: &stpb.Value_BoolValue{true}},\n\t}}}},\n\t{\"nested Struct\", Unmarshaler{}, `{\"st\": {\"a\": {\"b\": 1, \"c\": [{\"d\": true}, \"f\"]}}}`, &pb.KnownTypes{St: &stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\"a\": {Kind: &stpb.Value_StructValue{&stpb.Struct{Fields: map[string]*stpb.Value{\n\t\t\t\"b\": {Kind: &stpb.Value_NumberValue{1}},\n\t\t\t\"c\": {Kind: &stpb.Value_ListValue{&stpb.ListValue{Values: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StructValue{&stpb.Struct{Fields: map[string]*stpb.Value{\"d\": {Kind: &stpb.Value_BoolValue{true}}}}}},\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"f\"}},\n\t\t\t}}}},\n\t\t}}}},\n\t}}}},\n\t{\"null ListValue\", Unmarshaler{}, `{\"lv\": null}`, &pb.KnownTypes{Lv: nil}},\n\t{\"empty ListValue\", Unmarshaler{}, `{\"lv\": []}`, &pb.KnownTypes{Lv: &stpb.ListValue{}}},\n\t{\"basic ListValue\", Unmarshaler{}, `{\"lv\": [\"x\", null, 3, true]}`, &pb.KnownTypes{Lv: &stpb.ListValue{Values: []*stpb.Value{\n\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t{Kind: &stpb.Value_NullValue{}},\n\t\t{Kind: &stpb.Value_NumberValue{3}},\n\t\t{Kind: &stpb.Value_BoolValue{true}},\n\t}}}},\n\t{\"number Value\", Unmarshaler{}, `{\"val\":1}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NumberValue{1}}}},\n\t{\"null Value\", Unmarshaler{}, `{\"val\":null}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}}},\n\t{\"bool Value\", Unmarshaler{}, `{\"val\":true}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_BoolValue{true}}}},\n\t{\"string Value\", Unmarshaler{}, `{\"val\":\"x\"}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"x\"}}}},\n\t{\"string number value\", Unmarshaler{}, `{\"val\":\"9223372036854775807\"}`, &pb.KnownTypes{Val: &stpb.Value{Kind: &stpb.Value_StringValue{\"9223372036854775807\"}}}},\n\t{\"list of lists Value\", Unmarshaler{}, `{\"val\":[\"x\", [[\"y\"], \"z\"]]}`, &pb.KnownTypes{Val: &stpb.Value{\n\t\tKind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\tValues: []*stpb.Value{\n\t\t\t\t{Kind: &stpb.Value_StringValue{\"x\"}},\n\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\tValues: []*stpb.Value{\n\t\t\t\t\t\t{Kind: &stpb.Value_ListValue{&stpb.ListValue{\n\t\t\t\t\t\t\tValues: []*stpb.Value{{Kind: &stpb.Value_StringValue{\"y\"}}},\n\t\t\t\t\t\t}}},\n\t\t\t\t\t\t{Kind: &stpb.Value_StringValue{\"z\"}},\n\t\t\t\t\t},\n\t\t\t\t}}},\n\t\t\t},\n\t\t}}}}},\n\n\t{\"DoubleValue\", Unmarshaler{}, `{\"dbl\":1.2}`, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}},\n\t{\"FloatValue\", Unmarshaler{}, `{\"flt\":1.2}`, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}},\n\t{\"Int64Value\", Unmarshaler{}, `{\"i64\":\"-3\"}`, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}},\n\t{\"UInt64Value\", Unmarshaler{}, `{\"u64\":\"3\"}`, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}},\n\t{\"Int32Value\", Unmarshaler{}, `{\"i32\":-4}`, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}},\n\t{\"UInt32Value\", Unmarshaler{}, `{\"u32\":4}`, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}},\n\t{\"BoolValue\", Unmarshaler{}, `{\"bool\":true}`, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}},\n\t{\"StringValue\", Unmarshaler{}, `{\"str\":\"plush\"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: \"plush\"}}},\n\t{\"BytesValue\", Unmarshaler{}, `{\"bytes\":\"d293\"}`, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte(\"wow\")}}},\n\n\t// Ensure that `null` as a value ends up with a nil pointer instead of a [type]Value struct.\n\t{\"null DoubleValue\", Unmarshaler{}, `{\"dbl\":null}`, &pb.KnownTypes{Dbl: nil}},\n\t{\"null FloatValue\", Unmarshaler{}, `{\"flt\":null}`, &pb.KnownTypes{Flt: nil}},\n\t{\"null Int64Value\", Unmarshaler{}, `{\"i64\":null}`, &pb.KnownTypes{I64: nil}},\n\t{\"null UInt64Value\", Unmarshaler{}, `{\"u64\":null}`, &pb.KnownTypes{U64: nil}},\n\t{\"null Int32Value\", Unmarshaler{}, `{\"i32\":null}`, &pb.KnownTypes{I32: nil}},\n\t{\"null UInt32Value\", Unmarshaler{}, `{\"u32\":null}`, &pb.KnownTypes{U32: nil}},\n\t{\"null BoolValue\", Unmarshaler{}, `{\"bool\":null}`, &pb.KnownTypes{Bool: nil}},\n\t{\"null StringValue\", Unmarshaler{}, `{\"str\":null}`, &pb.KnownTypes{Str: nil}},\n\t{\"null BytesValue\", Unmarshaler{}, `{\"bytes\":null}`, &pb.KnownTypes{Bytes: nil}},\n}\n\nfunc TestUnmarshaling(t *testing.T) {\n\tfor _, tt := range unmarshalingTests {\n\t\t// Make a new instance of the type of our expected object.\n\t\tp := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)\n\n\t\terr := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: %v\", tt.desc, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// For easier diffs, compare text strings of the protos.\n\t\texp := proto.MarshalTextString(tt.pb)\n\t\tact := proto.MarshalTextString(p)\n\t\tif string(exp) != string(act) {\n\t\t\tt.Errorf(\"%s: got [%s] want [%s]\", tt.desc, act, exp)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalNullArray(t *testing.T) {\n\tvar repeats pb.Repeats\n\tif err := UnmarshalString(`{\"rBool\":null}`, &repeats); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(repeats, pb.Repeats{}) {\n\t\tt.Errorf(\"got non-nil fields in [%#v]\", repeats)\n\t}\n}\n\nfunc TestUnmarshalNullObject(t *testing.T) {\n\tvar maps pb.Maps\n\tif err := UnmarshalString(`{\"mInt64Str\":null}`, &maps); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(maps, pb.Maps{}) {\n\t\tt.Errorf(\"got non-nil fields in [%#v]\", maps)\n\t}\n}\n\nfunc TestUnmarshalNext(t *testing.T) {\n\t// We only need to check against a few, not all of them.\n\ttests := unmarshalingTests[:5]\n\n\t// Create a buffer with many concatenated JSON objects.\n\tvar b bytes.Buffer\n\tfor _, tt := range tests {\n\t\tb.WriteString(tt.json)\n\t}\n\n\tdec := json.NewDecoder(&b)\n\tfor _, tt := range tests {\n\t\t// Make a new instance of the type of our expected object.\n\t\tp := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)\n\n\t\terr := tt.unmarshaler.UnmarshalNext(dec, p)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: %v\", tt.desc, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// For easier diffs, compare text strings of the protos.\n\t\texp := proto.MarshalTextString(tt.pb)\n\t\tact := proto.MarshalTextString(p)\n\t\tif string(exp) != string(act) {\n\t\t\tt.Errorf(\"%s: got [%s] want [%s]\", tt.desc, act, exp)\n\t\t}\n\t}\n\n\tp := &pb.Simple{}\n\terr := new(Unmarshaler).UnmarshalNext(dec, p)\n\tif err != io.EOF {\n\t\tt.Errorf(\"eof: got %v, expected io.EOF\", err)\n\t}\n}\n\nvar unmarshalingShouldError = []struct {\n\tdesc string\n\tin   string\n\tpb   proto.Message\n}{\n\t{\"a value\", \"666\", new(pb.Simple)},\n\t{\"gibberish\", \"{adskja123;l23=-=\", new(pb.Simple)},\n\t{\"unknown field\", `{\"unknown\": \"foo\"}`, new(pb.Simple)},\n\t{\"unknown enum name\", `{\"hilarity\":\"DAVE\"}`, new(proto3pb.Message)},\n}\n\nfunc TestUnmarshalingBadInput(t *testing.T) {\n\tfor _, tt := range unmarshalingShouldError {\n\t\terr := UnmarshalString(tt.in, tt.pb)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"an error was expected when parsing %q instead of an object\", tt.desc)\n\t\t}\n\t}\n}\n\ntype funcResolver func(turl string) (proto.Message, error)\n\nfunc (fn funcResolver) Resolve(turl string) (proto.Message, error) {\n\treturn fn(turl)\n}\n\nfunc TestAnyWithCustomResolver(t *testing.T) {\n\tvar resolvedTypeUrls []string\n\tresolver := funcResolver(func(turl string) (proto.Message, error) {\n\t\tresolvedTypeUrls = append(resolvedTypeUrls, turl)\n\t\treturn new(pb.Simple), nil\n\t})\n\tmsg := &pb.Simple{\n\t\tOBytes:  []byte{1, 2, 3, 4},\n\t\tOBool:   proto.Bool(true),\n\t\tOString: proto.String(\"foobar\"),\n\t\tOInt64:  proto.Int64(1020304),\n\t}\n\tmsgBytes, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshaling message: %v\", err)\n\t}\n\t// make an Any with a type URL that won't resolve w/out custom resolver\n\tany := &anypb.Any{\n\t\tTypeUrl: \"https://foobar.com/some.random.MessageKind\",\n\t\tValue:   msgBytes,\n\t}\n\n\tm := Marshaler{AnyResolver: resolver}\n\tjs, err := m.MarshalToString(any)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshaling any to JSON: %v\", err)\n\t}\n\tif len(resolvedTypeUrls) != 1 {\n\t\tt.Errorf(\"custom resolver was not invoked during marshaling\")\n\t} else if resolvedTypeUrls[0] != \"https://foobar.com/some.random.MessageKind\" {\n\t\tt.Errorf(\"custom resolver was invoked with wrong URL: got %q, wanted %q\", resolvedTypeUrls[0], \"https://foobar.com/some.random.MessageKind\")\n\t}\n\twanted := `{\"@type\":\"https://foobar.com/some.random.MessageKind\",\"oBool\":true,\"oInt64\":\"1020304\",\"oString\":\"foobar\",\"oBytes\":\"AQIDBA==\"}`\n\tif js != wanted {\n\t\tt.Errorf(\"marshalling JSON produced incorrect output: got %s, wanted %s\", js, wanted)\n\t}\n\n\tu := Unmarshaler{AnyResolver: resolver}\n\troundTrip := &anypb.Any{}\n\terr = u.Unmarshal(bytes.NewReader([]byte(js)), roundTrip)\n\tif err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when unmarshaling any from JSON: %v\", err)\n\t}\n\tif len(resolvedTypeUrls) != 2 {\n\t\tt.Errorf(\"custom resolver was not invoked during marshaling\")\n\t} else if resolvedTypeUrls[1] != \"https://foobar.com/some.random.MessageKind\" {\n\t\tt.Errorf(\"custom resolver was invoked with wrong URL: got %q, wanted %q\", resolvedTypeUrls[1], \"https://foobar.com/some.random.MessageKind\")\n\t}\n\tif !proto.Equal(any, roundTrip) {\n\t\tt.Errorf(\"message contents not set correctly after unmarshalling JSON: got %s, wanted %s\", roundTrip, any)\n\t}\n}\n\nfunc TestUnmarshalJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{ \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tvar msg dynamicMessage\n\tif err := Unmarshal(strings.NewReader(rawJson), &msg); err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when parsing into JSONPBUnmarshaler: %v\", err)\n\t}\n\tif msg.rawJson != rawJson {\n\t\tt.Errorf(\"message contents not set correctly after unmarshalling JSON: got %s, wanted %s\", msg.rawJson, rawJson)\n\t}\n}\n\nfunc TestUnmarshalNullWithJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{\"stringField\":null}`\n\tvar ptrFieldMsg ptrFieldMessage\n\tif err := Unmarshal(strings.NewReader(rawJson), &ptrFieldMsg); err != nil {\n\t\tt.Errorf(\"unmarshal error: %v\", err)\n\t}\n\n\twant := ptrFieldMessage{StringField: &stringField{IsSet: true, StringValue: \"null\"}}\n\tif !proto.Equal(&ptrFieldMsg, &want) {\n\t\tt.Errorf(\"unmarshal result StringField: got %v, want %v\", ptrFieldMsg, want)\n\t}\n}\n\nfunc TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {\n\trawJson := `{ \"@type\": \"blah.com/` + dynamicMessageName + `\", \"foo\": \"bar\", \"baz\": [0, 1, 2, 3] }`\n\tvar got anypb.Any\n\tif err := Unmarshal(strings.NewReader(rawJson), &got); err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when parsing into JSONPBUnmarshaler: %v\", err)\n\t}\n\n\tdm := &dynamicMessage{rawJson: `{\"baz\":[0,1,2,3],\"foo\":\"bar\"}`}\n\tvar want anypb.Any\n\tif b, err := proto.Marshal(dm); err != nil {\n\t\tt.Errorf(\"an unexpected error occurred when marshaling message: %v\", err)\n\t} else {\n\t\twant.TypeUrl = \"blah.com/\" + dynamicMessageName\n\t\twant.Value = b\n\t}\n\n\tif !proto.Equal(&got, &want) {\n\t\tt.Errorf(\"message contents not set correctly after unmarshalling JSON: got %s, wanted %s\", got, want)\n\t}\n}\n\nconst (\n\tdynamicMessageName = \"google.protobuf.jsonpb.testing.dynamicMessage\"\n)\n\nfunc init() {\n\t// we register the custom type below so that we can use it in Any types\n\tproto.RegisterType((*dynamicMessage)(nil), dynamicMessageName)\n}\n\ntype ptrFieldMessage struct {\n\tStringField *stringField `protobuf:\"bytes,1,opt,name=stringField\"`\n}\n\nfunc (m *ptrFieldMessage) Reset() {\n}\n\nfunc (m *ptrFieldMessage) String() string {\n\treturn m.StringField.StringValue\n}\n\nfunc (m *ptrFieldMessage) ProtoMessage() {\n}\n\ntype stringField struct {\n\tIsSet       bool   `protobuf:\"varint,1,opt,name=isSet\"`\n\tStringValue string `protobuf:\"bytes,2,opt,name=stringValue\"`\n}\n\nfunc (s *stringField) Reset() {\n}\n\nfunc (s *stringField) String() string {\n\treturn s.StringValue\n}\n\nfunc (s *stringField) ProtoMessage() {\n}\n\nfunc (s *stringField) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {\n\ts.IsSet = true\n\ts.StringValue = string(js)\n\treturn nil\n}\n\n// dynamicMessage implements protobuf.Message but is not a normal generated message type.\n// It provides implementations of JSONPBMarshaler and JSONPBUnmarshaler for JSON support.\ntype dynamicMessage struct {\n\trawJson string `protobuf:\"bytes,1,opt,name=rawJson\"`\n}\n\nfunc (m *dynamicMessage) Reset() {\n\tm.rawJson = \"{}\"\n}\n\nfunc (m *dynamicMessage) String() string {\n\treturn m.rawJson\n}\n\nfunc (m *dynamicMessage) ProtoMessage() {\n}\n\nfunc (m *dynamicMessage) MarshalJSONPB(jm *Marshaler) ([]byte, error) {\n\treturn []byte(m.rawJson), nil\n}\n\nfunc (m *dynamicMessage) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {\n\tm.rawJson = string(js)\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2015 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nregenerate:\n\tprotoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: more_test_objects.proto\n\n/*\nPackage jsonpb is a generated protocol buffer package.\n\nIt is generated from these files:\n\tmore_test_objects.proto\n\ttest_objects.proto\n\nIt has these top-level messages:\n\tSimple3\n\tSimpleSlice3\n\tSimpleMap3\n\tSimpleNull3\n\tMappy\n\tSimple\n\tNonFinites\n\tRepeats\n\tWidget\n\tMaps\n\tMsgWithOneof\n\tReal\n\tComplex\n\tKnownTypes\n*/\npackage jsonpb\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype Numeral int32\n\nconst (\n\tNumeral_UNKNOWN Numeral = 0\n\tNumeral_ARABIC  Numeral = 1\n\tNumeral_ROMAN   Numeral = 2\n)\n\nvar Numeral_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"ARABIC\",\n\t2: \"ROMAN\",\n}\nvar Numeral_value = map[string]int32{\n\t\"UNKNOWN\": 0,\n\t\"ARABIC\":  1,\n\t\"ROMAN\":   2,\n}\n\nfunc (x Numeral) String() string {\n\treturn proto.EnumName(Numeral_name, int32(x))\n}\nfunc (Numeral) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\ntype Simple3 struct {\n\tDub float64 `protobuf:\"fixed64,1,opt,name=dub\" json:\"dub,omitempty\"`\n}\n\nfunc (m *Simple3) Reset()                    { *m = Simple3{} }\nfunc (m *Simple3) String() string            { return proto.CompactTextString(m) }\nfunc (*Simple3) ProtoMessage()               {}\nfunc (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\nfunc (m *Simple3) GetDub() float64 {\n\tif m != nil {\n\t\treturn m.Dub\n\t}\n\treturn 0\n}\n\ntype SimpleSlice3 struct {\n\tSlices []string `protobuf:\"bytes,1,rep,name=slices\" json:\"slices,omitempty\"`\n}\n\nfunc (m *SimpleSlice3) Reset()                    { *m = SimpleSlice3{} }\nfunc (m *SimpleSlice3) String() string            { return proto.CompactTextString(m) }\nfunc (*SimpleSlice3) ProtoMessage()               {}\nfunc (*SimpleSlice3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\nfunc (m *SimpleSlice3) GetSlices() []string {\n\tif m != nil {\n\t\treturn m.Slices\n\t}\n\treturn nil\n}\n\ntype SimpleMap3 struct {\n\tStringy map[string]string `protobuf:\"bytes,1,rep,name=stringy\" json:\"stringy,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n}\n\nfunc (m *SimpleMap3) Reset()                    { *m = SimpleMap3{} }\nfunc (m *SimpleMap3) String() string            { return proto.CompactTextString(m) }\nfunc (*SimpleMap3) ProtoMessage()               {}\nfunc (*SimpleMap3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\nfunc (m *SimpleMap3) GetStringy() map[string]string {\n\tif m != nil {\n\t\treturn m.Stringy\n\t}\n\treturn nil\n}\n\ntype SimpleNull3 struct {\n\tSimple *Simple3 `protobuf:\"bytes,1,opt,name=simple\" json:\"simple,omitempty\"`\n}\n\nfunc (m *SimpleNull3) Reset()                    { *m = SimpleNull3{} }\nfunc (m *SimpleNull3) String() string            { return proto.CompactTextString(m) }\nfunc (*SimpleNull3) ProtoMessage()               {}\nfunc (*SimpleNull3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\n\nfunc (m *SimpleNull3) GetSimple() *Simple3 {\n\tif m != nil {\n\t\treturn m.Simple\n\t}\n\treturn nil\n}\n\ntype Mappy struct {\n\tNummy    map[int64]int32    `protobuf:\"bytes,1,rep,name=nummy\" json:\"nummy,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tStrry    map[string]string  `protobuf:\"bytes,2,rep,name=strry\" json:\"strry,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tObjjy    map[int32]*Simple3 `protobuf:\"bytes,3,rep,name=objjy\" json:\"objjy,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tBuggy    map[int64]string   `protobuf:\"bytes,4,rep,name=buggy\" json:\"buggy,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tBooly    map[bool]bool      `protobuf:\"bytes,5,rep,name=booly\" json:\"booly,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tEnumy    map[string]Numeral `protobuf:\"bytes,6,rep,name=enumy\" json:\"enumy,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value,enum=jsonpb.Numeral\"`\n\tS32Booly map[int32]bool     `protobuf:\"bytes,7,rep,name=s32booly\" json:\"s32booly,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tS64Booly map[int64]bool     `protobuf:\"bytes,8,rep,name=s64booly\" json:\"s64booly,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tU32Booly map[uint32]bool    `protobuf:\"bytes,9,rep,name=u32booly\" json:\"u32booly,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n\tU64Booly map[uint64]bool    `protobuf:\"bytes,10,rep,name=u64booly\" json:\"u64booly,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n}\n\nfunc (m *Mappy) Reset()                    { *m = Mappy{} }\nfunc (m *Mappy) String() string            { return proto.CompactTextString(m) }\nfunc (*Mappy) ProtoMessage()               {}\nfunc (*Mappy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }\n\nfunc (m *Mappy) GetNummy() map[int64]int32 {\n\tif m != nil {\n\t\treturn m.Nummy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetStrry() map[string]string {\n\tif m != nil {\n\t\treturn m.Strry\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetObjjy() map[int32]*Simple3 {\n\tif m != nil {\n\t\treturn m.Objjy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetBuggy() map[int64]string {\n\tif m != nil {\n\t\treturn m.Buggy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetBooly() map[bool]bool {\n\tif m != nil {\n\t\treturn m.Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetEnumy() map[string]Numeral {\n\tif m != nil {\n\t\treturn m.Enumy\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetS32Booly() map[int32]bool {\n\tif m != nil {\n\t\treturn m.S32Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetS64Booly() map[int64]bool {\n\tif m != nil {\n\t\treturn m.S64Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetU32Booly() map[uint32]bool {\n\tif m != nil {\n\t\treturn m.U32Booly\n\t}\n\treturn nil\n}\n\nfunc (m *Mappy) GetU64Booly() map[uint64]bool {\n\tif m != nil {\n\t\treturn m.U64Booly\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterType((*Simple3)(nil), \"jsonpb.Simple3\")\n\tproto.RegisterType((*SimpleSlice3)(nil), \"jsonpb.SimpleSlice3\")\n\tproto.RegisterType((*SimpleMap3)(nil), \"jsonpb.SimpleMap3\")\n\tproto.RegisterType((*SimpleNull3)(nil), \"jsonpb.SimpleNull3\")\n\tproto.RegisterType((*Mappy)(nil), \"jsonpb.Mappy\")\n\tproto.RegisterEnum(\"jsonpb.Numeral\", Numeral_name, Numeral_value)\n}\n\nfunc init() { proto.RegisterFile(\"more_test_objects.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 526 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x6b, 0xdb, 0x3c,\n\t0x14, 0x87, 0x5f, 0x27, 0xf5, 0xd7, 0x49, 0xfb, 0x2e, 0x88, 0xb1, 0x99, 0xf4, 0x62, 0xc5, 0xb0,\n\t0xad, 0x0c, 0xe6, 0x8b, 0x78, 0x74, 0x5d, 0x77, 0x95, 0x8e, 0x5e, 0x94, 0x11, 0x07, 0x1c, 0xc2,\n\t0x2e, 0x4b, 0xdc, 0x99, 0x90, 0xcc, 0x5f, 0xd8, 0xd6, 0xc0, 0xd7, 0xfb, 0xbb, 0x07, 0xe3, 0x48,\n\t0x72, 0x2d, 0x07, 0x85, 0x6c, 0x77, 0x52, 0x7e, 0xcf, 0xe3, 0x73, 0x24, 0x1d, 0x02, 0x2f, 0xd3,\n\t0xbc, 0x8c, 0x1f, 0xea, 0xb8, 0xaa, 0x1f, 0xf2, 0x68, 0x17, 0x3f, 0xd6, 0x95, 0x57, 0x94, 0x79,\n\t0x9d, 0x13, 0x63, 0x57, 0xe5, 0x59, 0x11, 0xb9, 0xe7, 0x60, 0x2e, 0xb7, 0x69, 0x91, 0xc4, 0x3e,\n\t0x19, 0xc3, 0xf0, 0x3b, 0x8d, 0x1c, 0xed, 0x42, 0xbb, 0xd4, 0x42, 0x5c, 0xba, 0x6f, 0xe0, 0x94,\n\t0x87, 0xcb, 0x64, 0xfb, 0x18, 0xfb, 0xe4, 0x05, 0x18, 0x15, 0xae, 0x2a, 0x47, 0xbb, 0x18, 0x5e,\n\t0xda, 0xa1, 0xd8, 0xb9, 0xbf, 0x34, 0x00, 0x0e, 0xce, 0xd7, 0x85, 0x4f, 0x3e, 0x81, 0x59, 0xd5,\n\t0xe5, 0x36, 0xdb, 0x34, 0x8c, 0x1b, 0x4d, 0x5f, 0x79, 0xbc, 0x9a, 0xd7, 0x41, 0xde, 0x92, 0x13,\n\t0x77, 0x59, 0x5d, 0x36, 0x61, 0xcb, 0x4f, 0x6e, 0xe0, 0x54, 0x0e, 0xb0, 0xa7, 0x1f, 0x71, 0xc3,\n\t0x7a, 0xb2, 0x43, 0x5c, 0x92, 0xe7, 0xa0, 0xff, 0x5c, 0x27, 0x34, 0x76, 0x06, 0xec, 0x37, 0xbe,\n\t0xb9, 0x19, 0x5c, 0x6b, 0xee, 0x15, 0x8c, 0xf8, 0xf7, 0x03, 0x9a, 0x24, 0x3e, 0x79, 0x0b, 0x46,\n\t0xc5, 0xb6, 0xcc, 0x1e, 0x4d, 0x9f, 0xf5, 0x9b, 0xf0, 0x43, 0x11, 0xbb, 0xbf, 0x2d, 0xd0, 0xe7,\n\t0xeb, 0xa2, 0x68, 0x88, 0x07, 0x7a, 0x46, 0xd3, 0xb4, 0x6d, 0xdb, 0x69, 0x0d, 0x96, 0x7a, 0x01,\n\t0x46, 0xbc, 0x5f, 0x8e, 0x21, 0x5f, 0xd5, 0x65, 0xd9, 0x38, 0x03, 0x15, 0xbf, 0xc4, 0x48, 0xf0,\n\t0x0c, 0x43, 0x3e, 0x8f, 0x76, 0xbb, 0xc6, 0x19, 0xaa, 0xf8, 0x05, 0x46, 0x82, 0x67, 0x18, 0xf2,\n\t0x11, 0xdd, 0x6c, 0x1a, 0xe7, 0x44, 0xc5, 0xdf, 0x62, 0x24, 0x78, 0x86, 0x31, 0x3e, 0xcf, 0x93,\n\t0xc6, 0xd1, 0x95, 0x3c, 0x46, 0x2d, 0x8f, 0x6b, 0xe4, 0xe3, 0x8c, 0xa6, 0x8d, 0x63, 0xa8, 0xf8,\n\t0x3b, 0x8c, 0x04, 0xcf, 0x30, 0xf2, 0x11, 0xac, 0xca, 0x9f, 0xf2, 0x12, 0x26, 0x53, 0xce, 0xf7,\n\t0x8e, 0x2c, 0x52, 0x6e, 0x3d, 0xc1, 0x4c, 0xbc, 0xfa, 0xc0, 0x45, 0x4b, 0x29, 0x8a, 0xb4, 0x15,\n\t0xc5, 0x16, 0x45, 0xda, 0x56, 0xb4, 0x55, 0xe2, 0xaa, 0x5f, 0x91, 0x4a, 0x15, 0x69, 0x5b, 0x11,\n\t0x94, 0x62, 0xbf, 0x62, 0x0b, 0x4f, 0xae, 0x01, 0xba, 0x87, 0x96, 0xe7, 0x6f, 0xa8, 0x98, 0x3f,\n\t0x5d, 0x9a, 0x3f, 0x34, 0xbb, 0x27, 0xff, 0x97, 0xc9, 0x9d, 0xdc, 0x03, 0x74, 0x8f, 0x2f, 0x9b,\n\t0x3a, 0x37, 0x5f, 0xcb, 0xa6, 0x62, 0x92, 0xfb, 0x4d, 0x74, 0x73, 0x71, 0xac, 0x7d, 0x7b, 0xdf,\n\t0x7c, 0xba, 0x10, 0xd9, 0xb4, 0x14, 0xa6, 0xb5, 0xd7, 0x7e, 0x37, 0x2b, 0x8a, 0x83, 0xf7, 0xda,\n\t0xff, 0xbf, 0x6b, 0x3f, 0xa0, 0x69, 0x5c, 0xae, 0x13, 0xf9, 0x53, 0x9f, 0xe1, 0xac, 0x37, 0x43,\n\t0x8a, 0xcb, 0x38, 0xdc, 0x07, 0xca, 0xf2, 0xab, 0x1e, 0x3b, 0xfe, 0xbe, 0xbc, 0x3a, 0x54, 0xf9,\n\t0xec, 0x6f, 0xe4, 0x43, 0x95, 0x4f, 0x8e, 0xc8, 0xef, 0xde, 0x83, 0x29, 0x6e, 0x82, 0x8c, 0xc0,\n\t0x5c, 0x05, 0x5f, 0x83, 0xc5, 0xb7, 0x60, 0xfc, 0x1f, 0x01, 0x30, 0x66, 0xe1, 0xec, 0xf6, 0xfe,\n\t0xcb, 0x58, 0x23, 0x36, 0xe8, 0xe1, 0x62, 0x3e, 0x0b, 0xc6, 0x83, 0xc8, 0x60, 0x7f, 0xe0, 0xfe,\n\t0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x34, 0xaf, 0xdb, 0x05, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage jsonpb;\n\nmessage Simple3 {\n  double dub = 1;\n}\n\nmessage SimpleSlice3 {\n  repeated string slices = 1;\n}\n\nmessage SimpleMap3 {\n  map<string,string> stringy = 1;\n}\n\nmessage SimpleNull3 {\n  Simple3 simple = 1;\n}\n\nenum Numeral {\n  UNKNOWN = 0;\n  ARABIC = 1;\n  ROMAN = 2;\n}\n\nmessage Mappy {\n  map<int64, int32> nummy = 1;\n  map<string, string> strry = 2;\n  map<int32, Simple3> objjy = 3;\n  map<int64, string> buggy = 4;\n  map<bool, bool> booly = 5;\n  map<string, Numeral> enumy = 6;\n  map<int32, bool> s32booly = 7;\n  map<int64, bool> s64booly = 8;\n  map<uint32, bool> u32booly = 9;\n  map<uint64, bool> u64booly = 10;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: test_objects.proto\n\npackage jsonpb\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport google_protobuf \"github.com/golang/protobuf/ptypes/any\"\nimport google_protobuf1 \"github.com/golang/protobuf/ptypes/duration\"\nimport google_protobuf2 \"github.com/golang/protobuf/ptypes/struct\"\nimport google_protobuf3 \"github.com/golang/protobuf/ptypes/timestamp\"\nimport google_protobuf4 \"github.com/golang/protobuf/ptypes/wrappers\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\ntype Widget_Color int32\n\nconst (\n\tWidget_RED   Widget_Color = 0\n\tWidget_GREEN Widget_Color = 1\n\tWidget_BLUE  Widget_Color = 2\n)\n\nvar Widget_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\nvar Widget_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Widget_Color) Enum() *Widget_Color {\n\tp := new(Widget_Color)\n\t*p = x\n\treturn p\n}\nfunc (x Widget_Color) String() string {\n\treturn proto.EnumName(Widget_Color_name, int32(x))\n}\nfunc (x *Widget_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Widget_Color_value, data, \"Widget_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Widget_Color(value)\n\treturn nil\n}\nfunc (Widget_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{3, 0} }\n\n// Test message for holding primitive types.\ntype Simple struct {\n\tOBool            *bool    `protobuf:\"varint,1,opt,name=o_bool,json=oBool\" json:\"o_bool,omitempty\"`\n\tOInt32           *int32   `protobuf:\"varint,2,opt,name=o_int32,json=oInt32\" json:\"o_int32,omitempty\"`\n\tOInt64           *int64   `protobuf:\"varint,3,opt,name=o_int64,json=oInt64\" json:\"o_int64,omitempty\"`\n\tOUint32          *uint32  `protobuf:\"varint,4,opt,name=o_uint32,json=oUint32\" json:\"o_uint32,omitempty\"`\n\tOUint64          *uint64  `protobuf:\"varint,5,opt,name=o_uint64,json=oUint64\" json:\"o_uint64,omitempty\"`\n\tOSint32          *int32   `protobuf:\"zigzag32,6,opt,name=o_sint32,json=oSint32\" json:\"o_sint32,omitempty\"`\n\tOSint64          *int64   `protobuf:\"zigzag64,7,opt,name=o_sint64,json=oSint64\" json:\"o_sint64,omitempty\"`\n\tOFloat           *float32 `protobuf:\"fixed32,8,opt,name=o_float,json=oFloat\" json:\"o_float,omitempty\"`\n\tODouble          *float64 `protobuf:\"fixed64,9,opt,name=o_double,json=oDouble\" json:\"o_double,omitempty\"`\n\tOString          *string  `protobuf:\"bytes,10,opt,name=o_string,json=oString\" json:\"o_string,omitempty\"`\n\tOBytes           []byte   `protobuf:\"bytes,11,opt,name=o_bytes,json=oBytes\" json:\"o_bytes,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *Simple) Reset()                    { *m = Simple{} }\nfunc (m *Simple) String() string            { return proto.CompactTextString(m) }\nfunc (*Simple) ProtoMessage()               {}\nfunc (*Simple) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }\n\nfunc (m *Simple) GetOBool() bool {\n\tif m != nil && m.OBool != nil {\n\t\treturn *m.OBool\n\t}\n\treturn false\n}\n\nfunc (m *Simple) GetOInt32() int32 {\n\tif m != nil && m.OInt32 != nil {\n\t\treturn *m.OInt32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOInt64() int64 {\n\tif m != nil && m.OInt64 != nil {\n\t\treturn *m.OInt64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint32() uint32 {\n\tif m != nil && m.OUint32 != nil {\n\t\treturn *m.OUint32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOUint64() uint64 {\n\tif m != nil && m.OUint64 != nil {\n\t\treturn *m.OUint64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint32() int32 {\n\tif m != nil && m.OSint32 != nil {\n\t\treturn *m.OSint32\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOSint64() int64 {\n\tif m != nil && m.OSint64 != nil {\n\t\treturn *m.OSint64\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOFloat() float32 {\n\tif m != nil && m.OFloat != nil {\n\t\treturn *m.OFloat\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetODouble() float64 {\n\tif m != nil && m.ODouble != nil {\n\t\treturn *m.ODouble\n\t}\n\treturn 0\n}\n\nfunc (m *Simple) GetOString() string {\n\tif m != nil && m.OString != nil {\n\t\treturn *m.OString\n\t}\n\treturn \"\"\n}\n\nfunc (m *Simple) GetOBytes() []byte {\n\tif m != nil {\n\t\treturn m.OBytes\n\t}\n\treturn nil\n}\n\n// Test message for holding special non-finites primitives.\ntype NonFinites struct {\n\tFNan             *float32 `protobuf:\"fixed32,1,opt,name=f_nan,json=fNan\" json:\"f_nan,omitempty\"`\n\tFPinf            *float32 `protobuf:\"fixed32,2,opt,name=f_pinf,json=fPinf\" json:\"f_pinf,omitempty\"`\n\tFNinf            *float32 `protobuf:\"fixed32,3,opt,name=f_ninf,json=fNinf\" json:\"f_ninf,omitempty\"`\n\tDNan             *float64 `protobuf:\"fixed64,4,opt,name=d_nan,json=dNan\" json:\"d_nan,omitempty\"`\n\tDPinf            *float64 `protobuf:\"fixed64,5,opt,name=d_pinf,json=dPinf\" json:\"d_pinf,omitempty\"`\n\tDNinf            *float64 `protobuf:\"fixed64,6,opt,name=d_ninf,json=dNinf\" json:\"d_ninf,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *NonFinites) Reset()                    { *m = NonFinites{} }\nfunc (m *NonFinites) String() string            { return proto.CompactTextString(m) }\nfunc (*NonFinites) ProtoMessage()               {}\nfunc (*NonFinites) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }\n\nfunc (m *NonFinites) GetFNan() float32 {\n\tif m != nil && m.FNan != nil {\n\t\treturn *m.FNan\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetFPinf() float32 {\n\tif m != nil && m.FPinf != nil {\n\t\treturn *m.FPinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetFNinf() float32 {\n\tif m != nil && m.FNinf != nil {\n\t\treturn *m.FNinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDNan() float64 {\n\tif m != nil && m.DNan != nil {\n\t\treturn *m.DNan\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDPinf() float64 {\n\tif m != nil && m.DPinf != nil {\n\t\treturn *m.DPinf\n\t}\n\treturn 0\n}\n\nfunc (m *NonFinites) GetDNinf() float64 {\n\tif m != nil && m.DNinf != nil {\n\t\treturn *m.DNinf\n\t}\n\treturn 0\n}\n\n// Test message for holding repeated primitives.\ntype Repeats struct {\n\tRBool            []bool    `protobuf:\"varint,1,rep,name=r_bool,json=rBool\" json:\"r_bool,omitempty\"`\n\tRInt32           []int32   `protobuf:\"varint,2,rep,name=r_int32,json=rInt32\" json:\"r_int32,omitempty\"`\n\tRInt64           []int64   `protobuf:\"varint,3,rep,name=r_int64,json=rInt64\" json:\"r_int64,omitempty\"`\n\tRUint32          []uint32  `protobuf:\"varint,4,rep,name=r_uint32,json=rUint32\" json:\"r_uint32,omitempty\"`\n\tRUint64          []uint64  `protobuf:\"varint,5,rep,name=r_uint64,json=rUint64\" json:\"r_uint64,omitempty\"`\n\tRSint32          []int32   `protobuf:\"zigzag32,6,rep,name=r_sint32,json=rSint32\" json:\"r_sint32,omitempty\"`\n\tRSint64          []int64   `protobuf:\"zigzag64,7,rep,name=r_sint64,json=rSint64\" json:\"r_sint64,omitempty\"`\n\tRFloat           []float32 `protobuf:\"fixed32,8,rep,name=r_float,json=rFloat\" json:\"r_float,omitempty\"`\n\tRDouble          []float64 `protobuf:\"fixed64,9,rep,name=r_double,json=rDouble\" json:\"r_double,omitempty\"`\n\tRString          []string  `protobuf:\"bytes,10,rep,name=r_string,json=rString\" json:\"r_string,omitempty\"`\n\tRBytes           [][]byte  `protobuf:\"bytes,11,rep,name=r_bytes,json=rBytes\" json:\"r_bytes,omitempty\"`\n\tXXX_unrecognized []byte    `json:\"-\"`\n}\n\nfunc (m *Repeats) Reset()                    { *m = Repeats{} }\nfunc (m *Repeats) String() string            { return proto.CompactTextString(m) }\nfunc (*Repeats) ProtoMessage()               {}\nfunc (*Repeats) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }\n\nfunc (m *Repeats) GetRBool() []bool {\n\tif m != nil {\n\t\treturn m.RBool\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRInt32() []int32 {\n\tif m != nil {\n\t\treturn m.RInt32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRInt64() []int64 {\n\tif m != nil {\n\t\treturn m.RInt64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRUint32() []uint32 {\n\tif m != nil {\n\t\treturn m.RUint32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRUint64() []uint64 {\n\tif m != nil {\n\t\treturn m.RUint64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRSint32() []int32 {\n\tif m != nil {\n\t\treturn m.RSint32\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRSint64() []int64 {\n\tif m != nil {\n\t\treturn m.RSint64\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRFloat() []float32 {\n\tif m != nil {\n\t\treturn m.RFloat\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRDouble() []float64 {\n\tif m != nil {\n\t\treturn m.RDouble\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRString() []string {\n\tif m != nil {\n\t\treturn m.RString\n\t}\n\treturn nil\n}\n\nfunc (m *Repeats) GetRBytes() [][]byte {\n\tif m != nil {\n\t\treturn m.RBytes\n\t}\n\treturn nil\n}\n\n// Test message for holding enums and nested messages.\ntype Widget struct {\n\tColor            *Widget_Color  `protobuf:\"varint,1,opt,name=color,enum=jsonpb.Widget_Color\" json:\"color,omitempty\"`\n\tRColor           []Widget_Color `protobuf:\"varint,2,rep,name=r_color,json=rColor,enum=jsonpb.Widget_Color\" json:\"r_color,omitempty\"`\n\tSimple           *Simple        `protobuf:\"bytes,10,opt,name=simple\" json:\"simple,omitempty\"`\n\tRSimple          []*Simple      `protobuf:\"bytes,11,rep,name=r_simple,json=rSimple\" json:\"r_simple,omitempty\"`\n\tRepeats          *Repeats       `protobuf:\"bytes,20,opt,name=repeats\" json:\"repeats,omitempty\"`\n\tRRepeats         []*Repeats     `protobuf:\"bytes,21,rep,name=r_repeats,json=rRepeats\" json:\"r_repeats,omitempty\"`\n\tXXX_unrecognized []byte         `json:\"-\"`\n}\n\nfunc (m *Widget) Reset()                    { *m = Widget{} }\nfunc (m *Widget) String() string            { return proto.CompactTextString(m) }\nfunc (*Widget) ProtoMessage()               {}\nfunc (*Widget) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }\n\nfunc (m *Widget) GetColor() Widget_Color {\n\tif m != nil && m.Color != nil {\n\t\treturn *m.Color\n\t}\n\treturn Widget_RED\n}\n\nfunc (m *Widget) GetRColor() []Widget_Color {\n\tif m != nil {\n\t\treturn m.RColor\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetSimple() *Simple {\n\tif m != nil {\n\t\treturn m.Simple\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRSimple() []*Simple {\n\tif m != nil {\n\t\treturn m.RSimple\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRepeats() *Repeats {\n\tif m != nil {\n\t\treturn m.Repeats\n\t}\n\treturn nil\n}\n\nfunc (m *Widget) GetRRepeats() []*Repeats {\n\tif m != nil {\n\t\treturn m.RRepeats\n\t}\n\treturn nil\n}\n\ntype Maps struct {\n\tMInt64Str        map[int64]string `protobuf:\"bytes,1,rep,name=m_int64_str,json=mInt64Str\" json:\"m_int64_str,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMBoolSimple      map[bool]*Simple `protobuf:\"bytes,2,rep,name=m_bool_simple,json=mBoolSimple\" json:\"m_bool_simple,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tXXX_unrecognized []byte           `json:\"-\"`\n}\n\nfunc (m *Maps) Reset()                    { *m = Maps{} }\nfunc (m *Maps) String() string            { return proto.CompactTextString(m) }\nfunc (*Maps) ProtoMessage()               {}\nfunc (*Maps) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }\n\nfunc (m *Maps) GetMInt64Str() map[int64]string {\n\tif m != nil {\n\t\treturn m.MInt64Str\n\t}\n\treturn nil\n}\n\nfunc (m *Maps) GetMBoolSimple() map[bool]*Simple {\n\tif m != nil {\n\t\treturn m.MBoolSimple\n\t}\n\treturn nil\n}\n\ntype MsgWithOneof struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*MsgWithOneof_Title\n\t//\t*MsgWithOneof_Salary\n\t//\t*MsgWithOneof_Country\n\t//\t*MsgWithOneof_HomeAddress\n\tUnion            isMsgWithOneof_Union `protobuf_oneof:\"union\"`\n\tXXX_unrecognized []byte               `json:\"-\"`\n}\n\nfunc (m *MsgWithOneof) Reset()                    { *m = MsgWithOneof{} }\nfunc (m *MsgWithOneof) String() string            { return proto.CompactTextString(m) }\nfunc (*MsgWithOneof) ProtoMessage()               {}\nfunc (*MsgWithOneof) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} }\n\ntype isMsgWithOneof_Union interface {\n\tisMsgWithOneof_Union()\n}\n\ntype MsgWithOneof_Title struct {\n\tTitle string `protobuf:\"bytes,1,opt,name=title,oneof\"`\n}\ntype MsgWithOneof_Salary struct {\n\tSalary int64 `protobuf:\"varint,2,opt,name=salary,oneof\"`\n}\ntype MsgWithOneof_Country struct {\n\tCountry string `protobuf:\"bytes,3,opt,name=Country,oneof\"`\n}\ntype MsgWithOneof_HomeAddress struct {\n\tHomeAddress string `protobuf:\"bytes,4,opt,name=home_address,json=homeAddress,oneof\"`\n}\n\nfunc (*MsgWithOneof_Title) isMsgWithOneof_Union()       {}\nfunc (*MsgWithOneof_Salary) isMsgWithOneof_Union()      {}\nfunc (*MsgWithOneof_Country) isMsgWithOneof_Union()     {}\nfunc (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {}\n\nfunc (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *MsgWithOneof) GetTitle() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Title); ok {\n\t\treturn x.Title\n\t}\n\treturn \"\"\n}\n\nfunc (m *MsgWithOneof) GetSalary() int64 {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Salary); ok {\n\t\treturn x.Salary\n\t}\n\treturn 0\n}\n\nfunc (m *MsgWithOneof) GetCountry() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_Country); ok {\n\t\treturn x.Country\n\t}\n\treturn \"\"\n}\n\nfunc (m *MsgWithOneof) GetHomeAddress() string {\n\tif x, ok := m.GetUnion().(*MsgWithOneof_HomeAddress); ok {\n\t\treturn x.HomeAddress\n\t}\n\treturn \"\"\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{\n\t\t(*MsgWithOneof_Title)(nil),\n\t\t(*MsgWithOneof_Salary)(nil),\n\t\t(*MsgWithOneof_Country)(nil),\n\t\t(*MsgWithOneof_HomeAddress)(nil),\n\t}\n}\n\nfunc _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*MsgWithOneof)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *MsgWithOneof_Title:\n\t\tb.EncodeVarint(1<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Title)\n\tcase *MsgWithOneof_Salary:\n\t\tb.EncodeVarint(2<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Salary))\n\tcase *MsgWithOneof_Country:\n\t\tb.EncodeVarint(3<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Country)\n\tcase *MsgWithOneof_HomeAddress:\n\t\tb.EncodeVarint(4<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.HomeAddress)\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"MsgWithOneof.Union has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*MsgWithOneof)\n\tswitch tag {\n\tcase 1: // union.title\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &MsgWithOneof_Title{x}\n\t\treturn true, err\n\tcase 2: // union.salary\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &MsgWithOneof_Salary{int64(x)}\n\t\treturn true, err\n\tcase 3: // union.Country\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &MsgWithOneof_Country{x}\n\t\treturn true, err\n\tcase 4: // union.home_address\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &MsgWithOneof_HomeAddress{x}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _MsgWithOneof_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*MsgWithOneof)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *MsgWithOneof_Title:\n\t\tn += proto.SizeVarint(1<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Title)))\n\t\tn += len(x.Title)\n\tcase *MsgWithOneof_Salary:\n\t\tn += proto.SizeVarint(2<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Salary))\n\tcase *MsgWithOneof_Country:\n\t\tn += proto.SizeVarint(3<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Country)))\n\t\tn += len(x.Country)\n\tcase *MsgWithOneof_HomeAddress:\n\t\tn += proto.SizeVarint(4<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.HomeAddress)))\n\t\tn += len(x.HomeAddress)\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\ntype Real struct {\n\tValue                        *float64 `protobuf:\"fixed64,1,opt,name=value\" json:\"value,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *Real) Reset()                    { *m = Real{} }\nfunc (m *Real) String() string            { return proto.CompactTextString(m) }\nfunc (*Real) ProtoMessage()               {}\nfunc (*Real) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} }\n\nvar extRange_Real = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*Real) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Real\n}\n\nfunc (m *Real) GetValue() float64 {\n\tif m != nil && m.Value != nil {\n\t\treturn *m.Value\n\t}\n\treturn 0\n}\n\ntype Complex struct {\n\tImaginary                    *float64 `protobuf:\"fixed64,1,opt,name=imaginary\" json:\"imaginary,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *Complex) Reset()                    { *m = Complex{} }\nfunc (m *Complex) String() string            { return proto.CompactTextString(m) }\nfunc (*Complex) ProtoMessage()               {}\nfunc (*Complex) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }\n\nvar extRange_Complex = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*Complex) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Complex\n}\n\nfunc (m *Complex) GetImaginary() float64 {\n\tif m != nil && m.Imaginary != nil {\n\t\treturn *m.Imaginary\n\t}\n\treturn 0\n}\n\nvar E_Complex_RealExtension = &proto.ExtensionDesc{\n\tExtendedType:  (*Real)(nil),\n\tExtensionType: (*Complex)(nil),\n\tField:         123,\n\tName:          \"jsonpb.Complex.real_extension\",\n\tTag:           \"bytes,123,opt,name=real_extension,json=realExtension\",\n\tFilename:      \"test_objects.proto\",\n}\n\ntype KnownTypes struct {\n\tAn               *google_protobuf.Any          `protobuf:\"bytes,14,opt,name=an\" json:\"an,omitempty\"`\n\tDur              *google_protobuf1.Duration    `protobuf:\"bytes,1,opt,name=dur\" json:\"dur,omitempty\"`\n\tSt               *google_protobuf2.Struct      `protobuf:\"bytes,12,opt,name=st\" json:\"st,omitempty\"`\n\tTs               *google_protobuf3.Timestamp   `protobuf:\"bytes,2,opt,name=ts\" json:\"ts,omitempty\"`\n\tLv               *google_protobuf2.ListValue   `protobuf:\"bytes,15,opt,name=lv\" json:\"lv,omitempty\"`\n\tVal              *google_protobuf2.Value       `protobuf:\"bytes,16,opt,name=val\" json:\"val,omitempty\"`\n\tDbl              *google_protobuf4.DoubleValue `protobuf:\"bytes,3,opt,name=dbl\" json:\"dbl,omitempty\"`\n\tFlt              *google_protobuf4.FloatValue  `protobuf:\"bytes,4,opt,name=flt\" json:\"flt,omitempty\"`\n\tI64              *google_protobuf4.Int64Value  `protobuf:\"bytes,5,opt,name=i64\" json:\"i64,omitempty\"`\n\tU64              *google_protobuf4.UInt64Value `protobuf:\"bytes,6,opt,name=u64\" json:\"u64,omitempty\"`\n\tI32              *google_protobuf4.Int32Value  `protobuf:\"bytes,7,opt,name=i32\" json:\"i32,omitempty\"`\n\tU32              *google_protobuf4.UInt32Value `protobuf:\"bytes,8,opt,name=u32\" json:\"u32,omitempty\"`\n\tBool             *google_protobuf4.BoolValue   `protobuf:\"bytes,9,opt,name=bool\" json:\"bool,omitempty\"`\n\tStr              *google_protobuf4.StringValue `protobuf:\"bytes,10,opt,name=str\" json:\"str,omitempty\"`\n\tBytes            *google_protobuf4.BytesValue  `protobuf:\"bytes,11,opt,name=bytes\" json:\"bytes,omitempty\"`\n\tXXX_unrecognized []byte                        `json:\"-\"`\n}\n\nfunc (m *KnownTypes) Reset()                    { *m = KnownTypes{} }\nfunc (m *KnownTypes) String() string            { return proto.CompactTextString(m) }\nfunc (*KnownTypes) ProtoMessage()               {}\nfunc (*KnownTypes) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }\n\nfunc (m *KnownTypes) GetAn() *google_protobuf.Any {\n\tif m != nil {\n\t\treturn m.An\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetDur() *google_protobuf1.Duration {\n\tif m != nil {\n\t\treturn m.Dur\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetSt() *google_protobuf2.Struct {\n\tif m != nil {\n\t\treturn m.St\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetTs() *google_protobuf3.Timestamp {\n\tif m != nil {\n\t\treturn m.Ts\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetLv() *google_protobuf2.ListValue {\n\tif m != nil {\n\t\treturn m.Lv\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetVal() *google_protobuf2.Value {\n\tif m != nil {\n\t\treturn m.Val\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetDbl() *google_protobuf4.DoubleValue {\n\tif m != nil {\n\t\treturn m.Dbl\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetFlt() *google_protobuf4.FloatValue {\n\tif m != nil {\n\t\treturn m.Flt\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetI64() *google_protobuf4.Int64Value {\n\tif m != nil {\n\t\treturn m.I64\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetU64() *google_protobuf4.UInt64Value {\n\tif m != nil {\n\t\treturn m.U64\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetI32() *google_protobuf4.Int32Value {\n\tif m != nil {\n\t\treturn m.I32\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetU32() *google_protobuf4.UInt32Value {\n\tif m != nil {\n\t\treturn m.U32\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetBool() *google_protobuf4.BoolValue {\n\tif m != nil {\n\t\treturn m.Bool\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetStr() *google_protobuf4.StringValue {\n\tif m != nil {\n\t\treturn m.Str\n\t}\n\treturn nil\n}\n\nfunc (m *KnownTypes) GetBytes() *google_protobuf4.BytesValue {\n\tif m != nil {\n\t\treturn m.Bytes\n\t}\n\treturn nil\n}\n\nvar E_Name = &proto.ExtensionDesc{\n\tExtendedType:  (*Real)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         124,\n\tName:          \"jsonpb.name\",\n\tTag:           \"bytes,124,opt,name=name\",\n\tFilename:      \"test_objects.proto\",\n}\n\nfunc init() {\n\tproto.RegisterType((*Simple)(nil), \"jsonpb.Simple\")\n\tproto.RegisterType((*NonFinites)(nil), \"jsonpb.NonFinites\")\n\tproto.RegisterType((*Repeats)(nil), \"jsonpb.Repeats\")\n\tproto.RegisterType((*Widget)(nil), \"jsonpb.Widget\")\n\tproto.RegisterType((*Maps)(nil), \"jsonpb.Maps\")\n\tproto.RegisterType((*MsgWithOneof)(nil), \"jsonpb.MsgWithOneof\")\n\tproto.RegisterType((*Real)(nil), \"jsonpb.Real\")\n\tproto.RegisterType((*Complex)(nil), \"jsonpb.Complex\")\n\tproto.RegisterType((*KnownTypes)(nil), \"jsonpb.KnownTypes\")\n\tproto.RegisterEnum(\"jsonpb.Widget_Color\", Widget_Color_name, Widget_Color_value)\n\tproto.RegisterExtension(E_Complex_RealExtension)\n\tproto.RegisterExtension(E_Name)\n}\n\nfunc init() { proto.RegisterFile(\"test_objects.proto\", fileDescriptor1) }\n\nvar fileDescriptor1 = []byte{\n\t// 1160 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x41, 0x73, 0xdb, 0x44,\n\t0x14, 0xc7, 0x23, 0xc9, 0x92, 0xed, 0x75, 0x92, 0x9a, 0x6d, 0xda, 0x2a, 0x26, 0x80, 0xc6, 0x94,\n\t0x22, 0x0a, 0x75, 0x07, 0xc7, 0xe3, 0x61, 0x0a, 0x97, 0xa4, 0x71, 0x29, 0x43, 0x13, 0x98, 0x4d,\n\t0x43, 0x8f, 0x1e, 0x39, 0x5a, 0xbb, 0x2a, 0xf2, 0xae, 0x67, 0x77, 0x95, 0xd4, 0x03, 0x87, 0x9c,\n\t0x39, 0x32, 0x7c, 0x05, 0xf8, 0x08, 0x1c, 0xf8, 0x74, 0xcc, 0xdb, 0x95, 0xac, 0xc4, 0x8e, 0x4f,\n\t0xf1, 0x7b, 0xef, 0xff, 0xfe, 0x59, 0xed, 0x6f, 0x77, 0x1f, 0xc2, 0x8a, 0x4a, 0x35, 0xe4, 0xa3,\n\t0x77, 0xf4, 0x5c, 0xc9, 0xce, 0x4c, 0x70, 0xc5, 0xb1, 0xf7, 0x4e, 0x72, 0x36, 0x1b, 0xb5, 0x76,\n\t0x27, 0x9c, 0x4f, 0x52, 0xfa, 0x54, 0x67, 0x47, 0xd9, 0xf8, 0x69, 0xc4, 0xe6, 0x46, 0xd2, 0xfa,\n\t0x78, 0xb9, 0x14, 0x67, 0x22, 0x52, 0x09, 0x67, 0x79, 0x7d, 0x6f, 0xb9, 0x2e, 0x95, 0xc8, 0xce,\n\t0x55, 0x5e, 0xfd, 0x64, 0xb9, 0xaa, 0x92, 0x29, 0x95, 0x2a, 0x9a, 0xce, 0xd6, 0xd9, 0x5f, 0x8a,\n\t0x68, 0x36, 0xa3, 0x22, 0x5f, 0x61, 0xfb, 0x6f, 0x1b, 0x79, 0xa7, 0xc9, 0x74, 0x96, 0x52, 0x7c,\n\t0x0f, 0x79, 0x7c, 0x38, 0xe2, 0x3c, 0xf5, 0xad, 0xc0, 0x0a, 0x6b, 0xc4, 0xe5, 0x87, 0x9c, 0xa7,\n\t0xf8, 0x01, 0xaa, 0xf2, 0x61, 0xc2, 0xd4, 0x7e, 0xd7, 0xb7, 0x03, 0x2b, 0x74, 0x89, 0xc7, 0x7f,\n\t0x80, 0x68, 0x51, 0xe8, 0xf7, 0x7c, 0x27, 0xb0, 0x42, 0xc7, 0x14, 0xfa, 0x3d, 0xbc, 0x8b, 0x6a,\n\t0x7c, 0x98, 0x99, 0x96, 0x4a, 0x60, 0x85, 0x5b, 0xa4, 0xca, 0xcf, 0x74, 0x58, 0x96, 0xfa, 0x3d,\n\t0xdf, 0x0d, 0xac, 0xb0, 0x92, 0x97, 0x8a, 0x2e, 0x69, 0xba, 0xbc, 0xc0, 0x0a, 0x3f, 0x20, 0x55,\n\t0x7e, 0x7a, 0xad, 0x4b, 0x9a, 0xae, 0x6a, 0x60, 0x85, 0x38, 0x2f, 0xf5, 0x7b, 0x66, 0x11, 0xe3,\n\t0x94, 0x47, 0xca, 0xaf, 0x05, 0x56, 0x68, 0x13, 0x8f, 0xbf, 0x80, 0xc8, 0xf4, 0xc4, 0x3c, 0x1b,\n\t0xa5, 0xd4, 0xaf, 0x07, 0x56, 0x68, 0x91, 0x2a, 0x3f, 0xd2, 0x61, 0x6e, 0xa7, 0x44, 0xc2, 0x26,\n\t0x3e, 0x0a, 0xac, 0xb0, 0x0e, 0x76, 0x3a, 0x34, 0x76, 0xa3, 0xb9, 0xa2, 0xd2, 0x6f, 0x04, 0x56,\n\t0xb8, 0x49, 0x3c, 0x7e, 0x08, 0x51, 0xfb, 0x4f, 0x0b, 0xa1, 0x13, 0xce, 0x5e, 0x24, 0x2c, 0x51,\n\t0x54, 0xe2, 0xbb, 0xc8, 0x1d, 0x0f, 0x59, 0xc4, 0xf4, 0x56, 0xd9, 0xa4, 0x32, 0x3e, 0x89, 0x18,\n\t0x6c, 0xe0, 0x78, 0x38, 0x4b, 0xd8, 0x58, 0x6f, 0x94, 0x4d, 0xdc, 0xf1, 0xcf, 0x09, 0x1b, 0x9b,\n\t0x34, 0x83, 0xb4, 0x93, 0xa7, 0x4f, 0x20, 0x7d, 0x17, 0xb9, 0xb1, 0xb6, 0xa8, 0xe8, 0xd5, 0x55,\n\t0xe2, 0xdc, 0x22, 0x36, 0x16, 0xae, 0xce, 0xba, 0x71, 0x61, 0x11, 0x1b, 0x0b, 0x2f, 0x4f, 0x83,\n\t0x45, 0xfb, 0x1f, 0x1b, 0x55, 0x09, 0x9d, 0xd1, 0x48, 0x49, 0x90, 0x88, 0x82, 0x9e, 0x03, 0xf4,\n\t0x44, 0x41, 0x4f, 0x2c, 0xe8, 0x39, 0x40, 0x4f, 0x2c, 0xe8, 0x89, 0x05, 0x3d, 0x07, 0xe8, 0x89,\n\t0x05, 0x3d, 0x51, 0xd2, 0x73, 0x80, 0x9e, 0x28, 0xe9, 0x89, 0x92, 0x9e, 0x03, 0xf4, 0x44, 0x49,\n\t0x4f, 0x94, 0xf4, 0x1c, 0xa0, 0x27, 0x4e, 0xaf, 0x75, 0x2d, 0xe8, 0x39, 0x40, 0x4f, 0x94, 0xf4,\n\t0xc4, 0x82, 0x9e, 0x03, 0xf4, 0xc4, 0x82, 0x9e, 0x28, 0xe9, 0x39, 0x40, 0x4f, 0x94, 0xf4, 0x44,\n\t0x49, 0xcf, 0x01, 0x7a, 0xa2, 0xa4, 0x27, 0x16, 0xf4, 0x1c, 0xa0, 0x27, 0x0c, 0xbd, 0x7f, 0x6d,\n\t0xe4, 0xbd, 0x49, 0xe2, 0x09, 0x55, 0xf8, 0x31, 0x72, 0xcf, 0x79, 0xca, 0x85, 0x26, 0xb7, 0xdd,\n\t0xdd, 0xe9, 0x98, 0x2b, 0xda, 0x31, 0xe5, 0xce, 0x73, 0xa8, 0x11, 0x23, 0xc1, 0x4f, 0xc0, 0xcf,\n\t0xa8, 0x61, 0xf3, 0xd6, 0xa9, 0x3d, 0xa1, 0xff, 0xe2, 0x47, 0xc8, 0x93, 0xfa, 0x2a, 0xe9, 0x53,\n\t0xd5, 0xe8, 0x6e, 0x17, 0x6a, 0x73, 0xc1, 0x48, 0x5e, 0xc5, 0x5f, 0x98, 0x0d, 0xd1, 0x4a, 0x58,\n\t0xe7, 0xaa, 0x12, 0x36, 0x28, 0x97, 0x56, 0x85, 0x01, 0xec, 0xef, 0x68, 0xcf, 0x3b, 0x85, 0x32,\n\t0xe7, 0x4e, 0x8a, 0x3a, 0xfe, 0x0a, 0xd5, 0xc5, 0xb0, 0x10, 0xdf, 0xd3, 0xb6, 0x2b, 0xe2, 0x9a,\n\t0xc8, 0x7f, 0xb5, 0x3f, 0x43, 0xae, 0x59, 0x74, 0x15, 0x39, 0x64, 0x70, 0xd4, 0xdc, 0xc0, 0x75,\n\t0xe4, 0x7e, 0x4f, 0x06, 0x83, 0x93, 0xa6, 0x85, 0x6b, 0xa8, 0x72, 0xf8, 0xea, 0x6c, 0xd0, 0xb4,\n\t0xdb, 0x7f, 0xd9, 0xa8, 0x72, 0x1c, 0xcd, 0x24, 0xfe, 0x16, 0x35, 0xa6, 0xe6, 0xb8, 0xc0, 0xde,\n\t0xeb, 0x33, 0xd6, 0xe8, 0x7e, 0x58, 0xf8, 0x83, 0xa4, 0x73, 0xac, 0xcf, 0xcf, 0xa9, 0x12, 0x03,\n\t0xa6, 0xc4, 0x9c, 0xd4, 0xa7, 0x45, 0x8c, 0x0f, 0xd0, 0xd6, 0x54, 0x9f, 0xcd, 0xe2, 0xab, 0x6d,\n\t0xdd, 0xfe, 0xd1, 0xcd, 0x76, 0x38, 0xaf, 0xe6, 0xb3, 0x8d, 0x41, 0x63, 0x5a, 0x66, 0x5a, 0xdf,\n\t0xa1, 0xed, 0x9b, 0xfe, 0xb8, 0x89, 0x9c, 0x5f, 0xe9, 0x5c, 0x63, 0x74, 0x08, 0xfc, 0xc4, 0x3b,\n\t0xc8, 0xbd, 0x88, 0xd2, 0x8c, 0xea, 0xeb, 0x57, 0x27, 0x26, 0x78, 0x66, 0x7f, 0x63, 0xb5, 0x4e,\n\t0x50, 0x73, 0xd9, 0xfe, 0x7a, 0x7f, 0xcd, 0xf4, 0x3f, 0xbc, 0xde, 0xbf, 0x0a, 0xa5, 0xf4, 0x6b,\n\t0xff, 0x61, 0xa1, 0xcd, 0x63, 0x39, 0x79, 0x93, 0xa8, 0xb7, 0x3f, 0x31, 0xca, 0xc7, 0xf8, 0x3e,\n\t0x72, 0x55, 0xa2, 0x52, 0xaa, 0xed, 0xea, 0x2f, 0x37, 0x88, 0x09, 0xb1, 0x8f, 0x3c, 0x19, 0xa5,\n\t0x91, 0x98, 0x6b, 0x4f, 0xe7, 0xe5, 0x06, 0xc9, 0x63, 0xdc, 0x42, 0xd5, 0xe7, 0x3c, 0x83, 0x95,\n\t0xe8, 0x67, 0x01, 0x7a, 0x8a, 0x04, 0xfe, 0x14, 0x6d, 0xbe, 0xe5, 0x53, 0x3a, 0x8c, 0xe2, 0x58,\n\t0x50, 0x29, 0xf5, 0x0b, 0x01, 0x82, 0x06, 0x64, 0x0f, 0x4c, 0xf2, 0xb0, 0x8a, 0xdc, 0x8c, 0x25,\n\t0x9c, 0xb5, 0x1f, 0xa1, 0x0a, 0xa1, 0x51, 0x5a, 0x7e, 0xbe, 0x65, 0xde, 0x08, 0x1d, 0x3c, 0xae,\n\t0xd5, 0xe2, 0xe6, 0xd5, 0xd5, 0xd5, 0x95, 0xdd, 0xbe, 0x84, 0xff, 0x08, 0x5f, 0xf2, 0x1e, 0xef,\n\t0xa1, 0x7a, 0x32, 0x8d, 0x26, 0x09, 0x83, 0x95, 0x19, 0x79, 0x99, 0x28, 0x5b, 0xba, 0x47, 0x68,\n\t0x5b, 0xd0, 0x28, 0x1d, 0xd2, 0xf7, 0x8a, 0x32, 0x99, 0x70, 0x86, 0x37, 0xcb, 0x23, 0x15, 0xa5,\n\t0xfe, 0x6f, 0x37, 0xcf, 0x64, 0x6e, 0x4f, 0xb6, 0xa0, 0x69, 0x50, 0xf4, 0xb4, 0xff, 0x73, 0x11,\n\t0xfa, 0x91, 0xf1, 0x4b, 0xf6, 0x7a, 0x3e, 0xa3, 0x12, 0x3f, 0x44, 0x76, 0xc4, 0xfc, 0x6d, 0xdd,\n\t0xba, 0xd3, 0x31, 0xf3, 0xa9, 0x53, 0xcc, 0xa7, 0xce, 0x01, 0x9b, 0x13, 0x3b, 0x62, 0xf8, 0x4b,\n\t0xe4, 0xc4, 0x99, 0xb9, 0xa5, 0x8d, 0xee, 0xee, 0x8a, 0xec, 0x28, 0x9f, 0x92, 0x04, 0x54, 0xf8,\n\t0x73, 0x64, 0x4b, 0xe5, 0x6f, 0x6a, 0xed, 0x83, 0x15, 0xed, 0xa9, 0x9e, 0x98, 0xc4, 0x96, 0x70,\n\t0xfb, 0x6d, 0x25, 0x73, 0xbe, 0xad, 0x15, 0xe1, 0xeb, 0x62, 0x78, 0x12, 0x5b, 0x49, 0xd0, 0xa6,\n\t0x17, 0xfe, 0x9d, 0x35, 0xda, 0x57, 0x89, 0x54, 0xbf, 0xc0, 0x0e, 0x13, 0x3b, 0xbd, 0xc0, 0x21,\n\t0x72, 0x2e, 0xa2, 0xd4, 0x6f, 0x6a, 0xf1, 0xfd, 0x15, 0xb1, 0x11, 0x82, 0x04, 0x77, 0x90, 0x13,\n\t0x8f, 0x52, 0xcd, 0xbc, 0xd1, 0xdd, 0x5b, 0xfd, 0x2e, 0xfd, 0xc8, 0xe5, 0xfa, 0x78, 0x94, 0xe2,\n\t0x27, 0xc8, 0x19, 0xa7, 0x4a, 0x1f, 0x01, 0xb8, 0x70, 0xcb, 0x7a, 0xfd, 0x5c, 0xe6, 0xf2, 0x71,\n\t0xaa, 0x40, 0x9e, 0xe4, 0xb3, 0xf5, 0x36, 0xb9, 0xbe, 0x42, 0xb9, 0x3c, 0xe9, 0xf7, 0x60, 0x35,\n\t0x59, 0xbf, 0xa7, 0xa7, 0xca, 0x6d, 0xab, 0x39, 0xbb, 0xae, 0xcf, 0xfa, 0x3d, 0x6d, 0xbf, 0xdf,\n\t0xd5, 0x43, 0x78, 0x8d, 0xfd, 0x7e, 0xb7, 0xb0, 0xdf, 0xef, 0x6a, 0xfb, 0xfd, 0xae, 0x9e, 0xcc,\n\t0xeb, 0xec, 0x17, 0xfa, 0x4c, 0xeb, 0x2b, 0x7a, 0x84, 0xd5, 0xd7, 0x6c, 0x3a, 0xdc, 0x61, 0x23,\n\t0xd7, 0x3a, 0xf0, 0x87, 0xd7, 0x08, 0xad, 0xf1, 0x37, 0x63, 0x21, 0xf7, 0x97, 0x4a, 0xe0, 0xaf,\n\t0x91, 0x5b, 0x0e, 0xf7, 0xdb, 0x3e, 0x40, 0x8f, 0x0b, 0xd3, 0x60, 0x94, 0xcf, 0x02, 0x54, 0x61,\n\t0xd1, 0x94, 0x2e, 0x1d, 0xfc, 0xdf, 0xf5, 0x0b, 0xa3, 0x2b, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff,\n\t0xd5, 0x39, 0x32, 0x09, 0xf9, 0x09, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\nimport \"google/protobuf/any.proto\";\nimport \"google/protobuf/duration.proto\";\nimport \"google/protobuf/struct.proto\";\nimport \"google/protobuf/timestamp.proto\";\nimport \"google/protobuf/wrappers.proto\";\n\npackage jsonpb;\n\n// Test message for holding primitive types.\nmessage Simple {\n  optional bool o_bool = 1;\n  optional int32 o_int32 = 2;\n  optional int64 o_int64 = 3;\n  optional uint32 o_uint32 = 4;\n  optional uint64 o_uint64 = 5;\n  optional sint32 o_sint32 = 6;\n  optional sint64 o_sint64 = 7;\n  optional float o_float = 8;\n  optional double o_double = 9;\n  optional string o_string = 10;\n  optional bytes o_bytes = 11;\n}\n\n// Test message for holding special non-finites primitives.\nmessage NonFinites {\n    optional float f_nan = 1;\n    optional float f_pinf = 2;\n    optional float f_ninf = 3;\n    optional double d_nan = 4;\n    optional double d_pinf = 5;\n    optional double d_ninf = 6;\n}\n\n// Test message for holding repeated primitives.\nmessage Repeats {\n  repeated bool r_bool = 1;\n  repeated int32 r_int32 = 2;\n  repeated int64 r_int64 = 3;\n  repeated uint32 r_uint32 = 4;\n  repeated uint64 r_uint64 = 5;\n  repeated sint32 r_sint32 = 6;\n  repeated sint64 r_sint64 = 7;\n  repeated float r_float = 8;\n  repeated double r_double = 9;\n  repeated string r_string = 10;\n  repeated bytes r_bytes = 11;\n}\n\n// Test message for holding enums and nested messages.\nmessage Widget {\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  };\n  optional Color color = 1;\n  repeated Color r_color = 2;\n\n  optional Simple simple = 10;\n  repeated Simple r_simple = 11;\n\n  optional Repeats repeats = 20;\n  repeated Repeats r_repeats = 21;\n}\n\nmessage Maps {\n  map<int64, string> m_int64_str = 1;\n  map<bool, Simple> m_bool_simple = 2;\n}\n\nmessage MsgWithOneof {\n  oneof union {\n    string title = 1;\n    int64 salary = 2;\n    string Country = 3;\n    string home_address = 4;\n  }\n}\n\nmessage Real {\n  optional double value = 1;\n  extensions 100 to max;\n}\n\nextend Real {\n  optional string name = 124;\n}\n\nmessage Complex {\n  extend Real {\n    optional Complex real_extension = 123;\n  }\n  optional double imaginary = 1;\n  extensions 100 to max;\n}\n\nmessage KnownTypes {\n  optional google.protobuf.Any an = 14;\n  optional google.protobuf.Duration dur = 1;\n  optional google.protobuf.Struct st = 12;\n  optional google.protobuf.Timestamp ts = 2;\n  optional google.protobuf.ListValue lv = 15;\n  optional google.protobuf.Value val = 16;\n\n  optional google.protobuf.DoubleValue dbl = 3;\n  optional google.protobuf.FloatValue flt = 4;\n  optional google.protobuf.Int64Value i64 = 5;\n  optional google.protobuf.UInt64Value u64 = 6;\n  optional google.protobuf.Int32Value i32 = 7;\n  optional google.protobuf.UInt32Value u32 = 8;\n  optional google.protobuf.BoolValue bool = 9;\n  optional google.protobuf.StringValue str = 10;\n  optional google.protobuf.BytesValue bytes = 11;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ninstall:\n\tgo install\n\ntest: install generate-test-pbs\n\tgo test\n\n\ngenerate-test-pbs:\n\tmake install\n\tmake -C testdata\n\tprotoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto\n\tmake\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/all_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"math/rand\"\n\t\"reflect\"\n\t\"runtime/debug\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t. \"github.com/golang/protobuf/proto\"\n\t. \"github.com/golang/protobuf/proto/testdata\"\n)\n\nvar globalO *Buffer\n\nfunc old() *Buffer {\n\tif globalO == nil {\n\t\tglobalO = NewBuffer(nil)\n\t}\n\tglobalO.Reset()\n\treturn globalO\n}\n\nfunc equalbytes(b1, b2 []byte, t *testing.T) {\n\tif len(b1) != len(b2) {\n\t\tt.Errorf(\"wrong lengths: 2*%d != %d\", len(b1), len(b2))\n\t\treturn\n\t}\n\tfor i := 0; i < len(b1); i++ {\n\t\tif b1[i] != b2[i] {\n\t\t\tt.Errorf(\"bad byte[%d]:%x %x: %s %s\", i, b1[i], b2[i], b1, b2)\n\t\t}\n\t}\n}\n\nfunc initGoTestField() *GoTestField {\n\tf := new(GoTestField)\n\tf.Label = String(\"label\")\n\tf.Type = String(\"type\")\n\treturn f\n}\n\n// These are all structurally equivalent but the tag numbers differ.\n// (It's remarkable that required, optional, and repeated all have\n// 8 letters.)\nfunc initGoTest_RequiredGroup() *GoTest_RequiredGroup {\n\treturn &GoTest_RequiredGroup{\n\t\tRequiredField: String(\"required\"),\n\t}\n}\n\nfunc initGoTest_OptionalGroup() *GoTest_OptionalGroup {\n\treturn &GoTest_OptionalGroup{\n\t\tRequiredField: String(\"optional\"),\n\t}\n}\n\nfunc initGoTest_RepeatedGroup() *GoTest_RepeatedGroup {\n\treturn &GoTest_RepeatedGroup{\n\t\tRequiredField: String(\"repeated\"),\n\t}\n}\n\nfunc initGoTest(setdefaults bool) *GoTest {\n\tpb := new(GoTest)\n\tif setdefaults {\n\t\tpb.F_BoolDefaulted = Bool(Default_GoTest_F_BoolDefaulted)\n\t\tpb.F_Int32Defaulted = Int32(Default_GoTest_F_Int32Defaulted)\n\t\tpb.F_Int64Defaulted = Int64(Default_GoTest_F_Int64Defaulted)\n\t\tpb.F_Fixed32Defaulted = Uint32(Default_GoTest_F_Fixed32Defaulted)\n\t\tpb.F_Fixed64Defaulted = Uint64(Default_GoTest_F_Fixed64Defaulted)\n\t\tpb.F_Uint32Defaulted = Uint32(Default_GoTest_F_Uint32Defaulted)\n\t\tpb.F_Uint64Defaulted = Uint64(Default_GoTest_F_Uint64Defaulted)\n\t\tpb.F_FloatDefaulted = Float32(Default_GoTest_F_FloatDefaulted)\n\t\tpb.F_DoubleDefaulted = Float64(Default_GoTest_F_DoubleDefaulted)\n\t\tpb.F_StringDefaulted = String(Default_GoTest_F_StringDefaulted)\n\t\tpb.F_BytesDefaulted = Default_GoTest_F_BytesDefaulted\n\t\tpb.F_Sint32Defaulted = Int32(Default_GoTest_F_Sint32Defaulted)\n\t\tpb.F_Sint64Defaulted = Int64(Default_GoTest_F_Sint64Defaulted)\n\t}\n\n\tpb.Kind = GoTest_TIME.Enum()\n\tpb.RequiredField = initGoTestField()\n\tpb.F_BoolRequired = Bool(true)\n\tpb.F_Int32Required = Int32(3)\n\tpb.F_Int64Required = Int64(6)\n\tpb.F_Fixed32Required = Uint32(32)\n\tpb.F_Fixed64Required = Uint64(64)\n\tpb.F_Uint32Required = Uint32(3232)\n\tpb.F_Uint64Required = Uint64(6464)\n\tpb.F_FloatRequired = Float32(3232)\n\tpb.F_DoubleRequired = Float64(6464)\n\tpb.F_StringRequired = String(\"string\")\n\tpb.F_BytesRequired = []byte(\"bytes\")\n\tpb.F_Sint32Required = Int32(-32)\n\tpb.F_Sint64Required = Int64(-64)\n\tpb.Requiredgroup = initGoTest_RequiredGroup()\n\n\treturn pb\n}\n\nfunc fail(msg string, b *bytes.Buffer, s string, t *testing.T) {\n\tdata := b.Bytes()\n\tld := len(data)\n\tls := len(s) / 2\n\n\tfmt.Printf(\"fail %s ld=%d ls=%d\\n\", msg, ld, ls)\n\n\t// find the interesting spot - n\n\tn := ls\n\tif ld < ls {\n\t\tn = ld\n\t}\n\tj := 0\n\tfor i := 0; i < n; i++ {\n\t\tbs := hex(s[j])*16 + hex(s[j+1])\n\t\tj += 2\n\t\tif data[i] == bs {\n\t\t\tcontinue\n\t\t}\n\t\tn = i\n\t\tbreak\n\t}\n\tl := n - 10\n\tif l < 0 {\n\t\tl = 0\n\t}\n\th := n + 10\n\n\t// find the interesting spot - n\n\tfmt.Printf(\"is[%d]:\", l)\n\tfor i := l; i < h; i++ {\n\t\tif i >= ld {\n\t\t\tfmt.Printf(\" --\")\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\" %.2x\", data[i])\n\t}\n\tfmt.Printf(\"\\n\")\n\n\tfmt.Printf(\"sb[%d]:\", l)\n\tfor i := l; i < h; i++ {\n\t\tif i >= ls {\n\t\t\tfmt.Printf(\" --\")\n\t\t\tcontinue\n\t\t}\n\t\tbs := hex(s[j])*16 + hex(s[j+1])\n\t\tj += 2\n\t\tfmt.Printf(\" %.2x\", bs)\n\t}\n\tfmt.Printf(\"\\n\")\n\n\tt.Fail()\n\n\t//\tt.Errorf(\"%s: \\ngood: %s\\nbad: %x\", msg, s, b.Bytes())\n\t// Print the output in a partially-decoded format; can\n\t// be helpful when updating the test.  It produces the output\n\t// that is pasted, with minor edits, into the argument to verify().\n\t//\tdata := b.Bytes()\n\t//\tnesting := 0\n\t//\tfor b.Len() > 0 {\n\t//\t\tstart := len(data) - b.Len()\n\t//\t\tvar u uint64\n\t//\t\tu, err := DecodeVarint(b)\n\t//\t\tif err != nil {\n\t//\t\t\tfmt.Printf(\"decode error on varint:\", err)\n\t//\t\t\treturn\n\t//\t\t}\n\t//\t\twire := u & 0x7\n\t//\t\ttag := u >> 3\n\t//\t\tswitch wire {\n\t//\t\tcase WireVarint:\n\t//\t\t\tv, err := DecodeVarint(b)\n\t//\t\t\tif err != nil {\n\t//\t\t\t\tfmt.Printf(\"decode error on varint:\", err)\n\t//\t\t\t\treturn\n\t//\t\t\t}\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\"  // field %d, encoding %d, value %d\\n\",\n\t//\t\t\t\tdata[start:len(data)-b.Len()], tag, wire, v)\n\t//\t\tcase WireFixed32:\n\t//\t\t\tv, err := DecodeFixed32(b)\n\t//\t\t\tif err != nil {\n\t//\t\t\t\tfmt.Printf(\"decode error on fixed32:\", err)\n\t//\t\t\t\treturn\n\t//\t\t\t}\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\"  // field %d, encoding %d, value %d\\n\",\n\t//\t\t\t\tdata[start:len(data)-b.Len()], tag, wire, v)\n\t//\t\tcase WireFixed64:\n\t//\t\t\tv, err := DecodeFixed64(b)\n\t//\t\t\tif err != nil {\n\t//\t\t\t\tfmt.Printf(\"decode error on fixed64:\", err)\n\t//\t\t\t\treturn\n\t//\t\t\t}\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\"  // field %d, encoding %d, value %d\\n\",\n\t//\t\t\t\tdata[start:len(data)-b.Len()], tag, wire, v)\n\t//\t\tcase WireBytes:\n\t//\t\t\tnb, err := DecodeVarint(b)\n\t//\t\t\tif err != nil {\n\t//\t\t\t\tfmt.Printf(\"decode error on bytes:\", err)\n\t//\t\t\t\treturn\n\t//\t\t\t}\n\t//\t\t\tafter_tag := len(data) - b.Len()\n\t//\t\t\tstr := make([]byte, nb)\n\t//\t\t\t_, err = b.Read(str)\n\t//\t\t\tif err != nil {\n\t//\t\t\t\tfmt.Printf(\"decode error on bytes:\", err)\n\t//\t\t\t\treturn\n\t//\t\t\t}\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\" \\\"%x\\\"  // field %d, encoding %d (FIELD)\\n\",\n\t//\t\t\t\tdata[start:after_tag], str, tag, wire)\n\t//\t\tcase WireStartGroup:\n\t//\t\t\tnesting++\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\"\\t\\t// start group field %d level %d\\n\",\n\t//\t\t\t\tdata[start:len(data)-b.Len()], tag, nesting)\n\t//\t\tcase WireEndGroup:\n\t//\t\t\tfmt.Printf(\"\\t\\t\\\"%x\\\"\\t\\t// end group field %d level %d\\n\",\n\t//\t\t\t\tdata[start:len(data)-b.Len()], tag, nesting)\n\t//\t\t\tnesting--\n\t//\t\tdefault:\n\t//\t\t\tfmt.Printf(\"unrecognized wire type %d\\n\", wire)\n\t//\t\t\treturn\n\t//\t\t}\n\t//\t}\n}\n\nfunc hex(c uint8) uint8 {\n\tif '0' <= c && c <= '9' {\n\t\treturn c - '0'\n\t}\n\tif 'a' <= c && c <= 'f' {\n\t\treturn 10 + c - 'a'\n\t}\n\tif 'A' <= c && c <= 'F' {\n\t\treturn 10 + c - 'A'\n\t}\n\treturn 0\n}\n\nfunc equal(b []byte, s string, t *testing.T) bool {\n\tif 2*len(b) != len(s) {\n\t\t//\t\tfail(fmt.Sprintf(\"wrong lengths: 2*%d != %d\", len(b), len(s)), b, s, t)\n\t\tfmt.Printf(\"wrong lengths: 2*%d != %d\\n\", len(b), len(s))\n\t\treturn false\n\t}\n\tfor i, j := 0, 0; i < len(b); i, j = i+1, j+2 {\n\t\tx := hex(s[j])*16 + hex(s[j+1])\n\t\tif b[i] != x {\n\t\t\t//\t\t\tfail(fmt.Sprintf(\"bad byte[%d]:%x %x\", i, b[i], x), b, s, t)\n\t\t\tfmt.Printf(\"bad byte[%d]:%x %x\", i, b[i], x)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc overify(t *testing.T, pb *GoTest, expected string) {\n\to := old()\n\terr := o.Marshal(pb)\n\tif err != nil {\n\t\tfmt.Printf(\"overify marshal-1 err = %v\", err)\n\t\to.DebugPrint(\"\", o.Bytes())\n\t\tt.Fatalf(\"expected = %s\", expected)\n\t}\n\tif !equal(o.Bytes(), expected, t) {\n\t\to.DebugPrint(\"overify neq 1\", o.Bytes())\n\t\tt.Fatalf(\"expected = %s\", expected)\n\t}\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(GoTest)\n\terr = o.Unmarshal(pbd)\n\tif err != nil {\n\t\tt.Fatalf(\"overify unmarshal err = %v\", err)\n\t\to.DebugPrint(\"\", o.Bytes())\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n\to.Reset()\n\terr = o.Marshal(pbd)\n\tif err != nil {\n\t\tt.Errorf(\"overify marshal-2 err = %v\", err)\n\t\to.DebugPrint(\"\", o.Bytes())\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n\tif !equal(o.Bytes(), expected, t) {\n\t\to.DebugPrint(\"overify neq 2\", o.Bytes())\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n}\n\n// Simple tests for numeric encode/decode primitives (varint, etc.)\nfunc TestNumericPrimitives(t *testing.T) {\n\tfor i := uint64(0); i < 1e6; i += 111 {\n\t\to := old()\n\t\tif o.EncodeVarint(i) != nil {\n\t\t\tt.Error(\"EncodeVarint\")\n\t\t\tbreak\n\t\t}\n\t\tx, e := o.DecodeVarint()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeVarint\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"varint decode fail:\", i, x)\n\t\t}\n\n\t\to = old()\n\t\tif o.EncodeFixed32(i) != nil {\n\t\t\tt.Fatal(\"encFixed32\")\n\t\t}\n\t\tx, e = o.DecodeFixed32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"decFixed32\")\n\t\t}\n\t\tif x != i {\n\t\t\tt.Fatal(\"fixed32 decode fail:\", i, x)\n\t\t}\n\n\t\to = old()\n\t\tif o.EncodeFixed64(i*1234567) != nil {\n\t\t\tt.Error(\"encFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tx, e = o.DecodeFixed64()\n\t\tif e != nil {\n\t\t\tt.Error(\"decFixed64\")\n\t\t\tbreak\n\t\t}\n\t\tif x != i*1234567 {\n\t\t\tt.Error(\"fixed64 decode fail:\", i*1234567, x)\n\t\t\tbreak\n\t\t}\n\n\t\to = old()\n\t\ti32 := int32(i - 12345)\n\t\tif o.EncodeZigzag32(uint64(i32)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag32\")\n\t\t}\n\t\tx, e = o.DecodeZigzag32()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag32\")\n\t\t}\n\t\tif x != uint64(uint32(i32)) {\n\t\t\tt.Fatal(\"zigzag32 decode fail:\", i32, x)\n\t\t}\n\n\t\to = old()\n\t\ti64 := int64(i - 12345)\n\t\tif o.EncodeZigzag64(uint64(i64)) != nil {\n\t\t\tt.Fatal(\"EncodeZigzag64\")\n\t\t}\n\t\tx, e = o.DecodeZigzag64()\n\t\tif e != nil {\n\t\t\tt.Fatal(\"DecodeZigzag64\")\n\t\t}\n\t\tif x != uint64(i64) {\n\t\t\tt.Fatal(\"zigzag64 decode fail:\", i64, x)\n\t\t}\n\t}\n}\n\n// fakeMarshaler is a simple struct implementing Marshaler and Message interfaces.\ntype fakeMarshaler struct {\n\tb   []byte\n\terr error\n}\n\nfunc (f *fakeMarshaler) Marshal() ([]byte, error) { return f.b, f.err }\nfunc (f *fakeMarshaler) String() string           { return fmt.Sprintf(\"Bytes: %v Error: %v\", f.b, f.err) }\nfunc (f *fakeMarshaler) ProtoMessage()            {}\nfunc (f *fakeMarshaler) Reset()                   {}\n\ntype msgWithFakeMarshaler struct {\n\tM *fakeMarshaler `protobuf:\"bytes,1,opt,name=fake\"`\n}\n\nfunc (m *msgWithFakeMarshaler) String() string { return CompactTextString(m) }\nfunc (m *msgWithFakeMarshaler) ProtoMessage()  {}\nfunc (m *msgWithFakeMarshaler) Reset()         {}\n\n// Simple tests for proto messages that implement the Marshaler interface.\nfunc TestMarshalerEncoding(t *testing.T) {\n\ttests := []struct {\n\t\tname    string\n\t\tm       Message\n\t\twant    []byte\n\t\terrType reflect.Type\n\t}{\n\t\t{\n\t\t\tname: \"Marshaler that fails\",\n\t\t\tm: &fakeMarshaler{\n\t\t\t\terr: errors.New(\"some marshal err\"),\n\t\t\t\tb:   []byte{5, 6, 7},\n\t\t\t},\n\t\t\t// Since the Marshal method returned bytes, they should be written to the\n\t\t\t// buffer.  (For efficiency, we assume that Marshal implementations are\n\t\t\t// always correct w.r.t. RequiredNotSetError and output.)\n\t\t\twant:    []byte{5, 6, 7},\n\t\t\terrType: reflect.TypeOf(errors.New(\"some marshal err\")),\n\t\t},\n\t\t{\n\t\t\tname: \"Marshaler that fails with RequiredNotSetError\",\n\t\t\tm: &msgWithFakeMarshaler{\n\t\t\t\tM: &fakeMarshaler{\n\t\t\t\t\terr: &RequiredNotSetError{},\n\t\t\t\t\tb:   []byte{5, 6, 7},\n\t\t\t\t},\n\t\t\t},\n\t\t\t// Since there's an error that can be continued after,\n\t\t\t// the buffer should be written.\n\t\t\twant: []byte{\n\t\t\t\t10, 3, // for &msgWithFakeMarshaler\n\t\t\t\t5, 6, 7, // for &fakeMarshaler\n\t\t\t},\n\t\t\terrType: reflect.TypeOf(&RequiredNotSetError{}),\n\t\t},\n\t\t{\n\t\t\tname: \"Marshaler that succeeds\",\n\t\t\tm: &fakeMarshaler{\n\t\t\t\tb: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t\t},\n\t\t\twant: []byte{0, 1, 2, 3, 4, 127, 255},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tb := NewBuffer(nil)\n\t\terr := b.Marshal(test.m)\n\t\tif reflect.TypeOf(err) != test.errType {\n\t\t\tt.Errorf(\"%s: got err %T(%v) wanted %T\", test.name, err, err, test.errType)\n\t\t}\n\t\tif !reflect.DeepEqual(test.want, b.Bytes()) {\n\t\t\tt.Errorf(\"%s: got bytes %v wanted %v\", test.name, b.Bytes(), test.want)\n\t\t}\n\t\tif size := Size(test.m); size != len(b.Bytes()) {\n\t\t\tt.Errorf(\"%s: Size(_) = %v, but marshaled to %v bytes\", test.name, size, len(b.Bytes()))\n\t\t}\n\n\t\tm, mErr := Marshal(test.m)\n\t\tif !bytes.Equal(b.Bytes(), m) {\n\t\t\tt.Errorf(\"%s: Marshal returned %v, but (*Buffer).Marshal wrote %v\", test.name, m, b.Bytes())\n\t\t}\n\t\tif !reflect.DeepEqual(err, mErr) {\n\t\t\tt.Errorf(\"%s: Marshal err = %q, but (*Buffer).Marshal returned %q\",\n\t\t\t\ttest.name, fmt.Sprint(mErr), fmt.Sprint(err))\n\t\t}\n\t}\n}\n\n// Simple tests for bytes\nfunc TestBytesPrimitives(t *testing.T) {\n\to := old()\n\tbytes := []byte{'n', 'o', 'w', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 't', 'i', 'm', 'e'}\n\tif o.EncodeRawBytes(bytes) != nil {\n\t\tt.Error(\"EncodeRawBytes\")\n\t}\n\tdecb, e := o.DecodeRawBytes(false)\n\tif e != nil {\n\t\tt.Error(\"DecodeRawBytes\")\n\t}\n\tequalbytes(bytes, decb, t)\n}\n\n// Simple tests for strings\nfunc TestStringPrimitives(t *testing.T) {\n\to := old()\n\ts := \"now is the time\"\n\tif o.EncodeStringBytes(s) != nil {\n\t\tt.Error(\"enc_string\")\n\t}\n\tdecs, e := o.DecodeStringBytes()\n\tif e != nil {\n\t\tt.Error(\"dec_string\")\n\t}\n\tif s != decs {\n\t\tt.Error(\"string encode/decode fail:\", s, decs)\n\t}\n}\n\n// Do we catch the \"required bit not set\" case?\nfunc TestRequiredBit(t *testing.T) {\n\to := old()\n\tpb := new(GoTest)\n\terr := o.Marshal(pb)\n\tif err == nil {\n\t\tt.Error(\"did not catch missing required fields\")\n\t} else if strings.Index(err.Error(), \"Kind\") < 0 {\n\t\tt.Error(\"wrong error type:\", err)\n\t}\n}\n\n// Check that all fields are nil.\n// Clearly silly, and a residue from a more interesting test with an earlier,\n// different initialization property, but it once caught a compiler bug so\n// it lives.\nfunc checkInitialized(pb *GoTest, t *testing.T) {\n\tif pb.F_BoolDefaulted != nil {\n\t\tt.Error(\"New or Reset did not set boolean:\", *pb.F_BoolDefaulted)\n\t}\n\tif pb.F_Int32Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set int32:\", *pb.F_Int32Defaulted)\n\t}\n\tif pb.F_Int64Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set int64:\", *pb.F_Int64Defaulted)\n\t}\n\tif pb.F_Fixed32Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set fixed32:\", *pb.F_Fixed32Defaulted)\n\t}\n\tif pb.F_Fixed64Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set fixed64:\", *pb.F_Fixed64Defaulted)\n\t}\n\tif pb.F_Uint32Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set uint32:\", *pb.F_Uint32Defaulted)\n\t}\n\tif pb.F_Uint64Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set uint64:\", *pb.F_Uint64Defaulted)\n\t}\n\tif pb.F_FloatDefaulted != nil {\n\t\tt.Error(\"New or Reset did not set float:\", *pb.F_FloatDefaulted)\n\t}\n\tif pb.F_DoubleDefaulted != nil {\n\t\tt.Error(\"New or Reset did not set double:\", *pb.F_DoubleDefaulted)\n\t}\n\tif pb.F_StringDefaulted != nil {\n\t\tt.Error(\"New or Reset did not set string:\", *pb.F_StringDefaulted)\n\t}\n\tif pb.F_BytesDefaulted != nil {\n\t\tt.Error(\"New or Reset did not set bytes:\", string(pb.F_BytesDefaulted))\n\t}\n\tif pb.F_Sint32Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set int32:\", *pb.F_Sint32Defaulted)\n\t}\n\tif pb.F_Sint64Defaulted != nil {\n\t\tt.Error(\"New or Reset did not set int64:\", *pb.F_Sint64Defaulted)\n\t}\n}\n\n// Does Reset() reset?\nfunc TestReset(t *testing.T) {\n\tpb := initGoTest(true)\n\t// muck with some values\n\tpb.F_BoolDefaulted = Bool(false)\n\tpb.F_Int32Defaulted = Int32(237)\n\tpb.F_Int64Defaulted = Int64(12346)\n\tpb.F_Fixed32Defaulted = Uint32(32000)\n\tpb.F_Fixed64Defaulted = Uint64(666)\n\tpb.F_Uint32Defaulted = Uint32(323232)\n\tpb.F_Uint64Defaulted = nil\n\tpb.F_FloatDefaulted = nil\n\tpb.F_DoubleDefaulted = Float64(0)\n\tpb.F_StringDefaulted = String(\"gotcha\")\n\tpb.F_BytesDefaulted = []byte(\"asdfasdf\")\n\tpb.F_Sint32Defaulted = Int32(123)\n\tpb.F_Sint64Defaulted = Int64(789)\n\tpb.Reset()\n\tcheckInitialized(pb, t)\n}\n\n// All required fields set, no defaults provided.\nfunc TestEncodeDecode1(t *testing.T) {\n\tpb := initGoTest(false)\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 0x20\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 0x40\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 0xca0 = 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 0x1940 = 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2, string \"string\"\n\t\t\t\"b304\"+ // field 70, encoding 3, start group\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // field 70, encoding 4, end group\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2, string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\") // field 103, encoding 0, 0x7f zigzag64\n}\n\n// All required fields set, defaults provided.\nfunc TestEncodeDecode2(t *testing.T) {\n\tpb := initGoTest(true)\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 32\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 64\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2 string \"string\"\n\t\t\t\"c00201\"+ // field 40, encoding 0, value 1\n\t\t\t\"c80220\"+ // field 41, encoding 0, value 32\n\t\t\t\"d00240\"+ // field 42, encoding 0, value 64\n\t\t\t\"dd0240010000\"+ // field 43, encoding 5, value 320\n\t\t\t\"e1028002000000000000\"+ // field 44, encoding 1, value 640\n\t\t\t\"e8028019\"+ // field 45, encoding 0, value 3200\n\t\t\t\"f0028032\"+ // field 46, encoding 0, value 6400\n\t\t\t\"fd02e0659948\"+ // field 47, encoding 5, value 314159.0\n\t\t\t\"81030000000050971041\"+ // field 48, encoding 1, value 271828.0\n\t\t\t\"8a0310\"+\"68656c6c6f2c2022776f726c6421220a\"+ // field 49, encoding 2 string \"hello, \\\"world!\\\"\\n\"\n\t\t\t\"b304\"+ // start group field 70 level 1\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // end group field 70 level 1\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2 string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\"+ // field 103, encoding 0, 0x7f zigzag64\n\t\t\t\"8a1907\"+\"4269676e6f7365\"+ // field 401, encoding 2, string \"Bignose\"\n\t\t\t\"90193f\"+ // field 402, encoding 0, value 63\n\t\t\t\"98197f\") // field 403, encoding 0, value 127\n\n}\n\n// All default fields set to their default value by hand\nfunc TestEncodeDecode3(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.F_BoolDefaulted = Bool(true)\n\tpb.F_Int32Defaulted = Int32(32)\n\tpb.F_Int64Defaulted = Int64(64)\n\tpb.F_Fixed32Defaulted = Uint32(320)\n\tpb.F_Fixed64Defaulted = Uint64(640)\n\tpb.F_Uint32Defaulted = Uint32(3200)\n\tpb.F_Uint64Defaulted = Uint64(6400)\n\tpb.F_FloatDefaulted = Float32(314159)\n\tpb.F_DoubleDefaulted = Float64(271828)\n\tpb.F_StringDefaulted = String(\"hello, \\\"world!\\\"\\n\")\n\tpb.F_BytesDefaulted = []byte(\"Bignose\")\n\tpb.F_Sint32Defaulted = Int32(-32)\n\tpb.F_Sint64Defaulted = Int64(-64)\n\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 32\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 64\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2 string \"string\"\n\t\t\t\"c00201\"+ // field 40, encoding 0, value 1\n\t\t\t\"c80220\"+ // field 41, encoding 0, value 32\n\t\t\t\"d00240\"+ // field 42, encoding 0, value 64\n\t\t\t\"dd0240010000\"+ // field 43, encoding 5, value 320\n\t\t\t\"e1028002000000000000\"+ // field 44, encoding 1, value 640\n\t\t\t\"e8028019\"+ // field 45, encoding 0, value 3200\n\t\t\t\"f0028032\"+ // field 46, encoding 0, value 6400\n\t\t\t\"fd02e0659948\"+ // field 47, encoding 5, value 314159.0\n\t\t\t\"81030000000050971041\"+ // field 48, encoding 1, value 271828.0\n\t\t\t\"8a0310\"+\"68656c6c6f2c2022776f726c6421220a\"+ // field 49, encoding 2 string \"hello, \\\"world!\\\"\\n\"\n\t\t\t\"b304\"+ // start group field 70 level 1\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // end group field 70 level 1\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2 string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\"+ // field 103, encoding 0, 0x7f zigzag64\n\t\t\t\"8a1907\"+\"4269676e6f7365\"+ // field 401, encoding 2, string \"Bignose\"\n\t\t\t\"90193f\"+ // field 402, encoding 0, value 63\n\t\t\t\"98197f\") // field 403, encoding 0, value 127\n\n}\n\n// All required fields set, defaults provided, all non-defaulted optional fields have values.\nfunc TestEncodeDecode4(t *testing.T) {\n\tpb := initGoTest(true)\n\tpb.Table = String(\"hello\")\n\tpb.Param = Int32(7)\n\tpb.OptionalField = initGoTestField()\n\tpb.F_BoolOptional = Bool(true)\n\tpb.F_Int32Optional = Int32(32)\n\tpb.F_Int64Optional = Int64(64)\n\tpb.F_Fixed32Optional = Uint32(3232)\n\tpb.F_Fixed64Optional = Uint64(6464)\n\tpb.F_Uint32Optional = Uint32(323232)\n\tpb.F_Uint64Optional = Uint64(646464)\n\tpb.F_FloatOptional = Float32(32.)\n\tpb.F_DoubleOptional = Float64(64.)\n\tpb.F_StringOptional = String(\"hello\")\n\tpb.F_BytesOptional = []byte(\"Bignose\")\n\tpb.F_Sint32Optional = Int32(-32)\n\tpb.F_Sint64Optional = Int64(-64)\n\tpb.Optionalgroup = initGoTest_OptionalGroup()\n\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"1205\"+\"68656c6c6f\"+ // field 2, encoding 2, string \"hello\"\n\t\t\t\"1807\"+ // field 3, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"320d\"+\"0a056c6162656c120474797065\"+ // field 6, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 32\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 64\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2 string \"string\"\n\t\t\t\"f00101\"+ // field 30, encoding 0, value 1\n\t\t\t\"f80120\"+ // field 31, encoding 0, value 32\n\t\t\t\"800240\"+ // field 32, encoding 0, value 64\n\t\t\t\"8d02a00c0000\"+ // field 33, encoding 5, value 3232\n\t\t\t\"91024019000000000000\"+ // field 34, encoding 1, value 6464\n\t\t\t\"9802a0dd13\"+ // field 35, encoding 0, value 323232\n\t\t\t\"a002c0ba27\"+ // field 36, encoding 0, value 646464\n\t\t\t\"ad0200000042\"+ // field 37, encoding 5, value 32.0\n\t\t\t\"b1020000000000005040\"+ // field 38, encoding 1, value 64.0\n\t\t\t\"ba0205\"+\"68656c6c6f\"+ // field 39, encoding 2, string \"hello\"\n\t\t\t\"c00201\"+ // field 40, encoding 0, value 1\n\t\t\t\"c80220\"+ // field 41, encoding 0, value 32\n\t\t\t\"d00240\"+ // field 42, encoding 0, value 64\n\t\t\t\"dd0240010000\"+ // field 43, encoding 5, value 320\n\t\t\t\"e1028002000000000000\"+ // field 44, encoding 1, value 640\n\t\t\t\"e8028019\"+ // field 45, encoding 0, value 3200\n\t\t\t\"f0028032\"+ // field 46, encoding 0, value 6400\n\t\t\t\"fd02e0659948\"+ // field 47, encoding 5, value 314159.0\n\t\t\t\"81030000000050971041\"+ // field 48, encoding 1, value 271828.0\n\t\t\t\"8a0310\"+\"68656c6c6f2c2022776f726c6421220a\"+ // field 49, encoding 2 string \"hello, \\\"world!\\\"\\n\"\n\t\t\t\"b304\"+ // start group field 70 level 1\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // end group field 70 level 1\n\t\t\t\"d305\"+ // start group field 90 level 1\n\t\t\t\"da0508\"+\"6f7074696f6e616c\"+ // field 91, encoding 2, string \"optional\"\n\t\t\t\"d405\"+ // end group field 90 level 1\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2 string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\"+ // field 103, encoding 0, 0x7f zigzag64\n\t\t\t\"ea1207\"+\"4269676e6f7365\"+ // field 301, encoding 2, string \"Bignose\"\n\t\t\t\"f0123f\"+ // field 302, encoding 0, value 63\n\t\t\t\"f8127f\"+ // field 303, encoding 0, value 127\n\t\t\t\"8a1907\"+\"4269676e6f7365\"+ // field 401, encoding 2, string \"Bignose\"\n\t\t\t\"90193f\"+ // field 402, encoding 0, value 63\n\t\t\t\"98197f\") // field 403, encoding 0, value 127\n\n}\n\n// All required fields set, defaults provided, all repeated fields given two values.\nfunc TestEncodeDecode5(t *testing.T) {\n\tpb := initGoTest(true)\n\tpb.RepeatedField = []*GoTestField{initGoTestField(), initGoTestField()}\n\tpb.F_BoolRepeated = []bool{false, true}\n\tpb.F_Int32Repeated = []int32{32, 33}\n\tpb.F_Int64Repeated = []int64{64, 65}\n\tpb.F_Fixed32Repeated = []uint32{3232, 3333}\n\tpb.F_Fixed64Repeated = []uint64{6464, 6565}\n\tpb.F_Uint32Repeated = []uint32{323232, 333333}\n\tpb.F_Uint64Repeated = []uint64{646464, 656565}\n\tpb.F_FloatRepeated = []float32{32., 33.}\n\tpb.F_DoubleRepeated = []float64{64., 65.}\n\tpb.F_StringRepeated = []string{\"hello\", \"sailor\"}\n\tpb.F_BytesRepeated = [][]byte{[]byte(\"big\"), []byte(\"nose\")}\n\tpb.F_Sint32Repeated = []int32{32, -32}\n\tpb.F_Sint64Repeated = []int64{64, -64}\n\tpb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}\n\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"2a0d\"+\"0a056c6162656c120474797065\"+ // field 5, encoding 2 (GoTestField)\n\t\t\t\"2a0d\"+\"0a056c6162656c120474797065\"+ // field 5, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 32\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 64\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2 string \"string\"\n\t\t\t\"a00100\"+ // field 20, encoding 0, value 0\n\t\t\t\"a00101\"+ // field 20, encoding 0, value 1\n\t\t\t\"a80120\"+ // field 21, encoding 0, value 32\n\t\t\t\"a80121\"+ // field 21, encoding 0, value 33\n\t\t\t\"b00140\"+ // field 22, encoding 0, value 64\n\t\t\t\"b00141\"+ // field 22, encoding 0, value 65\n\t\t\t\"bd01a00c0000\"+ // field 23, encoding 5, value 3232\n\t\t\t\"bd01050d0000\"+ // field 23, encoding 5, value 3333\n\t\t\t\"c1014019000000000000\"+ // field 24, encoding 1, value 6464\n\t\t\t\"c101a519000000000000\"+ // field 24, encoding 1, value 6565\n\t\t\t\"c801a0dd13\"+ // field 25, encoding 0, value 323232\n\t\t\t\"c80195ac14\"+ // field 25, encoding 0, value 333333\n\t\t\t\"d001c0ba27\"+ // field 26, encoding 0, value 646464\n\t\t\t\"d001b58928\"+ // field 26, encoding 0, value 656565\n\t\t\t\"dd0100000042\"+ // field 27, encoding 5, value 32.0\n\t\t\t\"dd0100000442\"+ // field 27, encoding 5, value 33.0\n\t\t\t\"e1010000000000005040\"+ // field 28, encoding 1, value 64.0\n\t\t\t\"e1010000000000405040\"+ // field 28, encoding 1, value 65.0\n\t\t\t\"ea0105\"+\"68656c6c6f\"+ // field 29, encoding 2, string \"hello\"\n\t\t\t\"ea0106\"+\"7361696c6f72\"+ // field 29, encoding 2, string \"sailor\"\n\t\t\t\"c00201\"+ // field 40, encoding 0, value 1\n\t\t\t\"c80220\"+ // field 41, encoding 0, value 32\n\t\t\t\"d00240\"+ // field 42, encoding 0, value 64\n\t\t\t\"dd0240010000\"+ // field 43, encoding 5, value 320\n\t\t\t\"e1028002000000000000\"+ // field 44, encoding 1, value 640\n\t\t\t\"e8028019\"+ // field 45, encoding 0, value 3200\n\t\t\t\"f0028032\"+ // field 46, encoding 0, value 6400\n\t\t\t\"fd02e0659948\"+ // field 47, encoding 5, value 314159.0\n\t\t\t\"81030000000050971041\"+ // field 48, encoding 1, value 271828.0\n\t\t\t\"8a0310\"+\"68656c6c6f2c2022776f726c6421220a\"+ // field 49, encoding 2 string \"hello, \\\"world!\\\"\\n\"\n\t\t\t\"b304\"+ // start group field 70 level 1\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // end group field 70 level 1\n\t\t\t\"8305\"+ // start group field 80 level 1\n\t\t\t\"8a0508\"+\"7265706561746564\"+ // field 81, encoding 2, string \"repeated\"\n\t\t\t\"8405\"+ // end group field 80 level 1\n\t\t\t\"8305\"+ // start group field 80 level 1\n\t\t\t\"8a0508\"+\"7265706561746564\"+ // field 81, encoding 2, string \"repeated\"\n\t\t\t\"8405\"+ // end group field 80 level 1\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2 string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\"+ // field 103, encoding 0, 0x7f zigzag64\n\t\t\t\"ca0c03\"+\"626967\"+ // field 201, encoding 2, string \"big\"\n\t\t\t\"ca0c04\"+\"6e6f7365\"+ // field 201, encoding 2, string \"nose\"\n\t\t\t\"d00c40\"+ // field 202, encoding 0, value 32\n\t\t\t\"d00c3f\"+ // field 202, encoding 0, value -32\n\t\t\t\"d80c8001\"+ // field 203, encoding 0, value 64\n\t\t\t\"d80c7f\"+ // field 203, encoding 0, value -64\n\t\t\t\"8a1907\"+\"4269676e6f7365\"+ // field 401, encoding 2, string \"Bignose\"\n\t\t\t\"90193f\"+ // field 402, encoding 0, value 63\n\t\t\t\"98197f\") // field 403, encoding 0, value 127\n\n}\n\n// All required fields set, all packed repeated fields given two values.\nfunc TestEncodeDecode6(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.F_BoolRepeatedPacked = []bool{false, true}\n\tpb.F_Int32RepeatedPacked = []int32{32, 33}\n\tpb.F_Int64RepeatedPacked = []int64{64, 65}\n\tpb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}\n\tpb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}\n\tpb.F_Uint32RepeatedPacked = []uint32{323232, 333333}\n\tpb.F_Uint64RepeatedPacked = []uint64{646464, 656565}\n\tpb.F_FloatRepeatedPacked = []float32{32., 33.}\n\tpb.F_DoubleRepeatedPacked = []float64{64., 65.}\n\tpb.F_Sint32RepeatedPacked = []int32{32, -32}\n\tpb.F_Sint64RepeatedPacked = []int64{64, -64}\n\n\toverify(t, pb,\n\t\t\"0807\"+ // field 1, encoding 0, value 7\n\t\t\t\"220d\"+\"0a056c6162656c120474797065\"+ // field 4, encoding 2 (GoTestField)\n\t\t\t\"5001\"+ // field 10, encoding 0, value 1\n\t\t\t\"5803\"+ // field 11, encoding 0, value 3\n\t\t\t\"6006\"+ // field 12, encoding 0, value 6\n\t\t\t\"6d20000000\"+ // field 13, encoding 5, value 32\n\t\t\t\"714000000000000000\"+ // field 14, encoding 1, value 64\n\t\t\t\"78a019\"+ // field 15, encoding 0, value 3232\n\t\t\t\"8001c032\"+ // field 16, encoding 0, value 6464\n\t\t\t\"8d0100004a45\"+ // field 17, encoding 5, value 3232.0\n\t\t\t\"9101000000000040b940\"+ // field 18, encoding 1, value 6464.0\n\t\t\t\"9a0106\"+\"737472696e67\"+ // field 19, encoding 2 string \"string\"\n\t\t\t\"9203020001\"+ // field 50, encoding 2, 2 bytes, value 0, value 1\n\t\t\t\"9a03022021\"+ // field 51, encoding 2, 2 bytes, value 32, value 33\n\t\t\t\"a203024041\"+ // field 52, encoding 2, 2 bytes, value 64, value 65\n\t\t\t\"aa0308\"+ // field 53, encoding 2, 8 bytes\n\t\t\t\"a00c0000050d0000\"+ // value 3232, value 3333\n\t\t\t\"b20310\"+ // field 54, encoding 2, 16 bytes\n\t\t\t\"4019000000000000a519000000000000\"+ // value 6464, value 6565\n\t\t\t\"ba0306\"+ // field 55, encoding 2, 6 bytes\n\t\t\t\"a0dd1395ac14\"+ // value 323232, value 333333\n\t\t\t\"c20306\"+ // field 56, encoding 2, 6 bytes\n\t\t\t\"c0ba27b58928\"+ // value 646464, value 656565\n\t\t\t\"ca0308\"+ // field 57, encoding 2, 8 bytes\n\t\t\t\"0000004200000442\"+ // value 32.0, value 33.0\n\t\t\t\"d20310\"+ // field 58, encoding 2, 16 bytes\n\t\t\t\"00000000000050400000000000405040\"+ // value 64.0, value 65.0\n\t\t\t\"b304\"+ // start group field 70 level 1\n\t\t\t\"ba0408\"+\"7265717569726564\"+ // field 71, encoding 2, string \"required\"\n\t\t\t\"b404\"+ // end group field 70 level 1\n\t\t\t\"aa0605\"+\"6279746573\"+ // field 101, encoding 2 string \"bytes\"\n\t\t\t\"b0063f\"+ // field 102, encoding 0, 0x3f zigzag32\n\t\t\t\"b8067f\"+ // field 103, encoding 0, 0x7f zigzag64\n\t\t\t\"b21f02\"+ // field 502, encoding 2, 2 bytes\n\t\t\t\"403f\"+ // value 32, value -32\n\t\t\t\"ba1f03\"+ // field 503, encoding 2, 3 bytes\n\t\t\t\"80017f\") // value 64, value -64\n}\n\n// Test that we can encode empty bytes fields.\nfunc TestEncodeDecodeBytes1(t *testing.T) {\n\tpb := initGoTest(false)\n\n\t// Create our bytes\n\tpb.F_BytesRequired = []byte{}\n\tpb.F_BytesRepeated = [][]byte{{}}\n\tpb.F_BytesOptional = []byte{}\n\n\td, err := Marshal(pb)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tpbd := new(GoTest)\n\tif err := Unmarshal(d, pbd); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired) != 0 {\n\t\tt.Error(\"required empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {\n\t\tt.Error(\"repeated empty bytes field is incorrect\")\n\t}\n\tif pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional) != 0 {\n\t\tt.Error(\"optional empty bytes field is incorrect\")\n\t}\n}\n\n// Test that we encode nil-valued fields of a repeated bytes field correctly.\n// Since entries in a repeated field cannot be nil, nil must mean empty value.\nfunc TestEncodeDecodeBytes2(t *testing.T) {\n\tpb := initGoTest(false)\n\n\t// Create our bytes\n\tpb.F_BytesRepeated = [][]byte{nil}\n\n\td, err := Marshal(pb)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tpbd := new(GoTest)\n\tif err := Unmarshal(d, pbd); err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif len(pbd.F_BytesRepeated) != 1 || pbd.F_BytesRepeated[0] == nil {\n\t\tt.Error(\"Unexpected value for repeated bytes field\")\n\t}\n}\n\n// All required fields set, defaults provided, all repeated fields given two values.\nfunc TestSkippingUnrecognizedFields(t *testing.T) {\n\to := old()\n\tpb := initGoTestField()\n\n\t// Marshal it normally.\n\to.Marshal(pb)\n\n\t// Now new a GoSkipTest record.\n\tskip := &GoSkipTest{\n\t\tSkipInt32:   Int32(32),\n\t\tSkipFixed32: Uint32(3232),\n\t\tSkipFixed64: Uint64(6464),\n\t\tSkipString:  String(\"skipper\"),\n\t\tSkipgroup: &GoSkipTest_SkipGroup{\n\t\t\tGroupInt32:  Int32(75),\n\t\t\tGroupString: String(\"wxyz\"),\n\t\t},\n\t}\n\n\t// Marshal it into same buffer.\n\to.Marshal(skip)\n\n\tpbd := new(GoTestField)\n\to.Unmarshal(pbd)\n\n\t// The __unrecognized field should be a marshaling of GoSkipTest\n\tskipd := new(GoSkipTest)\n\n\to.SetBuf(pbd.XXX_unrecognized)\n\to.Unmarshal(skipd)\n\n\tif *skipd.SkipInt32 != *skip.SkipInt32 {\n\t\tt.Error(\"skip int32\", skipd.SkipInt32)\n\t}\n\tif *skipd.SkipFixed32 != *skip.SkipFixed32 {\n\t\tt.Error(\"skip fixed32\", skipd.SkipFixed32)\n\t}\n\tif *skipd.SkipFixed64 != *skip.SkipFixed64 {\n\t\tt.Error(\"skip fixed64\", skipd.SkipFixed64)\n\t}\n\tif *skipd.SkipString != *skip.SkipString {\n\t\tt.Error(\"skip string\", *skipd.SkipString)\n\t}\n\tif *skipd.Skipgroup.GroupInt32 != *skip.Skipgroup.GroupInt32 {\n\t\tt.Error(\"skip group int32\", skipd.Skipgroup.GroupInt32)\n\t}\n\tif *skipd.Skipgroup.GroupString != *skip.Skipgroup.GroupString {\n\t\tt.Error(\"skip group string\", *skipd.Skipgroup.GroupString)\n\t}\n}\n\n// Check that unrecognized fields of a submessage are preserved.\nfunc TestSubmessageUnrecognizedFields(t *testing.T) {\n\tnm := &NewMessage{\n\t\tNested: &NewMessage_Nested{\n\t\t\tName:      String(\"Nigel\"),\n\t\t\tFoodGroup: String(\"carbs\"),\n\t\t},\n\t}\n\tb, err := Marshal(nm)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of NewMessage: %v\", err)\n\t}\n\n\t// Unmarshal into an OldMessage.\n\tom := new(OldMessage)\n\tif err := Unmarshal(b, om); err != nil {\n\t\tt.Fatalf(\"Unmarshal to OldMessage: %v\", err)\n\t}\n\texp := &OldMessage{\n\t\tNested: &OldMessage_Nested{\n\t\t\tName: String(\"Nigel\"),\n\t\t\t// normal protocol buffer users should not do this\n\t\t\tXXX_unrecognized: []byte(\"\\x12\\x05carbs\"),\n\t\t},\n\t}\n\tif !Equal(om, exp) {\n\t\tt.Errorf(\"om = %v, want %v\", om, exp)\n\t}\n\n\t// Clone the OldMessage.\n\tom = Clone(om).(*OldMessage)\n\tif !Equal(om, exp) {\n\t\tt.Errorf(\"Clone(om) = %v, want %v\", om, exp)\n\t}\n\n\t// Marshal the OldMessage, then unmarshal it into an empty NewMessage.\n\tif b, err = Marshal(om); err != nil {\n\t\tt.Fatalf(\"Marshal of OldMessage: %v\", err)\n\t}\n\tt.Logf(\"Marshal(%v) -> %q\", om, b)\n\tnm2 := new(NewMessage)\n\tif err := Unmarshal(b, nm2); err != nil {\n\t\tt.Fatalf(\"Unmarshal to NewMessage: %v\", err)\n\t}\n\tif !Equal(nm, nm2) {\n\t\tt.Errorf(\"NewMessage round-trip: %v => %v\", nm, nm2)\n\t}\n}\n\n// Check that an int32 field can be upgraded to an int64 field.\nfunc TestNegativeInt32(t *testing.T) {\n\tom := &OldMessage{\n\t\tNum: Int32(-1),\n\t}\n\tb, err := Marshal(om)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of OldMessage: %v\", err)\n\t}\n\n\t// Check the size. It should be 11 bytes;\n\t// 1 for the field/wire type, and 10 for the negative number.\n\tif len(b) != 11 {\n\t\tt.Errorf(\"%v marshaled as %q, wanted 11 bytes\", om, b)\n\t}\n\n\t// Unmarshal into a NewMessage.\n\tnm := new(NewMessage)\n\tif err := Unmarshal(b, nm); err != nil {\n\t\tt.Fatalf(\"Unmarshal to NewMessage: %v\", err)\n\t}\n\twant := &NewMessage{\n\t\tNum: Int64(-1),\n\t}\n\tif !Equal(nm, want) {\n\t\tt.Errorf(\"nm = %v, want %v\", nm, want)\n\t}\n}\n\n// Check that we can grow an array (repeated field) to have many elements.\n// This test doesn't depend only on our encoding; for variety, it makes sure\n// we create, encode, and decode the correct contents explicitly.  It's therefore\n// a bit messier.\n// This test also uses (and hence tests) the Marshal/Unmarshal functions\n// instead of the methods.\nfunc TestBigRepeated(t *testing.T) {\n\tpb := initGoTest(true)\n\n\t// Create the arrays\n\tconst N = 50 // Internally the library starts much smaller.\n\tpb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)\n\tpb.F_Sint64Repeated = make([]int64, N)\n\tpb.F_Sint32Repeated = make([]int32, N)\n\tpb.F_BytesRepeated = make([][]byte, N)\n\tpb.F_StringRepeated = make([]string, N)\n\tpb.F_DoubleRepeated = make([]float64, N)\n\tpb.F_FloatRepeated = make([]float32, N)\n\tpb.F_Uint64Repeated = make([]uint64, N)\n\tpb.F_Uint32Repeated = make([]uint32, N)\n\tpb.F_Fixed64Repeated = make([]uint64, N)\n\tpb.F_Fixed32Repeated = make([]uint32, N)\n\tpb.F_Int64Repeated = make([]int64, N)\n\tpb.F_Int32Repeated = make([]int32, N)\n\tpb.F_BoolRepeated = make([]bool, N)\n\tpb.RepeatedField = make([]*GoTestField, N)\n\n\t// Fill in the arrays with checkable values.\n\tigtf := initGoTestField()\n\tigtrg := initGoTest_RepeatedGroup()\n\tfor i := 0; i < N; i++ {\n\t\tpb.Repeatedgroup[i] = igtrg\n\t\tpb.F_Sint64Repeated[i] = int64(i)\n\t\tpb.F_Sint32Repeated[i] = int32(i)\n\t\ts := fmt.Sprint(i)\n\t\tpb.F_BytesRepeated[i] = []byte(s)\n\t\tpb.F_StringRepeated[i] = s\n\t\tpb.F_DoubleRepeated[i] = float64(i)\n\t\tpb.F_FloatRepeated[i] = float32(i)\n\t\tpb.F_Uint64Repeated[i] = uint64(i)\n\t\tpb.F_Uint32Repeated[i] = uint32(i)\n\t\tpb.F_Fixed64Repeated[i] = uint64(i)\n\t\tpb.F_Fixed32Repeated[i] = uint32(i)\n\t\tpb.F_Int64Repeated[i] = int64(i)\n\t\tpb.F_Int32Repeated[i] = int32(i)\n\t\tpb.F_BoolRepeated[i] = i%2 == 0\n\t\tpb.RepeatedField[i] = igtf\n\t}\n\n\t// Marshal.\n\tbuf, _ := Marshal(pb)\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(GoTest)\n\tUnmarshal(buf, pbd)\n\n\t// Check the checkable values\n\tfor i := uint64(0); i < N; i++ {\n\t\tif pbd.Repeatedgroup[i] == nil { // TODO: more checking?\n\t\t\tt.Error(\"pbd.Repeatedgroup bad\")\n\t\t}\n\t\tvar x uint64\n\t\tx = uint64(pbd.F_Sint64Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Sint64Repeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_Sint32Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Sint32Repeated bad\", x, i)\n\t\t}\n\t\ts := fmt.Sprint(i)\n\t\tequalbytes(pbd.F_BytesRepeated[i], []byte(s), t)\n\t\tif pbd.F_StringRepeated[i] != s {\n\t\t\tt.Error(\"pbd.F_Sint32Repeated bad\", pbd.F_StringRepeated[i], i)\n\t\t}\n\t\tx = uint64(pbd.F_DoubleRepeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_DoubleRepeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_FloatRepeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_FloatRepeated bad\", x, i)\n\t\t}\n\t\tx = pbd.F_Uint64Repeated[i]\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Uint64Repeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_Uint32Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Uint32Repeated bad\", x, i)\n\t\t}\n\t\tx = pbd.F_Fixed64Repeated[i]\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Fixed64Repeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_Fixed32Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Fixed32Repeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_Int64Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Int64Repeated bad\", x, i)\n\t\t}\n\t\tx = uint64(pbd.F_Int32Repeated[i])\n\t\tif x != i {\n\t\t\tt.Error(\"pbd.F_Int32Repeated bad\", x, i)\n\t\t}\n\t\tif pbd.F_BoolRepeated[i] != (i%2 == 0) {\n\t\t\tt.Error(\"pbd.F_BoolRepeated bad\", x, i)\n\t\t}\n\t\tif pbd.RepeatedField[i] == nil { // TODO: more checking?\n\t\t\tt.Error(\"pbd.RepeatedField bad\")\n\t\t}\n\t}\n}\n\n// Verify we give a useful message when decoding to the wrong structure type.\nfunc TestTypeMismatch(t *testing.T) {\n\tpb1 := initGoTest(true)\n\n\t// Marshal\n\to := old()\n\to.Marshal(pb1)\n\n\t// Now Unmarshal it to the wrong type.\n\tpb2 := initGoTestField()\n\terr := o.Unmarshal(pb2)\n\tif err == nil {\n\t\tt.Error(\"expected error, got no error\")\n\t} else if !strings.Contains(err.Error(), \"bad wiretype\") {\n\t\tt.Error(\"expected bad wiretype error, got\", err)\n\t}\n}\n\nfunc encodeDecode(t *testing.T, in, out Message, msg string) {\n\tbuf, err := Marshal(in)\n\tif err != nil {\n\t\tt.Fatalf(\"failed marshaling %v: %v\", msg, err)\n\t}\n\tif err := Unmarshal(buf, out); err != nil {\n\t\tt.Fatalf(\"failed unmarshaling %v: %v\", msg, err)\n\t}\n}\n\nfunc TestPackedNonPackedDecoderSwitching(t *testing.T) {\n\tnp, p := new(NonPackedTest), new(PackedTest)\n\n\t// non-packed -> packed\n\tnp.A = []int32{0, 1, 1, 2, 3, 5}\n\tencodeDecode(t, np, p, \"non-packed -> packed\")\n\tif !reflect.DeepEqual(np.A, p.B) {\n\t\tt.Errorf(\"failed non-packed -> packed; np.A=%+v, p.B=%+v\", np.A, p.B)\n\t}\n\n\t// packed -> non-packed\n\tnp.Reset()\n\tp.B = []int32{3, 1, 4, 1, 5, 9}\n\tencodeDecode(t, p, np, \"packed -> non-packed\")\n\tif !reflect.DeepEqual(p.B, np.A) {\n\t\tt.Errorf(\"failed packed -> non-packed; p.B=%+v, np.A=%+v\", p.B, np.A)\n\t}\n}\n\nfunc TestProto1RepeatedGroup(t *testing.T) {\n\tpb := &MessageList{\n\t\tMessage: []*MessageList_Message{\n\t\t\t{\n\t\t\t\tName:  String(\"blah\"),\n\t\t\t\tCount: Int32(7),\n\t\t\t},\n\t\t\t// NOTE: pb.Message[1] is a nil\n\t\t\tnil,\n\t\t},\n\t}\n\n\to := old()\n\terr := o.Marshal(pb)\n\tif err == nil || !strings.Contains(err.Error(), \"repeated field Message has nil\") {\n\t\tt.Fatalf(\"unexpected or no error when marshaling: %v\", err)\n\t}\n}\n\n// Test that enums work.  Checks for a bug introduced by making enums\n// named types instead of int32: newInt32FromUint64 would crash with\n// a type mismatch in reflect.PointTo.\nfunc TestEnum(t *testing.T) {\n\tpb := new(GoEnum)\n\tpb.Foo = FOO_FOO1.Enum()\n\to := old()\n\tif err := o.Marshal(pb); err != nil {\n\t\tt.Fatal(\"error encoding enum:\", err)\n\t}\n\tpb1 := new(GoEnum)\n\tif err := o.Unmarshal(pb1); err != nil {\n\t\tt.Fatal(\"error decoding enum:\", err)\n\t}\n\tif *pb1.Foo != FOO_FOO1 {\n\t\tt.Error(\"expected 7 but got \", *pb1.Foo)\n\t}\n}\n\n// Enum types have String methods. Check that enum fields can be printed.\n// We don't care what the value actually is, just as long as it doesn't crash.\nfunc TestPrintingNilEnumFields(t *testing.T) {\n\tpb := new(GoEnum)\n\t_ = fmt.Sprintf(\"%+v\", pb)\n}\n\n// Verify that absent required fields cause Marshal/Unmarshal to return errors.\nfunc TestRequiredFieldEnforcement(t *testing.T) {\n\tpb := new(GoTestField)\n\t_, err := Marshal(pb)\n\tif err == nil {\n\t\tt.Error(\"marshal: expected error, got nil\")\n\t} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), \"Label\") {\n\t\tt.Errorf(\"marshal: bad error type: %v\", err)\n\t}\n\n\t// A slightly sneaky, yet valid, proto. It encodes the same required field twice,\n\t// so simply counting the required fields is insufficient.\n\t// field 1, encoding 2, value \"hi\"\n\tbuf := []byte(\"\\x0A\\x02hi\\x0A\\x02hi\")\n\terr = Unmarshal(buf, pb)\n\tif err == nil {\n\t\tt.Error(\"unmarshal: expected error, got nil\")\n\t} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), \"{Unknown}\") {\n\t\tt.Errorf(\"unmarshal: bad error type: %v\", err)\n\t}\n}\n\n// Verify that absent required fields in groups cause Marshal/Unmarshal to return errors.\nfunc TestRequiredFieldEnforcementGroups(t *testing.T) {\n\tpb := &GoTestRequiredGroupField{Group: &GoTestRequiredGroupField_Group{}}\n\tif _, err := Marshal(pb); err == nil {\n\t\tt.Error(\"marshal: expected error, got nil\")\n\t} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), \"Group.Field\") {\n\t\tt.Errorf(\"marshal: bad error type: %v\", err)\n\t}\n\n\tbuf := []byte{11, 12}\n\tif err := Unmarshal(buf, pb); err == nil {\n\t\tt.Error(\"unmarshal: expected error, got nil\")\n\t} else if _, ok := err.(*RequiredNotSetError); !ok || !strings.Contains(err.Error(), \"Group.{Unknown}\") {\n\t\tt.Errorf(\"unmarshal: bad error type: %v\", err)\n\t}\n}\n\nfunc TestTypedNilMarshal(t *testing.T) {\n\t// A typed nil should return ErrNil and not crash.\n\t{\n\t\tvar m *GoEnum\n\t\tif _, err := Marshal(m); err != ErrNil {\n\t\t\tt.Errorf(\"Marshal(%#v): got %v, want ErrNil\", m, err)\n\t\t}\n\t}\n\n\t{\n\t\tm := &Communique{Union: &Communique_Msg{nil}}\n\t\tif _, err := Marshal(m); err == nil || err == ErrNil {\n\t\t\tt.Errorf(\"Marshal(%#v): got %v, want errOneofHasNil\", m, err)\n\t\t}\n\t}\n}\n\n// A type that implements the Marshaler interface, but is not nillable.\ntype nonNillableInt uint64\n\nfunc (nni nonNillableInt) Marshal() ([]byte, error) {\n\treturn EncodeVarint(uint64(nni)), nil\n}\n\ntype NNIMessage struct {\n\tnni nonNillableInt\n}\n\nfunc (*NNIMessage) Reset()         {}\nfunc (*NNIMessage) String() string { return \"\" }\nfunc (*NNIMessage) ProtoMessage()  {}\n\n// A type that implements the Marshaler interface and is nillable.\ntype nillableMessage struct {\n\tx uint64\n}\n\nfunc (nm *nillableMessage) Marshal() ([]byte, error) {\n\treturn EncodeVarint(nm.x), nil\n}\n\ntype NMMessage struct {\n\tnm *nillableMessage\n}\n\nfunc (*NMMessage) Reset()         {}\nfunc (*NMMessage) String() string { return \"\" }\nfunc (*NMMessage) ProtoMessage()  {}\n\n// Verify a type that uses the Marshaler interface, but has a nil pointer.\nfunc TestNilMarshaler(t *testing.T) {\n\t// Try a struct with a Marshaler field that is nil.\n\t// It should be directly marshable.\n\tnmm := new(NMMessage)\n\tif _, err := Marshal(nmm); err != nil {\n\t\tt.Error(\"unexpected error marshaling nmm: \", err)\n\t}\n\n\t// Try a struct with a Marshaler field that is not nillable.\n\tnnim := new(NNIMessage)\n\tnnim.nni = 7\n\tvar _ Marshaler = nnim.nni // verify it is truly a Marshaler\n\tif _, err := Marshal(nnim); err != nil {\n\t\tt.Error(\"unexpected error marshaling nnim: \", err)\n\t}\n}\n\nfunc TestAllSetDefaults(t *testing.T) {\n\t// Exercise SetDefaults with all scalar field types.\n\tm := &Defaults{\n\t\t// NaN != NaN, so override that here.\n\t\tF_Nan: Float32(1.7),\n\t}\n\texpected := &Defaults{\n\t\tF_Bool:    Bool(true),\n\t\tF_Int32:   Int32(32),\n\t\tF_Int64:   Int64(64),\n\t\tF_Fixed32: Uint32(320),\n\t\tF_Fixed64: Uint64(640),\n\t\tF_Uint32:  Uint32(3200),\n\t\tF_Uint64:  Uint64(6400),\n\t\tF_Float:   Float32(314159),\n\t\tF_Double:  Float64(271828),\n\t\tF_String:  String(`hello, \"world!\"` + \"\\n\"),\n\t\tF_Bytes:   []byte(\"Bignose\"),\n\t\tF_Sint32:  Int32(-32),\n\t\tF_Sint64:  Int64(-64),\n\t\tF_Enum:    Defaults_GREEN.Enum(),\n\t\tF_Pinf:    Float32(float32(math.Inf(1))),\n\t\tF_Ninf:    Float32(float32(math.Inf(-1))),\n\t\tF_Nan:     Float32(1.7),\n\t\tStrZero:   String(\"\"),\n\t}\n\tSetDefaults(m)\n\tif !Equal(m, expected) {\n\t\tt.Errorf(\"SetDefaults failed\\n got %v\\nwant %v\", m, expected)\n\t}\n}\n\nfunc TestSetDefaultsWithSetField(t *testing.T) {\n\t// Check that a set value is not overridden.\n\tm := &Defaults{\n\t\tF_Int32: Int32(12),\n\t}\n\tSetDefaults(m)\n\tif v := m.GetF_Int32(); v != 12 {\n\t\tt.Errorf(\"m.FInt32 = %v, want 12\", v)\n\t}\n}\n\nfunc TestSetDefaultsWithSubMessage(t *testing.T) {\n\tm := &OtherMessage{\n\t\tKey: Int64(123),\n\t\tInner: &InnerMessage{\n\t\t\tHost: String(\"gopher\"),\n\t\t},\n\t}\n\texpected := &OtherMessage{\n\t\tKey: Int64(123),\n\t\tInner: &InnerMessage{\n\t\t\tHost: String(\"gopher\"),\n\t\t\tPort: Int32(4000),\n\t\t},\n\t}\n\tSetDefaults(m)\n\tif !Equal(m, expected) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, expected)\n\t}\n}\n\nfunc TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {\n\tm := &MyMessage{\n\t\tRepInner: []*InnerMessage{{}},\n\t}\n\texpected := &MyMessage{\n\t\tRepInner: []*InnerMessage{{\n\t\t\tPort: Int32(4000),\n\t\t}},\n\t}\n\tSetDefaults(m)\n\tif !Equal(m, expected) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, expected)\n\t}\n}\n\nfunc TestSetDefaultWithRepeatedNonMessage(t *testing.T) {\n\tm := &MyMessage{\n\t\tPet: []string{\"turtle\", \"wombat\"},\n\t}\n\texpected := Clone(m)\n\tSetDefaults(m)\n\tif !Equal(m, expected) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, expected)\n\t}\n}\n\nfunc TestMaximumTagNumber(t *testing.T) {\n\tm := &MaxTag{\n\t\tLastField: String(\"natural goat essence\"),\n\t}\n\tbuf, err := Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.Marshal failed: %v\", err)\n\t}\n\tm2 := new(MaxTag)\n\tif err := Unmarshal(buf, m2); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal failed: %v\", err)\n\t}\n\tif got, want := m2.GetLastField(), *m.LastField; got != want {\n\t\tt.Errorf(\"got %q, want %q\", got, want)\n\t}\n}\n\nfunc TestJSON(t *testing.T) {\n\tm := &MyMessage{\n\t\tCount: Int32(4),\n\t\tPet:   []string{\"bunny\", \"kitty\"},\n\t\tInner: &InnerMessage{\n\t\t\tHost: String(\"cauchy\"),\n\t\t},\n\t\tBikeshed: MyMessage_GREEN.Enum(),\n\t}\n\tconst expected = `{\"count\":4,\"pet\":[\"bunny\",\"kitty\"],\"inner\":{\"host\":\"cauchy\"},\"bikeshed\":1}`\n\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"json.Marshal failed: %v\", err)\n\t}\n\ts := string(b)\n\tif s != expected {\n\t\tt.Errorf(\"got  %s\\nwant %s\", s, expected)\n\t}\n\n\treceived := new(MyMessage)\n\tif err := json.Unmarshal(b, received); err != nil {\n\t\tt.Fatalf(\"json.Unmarshal failed: %v\", err)\n\t}\n\tif !Equal(received, m) {\n\t\tt.Fatalf(\"got %s, want %s\", received, m)\n\t}\n\n\t// Test unmarshalling of JSON with symbolic enum name.\n\tconst old = `{\"count\":4,\"pet\":[\"bunny\",\"kitty\"],\"inner\":{\"host\":\"cauchy\"},\"bikeshed\":\"GREEN\"}`\n\treceived.Reset()\n\tif err := json.Unmarshal([]byte(old), received); err != nil {\n\t\tt.Fatalf(\"json.Unmarshal failed: %v\", err)\n\t}\n\tif !Equal(received, m) {\n\t\tt.Fatalf(\"got %s, want %s\", received, m)\n\t}\n}\n\nfunc TestBadWireType(t *testing.T) {\n\tb := []byte{7<<3 | 6} // field 7, wire type 6\n\tpb := new(OtherMessage)\n\tif err := Unmarshal(b, pb); err == nil {\n\t\tt.Errorf(\"Unmarshal did not fail\")\n\t} else if !strings.Contains(err.Error(), \"unknown wire type\") {\n\t\tt.Errorf(\"wrong error: %v\", err)\n\t}\n}\n\nfunc TestBytesWithInvalidLength(t *testing.T) {\n\t// If a byte sequence has an invalid (negative) length, Unmarshal should not panic.\n\tb := []byte{2<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0}\n\tUnmarshal(b, new(MyMessage))\n}\n\nfunc TestLengthOverflow(t *testing.T) {\n\t// Overflowing a length should not panic.\n\tb := []byte{2<<3 | WireBytes, 1, 1, 3<<3 | WireBytes, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x01}\n\tUnmarshal(b, new(MyMessage))\n}\n\nfunc TestVarintOverflow(t *testing.T) {\n\t// Overflowing a 64-bit length should not be allowed.\n\tb := []byte{1<<3 | WireVarint, 0x01, 3<<3 | WireBytes, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}\n\tif err := Unmarshal(b, new(MyMessage)); err == nil {\n\t\tt.Fatalf(\"Overflowed uint64 length without error\")\n\t}\n}\n\nfunc TestUnmarshalFuzz(t *testing.T) {\n\tconst N = 1000\n\tseed := time.Now().UnixNano()\n\tt.Logf(\"RNG seed is %d\", seed)\n\trng := rand.New(rand.NewSource(seed))\n\tbuf := make([]byte, 20)\n\tfor i := 0; i < N; i++ {\n\t\tfor j := range buf {\n\t\t\tbuf[j] = byte(rng.Intn(256))\n\t\t}\n\t\tfuzzUnmarshal(t, buf)\n\t}\n}\n\nfunc TestMergeMessages(t *testing.T) {\n\tpb := &MessageList{Message: []*MessageList_Message{{Name: String(\"x\"), Count: Int32(1)}}}\n\tdata, err := Marshal(pb)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\n\tpb1 := new(MessageList)\n\tif err := Unmarshal(data, pb1); err != nil {\n\t\tt.Fatalf(\"first Unmarshal: %v\", err)\n\t}\n\tif err := Unmarshal(data, pb1); err != nil {\n\t\tt.Fatalf(\"second Unmarshal: %v\", err)\n\t}\n\tif len(pb1.Message) != 1 {\n\t\tt.Errorf(\"two Unmarshals produced %d Messages, want 1\", len(pb1.Message))\n\t}\n\n\tpb2 := new(MessageList)\n\tif err := UnmarshalMerge(data, pb2); err != nil {\n\t\tt.Fatalf(\"first UnmarshalMerge: %v\", err)\n\t}\n\tif err := UnmarshalMerge(data, pb2); err != nil {\n\t\tt.Fatalf(\"second UnmarshalMerge: %v\", err)\n\t}\n\tif len(pb2.Message) != 2 {\n\t\tt.Errorf(\"two UnmarshalMerges produced %d Messages, want 2\", len(pb2.Message))\n\t}\n}\n\nfunc TestExtensionMarshalOrder(t *testing.T) {\n\tm := &MyMessage{Count: Int(123)}\n\tif err := SetExtension(m, E_Ext_More, &Ext{Data: String(\"alpha\")}); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\tif err := SetExtension(m, E_Ext_Text, String(\"aleph\")); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\tif err := SetExtension(m, E_Ext_Number, Int32(1)); err != nil {\n\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t}\n\n\t// Serialize m several times, and check we get the same bytes each time.\n\tvar orig []byte\n\tfor i := 0; i < 100; i++ {\n\t\tb, err := Marshal(m)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Marshal: %v\", err)\n\t\t}\n\t\tif i == 0 {\n\t\t\torig = b\n\t\t\tcontinue\n\t\t}\n\t\tif !bytes.Equal(b, orig) {\n\t\t\tt.Errorf(\"Bytes differ on attempt #%d\", i)\n\t\t}\n\t}\n}\n\n// Many extensions, because small maps might not iterate differently on each iteration.\nvar exts = []*ExtensionDesc{\n\tE_X201,\n\tE_X202,\n\tE_X203,\n\tE_X204,\n\tE_X205,\n\tE_X206,\n\tE_X207,\n\tE_X208,\n\tE_X209,\n\tE_X210,\n\tE_X211,\n\tE_X212,\n\tE_X213,\n\tE_X214,\n\tE_X215,\n\tE_X216,\n\tE_X217,\n\tE_X218,\n\tE_X219,\n\tE_X220,\n\tE_X221,\n\tE_X222,\n\tE_X223,\n\tE_X224,\n\tE_X225,\n\tE_X226,\n\tE_X227,\n\tE_X228,\n\tE_X229,\n\tE_X230,\n\tE_X231,\n\tE_X232,\n\tE_X233,\n\tE_X234,\n\tE_X235,\n\tE_X236,\n\tE_X237,\n\tE_X238,\n\tE_X239,\n\tE_X240,\n\tE_X241,\n\tE_X242,\n\tE_X243,\n\tE_X244,\n\tE_X245,\n\tE_X246,\n\tE_X247,\n\tE_X248,\n\tE_X249,\n\tE_X250,\n}\n\nfunc TestMessageSetMarshalOrder(t *testing.T) {\n\tm := &MyMessageSet{}\n\tfor _, x := range exts {\n\t\tif err := SetExtension(m, x, &Empty{}); err != nil {\n\t\t\tt.Fatalf(\"SetExtension: %v\", err)\n\t\t}\n\t}\n\n\tbuf, err := Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\n\t// Serialize m several times, and check we get the same bytes each time.\n\tfor i := 0; i < 10; i++ {\n\t\tb1, err := Marshal(m)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Marshal: %v\", err)\n\t\t}\n\t\tif !bytes.Equal(b1, buf) {\n\t\t\tt.Errorf(\"Bytes differ on re-Marshal #%d\", i)\n\t\t}\n\n\t\tm2 := &MyMessageSet{}\n\t\tif err := Unmarshal(buf, m2); err != nil {\n\t\t\tt.Errorf(\"Unmarshal: %v\", err)\n\t\t}\n\t\tb2, err := Marshal(m2)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"re-Marshal: %v\", err)\n\t\t}\n\t\tif !bytes.Equal(b2, buf) {\n\t\t\tt.Errorf(\"Bytes differ on round-trip #%d\", i)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalMergesMessages(t *testing.T) {\n\t// If a nested message occurs twice in the input,\n\t// the fields should be merged when decoding.\n\ta := &OtherMessage{\n\t\tKey: Int64(123),\n\t\tInner: &InnerMessage{\n\t\t\tHost: String(\"polhode\"),\n\t\t\tPort: Int32(1234),\n\t\t},\n\t}\n\taData, err := Marshal(a)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(a): %v\", err)\n\t}\n\tb := &OtherMessage{\n\t\tWeight: Float32(1.2),\n\t\tInner: &InnerMessage{\n\t\t\tHost:      String(\"herpolhode\"),\n\t\t\tConnected: Bool(true),\n\t\t},\n\t}\n\tbData, err := Marshal(b)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal(b): %v\", err)\n\t}\n\twant := &OtherMessage{\n\t\tKey:    Int64(123),\n\t\tWeight: Float32(1.2),\n\t\tInner: &InnerMessage{\n\t\t\tHost:      String(\"herpolhode\"),\n\t\t\tPort:      Int32(1234),\n\t\t\tConnected: Bool(true),\n\t\t},\n\t}\n\tgot := new(OtherMessage)\n\tif err := Unmarshal(append(aData, bData...), got); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v\", err)\n\t}\n\tif !Equal(got, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", got, want)\n\t}\n}\n\nfunc TestEncodingSizes(t *testing.T) {\n\ttests := []struct {\n\t\tm Message\n\t\tn int\n\t}{\n\t\t{&Defaults{F_Int32: Int32(math.MaxInt32)}, 6},\n\t\t{&Defaults{F_Int32: Int32(math.MinInt32)}, 11},\n\t\t{&Defaults{F_Uint32: Uint32(uint32(math.MaxInt32) + 1)}, 6},\n\t\t{&Defaults{F_Uint32: Uint32(math.MaxUint32)}, 6},\n\t}\n\tfor _, test := range tests {\n\t\tb, err := Marshal(test.m)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Marshal(%v): %v\", test.m, err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(b) != test.n {\n\t\t\tt.Errorf(\"Marshal(%v) yielded %d bytes, want %d bytes\", test.m, len(b), test.n)\n\t\t}\n\t}\n}\n\nfunc TestRequiredNotSetError(t *testing.T) {\n\tpb := initGoTest(false)\n\tpb.RequiredField.Label = nil\n\tpb.F_Int32Required = nil\n\tpb.F_Int64Required = nil\n\n\texpected := \"0807\" + // field 1, encoding 0, value 7\n\t\t\"2206\" + \"120474797065\" + // field 4, encoding 2 (GoTestField)\n\t\t\"5001\" + // field 10, encoding 0, value 1\n\t\t\"6d20000000\" + // field 13, encoding 5, value 0x20\n\t\t\"714000000000000000\" + // field 14, encoding 1, value 0x40\n\t\t\"78a019\" + // field 15, encoding 0, value 0xca0 = 3232\n\t\t\"8001c032\" + // field 16, encoding 0, value 0x1940 = 6464\n\t\t\"8d0100004a45\" + // field 17, encoding 5, value 3232.0\n\t\t\"9101000000000040b940\" + // field 18, encoding 1, value 6464.0\n\t\t\"9a0106\" + \"737472696e67\" + // field 19, encoding 2, string \"string\"\n\t\t\"b304\" + // field 70, encoding 3, start group\n\t\t\"ba0408\" + \"7265717569726564\" + // field 71, encoding 2, string \"required\"\n\t\t\"b404\" + // field 70, encoding 4, end group\n\t\t\"aa0605\" + \"6279746573\" + // field 101, encoding 2, string \"bytes\"\n\t\t\"b0063f\" + // field 102, encoding 0, 0x3f zigzag32\n\t\t\"b8067f\" // field 103, encoding 0, 0x7f zigzag64\n\n\to := old()\n\tbytes, err := Marshal(pb)\n\tif _, ok := err.(*RequiredNotSetError); !ok {\n\t\tfmt.Printf(\"marshal-1 err = %v, want *RequiredNotSetError\", err)\n\t\to.DebugPrint(\"\", bytes)\n\t\tt.Fatalf(\"expected = %s\", expected)\n\t}\n\tif strings.Index(err.Error(), \"RequiredField.Label\") < 0 {\n\t\tt.Errorf(\"marshal-1 wrong err msg: %v\", err)\n\t}\n\tif !equal(bytes, expected, t) {\n\t\to.DebugPrint(\"neq 1\", bytes)\n\t\tt.Fatalf(\"expected = %s\", expected)\n\t}\n\n\t// Now test Unmarshal by recreating the original buffer.\n\tpbd := new(GoTest)\n\terr = Unmarshal(bytes, pbd)\n\tif _, ok := err.(*RequiredNotSetError); !ok {\n\t\tt.Fatalf(\"unmarshal err = %v, want *RequiredNotSetError\", err)\n\t\to.DebugPrint(\"\", bytes)\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n\tif strings.Index(err.Error(), \"RequiredField.{Unknown}\") < 0 {\n\t\tt.Errorf(\"unmarshal wrong err msg: %v\", err)\n\t}\n\tbytes, err = Marshal(pbd)\n\tif _, ok := err.(*RequiredNotSetError); !ok {\n\t\tt.Errorf(\"marshal-2 err = %v, want *RequiredNotSetError\", err)\n\t\to.DebugPrint(\"\", bytes)\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n\tif strings.Index(err.Error(), \"RequiredField.Label\") < 0 {\n\t\tt.Errorf(\"marshal-2 wrong err msg: %v\", err)\n\t}\n\tif !equal(bytes, expected, t) {\n\t\to.DebugPrint(\"neq 2\", bytes)\n\t\tt.Fatalf(\"string = %s\", expected)\n\t}\n}\n\nfunc fuzzUnmarshal(t *testing.T, data []byte) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tt.Errorf(\"These bytes caused a panic: %+v\", data)\n\t\t\tt.Logf(\"Stack:\\n%s\", debug.Stack())\n\t\t\tt.FailNow()\n\t\t}\n\t}()\n\n\tpb := new(MyMessage)\n\tUnmarshal(data, pb)\n}\n\nfunc TestMapFieldMarshal(t *testing.T) {\n\tm := &MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1: \"Rob\",\n\t\t\t4: \"Ian\",\n\t\t\t8: \"Dave\",\n\t\t},\n\t}\n\tb, err := Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\n\t// b should be the concatenation of these three byte sequences in some order.\n\tparts := []string{\n\t\t\"\\n\\a\\b\\x01\\x12\\x03Rob\",\n\t\t\"\\n\\a\\b\\x04\\x12\\x03Ian\",\n\t\t\"\\n\\b\\b\\x08\\x12\\x04Dave\",\n\t}\n\tok := false\n\tfor i := range parts {\n\t\tfor j := range parts {\n\t\t\tif j == i {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor k := range parts {\n\t\t\t\tif k == i || k == j {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry := parts[i] + parts[j] + parts[k]\n\t\t\t\tif bytes.Equal(b, []byte(try)) {\n\t\t\t\t\tok = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif !ok {\n\t\tt.Fatalf(\"Incorrect Marshal output.\\n got %q\\nwant %q (or a permutation of that)\", b, parts[0]+parts[1]+parts[2])\n\t}\n\tt.Logf(\"FYI b: %q\", b)\n\n\t(new(Buffer)).DebugPrint(\"Dump of b\", b)\n}\n\nfunc TestMapFieldRoundTrips(t *testing.T) {\n\tm := &MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1: \"Rob\",\n\t\t\t4: \"Ian\",\n\t\t\t8: \"Dave\",\n\t\t},\n\t\tMsgMapping: map[int64]*FloatingPoint{\n\t\t\t0x7001: &FloatingPoint{F: Float64(2.0)},\n\t\t},\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: []byte(\"that's not right!\"),\n\t\t\ttrue:  []byte(\"aye, 'tis true!\"),\n\t\t},\n\t}\n\tb, err := Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tt.Logf(\"FYI b: %q\", b)\n\tm2 := new(MessageWithMap)\n\tif err := Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v\", err)\n\t}\n\tfor _, pair := range [][2]interface{}{\n\t\t{m.NameMapping, m2.NameMapping},\n\t\t{m.MsgMapping, m2.MsgMapping},\n\t\t{m.ByteMapping, m2.ByteMapping},\n\t} {\n\t\tif !reflect.DeepEqual(pair[0], pair[1]) {\n\t\t\tt.Errorf(\"Map did not survive a round trip.\\ninitial: %v\\n  final: %v\", pair[0], pair[1])\n\t\t}\n\t}\n}\n\nfunc TestMapFieldWithNil(t *testing.T) {\n\tm1 := &MessageWithMap{\n\t\tMsgMapping: map[int64]*FloatingPoint{\n\t\t\t1: nil,\n\t\t},\n\t}\n\tb, err := Marshal(m1)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tm2 := new(MessageWithMap)\n\tif err := Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v, got these bytes: %v\", err, b)\n\t}\n\tif v, ok := m2.MsgMapping[1]; !ok {\n\t\tt.Error(\"msg_mapping[1] not present\")\n\t} else if v != nil {\n\t\tt.Errorf(\"msg_mapping[1] not nil: %v\", v)\n\t}\n}\n\nfunc TestMapFieldWithNilBytes(t *testing.T) {\n\tm1 := &MessageWithMap{\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: []byte{},\n\t\t\ttrue:  nil,\n\t\t},\n\t}\n\tn := Size(m1)\n\tb, err := Marshal(m1)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tif n != len(b) {\n\t\tt.Errorf(\"Size(m1) = %d; want len(Marshal(m1)) = %d\", n, len(b))\n\t}\n\tm2 := new(MessageWithMap)\n\tif err := Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"Unmarshal: %v, got these bytes: %v\", err, b)\n\t}\n\tif v, ok := m2.ByteMapping[false]; !ok {\n\t\tt.Error(\"byte_mapping[false] not present\")\n\t} else if len(v) != 0 {\n\t\tt.Errorf(\"byte_mapping[false] not empty: %#v\", v)\n\t}\n\tif v, ok := m2.ByteMapping[true]; !ok {\n\t\tt.Error(\"byte_mapping[true] not present\")\n\t} else if len(v) != 0 {\n\t\tt.Errorf(\"byte_mapping[true] not empty: %#v\", v)\n\t}\n}\n\nfunc TestDecodeMapFieldMissingKey(t *testing.T) {\n\tb := []byte{\n\t\t0x0A, 0x03, // message, tag 1 (name_mapping), of length 3 bytes\n\t\t// no key\n\t\t0x12, 0x01, 0x6D, // string value of length 1 byte, value \"m\"\n\t}\n\tgot := &MessageWithMap{}\n\terr := Unmarshal(b, got)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to marshal map with missing key: %v\", err)\n\t}\n\twant := &MessageWithMap{NameMapping: map[int32]string{0: \"m\"}}\n\tif !Equal(got, want) {\n\t\tt.Errorf(\"Unmarshaled map with no key was not as expected. got: %v, want %v\", got, want)\n\t}\n}\n\nfunc TestDecodeMapFieldMissingValue(t *testing.T) {\n\tb := []byte{\n\t\t0x0A, 0x02, // message, tag 1 (name_mapping), of length 2 bytes\n\t\t0x08, 0x01, // varint key, value 1\n\t\t// no value\n\t}\n\tgot := &MessageWithMap{}\n\terr := Unmarshal(b, got)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to marshal map with missing value: %v\", err)\n\t}\n\twant := &MessageWithMap{NameMapping: map[int32]string{1: \"\"}}\n\tif !Equal(got, want) {\n\t\tt.Errorf(\"Unmarshaled map with no value was not as expected. got: %v, want %v\", got, want)\n\t}\n}\n\nfunc TestOneof(t *testing.T) {\n\tm := &Communique{}\n\tb, err := Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of empty message with oneof: %v\", err)\n\t}\n\tif len(b) != 0 {\n\t\tt.Errorf(\"Marshal of empty message yielded too many bytes: %v\", b)\n\t}\n\n\tm = &Communique{\n\t\tUnion: &Communique_Name{\"Barry\"},\n\t}\n\n\t// Round-trip.\n\tb, err = Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of message with oneof: %v\", err)\n\t}\n\tif len(b) != 7 { // name tag/wire (1) + name len (1) + name (5)\n\t\tt.Errorf(\"Incorrect marshal of message with oneof: %v\", b)\n\t}\n\tm.Reset()\n\tif err := Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"Unmarshal of message with oneof: %v\", err)\n\t}\n\tif x, ok := m.Union.(*Communique_Name); !ok || x.Name != \"Barry\" {\n\t\tt.Errorf(\"After round trip, Union = %+v\", m.Union)\n\t}\n\tif name := m.GetName(); name != \"Barry\" {\n\t\tt.Errorf(\"After round trip, GetName = %q, want %q\", name, \"Barry\")\n\t}\n\n\t// Let's try with a message in the oneof.\n\tm.Union = &Communique_Msg{&Strings{StringField: String(\"deep deep string\")}}\n\tb, err = Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal of message with oneof set to message: %v\", err)\n\t}\n\tif len(b) != 20 { // msg tag/wire (1) + msg len (1) + msg (1 + 1 + 16)\n\t\tt.Errorf(\"Incorrect marshal of message with oneof set to message: %v\", b)\n\t}\n\tm.Reset()\n\tif err := Unmarshal(b, m); err != nil {\n\t\tt.Fatalf(\"Unmarshal of message with oneof set to message: %v\", err)\n\t}\n\tss, ok := m.Union.(*Communique_Msg)\n\tif !ok || ss.Msg.GetStringField() != \"deep deep string\" {\n\t\tt.Errorf(\"After round trip with oneof set to message, Union = %+v\", m.Union)\n\t}\n}\n\nfunc TestInefficientPackedBool(t *testing.T) {\n\t// https://github.com/golang/protobuf/issues/76\n\tinp := []byte{\n\t\t0x12, 0x02, // 0x12 = 2<<3|2; 2 bytes\n\t\t// Usually a bool should take a single byte,\n\t\t// but it is permitted to be any varint.\n\t\t0xb9, 0x30,\n\t}\n\tif err := Unmarshal(inp, new(MoreRepeated)); err != nil {\n\t\tt.Error(err)\n\t}\n}\n\n// Benchmarks\n\nfunc testMsg() *GoTest {\n\tpb := initGoTest(true)\n\tconst N = 1000 // Internally the library starts much smaller.\n\tpb.F_Int32Repeated = make([]int32, N)\n\tpb.F_DoubleRepeated = make([]float64, N)\n\tfor i := 0; i < N; i++ {\n\t\tpb.F_Int32Repeated[i] = int32(i)\n\t\tpb.F_DoubleRepeated[i] = float64(i)\n\t}\n\treturn pb\n}\n\nfunc bytesMsg() *GoTest {\n\tpb := initGoTest(true)\n\tbuf := make([]byte, 4000)\n\tfor i := range buf {\n\t\tbuf[i] = byte(i)\n\t}\n\tpb.F_BytesDefaulted = buf\n\treturn pb\n}\n\nfunc benchmarkMarshal(b *testing.B, pb Message, marshal func(Message) ([]byte, error)) {\n\td, _ := marshal(pb)\n\tb.SetBytes(int64(len(d)))\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tmarshal(pb)\n\t}\n}\n\nfunc benchmarkBufferMarshal(b *testing.B, pb Message) {\n\tp := NewBuffer(nil)\n\tbenchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {\n\t\tp.Reset()\n\t\terr := p.Marshal(pb0)\n\t\treturn p.Bytes(), err\n\t})\n}\n\nfunc benchmarkSize(b *testing.B, pb Message) {\n\tbenchmarkMarshal(b, pb, func(pb0 Message) ([]byte, error) {\n\t\tSize(pb)\n\t\treturn nil, nil\n\t})\n}\n\nfunc newOf(pb Message) Message {\n\tin := reflect.ValueOf(pb)\n\tif in.IsNil() {\n\t\treturn pb\n\t}\n\treturn reflect.New(in.Type().Elem()).Interface().(Message)\n}\n\nfunc benchmarkUnmarshal(b *testing.B, pb Message, unmarshal func([]byte, Message) error) {\n\td, _ := Marshal(pb)\n\tb.SetBytes(int64(len(d)))\n\tpbd := newOf(pb)\n\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tunmarshal(d, pbd)\n\t}\n}\n\nfunc benchmarkBufferUnmarshal(b *testing.B, pb Message) {\n\tp := NewBuffer(nil)\n\tbenchmarkUnmarshal(b, pb, func(d []byte, pb0 Message) error {\n\t\tp.SetBuf(d)\n\t\treturn p.Unmarshal(pb0)\n\t})\n}\n\n// Benchmark{Marshal,BufferMarshal,Size,Unmarshal,BufferUnmarshal}{,Bytes}\n\nfunc BenchmarkMarshal(b *testing.B) {\n\tbenchmarkMarshal(b, testMsg(), Marshal)\n}\n\nfunc BenchmarkBufferMarshal(b *testing.B) {\n\tbenchmarkBufferMarshal(b, testMsg())\n}\n\nfunc BenchmarkSize(b *testing.B) {\n\tbenchmarkSize(b, testMsg())\n}\n\nfunc BenchmarkUnmarshal(b *testing.B) {\n\tbenchmarkUnmarshal(b, testMsg(), Unmarshal)\n}\n\nfunc BenchmarkBufferUnmarshal(b *testing.B) {\n\tbenchmarkBufferUnmarshal(b, testMsg())\n}\n\nfunc BenchmarkMarshalBytes(b *testing.B) {\n\tbenchmarkMarshal(b, bytesMsg(), Marshal)\n}\n\nfunc BenchmarkBufferMarshalBytes(b *testing.B) {\n\tbenchmarkBufferMarshal(b, bytesMsg())\n}\n\nfunc BenchmarkSizeBytes(b *testing.B) {\n\tbenchmarkSize(b, bytesMsg())\n}\n\nfunc BenchmarkUnmarshalBytes(b *testing.B) {\n\tbenchmarkUnmarshal(b, bytesMsg(), Unmarshal)\n}\n\nfunc BenchmarkBufferUnmarshalBytes(b *testing.B) {\n\tbenchmarkBufferUnmarshal(b, bytesMsg())\n}\n\nfunc BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {\n\tb.StopTimer()\n\tpb := initGoTestField()\n\tskip := &GoSkipTest{\n\t\tSkipInt32:   Int32(32),\n\t\tSkipFixed32: Uint32(3232),\n\t\tSkipFixed64: Uint64(6464),\n\t\tSkipString:  String(\"skipper\"),\n\t\tSkipgroup: &GoSkipTest_SkipGroup{\n\t\t\tGroupInt32:  Int32(75),\n\t\t\tGroupString: String(\"wxyz\"),\n\t\t},\n\t}\n\n\tpbd := new(GoTestField)\n\tp := NewBuffer(nil)\n\tp.Marshal(pb)\n\tp.Marshal(skip)\n\tp2 := NewBuffer(nil)\n\n\tb.StartTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tp2.SetBuf(p.Bytes())\n\t\tp2.Unmarshal(pbd)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/any_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tpb \"github.com/golang/protobuf/proto/proto3_proto\"\n\ttestpb \"github.com/golang/protobuf/proto/testdata\"\n\tanypb \"github.com/golang/protobuf/ptypes/any\"\n)\n\nvar (\n\texpandedMarshaler        = proto.TextMarshaler{ExpandAny: true}\n\texpandedCompactMarshaler = proto.TextMarshaler{Compact: true, ExpandAny: true}\n)\n\n// anyEqual reports whether two messages which may be google.protobuf.Any or may\n// contain google.protobuf.Any fields are equal. We can't use proto.Equal for\n// comparison, because semantically equivalent messages may be marshaled to\n// binary in different tag order. Instead, trust that TextMarshaler with\n// ExpandAny option works and compare the text marshaling results.\nfunc anyEqual(got, want proto.Message) bool {\n\t// if messages are proto.Equal, no need to marshal.\n\tif proto.Equal(got, want) {\n\t\treturn true\n\t}\n\tg := expandedMarshaler.Text(got)\n\tw := expandedMarshaler.Text(want)\n\treturn g == w\n}\n\ntype golden struct {\n\tm    proto.Message\n\tt, c string\n}\n\nvar goldenMessages = makeGolden()\n\nfunc makeGolden() []golden {\n\tnested := &pb.Nested{Bunny: \"Monty\"}\n\tnb, err := proto.Marshal(nested)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm1 := &pb.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm2 := &pb.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"http://[::1]/type.googleapis.com/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm3 := &pb.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: `type.googleapis.com/\"/` + proto.MessageName(nested), Value: nb},\n\t}\n\tm4 := &pb.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/a/path/\" + proto.MessageName(nested), Value: nb},\n\t}\n\tm5 := &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(nested), Value: nb}\n\n\tany1 := &testpb.MyMessage{Count: proto.Int32(47), Name: proto.String(\"David\")}\n\tproto.SetExtension(any1, testpb.E_Ext_More, &testpb.Ext{Data: proto.String(\"foo\")})\n\tproto.SetExtension(any1, testpb.E_Ext_Text, proto.String(\"bar\"))\n\tany1b, err := proto.Marshal(any1)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tany2 := &testpb.MyMessage{Count: proto.Int32(42), Bikeshed: testpb.MyMessage_GREEN.Enum(), RepBytes: [][]byte{[]byte(\"roboto\")}}\n\tproto.SetExtension(any2, testpb.E_Ext_More, &testpb.Ext{Data: proto.String(\"baz\")})\n\tany2b, err := proto.Marshal(any2)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm6 := &pb.Message{\n\t\tName:        \"David\",\n\t\tResultCount: 47,\n\t\tAnything:    &anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any1), Value: any1b},\n\t\tManyThings: []*anypb.Any{\n\t\t\t&anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any2), Value: any2b},\n\t\t\t&anypb.Any{TypeUrl: \"type.googleapis.com/\" + proto.MessageName(any1), Value: any1b},\n\t\t},\n\t}\n\n\tconst (\n\t\tm1Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/proto3_proto.Nested]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm2Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [\"http://[::1]/type.googleapis.com/proto3_proto.Nested\"]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm3Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [\"type.googleapis.com/\\\"/proto3_proto.Nested\"]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm4Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/a/path/proto3_proto.Nested]: <\n    bunny: \"Monty\"\n  >\n>\n`\n\t\tm5Golden = `\n[type.googleapis.com/proto3_proto.Nested]: <\n  bunny: \"Monty\"\n>\n`\n\t\tm6Golden = `\nname: \"David\"\nresult_count: 47\nanything: <\n  [type.googleapis.com/testdata.MyMessage]: <\n    count: 47\n    name: \"David\"\n    [testdata.Ext.more]: <\n      data: \"foo\"\n    >\n    [testdata.Ext.text]: \"bar\"\n  >\n>\nmany_things: <\n  [type.googleapis.com/testdata.MyMessage]: <\n    count: 42\n    bikeshed: GREEN\n    rep_bytes: \"roboto\"\n    [testdata.Ext.more]: <\n      data: \"baz\"\n    >\n  >\n>\nmany_things: <\n  [type.googleapis.com/testdata.MyMessage]: <\n    count: 47\n    name: \"David\"\n    [testdata.Ext.more]: <\n      data: \"foo\"\n    >\n    [testdata.Ext.text]: \"bar\"\n  >\n>\n`\n\t)\n\treturn []golden{\n\t\t{m1, strings.TrimSpace(m1Golden) + \"\\n\", strings.TrimSpace(compact(m1Golden)) + \" \"},\n\t\t{m2, strings.TrimSpace(m2Golden) + \"\\n\", strings.TrimSpace(compact(m2Golden)) + \" \"},\n\t\t{m3, strings.TrimSpace(m3Golden) + \"\\n\", strings.TrimSpace(compact(m3Golden)) + \" \"},\n\t\t{m4, strings.TrimSpace(m4Golden) + \"\\n\", strings.TrimSpace(compact(m4Golden)) + \" \"},\n\t\t{m5, strings.TrimSpace(m5Golden) + \"\\n\", strings.TrimSpace(compact(m5Golden)) + \" \"},\n\t\t{m6, strings.TrimSpace(m6Golden) + \"\\n\", strings.TrimSpace(compact(m6Golden)) + \" \"},\n\t}\n}\n\nfunc TestMarshalGolden(t *testing.T) {\n\tfor _, tt := range goldenMessages {\n\t\tif got, want := expandedMarshaler.Text(tt.m), tt.t; got != want {\n\t\t\tt.Errorf(\"message %v: got:\\n%s\\nwant:\\n%s\", tt.m, got, want)\n\t\t}\n\t\tif got, want := expandedCompactMarshaler.Text(tt.m), tt.c; got != want {\n\t\t\tt.Errorf(\"message %v: got:\\n`%s`\\nwant:\\n`%s`\", tt.m, got, want)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalGolden(t *testing.T) {\n\tfor _, tt := range goldenMessages {\n\t\twant := tt.m\n\t\tgot := proto.Clone(tt.m)\n\t\tgot.Reset()\n\t\tif err := proto.UnmarshalText(tt.t, got); err != nil {\n\t\t\tt.Errorf(\"failed to unmarshal\\n%s\\nerror: %v\", tt.t, err)\n\t\t}\n\t\tif !anyEqual(got, want) {\n\t\t\tt.Errorf(\"message:\\n%s\\ngot:\\n%s\\nwant:\\n%s\", tt.t, got, want)\n\t\t}\n\t\tgot.Reset()\n\t\tif err := proto.UnmarshalText(tt.c, got); err != nil {\n\t\t\tt.Errorf(\"failed to unmarshal\\n%s\\nerror: %v\", tt.c, err)\n\t\t}\n\t\tif !anyEqual(got, want) {\n\t\t\tt.Errorf(\"message:\\n%s\\ngot:\\n%s\\nwant:\\n%s\", tt.c, got, want)\n\t\t}\n\t}\n}\n\nfunc TestMarshalUnknownAny(t *testing.T) {\n\tm := &pb.Message{\n\t\tAnything: &anypb.Any{\n\t\t\tTypeUrl: \"foo\",\n\t\t\tValue:   []byte(\"bar\"),\n\t\t},\n\t}\n\twant := `anything: <\n  type_url: \"foo\"\n  value: \"bar\"\n>\n`\n\tgot := expandedMarshaler.Text(m)\n\tif got != want {\n\t\tt.Errorf(\"got\\n`%s`\\nwant\\n`%s`\", got, want)\n\t}\n}\n\nfunc TestAmbiguousAny(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n\ttype_url: \"ttt/proto3_proto.Nested\"\n\tvalue: \"\\n\\x05Monty\"\n\t`, pb)\n\tt.Logf(\"result: %v (error: %v)\", expandedMarshaler.Text(pb), err)\n\tif err != nil {\n\t\tt.Errorf(\"failed to parse ambiguous Any message: %v\", err)\n\t}\n}\n\nfunc TestUnmarshalOverwriteAny(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n  [type.googleapis.com/a/path/proto3_proto.Nested]: <\n    bunny: \"Monty\"\n  >\n  [type.googleapis.com/a/path/proto3_proto.Nested]: <\n    bunny: \"Rabbit of Caerbannog\"\n  >\n\t`, pb)\n\twant := `line 7: Any message unpacked multiple times, or \"type_url\" already set`\n\tif err.Error() != want {\n\t\tt.Errorf(\"incorrect error.\\nHave: %v\\nWant: %v\", err.Error(), want)\n\t}\n}\n\nfunc TestUnmarshalAnyMixAndMatch(t *testing.T) {\n\tpb := &anypb.Any{}\n\terr := proto.UnmarshalText(`\n\tvalue: \"\\n\\x05Monty\"\n  [type.googleapis.com/a/path/proto3_proto.Nested]: <\n    bunny: \"Rabbit of Caerbannog\"\n  >\n\t`, pb)\n\twant := `line 5: Any message unpacked multiple times, or \"value\" already set`\n\tif err.Error() != want {\n\t\tt.Errorf(\"incorrect error.\\nHave: %v\\nWant: %v\", err.Error(), want)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/clone.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Protocol buffer deep copy and merge.\n// TODO: RawMessage.\n\npackage proto\n\nimport (\n\t\"log\"\n\t\"reflect\"\n\t\"strings\"\n)\n\n// Clone returns a deep copy of a protocol buffer.\nfunc Clone(pb Message) Message {\n\tin := reflect.ValueOf(pb)\n\tif in.IsNil() {\n\t\treturn pb\n\t}\n\n\tout := reflect.New(in.Type().Elem())\n\t// out is empty so a merge is a deep copy.\n\tmergeStruct(out.Elem(), in.Elem())\n\treturn out.Interface().(Message)\n}\n\n// Merge merges src into dst.\n// Required and optional fields that are set in src will be set to that value in dst.\n// Elements of repeated fields will be appended.\n// Merge panics if src and dst are not the same type, or if dst is nil.\nfunc Merge(dst, src Message) {\n\tin := reflect.ValueOf(src)\n\tout := reflect.ValueOf(dst)\n\tif out.IsNil() {\n\t\tpanic(\"proto: nil destination\")\n\t}\n\tif in.Type() != out.Type() {\n\t\t// Explicit test prior to mergeStruct so that mistyped nils will fail\n\t\tpanic(\"proto: type mismatch\")\n\t}\n\tif in.IsNil() {\n\t\t// Merging nil into non-nil is a quiet no-op\n\t\treturn\n\t}\n\tmergeStruct(out.Elem(), in.Elem())\n}\n\nfunc mergeStruct(out, in reflect.Value) {\n\tsprop := GetProperties(in.Type())\n\tfor i := 0; i < in.NumField(); i++ {\n\t\tf := in.Type().Field(i)\n\t\tif strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\t\tmergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])\n\t}\n\n\tif emIn, ok := extendable(in.Addr().Interface()); ok {\n\t\temOut, _ := extendable(out.Addr().Interface())\n\t\tmIn, muIn := emIn.extensionsRead()\n\t\tif mIn != nil {\n\t\t\tmOut := emOut.extensionsWrite()\n\t\t\tmuIn.Lock()\n\t\t\tmergeExtension(mOut, mIn)\n\t\t\tmuIn.Unlock()\n\t\t}\n\t}\n\n\tuf := in.FieldByName(\"XXX_unrecognized\")\n\tif !uf.IsValid() {\n\t\treturn\n\t}\n\tuin := uf.Bytes()\n\tif len(uin) > 0 {\n\t\tout.FieldByName(\"XXX_unrecognized\").SetBytes(append([]byte(nil), uin...))\n\t}\n}\n\n// mergeAny performs a merge between two values of the same type.\n// viaPtr indicates whether the values were indirected through a pointer (implying proto2).\n// prop is set if this is a struct field (it may be nil).\nfunc mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {\n\tif in.Type() == protoMessageType {\n\t\tif !in.IsNil() {\n\t\t\tif out.IsNil() {\n\t\t\t\tout.Set(reflect.ValueOf(Clone(in.Interface().(Message))))\n\t\t\t} else {\n\t\t\t\tMerge(out.Interface().(Message), in.Interface().(Message))\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tswitch in.Kind() {\n\tcase reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,\n\t\treflect.String, reflect.Uint32, reflect.Uint64:\n\t\tif !viaPtr && isProto3Zero(in) {\n\t\t\treturn\n\t\t}\n\t\tout.Set(in)\n\tcase reflect.Interface:\n\t\t// Probably a oneof field; copy non-nil values.\n\t\tif in.IsNil() {\n\t\t\treturn\n\t\t}\n\t\t// Allocate destination if it is not set, or set to a different type.\n\t\t// Otherwise we will merge as normal.\n\t\tif out.IsNil() || out.Elem().Type() != in.Elem().Type() {\n\t\t\tout.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)\n\t\t}\n\t\tmergeAny(out.Elem(), in.Elem(), false, nil)\n\tcase reflect.Map:\n\t\tif in.Len() == 0 {\n\t\t\treturn\n\t\t}\n\t\tif out.IsNil() {\n\t\t\tout.Set(reflect.MakeMap(in.Type()))\n\t\t}\n\t\t// For maps with value types of *T or []byte we need to deep copy each value.\n\t\telemKind := in.Type().Elem().Kind()\n\t\tfor _, key := range in.MapKeys() {\n\t\t\tvar val reflect.Value\n\t\t\tswitch elemKind {\n\t\t\tcase reflect.Ptr:\n\t\t\t\tval = reflect.New(in.Type().Elem().Elem())\n\t\t\t\tmergeAny(val, in.MapIndex(key), false, nil)\n\t\t\tcase reflect.Slice:\n\t\t\t\tval = in.MapIndex(key)\n\t\t\t\tval = reflect.ValueOf(append([]byte{}, val.Bytes()...))\n\t\t\tdefault:\n\t\t\t\tval = in.MapIndex(key)\n\t\t\t}\n\t\t\tout.SetMapIndex(key, val)\n\t\t}\n\tcase reflect.Ptr:\n\t\tif in.IsNil() {\n\t\t\treturn\n\t\t}\n\t\tif out.IsNil() {\n\t\t\tout.Set(reflect.New(in.Elem().Type()))\n\t\t}\n\t\tmergeAny(out.Elem(), in.Elem(), true, nil)\n\tcase reflect.Slice:\n\t\tif in.IsNil() {\n\t\t\treturn\n\t\t}\n\t\tif in.Type().Elem().Kind() == reflect.Uint8 {\n\t\t\t// []byte is a scalar bytes field, not a repeated field.\n\n\t\t\t// Edge case: if this is in a proto3 message, a zero length\n\t\t\t// bytes field is considered the zero value, and should not\n\t\t\t// be merged.\n\t\t\tif prop != nil && prop.proto3 && in.Len() == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Make a deep copy.\n\t\t\t// Append to []byte{} instead of []byte(nil) so that we never end up\n\t\t\t// with a nil result.\n\t\t\tout.SetBytes(append([]byte{}, in.Bytes()...))\n\t\t\treturn\n\t\t}\n\t\tn := in.Len()\n\t\tif out.IsNil() {\n\t\t\tout.Set(reflect.MakeSlice(in.Type(), 0, n))\n\t\t}\n\t\tswitch in.Type().Elem().Kind() {\n\t\tcase reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,\n\t\t\treflect.String, reflect.Uint32, reflect.Uint64:\n\t\t\tout.Set(reflect.AppendSlice(out, in))\n\t\tdefault:\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tx := reflect.Indirect(reflect.New(in.Type().Elem()))\n\t\t\t\tmergeAny(x, in.Index(i), false, nil)\n\t\t\t\tout.Set(reflect.Append(out, x))\n\t\t\t}\n\t\t}\n\tcase reflect.Struct:\n\t\tmergeStruct(out, in)\n\tdefault:\n\t\t// unknown type, so not a protocol buffer\n\t\tlog.Printf(\"proto: don't know how to copy %v\", in)\n\t}\n}\n\nfunc mergeExtension(out, in map[int32]Extension) {\n\tfor extNum, eIn := range in {\n\t\teOut := Extension{desc: eIn.desc}\n\t\tif eIn.value != nil {\n\t\t\tv := reflect.New(reflect.TypeOf(eIn.value)).Elem()\n\t\t\tmergeAny(v, reflect.ValueOf(eIn.value), false, nil)\n\t\t\teOut.value = v.Interface()\n\t\t}\n\t\tif eIn.enc != nil {\n\t\t\teOut.enc = make([]byte, len(eIn.enc))\n\t\t\tcopy(eOut.enc, eIn.enc)\n\t\t}\n\n\t\tout[extNum] = eOut\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/clone_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\tpb \"github.com/golang/protobuf/proto/testdata\"\n)\n\nvar cloneTestMessage = &pb.MyMessage{\n\tCount: proto.Int32(42),\n\tName:  proto.String(\"Dave\"),\n\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\tInner: &pb.InnerMessage{\n\t\tHost:      proto.String(\"niles\"),\n\t\tPort:      proto.Int32(9099),\n\t\tConnected: proto.Bool(true),\n\t},\n\tOthers: []*pb.OtherMessage{\n\t\t{\n\t\t\tValue: []byte(\"some bytes\"),\n\t\t},\n\t},\n\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\tGroupField: proto.Int32(6),\n\t},\n\tRepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")},\n}\n\nfunc init() {\n\text := &pb.Ext{\n\t\tData: proto.String(\"extension\"),\n\t}\n\tif err := proto.SetExtension(cloneTestMessage, pb.E_Ext_More, ext); err != nil {\n\t\tpanic(\"SetExtension: \" + err.Error())\n\t}\n}\n\nfunc TestClone(t *testing.T) {\n\tm := proto.Clone(cloneTestMessage).(*pb.MyMessage)\n\tif !proto.Equal(m, cloneTestMessage) {\n\t\tt.Errorf(\"Clone(%v) = %v\", cloneTestMessage, m)\n\t}\n\n\t// Verify it was a deep copy.\n\t*m.Inner.Port++\n\tif proto.Equal(m, cloneTestMessage) {\n\t\tt.Error(\"Mutating clone changed the original\")\n\t}\n\t// Byte fields and repeated fields should be copied.\n\tif &m.Pet[0] == &cloneTestMessage.Pet[0] {\n\t\tt.Error(\"Pet: repeated field not copied\")\n\t}\n\tif &m.Others[0] == &cloneTestMessage.Others[0] {\n\t\tt.Error(\"Others: repeated field not copied\")\n\t}\n\tif &m.Others[0].Value[0] == &cloneTestMessage.Others[0].Value[0] {\n\t\tt.Error(\"Others[0].Value: bytes field not copied\")\n\t}\n\tif &m.RepBytes[0] == &cloneTestMessage.RepBytes[0] {\n\t\tt.Error(\"RepBytes: repeated field not copied\")\n\t}\n\tif &m.RepBytes[0][0] == &cloneTestMessage.RepBytes[0][0] {\n\t\tt.Error(\"RepBytes[0]: bytes field not copied\")\n\t}\n}\n\nfunc TestCloneNil(t *testing.T) {\n\tvar m *pb.MyMessage\n\tif c := proto.Clone(m); !proto.Equal(m, c) {\n\t\tt.Errorf(\"Clone(%v) = %v\", m, c)\n\t}\n}\n\nvar mergeTests = []struct {\n\tsrc, dst, want proto.Message\n}{\n\t{\n\t\tsrc: &pb.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t},\n\t\tdst: &pb.MyMessage{\n\t\t\tName: proto.String(\"Dave\"),\n\t\t},\n\t\twant: &pb.MyMessage{\n\t\t\tCount: proto.Int32(42),\n\t\t\tName:  proto.String(\"Dave\"),\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb.MyMessage{\n\t\t\tInner: &pb.InnerMessage{\n\t\t\t\tHost:      proto.String(\"hey\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t},\n\t\t\tPet: []string{\"horsey\"},\n\t\t\tOthers: []*pb.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tValue: []byte(\"some bytes\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tdst: &pb.MyMessage{\n\t\t\tInner: &pb.InnerMessage{\n\t\t\t\tHost: proto.String(\"niles\"),\n\t\t\t\tPort: proto.Int32(9099),\n\t\t\t},\n\t\t\tPet: []string{\"bunny\", \"kitty\"},\n\t\t\tOthers: []*pb.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey: proto.Int64(31415926535),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// Explicitly test a src=nil field\n\t\t\t\t\tInner: nil,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\twant: &pb.MyMessage{\n\t\t\tInner: &pb.InnerMessage{\n\t\t\t\tHost:      proto.String(\"hey\"),\n\t\t\t\tConnected: proto.Bool(true),\n\t\t\t\tPort:      proto.Int32(9099),\n\t\t\t},\n\t\t\tPet: []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\t\tOthers: []*pb.OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey: proto.Int64(31415926535),\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t\t{\n\t\t\t\t\tValue: []byte(\"some bytes\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tsrc: &pb.MyMessage{\n\t\t\tRepBytes: [][]byte{[]byte(\"wow\")},\n\t\t},\n\t\tdst: &pb.MyMessage{\n\t\t\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(6),\n\t\t\t},\n\t\t\tRepBytes: [][]byte{[]byte(\"sham\")},\n\t\t},\n\t\twant: &pb.MyMessage{\n\t\t\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\t\t\tGroupField: proto.Int32(6),\n\t\t\t},\n\t\t\tRepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")},\n\t\t},\n\t},\n\t// Check that a scalar bytes field replaces rather than appends.\n\t{\n\t\tsrc:  &pb.OtherMessage{Value: []byte(\"foo\")},\n\t\tdst:  &pb.OtherMessage{Value: []byte(\"bar\")},\n\t\twant: &pb.OtherMessage{Value: []byte(\"foo\")},\n\t},\n\t{\n\t\tsrc: &pb.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{6: \"Nigel\"},\n\t\t\tMsgMapping: map[int64]*pb.FloatingPoint{\n\t\t\t\t0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)},\n\t\t\t\t0x4002: &pb.FloatingPoint{\n\t\t\t\t\tF: proto.Float64(2.0),\n\t\t\t\t},\n\t\t\t},\n\t\t\tByteMapping: map[bool][]byte{true: []byte(\"wowsa\")},\n\t\t},\n\t\tdst: &pb.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{\n\t\t\t\t6: \"Bruce\", // should be overwritten\n\t\t\t\t7: \"Andrew\",\n\t\t\t},\n\t\t\tMsgMapping: map[int64]*pb.FloatingPoint{\n\t\t\t\t0x4002: &pb.FloatingPoint{\n\t\t\t\t\tF:     proto.Float64(3.0),\n\t\t\t\t\tExact: proto.Bool(true),\n\t\t\t\t}, // the entire message should be overwritten\n\t\t\t},\n\t\t},\n\t\twant: &pb.MessageWithMap{\n\t\t\tNameMapping: map[int32]string{\n\t\t\t\t6: \"Nigel\",\n\t\t\t\t7: \"Andrew\",\n\t\t\t},\n\t\t\tMsgMapping: map[int64]*pb.FloatingPoint{\n\t\t\t\t0x4001: &pb.FloatingPoint{F: proto.Float64(2.0)},\n\t\t\t\t0x4002: &pb.FloatingPoint{\n\t\t\t\t\tF: proto.Float64(2.0),\n\t\t\t\t},\n\t\t\t},\n\t\t\tByteMapping: map[bool][]byte{true: []byte(\"wowsa\")},\n\t\t},\n\t},\n\t// proto3 shouldn't merge zero values,\n\t// in the same way that proto2 shouldn't merge nils.\n\t{\n\t\tsrc: &proto3pb.Message{\n\t\t\tName: \"Aaron\",\n\t\t\tData: []byte(\"\"), // zero value, but not nil\n\t\t},\n\t\tdst: &proto3pb.Message{\n\t\t\tHeightInCm: 176,\n\t\t\tData:       []byte(\"texas!\"),\n\t\t},\n\t\twant: &proto3pb.Message{\n\t\t\tName:       \"Aaron\",\n\t\t\tHeightInCm: 176,\n\t\t\tData:       []byte(\"texas!\"),\n\t\t},\n\t},\n\t// Oneof fields should merge by assignment.\n\t{\n\t\tsrc: &pb.Communique{\n\t\t\tUnion: &pb.Communique_Number{41},\n\t\t},\n\t\tdst: &pb.Communique{\n\t\t\tUnion: &pb.Communique_Name{\"Bobby Tables\"},\n\t\t},\n\t\twant: &pb.Communique{\n\t\t\tUnion: &pb.Communique_Number{41},\n\t\t},\n\t},\n\t// Oneof nil is the same as not set.\n\t{\n\t\tsrc: &pb.Communique{},\n\t\tdst: &pb.Communique{\n\t\t\tUnion: &pb.Communique_Name{\"Bobby Tables\"},\n\t\t},\n\t\twant: &pb.Communique{\n\t\t\tUnion: &pb.Communique_Name{\"Bobby Tables\"},\n\t\t},\n\t},\n\t{\n\t\tsrc: &proto3pb.Message{\n\t\t\tTerrain: map[string]*proto3pb.Nested{\n\t\t\t\t\"kay_a\": &proto3pb.Nested{Cute: true},      // replace\n\t\t\t\t\"kay_b\": &proto3pb.Nested{Bunny: \"rabbit\"}, // insert\n\t\t\t},\n\t\t},\n\t\tdst: &proto3pb.Message{\n\t\t\tTerrain: map[string]*proto3pb.Nested{\n\t\t\t\t\"kay_a\": &proto3pb.Nested{Bunny: \"lost\"},  // replaced\n\t\t\t\t\"kay_c\": &proto3pb.Nested{Bunny: \"bunny\"}, // keep\n\t\t\t},\n\t\t},\n\t\twant: &proto3pb.Message{\n\t\t\tTerrain: map[string]*proto3pb.Nested{\n\t\t\t\t\"kay_a\": &proto3pb.Nested{Cute: true},\n\t\t\t\t\"kay_b\": &proto3pb.Nested{Bunny: \"rabbit\"},\n\t\t\t\t\"kay_c\": &proto3pb.Nested{Bunny: \"bunny\"},\n\t\t\t},\n\t\t},\n\t},\n}\n\nfunc TestMerge(t *testing.T) {\n\tfor _, m := range mergeTests {\n\t\tgot := proto.Clone(m.dst)\n\t\tproto.Merge(got, m.src)\n\t\tif !proto.Equal(got, m.want) {\n\t\t\tt.Errorf(\"Merge(%v, %v)\\n got %v\\nwant %v\\n\", m.dst, m.src, got, m.want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/decode.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n/*\n * Routines for decoding protocol buffer data to construct in-memory representations.\n */\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n)\n\n// errOverflow is returned when an integer is too large to be represented.\nvar errOverflow = errors.New(\"proto: integer overflow\")\n\n// ErrInternalBadWireType is returned by generated code when an incorrect\n// wire type is encountered. It does not get returned to user code.\nvar ErrInternalBadWireType = errors.New(\"proto: internal error: bad wiretype for oneof\")\n\n// The fundamental decoders that interpret bytes on the wire.\n// Those that take integer types all return uint64 and are\n// therefore of type valueDecoder.\n\n// DecodeVarint reads a varint-encoded integer from the slice.\n// It returns the integer and the number of bytes consumed, or\n// zero if there is not enough.\n// This is the format for the\n// int32, int64, uint32, uint64, bool, and enum\n// protocol buffer types.\nfunc DecodeVarint(buf []byte) (x uint64, n int) {\n\tfor shift := uint(0); shift < 64; shift += 7 {\n\t\tif n >= len(buf) {\n\t\t\treturn 0, 0\n\t\t}\n\t\tb := uint64(buf[n])\n\t\tn++\n\t\tx |= (b & 0x7F) << shift\n\t\tif (b & 0x80) == 0 {\n\t\t\treturn x, n\n\t\t}\n\t}\n\n\t// The number is too large to represent in a 64-bit value.\n\treturn 0, 0\n}\n\nfunc (p *Buffer) decodeVarintSlow() (x uint64, err error) {\n\ti := p.index\n\tl := len(p.buf)\n\n\tfor shift := uint(0); shift < 64; shift += 7 {\n\t\tif i >= l {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t\treturn\n\t\t}\n\t\tb := p.buf[i]\n\t\ti++\n\t\tx |= (uint64(b) & 0x7F) << shift\n\t\tif b < 0x80 {\n\t\t\tp.index = i\n\t\t\treturn\n\t\t}\n\t}\n\n\t// The number is too large to represent in a 64-bit value.\n\terr = errOverflow\n\treturn\n}\n\n// DecodeVarint reads a varint-encoded integer from the Buffer.\n// This is the format for the\n// int32, int64, uint32, uint64, bool, and enum\n// protocol buffer types.\nfunc (p *Buffer) DecodeVarint() (x uint64, err error) {\n\ti := p.index\n\tbuf := p.buf\n\n\tif i >= len(buf) {\n\t\treturn 0, io.ErrUnexpectedEOF\n\t} else if buf[i] < 0x80 {\n\t\tp.index++\n\t\treturn uint64(buf[i]), nil\n\t} else if len(buf)-i < 10 {\n\t\treturn p.decodeVarintSlow()\n\t}\n\n\tvar b uint64\n\t// we already checked the first byte\n\tx = uint64(buf[i]) - 0x80\n\ti++\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 7\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 7\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 14\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 14\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 21\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 21\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 28\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 28\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 35\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 35\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 42\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 42\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 49\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 49\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 56\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\tx -= 0x80 << 56\n\n\tb = uint64(buf[i])\n\ti++\n\tx += b << 63\n\tif b&0x80 == 0 {\n\t\tgoto done\n\t}\n\t// x -= 0x80 << 63 // Always zero.\n\n\treturn 0, errOverflow\n\ndone:\n\tp.index = i\n\treturn x, nil\n}\n\n// DecodeFixed64 reads a 64-bit integer from the Buffer.\n// This is the format for the\n// fixed64, sfixed64, and double protocol buffer types.\nfunc (p *Buffer) DecodeFixed64() (x uint64, err error) {\n\t// x, err already 0\n\ti := p.index + 8\n\tif i < 0 || i > len(p.buf) {\n\t\terr = io.ErrUnexpectedEOF\n\t\treturn\n\t}\n\tp.index = i\n\n\tx = uint64(p.buf[i-8])\n\tx |= uint64(p.buf[i-7]) << 8\n\tx |= uint64(p.buf[i-6]) << 16\n\tx |= uint64(p.buf[i-5]) << 24\n\tx |= uint64(p.buf[i-4]) << 32\n\tx |= uint64(p.buf[i-3]) << 40\n\tx |= uint64(p.buf[i-2]) << 48\n\tx |= uint64(p.buf[i-1]) << 56\n\treturn\n}\n\n// DecodeFixed32 reads a 32-bit integer from the Buffer.\n// This is the format for the\n// fixed32, sfixed32, and float protocol buffer types.\nfunc (p *Buffer) DecodeFixed32() (x uint64, err error) {\n\t// x, err already 0\n\ti := p.index + 4\n\tif i < 0 || i > len(p.buf) {\n\t\terr = io.ErrUnexpectedEOF\n\t\treturn\n\t}\n\tp.index = i\n\n\tx = uint64(p.buf[i-4])\n\tx |= uint64(p.buf[i-3]) << 8\n\tx |= uint64(p.buf[i-2]) << 16\n\tx |= uint64(p.buf[i-1]) << 24\n\treturn\n}\n\n// DecodeZigzag64 reads a zigzag-encoded 64-bit integer\n// from the Buffer.\n// This is the format used for the sint64 protocol buffer type.\nfunc (p *Buffer) DecodeZigzag64() (x uint64, err error) {\n\tx, err = p.DecodeVarint()\n\tif err != nil {\n\t\treturn\n\t}\n\tx = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)\n\treturn\n}\n\n// DecodeZigzag32 reads a zigzag-encoded 32-bit integer\n// from  the Buffer.\n// This is the format used for the sint32 protocol buffer type.\nfunc (p *Buffer) DecodeZigzag32() (x uint64, err error) {\n\tx, err = p.DecodeVarint()\n\tif err != nil {\n\t\treturn\n\t}\n\tx = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))\n\treturn\n}\n\n// These are not ValueDecoders: they produce an array of bytes or a string.\n// bytes, embedded messages\n\n// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.\n// This is the format used for the bytes protocol buffer\n// type and for embedded messages.\nfunc (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {\n\tn, err := p.DecodeVarint()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnb := int(n)\n\tif nb < 0 {\n\t\treturn nil, fmt.Errorf(\"proto: bad byte length %d\", nb)\n\t}\n\tend := p.index + nb\n\tif end < p.index || end > len(p.buf) {\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\n\tif !alloc {\n\t\t// todo: check if can get more uses of alloc=false\n\t\tbuf = p.buf[p.index:end]\n\t\tp.index += nb\n\t\treturn\n\t}\n\n\tbuf = make([]byte, nb)\n\tcopy(buf, p.buf[p.index:])\n\tp.index += nb\n\treturn\n}\n\n// DecodeStringBytes reads an encoded string from the Buffer.\n// This is the format used for the proto2 string type.\nfunc (p *Buffer) DecodeStringBytes() (s string, err error) {\n\tbuf, err := p.DecodeRawBytes(false)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn string(buf), nil\n}\n\n// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.\n// If the protocol buffer has extensions, and the field matches, add it as an extension.\n// Otherwise, if the XXX_unrecognized field exists, append the skipped data there.\nfunc (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error {\n\toi := o.index\n\n\terr := o.skip(t, tag, wire)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !unrecField.IsValid() {\n\t\treturn nil\n\t}\n\n\tptr := structPointer_Bytes(base, unrecField)\n\n\t// Add the skipped field to struct field\n\tobuf := o.buf\n\n\to.buf = *ptr\n\to.EncodeVarint(uint64(tag<<3 | wire))\n\t*ptr = append(o.buf, obuf[oi:o.index]...)\n\n\to.buf = obuf\n\n\treturn nil\n}\n\n// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.\nfunc (o *Buffer) skip(t reflect.Type, tag, wire int) error {\n\n\tvar u uint64\n\tvar err error\n\n\tswitch wire {\n\tcase WireVarint:\n\t\t_, err = o.DecodeVarint()\n\tcase WireFixed64:\n\t\t_, err = o.DecodeFixed64()\n\tcase WireBytes:\n\t\t_, err = o.DecodeRawBytes(false)\n\tcase WireFixed32:\n\t\t_, err = o.DecodeFixed32()\n\tcase WireStartGroup:\n\t\tfor {\n\t\t\tu, err = o.DecodeVarint()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfwire := int(u & 0x7)\n\t\t\tif fwire == WireEndGroup {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tftag := int(u >> 3)\n\t\t\terr = o.skip(t, ftag, fwire)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\tdefault:\n\t\terr = fmt.Errorf(\"proto: can't skip unknown wire type %d for %s\", wire, t)\n\t}\n\treturn err\n}\n\n// Unmarshaler is the interface representing objects that can\n// unmarshal themselves.  The method should reset the receiver before\n// decoding starts.  The argument points to data that may be\n// overwritten, so implementations should not keep references to the\n// buffer.\ntype Unmarshaler interface {\n\tUnmarshal([]byte) error\n}\n\n// Unmarshal parses the protocol buffer representation in buf and places the\n// decoded result in pb.  If the struct underlying pb does not match\n// the data in buf, the results can be unpredictable.\n//\n// Unmarshal resets pb before starting to unmarshal, so any\n// existing data in pb is always removed. Use UnmarshalMerge\n// to preserve and append to existing data.\nfunc Unmarshal(buf []byte, pb Message) error {\n\tpb.Reset()\n\treturn UnmarshalMerge(buf, pb)\n}\n\n// UnmarshalMerge parses the protocol buffer representation in buf and\n// writes the decoded result to pb.  If the struct underlying pb does not match\n// the data in buf, the results can be unpredictable.\n//\n// UnmarshalMerge merges into existing data in pb.\n// Most code should use Unmarshal instead.\nfunc UnmarshalMerge(buf []byte, pb Message) error {\n\t// If the object can unmarshal itself, let it.\n\tif u, ok := pb.(Unmarshaler); ok {\n\t\treturn u.Unmarshal(buf)\n\t}\n\treturn NewBuffer(buf).Unmarshal(pb)\n}\n\n// DecodeMessage reads a count-delimited message from the Buffer.\nfunc (p *Buffer) DecodeMessage(pb Message) error {\n\tenc, err := p.DecodeRawBytes(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn NewBuffer(enc).Unmarshal(pb)\n}\n\n// DecodeGroup reads a tag-delimited group from the Buffer.\nfunc (p *Buffer) DecodeGroup(pb Message) error {\n\ttyp, base, err := getbase(pb)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base)\n}\n\n// Unmarshal parses the protocol buffer representation in the\n// Buffer and places the decoded result in pb.  If the struct\n// underlying pb does not match the data in the buffer, the results can be\n// unpredictable.\n//\n// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.\nfunc (p *Buffer) Unmarshal(pb Message) error {\n\t// If the object can unmarshal itself, let it.\n\tif u, ok := pb.(Unmarshaler); ok {\n\t\terr := u.Unmarshal(p.buf[p.index:])\n\t\tp.index = len(p.buf)\n\t\treturn err\n\t}\n\n\ttyp, base, err := getbase(pb)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base)\n\n\tif collectStats {\n\t\tstats.Decode++\n\t}\n\n\treturn err\n}\n\n// unmarshalType does the work of unmarshaling a structure.\nfunc (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error {\n\tvar state errorState\n\trequired, reqFields := prop.reqCount, uint64(0)\n\n\tvar err error\n\tfor err == nil && o.index < len(o.buf) {\n\t\toi := o.index\n\t\tvar u uint64\n\t\tu, err = o.DecodeVarint()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\twire := int(u & 0x7)\n\t\tif wire == WireEndGroup {\n\t\t\tif is_group {\n\t\t\t\tif required > 0 {\n\t\t\t\t\t// Not enough information to determine the exact field.\n\t\t\t\t\t// (See below.)\n\t\t\t\t\treturn &RequiredNotSetError{\"{Unknown}\"}\n\t\t\t\t}\n\t\t\t\treturn nil // input is satisfied\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"proto: %s: wiretype end group for non-group\", st)\n\t\t}\n\t\ttag := int(u >> 3)\n\t\tif tag <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: %s: illegal tag %d (wire type %d)\", st, tag, wire)\n\t\t}\n\t\tfieldnum, ok := prop.decoderTags.get(tag)\n\t\tif !ok {\n\t\t\t// Maybe it's an extension?\n\t\t\tif prop.extendable {\n\t\t\t\tif e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) {\n\t\t\t\t\tif err = o.skip(st, tag, wire); err == nil {\n\t\t\t\t\t\textmap := e.extensionsWrite()\n\t\t\t\t\t\text := extmap[int32(tag)] // may be missing\n\t\t\t\t\t\text.enc = append(ext.enc, o.buf[oi:o.index]...)\n\t\t\t\t\t\textmap[int32(tag)] = ext\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Maybe it's a oneof?\n\t\t\tif prop.oneofUnmarshaler != nil {\n\t\t\t\tm := structPointer_Interface(base, st).(Message)\n\t\t\t\t// First return value indicates whether tag is a oneof field.\n\t\t\t\tok, err = prop.oneofUnmarshaler(m, tag, wire, o)\n\t\t\t\tif err == ErrInternalBadWireType {\n\t\t\t\t\t// Map the error to something more descriptive.\n\t\t\t\t\t// Do the formatting here to save generated code space.\n\t\t\t\t\terr = fmt.Errorf(\"bad wiretype for oneof field in %T\", m)\n\t\t\t\t}\n\t\t\t\tif ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = o.skipAndSave(st, tag, wire, base, prop.unrecField)\n\t\t\tcontinue\n\t\t}\n\t\tp := prop.Prop[fieldnum]\n\n\t\tif p.dec == nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"proto: no protobuf decoder for %s.%s\\n\", st, st.Field(fieldnum).Name)\n\t\t\tcontinue\n\t\t}\n\t\tdec := p.dec\n\t\tif wire != WireStartGroup && wire != p.WireType {\n\t\t\tif wire == WireBytes && p.packedDec != nil {\n\t\t\t\t// a packable field\n\t\t\t\tdec = p.packedDec\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"proto: bad wiretype for field %s.%s: got wiretype %d, want %d\", st, st.Field(fieldnum).Name, wire, p.WireType)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tdecErr := dec(o, p, base)\n\t\tif decErr != nil && !state.shouldContinue(decErr, p) {\n\t\t\terr = decErr\n\t\t}\n\t\tif err == nil && p.Required {\n\t\t\t// Successfully decoded a required field.\n\t\t\tif tag <= 64 {\n\t\t\t\t// use bitmap for fields 1-64 to catch field reuse.\n\t\t\t\tvar mask uint64 = 1 << uint64(tag-1)\n\t\t\t\tif reqFields&mask == 0 {\n\t\t\t\t\t// new required field\n\t\t\t\t\treqFields |= mask\n\t\t\t\t\trequired--\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// This is imprecise. It can be fooled by a required field\n\t\t\t\t// with a tag > 64 that is encoded twice; that's very rare.\n\t\t\t\t// A fully correct implementation would require allocating\n\t\t\t\t// a data structure, which we would like to avoid.\n\t\t\t\trequired--\n\t\t\t}\n\t\t}\n\t}\n\tif err == nil {\n\t\tif is_group {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t\tif state.err != nil {\n\t\t\treturn state.err\n\t\t}\n\t\tif required > 0 {\n\t\t\t// Not enough information to determine the exact field. If we use extra\n\t\t\t// CPU, we could determine the field only if the missing required field\n\t\t\t// has a tag <= 64 and we check reqFields.\n\t\t\treturn &RequiredNotSetError{\"{Unknown}\"}\n\t\t}\n\t}\n\treturn err\n}\n\n// Individual type decoders\n// For each,\n//\tu is the decoded value,\n//\tv is a pointer to the field (pointer) in the struct\n\n// Sizes of the pools to allocate inside the Buffer.\n// The goal is modest amortization and allocation\n// on at least 16-byte boundaries.\nconst (\n\tboolPoolSize   = 16\n\tuint32PoolSize = 8\n\tuint64PoolSize = 4\n)\n\n// Decode a bool.\nfunc (o *Buffer) dec_bool(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(o.bools) == 0 {\n\t\to.bools = make([]bool, boolPoolSize)\n\t}\n\to.bools[0] = u != 0\n\t*structPointer_Bool(base, p.field) = &o.bools[0]\n\to.bools = o.bools[1:]\n\treturn nil\n}\n\nfunc (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*structPointer_BoolVal(base, p.field) = u != 0\n\treturn nil\n}\n\n// Decode an int32.\nfunc (o *Buffer) dec_int32(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tword32_Set(structPointer_Word32(base, p.field), o, uint32(u))\n\treturn nil\n}\n\nfunc (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tword32Val_Set(structPointer_Word32Val(base, p.field), uint32(u))\n\treturn nil\n}\n\n// Decode an int64.\nfunc (o *Buffer) dec_int64(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tword64_Set(structPointer_Word64(base, p.field), o, u)\n\treturn nil\n}\n\nfunc (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tword64Val_Set(structPointer_Word64Val(base, p.field), o, u)\n\treturn nil\n}\n\n// Decode a string.\nfunc (o *Buffer) dec_string(p *Properties, base structPointer) error {\n\ts, err := o.DecodeStringBytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\t*structPointer_String(base, p.field) = &s\n\treturn nil\n}\n\nfunc (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error {\n\ts, err := o.DecodeStringBytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\t*structPointer_StringVal(base, p.field) = s\n\treturn nil\n}\n\n// Decode a slice of bytes ([]byte).\nfunc (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error {\n\tb, err := o.DecodeRawBytes(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*structPointer_Bytes(base, p.field) = b\n\treturn nil\n}\n\n// Decode a slice of bools ([]bool).\nfunc (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv := structPointer_BoolSlice(base, p.field)\n\t*v = append(*v, u != 0)\n\treturn nil\n}\n\n// Decode a slice of bools ([]bool) in packed format.\nfunc (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error {\n\tv := structPointer_BoolSlice(base, p.field)\n\n\tnn, err := o.DecodeVarint()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnb := int(nn) // number of bytes of encoded bools\n\tfin := o.index + nb\n\tif fin < o.index {\n\t\treturn errOverflow\n\t}\n\n\ty := *v\n\tfor o.index < fin {\n\t\tu, err := p.valDec(o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ty = append(y, u != 0)\n\t}\n\n\t*v = y\n\treturn nil\n}\n\n// Decode a slice of int32s ([]int32).\nfunc (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstructPointer_Word32Slice(base, p.field).Append(uint32(u))\n\treturn nil\n}\n\n// Decode a slice of int32s ([]int32) in packed format.\nfunc (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error {\n\tv := structPointer_Word32Slice(base, p.field)\n\n\tnn, err := o.DecodeVarint()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnb := int(nn) // number of bytes of encoded int32s\n\n\tfin := o.index + nb\n\tif fin < o.index {\n\t\treturn errOverflow\n\t}\n\tfor o.index < fin {\n\t\tu, err := p.valDec(o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.Append(uint32(u))\n\t}\n\treturn nil\n}\n\n// Decode a slice of int64s ([]int64).\nfunc (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error {\n\tu, err := p.valDec(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstructPointer_Word64Slice(base, p.field).Append(u)\n\treturn nil\n}\n\n// Decode a slice of int64s ([]int64) in packed format.\nfunc (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error {\n\tv := structPointer_Word64Slice(base, p.field)\n\n\tnn, err := o.DecodeVarint()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnb := int(nn) // number of bytes of encoded int64s\n\n\tfin := o.index + nb\n\tif fin < o.index {\n\t\treturn errOverflow\n\t}\n\tfor o.index < fin {\n\t\tu, err := p.valDec(o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.Append(u)\n\t}\n\treturn nil\n}\n\n// Decode a slice of strings ([]string).\nfunc (o *Buffer) dec_slice_string(p *Properties, base structPointer) error {\n\ts, err := o.DecodeStringBytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tv := structPointer_StringSlice(base, p.field)\n\t*v = append(*v, s)\n\treturn nil\n}\n\n// Decode a slice of slice of bytes ([][]byte).\nfunc (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error {\n\tb, err := o.DecodeRawBytes(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tv := structPointer_BytesSlice(base, p.field)\n\t*v = append(*v, b)\n\treturn nil\n}\n\n// Decode a map field.\nfunc (o *Buffer) dec_new_map(p *Properties, base structPointer) error {\n\traw, err := o.DecodeRawBytes(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\toi := o.index       // index at the end of this map entry\n\to.index -= len(raw) // move buffer back to start of map entry\n\n\tmptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V\n\tif mptr.Elem().IsNil() {\n\t\tmptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem()))\n\t}\n\tv := mptr.Elem() // map[K]V\n\n\t// Prepare addressable doubly-indirect placeholders for the key and value types.\n\t// See enc_new_map for why.\n\tkeyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K\n\tkeybase := toStructPointer(keyptr.Addr())                  // **K\n\n\tvar valbase structPointer\n\tvar valptr reflect.Value\n\tswitch p.mtype.Elem().Kind() {\n\tcase reflect.Slice:\n\t\t// []byte\n\t\tvar dummy []byte\n\t\tvalptr = reflect.ValueOf(&dummy)  // *[]byte\n\t\tvalbase = toStructPointer(valptr) // *[]byte\n\tcase reflect.Ptr:\n\t\t// message; valptr is **Msg; need to allocate the intermediate pointer\n\t\tvalptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V\n\t\tvalptr.Set(reflect.New(valptr.Type().Elem()))\n\t\tvalbase = toStructPointer(valptr)\n\tdefault:\n\t\t// everything else\n\t\tvalptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V\n\t\tvalbase = toStructPointer(valptr.Addr())                   // **V\n\t}\n\n\t// Decode.\n\t// This parses a restricted wire format, namely the encoding of a message\n\t// with two fields. See enc_new_map for the format.\n\tfor o.index < oi {\n\t\t// tagcode for key and value properties are always a single byte\n\t\t// because they have tags 1 and 2.\n\t\ttagcode := o.buf[o.index]\n\t\to.index++\n\t\tswitch tagcode {\n\t\tcase p.mkeyprop.tagcode[0]:\n\t\t\tif err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase p.mvalprop.tagcode[0]:\n\t\t\tif err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\t// TODO: Should we silently skip this instead?\n\t\t\treturn fmt.Errorf(\"proto: bad map data tag %d\", raw[0])\n\t\t}\n\t}\n\tkeyelem, valelem := keyptr.Elem(), valptr.Elem()\n\tif !keyelem.IsValid() {\n\t\tkeyelem = reflect.Zero(p.mtype.Key())\n\t}\n\tif !valelem.IsValid() {\n\t\tvalelem = reflect.Zero(p.mtype.Elem())\n\t}\n\n\tv.SetMapIndex(keyelem, valelem)\n\treturn nil\n}\n\n// Decode a group.\nfunc (o *Buffer) dec_struct_group(p *Properties, base structPointer) error {\n\tbas := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(bas) {\n\t\t// allocate new nested message\n\t\tbas = toStructPointer(reflect.New(p.stype))\n\t\tstructPointer_SetStructPointer(base, p.field, bas)\n\t}\n\treturn o.unmarshalType(p.stype, p.sprop, true, bas)\n}\n\n// Decode an embedded message.\nfunc (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) {\n\traw, e := o.DecodeRawBytes(false)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tbas := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(bas) {\n\t\t// allocate new nested message\n\t\tbas = toStructPointer(reflect.New(p.stype))\n\t\tstructPointer_SetStructPointer(base, p.field, bas)\n\t}\n\n\t// If the object can unmarshal itself, let it.\n\tif p.isUnmarshaler {\n\t\tiv := structPointer_Interface(bas, p.stype)\n\t\treturn iv.(Unmarshaler).Unmarshal(raw)\n\t}\n\n\tobuf := o.buf\n\toi := o.index\n\to.buf = raw\n\to.index = 0\n\n\terr = o.unmarshalType(p.stype, p.sprop, false, bas)\n\to.buf = obuf\n\to.index = oi\n\n\treturn err\n}\n\n// Decode a slice of embedded messages.\nfunc (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error {\n\treturn o.dec_slice_struct(p, false, base)\n}\n\n// Decode a slice of embedded groups.\nfunc (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error {\n\treturn o.dec_slice_struct(p, true, base)\n}\n\n// Decode a slice of structs ([]*struct).\nfunc (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error {\n\tv := reflect.New(p.stype)\n\tbas := toStructPointer(v)\n\tstructPointer_StructPointerSlice(base, p.field).Append(bas)\n\n\tif is_group {\n\t\terr := o.unmarshalType(p.stype, p.sprop, is_group, bas)\n\t\treturn err\n\t}\n\n\traw, err := o.DecodeRawBytes(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the object can unmarshal itself, let it.\n\tif p.isUnmarshaler {\n\t\tiv := v.Interface()\n\t\treturn iv.(Unmarshaler).Unmarshal(raw)\n\t}\n\n\tobuf := o.buf\n\toi := o.index\n\to.buf = raw\n\to.index = 0\n\n\terr = o.unmarshalType(p.stype, p.sprop, is_group, bas)\n\n\to.buf = obuf\n\to.index = oi\n\n\treturn err\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/decode_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build go1.7\n\npackage proto_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\ttpb \"github.com/golang/protobuf/proto/proto3_proto\"\n)\n\nvar (\n\tbytesBlackhole []byte\n\tmsgBlackhole   = new(tpb.Message)\n)\n\n// BenchmarkVarint32ArraySmall shows the performance on an array of small int32 fields (1 and\n// 2 bytes long).\nfunc BenchmarkVarint32ArraySmall(b *testing.B) {\n\tfor i := uint(1); i <= 10; i++ {\n\t\tdist := genInt32Dist([7]int{0, 3, 1}, 1<<i)\n\t\traw, err := proto.Marshal(&tpb.Message{\n\t\t\tShortKey: dist,\n\t\t})\n\t\tif err != nil {\n\t\t\tb.Error(\"wrong encode\", err)\n\t\t}\n\t\tb.Run(fmt.Sprintf(\"Len%v\", len(dist)), func(b *testing.B) {\n\t\t\tscratchBuf := proto.NewBuffer(nil)\n\t\t\tb.ResetTimer()\n\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\tscratchBuf.SetBuf(raw)\n\t\t\t\tmsgBlackhole.Reset()\n\t\t\t\tif err := scratchBuf.Unmarshal(msgBlackhole); err != nil {\n\t\t\t\t\tb.Error(\"wrong decode\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\n// BenchmarkVarint32ArrayLarge shows the performance on an array of large int32 fields (3 and\n// 4 bytes long, with a small number of 1, 2, 5 and 10 byte long versions).\nfunc BenchmarkVarint32ArrayLarge(b *testing.B) {\n\tfor i := uint(1); i <= 10; i++ {\n\t\tdist := genInt32Dist([7]int{0, 1, 2, 4, 8, 1, 1}, 1<<i)\n\t\traw, err := proto.Marshal(&tpb.Message{\n\t\t\tShortKey: dist,\n\t\t})\n\t\tif err != nil {\n\t\t\tb.Error(\"wrong encode\", err)\n\t\t}\n\t\tb.Run(fmt.Sprintf(\"Len%v\", len(dist)), func(b *testing.B) {\n\t\t\tscratchBuf := proto.NewBuffer(nil)\n\t\t\tb.ResetTimer()\n\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\tscratchBuf.SetBuf(raw)\n\t\t\t\tmsgBlackhole.Reset()\n\t\t\t\tif err := scratchBuf.Unmarshal(msgBlackhole); err != nil {\n\t\t\t\t\tb.Error(\"wrong decode\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\n// BenchmarkVarint64ArraySmall shows the performance on an array of small int64 fields (1 and\n// 2 bytes long).\nfunc BenchmarkVarint64ArraySmall(b *testing.B) {\n\tfor i := uint(1); i <= 10; i++ {\n\t\tdist := genUint64Dist([11]int{0, 3, 1}, 1<<i)\n\t\traw, err := proto.Marshal(&tpb.Message{\n\t\t\tKey: dist,\n\t\t})\n\t\tif err != nil {\n\t\t\tb.Error(\"wrong encode\", err)\n\t\t}\n\t\tb.Run(fmt.Sprintf(\"Len%v\", len(dist)), func(b *testing.B) {\n\t\t\tscratchBuf := proto.NewBuffer(nil)\n\t\t\tb.ResetTimer()\n\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\tscratchBuf.SetBuf(raw)\n\t\t\t\tmsgBlackhole.Reset()\n\t\t\t\tif err := scratchBuf.Unmarshal(msgBlackhole); err != nil {\n\t\t\t\t\tb.Error(\"wrong decode\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\n// BenchmarkVarint64ArrayLarge shows the performance on an array of large int64 fields (6, 7,\n// and 8 bytes long with a small number of the other sizes).\nfunc BenchmarkVarint64ArrayLarge(b *testing.B) {\n\tfor i := uint(1); i <= 10; i++ {\n\t\tdist := genUint64Dist([11]int{0, 1, 1, 2, 4, 8, 16, 32, 16, 1, 1}, 1<<i)\n\t\traw, err := proto.Marshal(&tpb.Message{\n\t\t\tKey: dist,\n\t\t})\n\t\tif err != nil {\n\t\t\tb.Error(\"wrong encode\", err)\n\t\t}\n\t\tb.Run(fmt.Sprintf(\"Len%v\", len(dist)), func(b *testing.B) {\n\t\t\tscratchBuf := proto.NewBuffer(nil)\n\t\t\tb.ResetTimer()\n\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\tscratchBuf.SetBuf(raw)\n\t\t\t\tmsgBlackhole.Reset()\n\t\t\t\tif err := scratchBuf.Unmarshal(msgBlackhole); err != nil {\n\t\t\t\t\tb.Error(\"wrong decode\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\n// BenchmarkVarint64ArrayMixed shows the performance of lots of small messages, each\n// containing a small number of large (3, 4, and 5 byte) repeated int64s.\nfunc BenchmarkVarint64ArrayMixed(b *testing.B) {\n\tfor i := uint(1); i <= 1<<5; i <<= 1 {\n\t\tdist := genUint64Dist([11]int{0, 0, 0, 4, 6, 4, 0, 0, 0, 0, 0}, int(i))\n\t\t// number of sub fields\n\t\tfor k := uint(1); k <= 1<<10; k <<= 2 {\n\t\t\tmsg := &tpb.Message{}\n\t\t\tfor m := uint(0); m < k; m++ {\n\t\t\t\tmsg.Children = append(msg.Children, &tpb.Message{\n\t\t\t\t\tKey: dist,\n\t\t\t\t})\n\t\t\t}\n\t\t\traw, err := proto.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\tb.Error(\"wrong encode\", err)\n\t\t\t}\n\t\t\tb.Run(fmt.Sprintf(\"Fields%vLen%v\", k, i), func(b *testing.B) {\n\t\t\t\tscratchBuf := proto.NewBuffer(nil)\n\t\t\t\tb.ResetTimer()\n\t\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\t\tscratchBuf.SetBuf(raw)\n\t\t\t\t\tmsgBlackhole.Reset()\n\t\t\t\t\tif err := scratchBuf.Unmarshal(msgBlackhole); err != nil {\n\t\t\t\t\t\tb.Error(\"wrong decode\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}\n\n// genInt32Dist generates a slice of ints that will match the size distribution of dist.\n// A size of 6 corresponds to a max length varint32, which is 10 bytes.  The distribution\n// is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).\nfunc genInt32Dist(dist [7]int, count int) (dest []int32) {\n\tfor i := 0; i < count; i++ {\n\t\tfor k := 0; k < len(dist); k++ {\n\t\t\tvar num int32\n\t\t\tswitch k {\n\t\t\tcase 1:\n\t\t\t\tnum = 1<<7 - 1\n\t\t\tcase 2:\n\t\t\t\tnum = 1<<14 - 1\n\t\t\tcase 3:\n\t\t\t\tnum = 1<<21 - 1\n\t\t\tcase 4:\n\t\t\t\tnum = 1<<28 - 1\n\t\t\tcase 5:\n\t\t\t\tnum = 1<<29 - 1\n\t\t\tcase 6:\n\t\t\t\tnum = -1\n\t\t\t}\n\t\t\tfor m := 0; m < dist[k]; m++ {\n\t\t\t\tdest = append(dest, num)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}\n\n// genUint64Dist generates a slice of ints that will match the size distribution of dist.\n// The distribution is 1-indexed. (i.e. the value at index 1 is how many 1 byte ints to create).\nfunc genUint64Dist(dist [11]int, count int) (dest []uint64) {\n\tfor i := 0; i < count; i++ {\n\t\tfor k := 0; k < len(dist); k++ {\n\t\t\tvar num uint64\n\t\t\tswitch k {\n\t\t\tcase 1:\n\t\t\t\tnum = 1<<7 - 1\n\t\t\tcase 2:\n\t\t\t\tnum = 1<<14 - 1\n\t\t\tcase 3:\n\t\t\t\tnum = 1<<21 - 1\n\t\t\tcase 4:\n\t\t\t\tnum = 1<<28 - 1\n\t\t\tcase 5:\n\t\t\t\tnum = 1<<35 - 1\n\t\t\tcase 6:\n\t\t\t\tnum = 1<<42 - 1\n\t\t\tcase 7:\n\t\t\t\tnum = 1<<49 - 1\n\t\t\tcase 8:\n\t\t\t\tnum = 1<<56 - 1\n\t\t\tcase 9:\n\t\t\t\tnum = 1<<63 - 1\n\t\t\tcase 10:\n\t\t\t\tnum = 1<<64 - 1\n\t\t\t}\n\t\t\tfor m := 0; m < dist[k]; m++ {\n\t\t\t\tdest = append(dest, num)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}\n\n// BenchmarkDecodeEmpty measures the overhead of doing the minimal possible decode.\nfunc BenchmarkDecodeEmpty(b *testing.B) {\n\traw, err := proto.Marshal(&tpb.Message{})\n\tif err != nil {\n\t\tb.Error(\"wrong encode\", err)\n\t}\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tif err := proto.Unmarshal(raw, msgBlackhole); err != nil {\n\t\t\tb.Error(\"wrong decode\", err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/discard.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2017 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n)\n\n// DiscardUnknown recursively discards all unknown fields from this message\n// and all embedded messages.\n//\n// When unmarshaling a message with unrecognized fields, the tags and values\n// of such fields are preserved in the Message. This allows a later call to\n// marshal to be able to produce a message that continues to have those\n// unrecognized fields. To avoid this, DiscardUnknown is used to\n// explicitly clear the unknown fields after unmarshaling.\n//\n// For proto2 messages, the unknown fields of message extensions are only\n// discarded from messages that have been accessed via GetExtension.\nfunc DiscardUnknown(m Message) {\n\tdiscardLegacy(m)\n}\n\nfunc discardLegacy(m Message) {\n\tv := reflect.ValueOf(m)\n\tif v.Kind() != reflect.Ptr || v.IsNil() {\n\t\treturn\n\t}\n\tv = v.Elem()\n\tif v.Kind() != reflect.Struct {\n\t\treturn\n\t}\n\tt := v.Type()\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\t\tvf := v.Field(i)\n\t\ttf := f.Type\n\n\t\t// Unwrap tf to get its most basic type.\n\t\tvar isPointer, isSlice bool\n\t\tif tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {\n\t\t\tisSlice = true\n\t\t\ttf = tf.Elem()\n\t\t}\n\t\tif tf.Kind() == reflect.Ptr {\n\t\t\tisPointer = true\n\t\t\ttf = tf.Elem()\n\t\t}\n\t\tif isPointer && isSlice && tf.Kind() != reflect.Struct {\n\t\t\tpanic(fmt.Sprintf(\"%T.%s cannot be a slice of pointers to primitive types\", m, f.Name))\n\t\t}\n\n\t\tswitch tf.Kind() {\n\t\tcase reflect.Struct:\n\t\t\tswitch {\n\t\t\tcase !isPointer:\n\t\t\t\tpanic(fmt.Sprintf(\"%T.%s cannot be a direct struct value\", m, f.Name))\n\t\t\tcase isSlice: // E.g., []*pb.T\n\t\t\t\tfor j := 0; j < vf.Len(); j++ {\n\t\t\t\t\tdiscardLegacy(vf.Index(j).Interface().(Message))\n\t\t\t\t}\n\t\t\tdefault: // E.g., *pb.T\n\t\t\t\tdiscardLegacy(vf.Interface().(Message))\n\t\t\t}\n\t\tcase reflect.Map:\n\t\t\tswitch {\n\t\t\tcase isPointer || isSlice:\n\t\t\t\tpanic(fmt.Sprintf(\"%T.%s cannot be a pointer to a map or a slice of map values\", m, f.Name))\n\t\t\tdefault: // E.g., map[K]V\n\t\t\t\ttv := vf.Type().Elem()\n\t\t\t\tif tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T)\n\t\t\t\t\tfor _, key := range vf.MapKeys() {\n\t\t\t\t\t\tval := vf.MapIndex(key)\n\t\t\t\t\t\tdiscardLegacy(val.Interface().(Message))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Interface:\n\t\t\t// Must be oneof field.\n\t\t\tswitch {\n\t\t\tcase isPointer || isSlice:\n\t\t\t\tpanic(fmt.Sprintf(\"%T.%s cannot be a pointer to a interface or a slice of interface values\", m, f.Name))\n\t\t\tdefault: // E.g., test_proto.isCommunique_Union interface\n\t\t\t\tif !vf.IsNil() && f.Tag.Get(\"protobuf_oneof\") != \"\" {\n\t\t\t\t\tvf = vf.Elem() // E.g., *test_proto.Communique_Msg\n\t\t\t\t\tif !vf.IsNil() {\n\t\t\t\t\t\tvf = vf.Elem()   // E.g., test_proto.Communique_Msg\n\t\t\t\t\t\tvf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value\n\t\t\t\t\t\tif vf.Kind() == reflect.Ptr {\n\t\t\t\t\t\t\tdiscardLegacy(vf.Interface().(Message))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif vf := v.FieldByName(\"XXX_unrecognized\"); vf.IsValid() {\n\t\tif vf.Type() != reflect.TypeOf([]byte{}) {\n\t\t\tpanic(\"expected XXX_unrecognized to be of type []byte\")\n\t\t}\n\t\tvf.Set(reflect.ValueOf([]byte(nil)))\n\t}\n\n\t// For proto2 messages, only discard unknown fields in message extensions\n\t// that have been accessed via GetExtension.\n\tif em, ok := extendable(m); ok {\n\t\t// Ignore lock since discardLegacy is not concurrency safe.\n\t\temm, _ := em.extensionsRead()\n\t\tfor _, mx := range emm {\n\t\t\tif m, ok := mx.value.(Message); ok {\n\t\t\t\tdiscardLegacy(m)\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/encode.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n/*\n * Routines for encoding data into the wire format for protocol buffers.\n */\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n)\n\n// RequiredNotSetError is the error returned if Marshal is called with\n// a protocol buffer struct whose required fields have not\n// all been initialized. It is also the error returned if Unmarshal is\n// called with an encoded protocol buffer that does not include all the\n// required fields.\n//\n// When printed, RequiredNotSetError reports the first unset required field in a\n// message. If the field cannot be precisely determined, it is reported as\n// \"{Unknown}\".\ntype RequiredNotSetError struct {\n\tfield string\n}\n\nfunc (e *RequiredNotSetError) Error() string {\n\treturn fmt.Sprintf(\"proto: required field %q not set\", e.field)\n}\n\nvar (\n\t// errRepeatedHasNil is the error returned if Marshal is called with\n\t// a struct with a repeated field containing a nil element.\n\terrRepeatedHasNil = errors.New(\"proto: repeated field has nil element\")\n\n\t// errOneofHasNil is the error returned if Marshal is called with\n\t// a struct with a oneof field containing a nil element.\n\terrOneofHasNil = errors.New(\"proto: oneof field has nil value\")\n\n\t// ErrNil is the error returned if Marshal is called with nil.\n\tErrNil = errors.New(\"proto: Marshal called with nil\")\n\n\t// ErrTooLarge is the error returned if Marshal is called with a\n\t// message that encodes to >2GB.\n\tErrTooLarge = errors.New(\"proto: message encodes to over 2 GB\")\n)\n\n// The fundamental encoders that put bytes on the wire.\n// Those that take integer types all accept uint64 and are\n// therefore of type valueEncoder.\n\nconst maxVarintBytes = 10 // maximum length of a varint\n\n// maxMarshalSize is the largest allowed size of an encoded protobuf,\n// since C++ and Java use signed int32s for the size.\nconst maxMarshalSize = 1<<31 - 1\n\n// EncodeVarint returns the varint encoding of x.\n// This is the format for the\n// int32, int64, uint32, uint64, bool, and enum\n// protocol buffer types.\n// Not used by the package itself, but helpful to clients\n// wishing to use the same encoding.\nfunc EncodeVarint(x uint64) []byte {\n\tvar buf [maxVarintBytes]byte\n\tvar n int\n\tfor n = 0; x > 127; n++ {\n\t\tbuf[n] = 0x80 | uint8(x&0x7F)\n\t\tx >>= 7\n\t}\n\tbuf[n] = uint8(x)\n\tn++\n\treturn buf[0:n]\n}\n\n// EncodeVarint writes a varint-encoded integer to the Buffer.\n// This is the format for the\n// int32, int64, uint32, uint64, bool, and enum\n// protocol buffer types.\nfunc (p *Buffer) EncodeVarint(x uint64) error {\n\tfor x >= 1<<7 {\n\t\tp.buf = append(p.buf, uint8(x&0x7f|0x80))\n\t\tx >>= 7\n\t}\n\tp.buf = append(p.buf, uint8(x))\n\treturn nil\n}\n\n// SizeVarint returns the varint encoding size of an integer.\nfunc SizeVarint(x uint64) int {\n\treturn sizeVarint(x)\n}\n\nfunc sizeVarint(x uint64) (n int) {\n\tfor {\n\t\tn++\n\t\tx >>= 7\n\t\tif x == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn n\n}\n\n// EncodeFixed64 writes a 64-bit integer to the Buffer.\n// This is the format for the\n// fixed64, sfixed64, and double protocol buffer types.\nfunc (p *Buffer) EncodeFixed64(x uint64) error {\n\tp.buf = append(p.buf,\n\t\tuint8(x),\n\t\tuint8(x>>8),\n\t\tuint8(x>>16),\n\t\tuint8(x>>24),\n\t\tuint8(x>>32),\n\t\tuint8(x>>40),\n\t\tuint8(x>>48),\n\t\tuint8(x>>56))\n\treturn nil\n}\n\nfunc sizeFixed64(x uint64) int {\n\treturn 8\n}\n\n// EncodeFixed32 writes a 32-bit integer to the Buffer.\n// This is the format for the\n// fixed32, sfixed32, and float protocol buffer types.\nfunc (p *Buffer) EncodeFixed32(x uint64) error {\n\tp.buf = append(p.buf,\n\t\tuint8(x),\n\t\tuint8(x>>8),\n\t\tuint8(x>>16),\n\t\tuint8(x>>24))\n\treturn nil\n}\n\nfunc sizeFixed32(x uint64) int {\n\treturn 4\n}\n\n// EncodeZigzag64 writes a zigzag-encoded 64-bit integer\n// to the Buffer.\n// This is the format used for the sint64 protocol buffer type.\nfunc (p *Buffer) EncodeZigzag64(x uint64) error {\n\t// use signed number to get arithmetic right shift.\n\treturn p.EncodeVarint((x << 1) ^ uint64((int64(x) >> 63)))\n}\n\nfunc sizeZigzag64(x uint64) int {\n\treturn sizeVarint((x << 1) ^ uint64((int64(x) >> 63)))\n}\n\n// EncodeZigzag32 writes a zigzag-encoded 32-bit integer\n// to the Buffer.\n// This is the format used for the sint32 protocol buffer type.\nfunc (p *Buffer) EncodeZigzag32(x uint64) error {\n\t// use signed number to get arithmetic right shift.\n\treturn p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))\n}\n\nfunc sizeZigzag32(x uint64) int {\n\treturn sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))\n}\n\n// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.\n// This is the format used for the bytes protocol buffer\n// type and for embedded messages.\nfunc (p *Buffer) EncodeRawBytes(b []byte) error {\n\tp.EncodeVarint(uint64(len(b)))\n\tp.buf = append(p.buf, b...)\n\treturn nil\n}\n\nfunc sizeRawBytes(b []byte) int {\n\treturn sizeVarint(uint64(len(b))) +\n\t\tlen(b)\n}\n\n// EncodeStringBytes writes an encoded string to the Buffer.\n// This is the format used for the proto2 string type.\nfunc (p *Buffer) EncodeStringBytes(s string) error {\n\tp.EncodeVarint(uint64(len(s)))\n\tp.buf = append(p.buf, s...)\n\treturn nil\n}\n\nfunc sizeStringBytes(s string) int {\n\treturn sizeVarint(uint64(len(s))) +\n\t\tlen(s)\n}\n\n// Marshaler is the interface representing objects that can marshal themselves.\ntype Marshaler interface {\n\tMarshal() ([]byte, error)\n}\n\n// Marshal takes the protocol buffer\n// and encodes it into the wire format, returning the data.\nfunc Marshal(pb Message) ([]byte, error) {\n\t// Can the object marshal itself?\n\tif m, ok := pb.(Marshaler); ok {\n\t\treturn m.Marshal()\n\t}\n\tp := NewBuffer(nil)\n\terr := p.Marshal(pb)\n\tif p.buf == nil && err == nil {\n\t\t// Return a non-nil slice on success.\n\t\treturn []byte{}, nil\n\t}\n\treturn p.buf, err\n}\n\n// EncodeMessage writes the protocol buffer to the Buffer,\n// prefixed by a varint-encoded length.\nfunc (p *Buffer) EncodeMessage(pb Message) error {\n\tt, base, err := getbase(pb)\n\tif structPointer_IsNil(base) {\n\t\treturn ErrNil\n\t}\n\tif err == nil {\n\t\tvar state errorState\n\t\terr = p.enc_len_struct(GetProperties(t.Elem()), base, &state)\n\t}\n\treturn err\n}\n\n// Marshal takes the protocol buffer\n// and encodes it into the wire format, writing the result to the\n// Buffer.\nfunc (p *Buffer) Marshal(pb Message) error {\n\t// Can the object marshal itself?\n\tif m, ok := pb.(Marshaler); ok {\n\t\tdata, err := m.Marshal()\n\t\tp.buf = append(p.buf, data...)\n\t\treturn err\n\t}\n\n\tt, base, err := getbase(pb)\n\tif structPointer_IsNil(base) {\n\t\treturn ErrNil\n\t}\n\tif err == nil {\n\t\terr = p.enc_struct(GetProperties(t.Elem()), base)\n\t}\n\n\tif collectStats {\n\t\t(stats).Encode++ // Parens are to work around a goimports bug.\n\t}\n\n\tif len(p.buf) > maxMarshalSize {\n\t\treturn ErrTooLarge\n\t}\n\treturn err\n}\n\n// Size returns the encoded size of a protocol buffer.\nfunc Size(pb Message) (n int) {\n\t// Can the object marshal itself?  If so, Size is slow.\n\t// TODO: add Size to Marshaler, or add a Sizer interface.\n\tif m, ok := pb.(Marshaler); ok {\n\t\tb, _ := m.Marshal()\n\t\treturn len(b)\n\t}\n\n\tt, base, err := getbase(pb)\n\tif structPointer_IsNil(base) {\n\t\treturn 0\n\t}\n\tif err == nil {\n\t\tn = size_struct(GetProperties(t.Elem()), base)\n\t}\n\n\tif collectStats {\n\t\t(stats).Size++ // Parens are to work around a goimports bug.\n\t}\n\n\treturn\n}\n\n// Individual type encoders.\n\n// Encode a bool.\nfunc (o *Buffer) enc_bool(p *Properties, base structPointer) error {\n\tv := *structPointer_Bool(base, p.field)\n\tif v == nil {\n\t\treturn ErrNil\n\t}\n\tx := 0\n\tif *v {\n\t\tx = 1\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, uint64(x))\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error {\n\tv := *structPointer_BoolVal(base, p.field)\n\tif !v {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, 1)\n\treturn nil\n}\n\nfunc size_bool(p *Properties, base structPointer) int {\n\tv := *structPointer_Bool(base, p.field)\n\tif v == nil {\n\t\treturn 0\n\t}\n\treturn len(p.tagcode) + 1 // each bool takes exactly one byte\n}\n\nfunc size_proto3_bool(p *Properties, base structPointer) int {\n\tv := *structPointer_BoolVal(base, p.field)\n\tif !v && !p.oneof {\n\t\treturn 0\n\t}\n\treturn len(p.tagcode) + 1 // each bool takes exactly one byte\n}\n\n// Encode an int32.\nfunc (o *Buffer) enc_int32(p *Properties, base structPointer) error {\n\tv := structPointer_Word32(base, p.field)\n\tif word32_IsNil(v) {\n\t\treturn ErrNil\n\t}\n\tx := int32(word32_Get(v)) // permit sign extension to use full 64-bit range\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, uint64(x))\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error {\n\tv := structPointer_Word32Val(base, p.field)\n\tx := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range\n\tif x == 0 {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, uint64(x))\n\treturn nil\n}\n\nfunc size_int32(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word32(base, p.field)\n\tif word32_IsNil(v) {\n\t\treturn 0\n\t}\n\tx := int32(word32_Get(v)) // permit sign extension to use full 64-bit range\n\tn += len(p.tagcode)\n\tn += p.valSize(uint64(x))\n\treturn\n}\n\nfunc size_proto3_int32(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word32Val(base, p.field)\n\tx := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range\n\tif x == 0 && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += p.valSize(uint64(x))\n\treturn\n}\n\n// Encode a uint32.\n// Exactly the same as int32, except for no sign extension.\nfunc (o *Buffer) enc_uint32(p *Properties, base structPointer) error {\n\tv := structPointer_Word32(base, p.field)\n\tif word32_IsNil(v) {\n\t\treturn ErrNil\n\t}\n\tx := word32_Get(v)\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, uint64(x))\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error {\n\tv := structPointer_Word32Val(base, p.field)\n\tx := word32Val_Get(v)\n\tif x == 0 {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, uint64(x))\n\treturn nil\n}\n\nfunc size_uint32(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word32(base, p.field)\n\tif word32_IsNil(v) {\n\t\treturn 0\n\t}\n\tx := word32_Get(v)\n\tn += len(p.tagcode)\n\tn += p.valSize(uint64(x))\n\treturn\n}\n\nfunc size_proto3_uint32(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word32Val(base, p.field)\n\tx := word32Val_Get(v)\n\tif x == 0 && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += p.valSize(uint64(x))\n\treturn\n}\n\n// Encode an int64.\nfunc (o *Buffer) enc_int64(p *Properties, base structPointer) error {\n\tv := structPointer_Word64(base, p.field)\n\tif word64_IsNil(v) {\n\t\treturn ErrNil\n\t}\n\tx := word64_Get(v)\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, x)\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error {\n\tv := structPointer_Word64Val(base, p.field)\n\tx := word64Val_Get(v)\n\tif x == 0 {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\tp.valEnc(o, x)\n\treturn nil\n}\n\nfunc size_int64(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word64(base, p.field)\n\tif word64_IsNil(v) {\n\t\treturn 0\n\t}\n\tx := word64_Get(v)\n\tn += len(p.tagcode)\n\tn += p.valSize(x)\n\treturn\n}\n\nfunc size_proto3_int64(p *Properties, base structPointer) (n int) {\n\tv := structPointer_Word64Val(base, p.field)\n\tx := word64Val_Get(v)\n\tif x == 0 && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += p.valSize(x)\n\treturn\n}\n\n// Encode a string.\nfunc (o *Buffer) enc_string(p *Properties, base structPointer) error {\n\tv := *structPointer_String(base, p.field)\n\tif v == nil {\n\t\treturn ErrNil\n\t}\n\tx := *v\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeStringBytes(x)\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error {\n\tv := *structPointer_StringVal(base, p.field)\n\tif v == \"\" {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeStringBytes(v)\n\treturn nil\n}\n\nfunc size_string(p *Properties, base structPointer) (n int) {\n\tv := *structPointer_String(base, p.field)\n\tif v == nil {\n\t\treturn 0\n\t}\n\tx := *v\n\tn += len(p.tagcode)\n\tn += sizeStringBytes(x)\n\treturn\n}\n\nfunc size_proto3_string(p *Properties, base structPointer) (n int) {\n\tv := *structPointer_StringVal(base, p.field)\n\tif v == \"\" && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += sizeStringBytes(v)\n\treturn\n}\n\n// All protocol buffer fields are nillable, but be careful.\nfunc isNil(v reflect.Value) bool {\n\tswitch v.Kind() {\n\tcase reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:\n\t\treturn v.IsNil()\n\t}\n\treturn false\n}\n\n// Encode a message struct.\nfunc (o *Buffer) enc_struct_message(p *Properties, base structPointer) error {\n\tvar state errorState\n\tstructp := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(structp) {\n\t\treturn ErrNil\n\t}\n\n\t// Can the object marshal itself?\n\tif p.isMarshaler {\n\t\tm := structPointer_Interface(structp, p.stype).(Marshaler)\n\t\tdata, err := m.Marshal()\n\t\tif err != nil && !state.shouldContinue(err, nil) {\n\t\t\treturn err\n\t\t}\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\to.EncodeRawBytes(data)\n\t\treturn state.err\n\t}\n\n\to.buf = append(o.buf, p.tagcode...)\n\treturn o.enc_len_struct(p.sprop, structp, &state)\n}\n\nfunc size_struct_message(p *Properties, base structPointer) int {\n\tstructp := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(structp) {\n\t\treturn 0\n\t}\n\n\t// Can the object marshal itself?\n\tif p.isMarshaler {\n\t\tm := structPointer_Interface(structp, p.stype).(Marshaler)\n\t\tdata, _ := m.Marshal()\n\t\tn0 := len(p.tagcode)\n\t\tn1 := sizeRawBytes(data)\n\t\treturn n0 + n1\n\t}\n\n\tn0 := len(p.tagcode)\n\tn1 := size_struct(p.sprop, structp)\n\tn2 := sizeVarint(uint64(n1)) // size of encoded length\n\treturn n0 + n1 + n2\n}\n\n// Encode a group struct.\nfunc (o *Buffer) enc_struct_group(p *Properties, base structPointer) error {\n\tvar state errorState\n\tb := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(b) {\n\t\treturn ErrNil\n\t}\n\n\to.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))\n\terr := o.enc_struct(p.sprop, b)\n\tif err != nil && !state.shouldContinue(err, nil) {\n\t\treturn err\n\t}\n\to.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))\n\treturn state.err\n}\n\nfunc size_struct_group(p *Properties, base structPointer) (n int) {\n\tb := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(b) {\n\t\treturn 0\n\t}\n\n\tn += sizeVarint(uint64((p.Tag << 3) | WireStartGroup))\n\tn += size_struct(p.sprop, b)\n\tn += sizeVarint(uint64((p.Tag << 3) | WireEndGroup))\n\treturn\n}\n\n// Encode a slice of bools ([]bool).\nfunc (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error {\n\ts := *structPointer_BoolSlice(base, p.field)\n\tl := len(s)\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\tfor _, x := range s {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\tv := uint64(0)\n\t\tif x {\n\t\t\tv = 1\n\t\t}\n\t\tp.valEnc(o, v)\n\t}\n\treturn nil\n}\n\nfunc size_slice_bool(p *Properties, base structPointer) int {\n\ts := *structPointer_BoolSlice(base, p.field)\n\tl := len(s)\n\tif l == 0 {\n\t\treturn 0\n\t}\n\treturn l * (len(p.tagcode) + 1) // each bool takes exactly one byte\n}\n\n// Encode a slice of bools ([]bool) in packed format.\nfunc (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error {\n\ts := *structPointer_BoolSlice(base, p.field)\n\tl := len(s)\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeVarint(uint64(l)) // each bool takes exactly one byte\n\tfor _, x := range s {\n\t\tv := uint64(0)\n\t\tif x {\n\t\t\tv = 1\n\t\t}\n\t\tp.valEnc(o, v)\n\t}\n\treturn nil\n}\n\nfunc size_slice_packed_bool(p *Properties, base structPointer) (n int) {\n\ts := *structPointer_BoolSlice(base, p.field)\n\tl := len(s)\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += sizeVarint(uint64(l))\n\tn += l // each bool takes exactly one byte\n\treturn\n}\n\n// Encode a slice of bytes ([]byte).\nfunc (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error {\n\ts := *structPointer_Bytes(base, p.field)\n\tif s == nil {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeRawBytes(s)\n\treturn nil\n}\n\nfunc (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error {\n\ts := *structPointer_Bytes(base, p.field)\n\tif len(s) == 0 {\n\t\treturn ErrNil\n\t}\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeRawBytes(s)\n\treturn nil\n}\n\nfunc size_slice_byte(p *Properties, base structPointer) (n int) {\n\ts := *structPointer_Bytes(base, p.field)\n\tif s == nil && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += sizeRawBytes(s)\n\treturn\n}\n\nfunc size_proto3_slice_byte(p *Properties, base structPointer) (n int) {\n\ts := *structPointer_Bytes(base, p.field)\n\tif len(s) == 0 && !p.oneof {\n\t\treturn 0\n\t}\n\tn += len(p.tagcode)\n\tn += sizeRawBytes(s)\n\treturn\n}\n\n// Encode a slice of int32s ([]int32).\nfunc (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\tfor i := 0; i < l; i++ {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\tx := int32(s.Index(i)) // permit sign extension to use full 64-bit range\n\t\tp.valEnc(o, uint64(x))\n\t}\n\treturn nil\n}\n\nfunc size_slice_int32(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tfor i := 0; i < l; i++ {\n\t\tn += len(p.tagcode)\n\t\tx := int32(s.Index(i)) // permit sign extension to use full 64-bit range\n\t\tn += p.valSize(uint64(x))\n\t}\n\treturn\n}\n\n// Encode a slice of int32s ([]int32) in packed format.\nfunc (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\t// TODO: Reuse a Buffer.\n\tbuf := NewBuffer(nil)\n\tfor i := 0; i < l; i++ {\n\t\tx := int32(s.Index(i)) // permit sign extension to use full 64-bit range\n\t\tp.valEnc(buf, uint64(x))\n\t}\n\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeVarint(uint64(len(buf.buf)))\n\to.buf = append(o.buf, buf.buf...)\n\treturn nil\n}\n\nfunc size_slice_packed_int32(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tvar bufSize int\n\tfor i := 0; i < l; i++ {\n\t\tx := int32(s.Index(i)) // permit sign extension to use full 64-bit range\n\t\tbufSize += p.valSize(uint64(x))\n\t}\n\n\tn += len(p.tagcode)\n\tn += sizeVarint(uint64(bufSize))\n\tn += bufSize\n\treturn\n}\n\n// Encode a slice of uint32s ([]uint32).\n// Exactly the same as int32, except for no sign extension.\nfunc (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\tfor i := 0; i < l; i++ {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\tx := s.Index(i)\n\t\tp.valEnc(o, uint64(x))\n\t}\n\treturn nil\n}\n\nfunc size_slice_uint32(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tfor i := 0; i < l; i++ {\n\t\tn += len(p.tagcode)\n\t\tx := s.Index(i)\n\t\tn += p.valSize(uint64(x))\n\t}\n\treturn\n}\n\n// Encode a slice of uint32s ([]uint32) in packed format.\n// Exactly the same as int32, except for no sign extension.\nfunc (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\t// TODO: Reuse a Buffer.\n\tbuf := NewBuffer(nil)\n\tfor i := 0; i < l; i++ {\n\t\tp.valEnc(buf, uint64(s.Index(i)))\n\t}\n\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeVarint(uint64(len(buf.buf)))\n\to.buf = append(o.buf, buf.buf...)\n\treturn nil\n}\n\nfunc size_slice_packed_uint32(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word32Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tvar bufSize int\n\tfor i := 0; i < l; i++ {\n\t\tbufSize += p.valSize(uint64(s.Index(i)))\n\t}\n\n\tn += len(p.tagcode)\n\tn += sizeVarint(uint64(bufSize))\n\tn += bufSize\n\treturn\n}\n\n// Encode a slice of int64s ([]int64).\nfunc (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error {\n\ts := structPointer_Word64Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\tfor i := 0; i < l; i++ {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\tp.valEnc(o, s.Index(i))\n\t}\n\treturn nil\n}\n\nfunc size_slice_int64(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word64Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tfor i := 0; i < l; i++ {\n\t\tn += len(p.tagcode)\n\t\tn += p.valSize(s.Index(i))\n\t}\n\treturn\n}\n\n// Encode a slice of int64s ([]int64) in packed format.\nfunc (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error {\n\ts := structPointer_Word64Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\t// TODO: Reuse a Buffer.\n\tbuf := NewBuffer(nil)\n\tfor i := 0; i < l; i++ {\n\t\tp.valEnc(buf, s.Index(i))\n\t}\n\n\to.buf = append(o.buf, p.tagcode...)\n\to.EncodeVarint(uint64(len(buf.buf)))\n\to.buf = append(o.buf, buf.buf...)\n\treturn nil\n}\n\nfunc size_slice_packed_int64(p *Properties, base structPointer) (n int) {\n\ts := structPointer_Word64Slice(base, p.field)\n\tl := s.Len()\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tvar bufSize int\n\tfor i := 0; i < l; i++ {\n\t\tbufSize += p.valSize(s.Index(i))\n\t}\n\n\tn += len(p.tagcode)\n\tn += sizeVarint(uint64(bufSize))\n\tn += bufSize\n\treturn\n}\n\n// Encode a slice of slice of bytes ([][]byte).\nfunc (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error {\n\tss := *structPointer_BytesSlice(base, p.field)\n\tl := len(ss)\n\tif l == 0 {\n\t\treturn ErrNil\n\t}\n\tfor i := 0; i < l; i++ {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\to.EncodeRawBytes(ss[i])\n\t}\n\treturn nil\n}\n\nfunc size_slice_slice_byte(p *Properties, base structPointer) (n int) {\n\tss := *structPointer_BytesSlice(base, p.field)\n\tl := len(ss)\n\tif l == 0 {\n\t\treturn 0\n\t}\n\tn += l * len(p.tagcode)\n\tfor i := 0; i < l; i++ {\n\t\tn += sizeRawBytes(ss[i])\n\t}\n\treturn\n}\n\n// Encode a slice of strings ([]string).\nfunc (o *Buffer) enc_slice_string(p *Properties, base structPointer) error {\n\tss := *structPointer_StringSlice(base, p.field)\n\tl := len(ss)\n\tfor i := 0; i < l; i++ {\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\to.EncodeStringBytes(ss[i])\n\t}\n\treturn nil\n}\n\nfunc size_slice_string(p *Properties, base structPointer) (n int) {\n\tss := *structPointer_StringSlice(base, p.field)\n\tl := len(ss)\n\tn += l * len(p.tagcode)\n\tfor i := 0; i < l; i++ {\n\t\tn += sizeStringBytes(ss[i])\n\t}\n\treturn\n}\n\n// Encode a slice of message structs ([]*struct).\nfunc (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error {\n\tvar state errorState\n\ts := structPointer_StructPointerSlice(base, p.field)\n\tl := s.Len()\n\n\tfor i := 0; i < l; i++ {\n\t\tstructp := s.Index(i)\n\t\tif structPointer_IsNil(structp) {\n\t\t\treturn errRepeatedHasNil\n\t\t}\n\n\t\t// Can the object marshal itself?\n\t\tif p.isMarshaler {\n\t\t\tm := structPointer_Interface(structp, p.stype).(Marshaler)\n\t\t\tdata, err := m.Marshal()\n\t\t\tif err != nil && !state.shouldContinue(err, nil) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\to.buf = append(o.buf, p.tagcode...)\n\t\t\to.EncodeRawBytes(data)\n\t\t\tcontinue\n\t\t}\n\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\terr := o.enc_len_struct(p.sprop, structp, &state)\n\t\tif err != nil && !state.shouldContinue(err, nil) {\n\t\t\tif err == ErrNil {\n\t\t\t\treturn errRepeatedHasNil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\treturn state.err\n}\n\nfunc size_slice_struct_message(p *Properties, base structPointer) (n int) {\n\ts := structPointer_StructPointerSlice(base, p.field)\n\tl := s.Len()\n\tn += l * len(p.tagcode)\n\tfor i := 0; i < l; i++ {\n\t\tstructp := s.Index(i)\n\t\tif structPointer_IsNil(structp) {\n\t\t\treturn // return the size up to this point\n\t\t}\n\n\t\t// Can the object marshal itself?\n\t\tif p.isMarshaler {\n\t\t\tm := structPointer_Interface(structp, p.stype).(Marshaler)\n\t\t\tdata, _ := m.Marshal()\n\t\t\tn += sizeRawBytes(data)\n\t\t\tcontinue\n\t\t}\n\n\t\tn0 := size_struct(p.sprop, structp)\n\t\tn1 := sizeVarint(uint64(n0)) // size of encoded length\n\t\tn += n0 + n1\n\t}\n\treturn\n}\n\n// Encode a slice of group structs ([]*struct).\nfunc (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error {\n\tvar state errorState\n\ts := structPointer_StructPointerSlice(base, p.field)\n\tl := s.Len()\n\n\tfor i := 0; i < l; i++ {\n\t\tb := s.Index(i)\n\t\tif structPointer_IsNil(b) {\n\t\t\treturn errRepeatedHasNil\n\t\t}\n\n\t\to.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))\n\n\t\terr := o.enc_struct(p.sprop, b)\n\n\t\tif err != nil && !state.shouldContinue(err, nil) {\n\t\t\tif err == ErrNil {\n\t\t\t\treturn errRepeatedHasNil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\to.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))\n\t}\n\treturn state.err\n}\n\nfunc size_slice_struct_group(p *Properties, base structPointer) (n int) {\n\ts := structPointer_StructPointerSlice(base, p.field)\n\tl := s.Len()\n\n\tn += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup))\n\tn += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup))\n\tfor i := 0; i < l; i++ {\n\t\tb := s.Index(i)\n\t\tif structPointer_IsNil(b) {\n\t\t\treturn // return size up to this point\n\t\t}\n\n\t\tn += size_struct(p.sprop, b)\n\t}\n\treturn\n}\n\n// Encode an extension map.\nfunc (o *Buffer) enc_map(p *Properties, base structPointer) error {\n\texts := structPointer_ExtMap(base, p.field)\n\tif err := encodeExtensionsMap(*exts); err != nil {\n\t\treturn err\n\t}\n\n\treturn o.enc_map_body(*exts)\n}\n\nfunc (o *Buffer) enc_exts(p *Properties, base structPointer) error {\n\texts := structPointer_Extensions(base, p.field)\n\n\tv, mu := exts.extensionsRead()\n\tif v == nil {\n\t\treturn nil\n\t}\n\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tif err := encodeExtensionsMap(v); err != nil {\n\t\treturn err\n\t}\n\n\treturn o.enc_map_body(v)\n}\n\nfunc (o *Buffer) enc_map_body(v map[int32]Extension) error {\n\t// Fast-path for common cases: zero or one extensions.\n\tif len(v) <= 1 {\n\t\tfor _, e := range v {\n\t\t\to.buf = append(o.buf, e.enc...)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Sort keys to provide a deterministic encoding.\n\tkeys := make([]int, 0, len(v))\n\tfor k := range v {\n\t\tkeys = append(keys, int(k))\n\t}\n\tsort.Ints(keys)\n\n\tfor _, k := range keys {\n\t\to.buf = append(o.buf, v[int32(k)].enc...)\n\t}\n\treturn nil\n}\n\nfunc size_map(p *Properties, base structPointer) int {\n\tv := structPointer_ExtMap(base, p.field)\n\treturn extensionsMapSize(*v)\n}\n\nfunc size_exts(p *Properties, base structPointer) int {\n\tv := structPointer_Extensions(base, p.field)\n\treturn extensionsSize(v)\n}\n\n// Encode a map field.\nfunc (o *Buffer) enc_new_map(p *Properties, base structPointer) error {\n\tvar state errorState // XXX: or do we need to plumb this through?\n\n\t/*\n\t\tA map defined as\n\t\t\tmap<key_type, value_type> map_field = N;\n\t\tis encoded in the same way as\n\t\t\tmessage MapFieldEntry {\n\t\t\t\tkey_type key = 1;\n\t\t\t\tvalue_type value = 2;\n\t\t\t}\n\t\t\trepeated MapFieldEntry map_field = N;\n\t*/\n\n\tv := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V\n\tif v.Len() == 0 {\n\t\treturn nil\n\t}\n\n\tkeycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)\n\n\tenc := func() error {\n\t\tif err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Don't sort map keys. It is not required by the spec, and C++ doesn't do it.\n\tfor _, key := range v.MapKeys() {\n\t\tval := v.MapIndex(key)\n\n\t\tkeycopy.Set(key)\n\t\tvalcopy.Set(val)\n\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\tif err := o.enc_len_thing(enc, &state); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc size_new_map(p *Properties, base structPointer) int {\n\tv := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V\n\n\tkeycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)\n\n\tn := 0\n\tfor _, key := range v.MapKeys() {\n\t\tval := v.MapIndex(key)\n\t\tkeycopy.Set(key)\n\t\tvalcopy.Set(val)\n\n\t\t// Tag codes for key and val are the responsibility of the sub-sizer.\n\t\tkeysize := p.mkeyprop.size(p.mkeyprop, keybase)\n\t\tvalsize := p.mvalprop.size(p.mvalprop, valbase)\n\t\tentry := keysize + valsize\n\t\t// Add on tag code and length of map entry itself.\n\t\tn += len(p.tagcode) + sizeVarint(uint64(entry)) + entry\n\t}\n\treturn n\n}\n\n// mapEncodeScratch returns a new reflect.Value matching the map's value type,\n// and a structPointer suitable for passing to an encoder or sizer.\nfunc mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) {\n\t// Prepare addressable doubly-indirect placeholders for the key and value types.\n\t// This is needed because the element-type encoders expect **T, but the map iteration produces T.\n\n\tkeycopy = reflect.New(mapType.Key()).Elem()                 // addressable K\n\tkeyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K\n\tkeyptr.Set(keycopy.Addr())                                  //\n\tkeybase = toStructPointer(keyptr.Addr())                    // **K\n\n\t// Value types are more varied and require special handling.\n\tswitch mapType.Elem().Kind() {\n\tcase reflect.Slice:\n\t\t// []byte\n\t\tvar dummy []byte\n\t\tvalcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte\n\t\tvalbase = toStructPointer(valcopy.Addr())\n\tcase reflect.Ptr:\n\t\t// message; the generated field type is map[K]*Msg (so V is *Msg),\n\t\t// so we only need one level of indirection.\n\t\tvalcopy = reflect.New(mapType.Elem()).Elem() // addressable V\n\t\tvalbase = toStructPointer(valcopy.Addr())\n\tdefault:\n\t\t// everything else\n\t\tvalcopy = reflect.New(mapType.Elem()).Elem()                // addressable V\n\t\tvalptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V\n\t\tvalptr.Set(valcopy.Addr())                                  //\n\t\tvalbase = toStructPointer(valptr.Addr())                    // **V\n\t}\n\treturn\n}\n\n// Encode a struct.\nfunc (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {\n\tvar state errorState\n\t// Encode fields in tag order so that decoders may use optimizations\n\t// that depend on the ordering.\n\t// https://developers.google.com/protocol-buffers/docs/encoding#order\n\tfor _, i := range prop.order {\n\t\tp := prop.Prop[i]\n\t\tif p.enc != nil {\n\t\t\terr := p.enc(o, p, base)\n\t\t\tif err != nil {\n\t\t\t\tif err == ErrNil {\n\t\t\t\t\tif p.Required && state.err == nil {\n\t\t\t\t\t\tstate.err = &RequiredNotSetError{p.Name}\n\t\t\t\t\t}\n\t\t\t\t} else if err == errRepeatedHasNil {\n\t\t\t\t\t// Give more context to nil values in repeated fields.\n\t\t\t\t\treturn errors.New(\"repeated field \" + p.OrigName + \" has nil element\")\n\t\t\t\t} else if !state.shouldContinue(err, p) {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(o.buf) > maxMarshalSize {\n\t\t\t\treturn ErrTooLarge\n\t\t\t}\n\t\t}\n\t}\n\n\t// Do oneof fields.\n\tif prop.oneofMarshaler != nil {\n\t\tm := structPointer_Interface(base, prop.stype).(Message)\n\t\tif err := prop.oneofMarshaler(m, o); err == ErrNil {\n\t\t\treturn errOneofHasNil\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Add unrecognized fields at the end.\n\tif prop.unrecField.IsValid() {\n\t\tv := *structPointer_Bytes(base, prop.unrecField)\n\t\tif len(o.buf)+len(v) > maxMarshalSize {\n\t\t\treturn ErrTooLarge\n\t\t}\n\t\tif len(v) > 0 {\n\t\t\to.buf = append(o.buf, v...)\n\t\t}\n\t}\n\n\treturn state.err\n}\n\nfunc size_struct(prop *StructProperties, base structPointer) (n int) {\n\tfor _, i := range prop.order {\n\t\tp := prop.Prop[i]\n\t\tif p.size != nil {\n\t\t\tn += p.size(p, base)\n\t\t}\n\t}\n\n\t// Add unrecognized fields at the end.\n\tif prop.unrecField.IsValid() {\n\t\tv := *structPointer_Bytes(base, prop.unrecField)\n\t\tn += len(v)\n\t}\n\n\t// Factor in any oneof fields.\n\tif prop.oneofSizer != nil {\n\t\tm := structPointer_Interface(base, prop.stype).(Message)\n\t\tn += prop.oneofSizer(m)\n\t}\n\n\treturn\n}\n\nvar zeroes [20]byte // longer than any conceivable sizeVarint\n\n// Encode a struct, preceded by its encoded length (as a varint).\nfunc (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error {\n\treturn o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state)\n}\n\n// Encode something, preceded by its encoded length (as a varint).\nfunc (o *Buffer) enc_len_thing(enc func() error, state *errorState) error {\n\tiLen := len(o.buf)\n\to.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length\n\tiMsg := len(o.buf)\n\terr := enc()\n\tif err != nil && !state.shouldContinue(err, nil) {\n\t\treturn err\n\t}\n\tlMsg := len(o.buf) - iMsg\n\tlLen := sizeVarint(uint64(lMsg))\n\tswitch x := lLen - (iMsg - iLen); {\n\tcase x > 0: // actual length is x bytes larger than the space we reserved\n\t\t// Move msg x bytes right.\n\t\to.buf = append(o.buf, zeroes[:x]...)\n\t\tcopy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])\n\tcase x < 0: // actual length is x bytes smaller than the space we reserved\n\t\t// Move msg x bytes left.\n\t\tcopy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])\n\t\to.buf = o.buf[:len(o.buf)+x] // x is negative\n\t}\n\t// Encode the length in the reserved space.\n\to.buf = o.buf[:iLen]\n\to.EncodeVarint(uint64(lMsg))\n\to.buf = o.buf[:len(o.buf)+lMsg]\n\treturn state.err\n}\n\n// errorState maintains the first error that occurs and updates that error\n// with additional context.\ntype errorState struct {\n\terr error\n}\n\n// shouldContinue reports whether encoding should continue upon encountering the\n// given error. If the error is RequiredNotSetError, shouldContinue returns true\n// and, if this is the first appearance of that error, remembers it for future\n// reporting.\n//\n// If prop is not nil, it may update any error with additional context about the\n// field with the error.\nfunc (s *errorState) shouldContinue(err error, prop *Properties) bool {\n\t// Ignore unset required fields.\n\treqNotSet, ok := err.(*RequiredNotSetError)\n\tif !ok {\n\t\treturn false\n\t}\n\tif s.err == nil {\n\t\tif prop != nil {\n\t\t\terr = &RequiredNotSetError{prop.Name + \".\" + reqNotSet.field}\n\t\t}\n\t\ts.err = err\n\t}\n\treturn true\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/encode_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build go1.7\n\npackage proto_test\n\nimport (\n\t\"strconv\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\ttpb \"github.com/golang/protobuf/proto/proto3_proto\"\n\t\"github.com/golang/protobuf/ptypes\"\n)\n\nvar (\n\tblackhole []byte\n)\n\n// BenchmarkAny creates increasingly large arbitrary Any messages.  The type is always the\n// same.\nfunc BenchmarkAny(b *testing.B) {\n\tdata := make([]byte, 1<<20)\n\tquantum := 1 << 10\n\tfor i := uint(0); i <= 10; i++ {\n\t\tb.Run(strconv.Itoa(quantum<<i), func(b *testing.B) {\n\t\t\tfor k := 0; k < b.N; k++ {\n\t\t\t\tinner := &tpb.Message{\n\t\t\t\t\tData: data[:quantum<<i],\n\t\t\t\t}\n\t\t\t\touter, err := ptypes.MarshalAny(inner)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Error(\"wrong encode\", err)\n\t\t\t\t}\n\t\t\t\traw, err := proto.Marshal(&tpb.Message{\n\t\t\t\t\tAnything: outer,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.Error(\"wrong encode\", err)\n\t\t\t\t}\n\t\t\t\tblackhole = raw\n\t\t\t}\n\t\t})\n\t}\n}\n\n// BenchmarkEmpy measures the overhead of doing the minimal possible encode.\nfunc BenchmarkEmpy(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\traw, err := proto.Marshal(&tpb.Message{})\n\t\tif err != nil {\n\t\t\tb.Error(\"wrong encode\", err)\n\t\t}\n\t\tblackhole = raw\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/equal.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Protocol buffer comparison.\n\npackage proto\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"reflect\"\n\t\"strings\"\n)\n\n/*\nEqual returns true iff protocol buffers a and b are equal.\nThe arguments must both be pointers to protocol buffer structs.\n\nEquality is defined in this way:\n  - Two messages are equal iff they are the same type,\n    corresponding fields are equal, unknown field sets\n    are equal, and extensions sets are equal.\n  - Two set scalar fields are equal iff their values are equal.\n    If the fields are of a floating-point type, remember that\n    NaN != x for all x, including NaN. If the message is defined\n    in a proto3 .proto file, fields are not \"set\"; specifically,\n    zero length proto3 \"bytes\" fields are equal (nil == {}).\n  - Two repeated fields are equal iff their lengths are the same,\n    and their corresponding elements are equal. Note a \"bytes\" field,\n    although represented by []byte, is not a repeated field and the\n    rule for the scalar fields described above applies.\n  - Two unset fields are equal.\n  - Two unknown field sets are equal if their current\n    encoded state is equal.\n  - Two extension sets are equal iff they have corresponding\n    elements that are pairwise equal.\n  - Two map fields are equal iff their lengths are the same,\n    and they contain the same set of elements. Zero-length map\n    fields are equal.\n  - Every other combination of things are not equal.\n\nThe return value is undefined if a and b are not protocol buffers.\n*/\nfunc Equal(a, b Message) bool {\n\tif a == nil || b == nil {\n\t\treturn a == b\n\t}\n\tv1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)\n\tif v1.Type() != v2.Type() {\n\t\treturn false\n\t}\n\tif v1.Kind() == reflect.Ptr {\n\t\tif v1.IsNil() {\n\t\t\treturn v2.IsNil()\n\t\t}\n\t\tif v2.IsNil() {\n\t\t\treturn false\n\t\t}\n\t\tv1, v2 = v1.Elem(), v2.Elem()\n\t}\n\tif v1.Kind() != reflect.Struct {\n\t\treturn false\n\t}\n\treturn equalStruct(v1, v2)\n}\n\n// v1 and v2 are known to have the same type.\nfunc equalStruct(v1, v2 reflect.Value) bool {\n\tsprop := GetProperties(v1.Type())\n\tfor i := 0; i < v1.NumField(); i++ {\n\t\tf := v1.Type().Field(i)\n\t\tif strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\t\tf1, f2 := v1.Field(i), v2.Field(i)\n\t\tif f.Type.Kind() == reflect.Ptr {\n\t\t\tif n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {\n\t\t\t\t// both unset\n\t\t\t\tcontinue\n\t\t\t} else if n1 != n2 {\n\t\t\t\t// set/unset mismatch\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tb1, ok := f1.Interface().(raw)\n\t\t\tif ok {\n\t\t\t\tb2 := f2.Interface().(raw)\n\t\t\t\t// RawMessage\n\t\t\t\tif !bytes.Equal(b1.Bytes(), b2.Bytes()) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf1, f2 = f1.Elem(), f2.Elem()\n\t\t}\n\t\tif !equalAny(f1, f2, sprop.Prop[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif em1 := v1.FieldByName(\"XXX_InternalExtensions\"); em1.IsValid() {\n\t\tem2 := v2.FieldByName(\"XXX_InternalExtensions\")\n\t\tif !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif em1 := v1.FieldByName(\"XXX_extensions\"); em1.IsValid() {\n\t\tem2 := v2.FieldByName(\"XXX_extensions\")\n\t\tif !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tuf := v1.FieldByName(\"XXX_unrecognized\")\n\tif !uf.IsValid() {\n\t\treturn true\n\t}\n\n\tu1 := uf.Bytes()\n\tu2 := v2.FieldByName(\"XXX_unrecognized\").Bytes()\n\tif !bytes.Equal(u1, u2) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n// v1 and v2 are known to have the same type.\n// prop may be nil.\nfunc equalAny(v1, v2 reflect.Value, prop *Properties) bool {\n\tif v1.Type() == protoMessageType {\n\t\tm1, _ := v1.Interface().(Message)\n\t\tm2, _ := v2.Interface().(Message)\n\t\treturn Equal(m1, m2)\n\t}\n\tswitch v1.Kind() {\n\tcase reflect.Bool:\n\t\treturn v1.Bool() == v2.Bool()\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn v1.Float() == v2.Float()\n\tcase reflect.Int32, reflect.Int64:\n\t\treturn v1.Int() == v2.Int()\n\tcase reflect.Interface:\n\t\t// Probably a oneof field; compare the inner values.\n\t\tn1, n2 := v1.IsNil(), v2.IsNil()\n\t\tif n1 || n2 {\n\t\t\treturn n1 == n2\n\t\t}\n\t\te1, e2 := v1.Elem(), v2.Elem()\n\t\tif e1.Type() != e2.Type() {\n\t\t\treturn false\n\t\t}\n\t\treturn equalAny(e1, e2, nil)\n\tcase reflect.Map:\n\t\tif v1.Len() != v2.Len() {\n\t\t\treturn false\n\t\t}\n\t\tfor _, key := range v1.MapKeys() {\n\t\t\tval2 := v2.MapIndex(key)\n\t\t\tif !val2.IsValid() {\n\t\t\t\t// This key was not found in the second map.\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif !equalAny(v1.MapIndex(key), val2, nil) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase reflect.Ptr:\n\t\t// Maps may have nil values in them, so check for nil.\n\t\tif v1.IsNil() && v2.IsNil() {\n\t\t\treturn true\n\t\t}\n\t\tif v1.IsNil() != v2.IsNil() {\n\t\t\treturn false\n\t\t}\n\t\treturn equalAny(v1.Elem(), v2.Elem(), prop)\n\tcase reflect.Slice:\n\t\tif v1.Type().Elem().Kind() == reflect.Uint8 {\n\t\t\t// short circuit: []byte\n\n\t\t\t// Edge case: if this is in a proto3 message, a zero length\n\t\t\t// bytes field is considered the zero value.\n\t\t\tif prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif v1.IsNil() != v2.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))\n\t\t}\n\n\t\tif v1.Len() != v2.Len() {\n\t\t\treturn false\n\t\t}\n\t\tfor i := 0; i < v1.Len(); i++ {\n\t\t\tif !equalAny(v1.Index(i), v2.Index(i), prop) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase reflect.String:\n\t\treturn v1.Interface().(string) == v2.Interface().(string)\n\tcase reflect.Struct:\n\t\treturn equalStruct(v1, v2)\n\tcase reflect.Uint32, reflect.Uint64:\n\t\treturn v1.Uint() == v2.Uint()\n\t}\n\n\t// unknown type, so not a protocol buffer\n\tlog.Printf(\"proto: don't know how to compare %v\", v1)\n\treturn false\n}\n\n// base is the struct type that the extensions are based on.\n// x1 and x2 are InternalExtensions.\nfunc equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {\n\tem1, _ := x1.extensionsRead()\n\tem2, _ := x2.extensionsRead()\n\treturn equalExtMap(base, em1, em2)\n}\n\nfunc equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {\n\tif len(em1) != len(em2) {\n\t\treturn false\n\t}\n\n\tfor extNum, e1 := range em1 {\n\t\te2, ok := em2[extNum]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\n\t\tm1, m2 := e1.value, e2.value\n\n\t\tif m1 != nil && m2 != nil {\n\t\t\t// Both are unencoded.\n\t\t\tif !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// At least one is encoded. To do a semantically correct comparison\n\t\t// we need to unmarshal them first.\n\t\tvar desc *ExtensionDesc\n\t\tif m := extensionMaps[base]; m != nil {\n\t\t\tdesc = m[extNum]\n\t\t}\n\t\tif desc == nil {\n\t\t\tlog.Printf(\"proto: don't know how to compare extension %d of %v\", extNum, base)\n\t\t\tcontinue\n\t\t}\n\t\tvar err error\n\t\tif m1 == nil {\n\t\t\tm1, err = decodeExtension(e1.enc, desc)\n\t\t}\n\t\tif m2 == nil && err == nil {\n\t\t\tm2, err = decodeExtension(e2.enc, desc)\n\t\t}\n\t\tif err != nil {\n\t\t\t// The encoded form is invalid.\n\t\t\tlog.Printf(\"proto: badly encoded extension %d of %v: %v\", extNum, base, err)\n\t\t\treturn false\n\t\t}\n\t\tif !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/equal_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t. \"github.com/golang/protobuf/proto\"\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\tpb \"github.com/golang/protobuf/proto/testdata\"\n)\n\n// Four identical base messages.\n// The init function adds extensions to some of them.\nvar messageWithoutExtension = &pb.MyMessage{Count: Int32(7)}\nvar messageWithExtension1a = &pb.MyMessage{Count: Int32(7)}\nvar messageWithExtension1b = &pb.MyMessage{Count: Int32(7)}\nvar messageWithExtension2 = &pb.MyMessage{Count: Int32(7)}\n\n// Two messages with non-message extensions.\nvar messageWithInt32Extension1 = &pb.MyMessage{Count: Int32(8)}\nvar messageWithInt32Extension2 = &pb.MyMessage{Count: Int32(8)}\n\nfunc init() {\n\text1 := &pb.Ext{Data: String(\"Kirk\")}\n\text2 := &pb.Ext{Data: String(\"Picard\")}\n\n\t// messageWithExtension1a has ext1, but never marshals it.\n\tif err := SetExtension(messageWithExtension1a, pb.E_Ext_More, ext1); err != nil {\n\t\tpanic(\"SetExtension on 1a failed: \" + err.Error())\n\t}\n\n\t// messageWithExtension1b is the unmarshaled form of messageWithExtension1a.\n\tif err := SetExtension(messageWithExtension1b, pb.E_Ext_More, ext1); err != nil {\n\t\tpanic(\"SetExtension on 1b failed: \" + err.Error())\n\t}\n\tbuf, err := Marshal(messageWithExtension1b)\n\tif err != nil {\n\t\tpanic(\"Marshal of 1b failed: \" + err.Error())\n\t}\n\tmessageWithExtension1b.Reset()\n\tif err := Unmarshal(buf, messageWithExtension1b); err != nil {\n\t\tpanic(\"Unmarshal of 1b failed: \" + err.Error())\n\t}\n\n\t// messageWithExtension2 has ext2.\n\tif err := SetExtension(messageWithExtension2, pb.E_Ext_More, ext2); err != nil {\n\t\tpanic(\"SetExtension on 2 failed: \" + err.Error())\n\t}\n\n\tif err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(23)); err != nil {\n\t\tpanic(\"SetExtension on Int32-1 failed: \" + err.Error())\n\t}\n\tif err := SetExtension(messageWithInt32Extension1, pb.E_Ext_Number, Int32(24)); err != nil {\n\t\tpanic(\"SetExtension on Int32-2 failed: \" + err.Error())\n\t}\n}\n\nvar EqualTests = []struct {\n\tdesc string\n\ta, b Message\n\texp  bool\n}{\n\t{\"different types\", &pb.GoEnum{}, &pb.GoTestField{}, false},\n\t{\"equal empty\", &pb.GoEnum{}, &pb.GoEnum{}, true},\n\t{\"nil vs nil\", nil, nil, true},\n\t{\"typed nil vs typed nil\", (*pb.GoEnum)(nil), (*pb.GoEnum)(nil), true},\n\t{\"typed nil vs empty\", (*pb.GoEnum)(nil), &pb.GoEnum{}, false},\n\t{\"different typed nil\", (*pb.GoEnum)(nil), (*pb.GoTestField)(nil), false},\n\n\t{\"one set field, one unset field\", &pb.GoTestField{Label: String(\"foo\")}, &pb.GoTestField{}, false},\n\t{\"one set field zero, one unset field\", &pb.GoTest{Param: Int32(0)}, &pb.GoTest{}, false},\n\t{\"different set fields\", &pb.GoTestField{Label: String(\"foo\")}, &pb.GoTestField{Label: String(\"bar\")}, false},\n\t{\"equal set\", &pb.GoTestField{Label: String(\"foo\")}, &pb.GoTestField{Label: String(\"foo\")}, true},\n\n\t{\"repeated, one set\", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{}, false},\n\t{\"repeated, different length\", &pb.GoTest{F_Int32Repeated: []int32{2, 3}}, &pb.GoTest{F_Int32Repeated: []int32{2}}, false},\n\t{\"repeated, different value\", &pb.GoTest{F_Int32Repeated: []int32{2}}, &pb.GoTest{F_Int32Repeated: []int32{3}}, false},\n\t{\"repeated, equal\", &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, &pb.GoTest{F_Int32Repeated: []int32{2, 4}}, true},\n\t{\"repeated, nil equal nil\", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: nil}, true},\n\t{\"repeated, nil equal empty\", &pb.GoTest{F_Int32Repeated: nil}, &pb.GoTest{F_Int32Repeated: []int32{}}, true},\n\t{\"repeated, empty equal nil\", &pb.GoTest{F_Int32Repeated: []int32{}}, &pb.GoTest{F_Int32Repeated: nil}, true},\n\n\t{\n\t\t\"nested, different\",\n\t\t&pb.GoTest{RequiredField: &pb.GoTestField{Label: String(\"foo\")}},\n\t\t&pb.GoTest{RequiredField: &pb.GoTestField{Label: String(\"bar\")}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"nested, equal\",\n\t\t&pb.GoTest{RequiredField: &pb.GoTestField{Label: String(\"wow\")}},\n\t\t&pb.GoTest{RequiredField: &pb.GoTestField{Label: String(\"wow\")}},\n\t\ttrue,\n\t},\n\n\t{\"bytes\", &pb.OtherMessage{Value: []byte(\"foo\")}, &pb.OtherMessage{Value: []byte(\"foo\")}, true},\n\t{\"bytes, empty\", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: []byte{}}, true},\n\t{\"bytes, empty vs nil\", &pb.OtherMessage{Value: []byte{}}, &pb.OtherMessage{Value: nil}, false},\n\t{\n\t\t\"repeated bytes\",\n\t\t&pb.MyMessage{RepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")}},\n\t\t&pb.MyMessage{RepBytes: [][]byte{[]byte(\"sham\"), []byte(\"wow\")}},\n\t\ttrue,\n\t},\n\t// In proto3, []byte{} and []byte(nil) are equal.\n\t{\"proto3 bytes, empty vs nil\", &proto3pb.Message{Data: []byte{}}, &proto3pb.Message{Data: nil}, true},\n\n\t{\"extension vs. no extension\", messageWithoutExtension, messageWithExtension1a, false},\n\t{\"extension vs. same extension\", messageWithExtension1a, messageWithExtension1b, true},\n\t{\"extension vs. different extension\", messageWithExtension1a, messageWithExtension2, false},\n\n\t{\"int32 extension vs. itself\", messageWithInt32Extension1, messageWithInt32Extension1, true},\n\t{\"int32 extension vs. a different int32\", messageWithInt32Extension1, messageWithInt32Extension2, false},\n\n\t{\n\t\t\"message with group\",\n\t\t&pb.MyMessage{\n\t\t\tCount: Int32(1),\n\t\t\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\t\t\tGroupField: Int32(5),\n\t\t\t},\n\t\t},\n\t\t&pb.MyMessage{\n\t\t\tCount: Int32(1),\n\t\t\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\t\t\tGroupField: Int32(5),\n\t\t\t},\n\t\t},\n\t\ttrue,\n\t},\n\n\t{\n\t\t\"map same\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"map different entry\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{2: \"Rob\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"map different key only\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{2: \"Ken\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"map different value only\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\"}},\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Rob\"}},\n\t\tfalse,\n\t},\n\t{\n\t\t\"zero-length maps same\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{}},\n\t\t&pb.MessageWithMap{NameMapping: nil},\n\t\ttrue,\n\t},\n\t{\n\t\t\"orders in map don't matter\",\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{1: \"Ken\", 2: \"Rob\"}},\n\t\t&pb.MessageWithMap{NameMapping: map[int32]string{2: \"Rob\", 1: \"Ken\"}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"oneof same\",\n\t\t&pb.Communique{Union: &pb.Communique_Number{41}},\n\t\t&pb.Communique{Union: &pb.Communique_Number{41}},\n\t\ttrue,\n\t},\n\t{\n\t\t\"oneof one nil\",\n\t\t&pb.Communique{Union: &pb.Communique_Number{41}},\n\t\t&pb.Communique{},\n\t\tfalse,\n\t},\n\t{\n\t\t\"oneof different\",\n\t\t&pb.Communique{Union: &pb.Communique_Number{41}},\n\t\t&pb.Communique{Union: &pb.Communique_Name{\"Bobby Tables\"}},\n\t\tfalse,\n\t},\n}\n\nfunc TestEqual(t *testing.T) {\n\tfor _, tc := range EqualTests {\n\t\tif res := Equal(tc.a, tc.b); res != tc.exp {\n\t\t\tt.Errorf(\"%v: Equal(%v, %v) = %v, want %v\", tc.desc, tc.a, tc.b, res, tc.exp)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/extensions.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n/*\n * Types and routines for supporting protocol buffer extensions.\n */\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"sync\"\n)\n\n// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.\nvar ErrMissingExtension = errors.New(\"proto: missing extension\")\n\n// ExtensionRange represents a range of message extensions for a protocol buffer.\n// Used in code generated by the protocol compiler.\ntype ExtensionRange struct {\n\tStart, End int32 // both inclusive\n}\n\n// extendableProto is an interface implemented by any protocol buffer generated by the current\n// proto compiler that may be extended.\ntype extendableProto interface {\n\tMessage\n\tExtensionRangeArray() []ExtensionRange\n\textensionsWrite() map[int32]Extension\n\textensionsRead() (map[int32]Extension, sync.Locker)\n}\n\n// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous\n// version of the proto compiler that may be extended.\ntype extendableProtoV1 interface {\n\tMessage\n\tExtensionRangeArray() []ExtensionRange\n\tExtensionMap() map[int32]Extension\n}\n\n// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.\ntype extensionAdapter struct {\n\textendableProtoV1\n}\n\nfunc (e extensionAdapter) extensionsWrite() map[int32]Extension {\n\treturn e.ExtensionMap()\n}\n\nfunc (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {\n\treturn e.ExtensionMap(), notLocker{}\n}\n\n// notLocker is a sync.Locker whose Lock and Unlock methods are nops.\ntype notLocker struct{}\n\nfunc (n notLocker) Lock()   {}\nfunc (n notLocker) Unlock() {}\n\n// extendable returns the extendableProto interface for the given generated proto message.\n// If the proto message has the old extension format, it returns a wrapper that implements\n// the extendableProto interface.\nfunc extendable(p interface{}) (extendableProto, bool) {\n\tif ep, ok := p.(extendableProto); ok {\n\t\treturn ep, ok\n\t}\n\tif ep, ok := p.(extendableProtoV1); ok {\n\t\treturn extensionAdapter{ep}, ok\n\t}\n\treturn nil, false\n}\n\n// XXX_InternalExtensions is an internal representation of proto extensions.\n//\n// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,\n// thus gaining the unexported 'extensions' method, which can be called only from the proto package.\n//\n// The methods of XXX_InternalExtensions are not concurrency safe in general,\n// but calls to logically read-only methods such as has and get may be executed concurrently.\ntype XXX_InternalExtensions struct {\n\t// The struct must be indirect so that if a user inadvertently copies a\n\t// generated message and its embedded XXX_InternalExtensions, they\n\t// avoid the mayhem of a copied mutex.\n\t//\n\t// The mutex serializes all logically read-only operations to p.extensionMap.\n\t// It is up to the client to ensure that write operations to p.extensionMap are\n\t// mutually exclusive with other accesses.\n\tp *struct {\n\t\tmu           sync.Mutex\n\t\textensionMap map[int32]Extension\n\t}\n}\n\n// extensionsWrite returns the extension map, creating it on first use.\nfunc (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {\n\tif e.p == nil {\n\t\te.p = new(struct {\n\t\t\tmu           sync.Mutex\n\t\t\textensionMap map[int32]Extension\n\t\t})\n\t\te.p.extensionMap = make(map[int32]Extension)\n\t}\n\treturn e.p.extensionMap\n}\n\n// extensionsRead returns the extensions map for read-only use.  It may be nil.\n// The caller must hold the returned mutex's lock when accessing Elements within the map.\nfunc (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {\n\tif e.p == nil {\n\t\treturn nil, nil\n\t}\n\treturn e.p.extensionMap, &e.p.mu\n}\n\nvar extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()\nvar extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem()\n\n// ExtensionDesc represents an extension specification.\n// Used in generated code from the protocol compiler.\ntype ExtensionDesc struct {\n\tExtendedType  Message     // nil pointer to the type that is being extended\n\tExtensionType interface{} // nil pointer to the extension type\n\tField         int32       // field number\n\tName          string      // fully-qualified name of extension, for text formatting\n\tTag           string      // protobuf tag style\n\tFilename      string      // name of the file in which the extension is defined\n}\n\nfunc (ed *ExtensionDesc) repeated() bool {\n\tt := reflect.TypeOf(ed.ExtensionType)\n\treturn t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8\n}\n\n// Extension represents an extension in a message.\ntype Extension struct {\n\t// When an extension is stored in a message using SetExtension\n\t// only desc and value are set. When the message is marshaled\n\t// enc will be set to the encoded form of the message.\n\t//\n\t// When a message is unmarshaled and contains extensions, each\n\t// extension will have only enc set. When such an extension is\n\t// accessed using GetExtension (or GetExtensions) desc and value\n\t// will be set.\n\tdesc  *ExtensionDesc\n\tvalue interface{}\n\tenc   []byte\n}\n\n// SetRawExtension is for testing only.\nfunc SetRawExtension(base Message, id int32, b []byte) {\n\tepb, ok := extendable(base)\n\tif !ok {\n\t\treturn\n\t}\n\textmap := epb.extensionsWrite()\n\textmap[id] = Extension{enc: b}\n}\n\n// isExtensionField returns true iff the given field number is in an extension range.\nfunc isExtensionField(pb extendableProto, field int32) bool {\n\tfor _, er := range pb.ExtensionRangeArray() {\n\t\tif er.Start <= field && field <= er.End {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// checkExtensionTypes checks that the given extension is valid for pb.\nfunc checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {\n\tvar pbi interface{} = pb\n\t// Check the extended type.\n\tif ea, ok := pbi.(extensionAdapter); ok {\n\t\tpbi = ea.extendableProtoV1\n\t}\n\tif a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {\n\t\treturn errors.New(\"proto: bad extended type; \" + b.String() + \" does not extend \" + a.String())\n\t}\n\t// Check the range.\n\tif !isExtensionField(pb, extension.Field) {\n\t\treturn errors.New(\"proto: bad extension number; not in declared ranges\")\n\t}\n\treturn nil\n}\n\n// extPropKey is sufficient to uniquely identify an extension.\ntype extPropKey struct {\n\tbase  reflect.Type\n\tfield int32\n}\n\nvar extProp = struct {\n\tsync.RWMutex\n\tm map[extPropKey]*Properties\n}{\n\tm: make(map[extPropKey]*Properties),\n}\n\nfunc extensionProperties(ed *ExtensionDesc) *Properties {\n\tkey := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}\n\n\textProp.RLock()\n\tif prop, ok := extProp.m[key]; ok {\n\t\textProp.RUnlock()\n\t\treturn prop\n\t}\n\textProp.RUnlock()\n\n\textProp.Lock()\n\tdefer extProp.Unlock()\n\t// Check again.\n\tif prop, ok := extProp.m[key]; ok {\n\t\treturn prop\n\t}\n\n\tprop := new(Properties)\n\tprop.Init(reflect.TypeOf(ed.ExtensionType), \"unknown_name\", ed.Tag, nil)\n\textProp.m[key] = prop\n\treturn prop\n}\n\n// encode encodes any unmarshaled (unencoded) extensions in e.\nfunc encodeExtensions(e *XXX_InternalExtensions) error {\n\tm, mu := e.extensionsRead()\n\tif m == nil {\n\t\treturn nil // fast path\n\t}\n\tmu.Lock()\n\tdefer mu.Unlock()\n\treturn encodeExtensionsMap(m)\n}\n\n// encode encodes any unmarshaled (unencoded) extensions in e.\nfunc encodeExtensionsMap(m map[int32]Extension) error {\n\tfor k, e := range m {\n\t\tif e.value == nil || e.desc == nil {\n\t\t\t// Extension is only in its encoded form.\n\t\t\tcontinue\n\t\t}\n\n\t\t// We don't skip extensions that have an encoded form set,\n\t\t// because the extension value may have been mutated after\n\t\t// the last time this function was called.\n\n\t\tet := reflect.TypeOf(e.desc.ExtensionType)\n\t\tprops := extensionProperties(e.desc)\n\n\t\tp := NewBuffer(nil)\n\t\t// If e.value has type T, the encoder expects a *struct{ X T }.\n\t\t// Pass a *T with a zero field and hope it all works out.\n\t\tx := reflect.New(et)\n\t\tx.Elem().Set(reflect.ValueOf(e.value))\n\t\tif err := props.enc(p, props, toStructPointer(x)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\te.enc = p.buf\n\t\tm[k] = e\n\t}\n\treturn nil\n}\n\nfunc extensionsSize(e *XXX_InternalExtensions) (n int) {\n\tm, mu := e.extensionsRead()\n\tif m == nil {\n\t\treturn 0\n\t}\n\tmu.Lock()\n\tdefer mu.Unlock()\n\treturn extensionsMapSize(m)\n}\n\nfunc extensionsMapSize(m map[int32]Extension) (n int) {\n\tfor _, e := range m {\n\t\tif e.value == nil || e.desc == nil {\n\t\t\t// Extension is only in its encoded form.\n\t\t\tn += len(e.enc)\n\t\t\tcontinue\n\t\t}\n\n\t\t// We don't skip extensions that have an encoded form set,\n\t\t// because the extension value may have been mutated after\n\t\t// the last time this function was called.\n\n\t\tet := reflect.TypeOf(e.desc.ExtensionType)\n\t\tprops := extensionProperties(e.desc)\n\n\t\t// If e.value has type T, the encoder expects a *struct{ X T }.\n\t\t// Pass a *T with a zero field and hope it all works out.\n\t\tx := reflect.New(et)\n\t\tx.Elem().Set(reflect.ValueOf(e.value))\n\t\tn += props.size(props, toStructPointer(x))\n\t}\n\treturn\n}\n\n// HasExtension returns whether the given extension is present in pb.\nfunc HasExtension(pb Message, extension *ExtensionDesc) bool {\n\t// TODO: Check types, field numbers, etc.?\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn false\n\t}\n\textmap, mu := epb.extensionsRead()\n\tif extmap == nil {\n\t\treturn false\n\t}\n\tmu.Lock()\n\t_, ok = extmap[extension.Field]\n\tmu.Unlock()\n\treturn ok\n}\n\n// ClearExtension removes the given extension from pb.\nfunc ClearExtension(pb Message, extension *ExtensionDesc) {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn\n\t}\n\t// TODO: Check types, field numbers, etc.?\n\textmap := epb.extensionsWrite()\n\tdelete(extmap, extension.Field)\n}\n\n// GetExtension parses and returns the given extension of pb.\n// If the extension is not present and has no default value it returns ErrMissingExtension.\nfunc GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn nil, errors.New(\"proto: not an extendable proto\")\n\t}\n\n\tif err := checkExtensionTypes(epb, extension); err != nil {\n\t\treturn nil, err\n\t}\n\n\temap, mu := epb.extensionsRead()\n\tif emap == nil {\n\t\treturn defaultExtensionValue(extension)\n\t}\n\tmu.Lock()\n\tdefer mu.Unlock()\n\te, ok := emap[extension.Field]\n\tif !ok {\n\t\t// defaultExtensionValue returns the default value or\n\t\t// ErrMissingExtension if there is no default.\n\t\treturn defaultExtensionValue(extension)\n\t}\n\n\tif e.value != nil {\n\t\t// Already decoded. Check the descriptor, though.\n\t\tif e.desc != extension {\n\t\t\t// This shouldn't happen. If it does, it means that\n\t\t\t// GetExtension was called twice with two different\n\t\t\t// descriptors with the same field number.\n\t\t\treturn nil, errors.New(\"proto: descriptor conflict\")\n\t\t}\n\t\treturn e.value, nil\n\t}\n\n\tv, err := decodeExtension(e.enc, extension)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Remember the decoded version and drop the encoded version.\n\t// That way it is safe to mutate what we return.\n\te.value = v\n\te.desc = extension\n\te.enc = nil\n\temap[extension.Field] = e\n\treturn e.value, nil\n}\n\n// defaultExtensionValue returns the default value for extension.\n// If no default for an extension is defined ErrMissingExtension is returned.\nfunc defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {\n\tt := reflect.TypeOf(extension.ExtensionType)\n\tprops := extensionProperties(extension)\n\n\tsf, _, err := fieldDefault(t, props)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif sf == nil || sf.value == nil {\n\t\t// There is no default value.\n\t\treturn nil, ErrMissingExtension\n\t}\n\n\tif t.Kind() != reflect.Ptr {\n\t\t// We do not need to return a Ptr, we can directly return sf.value.\n\t\treturn sf.value, nil\n\t}\n\n\t// We need to return an interface{} that is a pointer to sf.value.\n\tvalue := reflect.New(t).Elem()\n\tvalue.Set(reflect.New(value.Type().Elem()))\n\tif sf.kind == reflect.Int32 {\n\t\t// We may have an int32 or an enum, but the underlying data is int32.\n\t\t// Since we can't set an int32 into a non int32 reflect.value directly\n\t\t// set it as a int32.\n\t\tvalue.Elem().SetInt(int64(sf.value.(int32)))\n\t} else {\n\t\tvalue.Elem().Set(reflect.ValueOf(sf.value))\n\t}\n\treturn value.Interface(), nil\n}\n\n// decodeExtension decodes an extension encoded in b.\nfunc decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {\n\to := NewBuffer(b)\n\n\tt := reflect.TypeOf(extension.ExtensionType)\n\n\tprops := extensionProperties(extension)\n\n\t// t is a pointer to a struct, pointer to basic type or a slice.\n\t// Allocate a \"field\" to store the pointer/slice itself; the\n\t// pointer/slice will be stored here. We pass\n\t// the address of this field to props.dec.\n\t// This passes a zero field and a *t and lets props.dec\n\t// interpret it as a *struct{ x t }.\n\tvalue := reflect.New(t).Elem()\n\n\tfor {\n\t\t// Discard wire type and field number varint. It isn't needed.\n\t\tif _, err := o.DecodeVarint(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := props.dec(o, props, toStructPointer(value.Addr())); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif o.index >= len(o.buf) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn value.Interface(), nil\n}\n\n// GetExtensions returns a slice of the extensions present in pb that are also listed in es.\n// The returned slice has the same length as es; missing extensions will appear as nil elements.\nfunc GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn nil, errors.New(\"proto: not an extendable proto\")\n\t}\n\textensions = make([]interface{}, len(es))\n\tfor i, e := range es {\n\t\textensions[i], err = GetExtension(epb, e)\n\t\tif err == ErrMissingExtension {\n\t\t\terr = nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}\n\n// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.\n// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing\n// just the Field field, which defines the extension's field number.\nfunc ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"proto: %T is not an extendable proto.Message\", pb)\n\t}\n\tregisteredExtensions := RegisteredExtensions(pb)\n\n\temap, mu := epb.extensionsRead()\n\tif emap == nil {\n\t\treturn nil, nil\n\t}\n\tmu.Lock()\n\tdefer mu.Unlock()\n\textensions := make([]*ExtensionDesc, 0, len(emap))\n\tfor extid, e := range emap {\n\t\tdesc := e.desc\n\t\tif desc == nil {\n\t\t\tdesc = registeredExtensions[extid]\n\t\t\tif desc == nil {\n\t\t\t\tdesc = &ExtensionDesc{Field: extid}\n\t\t\t}\n\t\t}\n\n\t\textensions = append(extensions, desc)\n\t}\n\treturn extensions, nil\n}\n\n// SetExtension sets the specified extension of pb to the specified value.\nfunc SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn errors.New(\"proto: not an extendable proto\")\n\t}\n\tif err := checkExtensionTypes(epb, extension); err != nil {\n\t\treturn err\n\t}\n\ttyp := reflect.TypeOf(extension.ExtensionType)\n\tif typ != reflect.TypeOf(value) {\n\t\treturn errors.New(\"proto: bad extension value type\")\n\t}\n\t// nil extension values need to be caught early, because the\n\t// encoder can't distinguish an ErrNil due to a nil extension\n\t// from an ErrNil due to a missing field. Extensions are\n\t// always optional, so the encoder would just swallow the error\n\t// and drop all the extensions from the encoded message.\n\tif reflect.ValueOf(value).IsNil() {\n\t\treturn fmt.Errorf(\"proto: SetExtension called with nil value of type %T\", value)\n\t}\n\n\textmap := epb.extensionsWrite()\n\textmap[extension.Field] = Extension{desc: extension, value: value}\n\treturn nil\n}\n\n// ClearAllExtensions clears all extensions from pb.\nfunc ClearAllExtensions(pb Message) {\n\tepb, ok := extendable(pb)\n\tif !ok {\n\t\treturn\n\t}\n\tm := epb.extensionsWrite()\n\tfor k := range m {\n\t\tdelete(m, k)\n\t}\n}\n\n// A global registry of extensions.\n// The generated code will register the generated descriptors by calling RegisterExtension.\n\nvar extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)\n\n// RegisterExtension is called from the generated code.\nfunc RegisterExtension(desc *ExtensionDesc) {\n\tst := reflect.TypeOf(desc.ExtendedType).Elem()\n\tm := extensionMaps[st]\n\tif m == nil {\n\t\tm = make(map[int32]*ExtensionDesc)\n\t\textensionMaps[st] = m\n\t}\n\tif _, ok := m[desc.Field]; ok {\n\t\tpanic(\"proto: duplicate extension registered: \" + st.String() + \" \" + strconv.Itoa(int(desc.Field)))\n\t}\n\tm[desc.Field] = desc\n}\n\n// RegisteredExtensions returns a map of the registered extensions of a\n// protocol buffer struct, indexed by the extension number.\n// The argument pb should be a nil pointer to the struct type.\nfunc RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {\n\treturn extensionMaps[reflect.TypeOf(pb).Elem()]\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/extensions_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tpb \"github.com/golang/protobuf/proto/testdata\"\n\t\"golang.org/x/sync/errgroup\"\n)\n\nfunc TestGetExtensionsWithMissingExtensions(t *testing.T) {\n\tmsg := &pb.MyMessage{}\n\text1 := &pb.Ext{}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", err)\n\t}\n\texts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{\n\t\tpb.E_Ext_More,\n\t\tpb.E_Ext_Text,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"GetExtensions() failed: %s\", err)\n\t}\n\tif exts[0] != ext1 {\n\t\tt.Errorf(\"ext1 not in returned extensions: %T %v\", exts[0], exts[0])\n\t}\n\tif exts[1] != nil {\n\t\tt.Errorf(\"ext2 in returned extensions: %T %v\", exts[1], exts[1])\n\t}\n}\n\nfunc TestExtensionDescsWithMissingExtensions(t *testing.T) {\n\tmsg := &pb.MyMessage{Count: proto.Int32(0)}\n\textdesc1 := pb.E_Ext_More\n\tif descs, err := proto.ExtensionDescs(msg); len(descs) != 0 || err != nil {\n\t\tt.Errorf(\"proto.ExtensionDescs: got %d descs, error %v; want 0, nil\", len(descs), err)\n\t}\n\n\text1 := &pb.Ext{}\n\tif err := proto.SetExtension(msg, extdesc1, ext1); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", err)\n\t}\n\textdesc2 := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         123456789,\n\t\tName:          \"a.b\",\n\t\tTag:           \"varint,123456789,opt\",\n\t}\n\text2 := proto.Bool(false)\n\tif err := proto.SetExtension(msg, extdesc2, ext2); err != nil {\n\t\tt.Fatalf(\"Could not set ext2: %s\", err)\n\t}\n\n\tb, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not marshal msg: %v\", err)\n\t}\n\tif err := proto.Unmarshal(b, msg); err != nil {\n\t\tt.Fatalf(\"Could not unmarshal into msg: %v\", err)\n\t}\n\n\tdescs, err := proto.ExtensionDescs(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.ExtensionDescs: got error %v\", err)\n\t}\n\tsortExtDescs(descs)\n\twantDescs := []*proto.ExtensionDesc{extdesc1, &proto.ExtensionDesc{Field: extdesc2.Field}}\n\tif !reflect.DeepEqual(descs, wantDescs) {\n\t\tt.Errorf(\"proto.ExtensionDescs(msg) sorted extension ids: got %+v, want %+v\", descs, wantDescs)\n\t}\n}\n\ntype ExtensionDescSlice []*proto.ExtensionDesc\n\nfunc (s ExtensionDescSlice) Len() int           { return len(s) }\nfunc (s ExtensionDescSlice) Less(i, j int) bool { return s[i].Field < s[j].Field }\nfunc (s ExtensionDescSlice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }\n\nfunc sortExtDescs(s []*proto.ExtensionDesc) {\n\tsort.Sort(ExtensionDescSlice(s))\n}\n\nfunc TestGetExtensionStability(t *testing.T) {\n\tcheck := func(m *pb.MyMessage) bool {\n\t\text1, err := proto.GetExtension(m, pb.E_Ext_More)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"GetExtension() failed: %s\", err)\n\t\t}\n\t\text2, err := proto.GetExtension(m, pb.E_Ext_More)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"GetExtension() failed: %s\", err)\n\t\t}\n\t\treturn ext1 == ext2\n\t}\n\tmsg := &pb.MyMessage{Count: proto.Int32(4)}\n\text0 := &pb.Ext{}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil {\n\t\tt.Fatalf(\"Could not set ext1: %s\", ext0)\n\t}\n\tif !check(msg) {\n\t\tt.Errorf(\"GetExtension() not stable before marshaling\")\n\t}\n\tbb, err := proto.Marshal(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal() failed: %s\", err)\n\t}\n\tmsg1 := &pb.MyMessage{}\n\terr = proto.Unmarshal(bb, msg1)\n\tif err != nil {\n\t\tt.Fatalf(\"Unmarshal() failed: %s\", err)\n\t}\n\tif !check(msg1) {\n\t\tt.Errorf(\"GetExtension() not stable after unmarshaling\")\n\t}\n}\n\nfunc TestGetExtensionDefaults(t *testing.T) {\n\tvar setFloat64 float64 = 1\n\tvar setFloat32 float32 = 2\n\tvar setInt32 int32 = 3\n\tvar setInt64 int64 = 4\n\tvar setUint32 uint32 = 5\n\tvar setUint64 uint64 = 6\n\tvar setBool = true\n\tvar setBool2 = false\n\tvar setString = \"Goodnight string\"\n\tvar setBytes = []byte(\"Goodnight bytes\")\n\tvar setEnum = pb.DefaultsMessage_TWO\n\n\ttype testcase struct {\n\t\text  *proto.ExtensionDesc // Extension we are testing.\n\t\twant interface{}          // Expected value of extension, or nil (meaning that GetExtension will fail).\n\t\tdef  interface{}          // Expected value of extension after ClearExtension().\n\t}\n\ttests := []testcase{\n\t\t{pb.E_NoDefaultDouble, setFloat64, nil},\n\t\t{pb.E_NoDefaultFloat, setFloat32, nil},\n\t\t{pb.E_NoDefaultInt32, setInt32, nil},\n\t\t{pb.E_NoDefaultInt64, setInt64, nil},\n\t\t{pb.E_NoDefaultUint32, setUint32, nil},\n\t\t{pb.E_NoDefaultUint64, setUint64, nil},\n\t\t{pb.E_NoDefaultSint32, setInt32, nil},\n\t\t{pb.E_NoDefaultSint64, setInt64, nil},\n\t\t{pb.E_NoDefaultFixed32, setUint32, nil},\n\t\t{pb.E_NoDefaultFixed64, setUint64, nil},\n\t\t{pb.E_NoDefaultSfixed32, setInt32, nil},\n\t\t{pb.E_NoDefaultSfixed64, setInt64, nil},\n\t\t{pb.E_NoDefaultBool, setBool, nil},\n\t\t{pb.E_NoDefaultBool, setBool2, nil},\n\t\t{pb.E_NoDefaultString, setString, nil},\n\t\t{pb.E_NoDefaultBytes, setBytes, nil},\n\t\t{pb.E_NoDefaultEnum, setEnum, nil},\n\t\t{pb.E_DefaultDouble, setFloat64, float64(3.1415)},\n\t\t{pb.E_DefaultFloat, setFloat32, float32(3.14)},\n\t\t{pb.E_DefaultInt32, setInt32, int32(42)},\n\t\t{pb.E_DefaultInt64, setInt64, int64(43)},\n\t\t{pb.E_DefaultUint32, setUint32, uint32(44)},\n\t\t{pb.E_DefaultUint64, setUint64, uint64(45)},\n\t\t{pb.E_DefaultSint32, setInt32, int32(46)},\n\t\t{pb.E_DefaultSint64, setInt64, int64(47)},\n\t\t{pb.E_DefaultFixed32, setUint32, uint32(48)},\n\t\t{pb.E_DefaultFixed64, setUint64, uint64(49)},\n\t\t{pb.E_DefaultSfixed32, setInt32, int32(50)},\n\t\t{pb.E_DefaultSfixed64, setInt64, int64(51)},\n\t\t{pb.E_DefaultBool, setBool, true},\n\t\t{pb.E_DefaultBool, setBool2, true},\n\t\t{pb.E_DefaultString, setString, \"Hello, string\"},\n\t\t{pb.E_DefaultBytes, setBytes, []byte(\"Hello, bytes\")},\n\t\t{pb.E_DefaultEnum, setEnum, pb.DefaultsMessage_ONE},\n\t}\n\n\tcheckVal := func(test testcase, msg *pb.DefaultsMessage, valWant interface{}) error {\n\t\tval, err := proto.GetExtension(msg, test.ext)\n\t\tif err != nil {\n\t\t\tif valWant != nil {\n\t\t\t\treturn fmt.Errorf(\"GetExtension(): %s\", err)\n\t\t\t}\n\t\t\tif want := proto.ErrMissingExtension; err != want {\n\t\t\t\treturn fmt.Errorf(\"Unexpected error: got %v, want %v\", err, want)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// All proto2 extension values are either a pointer to a value or a slice of values.\n\t\tty := reflect.TypeOf(val)\n\t\ttyWant := reflect.TypeOf(test.ext.ExtensionType)\n\t\tif got, want := ty, tyWant; got != want {\n\t\t\treturn fmt.Errorf(\"unexpected reflect.TypeOf(): got %v want %v\", got, want)\n\t\t}\n\t\ttye := ty.Elem()\n\t\ttyeWant := tyWant.Elem()\n\t\tif got, want := tye, tyeWant; got != want {\n\t\t\treturn fmt.Errorf(\"unexpected reflect.TypeOf().Elem(): got %v want %v\", got, want)\n\t\t}\n\n\t\t// Check the name of the type of the value.\n\t\t// If it is an enum it will be type int32 with the name of the enum.\n\t\tif got, want := tye.Name(), tye.Name(); got != want {\n\t\t\treturn fmt.Errorf(\"unexpected reflect.TypeOf().Elem().Name(): got %v want %v\", got, want)\n\t\t}\n\n\t\t// Check that value is what we expect.\n\t\t// If we have a pointer in val, get the value it points to.\n\t\tvalExp := val\n\t\tif ty.Kind() == reflect.Ptr {\n\t\t\tvalExp = reflect.ValueOf(val).Elem().Interface()\n\t\t}\n\t\tif got, want := valExp, valWant; !reflect.DeepEqual(got, want) {\n\t\t\treturn fmt.Errorf(\"unexpected reflect.DeepEqual(): got %v want %v\", got, want)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tsetTo := func(test testcase) interface{} {\n\t\tsetTo := reflect.ValueOf(test.want)\n\t\tif typ := reflect.TypeOf(test.ext.ExtensionType); typ.Kind() == reflect.Ptr {\n\t\t\tsetTo = reflect.New(typ).Elem()\n\t\t\tsetTo.Set(reflect.New(setTo.Type().Elem()))\n\t\t\tsetTo.Elem().Set(reflect.ValueOf(test.want))\n\t\t}\n\t\treturn setTo.Interface()\n\t}\n\n\tfor _, test := range tests {\n\t\tmsg := &pb.DefaultsMessage{}\n\t\tname := test.ext.Name\n\n\t\t// Check the initial value.\n\t\tif err := checkVal(test, msg, test.def); err != nil {\n\t\t\tt.Errorf(\"%s: %v\", name, err)\n\t\t}\n\n\t\t// Set the per-type value and check value.\n\t\tname = fmt.Sprintf(\"%s (set to %T %v)\", name, test.want, test.want)\n\t\tif err := proto.SetExtension(msg, test.ext, setTo(test)); err != nil {\n\t\t\tt.Errorf(\"%s: SetExtension(): %v\", name, err)\n\t\t\tcontinue\n\t\t}\n\t\tif err := checkVal(test, msg, test.want); err != nil {\n\t\t\tt.Errorf(\"%s: %v\", name, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Set and check the value.\n\t\tname += \" (cleared)\"\n\t\tproto.ClearExtension(msg, test.ext)\n\t\tif err := checkVal(test, msg, test.def); err != nil {\n\t\t\tt.Errorf(\"%s: %v\", name, err)\n\t\t}\n\t}\n}\n\nfunc TestExtensionsRoundTrip(t *testing.T) {\n\tmsg := &pb.MyMessage{}\n\text1 := &pb.Ext{\n\t\tData: proto.String(\"hi\"),\n\t}\n\text2 := &pb.Ext{\n\t\tData: proto.String(\"there\"),\n\t}\n\texists := proto.HasExtension(msg, pb.E_Ext_More)\n\tif exists {\n\t\tt.Error(\"Extension More present unexpectedly\")\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil {\n\t\tt.Error(err)\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, ext2); err != nil {\n\t\tt.Error(err)\n\t}\n\te, err := proto.GetExtension(msg, pb.E_Ext_More)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tx, ok := e.(*pb.Ext)\n\tif !ok {\n\t\tt.Errorf(\"e has type %T, expected testdata.Ext\", e)\n\t} else if *x.Data != \"there\" {\n\t\tt.Errorf(\"SetExtension failed to overwrite, got %+v, not 'there'\", x)\n\t}\n\tproto.ClearExtension(msg, pb.E_Ext_More)\n\tif _, err = proto.GetExtension(msg, pb.E_Ext_More); err != proto.ErrMissingExtension {\n\t\tt.Errorf(\"got %v, expected ErrMissingExtension\", e)\n\t}\n\tif _, err := proto.GetExtension(msg, pb.E_X215); err == nil {\n\t\tt.Error(\"expected bad extension error, got nil\")\n\t}\n\tif err := proto.SetExtension(msg, pb.E_X215, 12); err == nil {\n\t\tt.Error(\"expected extension err\")\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, 12); err == nil {\n\t\tt.Error(\"expected some sort of type mismatch error, got nil\")\n\t}\n}\n\nfunc TestNilExtension(t *testing.T) {\n\tmsg := &pb.MyMessage{\n\t\tCount: proto.Int32(1),\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_Text, proto.String(\"hello\")); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, (*pb.Ext)(nil)); err == nil {\n\t\tt.Error(\"expected SetExtension to fail due to a nil extension\")\n\t} else if want := \"proto: SetExtension called with nil value of type *testdata.Ext\"; err.Error() != want {\n\t\tt.Errorf(\"expected error %v, got %v\", want, err)\n\t}\n\t// Note: if the behavior of Marshal is ever changed to ignore nil extensions, update\n\t// this test to verify that E_Ext_Text is properly propagated through marshal->unmarshal.\n}\n\nfunc TestMarshalUnmarshalRepeatedExtension(t *testing.T) {\n\t// Add a repeated extension to the result.\n\ttests := []struct {\n\t\tname string\n\t\text  []*pb.ComplexExtension\n\t}{\n\t\t{\n\t\t\t\"two fields\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{First: proto.Int32(7)},\n\t\t\t\t{Second: proto.Int32(11)},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"repeated field\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"two fields and repeated field\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{First: proto.Int32(9)},\n\t\t\t\t{Second: proto.Int32(21)},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\t// Marshal message with a repeated extension.\n\t\tmsg1 := new(pb.OtherMessage)\n\t\terr := proto.SetExtension(msg1, pb.E_RComplex, test.ext)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error setting extension: %v\", test.name, err)\n\t\t}\n\t\tb, err := proto.Marshal(msg1)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error marshaling message: %v\", test.name, err)\n\t\t}\n\n\t\t// Unmarshal and read the merged proto.\n\t\tmsg2 := new(pb.OtherMessage)\n\t\terr = proto.Unmarshal(b, msg2)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error unmarshaling message: %v\", test.name, err)\n\t\t}\n\t\te, err := proto.GetExtension(msg2, pb.E_RComplex)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error getting extension: %v\", test.name, err)\n\t\t}\n\t\text := e.([]*pb.ComplexExtension)\n\t\tif ext == nil {\n\t\t\tt.Fatalf(\"[%s] Invalid extension\", test.name)\n\t\t}\n\t\tif !reflect.DeepEqual(ext, test.ext) {\n\t\t\tt.Errorf(\"[%s] Wrong value for ComplexExtension: got: %v want: %v\\n\", test.name, ext, test.ext)\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalRepeatingNonRepeatedExtension(t *testing.T) {\n\t// We may see multiple instances of the same extension in the wire\n\t// format. For example, the proto compiler may encode custom options in\n\t// this way. Here, we verify that we merge the extensions together.\n\ttests := []struct {\n\t\tname string\n\t\text  []*pb.ComplexExtension\n\t}{\n\t\t{\n\t\t\t\"two fields\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{First: proto.Int32(7)},\n\t\t\t\t{Second: proto.Int32(11)},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"repeated field\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"two fields and repeated field\",\n\t\t\t[]*pb.ComplexExtension{\n\t\t\t\t{Third: []int32{1000}},\n\t\t\t\t{First: proto.Int32(9)},\n\t\t\t\t{Second: proto.Int32(21)},\n\t\t\t\t{Third: []int32{2000}},\n\t\t\t},\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tvar buf bytes.Buffer\n\t\tvar want pb.ComplexExtension\n\n\t\t// Generate a serialized representation of a repeated extension\n\t\t// by catenating bytes together.\n\t\tfor i, e := range test.ext {\n\t\t\t// Merge to create the wanted proto.\n\t\t\tproto.Merge(&want, e)\n\n\t\t\t// serialize the message\n\t\t\tmsg := new(pb.OtherMessage)\n\t\t\terr := proto.SetExtension(msg, pb.E_Complex, e)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"[%s] Error setting extension %d: %v\", test.name, i, err)\n\t\t\t}\n\t\t\tb, err := proto.Marshal(msg)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"[%s] Error marshaling message %d: %v\", test.name, i, err)\n\t\t\t}\n\t\t\tbuf.Write(b)\n\t\t}\n\n\t\t// Unmarshal and read the merged proto.\n\t\tmsg2 := new(pb.OtherMessage)\n\t\terr := proto.Unmarshal(buf.Bytes(), msg2)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error unmarshaling message: %v\", test.name, err)\n\t\t}\n\t\te, err := proto.GetExtension(msg2, pb.E_Complex)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"[%s] Error getting extension: %v\", test.name, err)\n\t\t}\n\t\text := e.(*pb.ComplexExtension)\n\t\tif ext == nil {\n\t\t\tt.Fatalf(\"[%s] Invalid extension\", test.name)\n\t\t}\n\t\tif !reflect.DeepEqual(*ext, want) {\n\t\t\tt.Errorf(\"[%s] Wrong value for ComplexExtension: got: %s want: %s\\n\", test.name, ext, &want)\n\t\t}\n\t}\n}\n\nfunc TestClearAllExtensions(t *testing.T) {\n\t// unregistered extension\n\tdesc := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         101010100,\n\t\tName:          \"emptyextension\",\n\t\tTag:           \"varint,0,opt\",\n\t}\n\tm := &pb.MyMessage{}\n\tif proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got true, want false\", proto.MarshalTextString(m))\n\t}\n\tif err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {\n\t\tt.Errorf(\"proto.SetExtension(m, desc, true): got error %q, want nil\", err)\n\t}\n\tif !proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got false, want true\", proto.MarshalTextString(m))\n\t}\n\tproto.ClearAllExtensions(m)\n\tif proto.HasExtension(m, desc) {\n\t\tt.Errorf(\"proto.HasExtension(%s): got true, want false\", proto.MarshalTextString(m))\n\t}\n}\n\nfunc TestMarshalRace(t *testing.T) {\n\t// unregistered extension\n\tdesc := &proto.ExtensionDesc{\n\t\tExtendedType:  (*pb.MyMessage)(nil),\n\t\tExtensionType: (*bool)(nil),\n\t\tField:         101010100,\n\t\tName:          \"emptyextension\",\n\t\tTag:           \"varint,0,opt\",\n\t}\n\n\tm := &pb.MyMessage{Count: proto.Int32(4)}\n\tif err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil {\n\t\tt.Errorf(\"proto.SetExtension(m, desc, true): got error %q, want nil\", err)\n\t}\n\n\tvar g errgroup.Group\n\tfor n := 3; n > 0; n-- {\n\t\tg.Go(func() error {\n\t\t\t_, err := proto.Marshal(m)\n\t\t\treturn err\n\t\t})\n\t}\n\tif err := g.Wait(); err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/lib.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/*\nPackage proto converts data structures to and from the wire format of\nprotocol buffers.  It works in concert with the Go source code generated\nfor .proto files by the protocol compiler.\n\nA summary of the properties of the protocol buffer interface\nfor a protocol buffer variable v:\n\n  - Names are turned from camel_case to CamelCase for export.\n  - There are no methods on v to set fields; just treat\n\tthem as structure fields.\n  - There are getters that return a field's value if set,\n\tand return the field's default value if unset.\n\tThe getters work even if the receiver is a nil message.\n  - The zero value for a struct is its correct initialization state.\n\tAll desired fields must be set before marshaling.\n  - A Reset() method will restore a protobuf struct to its zero state.\n  - Non-repeated fields are pointers to the values; nil means unset.\n\tThat is, optional or required field int32 f becomes F *int32.\n  - Repeated fields are slices.\n  - Helper functions are available to aid the setting of fields.\n\tmsg.Foo = proto.String(\"hello\") // set field\n  - Constants are defined to hold the default values of all fields that\n\thave them.  They have the form Default_StructName_FieldName.\n\tBecause the getter methods handle defaulted values,\n\tdirect use of these constants should be rare.\n  - Enums are given type names and maps from names to values.\n\tEnum values are prefixed by the enclosing message's name, or by the\n\tenum's type name if it is a top-level enum. Enum types have a String\n\tmethod, and a Enum method to assist in message construction.\n  - Nested messages, groups and enums have type names prefixed with the name of\n\tthe surrounding message type.\n  - Extensions are given descriptor names that start with E_,\n\tfollowed by an underscore-delimited list of the nested messages\n\tthat contain it (if any) followed by the CamelCased name of the\n\textension field itself.  HasExtension, ClearExtension, GetExtension\n\tand SetExtension are functions for manipulating extensions.\n  - Oneof field sets are given a single field in their message,\n\twith distinguished wrapper types for each possible field value.\n  - Marshal and Unmarshal are functions to encode and decode the wire format.\n\nWhen the .proto file specifies `syntax=\"proto3\"`, there are some differences:\n\n  - Non-repeated fields of non-message type are values instead of pointers.\n  - Enum types do not get an Enum method.\n\nThe simplest way to describe this is to see an example.\nGiven file test.proto, containing\n\n\tpackage example;\n\n\tenum FOO { X = 17; }\n\n\tmessage Test {\n\t  required string label = 1;\n\t  optional int32 type = 2 [default=77];\n\t  repeated int64 reps = 3;\n\t  optional group OptionalGroup = 4 {\n\t    required string RequiredField = 5;\n\t  }\n\t  oneof union {\n\t    int32 number = 6;\n\t    string name = 7;\n\t  }\n\t}\n\nThe resulting file, test.pb.go, is:\n\n\tpackage example\n\n\timport proto \"github.com/golang/protobuf/proto\"\n\timport math \"math\"\n\n\ttype FOO int32\n\tconst (\n\t\tFOO_X FOO = 17\n\t)\n\tvar FOO_name = map[int32]string{\n\t\t17: \"X\",\n\t}\n\tvar FOO_value = map[string]int32{\n\t\t\"X\": 17,\n\t}\n\n\tfunc (x FOO) Enum() *FOO {\n\t\tp := new(FOO)\n\t\t*p = x\n\t\treturn p\n\t}\n\tfunc (x FOO) String() string {\n\t\treturn proto.EnumName(FOO_name, int32(x))\n\t}\n\tfunc (x *FOO) UnmarshalJSON(data []byte) error {\n\t\tvalue, err := proto.UnmarshalJSONEnum(FOO_value, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*x = FOO(value)\n\t\treturn nil\n\t}\n\n\ttype Test struct {\n\t\tLabel         *string             `protobuf:\"bytes,1,req,name=label\" json:\"label,omitempty\"`\n\t\tType          *int32              `protobuf:\"varint,2,opt,name=type,def=77\" json:\"type,omitempty\"`\n\t\tReps          []int64             `protobuf:\"varint,3,rep,name=reps\" json:\"reps,omitempty\"`\n\t\tOptionalgroup *Test_OptionalGroup `protobuf:\"group,4,opt,name=OptionalGroup\" json:\"optionalgroup,omitempty\"`\n\t\t// Types that are valid to be assigned to Union:\n\t\t//\t*Test_Number\n\t\t//\t*Test_Name\n\t\tUnion            isTest_Union `protobuf_oneof:\"union\"`\n\t\tXXX_unrecognized []byte       `json:\"-\"`\n\t}\n\tfunc (m *Test) Reset()         { *m = Test{} }\n\tfunc (m *Test) String() string { return proto.CompactTextString(m) }\n\tfunc (*Test) ProtoMessage() {}\n\n\ttype isTest_Union interface {\n\t\tisTest_Union()\n\t}\n\n\ttype Test_Number struct {\n\t\tNumber int32 `protobuf:\"varint,6,opt,name=number\"`\n\t}\n\ttype Test_Name struct {\n\t\tName string `protobuf:\"bytes,7,opt,name=name\"`\n\t}\n\n\tfunc (*Test_Number) isTest_Union() {}\n\tfunc (*Test_Name) isTest_Union()   {}\n\n\tfunc (m *Test) GetUnion() isTest_Union {\n\t\tif m != nil {\n\t\t\treturn m.Union\n\t\t}\n\t\treturn nil\n\t}\n\tconst Default_Test_Type int32 = 77\n\n\tfunc (m *Test) GetLabel() string {\n\t\tif m != nil && m.Label != nil {\n\t\t\treturn *m.Label\n\t\t}\n\t\treturn \"\"\n\t}\n\n\tfunc (m *Test) GetType() int32 {\n\t\tif m != nil && m.Type != nil {\n\t\t\treturn *m.Type\n\t\t}\n\t\treturn Default_Test_Type\n\t}\n\n\tfunc (m *Test) GetOptionalgroup() *Test_OptionalGroup {\n\t\tif m != nil {\n\t\t\treturn m.Optionalgroup\n\t\t}\n\t\treturn nil\n\t}\n\n\ttype Test_OptionalGroup struct {\n\t\tRequiredField *string `protobuf:\"bytes,5,req\" json:\"RequiredField,omitempty\"`\n\t}\n\tfunc (m *Test_OptionalGroup) Reset()         { *m = Test_OptionalGroup{} }\n\tfunc (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }\n\n\tfunc (m *Test_OptionalGroup) GetRequiredField() string {\n\t\tif m != nil && m.RequiredField != nil {\n\t\t\treturn *m.RequiredField\n\t\t}\n\t\treturn \"\"\n\t}\n\n\tfunc (m *Test) GetNumber() int32 {\n\t\tif x, ok := m.GetUnion().(*Test_Number); ok {\n\t\t\treturn x.Number\n\t\t}\n\t\treturn 0\n\t}\n\n\tfunc (m *Test) GetName() string {\n\t\tif x, ok := m.GetUnion().(*Test_Name); ok {\n\t\t\treturn x.Name\n\t\t}\n\t\treturn \"\"\n\t}\n\n\tfunc init() {\n\t\tproto.RegisterEnum(\"example.FOO\", FOO_name, FOO_value)\n\t}\n\nTo create and play with a Test object:\n\n\tpackage main\n\n\timport (\n\t\t\"log\"\n\n\t\t\"github.com/golang/protobuf/proto\"\n\t\tpb \"./example.pb\"\n\t)\n\n\tfunc main() {\n\t\ttest := &pb.Test{\n\t\t\tLabel: proto.String(\"hello\"),\n\t\t\tType:  proto.Int32(17),\n\t\t\tReps:  []int64{1, 2, 3},\n\t\t\tOptionalgroup: &pb.Test_OptionalGroup{\n\t\t\t\tRequiredField: proto.String(\"good bye\"),\n\t\t\t},\n\t\t\tUnion: &pb.Test_Name{\"fred\"},\n\t\t}\n\t\tdata, err := proto.Marshal(test)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"marshaling error: \", err)\n\t\t}\n\t\tnewTest := &pb.Test{}\n\t\terr = proto.Unmarshal(data, newTest)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"unmarshaling error: \", err)\n\t\t}\n\t\t// Now test and newTest contain the same data.\n\t\tif test.GetLabel() != newTest.GetLabel() {\n\t\t\tlog.Fatalf(\"data mismatch %q != %q\", test.GetLabel(), newTest.GetLabel())\n\t\t}\n\t\t// Use a type switch to determine which oneof was set.\n\t\tswitch u := test.Union.(type) {\n\t\tcase *pb.Test_Number: // u.Number contains the number.\n\t\tcase *pb.Test_Name: // u.Name contains the string.\n\t\t}\n\t\t// etc.\n\t}\n*/\npackage proto\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n\t\"sync\"\n)\n\n// Message is implemented by generated protocol buffer messages.\ntype Message interface {\n\tReset()\n\tString() string\n\tProtoMessage()\n}\n\n// Stats records allocation details about the protocol buffer encoders\n// and decoders.  Useful for tuning the library itself.\ntype Stats struct {\n\tEmalloc uint64 // mallocs in encode\n\tDmalloc uint64 // mallocs in decode\n\tEncode  uint64 // number of encodes\n\tDecode  uint64 // number of decodes\n\tChit    uint64 // number of cache hits\n\tCmiss   uint64 // number of cache misses\n\tSize    uint64 // number of sizes\n}\n\n// Set to true to enable stats collection.\nconst collectStats = false\n\nvar stats Stats\n\n// GetStats returns a copy of the global Stats structure.\nfunc GetStats() Stats { return stats }\n\n// A Buffer is a buffer manager for marshaling and unmarshaling\n// protocol buffers.  It may be reused between invocations to\n// reduce memory usage.  It is not necessary to use a Buffer;\n// the global functions Marshal and Unmarshal create a\n// temporary Buffer and are fine for most applications.\ntype Buffer struct {\n\tbuf   []byte // encode/decode byte stream\n\tindex int    // read point\n\n\t// pools of basic types to amortize allocation.\n\tbools   []bool\n\tuint32s []uint32\n\tuint64s []uint64\n\n\t// extra pools, only used with pointer_reflect.go\n\tint32s   []int32\n\tint64s   []int64\n\tfloat32s []float32\n\tfloat64s []float64\n}\n\n// NewBuffer allocates a new Buffer and initializes its internal data to\n// the contents of the argument slice.\nfunc NewBuffer(e []byte) *Buffer {\n\treturn &Buffer{buf: e}\n}\n\n// Reset resets the Buffer, ready for marshaling a new protocol buffer.\nfunc (p *Buffer) Reset() {\n\tp.buf = p.buf[0:0] // for reading/writing\n\tp.index = 0        // for reading\n}\n\n// SetBuf replaces the internal buffer with the slice,\n// ready for unmarshaling the contents of the slice.\nfunc (p *Buffer) SetBuf(s []byte) {\n\tp.buf = s\n\tp.index = 0\n}\n\n// Bytes returns the contents of the Buffer.\nfunc (p *Buffer) Bytes() []byte { return p.buf }\n\n/*\n * Helper routines for simplifying the creation of optional fields of basic type.\n */\n\n// Bool is a helper routine that allocates a new bool value\n// to store v and returns a pointer to it.\nfunc Bool(v bool) *bool {\n\treturn &v\n}\n\n// Int32 is a helper routine that allocates a new int32 value\n// to store v and returns a pointer to it.\nfunc Int32(v int32) *int32 {\n\treturn &v\n}\n\n// Int is a helper routine that allocates a new int32 value\n// to store v and returns a pointer to it, but unlike Int32\n// its argument value is an int.\nfunc Int(v int) *int32 {\n\tp := new(int32)\n\t*p = int32(v)\n\treturn p\n}\n\n// Int64 is a helper routine that allocates a new int64 value\n// to store v and returns a pointer to it.\nfunc Int64(v int64) *int64 {\n\treturn &v\n}\n\n// Float32 is a helper routine that allocates a new float32 value\n// to store v and returns a pointer to it.\nfunc Float32(v float32) *float32 {\n\treturn &v\n}\n\n// Float64 is a helper routine that allocates a new float64 value\n// to store v and returns a pointer to it.\nfunc Float64(v float64) *float64 {\n\treturn &v\n}\n\n// Uint32 is a helper routine that allocates a new uint32 value\n// to store v and returns a pointer to it.\nfunc Uint32(v uint32) *uint32 {\n\treturn &v\n}\n\n// Uint64 is a helper routine that allocates a new uint64 value\n// to store v and returns a pointer to it.\nfunc Uint64(v uint64) *uint64 {\n\treturn &v\n}\n\n// String is a helper routine that allocates a new string value\n// to store v and returns a pointer to it.\nfunc String(v string) *string {\n\treturn &v\n}\n\n// EnumName is a helper function to simplify printing protocol buffer enums\n// by name.  Given an enum map and a value, it returns a useful string.\nfunc EnumName(m map[int32]string, v int32) string {\n\ts, ok := m[v]\n\tif ok {\n\t\treturn s\n\t}\n\treturn strconv.Itoa(int(v))\n}\n\n// UnmarshalJSONEnum is a helper function to simplify recovering enum int values\n// from their JSON-encoded representation. Given a map from the enum's symbolic\n// names to its int values, and a byte buffer containing the JSON-encoded\n// value, it returns an int32 that can be cast to the enum type by the caller.\n//\n// The function can deal with both JSON representations, numeric and symbolic.\nfunc UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {\n\tif data[0] == '\"' {\n\t\t// New style: enums are strings.\n\t\tvar repr string\n\t\tif err := json.Unmarshal(data, &repr); err != nil {\n\t\t\treturn -1, err\n\t\t}\n\t\tval, ok := m[repr]\n\t\tif !ok {\n\t\t\treturn 0, fmt.Errorf(\"unrecognized enum %s value %q\", enumName, repr)\n\t\t}\n\t\treturn val, nil\n\t}\n\t// Old style: enums are ints.\n\tvar val int32\n\tif err := json.Unmarshal(data, &val); err != nil {\n\t\treturn 0, fmt.Errorf(\"cannot unmarshal %#q into enum %s\", data, enumName)\n\t}\n\treturn val, nil\n}\n\n// DebugPrint dumps the encoded data in b in a debugging format with a header\n// including the string s. Used in testing but made available for general debugging.\nfunc (p *Buffer) DebugPrint(s string, b []byte) {\n\tvar u uint64\n\n\tobuf := p.buf\n\tindex := p.index\n\tp.buf = b\n\tp.index = 0\n\tdepth := 0\n\n\tfmt.Printf(\"\\n--- %s ---\\n\", s)\n\nout:\n\tfor {\n\t\tfor i := 0; i < depth; i++ {\n\t\t\tfmt.Print(\"  \")\n\t\t}\n\n\t\tindex := p.index\n\t\tif index == len(p.buf) {\n\t\t\tbreak\n\t\t}\n\n\t\top, err := p.DecodeVarint()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%3d: fetching op err %v\\n\", index, err)\n\t\t\tbreak out\n\t\t}\n\t\ttag := op >> 3\n\t\twire := op & 7\n\n\t\tswitch wire {\n\t\tdefault:\n\t\t\tfmt.Printf(\"%3d: t=%3d unknown wire=%d\\n\",\n\t\t\t\tindex, tag, wire)\n\t\t\tbreak out\n\n\t\tcase WireBytes:\n\t\t\tvar r []byte\n\n\t\t\tr, err = p.DecodeRawBytes(false)\n\t\t\tif err != nil {\n\t\t\t\tbreak out\n\t\t\t}\n\t\t\tfmt.Printf(\"%3d: t=%3d bytes [%d]\", index, tag, len(r))\n\t\t\tif len(r) <= 6 {\n\t\t\t\tfor i := 0; i < len(r); i++ {\n\t\t\t\t\tfmt.Printf(\" %.2x\", r[i])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor i := 0; i < 3; i++ {\n\t\t\t\t\tfmt.Printf(\" %.2x\", r[i])\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\" ..\")\n\t\t\t\tfor i := len(r) - 3; i < len(r); i++ {\n\t\t\t\t\tfmt.Printf(\" %.2x\", r[i])\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Printf(\"\\n\")\n\n\t\tcase WireFixed32:\n\t\t\tu, err = p.DecodeFixed32()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"%3d: t=%3d fix32 err %v\\n\", index, tag, err)\n\t\t\t\tbreak out\n\t\t\t}\n\t\t\tfmt.Printf(\"%3d: t=%3d fix32 %d\\n\", index, tag, u)\n\n\t\tcase WireFixed64:\n\t\t\tu, err = p.DecodeFixed64()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"%3d: t=%3d fix64 err %v\\n\", index, tag, err)\n\t\t\t\tbreak out\n\t\t\t}\n\t\t\tfmt.Printf(\"%3d: t=%3d fix64 %d\\n\", index, tag, u)\n\n\t\tcase WireVarint:\n\t\t\tu, err = p.DecodeVarint()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"%3d: t=%3d varint err %v\\n\", index, tag, err)\n\t\t\t\tbreak out\n\t\t\t}\n\t\t\tfmt.Printf(\"%3d: t=%3d varint %d\\n\", index, tag, u)\n\n\t\tcase WireStartGroup:\n\t\t\tfmt.Printf(\"%3d: t=%3d start\\n\", index, tag)\n\t\t\tdepth++\n\n\t\tcase WireEndGroup:\n\t\t\tdepth--\n\t\t\tfmt.Printf(\"%3d: t=%3d end\\n\", index, tag)\n\t\t}\n\t}\n\n\tif depth != 0 {\n\t\tfmt.Printf(\"%3d: start-end not balanced %d\\n\", p.index, depth)\n\t}\n\tfmt.Printf(\"\\n\")\n\n\tp.buf = obuf\n\tp.index = index\n}\n\n// SetDefaults sets unset protocol buffer fields to their default values.\n// It only modifies fields that are both unset and have defined defaults.\n// It recursively sets default values in any non-nil sub-messages.\nfunc SetDefaults(pb Message) {\n\tsetDefaults(reflect.ValueOf(pb), true, false)\n}\n\n// v is a pointer to a struct.\nfunc setDefaults(v reflect.Value, recur, zeros bool) {\n\tv = v.Elem()\n\n\tdefaultMu.RLock()\n\tdm, ok := defaults[v.Type()]\n\tdefaultMu.RUnlock()\n\tif !ok {\n\t\tdm = buildDefaultMessage(v.Type())\n\t\tdefaultMu.Lock()\n\t\tdefaults[v.Type()] = dm\n\t\tdefaultMu.Unlock()\n\t}\n\n\tfor _, sf := range dm.scalars {\n\t\tf := v.Field(sf.index)\n\t\tif !f.IsNil() {\n\t\t\t// field already set\n\t\t\tcontinue\n\t\t}\n\t\tdv := sf.value\n\t\tif dv == nil && !zeros {\n\t\t\t// no explicit default, and don't want to set zeros\n\t\t\tcontinue\n\t\t}\n\t\tfptr := f.Addr().Interface() // **T\n\t\t// TODO: Consider batching the allocations we do here.\n\t\tswitch sf.kind {\n\t\tcase reflect.Bool:\n\t\t\tb := new(bool)\n\t\t\tif dv != nil {\n\t\t\t\t*b = dv.(bool)\n\t\t\t}\n\t\t\t*(fptr.(**bool)) = b\n\t\tcase reflect.Float32:\n\t\t\tf := new(float32)\n\t\t\tif dv != nil {\n\t\t\t\t*f = dv.(float32)\n\t\t\t}\n\t\t\t*(fptr.(**float32)) = f\n\t\tcase reflect.Float64:\n\t\t\tf := new(float64)\n\t\t\tif dv != nil {\n\t\t\t\t*f = dv.(float64)\n\t\t\t}\n\t\t\t*(fptr.(**float64)) = f\n\t\tcase reflect.Int32:\n\t\t\t// might be an enum\n\t\t\tif ft := f.Type(); ft != int32PtrType {\n\t\t\t\t// enum\n\t\t\t\tf.Set(reflect.New(ft.Elem()))\n\t\t\t\tif dv != nil {\n\t\t\t\t\tf.Elem().SetInt(int64(dv.(int32)))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// int32 field\n\t\t\t\ti := new(int32)\n\t\t\t\tif dv != nil {\n\t\t\t\t\t*i = dv.(int32)\n\t\t\t\t}\n\t\t\t\t*(fptr.(**int32)) = i\n\t\t\t}\n\t\tcase reflect.Int64:\n\t\t\ti := new(int64)\n\t\t\tif dv != nil {\n\t\t\t\t*i = dv.(int64)\n\t\t\t}\n\t\t\t*(fptr.(**int64)) = i\n\t\tcase reflect.String:\n\t\t\ts := new(string)\n\t\t\tif dv != nil {\n\t\t\t\t*s = dv.(string)\n\t\t\t}\n\t\t\t*(fptr.(**string)) = s\n\t\tcase reflect.Uint8:\n\t\t\t// exceptional case: []byte\n\t\t\tvar b []byte\n\t\t\tif dv != nil {\n\t\t\t\tdb := dv.([]byte)\n\t\t\t\tb = make([]byte, len(db))\n\t\t\t\tcopy(b, db)\n\t\t\t} else {\n\t\t\t\tb = []byte{}\n\t\t\t}\n\t\t\t*(fptr.(*[]byte)) = b\n\t\tcase reflect.Uint32:\n\t\t\tu := new(uint32)\n\t\t\tif dv != nil {\n\t\t\t\t*u = dv.(uint32)\n\t\t\t}\n\t\t\t*(fptr.(**uint32)) = u\n\t\tcase reflect.Uint64:\n\t\t\tu := new(uint64)\n\t\t\tif dv != nil {\n\t\t\t\t*u = dv.(uint64)\n\t\t\t}\n\t\t\t*(fptr.(**uint64)) = u\n\t\tdefault:\n\t\t\tlog.Printf(\"proto: can't set default for field %v (sf.kind=%v)\", f, sf.kind)\n\t\t}\n\t}\n\n\tfor _, ni := range dm.nested {\n\t\tf := v.Field(ni)\n\t\t// f is *T or []*T or map[T]*T\n\t\tswitch f.Kind() {\n\t\tcase reflect.Ptr:\n\t\t\tif f.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsetDefaults(f, recur, zeros)\n\n\t\tcase reflect.Slice:\n\t\t\tfor i := 0; i < f.Len(); i++ {\n\t\t\t\te := f.Index(i)\n\t\t\t\tif e.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsetDefaults(e, recur, zeros)\n\t\t\t}\n\n\t\tcase reflect.Map:\n\t\t\tfor _, k := range f.MapKeys() {\n\t\t\t\te := f.MapIndex(k)\n\t\t\t\tif e.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsetDefaults(e, recur, zeros)\n\t\t\t}\n\t\t}\n\t}\n}\n\nvar (\n\t// defaults maps a protocol buffer struct type to a slice of the fields,\n\t// with its scalar fields set to their proto-declared non-zero default values.\n\tdefaultMu sync.RWMutex\n\tdefaults  = make(map[reflect.Type]defaultMessage)\n\n\tint32PtrType = reflect.TypeOf((*int32)(nil))\n)\n\n// defaultMessage represents information about the default values of a message.\ntype defaultMessage struct {\n\tscalars []scalarField\n\tnested  []int // struct field index of nested messages\n}\n\ntype scalarField struct {\n\tindex int          // struct field index\n\tkind  reflect.Kind // element type (the T in *T or []T)\n\tvalue interface{}  // the proto-declared default value, or nil\n}\n\n// t is a struct type.\nfunc buildDefaultMessage(t reflect.Type) (dm defaultMessage) {\n\tsprop := GetProperties(t)\n\tfor _, prop := range sprop.Prop {\n\t\tfi, ok := sprop.decoderTags.get(prop.Tag)\n\t\tif !ok {\n\t\t\t// XXX_unrecognized\n\t\t\tcontinue\n\t\t}\n\t\tft := t.Field(fi).Type\n\n\t\tsf, nested, err := fieldDefault(ft, prop)\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\tlog.Print(err)\n\t\tcase nested:\n\t\t\tdm.nested = append(dm.nested, fi)\n\t\tcase sf != nil:\n\t\t\tsf.index = fi\n\t\t\tdm.scalars = append(dm.scalars, *sf)\n\t\t}\n\t}\n\n\treturn dm\n}\n\n// fieldDefault returns the scalarField for field type ft.\n// sf will be nil if the field can not have a default.\n// nestedMessage will be true if this is a nested message.\n// Note that sf.index is not set on return.\nfunc fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {\n\tvar canHaveDefault bool\n\tswitch ft.Kind() {\n\tcase reflect.Ptr:\n\t\tif ft.Elem().Kind() == reflect.Struct {\n\t\t\tnestedMessage = true\n\t\t} else {\n\t\t\tcanHaveDefault = true // proto2 scalar field\n\t\t}\n\n\tcase reflect.Slice:\n\t\tswitch ft.Elem().Kind() {\n\t\tcase reflect.Ptr:\n\t\t\tnestedMessage = true // repeated message\n\t\tcase reflect.Uint8:\n\t\t\tcanHaveDefault = true // bytes field\n\t\t}\n\n\tcase reflect.Map:\n\t\tif ft.Elem().Kind() == reflect.Ptr {\n\t\t\tnestedMessage = true // map with message values\n\t\t}\n\t}\n\n\tif !canHaveDefault {\n\t\tif nestedMessage {\n\t\t\treturn nil, true, nil\n\t\t}\n\t\treturn nil, false, nil\n\t}\n\n\t// We now know that ft is a pointer or slice.\n\tsf = &scalarField{kind: ft.Elem().Kind()}\n\n\t// scalar fields without defaults\n\tif !prop.HasDefault {\n\t\treturn sf, false, nil\n\t}\n\n\t// a scalar field: either *T or []byte\n\tswitch ft.Elem().Kind() {\n\tcase reflect.Bool:\n\t\tx, err := strconv.ParseBool(prop.Default)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default bool %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = x\n\tcase reflect.Float32:\n\t\tx, err := strconv.ParseFloat(prop.Default, 32)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default float32 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = float32(x)\n\tcase reflect.Float64:\n\t\tx, err := strconv.ParseFloat(prop.Default, 64)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default float64 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = x\n\tcase reflect.Int32:\n\t\tx, err := strconv.ParseInt(prop.Default, 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default int32 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = int32(x)\n\tcase reflect.Int64:\n\t\tx, err := strconv.ParseInt(prop.Default, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default int64 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = x\n\tcase reflect.String:\n\t\tsf.value = prop.Default\n\tcase reflect.Uint8:\n\t\t// []byte (not *uint8)\n\t\tsf.value = []byte(prop.Default)\n\tcase reflect.Uint32:\n\t\tx, err := strconv.ParseUint(prop.Default, 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default uint32 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = uint32(x)\n\tcase reflect.Uint64:\n\t\tx, err := strconv.ParseUint(prop.Default, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"proto: bad default uint64 %q: %v\", prop.Default, err)\n\t\t}\n\t\tsf.value = x\n\tdefault:\n\t\treturn nil, false, fmt.Errorf(\"proto: unhandled def kind %v\", ft.Elem().Kind())\n\t}\n\n\treturn sf, false, nil\n}\n\n// Map fields may have key types of non-float scalars, strings and enums.\n// The easiest way to sort them in some deterministic order is to use fmt.\n// If this turns out to be inefficient we can always consider other options,\n// such as doing a Schwartzian transform.\n\nfunc mapKeys(vs []reflect.Value) sort.Interface {\n\ts := mapKeySorter{\n\t\tvs: vs,\n\t\t// default Less function: textual comparison\n\t\tless: func(a, b reflect.Value) bool {\n\t\t\treturn fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface())\n\t\t},\n\t}\n\n\t// Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps;\n\t// numeric keys are sorted numerically.\n\tif len(vs) == 0 {\n\t\treturn s\n\t}\n\tswitch vs[0].Kind() {\n\tcase reflect.Int32, reflect.Int64:\n\t\ts.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }\n\tcase reflect.Uint32, reflect.Uint64:\n\t\ts.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }\n\t}\n\n\treturn s\n}\n\ntype mapKeySorter struct {\n\tvs   []reflect.Value\n\tless func(a, b reflect.Value) bool\n}\n\nfunc (s mapKeySorter) Len() int      { return len(s.vs) }\nfunc (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }\nfunc (s mapKeySorter) Less(i, j int) bool {\n\treturn s.less(s.vs[i], s.vs[j])\n}\n\n// isProto3Zero reports whether v is a zero proto3 value.\nfunc isProto3Zero(v reflect.Value) bool {\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn !v.Bool()\n\tcase reflect.Int32, reflect.Int64:\n\t\treturn v.Int() == 0\n\tcase reflect.Uint32, reflect.Uint64:\n\t\treturn v.Uint() == 0\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn v.Float() == 0\n\tcase reflect.String:\n\t\treturn v.String() == \"\"\n\t}\n\treturn false\n}\n\n// ProtoPackageIsVersion2 is referenced from generated protocol buffer files\n// to assert that that code is compatible with this version of the proto package.\nconst ProtoPackageIsVersion2 = true\n\n// ProtoPackageIsVersion1 is referenced from generated protocol buffer files\n// to assert that that code is compatible with this version of the proto package.\nconst ProtoPackageIsVersion1 = true\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/map_test.go",
    "content": "package proto_test\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tppb \"github.com/golang/protobuf/proto/proto3_proto\"\n)\n\nfunc marshalled() []byte {\n\tm := &ppb.IntMaps{}\n\tfor i := 0; i < 1000; i++ {\n\t\tm.Maps = append(m.Maps, &ppb.IntMap{\n\t\t\tRtt: map[int32]int32{1: 2},\n\t\t})\n\t}\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Can't marshal %+v: %v\", m, err))\n\t}\n\treturn b\n}\n\nfunc BenchmarkConcurrentMapUnmarshal(b *testing.B) {\n\tin := marshalled()\n\tb.RunParallel(func(pb *testing.PB) {\n\t\tfor pb.Next() {\n\t\t\tvar out ppb.IntMaps\n\t\t\tif err := proto.Unmarshal(in, &out); err != nil {\n\t\t\t\tb.Errorf(\"Can't unmarshal ppb.IntMaps: %v\", err)\n\t\t\t}\n\t\t}\n\t})\n}\n\nfunc BenchmarkSequentialMapUnmarshal(b *testing.B) {\n\tin := marshalled()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tvar out ppb.IntMaps\n\t\tif err := proto.Unmarshal(in, &out); err != nil {\n\t\t\tb.Errorf(\"Can't unmarshal ppb.IntMaps: %v\", err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/message_set.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n/*\n * Support for message sets.\n */\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n)\n\n// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.\n// A message type ID is required for storing a protocol buffer in a message set.\nvar errNoMessageTypeID = errors.New(\"proto does not have a message type ID\")\n\n// The first two types (_MessageSet_Item and messageSet)\n// model what the protocol compiler produces for the following protocol message:\n//   message MessageSet {\n//     repeated group Item = 1 {\n//       required int32 type_id = 2;\n//       required string message = 3;\n//     };\n//   }\n// That is the MessageSet wire format. We can't use a proto to generate these\n// because that would introduce a circular dependency between it and this package.\n\ntype _MessageSet_Item struct {\n\tTypeId  *int32 `protobuf:\"varint,2,req,name=type_id\"`\n\tMessage []byte `protobuf:\"bytes,3,req,name=message\"`\n}\n\ntype messageSet struct {\n\tItem             []*_MessageSet_Item `protobuf:\"group,1,rep\"`\n\tXXX_unrecognized []byte\n\t// TODO: caching?\n}\n\n// Make sure messageSet is a Message.\nvar _ Message = (*messageSet)(nil)\n\n// messageTypeIder is an interface satisfied by a protocol buffer type\n// that may be stored in a MessageSet.\ntype messageTypeIder interface {\n\tMessageTypeId() int32\n}\n\nfunc (ms *messageSet) find(pb Message) *_MessageSet_Item {\n\tmti, ok := pb.(messageTypeIder)\n\tif !ok {\n\t\treturn nil\n\t}\n\tid := mti.MessageTypeId()\n\tfor _, item := range ms.Item {\n\t\tif *item.TypeId == id {\n\t\t\treturn item\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (ms *messageSet) Has(pb Message) bool {\n\tif ms.find(pb) != nil {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (ms *messageSet) Unmarshal(pb Message) error {\n\tif item := ms.find(pb); item != nil {\n\t\treturn Unmarshal(item.Message, pb)\n\t}\n\tif _, ok := pb.(messageTypeIder); !ok {\n\t\treturn errNoMessageTypeID\n\t}\n\treturn nil // TODO: return error instead?\n}\n\nfunc (ms *messageSet) Marshal(pb Message) error {\n\tmsg, err := Marshal(pb)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif item := ms.find(pb); item != nil {\n\t\t// reuse existing item\n\t\titem.Message = msg\n\t\treturn nil\n\t}\n\n\tmti, ok := pb.(messageTypeIder)\n\tif !ok {\n\t\treturn errNoMessageTypeID\n\t}\n\n\tmtid := mti.MessageTypeId()\n\tms.Item = append(ms.Item, &_MessageSet_Item{\n\t\tTypeId:  &mtid,\n\t\tMessage: msg,\n\t})\n\treturn nil\n}\n\nfunc (ms *messageSet) Reset()         { *ms = messageSet{} }\nfunc (ms *messageSet) String() string { return CompactTextString(ms) }\nfunc (*messageSet) ProtoMessage()     {}\n\n// Support for the message_set_wire_format message option.\n\nfunc skipVarint(buf []byte) []byte {\n\ti := 0\n\tfor ; buf[i]&0x80 != 0; i++ {\n\t}\n\treturn buf[i+1:]\n}\n\n// MarshalMessageSet encodes the extension map represented by m in the message set wire format.\n// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.\nfunc MarshalMessageSet(exts interface{}) ([]byte, error) {\n\tvar m map[int32]Extension\n\tswitch exts := exts.(type) {\n\tcase *XXX_InternalExtensions:\n\t\tif err := encodeExtensions(exts); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm, _ = exts.extensionsRead()\n\tcase map[int32]Extension:\n\t\tif err := encodeExtensionsMap(exts); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm = exts\n\tdefault:\n\t\treturn nil, errors.New(\"proto: not an extension map\")\n\t}\n\n\t// Sort extension IDs to provide a deterministic encoding.\n\t// See also enc_map in encode.go.\n\tids := make([]int, 0, len(m))\n\tfor id := range m {\n\t\tids = append(ids, int(id))\n\t}\n\tsort.Ints(ids)\n\n\tms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))}\n\tfor _, id := range ids {\n\t\te := m[int32(id)]\n\t\t// Remove the wire type and field number varint, as well as the length varint.\n\t\tmsg := skipVarint(skipVarint(e.enc))\n\n\t\tms.Item = append(ms.Item, &_MessageSet_Item{\n\t\t\tTypeId:  Int32(int32(id)),\n\t\t\tMessage: msg,\n\t\t})\n\t}\n\treturn Marshal(ms)\n}\n\n// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.\n// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.\nfunc UnmarshalMessageSet(buf []byte, exts interface{}) error {\n\tvar m map[int32]Extension\n\tswitch exts := exts.(type) {\n\tcase *XXX_InternalExtensions:\n\t\tm = exts.extensionsWrite()\n\tcase map[int32]Extension:\n\t\tm = exts\n\tdefault:\n\t\treturn errors.New(\"proto: not an extension map\")\n\t}\n\n\tms := new(messageSet)\n\tif err := Unmarshal(buf, ms); err != nil {\n\t\treturn err\n\t}\n\tfor _, item := range ms.Item {\n\t\tid := *item.TypeId\n\t\tmsg := item.Message\n\n\t\t// Restore wire type and field number varint, plus length varint.\n\t\t// Be careful to preserve duplicate items.\n\t\tb := EncodeVarint(uint64(id)<<3 | WireBytes)\n\t\tif ext, ok := m[id]; ok {\n\t\t\t// Existing data; rip off the tag and length varint\n\t\t\t// so we join the new data correctly.\n\t\t\t// We can assume that ext.enc is set because we are unmarshaling.\n\t\t\to := ext.enc[len(b):]   // skip wire type and field number\n\t\t\t_, n := DecodeVarint(o) // calculate length of length varint\n\t\t\to = o[n:]               // skip length varint\n\t\t\tmsg = append(o, msg...) // join old data and new data\n\t\t}\n\t\tb = append(b, EncodeVarint(uint64(len(msg)))...)\n\t\tb = append(b, msg...)\n\n\t\tm[id] = Extension{enc: b}\n\t}\n\treturn nil\n}\n\n// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.\n// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.\nfunc MarshalMessageSetJSON(exts interface{}) ([]byte, error) {\n\tvar m map[int32]Extension\n\tswitch exts := exts.(type) {\n\tcase *XXX_InternalExtensions:\n\t\tm, _ = exts.extensionsRead()\n\tcase map[int32]Extension:\n\t\tm = exts\n\tdefault:\n\t\treturn nil, errors.New(\"proto: not an extension map\")\n\t}\n\tvar b bytes.Buffer\n\tb.WriteByte('{')\n\n\t// Process the map in key order for deterministic output.\n\tids := make([]int32, 0, len(m))\n\tfor id := range m {\n\t\tids = append(ids, id)\n\t}\n\tsort.Sort(int32Slice(ids)) // int32Slice defined in text.go\n\n\tfor i, id := range ids {\n\t\text := m[id]\n\t\tif i > 0 {\n\t\t\tb.WriteByte(',')\n\t\t}\n\n\t\tmsd, ok := messageSetMap[id]\n\t\tif !ok {\n\t\t\t// Unknown type; we can't render it, so skip it.\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(&b, `\"[%s]\":`, msd.name)\n\n\t\tx := ext.value\n\t\tif x == nil {\n\t\t\tx = reflect.New(msd.t.Elem()).Interface()\n\t\t\tif err := Unmarshal(ext.enc, x.(Message)); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\td, err := json.Marshal(x)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb.Write(d)\n\t}\n\tb.WriteByte('}')\n\treturn b.Bytes(), nil\n}\n\n// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.\n// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.\nfunc UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {\n\t// Common-case fast path.\n\tif len(buf) == 0 || bytes.Equal(buf, []byte(\"{}\")) {\n\t\treturn nil\n\t}\n\n\t// This is fairly tricky, and it's not clear that it is needed.\n\treturn errors.New(\"TODO: UnmarshalMessageSetJSON not yet implemented\")\n}\n\n// A global registry of types that can be used in a MessageSet.\n\nvar messageSetMap = make(map[int32]messageSetDesc)\n\ntype messageSetDesc struct {\n\tt    reflect.Type // pointer to struct\n\tname string\n}\n\n// RegisterMessageSetType is called from the generated code.\nfunc RegisterMessageSetType(m Message, fieldNum int32, name string) {\n\tmessageSetMap[fieldNum] = messageSetDesc{\n\t\tt:    reflect.TypeOf(m),\n\t\tname: name,\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/message_set_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\nimport (\n\t\"bytes\"\n\t\"testing\"\n)\n\nfunc TestUnmarshalMessageSetWithDuplicate(t *testing.T) {\n\t// Check that a repeated message set entry will be concatenated.\n\tin := &messageSet{\n\t\tItem: []*_MessageSet_Item{\n\t\t\t{TypeId: Int32(12345), Message: []byte(\"hoo\")},\n\t\t\t{TypeId: Int32(12345), Message: []byte(\"hah\")},\n\t\t},\n\t}\n\tb, err := Marshal(in)\n\tif err != nil {\n\t\tt.Fatalf(\"Marshal: %v\", err)\n\t}\n\tt.Logf(\"Marshaled bytes: %q\", b)\n\n\tvar extensions XXX_InternalExtensions\n\tif err := UnmarshalMessageSet(b, &extensions); err != nil {\n\t\tt.Fatalf(\"UnmarshalMessageSet: %v\", err)\n\t}\n\text, ok := extensions.p.extensionMap[12345]\n\tif !ok {\n\t\tt.Fatalf(\"Didn't retrieve extension 12345; map is %v\", extensions.p.extensionMap)\n\t}\n\t// Skip wire type/field number and length varints.\n\tgot := skipVarint(skipVarint(ext.enc))\n\tif want := []byte(\"hoohah\"); !bytes.Equal(got, want) {\n\t\tt.Errorf(\"Combined extension is %q, want %q\", got, want)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/pointer_reflect.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build appengine js\n\n// This file contains an implementation of proto field accesses using package reflect.\n// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can\n// be used on App Engine.\n\npackage proto\n\nimport (\n\t\"math\"\n\t\"reflect\"\n)\n\n// A structPointer is a pointer to a struct.\ntype structPointer struct {\n\tv reflect.Value\n}\n\n// toStructPointer returns a structPointer equivalent to the given reflect value.\n// The reflect value must itself be a pointer to a struct.\nfunc toStructPointer(v reflect.Value) structPointer {\n\treturn structPointer{v}\n}\n\n// IsNil reports whether p is nil.\nfunc structPointer_IsNil(p structPointer) bool {\n\treturn p.v.IsNil()\n}\n\n// Interface returns the struct pointer as an interface value.\nfunc structPointer_Interface(p structPointer, _ reflect.Type) interface{} {\n\treturn p.v.Interface()\n}\n\n// A field identifies a field in a struct, accessible from a structPointer.\n// In this implementation, a field is identified by the sequence of field indices\n// passed to reflect's FieldByIndex.\ntype field []int\n\n// toField returns a field equivalent to the given reflect field.\nfunc toField(f *reflect.StructField) field {\n\treturn f.Index\n}\n\n// invalidField is an invalid field identifier.\nvar invalidField = field(nil)\n\n// IsValid reports whether the field identifier is valid.\nfunc (f field) IsValid() bool { return f != nil }\n\n// field returns the given field in the struct as a reflect value.\nfunc structPointer_field(p structPointer, f field) reflect.Value {\n\t// Special case: an extension map entry with a value of type T\n\t// passes a *T to the struct-handling code with a zero field,\n\t// expecting that it will be treated as equivalent to *struct{ X T },\n\t// which has the same memory layout. We have to handle that case\n\t// specially, because reflect will panic if we call FieldByIndex on a\n\t// non-struct.\n\tif f == nil {\n\t\treturn p.v.Elem()\n\t}\n\n\treturn p.v.Elem().FieldByIndex(f)\n}\n\n// ifield returns the given field in the struct as an interface value.\nfunc structPointer_ifield(p structPointer, f field) interface{} {\n\treturn structPointer_field(p, f).Addr().Interface()\n}\n\n// Bytes returns the address of a []byte field in the struct.\nfunc structPointer_Bytes(p structPointer, f field) *[]byte {\n\treturn structPointer_ifield(p, f).(*[]byte)\n}\n\n// BytesSlice returns the address of a [][]byte field in the struct.\nfunc structPointer_BytesSlice(p structPointer, f field) *[][]byte {\n\treturn structPointer_ifield(p, f).(*[][]byte)\n}\n\n// Bool returns the address of a *bool field in the struct.\nfunc structPointer_Bool(p structPointer, f field) **bool {\n\treturn structPointer_ifield(p, f).(**bool)\n}\n\n// BoolVal returns the address of a bool field in the struct.\nfunc structPointer_BoolVal(p structPointer, f field) *bool {\n\treturn structPointer_ifield(p, f).(*bool)\n}\n\n// BoolSlice returns the address of a []bool field in the struct.\nfunc structPointer_BoolSlice(p structPointer, f field) *[]bool {\n\treturn structPointer_ifield(p, f).(*[]bool)\n}\n\n// String returns the address of a *string field in the struct.\nfunc structPointer_String(p structPointer, f field) **string {\n\treturn structPointer_ifield(p, f).(**string)\n}\n\n// StringVal returns the address of a string field in the struct.\nfunc structPointer_StringVal(p structPointer, f field) *string {\n\treturn structPointer_ifield(p, f).(*string)\n}\n\n// StringSlice returns the address of a []string field in the struct.\nfunc structPointer_StringSlice(p structPointer, f field) *[]string {\n\treturn structPointer_ifield(p, f).(*[]string)\n}\n\n// Extensions returns the address of an extension map field in the struct.\nfunc structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {\n\treturn structPointer_ifield(p, f).(*XXX_InternalExtensions)\n}\n\n// ExtMap returns the address of an extension map field in the struct.\nfunc structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {\n\treturn structPointer_ifield(p, f).(*map[int32]Extension)\n}\n\n// NewAt returns the reflect.Value for a pointer to a field in the struct.\nfunc structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {\n\treturn structPointer_field(p, f).Addr()\n}\n\n// SetStructPointer writes a *struct field in the struct.\nfunc structPointer_SetStructPointer(p structPointer, f field, q structPointer) {\n\tstructPointer_field(p, f).Set(q.v)\n}\n\n// GetStructPointer reads a *struct field in the struct.\nfunc structPointer_GetStructPointer(p structPointer, f field) structPointer {\n\treturn structPointer{structPointer_field(p, f)}\n}\n\n// StructPointerSlice the address of a []*struct field in the struct.\nfunc structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice {\n\treturn structPointerSlice{structPointer_field(p, f)}\n}\n\n// A structPointerSlice represents the address of a slice of pointers to structs\n// (themselves messages or groups). That is, v.Type() is *[]*struct{...}.\ntype structPointerSlice struct {\n\tv reflect.Value\n}\n\nfunc (p structPointerSlice) Len() int                  { return p.v.Len() }\nfunc (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} }\nfunc (p structPointerSlice) Append(q structPointer) {\n\tp.v.Set(reflect.Append(p.v, q.v))\n}\n\nvar (\n\tint32Type   = reflect.TypeOf(int32(0))\n\tuint32Type  = reflect.TypeOf(uint32(0))\n\tfloat32Type = reflect.TypeOf(float32(0))\n\tint64Type   = reflect.TypeOf(int64(0))\n\tuint64Type  = reflect.TypeOf(uint64(0))\n\tfloat64Type = reflect.TypeOf(float64(0))\n)\n\n// A word32 represents a field of type *int32, *uint32, *float32, or *enum.\n// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable.\ntype word32 struct {\n\tv reflect.Value\n}\n\n// IsNil reports whether p is nil.\nfunc word32_IsNil(p word32) bool {\n\treturn p.v.IsNil()\n}\n\n// Set sets p to point at a newly allocated word with bits set to x.\nfunc word32_Set(p word32, o *Buffer, x uint32) {\n\tt := p.v.Type().Elem()\n\tswitch t {\n\tcase int32Type:\n\t\tif len(o.int32s) == 0 {\n\t\t\to.int32s = make([]int32, uint32PoolSize)\n\t\t}\n\t\to.int32s[0] = int32(x)\n\t\tp.v.Set(reflect.ValueOf(&o.int32s[0]))\n\t\to.int32s = o.int32s[1:]\n\t\treturn\n\tcase uint32Type:\n\t\tif len(o.uint32s) == 0 {\n\t\t\to.uint32s = make([]uint32, uint32PoolSize)\n\t\t}\n\t\to.uint32s[0] = x\n\t\tp.v.Set(reflect.ValueOf(&o.uint32s[0]))\n\t\to.uint32s = o.uint32s[1:]\n\t\treturn\n\tcase float32Type:\n\t\tif len(o.float32s) == 0 {\n\t\t\to.float32s = make([]float32, uint32PoolSize)\n\t\t}\n\t\to.float32s[0] = math.Float32frombits(x)\n\t\tp.v.Set(reflect.ValueOf(&o.float32s[0]))\n\t\to.float32s = o.float32s[1:]\n\t\treturn\n\t}\n\n\t// must be enum\n\tp.v.Set(reflect.New(t))\n\tp.v.Elem().SetInt(int64(int32(x)))\n}\n\n// Get gets the bits pointed at by p, as a uint32.\nfunc word32_Get(p word32) uint32 {\n\telem := p.v.Elem()\n\tswitch elem.Kind() {\n\tcase reflect.Int32:\n\t\treturn uint32(elem.Int())\n\tcase reflect.Uint32:\n\t\treturn uint32(elem.Uint())\n\tcase reflect.Float32:\n\t\treturn math.Float32bits(float32(elem.Float()))\n\t}\n\tpanic(\"unreachable\")\n}\n\n// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct.\nfunc structPointer_Word32(p structPointer, f field) word32 {\n\treturn word32{structPointer_field(p, f)}\n}\n\n// A word32Val represents a field of type int32, uint32, float32, or enum.\n// That is, v.Type() is int32, uint32, float32, or enum and v is assignable.\ntype word32Val struct {\n\tv reflect.Value\n}\n\n// Set sets *p to x.\nfunc word32Val_Set(p word32Val, x uint32) {\n\tswitch p.v.Type() {\n\tcase int32Type:\n\t\tp.v.SetInt(int64(x))\n\t\treturn\n\tcase uint32Type:\n\t\tp.v.SetUint(uint64(x))\n\t\treturn\n\tcase float32Type:\n\t\tp.v.SetFloat(float64(math.Float32frombits(x)))\n\t\treturn\n\t}\n\n\t// must be enum\n\tp.v.SetInt(int64(int32(x)))\n}\n\n// Get gets the bits pointed at by p, as a uint32.\nfunc word32Val_Get(p word32Val) uint32 {\n\telem := p.v\n\tswitch elem.Kind() {\n\tcase reflect.Int32:\n\t\treturn uint32(elem.Int())\n\tcase reflect.Uint32:\n\t\treturn uint32(elem.Uint())\n\tcase reflect.Float32:\n\t\treturn math.Float32bits(float32(elem.Float()))\n\t}\n\tpanic(\"unreachable\")\n}\n\n// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct.\nfunc structPointer_Word32Val(p structPointer, f field) word32Val {\n\treturn word32Val{structPointer_field(p, f)}\n}\n\n// A word32Slice is a slice of 32-bit values.\n// That is, v.Type() is []int32, []uint32, []float32, or []enum.\ntype word32Slice struct {\n\tv reflect.Value\n}\n\nfunc (p word32Slice) Append(x uint32) {\n\tn, m := p.v.Len(), p.v.Cap()\n\tif n < m {\n\t\tp.v.SetLen(n + 1)\n\t} else {\n\t\tt := p.v.Type().Elem()\n\t\tp.v.Set(reflect.Append(p.v, reflect.Zero(t)))\n\t}\n\telem := p.v.Index(n)\n\tswitch elem.Kind() {\n\tcase reflect.Int32:\n\t\telem.SetInt(int64(int32(x)))\n\tcase reflect.Uint32:\n\t\telem.SetUint(uint64(x))\n\tcase reflect.Float32:\n\t\telem.SetFloat(float64(math.Float32frombits(x)))\n\t}\n}\n\nfunc (p word32Slice) Len() int {\n\treturn p.v.Len()\n}\n\nfunc (p word32Slice) Index(i int) uint32 {\n\telem := p.v.Index(i)\n\tswitch elem.Kind() {\n\tcase reflect.Int32:\n\t\treturn uint32(elem.Int())\n\tcase reflect.Uint32:\n\t\treturn uint32(elem.Uint())\n\tcase reflect.Float32:\n\t\treturn math.Float32bits(float32(elem.Float()))\n\t}\n\tpanic(\"unreachable\")\n}\n\n// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct.\nfunc structPointer_Word32Slice(p structPointer, f field) word32Slice {\n\treturn word32Slice{structPointer_field(p, f)}\n}\n\n// word64 is like word32 but for 64-bit values.\ntype word64 struct {\n\tv reflect.Value\n}\n\nfunc word64_Set(p word64, o *Buffer, x uint64) {\n\tt := p.v.Type().Elem()\n\tswitch t {\n\tcase int64Type:\n\t\tif len(o.int64s) == 0 {\n\t\t\to.int64s = make([]int64, uint64PoolSize)\n\t\t}\n\t\to.int64s[0] = int64(x)\n\t\tp.v.Set(reflect.ValueOf(&o.int64s[0]))\n\t\to.int64s = o.int64s[1:]\n\t\treturn\n\tcase uint64Type:\n\t\tif len(o.uint64s) == 0 {\n\t\t\to.uint64s = make([]uint64, uint64PoolSize)\n\t\t}\n\t\to.uint64s[0] = x\n\t\tp.v.Set(reflect.ValueOf(&o.uint64s[0]))\n\t\to.uint64s = o.uint64s[1:]\n\t\treturn\n\tcase float64Type:\n\t\tif len(o.float64s) == 0 {\n\t\t\to.float64s = make([]float64, uint64PoolSize)\n\t\t}\n\t\to.float64s[0] = math.Float64frombits(x)\n\t\tp.v.Set(reflect.ValueOf(&o.float64s[0]))\n\t\to.float64s = o.float64s[1:]\n\t\treturn\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc word64_IsNil(p word64) bool {\n\treturn p.v.IsNil()\n}\n\nfunc word64_Get(p word64) uint64 {\n\telem := p.v.Elem()\n\tswitch elem.Kind() {\n\tcase reflect.Int64:\n\t\treturn uint64(elem.Int())\n\tcase reflect.Uint64:\n\t\treturn elem.Uint()\n\tcase reflect.Float64:\n\t\treturn math.Float64bits(elem.Float())\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc structPointer_Word64(p structPointer, f field) word64 {\n\treturn word64{structPointer_field(p, f)}\n}\n\n// word64Val is like word32Val but for 64-bit values.\ntype word64Val struct {\n\tv reflect.Value\n}\n\nfunc word64Val_Set(p word64Val, o *Buffer, x uint64) {\n\tswitch p.v.Type() {\n\tcase int64Type:\n\t\tp.v.SetInt(int64(x))\n\t\treturn\n\tcase uint64Type:\n\t\tp.v.SetUint(x)\n\t\treturn\n\tcase float64Type:\n\t\tp.v.SetFloat(math.Float64frombits(x))\n\t\treturn\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc word64Val_Get(p word64Val) uint64 {\n\telem := p.v\n\tswitch elem.Kind() {\n\tcase reflect.Int64:\n\t\treturn uint64(elem.Int())\n\tcase reflect.Uint64:\n\t\treturn elem.Uint()\n\tcase reflect.Float64:\n\t\treturn math.Float64bits(elem.Float())\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc structPointer_Word64Val(p structPointer, f field) word64Val {\n\treturn word64Val{structPointer_field(p, f)}\n}\n\ntype word64Slice struct {\n\tv reflect.Value\n}\n\nfunc (p word64Slice) Append(x uint64) {\n\tn, m := p.v.Len(), p.v.Cap()\n\tif n < m {\n\t\tp.v.SetLen(n + 1)\n\t} else {\n\t\tt := p.v.Type().Elem()\n\t\tp.v.Set(reflect.Append(p.v, reflect.Zero(t)))\n\t}\n\telem := p.v.Index(n)\n\tswitch elem.Kind() {\n\tcase reflect.Int64:\n\t\telem.SetInt(int64(int64(x)))\n\tcase reflect.Uint64:\n\t\telem.SetUint(uint64(x))\n\tcase reflect.Float64:\n\t\telem.SetFloat(float64(math.Float64frombits(x)))\n\t}\n}\n\nfunc (p word64Slice) Len() int {\n\treturn p.v.Len()\n}\n\nfunc (p word64Slice) Index(i int) uint64 {\n\telem := p.v.Index(i)\n\tswitch elem.Kind() {\n\tcase reflect.Int64:\n\t\treturn uint64(elem.Int())\n\tcase reflect.Uint64:\n\t\treturn uint64(elem.Uint())\n\tcase reflect.Float64:\n\t\treturn math.Float64bits(float64(elem.Float()))\n\t}\n\tpanic(\"unreachable\")\n}\n\nfunc structPointer_Word64Slice(p structPointer, f field) word64Slice {\n\treturn word64Slice{structPointer_field(p, f)}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/pointer_unsafe.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build !appengine,!js\n\n// This file contains the implementation of the proto field accesses using package unsafe.\n\npackage proto\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\n// NOTE: These type_Foo functions would more idiomatically be methods,\n// but Go does not allow methods on pointer types, and we must preserve\n// some pointer type for the garbage collector. We use these\n// funcs with clunky names as our poor approximation to methods.\n//\n// An alternative would be\n//\ttype structPointer struct { p unsafe.Pointer }\n// but that does not registerize as well.\n\n// A structPointer is a pointer to a struct.\ntype structPointer unsafe.Pointer\n\n// toStructPointer returns a structPointer equivalent to the given reflect value.\nfunc toStructPointer(v reflect.Value) structPointer {\n\treturn structPointer(unsafe.Pointer(v.Pointer()))\n}\n\n// IsNil reports whether p is nil.\nfunc structPointer_IsNil(p structPointer) bool {\n\treturn p == nil\n}\n\n// Interface returns the struct pointer, assumed to have element type t,\n// as an interface value.\nfunc structPointer_Interface(p structPointer, t reflect.Type) interface{} {\n\treturn reflect.NewAt(t, unsafe.Pointer(p)).Interface()\n}\n\n// A field identifies a field in a struct, accessible from a structPointer.\n// In this implementation, a field is identified by its byte offset from the start of the struct.\ntype field uintptr\n\n// toField returns a field equivalent to the given reflect field.\nfunc toField(f *reflect.StructField) field {\n\treturn field(f.Offset)\n}\n\n// invalidField is an invalid field identifier.\nconst invalidField = ^field(0)\n\n// IsValid reports whether the field identifier is valid.\nfunc (f field) IsValid() bool {\n\treturn f != ^field(0)\n}\n\n// Bytes returns the address of a []byte field in the struct.\nfunc structPointer_Bytes(p structPointer, f field) *[]byte {\n\treturn (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// BytesSlice returns the address of a [][]byte field in the struct.\nfunc structPointer_BytesSlice(p structPointer, f field) *[][]byte {\n\treturn (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// Bool returns the address of a *bool field in the struct.\nfunc structPointer_Bool(p structPointer, f field) **bool {\n\treturn (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// BoolVal returns the address of a bool field in the struct.\nfunc structPointer_BoolVal(p structPointer, f field) *bool {\n\treturn (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// BoolSlice returns the address of a []bool field in the struct.\nfunc structPointer_BoolSlice(p structPointer, f field) *[]bool {\n\treturn (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// String returns the address of a *string field in the struct.\nfunc structPointer_String(p structPointer, f field) **string {\n\treturn (**string)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// StringVal returns the address of a string field in the struct.\nfunc structPointer_StringVal(p structPointer, f field) *string {\n\treturn (*string)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// StringSlice returns the address of a []string field in the struct.\nfunc structPointer_StringSlice(p structPointer, f field) *[]string {\n\treturn (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// ExtMap returns the address of an extension map field in the struct.\nfunc structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {\n\treturn (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\nfunc structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {\n\treturn (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// NewAt returns the reflect.Value for a pointer to a field in the struct.\nfunc structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {\n\treturn reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f)))\n}\n\n// SetStructPointer writes a *struct field in the struct.\nfunc structPointer_SetStructPointer(p structPointer, f field, q structPointer) {\n\t*(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q\n}\n\n// GetStructPointer reads a *struct field in the struct.\nfunc structPointer_GetStructPointer(p structPointer, f field) structPointer {\n\treturn *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// StructPointerSlice the address of a []*struct field in the struct.\nfunc structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice {\n\treturn (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups).\ntype structPointerSlice []structPointer\n\nfunc (v *structPointerSlice) Len() int                  { return len(*v) }\nfunc (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] }\nfunc (v *structPointerSlice) Append(p structPointer)    { *v = append(*v, p) }\n\n// A word32 is the address of a \"pointer to 32-bit value\" field.\ntype word32 **uint32\n\n// IsNil reports whether *v is nil.\nfunc word32_IsNil(p word32) bool {\n\treturn *p == nil\n}\n\n// Set sets *v to point at a newly allocated word set to x.\nfunc word32_Set(p word32, o *Buffer, x uint32) {\n\tif len(o.uint32s) == 0 {\n\t\to.uint32s = make([]uint32, uint32PoolSize)\n\t}\n\to.uint32s[0] = x\n\t*p = &o.uint32s[0]\n\to.uint32s = o.uint32s[1:]\n}\n\n// Get gets the value pointed at by *v.\nfunc word32_Get(p word32) uint32 {\n\treturn **p\n}\n\n// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct.\nfunc structPointer_Word32(p structPointer, f field) word32 {\n\treturn word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))\n}\n\n// A word32Val is the address of a 32-bit value field.\ntype word32Val *uint32\n\n// Set sets *p to x.\nfunc word32Val_Set(p word32Val, x uint32) {\n\t*p = x\n}\n\n// Get gets the value pointed at by p.\nfunc word32Val_Get(p word32Val) uint32 {\n\treturn *p\n}\n\n// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct.\nfunc structPointer_Word32Val(p structPointer, f field) word32Val {\n\treturn word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))\n}\n\n// A word32Slice is a slice of 32-bit values.\ntype word32Slice []uint32\n\nfunc (v *word32Slice) Append(x uint32)    { *v = append(*v, x) }\nfunc (v *word32Slice) Len() int           { return len(*v) }\nfunc (v *word32Slice) Index(i int) uint32 { return (*v)[i] }\n\n// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct.\nfunc structPointer_Word32Slice(p structPointer, f field) *word32Slice {\n\treturn (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n\n// word64 is like word32 but for 64-bit values.\ntype word64 **uint64\n\nfunc word64_Set(p word64, o *Buffer, x uint64) {\n\tif len(o.uint64s) == 0 {\n\t\to.uint64s = make([]uint64, uint64PoolSize)\n\t}\n\to.uint64s[0] = x\n\t*p = &o.uint64s[0]\n\to.uint64s = o.uint64s[1:]\n}\n\nfunc word64_IsNil(p word64) bool {\n\treturn *p == nil\n}\n\nfunc word64_Get(p word64) uint64 {\n\treturn **p\n}\n\nfunc structPointer_Word64(p structPointer, f field) word64 {\n\treturn word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))\n}\n\n// word64Val is like word32Val but for 64-bit values.\ntype word64Val *uint64\n\nfunc word64Val_Set(p word64Val, o *Buffer, x uint64) {\n\t*p = x\n}\n\nfunc word64Val_Get(p word64Val) uint64 {\n\treturn *p\n}\n\nfunc structPointer_Word64Val(p structPointer, f field) word64Val {\n\treturn word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))\n}\n\n// word64Slice is like word32Slice but for 64-bit values.\ntype word64Slice []uint64\n\nfunc (v *word64Slice) Append(x uint64)    { *v = append(*v, x) }\nfunc (v *word64Slice) Len() int           { return len(*v) }\nfunc (v *word64Slice) Index(i int) uint64 { return (*v)[i] }\n\nfunc structPointer_Word64Slice(p structPointer, f field) *word64Slice {\n\treturn (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/properties.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n/*\n * Routines for encoding data into the wire format for protocol buffers.\n */\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n)\n\nconst debug bool = false\n\n// Constants that identify the encoding of a value on the wire.\nconst (\n\tWireVarint     = 0\n\tWireFixed64    = 1\n\tWireBytes      = 2\n\tWireStartGroup = 3\n\tWireEndGroup   = 4\n\tWireFixed32    = 5\n)\n\nconst startSize = 10 // initial slice/string sizes\n\n// Encoders are defined in encode.go\n// An encoder outputs the full representation of a field, including its\n// tag and encoder type.\ntype encoder func(p *Buffer, prop *Properties, base structPointer) error\n\n// A valueEncoder encodes a single integer in a particular encoding.\ntype valueEncoder func(o *Buffer, x uint64) error\n\n// Sizers are defined in encode.go\n// A sizer returns the encoded size of a field, including its tag and encoder\n// type.\ntype sizer func(prop *Properties, base structPointer) int\n\n// A valueSizer returns the encoded size of a single integer in a particular\n// encoding.\ntype valueSizer func(x uint64) int\n\n// Decoders are defined in decode.go\n// A decoder creates a value from its wire representation.\n// Unrecognized subelements are saved in unrec.\ntype decoder func(p *Buffer, prop *Properties, base structPointer) error\n\n// A valueDecoder decodes a single integer in a particular encoding.\ntype valueDecoder func(o *Buffer) (x uint64, err error)\n\n// A oneofMarshaler does the marshaling for all oneof fields in a message.\ntype oneofMarshaler func(Message, *Buffer) error\n\n// A oneofUnmarshaler does the unmarshaling for a oneof field in a message.\ntype oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error)\n\n// A oneofSizer does the sizing for all oneof fields in a message.\ntype oneofSizer func(Message) int\n\n// tagMap is an optimization over map[int]int for typical protocol buffer\n// use-cases. Encoded protocol buffers are often in tag order with small tag\n// numbers.\ntype tagMap struct {\n\tfastTags []int\n\tslowTags map[int]int\n}\n\n// tagMapFastLimit is the upper bound on the tag number that will be stored in\n// the tagMap slice rather than its map.\nconst tagMapFastLimit = 1024\n\nfunc (p *tagMap) get(t int) (int, bool) {\n\tif t > 0 && t < tagMapFastLimit {\n\t\tif t >= len(p.fastTags) {\n\t\t\treturn 0, false\n\t\t}\n\t\tfi := p.fastTags[t]\n\t\treturn fi, fi >= 0\n\t}\n\tfi, ok := p.slowTags[t]\n\treturn fi, ok\n}\n\nfunc (p *tagMap) put(t int, fi int) {\n\tif t > 0 && t < tagMapFastLimit {\n\t\tfor len(p.fastTags) < t+1 {\n\t\t\tp.fastTags = append(p.fastTags, -1)\n\t\t}\n\t\tp.fastTags[t] = fi\n\t\treturn\n\t}\n\tif p.slowTags == nil {\n\t\tp.slowTags = make(map[int]int)\n\t}\n\tp.slowTags[t] = fi\n}\n\n// StructProperties represents properties for all the fields of a struct.\n// decoderTags and decoderOrigNames should only be used by the decoder.\ntype StructProperties struct {\n\tProp             []*Properties  // properties for each field\n\treqCount         int            // required count\n\tdecoderTags      tagMap         // map from proto tag to struct field number\n\tdecoderOrigNames map[string]int // map from original name to struct field number\n\torder            []int          // list of struct field numbers in tag order\n\tunrecField       field          // field id of the XXX_unrecognized []byte field\n\textendable       bool           // is this an extendable proto\n\n\toneofMarshaler   oneofMarshaler\n\toneofUnmarshaler oneofUnmarshaler\n\toneofSizer       oneofSizer\n\tstype            reflect.Type\n\n\t// OneofTypes contains information about the oneof fields in this message.\n\t// It is keyed by the original name of a field.\n\tOneofTypes map[string]*OneofProperties\n}\n\n// OneofProperties represents information about a specific field in a oneof.\ntype OneofProperties struct {\n\tType  reflect.Type // pointer to generated struct type for this oneof field\n\tField int          // struct field number of the containing oneof in the message\n\tProp  *Properties\n}\n\n// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.\n// See encode.go, (*Buffer).enc_struct.\n\nfunc (sp *StructProperties) Len() int { return len(sp.order) }\nfunc (sp *StructProperties) Less(i, j int) bool {\n\treturn sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag\n}\nfunc (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }\n\n// Properties represents the protocol-specific behavior of a single struct field.\ntype Properties struct {\n\tName     string // name of the field, for error messages\n\tOrigName string // original name before protocol compiler (always set)\n\tJSONName string // name to use for JSON; determined by protoc\n\tWire     string\n\tWireType int\n\tTag      int\n\tRequired bool\n\tOptional bool\n\tRepeated bool\n\tPacked   bool   // relevant for repeated primitives only\n\tEnum     string // set for enum types only\n\tproto3   bool   // whether this is known to be a proto3 field; set for []byte only\n\toneof    bool   // whether this is a oneof field\n\n\tDefault    string // default value\n\tHasDefault bool   // whether an explicit default was provided\n\tdef_uint64 uint64\n\n\tenc           encoder\n\tvalEnc        valueEncoder // set for bool and numeric types only\n\tfield         field\n\ttagcode       []byte // encoding of EncodeVarint((Tag<<3)|WireType)\n\ttagbuf        [8]byte\n\tstype         reflect.Type      // set for struct types only\n\tsprop         *StructProperties // set for struct types only\n\tisMarshaler   bool\n\tisUnmarshaler bool\n\n\tmtype    reflect.Type // set for map types only\n\tmkeyprop *Properties  // set for map types only\n\tmvalprop *Properties  // set for map types only\n\n\tsize    sizer\n\tvalSize valueSizer // set for bool and numeric types only\n\n\tdec    decoder\n\tvalDec valueDecoder // set for bool and numeric types only\n\n\t// If this is a packable field, this will be the decoder for the packed version of the field.\n\tpackedDec decoder\n}\n\n// String formats the properties in the protobuf struct field tag style.\nfunc (p *Properties) String() string {\n\ts := p.Wire\n\ts = \",\"\n\ts += strconv.Itoa(p.Tag)\n\tif p.Required {\n\t\ts += \",req\"\n\t}\n\tif p.Optional {\n\t\ts += \",opt\"\n\t}\n\tif p.Repeated {\n\t\ts += \",rep\"\n\t}\n\tif p.Packed {\n\t\ts += \",packed\"\n\t}\n\ts += \",name=\" + p.OrigName\n\tif p.JSONName != p.OrigName {\n\t\ts += \",json=\" + p.JSONName\n\t}\n\tif p.proto3 {\n\t\ts += \",proto3\"\n\t}\n\tif p.oneof {\n\t\ts += \",oneof\"\n\t}\n\tif len(p.Enum) > 0 {\n\t\ts += \",enum=\" + p.Enum\n\t}\n\tif p.HasDefault {\n\t\ts += \",def=\" + p.Default\n\t}\n\treturn s\n}\n\n// Parse populates p by parsing a string in the protobuf struct field tag style.\nfunc (p *Properties) Parse(s string) {\n\t// \"bytes,49,opt,name=foo,def=hello!\"\n\tfields := strings.Split(s, \",\") // breaks def=, but handled below.\n\tif len(fields) < 2 {\n\t\tfmt.Fprintf(os.Stderr, \"proto: tag has too few fields: %q\\n\", s)\n\t\treturn\n\t}\n\n\tp.Wire = fields[0]\n\tswitch p.Wire {\n\tcase \"varint\":\n\t\tp.WireType = WireVarint\n\t\tp.valEnc = (*Buffer).EncodeVarint\n\t\tp.valDec = (*Buffer).DecodeVarint\n\t\tp.valSize = sizeVarint\n\tcase \"fixed32\":\n\t\tp.WireType = WireFixed32\n\t\tp.valEnc = (*Buffer).EncodeFixed32\n\t\tp.valDec = (*Buffer).DecodeFixed32\n\t\tp.valSize = sizeFixed32\n\tcase \"fixed64\":\n\t\tp.WireType = WireFixed64\n\t\tp.valEnc = (*Buffer).EncodeFixed64\n\t\tp.valDec = (*Buffer).DecodeFixed64\n\t\tp.valSize = sizeFixed64\n\tcase \"zigzag32\":\n\t\tp.WireType = WireVarint\n\t\tp.valEnc = (*Buffer).EncodeZigzag32\n\t\tp.valDec = (*Buffer).DecodeZigzag32\n\t\tp.valSize = sizeZigzag32\n\tcase \"zigzag64\":\n\t\tp.WireType = WireVarint\n\t\tp.valEnc = (*Buffer).EncodeZigzag64\n\t\tp.valDec = (*Buffer).DecodeZigzag64\n\t\tp.valSize = sizeZigzag64\n\tcase \"bytes\", \"group\":\n\t\tp.WireType = WireBytes\n\t\t// no numeric converter for non-numeric types\n\tdefault:\n\t\tfmt.Fprintf(os.Stderr, \"proto: tag has unknown wire type: %q\\n\", s)\n\t\treturn\n\t}\n\n\tvar err error\n\tp.Tag, err = strconv.Atoi(fields[1])\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor i := 2; i < len(fields); i++ {\n\t\tf := fields[i]\n\t\tswitch {\n\t\tcase f == \"req\":\n\t\t\tp.Required = true\n\t\tcase f == \"opt\":\n\t\t\tp.Optional = true\n\t\tcase f == \"rep\":\n\t\t\tp.Repeated = true\n\t\tcase f == \"packed\":\n\t\t\tp.Packed = true\n\t\tcase strings.HasPrefix(f, \"name=\"):\n\t\t\tp.OrigName = f[5:]\n\t\tcase strings.HasPrefix(f, \"json=\"):\n\t\t\tp.JSONName = f[5:]\n\t\tcase strings.HasPrefix(f, \"enum=\"):\n\t\t\tp.Enum = f[5:]\n\t\tcase f == \"proto3\":\n\t\t\tp.proto3 = true\n\t\tcase f == \"oneof\":\n\t\t\tp.oneof = true\n\t\tcase strings.HasPrefix(f, \"def=\"):\n\t\t\tp.HasDefault = true\n\t\t\tp.Default = f[4:] // rest of string\n\t\t\tif i+1 < len(fields) {\n\t\t\t\t// Commas aren't escaped, and def is always last.\n\t\t\t\tp.Default += \",\" + strings.Join(fields[i+1:], \",\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc logNoSliceEnc(t1, t2 reflect.Type) {\n\tfmt.Fprintf(os.Stderr, \"proto: no slice oenc for %T = []%T\\n\", t1, t2)\n}\n\nvar protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()\n\n// Initialize the fields for encoding and decoding.\nfunc (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {\n\tp.enc = nil\n\tp.dec = nil\n\tp.size = nil\n\n\tswitch t1 := typ; t1.Kind() {\n\tdefault:\n\t\tfmt.Fprintf(os.Stderr, \"proto: no coders for %v\\n\", t1)\n\n\t// proto3 scalar types\n\n\tcase reflect.Bool:\n\t\tp.enc = (*Buffer).enc_proto3_bool\n\t\tp.dec = (*Buffer).dec_proto3_bool\n\t\tp.size = size_proto3_bool\n\tcase reflect.Int32:\n\t\tp.enc = (*Buffer).enc_proto3_int32\n\t\tp.dec = (*Buffer).dec_proto3_int32\n\t\tp.size = size_proto3_int32\n\tcase reflect.Uint32:\n\t\tp.enc = (*Buffer).enc_proto3_uint32\n\t\tp.dec = (*Buffer).dec_proto3_int32 // can reuse\n\t\tp.size = size_proto3_uint32\n\tcase reflect.Int64, reflect.Uint64:\n\t\tp.enc = (*Buffer).enc_proto3_int64\n\t\tp.dec = (*Buffer).dec_proto3_int64\n\t\tp.size = size_proto3_int64\n\tcase reflect.Float32:\n\t\tp.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits\n\t\tp.dec = (*Buffer).dec_proto3_int32\n\t\tp.size = size_proto3_uint32\n\tcase reflect.Float64:\n\t\tp.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits\n\t\tp.dec = (*Buffer).dec_proto3_int64\n\t\tp.size = size_proto3_int64\n\tcase reflect.String:\n\t\tp.enc = (*Buffer).enc_proto3_string\n\t\tp.dec = (*Buffer).dec_proto3_string\n\t\tp.size = size_proto3_string\n\n\tcase reflect.Ptr:\n\t\tswitch t2 := t1.Elem(); t2.Kind() {\n\t\tdefault:\n\t\t\tfmt.Fprintf(os.Stderr, \"proto: no encoder function for %v -> %v\\n\", t1, t2)\n\t\t\tbreak\n\t\tcase reflect.Bool:\n\t\t\tp.enc = (*Buffer).enc_bool\n\t\t\tp.dec = (*Buffer).dec_bool\n\t\t\tp.size = size_bool\n\t\tcase reflect.Int32:\n\t\t\tp.enc = (*Buffer).enc_int32\n\t\t\tp.dec = (*Buffer).dec_int32\n\t\t\tp.size = size_int32\n\t\tcase reflect.Uint32:\n\t\t\tp.enc = (*Buffer).enc_uint32\n\t\t\tp.dec = (*Buffer).dec_int32 // can reuse\n\t\t\tp.size = size_uint32\n\t\tcase reflect.Int64, reflect.Uint64:\n\t\t\tp.enc = (*Buffer).enc_int64\n\t\t\tp.dec = (*Buffer).dec_int64\n\t\t\tp.size = size_int64\n\t\tcase reflect.Float32:\n\t\t\tp.enc = (*Buffer).enc_uint32 // can just treat them as bits\n\t\t\tp.dec = (*Buffer).dec_int32\n\t\t\tp.size = size_uint32\n\t\tcase reflect.Float64:\n\t\t\tp.enc = (*Buffer).enc_int64 // can just treat them as bits\n\t\t\tp.dec = (*Buffer).dec_int64\n\t\t\tp.size = size_int64\n\t\tcase reflect.String:\n\t\t\tp.enc = (*Buffer).enc_string\n\t\t\tp.dec = (*Buffer).dec_string\n\t\t\tp.size = size_string\n\t\tcase reflect.Struct:\n\t\t\tp.stype = t1.Elem()\n\t\t\tp.isMarshaler = isMarshaler(t1)\n\t\t\tp.isUnmarshaler = isUnmarshaler(t1)\n\t\t\tif p.Wire == \"bytes\" {\n\t\t\t\tp.enc = (*Buffer).enc_struct_message\n\t\t\t\tp.dec = (*Buffer).dec_struct_message\n\t\t\t\tp.size = size_struct_message\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_struct_group\n\t\t\t\tp.dec = (*Buffer).dec_struct_group\n\t\t\t\tp.size = size_struct_group\n\t\t\t}\n\t\t}\n\n\tcase reflect.Slice:\n\t\tswitch t2 := t1.Elem(); t2.Kind() {\n\t\tdefault:\n\t\t\tlogNoSliceEnc(t1, t2)\n\t\t\tbreak\n\t\tcase reflect.Bool:\n\t\t\tif p.Packed {\n\t\t\t\tp.enc = (*Buffer).enc_slice_packed_bool\n\t\t\t\tp.size = size_slice_packed_bool\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_slice_bool\n\t\t\t\tp.size = size_slice_bool\n\t\t\t}\n\t\t\tp.dec = (*Buffer).dec_slice_bool\n\t\t\tp.packedDec = (*Buffer).dec_slice_packed_bool\n\t\tcase reflect.Int32:\n\t\t\tif p.Packed {\n\t\t\t\tp.enc = (*Buffer).enc_slice_packed_int32\n\t\t\t\tp.size = size_slice_packed_int32\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_slice_int32\n\t\t\t\tp.size = size_slice_int32\n\t\t\t}\n\t\t\tp.dec = (*Buffer).dec_slice_int32\n\t\t\tp.packedDec = (*Buffer).dec_slice_packed_int32\n\t\tcase reflect.Uint32:\n\t\t\tif p.Packed {\n\t\t\t\tp.enc = (*Buffer).enc_slice_packed_uint32\n\t\t\t\tp.size = size_slice_packed_uint32\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_slice_uint32\n\t\t\t\tp.size = size_slice_uint32\n\t\t\t}\n\t\t\tp.dec = (*Buffer).dec_slice_int32\n\t\t\tp.packedDec = (*Buffer).dec_slice_packed_int32\n\t\tcase reflect.Int64, reflect.Uint64:\n\t\t\tif p.Packed {\n\t\t\t\tp.enc = (*Buffer).enc_slice_packed_int64\n\t\t\t\tp.size = size_slice_packed_int64\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_slice_int64\n\t\t\t\tp.size = size_slice_int64\n\t\t\t}\n\t\t\tp.dec = (*Buffer).dec_slice_int64\n\t\t\tp.packedDec = (*Buffer).dec_slice_packed_int64\n\t\tcase reflect.Uint8:\n\t\t\tp.dec = (*Buffer).dec_slice_byte\n\t\t\tif p.proto3 {\n\t\t\t\tp.enc = (*Buffer).enc_proto3_slice_byte\n\t\t\t\tp.size = size_proto3_slice_byte\n\t\t\t} else {\n\t\t\t\tp.enc = (*Buffer).enc_slice_byte\n\t\t\t\tp.size = size_slice_byte\n\t\t\t}\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\tswitch t2.Bits() {\n\t\t\tcase 32:\n\t\t\t\t// can just treat them as bits\n\t\t\t\tif p.Packed {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_packed_uint32\n\t\t\t\t\tp.size = size_slice_packed_uint32\n\t\t\t\t} else {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_uint32\n\t\t\t\t\tp.size = size_slice_uint32\n\t\t\t\t}\n\t\t\t\tp.dec = (*Buffer).dec_slice_int32\n\t\t\t\tp.packedDec = (*Buffer).dec_slice_packed_int32\n\t\t\tcase 64:\n\t\t\t\t// can just treat them as bits\n\t\t\t\tif p.Packed {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_packed_int64\n\t\t\t\t\tp.size = size_slice_packed_int64\n\t\t\t\t} else {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_int64\n\t\t\t\t\tp.size = size_slice_int64\n\t\t\t\t}\n\t\t\t\tp.dec = (*Buffer).dec_slice_int64\n\t\t\t\tp.packedDec = (*Buffer).dec_slice_packed_int64\n\t\t\tdefault:\n\t\t\t\tlogNoSliceEnc(t1, t2)\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\tp.enc = (*Buffer).enc_slice_string\n\t\t\tp.dec = (*Buffer).dec_slice_string\n\t\t\tp.size = size_slice_string\n\t\tcase reflect.Ptr:\n\t\t\tswitch t3 := t2.Elem(); t3.Kind() {\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintf(os.Stderr, \"proto: no ptr oenc for %T -> %T -> %T\\n\", t1, t2, t3)\n\t\t\t\tbreak\n\t\t\tcase reflect.Struct:\n\t\t\t\tp.stype = t2.Elem()\n\t\t\t\tp.isMarshaler = isMarshaler(t2)\n\t\t\t\tp.isUnmarshaler = isUnmarshaler(t2)\n\t\t\t\tif p.Wire == \"bytes\" {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_struct_message\n\t\t\t\t\tp.dec = (*Buffer).dec_slice_struct_message\n\t\t\t\t\tp.size = size_slice_struct_message\n\t\t\t\t} else {\n\t\t\t\t\tp.enc = (*Buffer).enc_slice_struct_group\n\t\t\t\t\tp.dec = (*Buffer).dec_slice_struct_group\n\t\t\t\t\tp.size = size_slice_struct_group\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Slice:\n\t\t\tswitch t2.Elem().Kind() {\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintf(os.Stderr, \"proto: no slice elem oenc for %T -> %T -> %T\\n\", t1, t2, t2.Elem())\n\t\t\t\tbreak\n\t\t\tcase reflect.Uint8:\n\t\t\t\tp.enc = (*Buffer).enc_slice_slice_byte\n\t\t\t\tp.dec = (*Buffer).dec_slice_slice_byte\n\t\t\t\tp.size = size_slice_slice_byte\n\t\t\t}\n\t\t}\n\n\tcase reflect.Map:\n\t\tp.enc = (*Buffer).enc_new_map\n\t\tp.dec = (*Buffer).dec_new_map\n\t\tp.size = size_new_map\n\n\t\tp.mtype = t1\n\t\tp.mkeyprop = &Properties{}\n\t\tp.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), \"Key\", f.Tag.Get(\"protobuf_key\"), nil, lockGetProp)\n\t\tp.mvalprop = &Properties{}\n\t\tvtype := p.mtype.Elem()\n\t\tif vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice {\n\t\t\t// The value type is not a message (*T) or bytes ([]byte),\n\t\t\t// so we need encoders for the pointer to this type.\n\t\t\tvtype = reflect.PtrTo(vtype)\n\t\t}\n\t\tp.mvalprop.init(vtype, \"Value\", f.Tag.Get(\"protobuf_val\"), nil, lockGetProp)\n\t}\n\n\t// precalculate tag code\n\twire := p.WireType\n\tif p.Packed {\n\t\twire = WireBytes\n\t}\n\tx := uint32(p.Tag)<<3 | uint32(wire)\n\ti := 0\n\tfor i = 0; x > 127; i++ {\n\t\tp.tagbuf[i] = 0x80 | uint8(x&0x7F)\n\t\tx >>= 7\n\t}\n\tp.tagbuf[i] = uint8(x)\n\tp.tagcode = p.tagbuf[0 : i+1]\n\n\tif p.stype != nil {\n\t\tif lockGetProp {\n\t\t\tp.sprop = GetProperties(p.stype)\n\t\t} else {\n\t\t\tp.sprop = getPropertiesLocked(p.stype)\n\t\t}\n\t}\n}\n\nvar (\n\tmarshalerType   = reflect.TypeOf((*Marshaler)(nil)).Elem()\n\tunmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem()\n)\n\n// isMarshaler reports whether type t implements Marshaler.\nfunc isMarshaler(t reflect.Type) bool {\n\t// We're checking for (likely) pointer-receiver methods\n\t// so if t is not a pointer, something is very wrong.\n\t// The calls above only invoke isMarshaler on pointer types.\n\tif t.Kind() != reflect.Ptr {\n\t\tpanic(\"proto: misuse of isMarshaler\")\n\t}\n\treturn t.Implements(marshalerType)\n}\n\n// isUnmarshaler reports whether type t implements Unmarshaler.\nfunc isUnmarshaler(t reflect.Type) bool {\n\t// We're checking for (likely) pointer-receiver methods\n\t// so if t is not a pointer, something is very wrong.\n\t// The calls above only invoke isUnmarshaler on pointer types.\n\tif t.Kind() != reflect.Ptr {\n\t\tpanic(\"proto: misuse of isUnmarshaler\")\n\t}\n\treturn t.Implements(unmarshalerType)\n}\n\n// Init populates the properties from a protocol buffer struct tag.\nfunc (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {\n\tp.init(typ, name, tag, f, true)\n}\n\nfunc (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {\n\t// \"bytes,49,opt,def=hello!\"\n\tp.Name = name\n\tp.OrigName = name\n\tif f != nil {\n\t\tp.field = toField(f)\n\t}\n\tif tag == \"\" {\n\t\treturn\n\t}\n\tp.Parse(tag)\n\tp.setEncAndDec(typ, f, lockGetProp)\n}\n\nvar (\n\tpropertiesMu  sync.RWMutex\n\tpropertiesMap = make(map[reflect.Type]*StructProperties)\n)\n\n// GetProperties returns the list of properties for the type represented by t.\n// t must represent a generated struct type of a protocol message.\nfunc GetProperties(t reflect.Type) *StructProperties {\n\tif t.Kind() != reflect.Struct {\n\t\tpanic(\"proto: type must have kind struct\")\n\t}\n\n\t// Most calls to GetProperties in a long-running program will be\n\t// retrieving details for types we have seen before.\n\tpropertiesMu.RLock()\n\tsprop, ok := propertiesMap[t]\n\tpropertiesMu.RUnlock()\n\tif ok {\n\t\tif collectStats {\n\t\t\tstats.Chit++\n\t\t}\n\t\treturn sprop\n\t}\n\n\tpropertiesMu.Lock()\n\tsprop = getPropertiesLocked(t)\n\tpropertiesMu.Unlock()\n\treturn sprop\n}\n\n// getPropertiesLocked requires that propertiesMu is held.\nfunc getPropertiesLocked(t reflect.Type) *StructProperties {\n\tif prop, ok := propertiesMap[t]; ok {\n\t\tif collectStats {\n\t\t\tstats.Chit++\n\t\t}\n\t\treturn prop\n\t}\n\tif collectStats {\n\t\tstats.Cmiss++\n\t}\n\n\tprop := new(StructProperties)\n\t// in case of recursive protos, fill this in now.\n\tpropertiesMap[t] = prop\n\n\t// build properties\n\tprop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) ||\n\t\treflect.PtrTo(t).Implements(extendableProtoV1Type)\n\tprop.unrecField = invalidField\n\tprop.Prop = make([]*Properties, t.NumField())\n\tprop.order = make([]int, t.NumField())\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tp := new(Properties)\n\t\tname := f.Name\n\t\tp.init(f.Type, name, f.Tag.Get(\"protobuf\"), &f, false)\n\n\t\tif f.Name == \"XXX_InternalExtensions\" { // special case\n\t\t\tp.enc = (*Buffer).enc_exts\n\t\t\tp.dec = nil // not needed\n\t\t\tp.size = size_exts\n\t\t} else if f.Name == \"XXX_extensions\" { // special case\n\t\t\tp.enc = (*Buffer).enc_map\n\t\t\tp.dec = nil // not needed\n\t\t\tp.size = size_map\n\t\t} else if f.Name == \"XXX_unrecognized\" { // special case\n\t\t\tprop.unrecField = toField(&f)\n\t\t}\n\t\toneof := f.Tag.Get(\"protobuf_oneof\") // special case\n\t\tif oneof != \"\" {\n\t\t\t// Oneof fields don't use the traditional protobuf tag.\n\t\t\tp.OrigName = oneof\n\t\t}\n\t\tprop.Prop[i] = p\n\t\tprop.order[i] = i\n\t\tif debug {\n\t\t\tprint(i, \" \", f.Name, \" \", t.String(), \" \")\n\t\t\tif p.Tag > 0 {\n\t\t\t\tprint(p.String())\n\t\t\t}\n\t\t\tprint(\"\\n\")\n\t\t}\n\t\tif p.enc == nil && !strings.HasPrefix(f.Name, \"XXX_\") && oneof == \"\" {\n\t\t\tfmt.Fprintln(os.Stderr, \"proto: no encoder for\", f.Name, f.Type.String(), \"[GetProperties]\")\n\t\t}\n\t}\n\n\t// Re-order prop.order.\n\tsort.Sort(prop)\n\n\ttype oneofMessage interface {\n\t\tXXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})\n\t}\n\tif om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {\n\t\tvar oots []interface{}\n\t\tprop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs()\n\t\tprop.stype = t\n\n\t\t// Interpret oneof metadata.\n\t\tprop.OneofTypes = make(map[string]*OneofProperties)\n\t\tfor _, oot := range oots {\n\t\t\toop := &OneofProperties{\n\t\t\t\tType: reflect.ValueOf(oot).Type(), // *T\n\t\t\t\tProp: new(Properties),\n\t\t\t}\n\t\t\tsft := oop.Type.Elem().Field(0)\n\t\t\toop.Prop.Name = sft.Name\n\t\t\toop.Prop.Parse(sft.Tag.Get(\"protobuf\"))\n\t\t\t// There will be exactly one interface field that\n\t\t\t// this new value is assignable to.\n\t\t\tfor i := 0; i < t.NumField(); i++ {\n\t\t\t\tf := t.Field(i)\n\t\t\t\tif f.Type.Kind() != reflect.Interface {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !oop.Type.AssignableTo(f.Type) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\toop.Field = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tprop.OneofTypes[oop.Prop.OrigName] = oop\n\t\t}\n\t}\n\n\t// build required counts\n\t// build tags\n\treqCount := 0\n\tprop.decoderOrigNames = make(map[string]int)\n\tfor i, p := range prop.Prop {\n\t\tif strings.HasPrefix(p.Name, \"XXX_\") {\n\t\t\t// Internal fields should not appear in tags/origNames maps.\n\t\t\t// They are handled specially when encoding and decoding.\n\t\t\tcontinue\n\t\t}\n\t\tif p.Required {\n\t\t\treqCount++\n\t\t}\n\t\tprop.decoderTags.put(p.Tag, i)\n\t\tprop.decoderOrigNames[p.OrigName] = i\n\t}\n\tprop.reqCount = reqCount\n\n\treturn prop\n}\n\n// Return the Properties object for the x[0]'th field of the structure.\nfunc propByIndex(t reflect.Type, x []int) *Properties {\n\tif len(x) != 1 {\n\t\tfmt.Fprintf(os.Stderr, \"proto: field index dimension %d (not 1) for type %s\\n\", len(x), t)\n\t\treturn nil\n\t}\n\tprop := GetProperties(t)\n\treturn prop.Prop[x[0]]\n}\n\n// Get the address and type of a pointer to a struct from an interface.\nfunc getbase(pb Message) (t reflect.Type, b structPointer, err error) {\n\tif pb == nil {\n\t\terr = ErrNil\n\t\treturn\n\t}\n\t// get the reflect type of the pointer to the struct.\n\tt = reflect.TypeOf(pb)\n\t// get the address of the struct.\n\tvalue := reflect.ValueOf(pb)\n\tb = toStructPointer(value)\n\treturn\n}\n\n// A global registry of enum types.\n// The generated code will register the generated maps by calling RegisterEnum.\n\nvar enumValueMaps = make(map[string]map[string]int32)\n\n// RegisterEnum is called from the generated code to install the enum descriptor\n// maps into the global table to aid parsing text format protocol buffers.\nfunc RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {\n\tif _, ok := enumValueMaps[typeName]; ok {\n\t\tpanic(\"proto: duplicate enum registered: \" + typeName)\n\t}\n\tenumValueMaps[typeName] = valueMap\n}\n\n// EnumValueMap returns the mapping from names to integers of the\n// enum type enumType, or a nil if not found.\nfunc EnumValueMap(enumType string) map[string]int32 {\n\treturn enumValueMaps[enumType]\n}\n\n// A registry of all linked message types.\n// The string is a fully-qualified proto name (\"pkg.Message\").\nvar (\n\tprotoTypes    = make(map[string]reflect.Type)\n\trevProtoTypes = make(map[reflect.Type]string)\n)\n\n// RegisterType is called from generated code and maps from the fully qualified\n// proto name to the type (pointer to struct) of the protocol buffer.\nfunc RegisterType(x Message, name string) {\n\tif _, ok := protoTypes[name]; ok {\n\t\t// TODO: Some day, make this a panic.\n\t\tlog.Printf(\"proto: duplicate proto type registered: %s\", name)\n\t\treturn\n\t}\n\tt := reflect.TypeOf(x)\n\tprotoTypes[name] = t\n\trevProtoTypes[t] = name\n}\n\n// MessageName returns the fully-qualified proto name for the given message type.\nfunc MessageName(x Message) string {\n\ttype xname interface {\n\t\tXXX_MessageName() string\n\t}\n\tif m, ok := x.(xname); ok {\n\t\treturn m.XXX_MessageName()\n\t}\n\treturn revProtoTypes[reflect.TypeOf(x)]\n}\n\n// MessageType returns the message type (pointer to struct) for a named message.\nfunc MessageType(name string) reflect.Type { return protoTypes[name] }\n\n// A registry of all linked proto files.\nvar (\n\tprotoFiles = make(map[string][]byte) // file name => fileDescriptor\n)\n\n// RegisterFile is called from generated code and maps from the\n// full file name of a .proto file to its compressed FileDescriptorProto.\nfunc RegisterFile(filename string, fileDescriptor []byte) {\n\tprotoFiles[filename] = fileDescriptor\n}\n\n// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.\nfunc FileDescriptor(filename string) []byte { return protoFiles[filename] }\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go",
    "content": "// Code generated by protoc-gen-go.\n// source: proto3_proto/proto3.proto\n// DO NOT EDIT!\n\n/*\nPackage proto3_proto is a generated protocol buffer package.\n\nIt is generated from these files:\n\tproto3_proto/proto3.proto\n\nIt has these top-level messages:\n\tMessage\n\tNested\n\tMessageWithMap\n\tIntMap\n\tIntMaps\n*/\npackage proto3_proto\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport google_protobuf \"github.com/golang/protobuf/ptypes/any\"\nimport testdata \"github.com/golang/protobuf/proto/testdata\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype Message_Humour int32\n\nconst (\n\tMessage_UNKNOWN     Message_Humour = 0\n\tMessage_PUNS        Message_Humour = 1\n\tMessage_SLAPSTICK   Message_Humour = 2\n\tMessage_BILL_BAILEY Message_Humour = 3\n)\n\nvar Message_Humour_name = map[int32]string{\n\t0: \"UNKNOWN\",\n\t1: \"PUNS\",\n\t2: \"SLAPSTICK\",\n\t3: \"BILL_BAILEY\",\n}\nvar Message_Humour_value = map[string]int32{\n\t\"UNKNOWN\":     0,\n\t\"PUNS\":        1,\n\t\"SLAPSTICK\":   2,\n\t\"BILL_BAILEY\": 3,\n}\n\nfunc (x Message_Humour) String() string {\n\treturn proto.EnumName(Message_Humour_name, int32(x))\n}\nfunc (Message_Humour) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }\n\ntype Message struct {\n\tName         string                           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tHilarity     Message_Humour                   `protobuf:\"varint,2,opt,name=hilarity,enum=proto3_proto.Message_Humour\" json:\"hilarity,omitempty\"`\n\tHeightInCm   uint32                           `protobuf:\"varint,3,opt,name=height_in_cm,json=heightInCm\" json:\"height_in_cm,omitempty\"`\n\tData         []byte                           `protobuf:\"bytes,4,opt,name=data,proto3\" json:\"data,omitempty\"`\n\tResultCount  int64                            `protobuf:\"varint,7,opt,name=result_count,json=resultCount\" json:\"result_count,omitempty\"`\n\tTrueScotsman bool                             `protobuf:\"varint,8,opt,name=true_scotsman,json=trueScotsman\" json:\"true_scotsman,omitempty\"`\n\tScore        float32                          `protobuf:\"fixed32,9,opt,name=score\" json:\"score,omitempty\"`\n\tKey          []uint64                         `protobuf:\"varint,5,rep,packed,name=key\" json:\"key,omitempty\"`\n\tShortKey     []int32                          `protobuf:\"varint,19,rep,packed,name=short_key,json=shortKey\" json:\"short_key,omitempty\"`\n\tNested       *Nested                          `protobuf:\"bytes,6,opt,name=nested\" json:\"nested,omitempty\"`\n\tRFunny       []Message_Humour                 `protobuf:\"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour\" json:\"r_funny,omitempty\"`\n\tTerrain      map[string]*Nested               `protobuf:\"bytes,10,rep,name=terrain\" json:\"terrain,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tProto2Field  *testdata.SubDefaults            `protobuf:\"bytes,11,opt,name=proto2_field,json=proto2Field\" json:\"proto2_field,omitempty\"`\n\tProto2Value  map[string]*testdata.SubDefaults `protobuf:\"bytes,13,rep,name=proto2_value,json=proto2Value\" json:\"proto2_value,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tAnything     *google_protobuf.Any             `protobuf:\"bytes,14,opt,name=anything\" json:\"anything,omitempty\"`\n\tManyThings   []*google_protobuf.Any           `protobuf:\"bytes,15,rep,name=many_things,json=manyThings\" json:\"many_things,omitempty\"`\n\tSubmessage   *Message                         `protobuf:\"bytes,17,opt,name=submessage\" json:\"submessage,omitempty\"`\n\tChildren     []*Message                       `protobuf:\"bytes,18,rep,name=children\" json:\"children,omitempty\"`\n}\n\nfunc (m *Message) Reset()                    { *m = Message{} }\nfunc (m *Message) String() string            { return proto.CompactTextString(m) }\nfunc (*Message) ProtoMessage()               {}\nfunc (*Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\nfunc (m *Message) GetName() string {\n\tif m != nil {\n\t\treturn m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Message) GetHilarity() Message_Humour {\n\tif m != nil {\n\t\treturn m.Hilarity\n\t}\n\treturn Message_UNKNOWN\n}\n\nfunc (m *Message) GetHeightInCm() uint32 {\n\tif m != nil {\n\t\treturn m.HeightInCm\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetData() []byte {\n\tif m != nil {\n\t\treturn m.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetResultCount() int64 {\n\tif m != nil {\n\t\treturn m.ResultCount\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetTrueScotsman() bool {\n\tif m != nil {\n\t\treturn m.TrueScotsman\n\t}\n\treturn false\n}\n\nfunc (m *Message) GetScore() float32 {\n\tif m != nil {\n\t\treturn m.Score\n\t}\n\treturn 0\n}\n\nfunc (m *Message) GetKey() []uint64 {\n\tif m != nil {\n\t\treturn m.Key\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetShortKey() []int32 {\n\tif m != nil {\n\t\treturn m.ShortKey\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetNested() *Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetRFunny() []Message_Humour {\n\tif m != nil {\n\t\treturn m.RFunny\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetTerrain() map[string]*Nested {\n\tif m != nil {\n\t\treturn m.Terrain\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetProto2Field() *testdata.SubDefaults {\n\tif m != nil {\n\t\treturn m.Proto2Field\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetProto2Value() map[string]*testdata.SubDefaults {\n\tif m != nil {\n\t\treturn m.Proto2Value\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetAnything() *google_protobuf.Any {\n\tif m != nil {\n\t\treturn m.Anything\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetManyThings() []*google_protobuf.Any {\n\tif m != nil {\n\t\treturn m.ManyThings\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetSubmessage() *Message {\n\tif m != nil {\n\t\treturn m.Submessage\n\t}\n\treturn nil\n}\n\nfunc (m *Message) GetChildren() []*Message {\n\tif m != nil {\n\t\treturn m.Children\n\t}\n\treturn nil\n}\n\ntype Nested struct {\n\tBunny string `protobuf:\"bytes,1,opt,name=bunny\" json:\"bunny,omitempty\"`\n\tCute  bool   `protobuf:\"varint,2,opt,name=cute\" json:\"cute,omitempty\"`\n}\n\nfunc (m *Nested) Reset()                    { *m = Nested{} }\nfunc (m *Nested) String() string            { return proto.CompactTextString(m) }\nfunc (*Nested) ProtoMessage()               {}\nfunc (*Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\nfunc (m *Nested) GetBunny() string {\n\tif m != nil {\n\t\treturn m.Bunny\n\t}\n\treturn \"\"\n}\n\nfunc (m *Nested) GetCute() bool {\n\tif m != nil {\n\t\treturn m.Cute\n\t}\n\treturn false\n}\n\ntype MessageWithMap struct {\n\tByteMapping map[bool][]byte `protobuf:\"bytes,1,rep,name=byte_mapping,json=byteMapping\" json:\"byte_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value,proto3\"`\n}\n\nfunc (m *MessageWithMap) Reset()                    { *m = MessageWithMap{} }\nfunc (m *MessageWithMap) String() string            { return proto.CompactTextString(m) }\nfunc (*MessageWithMap) ProtoMessage()               {}\nfunc (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\nfunc (m *MessageWithMap) GetByteMapping() map[bool][]byte {\n\tif m != nil {\n\t\treturn m.ByteMapping\n\t}\n\treturn nil\n}\n\ntype IntMap struct {\n\tRtt map[int32]int32 `protobuf:\"bytes,1,rep,name=rtt\" json:\"rtt,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"varint,2,opt,name=value\"`\n}\n\nfunc (m *IntMap) Reset()                    { *m = IntMap{} }\nfunc (m *IntMap) String() string            { return proto.CompactTextString(m) }\nfunc (*IntMap) ProtoMessage()               {}\nfunc (*IntMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\n\nfunc (m *IntMap) GetRtt() map[int32]int32 {\n\tif m != nil {\n\t\treturn m.Rtt\n\t}\n\treturn nil\n}\n\ntype IntMaps struct {\n\tMaps []*IntMap `protobuf:\"bytes,1,rep,name=maps\" json:\"maps,omitempty\"`\n}\n\nfunc (m *IntMaps) Reset()                    { *m = IntMaps{} }\nfunc (m *IntMaps) String() string            { return proto.CompactTextString(m) }\nfunc (*IntMaps) ProtoMessage()               {}\nfunc (*IntMaps) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }\n\nfunc (m *IntMaps) GetMaps() []*IntMap {\n\tif m != nil {\n\t\treturn m.Maps\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterType((*Message)(nil), \"proto3_proto.Message\")\n\tproto.RegisterType((*Nested)(nil), \"proto3_proto.Nested\")\n\tproto.RegisterType((*MessageWithMap)(nil), \"proto3_proto.MessageWithMap\")\n\tproto.RegisterType((*IntMap)(nil), \"proto3_proto.IntMap\")\n\tproto.RegisterType((*IntMaps)(nil), \"proto3_proto.IntMaps\")\n\tproto.RegisterEnum(\"proto3_proto.Message_Humour\", Message_Humour_name, Message_Humour_value)\n}\n\nfunc init() { proto.RegisterFile(\"proto3_proto/proto3.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 733 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x53, 0x6d, 0x6f, 0xf3, 0x34,\n\t0x14, 0x25, 0x4d, 0x5f, 0xd2, 0x9b, 0x74, 0x0b, 0x5e, 0x91, 0xbc, 0x02, 0x52, 0x28, 0x12, 0x8a,\n\t0x78, 0x49, 0xa1, 0xd3, 0xd0, 0x84, 0x10, 0x68, 0x1b, 0x9b, 0xa8, 0xd6, 0x95, 0xca, 0xdd, 0x98,\n\t0xf8, 0x14, 0xa5, 0xad, 0xdb, 0x46, 0x34, 0x4e, 0x49, 0x1c, 0xa4, 0xfc, 0x1d, 0xfe, 0x28, 0x8f,\n\t0x6c, 0xa7, 0x5d, 0x36, 0x65, 0xcf, 0xf3, 0x29, 0xf6, 0xf1, 0xb9, 0xf7, 0x9c, 0x1c, 0x5f, 0xc3,\n\t0xe9, 0x2e, 0x89, 0x79, 0x7c, 0xe6, 0xcb, 0xcf, 0x40, 0x6d, 0x3c, 0xf9, 0x41, 0x56, 0xf9, 0xa8,\n\t0x77, 0xba, 0x8e, 0xe3, 0xf5, 0x96, 0x2a, 0xca, 0x3c, 0x5b, 0x0d, 0x02, 0x96, 0x2b, 0x62, 0xef,\n\t0x84, 0xd3, 0x94, 0x2f, 0x03, 0x1e, 0x0c, 0xc4, 0x42, 0x81, 0xfd, 0xff, 0x5b, 0xd0, 0xba, 0xa7,\n\t0x69, 0x1a, 0xac, 0x29, 0x42, 0x50, 0x67, 0x41, 0x44, 0xb1, 0xe6, 0x68, 0x6e, 0x9b, 0xc8, 0x35,\n\t0xba, 0x00, 0x63, 0x13, 0x6e, 0x83, 0x24, 0xe4, 0x39, 0xae, 0x39, 0x9a, 0x7b, 0x34, 0xfc, 0xcc,\n\t0x2b, 0x0b, 0x7a, 0x45, 0xb1, 0xf7, 0x7b, 0x16, 0xc5, 0x59, 0x42, 0x0e, 0x6c, 0xe4, 0x80, 0xb5,\n\t0xa1, 0xe1, 0x7a, 0xc3, 0xfd, 0x90, 0xf9, 0x8b, 0x08, 0xeb, 0x8e, 0xe6, 0x76, 0x08, 0x28, 0x6c,\n\t0xc4, 0xae, 0x23, 0xa1, 0x27, 0xec, 0xe0, 0xba, 0xa3, 0xb9, 0x16, 0x91, 0x6b, 0xf4, 0x05, 0x58,\n\t0x09, 0x4d, 0xb3, 0x2d, 0xf7, 0x17, 0x71, 0xc6, 0x38, 0x6e, 0x39, 0x9a, 0xab, 0x13, 0x53, 0x61,\n\t0xd7, 0x02, 0x42, 0x5f, 0x42, 0x87, 0x27, 0x19, 0xf5, 0xd3, 0x45, 0xcc, 0xd3, 0x28, 0x60, 0xd8,\n\t0x70, 0x34, 0xd7, 0x20, 0x96, 0x00, 0x67, 0x05, 0x86, 0xba, 0xd0, 0x48, 0x17, 0x71, 0x42, 0x71,\n\t0xdb, 0xd1, 0xdc, 0x1a, 0x51, 0x1b, 0x64, 0x83, 0xfe, 0x37, 0xcd, 0x71, 0xc3, 0xd1, 0xdd, 0x3a,\n\t0x11, 0x4b, 0xf4, 0x29, 0xb4, 0xd3, 0x4d, 0x9c, 0x70, 0x5f, 0xe0, 0x27, 0x8e, 0xee, 0x36, 0x88,\n\t0x21, 0x81, 0x3b, 0x9a, 0xa3, 0x6f, 0xa1, 0xc9, 0x68, 0xca, 0xe9, 0x12, 0x37, 0x1d, 0xcd, 0x35,\n\t0x87, 0xdd, 0x97, 0xbf, 0x3e, 0x91, 0x67, 0xa4, 0xe0, 0xa0, 0x73, 0x68, 0x25, 0xfe, 0x2a, 0x63,\n\t0x2c, 0xc7, 0xb6, 0xa3, 0x7f, 0x30, 0xa9, 0x66, 0x72, 0x2b, 0xb8, 0xe8, 0x67, 0x68, 0x71, 0x9a,\n\t0x24, 0x41, 0xc8, 0x30, 0x38, 0xba, 0x6b, 0x0e, 0xfb, 0xd5, 0x65, 0x0f, 0x8a, 0x74, 0xc3, 0x78,\n\t0x92, 0x93, 0x7d, 0x09, 0xba, 0x00, 0x75, 0xff, 0x43, 0x7f, 0x15, 0xd2, 0xed, 0x12, 0x9b, 0xd2,\n\t0xe8, 0x27, 0xde, 0xfe, 0xae, 0xbd, 0x59, 0x36, 0xff, 0x8d, 0xae, 0x82, 0x6c, 0xcb, 0x53, 0x62,\n\t0x2a, 0xea, 0xad, 0x60, 0xa2, 0xd1, 0xa1, 0xf2, 0xdf, 0x60, 0x9b, 0x51, 0xdc, 0x91, 0xe2, 0x5f,\n\t0x55, 0x8b, 0x4f, 0x25, 0xf3, 0x4f, 0x41, 0x54, 0x06, 0x8a, 0x56, 0x12, 0x41, 0xdf, 0x83, 0x11,\n\t0xb0, 0x9c, 0x6f, 0x42, 0xb6, 0xc6, 0x47, 0x45, 0x52, 0x6a, 0x0e, 0xbd, 0xfd, 0x1c, 0x7a, 0x97,\n\t0x2c, 0x27, 0x07, 0x16, 0x3a, 0x07, 0x33, 0x0a, 0x58, 0xee, 0xcb, 0x5d, 0x8a, 0x8f, 0xa5, 0x76,\n\t0x75, 0x11, 0x08, 0xe2, 0x83, 0xe4, 0xa1, 0x73, 0x80, 0x34, 0x9b, 0x47, 0xca, 0x14, 0xfe, 0xb8,\n\t0xf8, 0xd7, 0x2a, 0xc7, 0xa4, 0x44, 0x44, 0x3f, 0x80, 0xb1, 0xd8, 0x84, 0xdb, 0x65, 0x42, 0x19,\n\t0x46, 0x52, 0xea, 0x8d, 0xa2, 0x03, 0xad, 0x37, 0x05, 0xab, 0x1c, 0xf8, 0x7e, 0x72, 0xd4, 0xd3,\n\t0x90, 0x93, 0xf3, 0x35, 0x34, 0x54, 0x70, 0xb5, 0xf7, 0xcc, 0x86, 0xa2, 0xfc, 0x54, 0xbb, 0xd0,\n\t0x7a, 0x8f, 0x60, 0xbf, 0x4e, 0xb1, 0xa2, 0xeb, 0x37, 0x2f, 0xbb, 0xbe, 0x71, 0x91, 0xcf, 0x6d,\n\t0xfb, 0xbf, 0x42, 0x53, 0x0d, 0x14, 0x32, 0xa1, 0xf5, 0x38, 0xb9, 0x9b, 0xfc, 0xf1, 0x34, 0xb1,\n\t0x3f, 0x42, 0x06, 0xd4, 0xa7, 0x8f, 0x93, 0x99, 0xad, 0xa1, 0x0e, 0xb4, 0x67, 0xe3, 0xcb, 0xe9,\n\t0xec, 0x61, 0x74, 0x7d, 0x67, 0xd7, 0xd0, 0x31, 0x98, 0x57, 0xa3, 0xf1, 0xd8, 0xbf, 0xba, 0x1c,\n\t0x8d, 0x6f, 0xfe, 0xb2, 0xf5, 0xfe, 0x10, 0x9a, 0xca, 0xac, 0x78, 0x33, 0x73, 0x39, 0xbe, 0xca,\n\t0x8f, 0xda, 0x88, 0x57, 0xba, 0xc8, 0xb8, 0x32, 0x64, 0x10, 0xb9, 0xee, 0xff, 0xa7, 0xc1, 0x51,\n\t0x91, 0xd9, 0x53, 0xc8, 0x37, 0xf7, 0xc1, 0x0e, 0x4d, 0xc1, 0x9a, 0xe7, 0x9c, 0xfa, 0x51, 0xb0,\n\t0xdb, 0x89, 0x39, 0xd0, 0x64, 0xce, 0xdf, 0x55, 0xe6, 0x5c, 0xd4, 0x78, 0x57, 0x39, 0xa7, 0xf7,\n\t0x8a, 0x5f, 0x4c, 0xd5, 0xfc, 0x19, 0xe9, 0xfd, 0x02, 0xf6, 0x6b, 0x42, 0x39, 0x30, 0x43, 0x05,\n\t0xd6, 0x2d, 0x07, 0x66, 0x95, 0x93, 0xf9, 0x07, 0x9a, 0x23, 0xc6, 0x85, 0xb7, 0x01, 0xe8, 0x09,\n\t0xe7, 0x85, 0xa5, 0xcf, 0x5f, 0x5a, 0x52, 0x14, 0x8f, 0x70, 0xae, 0x2c, 0x08, 0x66, 0xef, 0x47,\n\t0x30, 0xf6, 0x40, 0x59, 0xb2, 0x51, 0x21, 0xd9, 0x28, 0x4b, 0x9e, 0x41, 0x4b, 0xf5, 0x4b, 0x91,\n\t0x0b, 0xf5, 0x28, 0xd8, 0xa5, 0x85, 0x68, 0xb7, 0x4a, 0x94, 0x48, 0xc6, 0xbc, 0xa9, 0x8e, 0xde,\n\t0x05, 0x00, 0x00, 0xff, 0xff, 0x75, 0x38, 0xad, 0x84, 0xe4, 0x05, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/proto3_proto/proto3.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\nimport \"google/protobuf/any.proto\";\nimport \"testdata/test.proto\";\n\npackage proto3_proto;\n\nmessage Message {\n  enum Humour {\n    UNKNOWN = 0;\n    PUNS = 1;\n    SLAPSTICK = 2;\n    BILL_BAILEY = 3;\n  }\n\n  string name = 1;\n  Humour hilarity = 2;\n  uint32 height_in_cm = 3;\n  bytes data = 4;\n  int64 result_count = 7;\n  bool true_scotsman = 8;\n  float score = 9;\n\n  repeated uint64 key = 5;\n  repeated int32 short_key = 19;\n  Nested nested = 6;\n  repeated Humour r_funny = 16;\n\n  map<string, Nested> terrain = 10;\n  testdata.SubDefaults proto2_field = 11;\n  map<string, testdata.SubDefaults> proto2_value = 13;\n\n  google.protobuf.Any anything = 14;\n  repeated google.protobuf.Any many_things = 15;\n\n  Message submessage = 17;\n  repeated Message children = 18;\n}\n\nmessage Nested {\n  string bunny = 1;\n  bool cute = 2;\n}\n\nmessage MessageWithMap {\n  map<bool, bytes> byte_mapping = 1;\n}\n\n\nmessage IntMap {\n  map<int32, int32> rtt = 1;\n}\n\nmessage IntMaps {\n  repeated IntMap maps = 1;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/proto3_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tpb \"github.com/golang/protobuf/proto/proto3_proto\"\n\ttpb \"github.com/golang/protobuf/proto/testdata\"\n)\n\nfunc TestProto3ZeroValues(t *testing.T) {\n\ttests := []struct {\n\t\tdesc string\n\t\tm    proto.Message\n\t}{\n\t\t{\"zero message\", &pb.Message{}},\n\t\t{\"empty bytes field\", &pb.Message{Data: []byte{}}},\n\t}\n\tfor _, test := range tests {\n\t\tb, err := proto.Marshal(test.m)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%s: proto.Marshal: %v\", test.desc, err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(b) > 0 {\n\t\t\tt.Errorf(\"%s: Encoding is non-empty: %q\", test.desc, b)\n\t\t}\n\t}\n}\n\nfunc TestRoundTripProto3(t *testing.T) {\n\tm := &pb.Message{\n\t\tName:         \"David\",          // (2 | 1<<3): 0x0a 0x05 \"David\"\n\t\tHilarity:     pb.Message_PUNS,  // (0 | 2<<3): 0x10 0x01\n\t\tHeightInCm:   178,              // (0 | 3<<3): 0x18 0xb2 0x01\n\t\tData:         []byte(\"roboto\"), // (2 | 4<<3): 0x20 0x06 \"roboto\"\n\t\tResultCount:  47,               // (0 | 7<<3): 0x38 0x2f\n\t\tTrueScotsman: true,             // (0 | 8<<3): 0x40 0x01\n\t\tScore:        8.1,              // (5 | 9<<3): 0x4d <8.1>\n\n\t\tKey: []uint64{1, 0xdeadbeef},\n\t\tNested: &pb.Nested{\n\t\t\tBunny: \"Monty\",\n\t\t},\n\t}\n\tt.Logf(\" m: %v\", m)\n\n\tb, err := proto.Marshal(m)\n\tif err != nil {\n\t\tt.Fatalf(\"proto.Marshal: %v\", err)\n\t}\n\tt.Logf(\" b: %q\", b)\n\n\tm2 := new(pb.Message)\n\tif err := proto.Unmarshal(b, m2); err != nil {\n\t\tt.Fatalf(\"proto.Unmarshal: %v\", err)\n\t}\n\tt.Logf(\"m2: %v\", m2)\n\n\tif !proto.Equal(m, m2) {\n\t\tt.Errorf(\"proto.Equal returned false:\\n m: %v\\nm2: %v\", m, m2)\n\t}\n}\n\nfunc TestGettersForBasicTypesExist(t *testing.T) {\n\tvar m pb.Message\n\tif got := m.GetNested().GetBunny(); got != \"\" {\n\t\tt.Errorf(\"m.GetNested().GetBunny() = %q, want empty string\", got)\n\t}\n\tif got := m.GetNested().GetCute(); got {\n\t\tt.Errorf(\"m.GetNested().GetCute() = %t, want false\", got)\n\t}\n}\n\nfunc TestProto3SetDefaults(t *testing.T) {\n\tin := &pb.Message{\n\t\tTerrain: map[string]*pb.Nested{\n\t\t\t\"meadow\": new(pb.Nested),\n\t\t},\n\t\tProto2Field: new(tpb.SubDefaults),\n\t\tProto2Value: map[string]*tpb.SubDefaults{\n\t\t\t\"badlands\": new(tpb.SubDefaults),\n\t\t},\n\t}\n\n\tgot := proto.Clone(in).(*pb.Message)\n\tproto.SetDefaults(got)\n\n\t// There are no defaults in proto3.  Everything should be the zero value, but\n\t// we need to remember to set defaults for nested proto2 messages.\n\twant := &pb.Message{\n\t\tTerrain: map[string]*pb.Nested{\n\t\t\t\"meadow\": new(pb.Nested),\n\t\t},\n\t\tProto2Field: &tpb.SubDefaults{N: proto.Int64(7)},\n\t\tProto2Value: map[string]*tpb.SubDefaults{\n\t\t\t\"badlands\": &tpb.SubDefaults{N: proto.Int64(7)},\n\t\t},\n\t}\n\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"with in = %v\\nproto.SetDefaults(in) =>\\ngot %v\\nwant %v\", in, got, want)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/size2_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\nimport (\n\t\"testing\"\n)\n\n// This is a separate file and package from size_test.go because that one uses\n// generated messages and thus may not be in package proto without having a circular\n// dependency, whereas this file tests unexported details of size.go.\n\nfunc TestVarintSize(t *testing.T) {\n\t// Check the edge cases carefully.\n\ttestCases := []struct {\n\t\tn    uint64\n\t\tsize int\n\t}{\n\t\t{0, 1},\n\t\t{1, 1},\n\t\t{127, 1},\n\t\t{128, 2},\n\t\t{16383, 2},\n\t\t{16384, 3},\n\t\t{1<<63 - 1, 9},\n\t\t{1 << 63, 10},\n\t}\n\tfor _, tc := range testCases {\n\t\tsize := sizeVarint(tc.n)\n\t\tif size != tc.size {\n\t\t\tt.Errorf(\"sizeVarint(%d) = %d, want %d\", tc.n, size, tc.size)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/size_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"log\"\n\t\"strings\"\n\t\"testing\"\n\n\t. \"github.com/golang/protobuf/proto\"\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\tpb \"github.com/golang/protobuf/proto/testdata\"\n)\n\nvar messageWithExtension1 = &pb.MyMessage{Count: Int32(7)}\n\n// messageWithExtension2 is in equal_test.go.\nvar messageWithExtension3 = &pb.MyMessage{Count: Int32(8)}\n\nfunc init() {\n\tif err := SetExtension(messageWithExtension1, pb.E_Ext_More, &pb.Ext{Data: String(\"Abbott\")}); err != nil {\n\t\tlog.Panicf(\"SetExtension: %v\", err)\n\t}\n\tif err := SetExtension(messageWithExtension3, pb.E_Ext_More, &pb.Ext{Data: String(\"Costello\")}); err != nil {\n\t\tlog.Panicf(\"SetExtension: %v\", err)\n\t}\n\n\t// Force messageWithExtension3 to have the extension encoded.\n\tMarshal(messageWithExtension3)\n\n}\n\nvar SizeTests = []struct {\n\tdesc string\n\tpb   Message\n}{\n\t{\"empty\", &pb.OtherMessage{}},\n\t// Basic types.\n\t{\"bool\", &pb.Defaults{F_Bool: Bool(true)}},\n\t{\"int32\", &pb.Defaults{F_Int32: Int32(12)}},\n\t{\"negative int32\", &pb.Defaults{F_Int32: Int32(-1)}},\n\t{\"small int64\", &pb.Defaults{F_Int64: Int64(1)}},\n\t{\"big int64\", &pb.Defaults{F_Int64: Int64(1 << 20)}},\n\t{\"negative int64\", &pb.Defaults{F_Int64: Int64(-1)}},\n\t{\"fixed32\", &pb.Defaults{F_Fixed32: Uint32(71)}},\n\t{\"fixed64\", &pb.Defaults{F_Fixed64: Uint64(72)}},\n\t{\"uint32\", &pb.Defaults{F_Uint32: Uint32(123)}},\n\t{\"uint64\", &pb.Defaults{F_Uint64: Uint64(124)}},\n\t{\"float\", &pb.Defaults{F_Float: Float32(12.6)}},\n\t{\"double\", &pb.Defaults{F_Double: Float64(13.9)}},\n\t{\"string\", &pb.Defaults{F_String: String(\"niles\")}},\n\t{\"bytes\", &pb.Defaults{F_Bytes: []byte(\"wowsa\")}},\n\t{\"bytes, empty\", &pb.Defaults{F_Bytes: []byte{}}},\n\t{\"sint32\", &pb.Defaults{F_Sint32: Int32(65)}},\n\t{\"sint64\", &pb.Defaults{F_Sint64: Int64(67)}},\n\t{\"enum\", &pb.Defaults{F_Enum: pb.Defaults_BLUE.Enum()}},\n\t// Repeated.\n\t{\"empty repeated bool\", &pb.MoreRepeated{Bools: []bool{}}},\n\t{\"repeated bool\", &pb.MoreRepeated{Bools: []bool{false, true, true, false}}},\n\t{\"packed repeated bool\", &pb.MoreRepeated{BoolsPacked: []bool{false, true, true, false, true, true, true}}},\n\t{\"repeated int32\", &pb.MoreRepeated{Ints: []int32{1, 12203, 1729, -1}}},\n\t{\"repeated int32 packed\", &pb.MoreRepeated{IntsPacked: []int32{1, 12203, 1729}}},\n\t{\"repeated int64 packed\", &pb.MoreRepeated{Int64SPacked: []int64{\n\t\t// Need enough large numbers to verify that the header is counting the number of bytes\n\t\t// for the field, not the number of elements.\n\t\t1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,\n\t\t1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62, 1 << 62,\n\t}}},\n\t{\"repeated string\", &pb.MoreRepeated{Strings: []string{\"r\", \"ken\", \"gri\"}}},\n\t{\"repeated fixed\", &pb.MoreRepeated{Fixeds: []uint32{1, 2, 3, 4}}},\n\t// Nested.\n\t{\"nested\", &pb.OldMessage{Nested: &pb.OldMessage_Nested{Name: String(\"whatever\")}}},\n\t{\"group\", &pb.GroupOld{G: &pb.GroupOld_G{X: Int32(12345)}}},\n\t// Other things.\n\t{\"unrecognized\", &pb.MoreRepeated{XXX_unrecognized: []byte{13<<3 | 0, 4}}},\n\t{\"extension (unencoded)\", messageWithExtension1},\n\t{\"extension (encoded)\", messageWithExtension3},\n\t// proto3 message\n\t{\"proto3 empty\", &proto3pb.Message{}},\n\t{\"proto3 bool\", &proto3pb.Message{TrueScotsman: true}},\n\t{\"proto3 int64\", &proto3pb.Message{ResultCount: 1}},\n\t{\"proto3 uint32\", &proto3pb.Message{HeightInCm: 123}},\n\t{\"proto3 float\", &proto3pb.Message{Score: 12.6}},\n\t{\"proto3 string\", &proto3pb.Message{Name: \"Snezana\"}},\n\t{\"proto3 bytes\", &proto3pb.Message{Data: []byte(\"wowsa\")}},\n\t{\"proto3 bytes, empty\", &proto3pb.Message{Data: []byte{}}},\n\t{\"proto3 enum\", &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},\n\t{\"proto3 map field with empty bytes\", &proto3pb.MessageWithMap{ByteMapping: map[bool][]byte{false: []byte{}}}},\n\n\t{\"map field\", &pb.MessageWithMap{NameMapping: map[int32]string{1: \"Rob\", 7: \"Andrew\"}}},\n\t{\"map field with message\", &pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{0x7001: &pb.FloatingPoint{F: Float64(2.0)}}}},\n\t{\"map field with bytes\", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte(\"this time for sure\")}}},\n\t{\"map field with empty bytes\", &pb.MessageWithMap{ByteMapping: map[bool][]byte{true: []byte{}}}},\n\n\t{\"map field with big entry\", &pb.MessageWithMap{NameMapping: map[int32]string{8: strings.Repeat(\"x\", 125)}}},\n\t{\"map field with big key and val\", &pb.MessageWithMap{StrToStr: map[string]string{strings.Repeat(\"x\", 70): strings.Repeat(\"y\", 70)}}},\n\t{\"map field with big numeric key\", &pb.MessageWithMap{NameMapping: map[int32]string{0xf00d: \"om nom nom\"}}},\n\n\t{\"oneof not set\", &pb.Oneof{}},\n\t{\"oneof bool\", &pb.Oneof{Union: &pb.Oneof_F_Bool{true}}},\n\t{\"oneof zero int32\", &pb.Oneof{Union: &pb.Oneof_F_Int32{0}}},\n\t{\"oneof big int32\", &pb.Oneof{Union: &pb.Oneof_F_Int32{1 << 20}}},\n\t{\"oneof int64\", &pb.Oneof{Union: &pb.Oneof_F_Int64{42}}},\n\t{\"oneof fixed32\", &pb.Oneof{Union: &pb.Oneof_F_Fixed32{43}}},\n\t{\"oneof fixed64\", &pb.Oneof{Union: &pb.Oneof_F_Fixed64{44}}},\n\t{\"oneof uint32\", &pb.Oneof{Union: &pb.Oneof_F_Uint32{45}}},\n\t{\"oneof uint64\", &pb.Oneof{Union: &pb.Oneof_F_Uint64{46}}},\n\t{\"oneof float\", &pb.Oneof{Union: &pb.Oneof_F_Float{47.1}}},\n\t{\"oneof double\", &pb.Oneof{Union: &pb.Oneof_F_Double{48.9}}},\n\t{\"oneof string\", &pb.Oneof{Union: &pb.Oneof_F_String{\"Rhythmic Fman\"}}},\n\t{\"oneof bytes\", &pb.Oneof{Union: &pb.Oneof_F_Bytes{[]byte(\"let go\")}}},\n\t{\"oneof sint32\", &pb.Oneof{Union: &pb.Oneof_F_Sint32{50}}},\n\t{\"oneof sint64\", &pb.Oneof{Union: &pb.Oneof_F_Sint64{51}}},\n\t{\"oneof enum\", &pb.Oneof{Union: &pb.Oneof_F_Enum{pb.MyMessage_BLUE}}},\n\t{\"message for oneof\", &pb.GoTestField{Label: String(\"k\"), Type: String(\"v\")}},\n\t{\"oneof message\", &pb.Oneof{Union: &pb.Oneof_F_Message{&pb.GoTestField{Label: String(\"k\"), Type: String(\"v\")}}}},\n\t{\"oneof group\", &pb.Oneof{Union: &pb.Oneof_FGroup{&pb.Oneof_F_Group{X: Int32(52)}}}},\n\t{\"oneof largest tag\", &pb.Oneof{Union: &pb.Oneof_F_Largest_Tag{1}}},\n\t{\"multiple oneofs\", &pb.Oneof{Union: &pb.Oneof_F_Int32{1}, Tormato: &pb.Oneof_Value{2}}},\n}\n\nfunc TestSize(t *testing.T) {\n\tfor _, tc := range SizeTests {\n\t\tsize := Size(tc.pb)\n\t\tb, err := Marshal(tc.pb)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%v: Marshal failed: %v\", tc.desc, err)\n\t\t\tcontinue\n\t\t}\n\t\tif size != len(b) {\n\t\t\tt.Errorf(\"%v: Size(%v) = %d, want %d\", tc.desc, tc.pb, size, len(b))\n\t\t\tt.Logf(\"%v: bytes: %#v\", tc.desc, b)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/testdata/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\ninclude ../../Make.protobuf\n\nall:\tregenerate\n\nregenerate:\n\trm -f test.pb.go\n\tmake test.pb.go\n\n# The following rules are just aids to development. Not needed for typical testing.\n\ndiff:\tregenerate\n\tgit diff test.pb.go\n\nrestore:\n\tcp test.pb.go.golden test.pb.go\n\npreserve:\n\tcp test.pb.go test.pb.go.golden\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/testdata/golden_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Verify that the compiler output for test.proto is unchanged.\n\npackage testdata\n\nimport (\n\t\"crypto/sha1\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"testing\"\n)\n\n// sum returns in string form (for easy comparison) the SHA-1 hash of the named file.\nfunc sum(t *testing.T, name string) string {\n\tdata, err := ioutil.ReadFile(name)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Logf(\"sum(%q): length is %d\", name, len(data))\n\thash := sha1.New()\n\t_, err = hash.Write(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn fmt.Sprintf(\"% x\", hash.Sum(nil))\n}\n\nfunc run(t *testing.T, name string, args ...string) {\n\tcmd := exec.Command(name, args...)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n\nfunc TestGolden(t *testing.T) {\n\t// Compute the original checksum.\n\tgoldenSum := sum(t, \"test.pb.go\")\n\t// Run the proto compiler.\n\trun(t, \"protoc\", \"--go_out=\"+os.TempDir(), \"test.proto\")\n\tnewFile := filepath.Join(os.TempDir(), \"test.pb.go\")\n\tdefer os.Remove(newFile)\n\t// Compute the new checksum.\n\tnewSum := sum(t, newFile)\n\t// Verify\n\tif newSum != goldenSum {\n\t\trun(t, \"diff\", \"-u\", \"test.pb.go\", newFile)\n\t\tt.Fatal(\"Code generated by protoc-gen-go has changed; update test.pb.go\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/testdata/test.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: test.proto\n\n/*\nPackage testdata is a generated protocol buffer package.\n\nIt is generated from these files:\n\ttest.proto\n\nIt has these top-level messages:\n\tGoEnum\n\tGoTestField\n\tGoTest\n\tGoTestRequiredGroupField\n\tGoSkipTest\n\tNonPackedTest\n\tPackedTest\n\tMaxTag\n\tOldMessage\n\tNewMessage\n\tInnerMessage\n\tOtherMessage\n\tRequiredInnerMessage\n\tMyMessage\n\tExt\n\tComplexExtension\n\tDefaultsMessage\n\tMyMessageSet\n\tEmpty\n\tMessageList\n\tStrings\n\tDefaults\n\tSubDefaults\n\tRepeatedEnum\n\tMoreRepeated\n\tGroupOld\n\tGroupNew\n\tFloatingPoint\n\tMessageWithMap\n\tOneof\n\tCommunique\n*/\npackage testdata\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype FOO int32\n\nconst (\n\tFOO_FOO1 FOO = 1\n)\n\nvar FOO_name = map[int32]string{\n\t1: \"FOO1\",\n}\nvar FOO_value = map[string]int32{\n\t\"FOO1\": 1,\n}\n\nfunc (x FOO) Enum() *FOO {\n\tp := new(FOO)\n\t*p = x\n\treturn p\n}\nfunc (x FOO) String() string {\n\treturn proto.EnumName(FOO_name, int32(x))\n}\nfunc (x *FOO) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FOO_value, data, \"FOO\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FOO(value)\n\treturn nil\n}\nfunc (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\n// An enum, for completeness.\ntype GoTest_KIND int32\n\nconst (\n\tGoTest_VOID GoTest_KIND = 0\n\t// Basic types\n\tGoTest_BOOL        GoTest_KIND = 1\n\tGoTest_BYTES       GoTest_KIND = 2\n\tGoTest_FINGERPRINT GoTest_KIND = 3\n\tGoTest_FLOAT       GoTest_KIND = 4\n\tGoTest_INT         GoTest_KIND = 5\n\tGoTest_STRING      GoTest_KIND = 6\n\tGoTest_TIME        GoTest_KIND = 7\n\t// Groupings\n\tGoTest_TUPLE GoTest_KIND = 8\n\tGoTest_ARRAY GoTest_KIND = 9\n\tGoTest_MAP   GoTest_KIND = 10\n\t// Table types\n\tGoTest_TABLE GoTest_KIND = 11\n\t// Functions\n\tGoTest_FUNCTION GoTest_KIND = 12\n)\n\nvar GoTest_KIND_name = map[int32]string{\n\t0:  \"VOID\",\n\t1:  \"BOOL\",\n\t2:  \"BYTES\",\n\t3:  \"FINGERPRINT\",\n\t4:  \"FLOAT\",\n\t5:  \"INT\",\n\t6:  \"STRING\",\n\t7:  \"TIME\",\n\t8:  \"TUPLE\",\n\t9:  \"ARRAY\",\n\t10: \"MAP\",\n\t11: \"TABLE\",\n\t12: \"FUNCTION\",\n}\nvar GoTest_KIND_value = map[string]int32{\n\t\"VOID\":        0,\n\t\"BOOL\":        1,\n\t\"BYTES\":       2,\n\t\"FINGERPRINT\": 3,\n\t\"FLOAT\":       4,\n\t\"INT\":         5,\n\t\"STRING\":      6,\n\t\"TIME\":        7,\n\t\"TUPLE\":       8,\n\t\"ARRAY\":       9,\n\t\"MAP\":         10,\n\t\"TABLE\":       11,\n\t\"FUNCTION\":    12,\n}\n\nfunc (x GoTest_KIND) Enum() *GoTest_KIND {\n\tp := new(GoTest_KIND)\n\t*p = x\n\treturn p\n}\nfunc (x GoTest_KIND) String() string {\n\treturn proto.EnumName(GoTest_KIND_name, int32(x))\n}\nfunc (x *GoTest_KIND) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, \"GoTest_KIND\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = GoTest_KIND(value)\n\treturn nil\n}\nfunc (GoTest_KIND) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }\n\ntype MyMessage_Color int32\n\nconst (\n\tMyMessage_RED   MyMessage_Color = 0\n\tMyMessage_GREEN MyMessage_Color = 1\n\tMyMessage_BLUE  MyMessage_Color = 2\n)\n\nvar MyMessage_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\nvar MyMessage_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x MyMessage_Color) Enum() *MyMessage_Color {\n\tp := new(MyMessage_Color)\n\t*p = x\n\treturn p\n}\nfunc (x MyMessage_Color) String() string {\n\treturn proto.EnumName(MyMessage_Color_name, int32(x))\n}\nfunc (x *MyMessage_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, \"MyMessage_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MyMessage_Color(value)\n\treturn nil\n}\nfunc (MyMessage_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} }\n\ntype DefaultsMessage_DefaultsEnum int32\n\nconst (\n\tDefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0\n\tDefaultsMessage_ONE  DefaultsMessage_DefaultsEnum = 1\n\tDefaultsMessage_TWO  DefaultsMessage_DefaultsEnum = 2\n)\n\nvar DefaultsMessage_DefaultsEnum_name = map[int32]string{\n\t0: \"ZERO\",\n\t1: \"ONE\",\n\t2: \"TWO\",\n}\nvar DefaultsMessage_DefaultsEnum_value = map[string]int32{\n\t\"ZERO\": 0,\n\t\"ONE\":  1,\n\t\"TWO\":  2,\n}\n\nfunc (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum {\n\tp := new(DefaultsMessage_DefaultsEnum)\n\t*p = x\n\treturn p\n}\nfunc (x DefaultsMessage_DefaultsEnum) String() string {\n\treturn proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x))\n}\nfunc (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, \"DefaultsMessage_DefaultsEnum\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = DefaultsMessage_DefaultsEnum(value)\n\treturn nil\n}\nfunc (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{16, 0}\n}\n\ntype Defaults_Color int32\n\nconst (\n\tDefaults_RED   Defaults_Color = 0\n\tDefaults_GREEN Defaults_Color = 1\n\tDefaults_BLUE  Defaults_Color = 2\n)\n\nvar Defaults_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\nvar Defaults_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Defaults_Color) Enum() *Defaults_Color {\n\tp := new(Defaults_Color)\n\t*p = x\n\treturn p\n}\nfunc (x Defaults_Color) String() string {\n\treturn proto.EnumName(Defaults_Color_name, int32(x))\n}\nfunc (x *Defaults_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, \"Defaults_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Defaults_Color(value)\n\treturn nil\n}\nfunc (Defaults_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{21, 0} }\n\ntype RepeatedEnum_Color int32\n\nconst (\n\tRepeatedEnum_RED RepeatedEnum_Color = 1\n)\n\nvar RepeatedEnum_Color_name = map[int32]string{\n\t1: \"RED\",\n}\nvar RepeatedEnum_Color_value = map[string]int32{\n\t\"RED\": 1,\n}\n\nfunc (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color {\n\tp := new(RepeatedEnum_Color)\n\t*p = x\n\treturn p\n}\nfunc (x RepeatedEnum_Color) String() string {\n\treturn proto.EnumName(RepeatedEnum_Color_name, int32(x))\n}\nfunc (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, \"RepeatedEnum_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = RepeatedEnum_Color(value)\n\treturn nil\n}\nfunc (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{23, 0} }\n\ntype GoEnum struct {\n\tFoo              *FOO   `protobuf:\"varint,1,req,name=foo,enum=testdata.FOO\" json:\"foo,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *GoEnum) Reset()                    { *m = GoEnum{} }\nfunc (m *GoEnum) String() string            { return proto.CompactTextString(m) }\nfunc (*GoEnum) ProtoMessage()               {}\nfunc (*GoEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\nfunc (m *GoEnum) GetFoo() FOO {\n\tif m != nil && m.Foo != nil {\n\t\treturn *m.Foo\n\t}\n\treturn FOO_FOO1\n}\n\ntype GoTestField struct {\n\tLabel            *string `protobuf:\"bytes,1,req,name=Label\" json:\"Label,omitempty\"`\n\tType             *string `protobuf:\"bytes,2,req,name=Type\" json:\"Type,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *GoTestField) Reset()                    { *m = GoTestField{} }\nfunc (m *GoTestField) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTestField) ProtoMessage()               {}\nfunc (*GoTestField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\nfunc (m *GoTestField) GetLabel() string {\n\tif m != nil && m.Label != nil {\n\t\treturn *m.Label\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTestField) GetType() string {\n\tif m != nil && m.Type != nil {\n\t\treturn *m.Type\n\t}\n\treturn \"\"\n}\n\ntype GoTest struct {\n\t// Some typical parameters\n\tKind  *GoTest_KIND `protobuf:\"varint,1,req,name=Kind,enum=testdata.GoTest_KIND\" json:\"Kind,omitempty\"`\n\tTable *string      `protobuf:\"bytes,2,opt,name=Table\" json:\"Table,omitempty\"`\n\tParam *int32       `protobuf:\"varint,3,opt,name=Param\" json:\"Param,omitempty\"`\n\t// Required, repeated and optional foreign fields.\n\tRequiredField *GoTestField   `protobuf:\"bytes,4,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tRepeatedField []*GoTestField `protobuf:\"bytes,5,rep,name=RepeatedField\" json:\"RepeatedField,omitempty\"`\n\tOptionalField *GoTestField   `protobuf:\"bytes,6,opt,name=OptionalField\" json:\"OptionalField,omitempty\"`\n\t// Required fields of all basic types\n\tF_BoolRequired    *bool    `protobuf:\"varint,10,req,name=F_Bool_required,json=FBoolRequired\" json:\"F_Bool_required,omitempty\"`\n\tF_Int32Required   *int32   `protobuf:\"varint,11,req,name=F_Int32_required,json=FInt32Required\" json:\"F_Int32_required,omitempty\"`\n\tF_Int64Required   *int64   `protobuf:\"varint,12,req,name=F_Int64_required,json=FInt64Required\" json:\"F_Int64_required,omitempty\"`\n\tF_Fixed32Required *uint32  `protobuf:\"fixed32,13,req,name=F_Fixed32_required,json=FFixed32Required\" json:\"F_Fixed32_required,omitempty\"`\n\tF_Fixed64Required *uint64  `protobuf:\"fixed64,14,req,name=F_Fixed64_required,json=FFixed64Required\" json:\"F_Fixed64_required,omitempty\"`\n\tF_Uint32Required  *uint32  `protobuf:\"varint,15,req,name=F_Uint32_required,json=FUint32Required\" json:\"F_Uint32_required,omitempty\"`\n\tF_Uint64Required  *uint64  `protobuf:\"varint,16,req,name=F_Uint64_required,json=FUint64Required\" json:\"F_Uint64_required,omitempty\"`\n\tF_FloatRequired   *float32 `protobuf:\"fixed32,17,req,name=F_Float_required,json=FFloatRequired\" json:\"F_Float_required,omitempty\"`\n\tF_DoubleRequired  *float64 `protobuf:\"fixed64,18,req,name=F_Double_required,json=FDoubleRequired\" json:\"F_Double_required,omitempty\"`\n\tF_StringRequired  *string  `protobuf:\"bytes,19,req,name=F_String_required,json=FStringRequired\" json:\"F_String_required,omitempty\"`\n\tF_BytesRequired   []byte   `protobuf:\"bytes,101,req,name=F_Bytes_required,json=FBytesRequired\" json:\"F_Bytes_required,omitempty\"`\n\tF_Sint32Required  *int32   `protobuf:\"zigzag32,102,req,name=F_Sint32_required,json=FSint32Required\" json:\"F_Sint32_required,omitempty\"`\n\tF_Sint64Required  *int64   `protobuf:\"zigzag64,103,req,name=F_Sint64_required,json=FSint64Required\" json:\"F_Sint64_required,omitempty\"`\n\t// Repeated fields of all basic types\n\tF_BoolRepeated    []bool    `protobuf:\"varint,20,rep,name=F_Bool_repeated,json=FBoolRepeated\" json:\"F_Bool_repeated,omitempty\"`\n\tF_Int32Repeated   []int32   `protobuf:\"varint,21,rep,name=F_Int32_repeated,json=FInt32Repeated\" json:\"F_Int32_repeated,omitempty\"`\n\tF_Int64Repeated   []int64   `protobuf:\"varint,22,rep,name=F_Int64_repeated,json=FInt64Repeated\" json:\"F_Int64_repeated,omitempty\"`\n\tF_Fixed32Repeated []uint32  `protobuf:\"fixed32,23,rep,name=F_Fixed32_repeated,json=FFixed32Repeated\" json:\"F_Fixed32_repeated,omitempty\"`\n\tF_Fixed64Repeated []uint64  `protobuf:\"fixed64,24,rep,name=F_Fixed64_repeated,json=FFixed64Repeated\" json:\"F_Fixed64_repeated,omitempty\"`\n\tF_Uint32Repeated  []uint32  `protobuf:\"varint,25,rep,name=F_Uint32_repeated,json=FUint32Repeated\" json:\"F_Uint32_repeated,omitempty\"`\n\tF_Uint64Repeated  []uint64  `protobuf:\"varint,26,rep,name=F_Uint64_repeated,json=FUint64Repeated\" json:\"F_Uint64_repeated,omitempty\"`\n\tF_FloatRepeated   []float32 `protobuf:\"fixed32,27,rep,name=F_Float_repeated,json=FFloatRepeated\" json:\"F_Float_repeated,omitempty\"`\n\tF_DoubleRepeated  []float64 `protobuf:\"fixed64,28,rep,name=F_Double_repeated,json=FDoubleRepeated\" json:\"F_Double_repeated,omitempty\"`\n\tF_StringRepeated  []string  `protobuf:\"bytes,29,rep,name=F_String_repeated,json=FStringRepeated\" json:\"F_String_repeated,omitempty\"`\n\tF_BytesRepeated   [][]byte  `protobuf:\"bytes,201,rep,name=F_Bytes_repeated,json=FBytesRepeated\" json:\"F_Bytes_repeated,omitempty\"`\n\tF_Sint32Repeated  []int32   `protobuf:\"zigzag32,202,rep,name=F_Sint32_repeated,json=FSint32Repeated\" json:\"F_Sint32_repeated,omitempty\"`\n\tF_Sint64Repeated  []int64   `protobuf:\"zigzag64,203,rep,name=F_Sint64_repeated,json=FSint64Repeated\" json:\"F_Sint64_repeated,omitempty\"`\n\t// Optional fields of all basic types\n\tF_BoolOptional    *bool    `protobuf:\"varint,30,opt,name=F_Bool_optional,json=FBoolOptional\" json:\"F_Bool_optional,omitempty\"`\n\tF_Int32Optional   *int32   `protobuf:\"varint,31,opt,name=F_Int32_optional,json=FInt32Optional\" json:\"F_Int32_optional,omitempty\"`\n\tF_Int64Optional   *int64   `protobuf:\"varint,32,opt,name=F_Int64_optional,json=FInt64Optional\" json:\"F_Int64_optional,omitempty\"`\n\tF_Fixed32Optional *uint32  `protobuf:\"fixed32,33,opt,name=F_Fixed32_optional,json=FFixed32Optional\" json:\"F_Fixed32_optional,omitempty\"`\n\tF_Fixed64Optional *uint64  `protobuf:\"fixed64,34,opt,name=F_Fixed64_optional,json=FFixed64Optional\" json:\"F_Fixed64_optional,omitempty\"`\n\tF_Uint32Optional  *uint32  `protobuf:\"varint,35,opt,name=F_Uint32_optional,json=FUint32Optional\" json:\"F_Uint32_optional,omitempty\"`\n\tF_Uint64Optional  *uint64  `protobuf:\"varint,36,opt,name=F_Uint64_optional,json=FUint64Optional\" json:\"F_Uint64_optional,omitempty\"`\n\tF_FloatOptional   *float32 `protobuf:\"fixed32,37,opt,name=F_Float_optional,json=FFloatOptional\" json:\"F_Float_optional,omitempty\"`\n\tF_DoubleOptional  *float64 `protobuf:\"fixed64,38,opt,name=F_Double_optional,json=FDoubleOptional\" json:\"F_Double_optional,omitempty\"`\n\tF_StringOptional  *string  `protobuf:\"bytes,39,opt,name=F_String_optional,json=FStringOptional\" json:\"F_String_optional,omitempty\"`\n\tF_BytesOptional   []byte   `protobuf:\"bytes,301,opt,name=F_Bytes_optional,json=FBytesOptional\" json:\"F_Bytes_optional,omitempty\"`\n\tF_Sint32Optional  *int32   `protobuf:\"zigzag32,302,opt,name=F_Sint32_optional,json=FSint32Optional\" json:\"F_Sint32_optional,omitempty\"`\n\tF_Sint64Optional  *int64   `protobuf:\"zigzag64,303,opt,name=F_Sint64_optional,json=FSint64Optional\" json:\"F_Sint64_optional,omitempty\"`\n\t// Default-valued fields of all basic types\n\tF_BoolDefaulted    *bool    `protobuf:\"varint,40,opt,name=F_Bool_defaulted,json=FBoolDefaulted,def=1\" json:\"F_Bool_defaulted,omitempty\"`\n\tF_Int32Defaulted   *int32   `protobuf:\"varint,41,opt,name=F_Int32_defaulted,json=FInt32Defaulted,def=32\" json:\"F_Int32_defaulted,omitempty\"`\n\tF_Int64Defaulted   *int64   `protobuf:\"varint,42,opt,name=F_Int64_defaulted,json=FInt64Defaulted,def=64\" json:\"F_Int64_defaulted,omitempty\"`\n\tF_Fixed32Defaulted *uint32  `protobuf:\"fixed32,43,opt,name=F_Fixed32_defaulted,json=FFixed32Defaulted,def=320\" json:\"F_Fixed32_defaulted,omitempty\"`\n\tF_Fixed64Defaulted *uint64  `protobuf:\"fixed64,44,opt,name=F_Fixed64_defaulted,json=FFixed64Defaulted,def=640\" json:\"F_Fixed64_defaulted,omitempty\"`\n\tF_Uint32Defaulted  *uint32  `protobuf:\"varint,45,opt,name=F_Uint32_defaulted,json=FUint32Defaulted,def=3200\" json:\"F_Uint32_defaulted,omitempty\"`\n\tF_Uint64Defaulted  *uint64  `protobuf:\"varint,46,opt,name=F_Uint64_defaulted,json=FUint64Defaulted,def=6400\" json:\"F_Uint64_defaulted,omitempty\"`\n\tF_FloatDefaulted   *float32 `protobuf:\"fixed32,47,opt,name=F_Float_defaulted,json=FFloatDefaulted,def=314159\" json:\"F_Float_defaulted,omitempty\"`\n\tF_DoubleDefaulted  *float64 `protobuf:\"fixed64,48,opt,name=F_Double_defaulted,json=FDoubleDefaulted,def=271828\" json:\"F_Double_defaulted,omitempty\"`\n\tF_StringDefaulted  *string  `protobuf:\"bytes,49,opt,name=F_String_defaulted,json=FStringDefaulted,def=hello, \\\"world!\\\"\\n\" json:\"F_String_defaulted,omitempty\"`\n\tF_BytesDefaulted   []byte   `protobuf:\"bytes,401,opt,name=F_Bytes_defaulted,json=FBytesDefaulted,def=Bignose\" json:\"F_Bytes_defaulted,omitempty\"`\n\tF_Sint32Defaulted  *int32   `protobuf:\"zigzag32,402,opt,name=F_Sint32_defaulted,json=FSint32Defaulted,def=-32\" json:\"F_Sint32_defaulted,omitempty\"`\n\tF_Sint64Defaulted  *int64   `protobuf:\"zigzag64,403,opt,name=F_Sint64_defaulted,json=FSint64Defaulted,def=-64\" json:\"F_Sint64_defaulted,omitempty\"`\n\t// Packed repeated fields (no string or bytes).\n\tF_BoolRepeatedPacked    []bool                  `protobuf:\"varint,50,rep,packed,name=F_Bool_repeated_packed,json=FBoolRepeatedPacked\" json:\"F_Bool_repeated_packed,omitempty\"`\n\tF_Int32RepeatedPacked   []int32                 `protobuf:\"varint,51,rep,packed,name=F_Int32_repeated_packed,json=FInt32RepeatedPacked\" json:\"F_Int32_repeated_packed,omitempty\"`\n\tF_Int64RepeatedPacked   []int64                 `protobuf:\"varint,52,rep,packed,name=F_Int64_repeated_packed,json=FInt64RepeatedPacked\" json:\"F_Int64_repeated_packed,omitempty\"`\n\tF_Fixed32RepeatedPacked []uint32                `protobuf:\"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=FFixed32RepeatedPacked\" json:\"F_Fixed32_repeated_packed,omitempty\"`\n\tF_Fixed64RepeatedPacked []uint64                `protobuf:\"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=FFixed64RepeatedPacked\" json:\"F_Fixed64_repeated_packed,omitempty\"`\n\tF_Uint32RepeatedPacked  []uint32                `protobuf:\"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=FUint32RepeatedPacked\" json:\"F_Uint32_repeated_packed,omitempty\"`\n\tF_Uint64RepeatedPacked  []uint64                `protobuf:\"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=FUint64RepeatedPacked\" json:\"F_Uint64_repeated_packed,omitempty\"`\n\tF_FloatRepeatedPacked   []float32               `protobuf:\"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=FFloatRepeatedPacked\" json:\"F_Float_repeated_packed,omitempty\"`\n\tF_DoubleRepeatedPacked  []float64               `protobuf:\"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=FDoubleRepeatedPacked\" json:\"F_Double_repeated_packed,omitempty\"`\n\tF_Sint32RepeatedPacked  []int32                 `protobuf:\"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=FSint32RepeatedPacked\" json:\"F_Sint32_repeated_packed,omitempty\"`\n\tF_Sint64RepeatedPacked  []int64                 `protobuf:\"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=FSint64RepeatedPacked\" json:\"F_Sint64_repeated_packed,omitempty\"`\n\tRequiredgroup           *GoTest_RequiredGroup   `protobuf:\"group,70,req,name=RequiredGroup,json=requiredgroup\" json:\"requiredgroup,omitempty\"`\n\tRepeatedgroup           []*GoTest_RepeatedGroup `protobuf:\"group,80,rep,name=RepeatedGroup,json=repeatedgroup\" json:\"repeatedgroup,omitempty\"`\n\tOptionalgroup           *GoTest_OptionalGroup   `protobuf:\"group,90,opt,name=OptionalGroup,json=optionalgroup\" json:\"optionalgroup,omitempty\"`\n\tXXX_unrecognized        []byte                  `json:\"-\"`\n}\n\nfunc (m *GoTest) Reset()                    { *m = GoTest{} }\nfunc (m *GoTest) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTest) ProtoMessage()               {}\nfunc (*GoTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\nconst Default_GoTest_F_BoolDefaulted bool = true\nconst Default_GoTest_F_Int32Defaulted int32 = 32\nconst Default_GoTest_F_Int64Defaulted int64 = 64\nconst Default_GoTest_F_Fixed32Defaulted uint32 = 320\nconst Default_GoTest_F_Fixed64Defaulted uint64 = 640\nconst Default_GoTest_F_Uint32Defaulted uint32 = 3200\nconst Default_GoTest_F_Uint64Defaulted uint64 = 6400\nconst Default_GoTest_F_FloatDefaulted float32 = 314159\nconst Default_GoTest_F_DoubleDefaulted float64 = 271828\nconst Default_GoTest_F_StringDefaulted string = \"hello, \\\"world!\\\"\\n\"\n\nvar Default_GoTest_F_BytesDefaulted []byte = []byte(\"Bignose\")\n\nconst Default_GoTest_F_Sint32Defaulted int32 = -32\nconst Default_GoTest_F_Sint64Defaulted int64 = -64\n\nfunc (m *GoTest) GetKind() GoTest_KIND {\n\tif m != nil && m.Kind != nil {\n\t\treturn *m.Kind\n\t}\n\treturn GoTest_VOID\n}\n\nfunc (m *GoTest) GetTable() string {\n\tif m != nil && m.Table != nil {\n\t\treturn *m.Table\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetParam() int32 {\n\tif m != nil && m.Param != nil {\n\t\treturn *m.Param\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetRequiredField() *GoTestField {\n\tif m != nil {\n\t\treturn m.RequiredField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRepeatedField() []*GoTestField {\n\tif m != nil {\n\t\treturn m.RepeatedField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetOptionalField() *GoTestField {\n\tif m != nil {\n\t\treturn m.OptionalField\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BoolRequired() bool {\n\tif m != nil && m.F_BoolRequired != nil {\n\t\treturn *m.F_BoolRequired\n\t}\n\treturn false\n}\n\nfunc (m *GoTest) GetF_Int32Required() int32 {\n\tif m != nil && m.F_Int32Required != nil {\n\t\treturn *m.F_Int32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Int64Required() int64 {\n\tif m != nil && m.F_Int64Required != nil {\n\t\treturn *m.F_Int64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed32Required() uint32 {\n\tif m != nil && m.F_Fixed32Required != nil {\n\t\treturn *m.F_Fixed32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed64Required() uint64 {\n\tif m != nil && m.F_Fixed64Required != nil {\n\t\treturn *m.F_Fixed64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint32Required() uint32 {\n\tif m != nil && m.F_Uint32Required != nil {\n\t\treturn *m.F_Uint32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint64Required() uint64 {\n\tif m != nil && m.F_Uint64Required != nil {\n\t\treturn *m.F_Uint64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_FloatRequired() float32 {\n\tif m != nil && m.F_FloatRequired != nil {\n\t\treturn *m.F_FloatRequired\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_DoubleRequired() float64 {\n\tif m != nil && m.F_DoubleRequired != nil {\n\t\treturn *m.F_DoubleRequired\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_StringRequired() string {\n\tif m != nil && m.F_StringRequired != nil {\n\t\treturn *m.F_StringRequired\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetF_BytesRequired() []byte {\n\tif m != nil {\n\t\treturn m.F_BytesRequired\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Required() int32 {\n\tif m != nil && m.F_Sint32Required != nil {\n\t\treturn *m.F_Sint32Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sint64Required() int64 {\n\tif m != nil && m.F_Sint64Required != nil {\n\t\treturn *m.F_Sint64Required\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_BoolRepeated() []bool {\n\tif m != nil {\n\t\treturn m.F_BoolRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int32Repeated() []int32 {\n\tif m != nil {\n\t\treturn m.F_Int32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int64Repeated() []int64 {\n\tif m != nil {\n\t\treturn m.F_Int64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed32Repeated() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Fixed32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed64Repeated() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Fixed64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint32Repeated() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Uint32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint64Repeated() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Uint64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_FloatRepeated() []float32 {\n\tif m != nil {\n\t\treturn m.F_FloatRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_DoubleRepeated() []float64 {\n\tif m != nil {\n\t\treturn m.F_DoubleRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_StringRepeated() []string {\n\tif m != nil {\n\t\treturn m.F_StringRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BytesRepeated() [][]byte {\n\tif m != nil {\n\t\treturn m.F_BytesRepeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Repeated() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sint32Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint64Repeated() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sint64Repeated\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_BoolOptional() bool {\n\tif m != nil && m.F_BoolOptional != nil {\n\t\treturn *m.F_BoolOptional\n\t}\n\treturn false\n}\n\nfunc (m *GoTest) GetF_Int32Optional() int32 {\n\tif m != nil && m.F_Int32Optional != nil {\n\t\treturn *m.F_Int32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Int64Optional() int64 {\n\tif m != nil && m.F_Int64Optional != nil {\n\t\treturn *m.F_Int64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed32Optional() uint32 {\n\tif m != nil && m.F_Fixed32Optional != nil {\n\t\treturn *m.F_Fixed32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Fixed64Optional() uint64 {\n\tif m != nil && m.F_Fixed64Optional != nil {\n\t\treturn *m.F_Fixed64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint32Optional() uint32 {\n\tif m != nil && m.F_Uint32Optional != nil {\n\t\treturn *m.F_Uint32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Uint64Optional() uint64 {\n\tif m != nil && m.F_Uint64Optional != nil {\n\t\treturn *m.F_Uint64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_FloatOptional() float32 {\n\tif m != nil && m.F_FloatOptional != nil {\n\t\treturn *m.F_FloatOptional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_DoubleOptional() float64 {\n\tif m != nil && m.F_DoubleOptional != nil {\n\t\treturn *m.F_DoubleOptional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_StringOptional() string {\n\tif m != nil && m.F_StringOptional != nil {\n\t\treturn *m.F_StringOptional\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoTest) GetF_BytesOptional() []byte {\n\tif m != nil {\n\t\treturn m.F_BytesOptional\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32Optional() int32 {\n\tif m != nil && m.F_Sint32Optional != nil {\n\t\treturn *m.F_Sint32Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_Sint64Optional() int64 {\n\tif m != nil && m.F_Sint64Optional != nil {\n\t\treturn *m.F_Sint64Optional\n\t}\n\treturn 0\n}\n\nfunc (m *GoTest) GetF_BoolDefaulted() bool {\n\tif m != nil && m.F_BoolDefaulted != nil {\n\t\treturn *m.F_BoolDefaulted\n\t}\n\treturn Default_GoTest_F_BoolDefaulted\n}\n\nfunc (m *GoTest) GetF_Int32Defaulted() int32 {\n\tif m != nil && m.F_Int32Defaulted != nil {\n\t\treturn *m.F_Int32Defaulted\n\t}\n\treturn Default_GoTest_F_Int32Defaulted\n}\n\nfunc (m *GoTest) GetF_Int64Defaulted() int64 {\n\tif m != nil && m.F_Int64Defaulted != nil {\n\t\treturn *m.F_Int64Defaulted\n\t}\n\treturn Default_GoTest_F_Int64Defaulted\n}\n\nfunc (m *GoTest) GetF_Fixed32Defaulted() uint32 {\n\tif m != nil && m.F_Fixed32Defaulted != nil {\n\t\treturn *m.F_Fixed32Defaulted\n\t}\n\treturn Default_GoTest_F_Fixed32Defaulted\n}\n\nfunc (m *GoTest) GetF_Fixed64Defaulted() uint64 {\n\tif m != nil && m.F_Fixed64Defaulted != nil {\n\t\treturn *m.F_Fixed64Defaulted\n\t}\n\treturn Default_GoTest_F_Fixed64Defaulted\n}\n\nfunc (m *GoTest) GetF_Uint32Defaulted() uint32 {\n\tif m != nil && m.F_Uint32Defaulted != nil {\n\t\treturn *m.F_Uint32Defaulted\n\t}\n\treturn Default_GoTest_F_Uint32Defaulted\n}\n\nfunc (m *GoTest) GetF_Uint64Defaulted() uint64 {\n\tif m != nil && m.F_Uint64Defaulted != nil {\n\t\treturn *m.F_Uint64Defaulted\n\t}\n\treturn Default_GoTest_F_Uint64Defaulted\n}\n\nfunc (m *GoTest) GetF_FloatDefaulted() float32 {\n\tif m != nil && m.F_FloatDefaulted != nil {\n\t\treturn *m.F_FloatDefaulted\n\t}\n\treturn Default_GoTest_F_FloatDefaulted\n}\n\nfunc (m *GoTest) GetF_DoubleDefaulted() float64 {\n\tif m != nil && m.F_DoubleDefaulted != nil {\n\t\treturn *m.F_DoubleDefaulted\n\t}\n\treturn Default_GoTest_F_DoubleDefaulted\n}\n\nfunc (m *GoTest) GetF_StringDefaulted() string {\n\tif m != nil && m.F_StringDefaulted != nil {\n\t\treturn *m.F_StringDefaulted\n\t}\n\treturn Default_GoTest_F_StringDefaulted\n}\n\nfunc (m *GoTest) GetF_BytesDefaulted() []byte {\n\tif m != nil && m.F_BytesDefaulted != nil {\n\t\treturn m.F_BytesDefaulted\n\t}\n\treturn append([]byte(nil), Default_GoTest_F_BytesDefaulted...)\n}\n\nfunc (m *GoTest) GetF_Sint32Defaulted() int32 {\n\tif m != nil && m.F_Sint32Defaulted != nil {\n\t\treturn *m.F_Sint32Defaulted\n\t}\n\treturn Default_GoTest_F_Sint32Defaulted\n}\n\nfunc (m *GoTest) GetF_Sint64Defaulted() int64 {\n\tif m != nil && m.F_Sint64Defaulted != nil {\n\t\treturn *m.F_Sint64Defaulted\n\t}\n\treturn Default_GoTest_F_Sint64Defaulted\n}\n\nfunc (m *GoTest) GetF_BoolRepeatedPacked() []bool {\n\tif m != nil {\n\t\treturn m.F_BoolRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int32RepeatedPacked() []int32 {\n\tif m != nil {\n\t\treturn m.F_Int32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Int64RepeatedPacked() []int64 {\n\tif m != nil {\n\t\treturn m.F_Int64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Fixed32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Fixed64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 {\n\tif m != nil {\n\t\treturn m.F_Uint32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 {\n\tif m != nil {\n\t\treturn m.F_Uint64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_FloatRepeatedPacked() []float32 {\n\tif m != nil {\n\t\treturn m.F_FloatRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_DoubleRepeatedPacked() []float64 {\n\tif m != nil {\n\t\treturn m.F_DoubleRepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint32RepeatedPacked() []int32 {\n\tif m != nil {\n\t\treturn m.F_Sint32RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetF_Sint64RepeatedPacked() []int64 {\n\tif m != nil {\n\t\treturn m.F_Sint64RepeatedPacked\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup {\n\tif m != nil {\n\t\treturn m.Requiredgroup\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup {\n\tif m != nil {\n\t\treturn m.Repeatedgroup\n\t}\n\treturn nil\n}\n\nfunc (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup {\n\tif m != nil {\n\t\treturn m.Optionalgroup\n\t}\n\treturn nil\n}\n\n// Required, repeated, and optional groups.\ntype GoTest_RequiredGroup struct {\n\tRequiredField    *string `protobuf:\"bytes,71,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *GoTest_RequiredGroup) Reset()                    { *m = GoTest_RequiredGroup{} }\nfunc (m *GoTest_RequiredGroup) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTest_RequiredGroup) ProtoMessage()               {}\nfunc (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }\n\nfunc (m *GoTest_RequiredGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\ntype GoTest_RepeatedGroup struct {\n\tRequiredField    *string `protobuf:\"bytes,81,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *GoTest_RepeatedGroup) Reset()                    { *m = GoTest_RepeatedGroup{} }\nfunc (m *GoTest_RepeatedGroup) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTest_RepeatedGroup) ProtoMessage()               {}\nfunc (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} }\n\nfunc (m *GoTest_RepeatedGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\ntype GoTest_OptionalGroup struct {\n\tRequiredField    *string `protobuf:\"bytes,91,req,name=RequiredField\" json:\"RequiredField,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *GoTest_OptionalGroup) Reset()                    { *m = GoTest_OptionalGroup{} }\nfunc (m *GoTest_OptionalGroup) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTest_OptionalGroup) ProtoMessage()               {}\nfunc (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 2} }\n\nfunc (m *GoTest_OptionalGroup) GetRequiredField() string {\n\tif m != nil && m.RequiredField != nil {\n\t\treturn *m.RequiredField\n\t}\n\treturn \"\"\n}\n\n// For testing a group containing a required field.\ntype GoTestRequiredGroupField struct {\n\tGroup            *GoTestRequiredGroupField_Group `protobuf:\"group,1,req,name=Group,json=group\" json:\"group,omitempty\"`\n\tXXX_unrecognized []byte                          `json:\"-\"`\n}\n\nfunc (m *GoTestRequiredGroupField) Reset()                    { *m = GoTestRequiredGroupField{} }\nfunc (m *GoTestRequiredGroupField) String() string            { return proto.CompactTextString(m) }\nfunc (*GoTestRequiredGroupField) ProtoMessage()               {}\nfunc (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\n\nfunc (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group {\n\tif m != nil {\n\t\treturn m.Group\n\t}\n\treturn nil\n}\n\ntype GoTestRequiredGroupField_Group struct {\n\tField            *int32 `protobuf:\"varint,2,req,name=Field\" json:\"Field,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *GoTestRequiredGroupField_Group) Reset()         { *m = GoTestRequiredGroupField_Group{} }\nfunc (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) }\nfunc (*GoTestRequiredGroupField_Group) ProtoMessage()    {}\nfunc (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{3, 0}\n}\n\nfunc (m *GoTestRequiredGroupField_Group) GetField() int32 {\n\tif m != nil && m.Field != nil {\n\t\treturn *m.Field\n\t}\n\treturn 0\n}\n\n// For testing skipping of unrecognized fields.\n// Numbers are all big, larger than tag numbers in GoTestField,\n// the message used in the corresponding test.\ntype GoSkipTest struct {\n\tSkipInt32        *int32                `protobuf:\"varint,11,req,name=skip_int32,json=skipInt32\" json:\"skip_int32,omitempty\"`\n\tSkipFixed32      *uint32               `protobuf:\"fixed32,12,req,name=skip_fixed32,json=skipFixed32\" json:\"skip_fixed32,omitempty\"`\n\tSkipFixed64      *uint64               `protobuf:\"fixed64,13,req,name=skip_fixed64,json=skipFixed64\" json:\"skip_fixed64,omitempty\"`\n\tSkipString       *string               `protobuf:\"bytes,14,req,name=skip_string,json=skipString\" json:\"skip_string,omitempty\"`\n\tSkipgroup        *GoSkipTest_SkipGroup `protobuf:\"group,15,req,name=SkipGroup,json=skipgroup\" json:\"skipgroup,omitempty\"`\n\tXXX_unrecognized []byte                `json:\"-\"`\n}\n\nfunc (m *GoSkipTest) Reset()                    { *m = GoSkipTest{} }\nfunc (m *GoSkipTest) String() string            { return proto.CompactTextString(m) }\nfunc (*GoSkipTest) ProtoMessage()               {}\nfunc (*GoSkipTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }\n\nfunc (m *GoSkipTest) GetSkipInt32() int32 {\n\tif m != nil && m.SkipInt32 != nil {\n\t\treturn *m.SkipInt32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipFixed32() uint32 {\n\tif m != nil && m.SkipFixed32 != nil {\n\t\treturn *m.SkipFixed32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipFixed64() uint64 {\n\tif m != nil && m.SkipFixed64 != nil {\n\t\treturn *m.SkipFixed64\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest) GetSkipString() string {\n\tif m != nil && m.SkipString != nil {\n\t\treturn *m.SkipString\n\t}\n\treturn \"\"\n}\n\nfunc (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup {\n\tif m != nil {\n\t\treturn m.Skipgroup\n\t}\n\treturn nil\n}\n\ntype GoSkipTest_SkipGroup struct {\n\tGroupInt32       *int32  `protobuf:\"varint,16,req,name=group_int32,json=groupInt32\" json:\"group_int32,omitempty\"`\n\tGroupString      *string `protobuf:\"bytes,17,req,name=group_string,json=groupString\" json:\"group_string,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *GoSkipTest_SkipGroup) Reset()                    { *m = GoSkipTest_SkipGroup{} }\nfunc (m *GoSkipTest_SkipGroup) String() string            { return proto.CompactTextString(m) }\nfunc (*GoSkipTest_SkipGroup) ProtoMessage()               {}\nfunc (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} }\n\nfunc (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 {\n\tif m != nil && m.GroupInt32 != nil {\n\t\treturn *m.GroupInt32\n\t}\n\treturn 0\n}\n\nfunc (m *GoSkipTest_SkipGroup) GetGroupString() string {\n\tif m != nil && m.GroupString != nil {\n\t\treturn *m.GroupString\n\t}\n\treturn \"\"\n}\n\n// For testing packed/non-packed decoder switching.\n// A serialized instance of one should be deserializable as the other.\ntype NonPackedTest struct {\n\tA                []int32 `protobuf:\"varint,1,rep,name=a\" json:\"a,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *NonPackedTest) Reset()                    { *m = NonPackedTest{} }\nfunc (m *NonPackedTest) String() string            { return proto.CompactTextString(m) }\nfunc (*NonPackedTest) ProtoMessage()               {}\nfunc (*NonPackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }\n\nfunc (m *NonPackedTest) GetA() []int32 {\n\tif m != nil {\n\t\treturn m.A\n\t}\n\treturn nil\n}\n\ntype PackedTest struct {\n\tB                []int32 `protobuf:\"varint,1,rep,packed,name=b\" json:\"b,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *PackedTest) Reset()                    { *m = PackedTest{} }\nfunc (m *PackedTest) String() string            { return proto.CompactTextString(m) }\nfunc (*PackedTest) ProtoMessage()               {}\nfunc (*PackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }\n\nfunc (m *PackedTest) GetB() []int32 {\n\tif m != nil {\n\t\treturn m.B\n\t}\n\treturn nil\n}\n\ntype MaxTag struct {\n\t// Maximum possible tag number.\n\tLastField        *string `protobuf:\"bytes,536870911,opt,name=last_field,json=lastField\" json:\"last_field,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *MaxTag) Reset()                    { *m = MaxTag{} }\nfunc (m *MaxTag) String() string            { return proto.CompactTextString(m) }\nfunc (*MaxTag) ProtoMessage()               {}\nfunc (*MaxTag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }\n\nfunc (m *MaxTag) GetLastField() string {\n\tif m != nil && m.LastField != nil {\n\t\treturn *m.LastField\n\t}\n\treturn \"\"\n}\n\ntype OldMessage struct {\n\tNested           *OldMessage_Nested `protobuf:\"bytes,1,opt,name=nested\" json:\"nested,omitempty\"`\n\tNum              *int32             `protobuf:\"varint,2,opt,name=num\" json:\"num,omitempty\"`\n\tXXX_unrecognized []byte             `json:\"-\"`\n}\n\nfunc (m *OldMessage) Reset()                    { *m = OldMessage{} }\nfunc (m *OldMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*OldMessage) ProtoMessage()               {}\nfunc (*OldMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }\n\nfunc (m *OldMessage) GetNested() *OldMessage_Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *OldMessage) GetNum() int32 {\n\tif m != nil && m.Num != nil {\n\t\treturn *m.Num\n\t}\n\treturn 0\n}\n\ntype OldMessage_Nested struct {\n\tName             *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *OldMessage_Nested) Reset()                    { *m = OldMessage_Nested{} }\nfunc (m *OldMessage_Nested) String() string            { return proto.CompactTextString(m) }\nfunc (*OldMessage_Nested) ProtoMessage()               {}\nfunc (*OldMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} }\n\nfunc (m *OldMessage_Nested) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\n// NewMessage is wire compatible with OldMessage;\n// imagine it as a future version.\ntype NewMessage struct {\n\tNested *NewMessage_Nested `protobuf:\"bytes,1,opt,name=nested\" json:\"nested,omitempty\"`\n\t// This is an int32 in OldMessage.\n\tNum              *int64 `protobuf:\"varint,2,opt,name=num\" json:\"num,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *NewMessage) Reset()                    { *m = NewMessage{} }\nfunc (m *NewMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*NewMessage) ProtoMessage()               {}\nfunc (*NewMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }\n\nfunc (m *NewMessage) GetNested() *NewMessage_Nested {\n\tif m != nil {\n\t\treturn m.Nested\n\t}\n\treturn nil\n}\n\nfunc (m *NewMessage) GetNum() int64 {\n\tif m != nil && m.Num != nil {\n\t\treturn *m.Num\n\t}\n\treturn 0\n}\n\ntype NewMessage_Nested struct {\n\tName             *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tFoodGroup        *string `protobuf:\"bytes,2,opt,name=food_group,json=foodGroup\" json:\"food_group,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *NewMessage_Nested) Reset()                    { *m = NewMessage_Nested{} }\nfunc (m *NewMessage_Nested) String() string            { return proto.CompactTextString(m) }\nfunc (*NewMessage_Nested) ProtoMessage()               {}\nfunc (*NewMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} }\n\nfunc (m *NewMessage_Nested) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *NewMessage_Nested) GetFoodGroup() string {\n\tif m != nil && m.FoodGroup != nil {\n\t\treturn *m.FoodGroup\n\t}\n\treturn \"\"\n}\n\ntype InnerMessage struct {\n\tHost             *string `protobuf:\"bytes,1,req,name=host\" json:\"host,omitempty\"`\n\tPort             *int32  `protobuf:\"varint,2,opt,name=port,def=4000\" json:\"port,omitempty\"`\n\tConnected        *bool   `protobuf:\"varint,3,opt,name=connected\" json:\"connected,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *InnerMessage) Reset()                    { *m = InnerMessage{} }\nfunc (m *InnerMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*InnerMessage) ProtoMessage()               {}\nfunc (*InnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }\n\nconst Default_InnerMessage_Port int32 = 4000\n\nfunc (m *InnerMessage) GetHost() string {\n\tif m != nil && m.Host != nil {\n\t\treturn *m.Host\n\t}\n\treturn \"\"\n}\n\nfunc (m *InnerMessage) GetPort() int32 {\n\tif m != nil && m.Port != nil {\n\t\treturn *m.Port\n\t}\n\treturn Default_InnerMessage_Port\n}\n\nfunc (m *InnerMessage) GetConnected() bool {\n\tif m != nil && m.Connected != nil {\n\t\treturn *m.Connected\n\t}\n\treturn false\n}\n\ntype OtherMessage struct {\n\tKey                          *int64        `protobuf:\"varint,1,opt,name=key\" json:\"key,omitempty\"`\n\tValue                        []byte        `protobuf:\"bytes,2,opt,name=value\" json:\"value,omitempty\"`\n\tWeight                       *float32      `protobuf:\"fixed32,3,opt,name=weight\" json:\"weight,omitempty\"`\n\tInner                        *InnerMessage `protobuf:\"bytes,4,opt,name=inner\" json:\"inner,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OtherMessage) Reset()                    { *m = OtherMessage{} }\nfunc (m *OtherMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*OtherMessage) ProtoMessage()               {}\nfunc (*OtherMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }\n\nvar extRange_OtherMessage = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OtherMessage\n}\n\nfunc (m *OtherMessage) GetKey() int64 {\n\tif m != nil && m.Key != nil {\n\t\treturn *m.Key\n\t}\n\treturn 0\n}\n\nfunc (m *OtherMessage) GetValue() []byte {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn nil\n}\n\nfunc (m *OtherMessage) GetWeight() float32 {\n\tif m != nil && m.Weight != nil {\n\t\treturn *m.Weight\n\t}\n\treturn 0\n}\n\nfunc (m *OtherMessage) GetInner() *InnerMessage {\n\tif m != nil {\n\t\treturn m.Inner\n\t}\n\treturn nil\n}\n\ntype RequiredInnerMessage struct {\n\tLeoFinallyWonAnOscar *InnerMessage `protobuf:\"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar\" json:\"leo_finally_won_an_oscar,omitempty\"`\n\tXXX_unrecognized     []byte        `json:\"-\"`\n}\n\nfunc (m *RequiredInnerMessage) Reset()                    { *m = RequiredInnerMessage{} }\nfunc (m *RequiredInnerMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*RequiredInnerMessage) ProtoMessage()               {}\nfunc (*RequiredInnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }\n\nfunc (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage {\n\tif m != nil {\n\t\treturn m.LeoFinallyWonAnOscar\n\t}\n\treturn nil\n}\n\ntype MyMessage struct {\n\tCount          *int32                `protobuf:\"varint,1,req,name=count\" json:\"count,omitempty\"`\n\tName           *string               `protobuf:\"bytes,2,opt,name=name\" json:\"name,omitempty\"`\n\tQuote          *string               `protobuf:\"bytes,3,opt,name=quote\" json:\"quote,omitempty\"`\n\tPet            []string              `protobuf:\"bytes,4,rep,name=pet\" json:\"pet,omitempty\"`\n\tInner          *InnerMessage         `protobuf:\"bytes,5,opt,name=inner\" json:\"inner,omitempty\"`\n\tOthers         []*OtherMessage       `protobuf:\"bytes,6,rep,name=others\" json:\"others,omitempty\"`\n\tWeMustGoDeeper *RequiredInnerMessage `protobuf:\"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper\" json:\"we_must_go_deeper,omitempty\"`\n\tRepInner       []*InnerMessage       `protobuf:\"bytes,12,rep,name=rep_inner,json=repInner\" json:\"rep_inner,omitempty\"`\n\tBikeshed       *MyMessage_Color      `protobuf:\"varint,7,opt,name=bikeshed,enum=testdata.MyMessage_Color\" json:\"bikeshed,omitempty\"`\n\tSomegroup      *MyMessage_SomeGroup  `protobuf:\"group,8,opt,name=SomeGroup,json=somegroup\" json:\"somegroup,omitempty\"`\n\t// This field becomes [][]byte in the generated code.\n\tRepBytes                     [][]byte `protobuf:\"bytes,10,rep,name=rep_bytes,json=repBytes\" json:\"rep_bytes,omitempty\"`\n\tBigfloat                     *float64 `protobuf:\"fixed64,11,opt,name=bigfloat\" json:\"bigfloat,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *MyMessage) Reset()                    { *m = MyMessage{} }\nfunc (m *MyMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*MyMessage) ProtoMessage()               {}\nfunc (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }\n\nvar extRange_MyMessage = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_MyMessage\n}\n\nfunc (m *MyMessage) GetCount() int32 {\n\tif m != nil && m.Count != nil {\n\t\treturn *m.Count\n\t}\n\treturn 0\n}\n\nfunc (m *MyMessage) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *MyMessage) GetQuote() string {\n\tif m != nil && m.Quote != nil {\n\t\treturn *m.Quote\n\t}\n\treturn \"\"\n}\n\nfunc (m *MyMessage) GetPet() []string {\n\tif m != nil {\n\t\treturn m.Pet\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetInner() *InnerMessage {\n\tif m != nil {\n\t\treturn m.Inner\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetOthers() []*OtherMessage {\n\tif m != nil {\n\t\treturn m.Others\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage {\n\tif m != nil {\n\t\treturn m.WeMustGoDeeper\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetRepInner() []*InnerMessage {\n\tif m != nil {\n\t\treturn m.RepInner\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetBikeshed() MyMessage_Color {\n\tif m != nil && m.Bikeshed != nil {\n\t\treturn *m.Bikeshed\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup {\n\tif m != nil {\n\t\treturn m.Somegroup\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetRepBytes() [][]byte {\n\tif m != nil {\n\t\treturn m.RepBytes\n\t}\n\treturn nil\n}\n\nfunc (m *MyMessage) GetBigfloat() float64 {\n\tif m != nil && m.Bigfloat != nil {\n\t\treturn *m.Bigfloat\n\t}\n\treturn 0\n}\n\ntype MyMessage_SomeGroup struct {\n\tGroupField       *int32 `protobuf:\"varint,9,opt,name=group_field,json=groupField\" json:\"group_field,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *MyMessage_SomeGroup) Reset()                    { *m = MyMessage_SomeGroup{} }\nfunc (m *MyMessage_SomeGroup) String() string            { return proto.CompactTextString(m) }\nfunc (*MyMessage_SomeGroup) ProtoMessage()               {}\nfunc (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} }\n\nfunc (m *MyMessage_SomeGroup) GetGroupField() int32 {\n\tif m != nil && m.GroupField != nil {\n\t\treturn *m.GroupField\n\t}\n\treturn 0\n}\n\ntype Ext struct {\n\tData             *string `protobuf:\"bytes,1,opt,name=data\" json:\"data,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Ext) Reset()                    { *m = Ext{} }\nfunc (m *Ext) String() string            { return proto.CompactTextString(m) }\nfunc (*Ext) ProtoMessage()               {}\nfunc (*Ext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }\n\nfunc (m *Ext) GetData() string {\n\tif m != nil && m.Data != nil {\n\t\treturn *m.Data\n\t}\n\treturn \"\"\n}\n\nvar E_Ext_More = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*Ext)(nil),\n\tField:         103,\n\tName:          \"testdata.Ext.more\",\n\tTag:           \"bytes,103,opt,name=more\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_Ext_Text = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         104,\n\tName:          \"testdata.Ext.text\",\n\tTag:           \"bytes,104,opt,name=text\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_Ext_Number = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         105,\n\tName:          \"testdata.Ext.number\",\n\tTag:           \"varint,105,opt,name=number\",\n\tFilename:      \"test.proto\",\n}\n\ntype ComplexExtension struct {\n\tFirst            *int32  `protobuf:\"varint,1,opt,name=first\" json:\"first,omitempty\"`\n\tSecond           *int32  `protobuf:\"varint,2,opt,name=second\" json:\"second,omitempty\"`\n\tThird            []int32 `protobuf:\"varint,3,rep,name=third\" json:\"third,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *ComplexExtension) Reset()                    { *m = ComplexExtension{} }\nfunc (m *ComplexExtension) String() string            { return proto.CompactTextString(m) }\nfunc (*ComplexExtension) ProtoMessage()               {}\nfunc (*ComplexExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }\n\nfunc (m *ComplexExtension) GetFirst() int32 {\n\tif m != nil && m.First != nil {\n\t\treturn *m.First\n\t}\n\treturn 0\n}\n\nfunc (m *ComplexExtension) GetSecond() int32 {\n\tif m != nil && m.Second != nil {\n\t\treturn *m.Second\n\t}\n\treturn 0\n}\n\nfunc (m *ComplexExtension) GetThird() []int32 {\n\tif m != nil {\n\t\treturn m.Third\n\t}\n\treturn nil\n}\n\ntype DefaultsMessage struct {\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *DefaultsMessage) Reset()                    { *m = DefaultsMessage{} }\nfunc (m *DefaultsMessage) String() string            { return proto.CompactTextString(m) }\nfunc (*DefaultsMessage) ProtoMessage()               {}\nfunc (*DefaultsMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }\n\nvar extRange_DefaultsMessage = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_DefaultsMessage\n}\n\ntype MyMessageSet struct {\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *MyMessageSet) Reset()                    { *m = MyMessageSet{} }\nfunc (m *MyMessageSet) String() string            { return proto.CompactTextString(m) }\nfunc (*MyMessageSet) ProtoMessage()               {}\nfunc (*MyMessageSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }\n\nfunc (m *MyMessageSet) Marshal() ([]byte, error) {\n\treturn proto.MarshalMessageSet(&m.XXX_InternalExtensions)\n}\nfunc (m *MyMessageSet) Unmarshal(buf []byte) error {\n\treturn proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)\n}\nfunc (m *MyMessageSet) MarshalJSON() ([]byte, error) {\n\treturn proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)\n}\nfunc (m *MyMessageSet) UnmarshalJSON(buf []byte) error {\n\treturn proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)\n}\n\n// ensure MyMessageSet satisfies proto.Marshaler and proto.Unmarshaler\nvar _ proto.Marshaler = (*MyMessageSet)(nil)\nvar _ proto.Unmarshaler = (*MyMessageSet)(nil)\n\nvar extRange_MyMessageSet = []proto.ExtensionRange{\n\t{100, 2147483646},\n}\n\nfunc (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_MyMessageSet\n}\n\ntype Empty struct {\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Empty) Reset()                    { *m = Empty{} }\nfunc (m *Empty) String() string            { return proto.CompactTextString(m) }\nfunc (*Empty) ProtoMessage()               {}\nfunc (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }\n\ntype MessageList struct {\n\tMessage          []*MessageList_Message `protobuf:\"group,1,rep,name=Message,json=message\" json:\"message,omitempty\"`\n\tXXX_unrecognized []byte                 `json:\"-\"`\n}\n\nfunc (m *MessageList) Reset()                    { *m = MessageList{} }\nfunc (m *MessageList) String() string            { return proto.CompactTextString(m) }\nfunc (*MessageList) ProtoMessage()               {}\nfunc (*MessageList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }\n\nfunc (m *MessageList) GetMessage() []*MessageList_Message {\n\tif m != nil {\n\t\treturn m.Message\n\t}\n\treturn nil\n}\n\ntype MessageList_Message struct {\n\tName             *string `protobuf:\"bytes,2,req,name=name\" json:\"name,omitempty\"`\n\tCount            *int32  `protobuf:\"varint,3,req,name=count\" json:\"count,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *MessageList_Message) Reset()                    { *m = MessageList_Message{} }\nfunc (m *MessageList_Message) String() string            { return proto.CompactTextString(m) }\nfunc (*MessageList_Message) ProtoMessage()               {}\nfunc (*MessageList_Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} }\n\nfunc (m *MessageList_Message) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *MessageList_Message) GetCount() int32 {\n\tif m != nil && m.Count != nil {\n\t\treturn *m.Count\n\t}\n\treturn 0\n}\n\ntype Strings struct {\n\tStringField      *string `protobuf:\"bytes,1,opt,name=string_field,json=stringField\" json:\"string_field,omitempty\"`\n\tBytesField       []byte  `protobuf:\"bytes,2,opt,name=bytes_field,json=bytesField\" json:\"bytes_field,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Strings) Reset()                    { *m = Strings{} }\nfunc (m *Strings) String() string            { return proto.CompactTextString(m) }\nfunc (*Strings) ProtoMessage()               {}\nfunc (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }\n\nfunc (m *Strings) GetStringField() string {\n\tif m != nil && m.StringField != nil {\n\t\treturn *m.StringField\n\t}\n\treturn \"\"\n}\n\nfunc (m *Strings) GetBytesField() []byte {\n\tif m != nil {\n\t\treturn m.BytesField\n\t}\n\treturn nil\n}\n\ntype Defaults struct {\n\t// Default-valued fields of all basic types.\n\t// Same as GoTest, but copied here to make testing easier.\n\tF_Bool    *bool           `protobuf:\"varint,1,opt,name=F_Bool,json=FBool,def=1\" json:\"F_Bool,omitempty\"`\n\tF_Int32   *int32          `protobuf:\"varint,2,opt,name=F_Int32,json=FInt32,def=32\" json:\"F_Int32,omitempty\"`\n\tF_Int64   *int64          `protobuf:\"varint,3,opt,name=F_Int64,json=FInt64,def=64\" json:\"F_Int64,omitempty\"`\n\tF_Fixed32 *uint32         `protobuf:\"fixed32,4,opt,name=F_Fixed32,json=FFixed32,def=320\" json:\"F_Fixed32,omitempty\"`\n\tF_Fixed64 *uint64         `protobuf:\"fixed64,5,opt,name=F_Fixed64,json=FFixed64,def=640\" json:\"F_Fixed64,omitempty\"`\n\tF_Uint32  *uint32         `protobuf:\"varint,6,opt,name=F_Uint32,json=FUint32,def=3200\" json:\"F_Uint32,omitempty\"`\n\tF_Uint64  *uint64         `protobuf:\"varint,7,opt,name=F_Uint64,json=FUint64,def=6400\" json:\"F_Uint64,omitempty\"`\n\tF_Float   *float32        `protobuf:\"fixed32,8,opt,name=F_Float,json=FFloat,def=314159\" json:\"F_Float,omitempty\"`\n\tF_Double  *float64        `protobuf:\"fixed64,9,opt,name=F_Double,json=FDouble,def=271828\" json:\"F_Double,omitempty\"`\n\tF_String  *string         `protobuf:\"bytes,10,opt,name=F_String,json=FString,def=hello, \\\"world!\\\"\\n\" json:\"F_String,omitempty\"`\n\tF_Bytes   []byte          `protobuf:\"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose\" json:\"F_Bytes,omitempty\"`\n\tF_Sint32  *int32          `protobuf:\"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32\" json:\"F_Sint32,omitempty\"`\n\tF_Sint64  *int64          `protobuf:\"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64\" json:\"F_Sint64,omitempty\"`\n\tF_Enum    *Defaults_Color `protobuf:\"varint,14,opt,name=F_Enum,json=FEnum,enum=testdata.Defaults_Color,def=1\" json:\"F_Enum,omitempty\"`\n\t// More fields with crazy defaults.\n\tF_Pinf *float32 `protobuf:\"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf\" json:\"F_Pinf,omitempty\"`\n\tF_Ninf *float32 `protobuf:\"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf\" json:\"F_Ninf,omitempty\"`\n\tF_Nan  *float32 `protobuf:\"fixed32,17,opt,name=F_Nan,json=FNan,def=nan\" json:\"F_Nan,omitempty\"`\n\t// Sub-message.\n\tSub *SubDefaults `protobuf:\"bytes,18,opt,name=sub\" json:\"sub,omitempty\"`\n\t// Redundant but explicit defaults.\n\tStrZero          *string `protobuf:\"bytes,19,opt,name=str_zero,json=strZero,def=\" json:\"str_zero,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Defaults) Reset()                    { *m = Defaults{} }\nfunc (m *Defaults) String() string            { return proto.CompactTextString(m) }\nfunc (*Defaults) ProtoMessage()               {}\nfunc (*Defaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }\n\nconst Default_Defaults_F_Bool bool = true\nconst Default_Defaults_F_Int32 int32 = 32\nconst Default_Defaults_F_Int64 int64 = 64\nconst Default_Defaults_F_Fixed32 uint32 = 320\nconst Default_Defaults_F_Fixed64 uint64 = 640\nconst Default_Defaults_F_Uint32 uint32 = 3200\nconst Default_Defaults_F_Uint64 uint64 = 6400\nconst Default_Defaults_F_Float float32 = 314159\nconst Default_Defaults_F_Double float64 = 271828\nconst Default_Defaults_F_String string = \"hello, \\\"world!\\\"\\n\"\n\nvar Default_Defaults_F_Bytes []byte = []byte(\"Bignose\")\n\nconst Default_Defaults_F_Sint32 int32 = -32\nconst Default_Defaults_F_Sint64 int64 = -64\nconst Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN\n\nvar Default_Defaults_F_Pinf float32 = float32(math.Inf(1))\nvar Default_Defaults_F_Ninf float32 = float32(math.Inf(-1))\nvar Default_Defaults_F_Nan float32 = float32(math.NaN())\n\nfunc (m *Defaults) GetF_Bool() bool {\n\tif m != nil && m.F_Bool != nil {\n\t\treturn *m.F_Bool\n\t}\n\treturn Default_Defaults_F_Bool\n}\n\nfunc (m *Defaults) GetF_Int32() int32 {\n\tif m != nil && m.F_Int32 != nil {\n\t\treturn *m.F_Int32\n\t}\n\treturn Default_Defaults_F_Int32\n}\n\nfunc (m *Defaults) GetF_Int64() int64 {\n\tif m != nil && m.F_Int64 != nil {\n\t\treturn *m.F_Int64\n\t}\n\treturn Default_Defaults_F_Int64\n}\n\nfunc (m *Defaults) GetF_Fixed32() uint32 {\n\tif m != nil && m.F_Fixed32 != nil {\n\t\treturn *m.F_Fixed32\n\t}\n\treturn Default_Defaults_F_Fixed32\n}\n\nfunc (m *Defaults) GetF_Fixed64() uint64 {\n\tif m != nil && m.F_Fixed64 != nil {\n\t\treturn *m.F_Fixed64\n\t}\n\treturn Default_Defaults_F_Fixed64\n}\n\nfunc (m *Defaults) GetF_Uint32() uint32 {\n\tif m != nil && m.F_Uint32 != nil {\n\t\treturn *m.F_Uint32\n\t}\n\treturn Default_Defaults_F_Uint32\n}\n\nfunc (m *Defaults) GetF_Uint64() uint64 {\n\tif m != nil && m.F_Uint64 != nil {\n\t\treturn *m.F_Uint64\n\t}\n\treturn Default_Defaults_F_Uint64\n}\n\nfunc (m *Defaults) GetF_Float() float32 {\n\tif m != nil && m.F_Float != nil {\n\t\treturn *m.F_Float\n\t}\n\treturn Default_Defaults_F_Float\n}\n\nfunc (m *Defaults) GetF_Double() float64 {\n\tif m != nil && m.F_Double != nil {\n\t\treturn *m.F_Double\n\t}\n\treturn Default_Defaults_F_Double\n}\n\nfunc (m *Defaults) GetF_String() string {\n\tif m != nil && m.F_String != nil {\n\t\treturn *m.F_String\n\t}\n\treturn Default_Defaults_F_String\n}\n\nfunc (m *Defaults) GetF_Bytes() []byte {\n\tif m != nil && m.F_Bytes != nil {\n\t\treturn m.F_Bytes\n\t}\n\treturn append([]byte(nil), Default_Defaults_F_Bytes...)\n}\n\nfunc (m *Defaults) GetF_Sint32() int32 {\n\tif m != nil && m.F_Sint32 != nil {\n\t\treturn *m.F_Sint32\n\t}\n\treturn Default_Defaults_F_Sint32\n}\n\nfunc (m *Defaults) GetF_Sint64() int64 {\n\tif m != nil && m.F_Sint64 != nil {\n\t\treturn *m.F_Sint64\n\t}\n\treturn Default_Defaults_F_Sint64\n}\n\nfunc (m *Defaults) GetF_Enum() Defaults_Color {\n\tif m != nil && m.F_Enum != nil {\n\t\treturn *m.F_Enum\n\t}\n\treturn Default_Defaults_F_Enum\n}\n\nfunc (m *Defaults) GetF_Pinf() float32 {\n\tif m != nil && m.F_Pinf != nil {\n\t\treturn *m.F_Pinf\n\t}\n\treturn Default_Defaults_F_Pinf\n}\n\nfunc (m *Defaults) GetF_Ninf() float32 {\n\tif m != nil && m.F_Ninf != nil {\n\t\treturn *m.F_Ninf\n\t}\n\treturn Default_Defaults_F_Ninf\n}\n\nfunc (m *Defaults) GetF_Nan() float32 {\n\tif m != nil && m.F_Nan != nil {\n\t\treturn *m.F_Nan\n\t}\n\treturn Default_Defaults_F_Nan\n}\n\nfunc (m *Defaults) GetSub() *SubDefaults {\n\tif m != nil {\n\t\treturn m.Sub\n\t}\n\treturn nil\n}\n\nfunc (m *Defaults) GetStrZero() string {\n\tif m != nil && m.StrZero != nil {\n\t\treturn *m.StrZero\n\t}\n\treturn \"\"\n}\n\ntype SubDefaults struct {\n\tN                *int64 `protobuf:\"varint,1,opt,name=n,def=7\" json:\"n,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *SubDefaults) Reset()                    { *m = SubDefaults{} }\nfunc (m *SubDefaults) String() string            { return proto.CompactTextString(m) }\nfunc (*SubDefaults) ProtoMessage()               {}\nfunc (*SubDefaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }\n\nconst Default_SubDefaults_N int64 = 7\n\nfunc (m *SubDefaults) GetN() int64 {\n\tif m != nil && m.N != nil {\n\t\treturn *m.N\n\t}\n\treturn Default_SubDefaults_N\n}\n\ntype RepeatedEnum struct {\n\tColor            []RepeatedEnum_Color `protobuf:\"varint,1,rep,name=color,enum=testdata.RepeatedEnum_Color\" json:\"color,omitempty\"`\n\tXXX_unrecognized []byte               `json:\"-\"`\n}\n\nfunc (m *RepeatedEnum) Reset()                    { *m = RepeatedEnum{} }\nfunc (m *RepeatedEnum) String() string            { return proto.CompactTextString(m) }\nfunc (*RepeatedEnum) ProtoMessage()               {}\nfunc (*RepeatedEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }\n\nfunc (m *RepeatedEnum) GetColor() []RepeatedEnum_Color {\n\tif m != nil {\n\t\treturn m.Color\n\t}\n\treturn nil\n}\n\ntype MoreRepeated struct {\n\tBools            []bool   `protobuf:\"varint,1,rep,name=bools\" json:\"bools,omitempty\"`\n\tBoolsPacked      []bool   `protobuf:\"varint,2,rep,packed,name=bools_packed,json=boolsPacked\" json:\"bools_packed,omitempty\"`\n\tInts             []int32  `protobuf:\"varint,3,rep,name=ints\" json:\"ints,omitempty\"`\n\tIntsPacked       []int32  `protobuf:\"varint,4,rep,packed,name=ints_packed,json=intsPacked\" json:\"ints_packed,omitempty\"`\n\tInt64SPacked     []int64  `protobuf:\"varint,7,rep,packed,name=int64s_packed,json=int64sPacked\" json:\"int64s_packed,omitempty\"`\n\tStrings          []string `protobuf:\"bytes,5,rep,name=strings\" json:\"strings,omitempty\"`\n\tFixeds           []uint32 `protobuf:\"fixed32,6,rep,name=fixeds\" json:\"fixeds,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *MoreRepeated) Reset()                    { *m = MoreRepeated{} }\nfunc (m *MoreRepeated) String() string            { return proto.CompactTextString(m) }\nfunc (*MoreRepeated) ProtoMessage()               {}\nfunc (*MoreRepeated) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }\n\nfunc (m *MoreRepeated) GetBools() []bool {\n\tif m != nil {\n\t\treturn m.Bools\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetBoolsPacked() []bool {\n\tif m != nil {\n\t\treturn m.BoolsPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetInts() []int32 {\n\tif m != nil {\n\t\treturn m.Ints\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetIntsPacked() []int32 {\n\tif m != nil {\n\t\treturn m.IntsPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetInt64SPacked() []int64 {\n\tif m != nil {\n\t\treturn m.Int64SPacked\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetStrings() []string {\n\tif m != nil {\n\t\treturn m.Strings\n\t}\n\treturn nil\n}\n\nfunc (m *MoreRepeated) GetFixeds() []uint32 {\n\tif m != nil {\n\t\treturn m.Fixeds\n\t}\n\treturn nil\n}\n\ntype GroupOld struct {\n\tG                *GroupOld_G `protobuf:\"group,101,opt,name=G,json=g\" json:\"g,omitempty\"`\n\tXXX_unrecognized []byte      `json:\"-\"`\n}\n\nfunc (m *GroupOld) Reset()                    { *m = GroupOld{} }\nfunc (m *GroupOld) String() string            { return proto.CompactTextString(m) }\nfunc (*GroupOld) ProtoMessage()               {}\nfunc (*GroupOld) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }\n\nfunc (m *GroupOld) GetG() *GroupOld_G {\n\tif m != nil {\n\t\treturn m.G\n\t}\n\treturn nil\n}\n\ntype GroupOld_G struct {\n\tX                *int32 `protobuf:\"varint,2,opt,name=x\" json:\"x,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *GroupOld_G) Reset()                    { *m = GroupOld_G{} }\nfunc (m *GroupOld_G) String() string            { return proto.CompactTextString(m) }\nfunc (*GroupOld_G) ProtoMessage()               {}\nfunc (*GroupOld_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25, 0} }\n\nfunc (m *GroupOld_G) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\ntype GroupNew struct {\n\tG                *GroupNew_G `protobuf:\"group,101,opt,name=G,json=g\" json:\"g,omitempty\"`\n\tXXX_unrecognized []byte      `json:\"-\"`\n}\n\nfunc (m *GroupNew) Reset()                    { *m = GroupNew{} }\nfunc (m *GroupNew) String() string            { return proto.CompactTextString(m) }\nfunc (*GroupNew) ProtoMessage()               {}\nfunc (*GroupNew) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }\n\nfunc (m *GroupNew) GetG() *GroupNew_G {\n\tif m != nil {\n\t\treturn m.G\n\t}\n\treturn nil\n}\n\ntype GroupNew_G struct {\n\tX                *int32 `protobuf:\"varint,2,opt,name=x\" json:\"x,omitempty\"`\n\tY                *int32 `protobuf:\"varint,3,opt,name=y\" json:\"y,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *GroupNew_G) Reset()                    { *m = GroupNew_G{} }\nfunc (m *GroupNew_G) String() string            { return proto.CompactTextString(m) }\nfunc (*GroupNew_G) ProtoMessage()               {}\nfunc (*GroupNew_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26, 0} }\n\nfunc (m *GroupNew_G) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\nfunc (m *GroupNew_G) GetY() int32 {\n\tif m != nil && m.Y != nil {\n\t\treturn *m.Y\n\t}\n\treturn 0\n}\n\ntype FloatingPoint struct {\n\tF                *float64 `protobuf:\"fixed64,1,req,name=f\" json:\"f,omitempty\"`\n\tExact            *bool    `protobuf:\"varint,2,opt,name=exact\" json:\"exact,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *FloatingPoint) Reset()                    { *m = FloatingPoint{} }\nfunc (m *FloatingPoint) String() string            { return proto.CompactTextString(m) }\nfunc (*FloatingPoint) ProtoMessage()               {}\nfunc (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }\n\nfunc (m *FloatingPoint) GetF() float64 {\n\tif m != nil && m.F != nil {\n\t\treturn *m.F\n\t}\n\treturn 0\n}\n\nfunc (m *FloatingPoint) GetExact() bool {\n\tif m != nil && m.Exact != nil {\n\t\treturn *m.Exact\n\t}\n\treturn false\n}\n\ntype MessageWithMap struct {\n\tNameMapping      map[int32]string         `protobuf:\"bytes,1,rep,name=name_mapping,json=nameMapping\" json:\"name_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tMsgMapping       map[int64]*FloatingPoint `protobuf:\"bytes,2,rep,name=msg_mapping,json=msgMapping\" json:\"msg_mapping,omitempty\" protobuf_key:\"zigzag64,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tByteMapping      map[bool][]byte          `protobuf:\"bytes,3,rep,name=byte_mapping,json=byteMapping\" json:\"byte_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tStrToStr         map[string]string        `protobuf:\"bytes,4,rep,name=str_to_str,json=strToStr\" json:\"str_to_str,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tXXX_unrecognized []byte                   `json:\"-\"`\n}\n\nfunc (m *MessageWithMap) Reset()                    { *m = MessageWithMap{} }\nfunc (m *MessageWithMap) String() string            { return proto.CompactTextString(m) }\nfunc (*MessageWithMap) ProtoMessage()               {}\nfunc (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }\n\nfunc (m *MessageWithMap) GetNameMapping() map[int32]string {\n\tif m != nil {\n\t\treturn m.NameMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint {\n\tif m != nil {\n\t\treturn m.MsgMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetByteMapping() map[bool][]byte {\n\tif m != nil {\n\t\treturn m.ByteMapping\n\t}\n\treturn nil\n}\n\nfunc (m *MessageWithMap) GetStrToStr() map[string]string {\n\tif m != nil {\n\t\treturn m.StrToStr\n\t}\n\treturn nil\n}\n\ntype Oneof struct {\n\t// Types that are valid to be assigned to Union:\n\t//\t*Oneof_F_Bool\n\t//\t*Oneof_F_Int32\n\t//\t*Oneof_F_Int64\n\t//\t*Oneof_F_Fixed32\n\t//\t*Oneof_F_Fixed64\n\t//\t*Oneof_F_Uint32\n\t//\t*Oneof_F_Uint64\n\t//\t*Oneof_F_Float\n\t//\t*Oneof_F_Double\n\t//\t*Oneof_F_String\n\t//\t*Oneof_F_Bytes\n\t//\t*Oneof_F_Sint32\n\t//\t*Oneof_F_Sint64\n\t//\t*Oneof_F_Enum\n\t//\t*Oneof_F_Message\n\t//\t*Oneof_FGroup\n\t//\t*Oneof_F_Largest_Tag\n\tUnion isOneof_Union `protobuf_oneof:\"union\"`\n\t// Types that are valid to be assigned to Tormato:\n\t//\t*Oneof_Value\n\tTormato          isOneof_Tormato `protobuf_oneof:\"tormato\"`\n\tXXX_unrecognized []byte          `json:\"-\"`\n}\n\nfunc (m *Oneof) Reset()                    { *m = Oneof{} }\nfunc (m *Oneof) String() string            { return proto.CompactTextString(m) }\nfunc (*Oneof) ProtoMessage()               {}\nfunc (*Oneof) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }\n\ntype isOneof_Union interface {\n\tisOneof_Union()\n}\ntype isOneof_Tormato interface {\n\tisOneof_Tormato()\n}\n\ntype Oneof_F_Bool struct {\n\tF_Bool bool `protobuf:\"varint,1,opt,name=F_Bool,json=FBool,oneof\"`\n}\ntype Oneof_F_Int32 struct {\n\tF_Int32 int32 `protobuf:\"varint,2,opt,name=F_Int32,json=FInt32,oneof\"`\n}\ntype Oneof_F_Int64 struct {\n\tF_Int64 int64 `protobuf:\"varint,3,opt,name=F_Int64,json=FInt64,oneof\"`\n}\ntype Oneof_F_Fixed32 struct {\n\tF_Fixed32 uint32 `protobuf:\"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof\"`\n}\ntype Oneof_F_Fixed64 struct {\n\tF_Fixed64 uint64 `protobuf:\"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof\"`\n}\ntype Oneof_F_Uint32 struct {\n\tF_Uint32 uint32 `protobuf:\"varint,6,opt,name=F_Uint32,json=FUint32,oneof\"`\n}\ntype Oneof_F_Uint64 struct {\n\tF_Uint64 uint64 `protobuf:\"varint,7,opt,name=F_Uint64,json=FUint64,oneof\"`\n}\ntype Oneof_F_Float struct {\n\tF_Float float32 `protobuf:\"fixed32,8,opt,name=F_Float,json=FFloat,oneof\"`\n}\ntype Oneof_F_Double struct {\n\tF_Double float64 `protobuf:\"fixed64,9,opt,name=F_Double,json=FDouble,oneof\"`\n}\ntype Oneof_F_String struct {\n\tF_String string `protobuf:\"bytes,10,opt,name=F_String,json=FString,oneof\"`\n}\ntype Oneof_F_Bytes struct {\n\tF_Bytes []byte `protobuf:\"bytes,11,opt,name=F_Bytes,json=FBytes,oneof\"`\n}\ntype Oneof_F_Sint32 struct {\n\tF_Sint32 int32 `protobuf:\"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof\"`\n}\ntype Oneof_F_Sint64 struct {\n\tF_Sint64 int64 `protobuf:\"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof\"`\n}\ntype Oneof_F_Enum struct {\n\tF_Enum MyMessage_Color `protobuf:\"varint,14,opt,name=F_Enum,json=FEnum,enum=testdata.MyMessage_Color,oneof\"`\n}\ntype Oneof_F_Message struct {\n\tF_Message *GoTestField `protobuf:\"bytes,15,opt,name=F_Message,json=FMessage,oneof\"`\n}\ntype Oneof_FGroup struct {\n\tFGroup *Oneof_F_Group `protobuf:\"group,16,opt,name=F_Group,json=fGroup,oneof\"`\n}\ntype Oneof_F_Largest_Tag struct {\n\tF_Largest_Tag int32 `protobuf:\"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof\"`\n}\ntype Oneof_Value struct {\n\tValue int32 `protobuf:\"varint,100,opt,name=value,oneof\"`\n}\n\nfunc (*Oneof_F_Bool) isOneof_Union()        {}\nfunc (*Oneof_F_Int32) isOneof_Union()       {}\nfunc (*Oneof_F_Int64) isOneof_Union()       {}\nfunc (*Oneof_F_Fixed32) isOneof_Union()     {}\nfunc (*Oneof_F_Fixed64) isOneof_Union()     {}\nfunc (*Oneof_F_Uint32) isOneof_Union()      {}\nfunc (*Oneof_F_Uint64) isOneof_Union()      {}\nfunc (*Oneof_F_Float) isOneof_Union()       {}\nfunc (*Oneof_F_Double) isOneof_Union()      {}\nfunc (*Oneof_F_String) isOneof_Union()      {}\nfunc (*Oneof_F_Bytes) isOneof_Union()       {}\nfunc (*Oneof_F_Sint32) isOneof_Union()      {}\nfunc (*Oneof_F_Sint64) isOneof_Union()      {}\nfunc (*Oneof_F_Enum) isOneof_Union()        {}\nfunc (*Oneof_F_Message) isOneof_Union()     {}\nfunc (*Oneof_FGroup) isOneof_Union()        {}\nfunc (*Oneof_F_Largest_Tag) isOneof_Union() {}\nfunc (*Oneof_Value) isOneof_Tormato()       {}\n\nfunc (m *Oneof) GetUnion() isOneof_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\nfunc (m *Oneof) GetTormato() isOneof_Tormato {\n\tif m != nil {\n\t\treturn m.Tormato\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Bool() bool {\n\tif x, ok := m.GetUnion().(*Oneof_F_Bool); ok {\n\t\treturn x.F_Bool\n\t}\n\treturn false\n}\n\nfunc (m *Oneof) GetF_Int32() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Int32); ok {\n\t\treturn x.F_Int32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Int64() int64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Int64); ok {\n\t\treturn x.F_Int64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Fixed32() uint32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok {\n\t\treturn x.F_Fixed32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Fixed64() uint64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok {\n\t\treturn x.F_Fixed64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Uint32() uint32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Uint32); ok {\n\t\treturn x.F_Uint32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Uint64() uint64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Uint64); ok {\n\t\treturn x.F_Uint64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Float() float32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Float); ok {\n\t\treturn x.F_Float\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Double() float64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Double); ok {\n\t\treturn x.F_Double\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_String() string {\n\tif x, ok := m.GetUnion().(*Oneof_F_String); ok {\n\t\treturn x.F_String\n\t}\n\treturn \"\"\n}\n\nfunc (m *Oneof) GetF_Bytes() []byte {\n\tif x, ok := m.GetUnion().(*Oneof_F_Bytes); ok {\n\t\treturn x.F_Bytes\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Sint32() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Sint32); ok {\n\t\treturn x.F_Sint32\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Sint64() int64 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Sint64); ok {\n\t\treturn x.F_Sint64\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetF_Enum() MyMessage_Color {\n\tif x, ok := m.GetUnion().(*Oneof_F_Enum); ok {\n\t\treturn x.F_Enum\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *Oneof) GetF_Message() *GoTestField {\n\tif x, ok := m.GetUnion().(*Oneof_F_Message); ok {\n\t\treturn x.F_Message\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetFGroup() *Oneof_F_Group {\n\tif x, ok := m.GetUnion().(*Oneof_FGroup); ok {\n\t\treturn x.FGroup\n\t}\n\treturn nil\n}\n\nfunc (m *Oneof) GetF_Largest_Tag() int32 {\n\tif x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok {\n\t\treturn x.F_Largest_Tag\n\t}\n\treturn 0\n}\n\nfunc (m *Oneof) GetValue() int32 {\n\tif x, ok := m.GetTormato().(*Oneof_Value); ok {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Oneof_OneofMarshaler, _Oneof_OneofUnmarshaler, _Oneof_OneofSizer, []interface{}{\n\t\t(*Oneof_F_Bool)(nil),\n\t\t(*Oneof_F_Int32)(nil),\n\t\t(*Oneof_F_Int64)(nil),\n\t\t(*Oneof_F_Fixed32)(nil),\n\t\t(*Oneof_F_Fixed64)(nil),\n\t\t(*Oneof_F_Uint32)(nil),\n\t\t(*Oneof_F_Uint64)(nil),\n\t\t(*Oneof_F_Float)(nil),\n\t\t(*Oneof_F_Double)(nil),\n\t\t(*Oneof_F_String)(nil),\n\t\t(*Oneof_F_Bytes)(nil),\n\t\t(*Oneof_F_Sint32)(nil),\n\t\t(*Oneof_F_Sint64)(nil),\n\t\t(*Oneof_F_Enum)(nil),\n\t\t(*Oneof_F_Message)(nil),\n\t\t(*Oneof_FGroup)(nil),\n\t\t(*Oneof_F_Largest_Tag)(nil),\n\t\t(*Oneof_Value)(nil),\n\t}\n}\n\nfunc _Oneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*Oneof)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Oneof_F_Bool:\n\t\tt := uint64(0)\n\t\tif x.F_Bool {\n\t\t\tt = 1\n\t\t}\n\t\tb.EncodeVarint(1<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(t)\n\tcase *Oneof_F_Int32:\n\t\tb.EncodeVarint(2<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Int32))\n\tcase *Oneof_F_Int64:\n\t\tb.EncodeVarint(3<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Int64))\n\tcase *Oneof_F_Fixed32:\n\t\tb.EncodeVarint(4<<3 | proto.WireFixed32)\n\t\tb.EncodeFixed32(uint64(x.F_Fixed32))\n\tcase *Oneof_F_Fixed64:\n\t\tb.EncodeVarint(5<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(uint64(x.F_Fixed64))\n\tcase *Oneof_F_Uint32:\n\t\tb.EncodeVarint(6<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Uint32))\n\tcase *Oneof_F_Uint64:\n\t\tb.EncodeVarint(7<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Uint64))\n\tcase *Oneof_F_Float:\n\t\tb.EncodeVarint(8<<3 | proto.WireFixed32)\n\t\tb.EncodeFixed32(uint64(math.Float32bits(x.F_Float)))\n\tcase *Oneof_F_Double:\n\t\tb.EncodeVarint(9<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.F_Double))\n\tcase *Oneof_F_String:\n\t\tb.EncodeVarint(10<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.F_String)\n\tcase *Oneof_F_Bytes:\n\t\tb.EncodeVarint(11<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.F_Bytes)\n\tcase *Oneof_F_Sint32:\n\t\tb.EncodeVarint(12<<3 | proto.WireVarint)\n\t\tb.EncodeZigzag32(uint64(x.F_Sint32))\n\tcase *Oneof_F_Sint64:\n\t\tb.EncodeVarint(13<<3 | proto.WireVarint)\n\t\tb.EncodeZigzag64(uint64(x.F_Sint64))\n\tcase *Oneof_F_Enum:\n\t\tb.EncodeVarint(14<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Enum))\n\tcase *Oneof_F_Message:\n\t\tb.EncodeVarint(15<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.F_Message); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *Oneof_FGroup:\n\t\tb.EncodeVarint(16<<3 | proto.WireStartGroup)\n\t\tif err := b.Marshal(x.FGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.EncodeVarint(16<<3 | proto.WireEndGroup)\n\tcase *Oneof_F_Largest_Tag:\n\t\tb.EncodeVarint(536870911<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.F_Largest_Tag))\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Oneof.Union has unexpected type %T\", x)\n\t}\n\t// tormato\n\tswitch x := m.Tormato.(type) {\n\tcase *Oneof_Value:\n\t\tb.EncodeVarint(100<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Value))\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Oneof.Tormato has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _Oneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*Oneof)\n\tswitch tag {\n\tcase 1: // union.F_Bool\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Bool{x != 0}\n\t\treturn true, err\n\tcase 2: // union.F_Int32\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Int32{int32(x)}\n\t\treturn true, err\n\tcase 3: // union.F_Int64\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Int64{int64(x)}\n\t\treturn true, err\n\tcase 4: // union.F_Fixed32\n\t\tif wire != proto.WireFixed32 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed32()\n\t\tm.Union = &Oneof_F_Fixed32{uint32(x)}\n\t\treturn true, err\n\tcase 5: // union.F_Fixed64\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Union = &Oneof_F_Fixed64{x}\n\t\treturn true, err\n\tcase 6: // union.F_Uint32\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Uint32{uint32(x)}\n\t\treturn true, err\n\tcase 7: // union.F_Uint64\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Uint64{x}\n\t\treturn true, err\n\tcase 8: // union.F_Float\n\t\tif wire != proto.WireFixed32 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed32()\n\t\tm.Union = &Oneof_F_Float{math.Float32frombits(uint32(x))}\n\t\treturn true, err\n\tcase 9: // union.F_Double\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Union = &Oneof_F_Double{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 10: // union.F_String\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &Oneof_F_String{x}\n\t\treturn true, err\n\tcase 11: // union.F_Bytes\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Union = &Oneof_F_Bytes{x}\n\t\treturn true, err\n\tcase 12: // union.F_Sint32\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeZigzag32()\n\t\tm.Union = &Oneof_F_Sint32{int32(x)}\n\t\treturn true, err\n\tcase 13: // union.F_Sint64\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeZigzag64()\n\t\tm.Union = &Oneof_F_Sint64{int64(x)}\n\t\treturn true, err\n\tcase 14: // union.F_Enum\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Enum{MyMessage_Color(x)}\n\t\treturn true, err\n\tcase 15: // union.F_Message\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(GoTestField)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Union = &Oneof_F_Message{msg}\n\t\treturn true, err\n\tcase 16: // union.f_group\n\t\tif wire != proto.WireStartGroup {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Oneof_F_Group)\n\t\terr := b.DecodeGroup(msg)\n\t\tm.Union = &Oneof_FGroup{msg}\n\t\treturn true, err\n\tcase 536870911: // union.F_Largest_Tag\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Oneof_F_Largest_Tag{int32(x)}\n\t\treturn true, err\n\tcase 100: // tormato.value\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Tormato = &Oneof_Value{int32(x)}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _Oneof_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*Oneof)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Oneof_F_Bool:\n\t\tn += proto.SizeVarint(1<<3 | proto.WireVarint)\n\t\tn += 1\n\tcase *Oneof_F_Int32:\n\t\tn += proto.SizeVarint(2<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Int32))\n\tcase *Oneof_F_Int64:\n\t\tn += proto.SizeVarint(3<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Int64))\n\tcase *Oneof_F_Fixed32:\n\t\tn += proto.SizeVarint(4<<3 | proto.WireFixed32)\n\t\tn += 4\n\tcase *Oneof_F_Fixed64:\n\t\tn += proto.SizeVarint(5<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Oneof_F_Uint32:\n\t\tn += proto.SizeVarint(6<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Uint32))\n\tcase *Oneof_F_Uint64:\n\t\tn += proto.SizeVarint(7<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Uint64))\n\tcase *Oneof_F_Float:\n\t\tn += proto.SizeVarint(8<<3 | proto.WireFixed32)\n\t\tn += 4\n\tcase *Oneof_F_Double:\n\t\tn += proto.SizeVarint(9<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Oneof_F_String:\n\t\tn += proto.SizeVarint(10<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.F_String)))\n\t\tn += len(x.F_String)\n\tcase *Oneof_F_Bytes:\n\t\tn += proto.SizeVarint(11<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.F_Bytes)))\n\t\tn += len(x.F_Bytes)\n\tcase *Oneof_F_Sint32:\n\t\tn += proto.SizeVarint(12<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64((uint32(x.F_Sint32) << 1) ^ uint32((int32(x.F_Sint32) >> 31))))\n\tcase *Oneof_F_Sint64:\n\t\tn += proto.SizeVarint(13<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(uint64(x.F_Sint64<<1) ^ uint64((int64(x.F_Sint64) >> 63))))\n\tcase *Oneof_F_Enum:\n\t\tn += proto.SizeVarint(14<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Enum))\n\tcase *Oneof_F_Message:\n\t\ts := proto.Size(x.F_Message)\n\t\tn += proto.SizeVarint(15<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase *Oneof_FGroup:\n\t\tn += proto.SizeVarint(16<<3 | proto.WireStartGroup)\n\t\tn += proto.Size(x.FGroup)\n\t\tn += proto.SizeVarint(16<<3 | proto.WireEndGroup)\n\tcase *Oneof_F_Largest_Tag:\n\t\tn += proto.SizeVarint(536870911<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.F_Largest_Tag))\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\t// tormato\n\tswitch x := m.Tormato.(type) {\n\tcase *Oneof_Value:\n\t\tn += proto.SizeVarint(100<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Value))\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\ntype Oneof_F_Group struct {\n\tX                *int32 `protobuf:\"varint,17,opt,name=x\" json:\"x,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Oneof_F_Group) Reset()                    { *m = Oneof_F_Group{} }\nfunc (m *Oneof_F_Group) String() string            { return proto.CompactTextString(m) }\nfunc (*Oneof_F_Group) ProtoMessage()               {}\nfunc (*Oneof_F_Group) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29, 0} }\n\nfunc (m *Oneof_F_Group) GetX() int32 {\n\tif m != nil && m.X != nil {\n\t\treturn *m.X\n\t}\n\treturn 0\n}\n\ntype Communique struct {\n\tMakeMeCry *bool `protobuf:\"varint,1,opt,name=make_me_cry,json=makeMeCry\" json:\"make_me_cry,omitempty\"`\n\t// This is a oneof, called \"union\".\n\t//\n\t// Types that are valid to be assigned to Union:\n\t//\t*Communique_Number\n\t//\t*Communique_Name\n\t//\t*Communique_Data\n\t//\t*Communique_TempC\n\t//\t*Communique_Col\n\t//\t*Communique_Msg\n\tUnion            isCommunique_Union `protobuf_oneof:\"union\"`\n\tXXX_unrecognized []byte             `json:\"-\"`\n}\n\nfunc (m *Communique) Reset()                    { *m = Communique{} }\nfunc (m *Communique) String() string            { return proto.CompactTextString(m) }\nfunc (*Communique) ProtoMessage()               {}\nfunc (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }\n\ntype isCommunique_Union interface {\n\tisCommunique_Union()\n}\n\ntype Communique_Number struct {\n\tNumber int32 `protobuf:\"varint,5,opt,name=number,oneof\"`\n}\ntype Communique_Name struct {\n\tName string `protobuf:\"bytes,6,opt,name=name,oneof\"`\n}\ntype Communique_Data struct {\n\tData []byte `protobuf:\"bytes,7,opt,name=data,oneof\"`\n}\ntype Communique_TempC struct {\n\tTempC float64 `protobuf:\"fixed64,8,opt,name=temp_c,json=tempC,oneof\"`\n}\ntype Communique_Col struct {\n\tCol MyMessage_Color `protobuf:\"varint,9,opt,name=col,enum=testdata.MyMessage_Color,oneof\"`\n}\ntype Communique_Msg struct {\n\tMsg *Strings `protobuf:\"bytes,10,opt,name=msg,oneof\"`\n}\n\nfunc (*Communique_Number) isCommunique_Union() {}\nfunc (*Communique_Name) isCommunique_Union()   {}\nfunc (*Communique_Data) isCommunique_Union()   {}\nfunc (*Communique_TempC) isCommunique_Union()  {}\nfunc (*Communique_Col) isCommunique_Union()    {}\nfunc (*Communique_Msg) isCommunique_Union()    {}\n\nfunc (m *Communique) GetUnion() isCommunique_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetMakeMeCry() bool {\n\tif m != nil && m.MakeMeCry != nil {\n\t\treturn *m.MakeMeCry\n\t}\n\treturn false\n}\n\nfunc (m *Communique) GetNumber() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Number); ok {\n\t\treturn x.Number\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetName() string {\n\tif x, ok := m.GetUnion().(*Communique_Name); ok {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Communique) GetData() []byte {\n\tif x, ok := m.GetUnion().(*Communique_Data); ok {\n\t\treturn x.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetTempC() float64 {\n\tif x, ok := m.GetUnion().(*Communique_TempC); ok {\n\t\treturn x.TempC\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetCol() MyMessage_Color {\n\tif x, ok := m.GetUnion().(*Communique_Col); ok {\n\t\treturn x.Col\n\t}\n\treturn MyMessage_RED\n}\n\nfunc (m *Communique) GetMsg() *Strings {\n\tif x, ok := m.GetUnion().(*Communique_Msg); ok {\n\t\treturn x.Msg\n\t}\n\treturn nil\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{\n\t\t(*Communique_Number)(nil),\n\t\t(*Communique_Name)(nil),\n\t\t(*Communique_Data)(nil),\n\t\t(*Communique_TempC)(nil),\n\t\t(*Communique_Col)(nil),\n\t\t(*Communique_Msg)(nil),\n\t}\n}\n\nfunc _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tb.EncodeVarint(5<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tb.EncodeVarint(6<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Name)\n\tcase *Communique_Data:\n\t\tb.EncodeVarint(7<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.Data)\n\tcase *Communique_TempC:\n\t\tb.EncodeVarint(8<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.TempC))\n\tcase *Communique_Col:\n\t\tb.EncodeVarint(9<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Col))\n\tcase *Communique_Msg:\n\t\tb.EncodeVarint(10<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.Msg); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Communique.Union has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*Communique)\n\tswitch tag {\n\tcase 5: // union.number\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Number{int32(x)}\n\t\treturn true, err\n\tcase 6: // union.name\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &Communique_Name{x}\n\t\treturn true, err\n\tcase 7: // union.data\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Union = &Communique_Data{x}\n\t\treturn true, err\n\tcase 8: // union.temp_c\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Union = &Communique_TempC{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 9: // union.col\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Col{MyMessage_Color(x)}\n\t\treturn true, err\n\tcase 10: // union.msg\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Strings)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Union = &Communique_Msg{msg}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _Communique_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tn += proto.SizeVarint(5<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tn += proto.SizeVarint(6<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Name)))\n\t\tn += len(x.Name)\n\tcase *Communique_Data:\n\t\tn += proto.SizeVarint(7<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Data)))\n\t\tn += len(x.Data)\n\tcase *Communique_TempC:\n\t\tn += proto.SizeVarint(8<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Communique_Col:\n\t\tn += proto.SizeVarint(9<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Col))\n\tcase *Communique_Msg:\n\t\ts := proto.Size(x.Msg)\n\t\tn += proto.SizeVarint(10<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\nvar E_Greeting = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessage)(nil),\n\tExtensionType: ([]string)(nil),\n\tField:         106,\n\tName:          \"testdata.greeting\",\n\tTag:           \"bytes,106,rep,name=greeting\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_Complex = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherMessage)(nil),\n\tExtensionType: (*ComplexExtension)(nil),\n\tField:         200,\n\tName:          \"testdata.complex\",\n\tTag:           \"bytes,200,opt,name=complex\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_RComplex = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherMessage)(nil),\n\tExtensionType: ([]*ComplexExtension)(nil),\n\tField:         201,\n\tName:          \"testdata.r_complex\",\n\tTag:           \"bytes,201,rep,name=r_complex,json=rComplex\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultDouble = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         101,\n\tName:          \"testdata.no_default_double\",\n\tTag:           \"fixed64,101,opt,name=no_default_double,json=noDefaultDouble\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultFloat = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float32)(nil),\n\tField:         102,\n\tName:          \"testdata.no_default_float\",\n\tTag:           \"fixed32,102,opt,name=no_default_float,json=noDefaultFloat\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultInt32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         103,\n\tName:          \"testdata.no_default_int32\",\n\tTag:           \"varint,103,opt,name=no_default_int32,json=noDefaultInt32\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultInt64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         104,\n\tName:          \"testdata.no_default_int64\",\n\tTag:           \"varint,104,opt,name=no_default_int64,json=noDefaultInt64\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultUint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         105,\n\tName:          \"testdata.no_default_uint32\",\n\tTag:           \"varint,105,opt,name=no_default_uint32,json=noDefaultUint32\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultUint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         106,\n\tName:          \"testdata.no_default_uint64\",\n\tTag:           \"varint,106,opt,name=no_default_uint64,json=noDefaultUint64\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultSint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         107,\n\tName:          \"testdata.no_default_sint32\",\n\tTag:           \"zigzag32,107,opt,name=no_default_sint32,json=noDefaultSint32\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultSint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         108,\n\tName:          \"testdata.no_default_sint64\",\n\tTag:           \"zigzag64,108,opt,name=no_default_sint64,json=noDefaultSint64\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultFixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         109,\n\tName:          \"testdata.no_default_fixed32\",\n\tTag:           \"fixed32,109,opt,name=no_default_fixed32,json=noDefaultFixed32\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultFixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         110,\n\tName:          \"testdata.no_default_fixed64\",\n\tTag:           \"fixed64,110,opt,name=no_default_fixed64,json=noDefaultFixed64\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultSfixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         111,\n\tName:          \"testdata.no_default_sfixed32\",\n\tTag:           \"fixed32,111,opt,name=no_default_sfixed32,json=noDefaultSfixed32\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultSfixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         112,\n\tName:          \"testdata.no_default_sfixed64\",\n\tTag:           \"fixed64,112,opt,name=no_default_sfixed64,json=noDefaultSfixed64\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultBool = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*bool)(nil),\n\tField:         113,\n\tName:          \"testdata.no_default_bool\",\n\tTag:           \"varint,113,opt,name=no_default_bool,json=noDefaultBool\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultString = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         114,\n\tName:          \"testdata.no_default_string\",\n\tTag:           \"bytes,114,opt,name=no_default_string,json=noDefaultString\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultBytes = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: ([]byte)(nil),\n\tField:         115,\n\tName:          \"testdata.no_default_bytes\",\n\tTag:           \"bytes,115,opt,name=no_default_bytes,json=noDefaultBytes\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_NoDefaultEnum = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*DefaultsMessage_DefaultsEnum)(nil),\n\tField:         116,\n\tName:          \"testdata.no_default_enum\",\n\tTag:           \"varint,116,opt,name=no_default_enum,json=noDefaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultDouble = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         201,\n\tName:          \"testdata.default_double\",\n\tTag:           \"fixed64,201,opt,name=default_double,json=defaultDouble,def=3.1415\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultFloat = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*float32)(nil),\n\tField:         202,\n\tName:          \"testdata.default_float\",\n\tTag:           \"fixed32,202,opt,name=default_float,json=defaultFloat,def=3.14\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultInt32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         203,\n\tName:          \"testdata.default_int32\",\n\tTag:           \"varint,203,opt,name=default_int32,json=defaultInt32,def=42\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultInt64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         204,\n\tName:          \"testdata.default_int64\",\n\tTag:           \"varint,204,opt,name=default_int64,json=defaultInt64,def=43\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultUint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         205,\n\tName:          \"testdata.default_uint32\",\n\tTag:           \"varint,205,opt,name=default_uint32,json=defaultUint32,def=44\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultUint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         206,\n\tName:          \"testdata.default_uint64\",\n\tTag:           \"varint,206,opt,name=default_uint64,json=defaultUint64,def=45\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultSint32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         207,\n\tName:          \"testdata.default_sint32\",\n\tTag:           \"zigzag32,207,opt,name=default_sint32,json=defaultSint32,def=46\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultSint64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         208,\n\tName:          \"testdata.default_sint64\",\n\tTag:           \"zigzag64,208,opt,name=default_sint64,json=defaultSint64,def=47\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultFixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint32)(nil),\n\tField:         209,\n\tName:          \"testdata.default_fixed32\",\n\tTag:           \"fixed32,209,opt,name=default_fixed32,json=defaultFixed32,def=48\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultFixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*uint64)(nil),\n\tField:         210,\n\tName:          \"testdata.default_fixed64\",\n\tTag:           \"fixed64,210,opt,name=default_fixed64,json=defaultFixed64,def=49\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultSfixed32 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int32)(nil),\n\tField:         211,\n\tName:          \"testdata.default_sfixed32\",\n\tTag:           \"fixed32,211,opt,name=default_sfixed32,json=defaultSfixed32,def=50\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultSfixed64 = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*int64)(nil),\n\tField:         212,\n\tName:          \"testdata.default_sfixed64\",\n\tTag:           \"fixed64,212,opt,name=default_sfixed64,json=defaultSfixed64,def=51\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultBool = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*bool)(nil),\n\tField:         213,\n\tName:          \"testdata.default_bool\",\n\tTag:           \"varint,213,opt,name=default_bool,json=defaultBool,def=1\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultString = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         214,\n\tName:          \"testdata.default_string\",\n\tTag:           \"bytes,214,opt,name=default_string,json=defaultString,def=Hello, string\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultBytes = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: ([]byte)(nil),\n\tField:         215,\n\tName:          \"testdata.default_bytes\",\n\tTag:           \"bytes,215,opt,name=default_bytes,json=defaultBytes,def=Hello, bytes\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_DefaultEnum = &proto.ExtensionDesc{\n\tExtendedType:  (*DefaultsMessage)(nil),\n\tExtensionType: (*DefaultsMessage_DefaultsEnum)(nil),\n\tField:         216,\n\tName:          \"testdata.default_enum\",\n\tTag:           \"varint,216,opt,name=default_enum,json=defaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum,def=1\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X201 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         201,\n\tName:          \"testdata.x201\",\n\tTag:           \"bytes,201,opt,name=x201\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X202 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         202,\n\tName:          \"testdata.x202\",\n\tTag:           \"bytes,202,opt,name=x202\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X203 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         203,\n\tName:          \"testdata.x203\",\n\tTag:           \"bytes,203,opt,name=x203\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X204 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         204,\n\tName:          \"testdata.x204\",\n\tTag:           \"bytes,204,opt,name=x204\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X205 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         205,\n\tName:          \"testdata.x205\",\n\tTag:           \"bytes,205,opt,name=x205\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X206 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         206,\n\tName:          \"testdata.x206\",\n\tTag:           \"bytes,206,opt,name=x206\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X207 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         207,\n\tName:          \"testdata.x207\",\n\tTag:           \"bytes,207,opt,name=x207\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X208 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         208,\n\tName:          \"testdata.x208\",\n\tTag:           \"bytes,208,opt,name=x208\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X209 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         209,\n\tName:          \"testdata.x209\",\n\tTag:           \"bytes,209,opt,name=x209\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X210 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         210,\n\tName:          \"testdata.x210\",\n\tTag:           \"bytes,210,opt,name=x210\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X211 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         211,\n\tName:          \"testdata.x211\",\n\tTag:           \"bytes,211,opt,name=x211\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X212 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         212,\n\tName:          \"testdata.x212\",\n\tTag:           \"bytes,212,opt,name=x212\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X213 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         213,\n\tName:          \"testdata.x213\",\n\tTag:           \"bytes,213,opt,name=x213\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X214 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         214,\n\tName:          \"testdata.x214\",\n\tTag:           \"bytes,214,opt,name=x214\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X215 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         215,\n\tName:          \"testdata.x215\",\n\tTag:           \"bytes,215,opt,name=x215\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X216 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         216,\n\tName:          \"testdata.x216\",\n\tTag:           \"bytes,216,opt,name=x216\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X217 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         217,\n\tName:          \"testdata.x217\",\n\tTag:           \"bytes,217,opt,name=x217\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X218 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         218,\n\tName:          \"testdata.x218\",\n\tTag:           \"bytes,218,opt,name=x218\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X219 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         219,\n\tName:          \"testdata.x219\",\n\tTag:           \"bytes,219,opt,name=x219\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X220 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         220,\n\tName:          \"testdata.x220\",\n\tTag:           \"bytes,220,opt,name=x220\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X221 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         221,\n\tName:          \"testdata.x221\",\n\tTag:           \"bytes,221,opt,name=x221\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X222 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         222,\n\tName:          \"testdata.x222\",\n\tTag:           \"bytes,222,opt,name=x222\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X223 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         223,\n\tName:          \"testdata.x223\",\n\tTag:           \"bytes,223,opt,name=x223\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X224 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         224,\n\tName:          \"testdata.x224\",\n\tTag:           \"bytes,224,opt,name=x224\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X225 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         225,\n\tName:          \"testdata.x225\",\n\tTag:           \"bytes,225,opt,name=x225\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X226 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         226,\n\tName:          \"testdata.x226\",\n\tTag:           \"bytes,226,opt,name=x226\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X227 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         227,\n\tName:          \"testdata.x227\",\n\tTag:           \"bytes,227,opt,name=x227\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X228 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         228,\n\tName:          \"testdata.x228\",\n\tTag:           \"bytes,228,opt,name=x228\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X229 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         229,\n\tName:          \"testdata.x229\",\n\tTag:           \"bytes,229,opt,name=x229\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X230 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         230,\n\tName:          \"testdata.x230\",\n\tTag:           \"bytes,230,opt,name=x230\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X231 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         231,\n\tName:          \"testdata.x231\",\n\tTag:           \"bytes,231,opt,name=x231\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X232 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         232,\n\tName:          \"testdata.x232\",\n\tTag:           \"bytes,232,opt,name=x232\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X233 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         233,\n\tName:          \"testdata.x233\",\n\tTag:           \"bytes,233,opt,name=x233\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X234 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         234,\n\tName:          \"testdata.x234\",\n\tTag:           \"bytes,234,opt,name=x234\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X235 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         235,\n\tName:          \"testdata.x235\",\n\tTag:           \"bytes,235,opt,name=x235\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X236 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         236,\n\tName:          \"testdata.x236\",\n\tTag:           \"bytes,236,opt,name=x236\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X237 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         237,\n\tName:          \"testdata.x237\",\n\tTag:           \"bytes,237,opt,name=x237\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X238 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         238,\n\tName:          \"testdata.x238\",\n\tTag:           \"bytes,238,opt,name=x238\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X239 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         239,\n\tName:          \"testdata.x239\",\n\tTag:           \"bytes,239,opt,name=x239\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X240 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         240,\n\tName:          \"testdata.x240\",\n\tTag:           \"bytes,240,opt,name=x240\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X241 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         241,\n\tName:          \"testdata.x241\",\n\tTag:           \"bytes,241,opt,name=x241\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X242 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         242,\n\tName:          \"testdata.x242\",\n\tTag:           \"bytes,242,opt,name=x242\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X243 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         243,\n\tName:          \"testdata.x243\",\n\tTag:           \"bytes,243,opt,name=x243\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X244 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         244,\n\tName:          \"testdata.x244\",\n\tTag:           \"bytes,244,opt,name=x244\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X245 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         245,\n\tName:          \"testdata.x245\",\n\tTag:           \"bytes,245,opt,name=x245\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X246 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         246,\n\tName:          \"testdata.x246\",\n\tTag:           \"bytes,246,opt,name=x246\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X247 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         247,\n\tName:          \"testdata.x247\",\n\tTag:           \"bytes,247,opt,name=x247\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X248 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         248,\n\tName:          \"testdata.x248\",\n\tTag:           \"bytes,248,opt,name=x248\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X249 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         249,\n\tName:          \"testdata.x249\",\n\tTag:           \"bytes,249,opt,name=x249\",\n\tFilename:      \"test.proto\",\n}\n\nvar E_X250 = &proto.ExtensionDesc{\n\tExtendedType:  (*MyMessageSet)(nil),\n\tExtensionType: (*Empty)(nil),\n\tField:         250,\n\tName:          \"testdata.x250\",\n\tTag:           \"bytes,250,opt,name=x250\",\n\tFilename:      \"test.proto\",\n}\n\nfunc init() {\n\tproto.RegisterType((*GoEnum)(nil), \"testdata.GoEnum\")\n\tproto.RegisterType((*GoTestField)(nil), \"testdata.GoTestField\")\n\tproto.RegisterType((*GoTest)(nil), \"testdata.GoTest\")\n\tproto.RegisterType((*GoTest_RequiredGroup)(nil), \"testdata.GoTest.RequiredGroup\")\n\tproto.RegisterType((*GoTest_RepeatedGroup)(nil), \"testdata.GoTest.RepeatedGroup\")\n\tproto.RegisterType((*GoTest_OptionalGroup)(nil), \"testdata.GoTest.OptionalGroup\")\n\tproto.RegisterType((*GoTestRequiredGroupField)(nil), \"testdata.GoTestRequiredGroupField\")\n\tproto.RegisterType((*GoTestRequiredGroupField_Group)(nil), \"testdata.GoTestRequiredGroupField.Group\")\n\tproto.RegisterType((*GoSkipTest)(nil), \"testdata.GoSkipTest\")\n\tproto.RegisterType((*GoSkipTest_SkipGroup)(nil), \"testdata.GoSkipTest.SkipGroup\")\n\tproto.RegisterType((*NonPackedTest)(nil), \"testdata.NonPackedTest\")\n\tproto.RegisterType((*PackedTest)(nil), \"testdata.PackedTest\")\n\tproto.RegisterType((*MaxTag)(nil), \"testdata.MaxTag\")\n\tproto.RegisterType((*OldMessage)(nil), \"testdata.OldMessage\")\n\tproto.RegisterType((*OldMessage_Nested)(nil), \"testdata.OldMessage.Nested\")\n\tproto.RegisterType((*NewMessage)(nil), \"testdata.NewMessage\")\n\tproto.RegisterType((*NewMessage_Nested)(nil), \"testdata.NewMessage.Nested\")\n\tproto.RegisterType((*InnerMessage)(nil), \"testdata.InnerMessage\")\n\tproto.RegisterType((*OtherMessage)(nil), \"testdata.OtherMessage\")\n\tproto.RegisterType((*RequiredInnerMessage)(nil), \"testdata.RequiredInnerMessage\")\n\tproto.RegisterType((*MyMessage)(nil), \"testdata.MyMessage\")\n\tproto.RegisterType((*MyMessage_SomeGroup)(nil), \"testdata.MyMessage.SomeGroup\")\n\tproto.RegisterType((*Ext)(nil), \"testdata.Ext\")\n\tproto.RegisterType((*ComplexExtension)(nil), \"testdata.ComplexExtension\")\n\tproto.RegisterType((*DefaultsMessage)(nil), \"testdata.DefaultsMessage\")\n\tproto.RegisterType((*MyMessageSet)(nil), \"testdata.MyMessageSet\")\n\tproto.RegisterType((*Empty)(nil), \"testdata.Empty\")\n\tproto.RegisterType((*MessageList)(nil), \"testdata.MessageList\")\n\tproto.RegisterType((*MessageList_Message)(nil), \"testdata.MessageList.Message\")\n\tproto.RegisterType((*Strings)(nil), \"testdata.Strings\")\n\tproto.RegisterType((*Defaults)(nil), \"testdata.Defaults\")\n\tproto.RegisterType((*SubDefaults)(nil), \"testdata.SubDefaults\")\n\tproto.RegisterType((*RepeatedEnum)(nil), \"testdata.RepeatedEnum\")\n\tproto.RegisterType((*MoreRepeated)(nil), \"testdata.MoreRepeated\")\n\tproto.RegisterType((*GroupOld)(nil), \"testdata.GroupOld\")\n\tproto.RegisterType((*GroupOld_G)(nil), \"testdata.GroupOld.G\")\n\tproto.RegisterType((*GroupNew)(nil), \"testdata.GroupNew\")\n\tproto.RegisterType((*GroupNew_G)(nil), \"testdata.GroupNew.G\")\n\tproto.RegisterType((*FloatingPoint)(nil), \"testdata.FloatingPoint\")\n\tproto.RegisterType((*MessageWithMap)(nil), \"testdata.MessageWithMap\")\n\tproto.RegisterType((*Oneof)(nil), \"testdata.Oneof\")\n\tproto.RegisterType((*Oneof_F_Group)(nil), \"testdata.Oneof.F_Group\")\n\tproto.RegisterType((*Communique)(nil), \"testdata.Communique\")\n\tproto.RegisterEnum(\"testdata.FOO\", FOO_name, FOO_value)\n\tproto.RegisterEnum(\"testdata.GoTest_KIND\", GoTest_KIND_name, GoTest_KIND_value)\n\tproto.RegisterEnum(\"testdata.MyMessage_Color\", MyMessage_Color_name, MyMessage_Color_value)\n\tproto.RegisterEnum(\"testdata.DefaultsMessage_DefaultsEnum\", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value)\n\tproto.RegisterEnum(\"testdata.Defaults_Color\", Defaults_Color_name, Defaults_Color_value)\n\tproto.RegisterEnum(\"testdata.RepeatedEnum_Color\", RepeatedEnum_Color_name, RepeatedEnum_Color_value)\n\tproto.RegisterExtension(E_Ext_More)\n\tproto.RegisterExtension(E_Ext_Text)\n\tproto.RegisterExtension(E_Ext_Number)\n\tproto.RegisterExtension(E_Greeting)\n\tproto.RegisterExtension(E_Complex)\n\tproto.RegisterExtension(E_RComplex)\n\tproto.RegisterExtension(E_NoDefaultDouble)\n\tproto.RegisterExtension(E_NoDefaultFloat)\n\tproto.RegisterExtension(E_NoDefaultInt32)\n\tproto.RegisterExtension(E_NoDefaultInt64)\n\tproto.RegisterExtension(E_NoDefaultUint32)\n\tproto.RegisterExtension(E_NoDefaultUint64)\n\tproto.RegisterExtension(E_NoDefaultSint32)\n\tproto.RegisterExtension(E_NoDefaultSint64)\n\tproto.RegisterExtension(E_NoDefaultFixed32)\n\tproto.RegisterExtension(E_NoDefaultFixed64)\n\tproto.RegisterExtension(E_NoDefaultSfixed32)\n\tproto.RegisterExtension(E_NoDefaultSfixed64)\n\tproto.RegisterExtension(E_NoDefaultBool)\n\tproto.RegisterExtension(E_NoDefaultString)\n\tproto.RegisterExtension(E_NoDefaultBytes)\n\tproto.RegisterExtension(E_NoDefaultEnum)\n\tproto.RegisterExtension(E_DefaultDouble)\n\tproto.RegisterExtension(E_DefaultFloat)\n\tproto.RegisterExtension(E_DefaultInt32)\n\tproto.RegisterExtension(E_DefaultInt64)\n\tproto.RegisterExtension(E_DefaultUint32)\n\tproto.RegisterExtension(E_DefaultUint64)\n\tproto.RegisterExtension(E_DefaultSint32)\n\tproto.RegisterExtension(E_DefaultSint64)\n\tproto.RegisterExtension(E_DefaultFixed32)\n\tproto.RegisterExtension(E_DefaultFixed64)\n\tproto.RegisterExtension(E_DefaultSfixed32)\n\tproto.RegisterExtension(E_DefaultSfixed64)\n\tproto.RegisterExtension(E_DefaultBool)\n\tproto.RegisterExtension(E_DefaultString)\n\tproto.RegisterExtension(E_DefaultBytes)\n\tproto.RegisterExtension(E_DefaultEnum)\n\tproto.RegisterExtension(E_X201)\n\tproto.RegisterExtension(E_X202)\n\tproto.RegisterExtension(E_X203)\n\tproto.RegisterExtension(E_X204)\n\tproto.RegisterExtension(E_X205)\n\tproto.RegisterExtension(E_X206)\n\tproto.RegisterExtension(E_X207)\n\tproto.RegisterExtension(E_X208)\n\tproto.RegisterExtension(E_X209)\n\tproto.RegisterExtension(E_X210)\n\tproto.RegisterExtension(E_X211)\n\tproto.RegisterExtension(E_X212)\n\tproto.RegisterExtension(E_X213)\n\tproto.RegisterExtension(E_X214)\n\tproto.RegisterExtension(E_X215)\n\tproto.RegisterExtension(E_X216)\n\tproto.RegisterExtension(E_X217)\n\tproto.RegisterExtension(E_X218)\n\tproto.RegisterExtension(E_X219)\n\tproto.RegisterExtension(E_X220)\n\tproto.RegisterExtension(E_X221)\n\tproto.RegisterExtension(E_X222)\n\tproto.RegisterExtension(E_X223)\n\tproto.RegisterExtension(E_X224)\n\tproto.RegisterExtension(E_X225)\n\tproto.RegisterExtension(E_X226)\n\tproto.RegisterExtension(E_X227)\n\tproto.RegisterExtension(E_X228)\n\tproto.RegisterExtension(E_X229)\n\tproto.RegisterExtension(E_X230)\n\tproto.RegisterExtension(E_X231)\n\tproto.RegisterExtension(E_X232)\n\tproto.RegisterExtension(E_X233)\n\tproto.RegisterExtension(E_X234)\n\tproto.RegisterExtension(E_X235)\n\tproto.RegisterExtension(E_X236)\n\tproto.RegisterExtension(E_X237)\n\tproto.RegisterExtension(E_X238)\n\tproto.RegisterExtension(E_X239)\n\tproto.RegisterExtension(E_X240)\n\tproto.RegisterExtension(E_X241)\n\tproto.RegisterExtension(E_X242)\n\tproto.RegisterExtension(E_X243)\n\tproto.RegisterExtension(E_X244)\n\tproto.RegisterExtension(E_X245)\n\tproto.RegisterExtension(E_X246)\n\tproto.RegisterExtension(E_X247)\n\tproto.RegisterExtension(E_X248)\n\tproto.RegisterExtension(E_X249)\n\tproto.RegisterExtension(E_X250)\n}\n\nfunc init() { proto.RegisterFile(\"test.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 4453 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xc9, 0x77, 0xdb, 0x48,\n\t0x7a, 0x37, 0xc0, 0xfd, 0x23, 0x25, 0x42, 0x65, 0xb5, 0x9b, 0x96, 0xbc, 0xc0, 0x9c, 0xe9, 0x6e,\n\t0x7a, 0xd3, 0x48, 0x20, 0x44, 0xdb, 0x74, 0xa7, 0xdf, 0xf3, 0x42, 0xca, 0x7a, 0x63, 0x89, 0x0a,\n\t0xa4, 0xee, 0x7e, 0xd3, 0x39, 0xf0, 0x51, 0x22, 0x44, 0xb3, 0x4d, 0x02, 0x34, 0x09, 0xc5, 0x52,\n\t0x72, 0xe9, 0x4b, 0x72, 0xcd, 0x76, 0xc9, 0x35, 0xa7, 0x9c, 0x92, 0xbc, 0x97, 0x7f, 0x22, 0xe9,\n\t0xee, 0x59, 0x7b, 0xd6, 0xac, 0x93, 0x7d, 0x99, 0xec, 0xdb, 0x4c, 0x92, 0x4b, 0xcf, 0xab, 0xaf,\n\t0x0a, 0x40, 0x01, 0x24, 0x20, 0xf9, 0x24, 0x56, 0xd5, 0xef, 0xf7, 0xd5, 0xf6, 0xab, 0xef, 0xab,\n\t0xaf, 0x20, 0x00, 0xc7, 0x9c, 0x38, 0x2b, 0xa3, 0xb1, 0xed, 0xd8, 0x24, 0x4b, 0x7f, 0x77, 0x3b,\n\t0x4e, 0xa7, 0x7c, 0x1d, 0xd2, 0x1b, 0x76, 0xc3, 0x3a, 0x1a, 0x92, 0xab, 0x90, 0x38, 0xb4, 0xed,\n\t0x92, 0xa4, 0xca, 0x95, 0x79, 0x6d, 0x6e, 0xc5, 0x45, 0xac, 0x34, 0x5b, 0x2d, 0x83, 0xb6, 0x94,\n\t0xef, 0x40, 0x7e, 0xc3, 0xde, 0x33, 0x27, 0x4e, 0xb3, 0x6f, 0x0e, 0xba, 0x64, 0x11, 0x52, 0x4f,\n\t0x3b, 0xfb, 0xe6, 0x00, 0x19, 0x39, 0x83, 0x15, 0x08, 0x81, 0xe4, 0xde, 0xc9, 0xc8, 0x2c, 0xc9,\n\t0x58, 0x89, 0xbf, 0xcb, 0xbf, 0x72, 0x85, 0x76, 0x42, 0x99, 0xe4, 0x3a, 0x24, 0xbf, 0xdc, 0xb7,\n\t0xba, 0xbc, 0x97, 0xd7, 0xfc, 0x5e, 0x58, 0xfb, 0xca, 0x97, 0x37, 0xb7, 0x1f, 0x1b, 0x08, 0xa1,\n\t0xf6, 0xf7, 0x3a, 0xfb, 0x03, 0x6a, 0x4a, 0xa2, 0xf6, 0xb1, 0x40, 0x6b, 0x77, 0x3a, 0xe3, 0xce,\n\t0xb0, 0x94, 0x50, 0xa5, 0x4a, 0xca, 0x60, 0x05, 0x72, 0x1f, 0xe6, 0x0c, 0xf3, 0xc5, 0x51, 0x7f,\n\t0x6c, 0x76, 0x71, 0x70, 0xa5, 0xa4, 0x2a, 0x57, 0xf2, 0xd3, 0xf6, 0xb1, 0xd1, 0x08, 0x62, 0x19,\n\t0x79, 0x64, 0x76, 0x1c, 0x97, 0x9c, 0x52, 0x13, 0xb1, 0x64, 0x01, 0x4b, 0xc9, 0xad, 0x91, 0xd3,\n\t0xb7, 0xad, 0xce, 0x80, 0x91, 0xd3, 0xaa, 0x14, 0x43, 0x0e, 0x60, 0xc9, 0x9b, 0x50, 0x6c, 0xb6,\n\t0x1f, 0xda, 0xf6, 0xa0, 0x3d, 0xe6, 0x23, 0x2a, 0x81, 0x2a, 0x57, 0xb2, 0xc6, 0x5c, 0x93, 0xd6,\n\t0xba, 0xc3, 0x24, 0x15, 0x50, 0x9a, 0xed, 0x4d, 0xcb, 0xa9, 0x6a, 0x3e, 0x30, 0xaf, 0xca, 0x95,\n\t0x94, 0x31, 0xdf, 0xc4, 0xea, 0x29, 0x64, 0x4d, 0xf7, 0x91, 0x05, 0x55, 0xae, 0x24, 0x18, 0xb2,\n\t0xa6, 0x7b, 0xc8, 0x5b, 0x40, 0x9a, 0xed, 0x66, 0xff, 0xd8, 0xec, 0x8a, 0x56, 0xe7, 0x54, 0xb9,\n\t0x92, 0x31, 0x94, 0x26, 0x6f, 0x98, 0x81, 0x16, 0x2d, 0xcf, 0xab, 0x72, 0x25, 0xed, 0xa2, 0x05,\n\t0xdb, 0x37, 0x60, 0xa1, 0xd9, 0x7e, 0xb7, 0x1f, 0x1c, 0x70, 0x51, 0x95, 0x2b, 0x73, 0x46, 0xb1,\n\t0xc9, 0xea, 0xa7, 0xb1, 0xa2, 0x61, 0x45, 0x95, 0x2b, 0x49, 0x8e, 0x15, 0xec, 0xe2, 0xec, 0x9a,\n\t0x03, 0xbb, 0xe3, 0xf8, 0xd0, 0x05, 0x55, 0xae, 0xc8, 0xc6, 0x7c, 0x13, 0xab, 0x83, 0x56, 0x1f,\n\t0xdb, 0x47, 0xfb, 0x03, 0xd3, 0x87, 0x12, 0x55, 0xae, 0x48, 0x46, 0xb1, 0xc9, 0xea, 0x83, 0xd8,\n\t0x5d, 0x67, 0xdc, 0xb7, 0x7a, 0x3e, 0xf6, 0x3c, 0xea, 0xb7, 0xd8, 0x64, 0xf5, 0xc1, 0x11, 0x3c,\n\t0x3c, 0x71, 0xcc, 0x89, 0x0f, 0x35, 0x55, 0xb9, 0x52, 0x30, 0xe6, 0x9b, 0x58, 0x1d, 0xb2, 0x1a,\n\t0x5a, 0x83, 0x43, 0x55, 0xae, 0x2c, 0x50, 0xab, 0x33, 0xd6, 0x60, 0x37, 0xb4, 0x06, 0x3d, 0x55,\n\t0xae, 0x10, 0x8e, 0x15, 0xd6, 0x40, 0xd4, 0x0c, 0x13, 0x62, 0x69, 0x51, 0x4d, 0x08, 0x9a, 0x61,\n\t0x95, 0x41, 0xcd, 0x70, 0xe0, 0x6b, 0x6a, 0x42, 0xd4, 0x4c, 0x08, 0x89, 0x9d, 0x73, 0xe4, 0x05,\n\t0x35, 0x21, 0x6a, 0x86, 0x23, 0x43, 0x9a, 0xe1, 0xd8, 0xd7, 0xd5, 0x44, 0x50, 0x33, 0x53, 0x68,\n\t0xd1, 0x72, 0x49, 0x4d, 0x04, 0x35, 0xc3, 0xd1, 0x41, 0xcd, 0x70, 0xf0, 0x45, 0x35, 0x11, 0xd0,\n\t0x4c, 0x18, 0x2b, 0x1a, 0x5e, 0x52, 0x13, 0x01, 0xcd, 0x88, 0xb3, 0x73, 0x35, 0xc3, 0xa1, 0xcb,\n\t0x6a, 0x42, 0xd4, 0x8c, 0x68, 0xd5, 0xd3, 0x0c, 0x87, 0x5e, 0x52, 0x13, 0x01, 0xcd, 0x88, 0x58,\n\t0x4f, 0x33, 0x1c, 0x7b, 0x59, 0x4d, 0x04, 0x34, 0xc3, 0xb1, 0xd7, 0x45, 0xcd, 0x70, 0xe8, 0xc7,\n\t0x92, 0x9a, 0x10, 0x45, 0xc3, 0xa1, 0x37, 0x03, 0xa2, 0xe1, 0xd8, 0x4f, 0x28, 0x56, 0x54, 0x4d,\n\t0x18, 0x2c, 0xae, 0xc2, 0xa7, 0x14, 0x2c, 0xca, 0x86, 0x83, 0x7d, 0xd9, 0xd8, 0xdc, 0x05, 0x95,\n\t0xae, 0xa8, 0x92, 0x27, 0x1b, 0xd7, 0x2f, 0x89, 0xb2, 0xf1, 0x80, 0x57, 0xd1, 0xd5, 0x72, 0xd9,\n\t0x4c, 0x21, 0x6b, 0xba, 0x8f, 0x54, 0x55, 0xc9, 0x97, 0x8d, 0x87, 0x0c, 0xc8, 0xc6, 0xc3, 0x5e,\n\t0x53, 0x25, 0x51, 0x36, 0x33, 0xd0, 0xa2, 0xe5, 0xb2, 0x2a, 0x89, 0xb2, 0xf1, 0xd0, 0xa2, 0x6c,\n\t0x3c, 0xf0, 0x17, 0x54, 0x49, 0x90, 0xcd, 0x34, 0x56, 0x34, 0xfc, 0x45, 0x55, 0x12, 0x64, 0x13,\n\t0x9c, 0x1d, 0x93, 0x8d, 0x07, 0x7d, 0x43, 0x95, 0x7c, 0xd9, 0x04, 0xad, 0x72, 0xd9, 0x78, 0xd0,\n\t0x37, 0x55, 0x49, 0x90, 0x4d, 0x10, 0xcb, 0x65, 0xe3, 0x61, 0xdf, 0xc2, 0xf8, 0xe6, 0xca, 0xc6,\n\t0xc3, 0x0a, 0xb2, 0xf1, 0xa0, 0xbf, 0x43, 0x63, 0xa1, 0x27, 0x1b, 0x0f, 0x2a, 0xca, 0xc6, 0xc3,\n\t0xfe, 0x2e, 0xc5, 0xfa, 0xb2, 0x99, 0x06, 0x8b, 0xab, 0xf0, 0x7b, 0x14, 0xec, 0xcb, 0xc6, 0x03,\n\t0xaf, 0xe0, 0x20, 0xa8, 0x6c, 0xba, 0xe6, 0x61, 0xe7, 0x68, 0x40, 0x25, 0x56, 0xa1, 0xba, 0xa9,\n\t0x27, 0x9d, 0xf1, 0x91, 0x49, 0x47, 0x62, 0xdb, 0x83, 0xc7, 0x6e, 0x1b, 0x59, 0xa1, 0xc6, 0x99,\n\t0x7c, 0x7c, 0xc2, 0x75, 0xaa, 0x9f, 0xba, 0x5c, 0xd5, 0x8c, 0x22, 0xd3, 0xd0, 0x34, 0xbe, 0xa6,\n\t0x0b, 0xf8, 0x1b, 0x54, 0x45, 0x75, 0xb9, 0xa6, 0x33, 0x7c, 0x4d, 0xf7, 0xf1, 0x55, 0x38, 0xef,\n\t0x4b, 0xc9, 0x67, 0xdc, 0xa4, 0x5a, 0xaa, 0x27, 0xaa, 0xda, 0xaa, 0xb1, 0xe0, 0x0a, 0x6a, 0x16,\n\t0x29, 0xd0, 0xcd, 0x2d, 0x2a, 0xa9, 0x7a, 0xa2, 0xa6, 0x7b, 0x24, 0xb1, 0x27, 0x8d, 0xca, 0x90,\n\t0x0b, 0xcb, 0xe7, 0xdc, 0xa6, 0xca, 0xaa, 0x27, 0xab, 0xda, 0xea, 0xaa, 0xa1, 0x70, 0x7d, 0xcd,\n\t0xe0, 0x04, 0xfa, 0x59, 0xa1, 0x0a, 0xab, 0x27, 0x6b, 0xba, 0xc7, 0x09, 0xf6, 0xb3, 0xe0, 0x0a,\n\t0xcd, 0xa7, 0x7c, 0x89, 0x2a, 0xad, 0x9e, 0xae, 0xae, 0xe9, 0x6b, 0xeb, 0xf7, 0x8c, 0x22, 0x53,\n\t0x9c, 0xcf, 0xd1, 0x69, 0x3f, 0x5c, 0x72, 0x3e, 0x69, 0x95, 0x6a, 0xae, 0x9e, 0xd6, 0xee, 0xac,\n\t0xdd, 0xd5, 0xee, 0x1a, 0x0a, 0xd7, 0x9e, 0xcf, 0x7a, 0x87, 0xb2, 0xb8, 0xf8, 0x7c, 0xd6, 0x1a,\n\t0x55, 0x5f, 0x5d, 0x79, 0x66, 0x0e, 0x06, 0xf6, 0x2d, 0xb5, 0xfc, 0xd2, 0x1e, 0x0f, 0xba, 0xd7,\n\t0xca, 0x60, 0x28, 0x5c, 0x8f, 0x62, 0xaf, 0x0b, 0xae, 0x20, 0x7d, 0xfa, 0xaf, 0xd1, 0x7b, 0x58,\n\t0xa1, 0x9e, 0x79, 0xd8, 0xef, 0x59, 0xf6, 0xc4, 0x34, 0x8a, 0x4c, 0x9a, 0xa1, 0x35, 0xd9, 0x0d,\n\t0xaf, 0xe3, 0xaf, 0x53, 0xda, 0x42, 0x3d, 0x71, 0xbb, 0xaa, 0xd1, 0x9e, 0x66, 0xad, 0xe3, 0x6e,\n\t0x78, 0x1d, 0x7f, 0x83, 0x72, 0x48, 0x3d, 0x71, 0xbb, 0xa6, 0x73, 0x8e, 0xb8, 0x8e, 0x77, 0xe0,\n\t0x42, 0x28, 0x2e, 0xb6, 0x47, 0x9d, 0x83, 0xe7, 0x66, 0xb7, 0xa4, 0xd1, 0xf0, 0xf8, 0x50, 0x56,\n\t0x24, 0xe3, 0x7c, 0x20, 0x44, 0xee, 0x60, 0x33, 0xb9, 0x07, 0xaf, 0x87, 0x03, 0xa5, 0xcb, 0xac,\n\t0xd2, 0x78, 0x89, 0xcc, 0xc5, 0x60, 0xcc, 0x0c, 0x51, 0x05, 0x07, 0xec, 0x52, 0x75, 0x1a, 0x40,\n\t0x7d, 0xaa, 0xef, 0x89, 0x39, 0xf5, 0x67, 0xe0, 0xe2, 0x74, 0x28, 0x75, 0xc9, 0xeb, 0x34, 0xa2,\n\t0x22, 0xf9, 0x42, 0x38, 0xaa, 0x4e, 0xd1, 0x67, 0xf4, 0x5d, 0xa3, 0x21, 0x56, 0xa4, 0x4f, 0xf5,\n\t0x7e, 0x1f, 0x4a, 0x53, 0xc1, 0xd6, 0x65, 0xdf, 0xa1, 0x31, 0x17, 0xd9, 0xaf, 0x85, 0xe2, 0x6e,\n\t0x98, 0x3c, 0xa3, 0xeb, 0xbb, 0x34, 0x08, 0x0b, 0xe4, 0xa9, 0x9e, 0x71, 0xc9, 0x82, 0xe1, 0xd8,\n\t0xe5, 0xde, 0xa3, 0x51, 0x99, 0x2f, 0x59, 0x20, 0x32, 0x8b, 0xfd, 0x86, 0xe2, 0xb3, 0xcb, 0xad,\n\t0xd3, 0x30, 0xcd, 0xfb, 0x0d, 0x86, 0x6a, 0x4e, 0x7e, 0x9b, 0x92, 0x77, 0x67, 0xcf, 0xf8, 0xc7,\n\t0x09, 0x1a, 0x60, 0x39, 0x7b, 0x77, 0xd6, 0x94, 0x3d, 0xf6, 0x8c, 0x29, 0xff, 0x84, 0xb2, 0x89,\n\t0xc0, 0x9e, 0x9a, 0xf3, 0x63, 0x98, 0x73, 0x6f, 0x75, 0xbd, 0xb1, 0x7d, 0x34, 0x2a, 0x35, 0x55,\n\t0xb9, 0x02, 0xda, 0x95, 0xa9, 0xec, 0xc7, 0xbd, 0xe4, 0x6d, 0x50, 0x94, 0x11, 0x24, 0x31, 0x2b,\n\t0xcc, 0x2e, 0xb3, 0xb2, 0xa3, 0x26, 0x22, 0xac, 0x30, 0x94, 0x67, 0x45, 0x20, 0x51, 0x2b, 0xae,\n\t0xd3, 0x67, 0x56, 0x3e, 0x50, 0xa5, 0x99, 0x56, 0xdc, 0x10, 0xc0, 0xad, 0x04, 0x48, 0x4b, 0xeb,\n\t0x7e, 0xbe, 0x85, 0xed, 0xe4, 0x8b, 0xe1, 0x04, 0x6c, 0x03, 0xef, 0xcf, 0xc1, 0x4a, 0x46, 0x13,\n\t0x06, 0x37, 0x4d, 0xfb, 0xd9, 0x08, 0x5a, 0x60, 0x34, 0xd3, 0xb4, 0x9f, 0x9b, 0x41, 0x2b, 0xff,\n\t0xa6, 0x04, 0x49, 0x9a, 0x4f, 0x92, 0x2c, 0x24, 0xdf, 0x6b, 0x6d, 0x3e, 0x56, 0xce, 0xd1, 0x5f,\n\t0x0f, 0x5b, 0xad, 0xa7, 0x8a, 0x44, 0x72, 0x90, 0x7a, 0xf8, 0x95, 0xbd, 0xc6, 0xae, 0x22, 0x93,\n\t0x22, 0xe4, 0x9b, 0x9b, 0xdb, 0x1b, 0x0d, 0x63, 0xc7, 0xd8, 0xdc, 0xde, 0x53, 0x12, 0xb4, 0xad,\n\t0xf9, 0xb4, 0xf5, 0x60, 0x4f, 0x49, 0x92, 0x0c, 0x24, 0x68, 0x5d, 0x8a, 0x00, 0xa4, 0x77, 0xf7,\n\t0x8c, 0xcd, 0xed, 0x0d, 0x25, 0x4d, 0xad, 0xec, 0x6d, 0x6e, 0x35, 0x94, 0x0c, 0x45, 0xee, 0xbd,\n\t0xbb, 0xf3, 0xb4, 0xa1, 0x64, 0xe9, 0xcf, 0x07, 0x86, 0xf1, 0xe0, 0x2b, 0x4a, 0x8e, 0x92, 0xb6,\n\t0x1e, 0xec, 0x28, 0x80, 0xcd, 0x0f, 0x1e, 0x3e, 0x6d, 0x28, 0x79, 0x52, 0x80, 0x6c, 0xf3, 0xdd,\n\t0xed, 0x47, 0x7b, 0x9b, 0xad, 0x6d, 0xa5, 0x50, 0x3e, 0x81, 0x12, 0x5b, 0xe6, 0xc0, 0x2a, 0xb2,\n\t0xa4, 0xf0, 0x1d, 0x48, 0xb1, 0x9d, 0x91, 0x50, 0x25, 0x95, 0xf0, 0xce, 0x4c, 0x53, 0x56, 0xd8,\n\t0x1e, 0x31, 0xda, 0xd2, 0x65, 0x48, 0xb1, 0x55, 0x5a, 0x84, 0x14, 0x5b, 0x1d, 0x19, 0x53, 0x45,\n\t0x56, 0x28, 0xff, 0x96, 0x0c, 0xb0, 0x61, 0xef, 0x3e, 0xef, 0x8f, 0x30, 0x21, 0xbf, 0x0c, 0x30,\n\t0x79, 0xde, 0x1f, 0xb5, 0x51, 0xf5, 0x3c, 0xa9, 0xcc, 0xd1, 0x1a, 0xf4, 0x77, 0xe4, 0x1a, 0x14,\n\t0xb0, 0xf9, 0x90, 0x79, 0x21, 0xcc, 0x25, 0x33, 0x46, 0x9e, 0xd6, 0x71, 0xc7, 0x14, 0x84, 0xd4,\n\t0x74, 0x4c, 0x21, 0xd3, 0x02, 0xa4, 0xa6, 0x93, 0xab, 0x80, 0xc5, 0xf6, 0x04, 0x23, 0x0a, 0xa6,\n\t0x8d, 0x39, 0x03, 0xfb, 0x65, 0x31, 0x86, 0xbc, 0x0d, 0xd8, 0x27, 0x9b, 0x77, 0x71, 0xfa, 0x74,\n\t0xb8, 0xc3, 0x5d, 0xa1, 0x3f, 0xd8, 0x6c, 0x7d, 0xc2, 0x52, 0x0b, 0x72, 0x5e, 0x3d, 0xed, 0x0b,\n\t0x6b, 0xf9, 0x8c, 0x14, 0x9c, 0x11, 0x60, 0x95, 0x37, 0x25, 0x06, 0xe0, 0xa3, 0x59, 0xc0, 0xd1,\n\t0x30, 0x12, 0x1b, 0x4e, 0xf9, 0x32, 0xcc, 0x6d, 0xdb, 0x16, 0x3b, 0xbd, 0xb8, 0x4a, 0x05, 0x90,\n\t0x3a, 0x25, 0x09, 0xb3, 0x27, 0xa9, 0x53, 0xbe, 0x02, 0x20, 0xb4, 0x29, 0x20, 0xed, 0xb3, 0x36,\n\t0xf4, 0x01, 0xd2, 0x7e, 0xf9, 0x26, 0xa4, 0xb7, 0x3a, 0xc7, 0x7b, 0x9d, 0x1e, 0xb9, 0x06, 0x30,\n\t0xe8, 0x4c, 0x9c, 0xf6, 0x21, 0xee, 0xc3, 0xe7, 0x9f, 0x7f, 0xfe, 0xb9, 0x84, 0x97, 0xbd, 0x1c,\n\t0xad, 0x65, 0xfb, 0xf1, 0x02, 0xa0, 0x35, 0xe8, 0x6e, 0x99, 0x93, 0x49, 0xa7, 0x67, 0x92, 0x2a,\n\t0xa4, 0x2d, 0x73, 0x42, 0xa3, 0x9d, 0x84, 0xef, 0x08, 0xcb, 0xfe, 0x2a, 0xf8, 0xa8, 0x95, 0x6d,\n\t0x84, 0x18, 0x1c, 0x4a, 0x14, 0x48, 0x58, 0x47, 0x43, 0x7c, 0x27, 0x49, 0x19, 0xf4, 0xe7, 0xd2,\n\t0x25, 0x48, 0x33, 0x0c, 0x21, 0x90, 0xb4, 0x3a, 0x43, 0xb3, 0xc4, 0xfa, 0xc5, 0xdf, 0xe5, 0x5f,\n\t0x95, 0x00, 0xb6, 0xcd, 0x97, 0x67, 0xe8, 0xd3, 0x47, 0xc5, 0xf4, 0x99, 0x60, 0x7d, 0xde, 0x8f,\n\t0xeb, 0x93, 0xea, 0xec, 0xd0, 0xb6, 0xbb, 0x6d, 0xb6, 0xc5, 0xec, 0x49, 0x27, 0x47, 0x6b, 0x70,\n\t0xd7, 0xca, 0x1f, 0x40, 0x61, 0xd3, 0xb2, 0xcc, 0xb1, 0x3b, 0x26, 0x02, 0xc9, 0x67, 0xf6, 0xc4,\n\t0xe1, 0x6f, 0x4b, 0xf8, 0x9b, 0x94, 0x20, 0x39, 0xb2, 0xc7, 0x0e, 0x9b, 0x67, 0x3d, 0xa9, 0xaf,\n\t0xae, 0xae, 0x1a, 0x58, 0x43, 0x2e, 0x41, 0xee, 0xc0, 0xb6, 0x2c, 0xf3, 0x80, 0x4e, 0x22, 0x81,\n\t0x69, 0x8d, 0x5f, 0x51, 0xfe, 0x65, 0x09, 0x0a, 0x2d, 0xe7, 0x99, 0x6f, 0x5c, 0x81, 0xc4, 0x73,\n\t0xf3, 0x04, 0x87, 0x97, 0x30, 0xe8, 0x4f, 0x7a, 0x54, 0x7e, 0xbe, 0x33, 0x38, 0x62, 0x6f, 0x4d,\n\t0x05, 0x83, 0x15, 0xc8, 0x05, 0x48, 0xbf, 0x34, 0xfb, 0xbd, 0x67, 0x0e, 0xda, 0x94, 0x0d, 0x5e,\n\t0x22, 0xb7, 0x20, 0xd5, 0xa7, 0x83, 0x2d, 0x25, 0x71, 0xbd, 0x2e, 0xf8, 0xeb, 0x25, 0xce, 0xc1,\n\t0x60, 0xa0, 0x1b, 0xd9, 0x6c, 0x57, 0xf9, 0xe8, 0xa3, 0x8f, 0x3e, 0x92, 0xcb, 0x87, 0xb0, 0xe8,\n\t0x1e, 0xde, 0xc0, 0x64, 0xb7, 0xa1, 0x34, 0x30, 0xed, 0xf6, 0x61, 0xdf, 0xea, 0x0c, 0x06, 0x27,\n\t0xed, 0x97, 0xb6, 0xd5, 0xee, 0x58, 0x6d, 0x7b, 0x72, 0xd0, 0x19, 0xe3, 0x02, 0x44, 0x77, 0xb1,\n\t0x38, 0x30, 0xed, 0x26, 0xa3, 0xbd, 0x6f, 0x5b, 0x0f, 0xac, 0x16, 0xe5, 0x94, 0xff, 0x20, 0x09,\n\t0xb9, 0xad, 0x13, 0xd7, 0xfa, 0x22, 0xa4, 0x0e, 0xec, 0x23, 0x8b, 0xad, 0x65, 0xca, 0x60, 0x05,\n\t0x6f, 0x8f, 0x64, 0x61, 0x8f, 0x16, 0x21, 0xf5, 0xe2, 0xc8, 0x76, 0x4c, 0x9c, 0x6e, 0xce, 0x60,\n\t0x05, 0xba, 0x5a, 0x23, 0xd3, 0x29, 0x25, 0x31, 0xb9, 0xa5, 0x3f, 0xfd, 0xf9, 0xa7, 0xce, 0x30,\n\t0x7f, 0xb2, 0x02, 0x69, 0x9b, 0xae, 0xfe, 0xa4, 0x94, 0xc6, 0x77, 0x35, 0x01, 0x2e, 0xee, 0x8a,\n\t0xc1, 0x51, 0x64, 0x13, 0x16, 0x5e, 0x9a, 0xed, 0xe1, 0xd1, 0xc4, 0x69, 0xf7, 0xec, 0x76, 0xd7,\n\t0x34, 0x47, 0xe6, 0xb8, 0x34, 0x87, 0x3d, 0x09, 0x3e, 0x61, 0xd6, 0x42, 0x1a, 0xf3, 0x2f, 0xcd,\n\t0xad, 0xa3, 0x89, 0xb3, 0x61, 0x3f, 0x46, 0x16, 0xa9, 0x42, 0x6e, 0x6c, 0x52, 0x4f, 0x40, 0x07,\n\t0x5b, 0x08, 0xf7, 0x1e, 0xa0, 0x66, 0xc7, 0xe6, 0x08, 0x2b, 0xc8, 0x3a, 0x64, 0xf7, 0xfb, 0xcf,\n\t0xcd, 0xc9, 0x33, 0xb3, 0x5b, 0xca, 0xa8, 0x52, 0x65, 0x5e, 0xbb, 0xe8, 0x73, 0xbc, 0x65, 0x5d,\n\t0x79, 0x64, 0x0f, 0xec, 0xb1, 0xe1, 0x41, 0xc9, 0x7d, 0xc8, 0x4d, 0xec, 0xa1, 0xc9, 0xf4, 0x9d,\n\t0xc5, 0xa0, 0x7a, 0x79, 0x16, 0x6f, 0xd7, 0x1e, 0x9a, 0xae, 0x07, 0x73, 0xf1, 0x64, 0x99, 0x0d,\n\t0x74, 0x9f, 0x5e, 0x9d, 0x4b, 0x80, 0x4f, 0x03, 0x74, 0x40, 0x78, 0x95, 0x26, 0x4b, 0x74, 0x40,\n\t0xbd, 0x43, 0x7a, 0x23, 0x2a, 0xe5, 0x31, 0xaf, 0xf4, 0xca, 0x4b, 0xb7, 0x20, 0xe7, 0x19, 0xf4,\n\t0x5d, 0x1f, 0x73, 0x37, 0x39, 0xf4, 0x07, 0xcc, 0xf5, 0x31, 0x5f, 0xf3, 0x06, 0xa4, 0x70, 0xd8,\n\t0x34, 0x42, 0x19, 0x0d, 0x1a, 0x10, 0x73, 0x90, 0xda, 0x30, 0x1a, 0x8d, 0x6d, 0x45, 0xc2, 0xd8,\n\t0xf8, 0xf4, 0xdd, 0x86, 0x22, 0x0b, 0x8a, 0xfd, 0x6d, 0x09, 0x12, 0x8d, 0x63, 0x54, 0x0b, 0x9d,\n\t0x86, 0x7b, 0xa2, 0xe9, 0x6f, 0xad, 0x06, 0xc9, 0xa1, 0x3d, 0x36, 0xc9, 0xf9, 0x19, 0xb3, 0x2c,\n\t0xf5, 0x70, 0xbf, 0x84, 0x57, 0xe4, 0xc6, 0xb1, 0x63, 0x20, 0x5e, 0x7b, 0x0b, 0x92, 0x8e, 0x79,\n\t0xec, 0xcc, 0xe6, 0x3d, 0x63, 0x1d, 0x50, 0x80, 0x76, 0x13, 0xd2, 0xd6, 0xd1, 0x70, 0xdf, 0x1c,\n\t0xcf, 0x86, 0xf6, 0x71, 0x7a, 0x1c, 0x52, 0x7e, 0x0f, 0x94, 0x47, 0xf6, 0x70, 0x34, 0x30, 0x8f,\n\t0x1b, 0xc7, 0x8e, 0x69, 0x4d, 0xfa, 0xb6, 0x45, 0xf5, 0x7c, 0xd8, 0x1f, 0xa3, 0x17, 0xc1, 0xb7,\n\t0x62, 0x2c, 0xd0, 0x53, 0x3d, 0x31, 0x0f, 0x6c, 0xab, 0xcb, 0x1d, 0x26, 0x2f, 0x51, 0xb4, 0xf3,\n\t0xac, 0x3f, 0xa6, 0x0e, 0x84, 0xfa, 0x79, 0x56, 0x28, 0x6f, 0x40, 0x91, 0xe7, 0x18, 0x13, 0xde,\n\t0x71, 0xf9, 0x06, 0x14, 0xdc, 0x2a, 0x7c, 0x38, 0xcf, 0x42, 0xf2, 0x83, 0x86, 0xd1, 0x52, 0xce,\n\t0xd1, 0x65, 0x6d, 0x6d, 0x37, 0x14, 0x89, 0xfe, 0xd8, 0x7b, 0xbf, 0x15, 0x58, 0xca, 0x4b, 0x50,\n\t0xf0, 0xc6, 0xbe, 0x6b, 0x3a, 0xd8, 0x42, 0x03, 0x42, 0xa6, 0x2e, 0x67, 0xa5, 0x72, 0x06, 0x52,\n\t0x8d, 0xe1, 0xc8, 0x39, 0x29, 0xff, 0x22, 0xe4, 0x39, 0xe8, 0x69, 0x7f, 0xe2, 0x90, 0x3b, 0x90,\n\t0x19, 0xf2, 0xf9, 0x4a, 0x78, 0xdd, 0x13, 0x35, 0xe5, 0xe3, 0xdc, 0xdf, 0x86, 0x8b, 0x5e, 0xaa,\n\t0x42, 0x46, 0xf0, 0xa5, 0xfc, 0xa8, 0xcb, 0xe2, 0x51, 0x67, 0x4e, 0x21, 0x21, 0x38, 0x85, 0xf2,\n\t0x16, 0x64, 0x58, 0x04, 0x9c, 0x60, 0x54, 0x67, 0xa9, 0x22, 0x13, 0x13, 0xdb, 0xf9, 0x3c, 0xab,\n\t0x63, 0x17, 0x95, 0xab, 0x90, 0x47, 0xc1, 0x72, 0x04, 0x73, 0x9d, 0x80, 0x55, 0x4c, 0x6e, 0xbf,\n\t0x9f, 0x82, 0xac, 0xbb, 0x52, 0x64, 0x19, 0xd2, 0x2c, 0x3f, 0x43, 0x53, 0xee, 0xfb, 0x41, 0x0a,\n\t0x33, 0x32, 0xb2, 0x0c, 0x19, 0x9e, 0x83, 0x71, 0xef, 0x2e, 0x57, 0x35, 0x23, 0xcd, 0x72, 0x2e,\n\t0xaf, 0xb1, 0xa6, 0xa3, 0x63, 0x62, 0x2f, 0x03, 0x69, 0x96, 0x55, 0x11, 0x15, 0x72, 0x5e, 0x1e,\n\t0x85, 0xfe, 0x98, 0x3f, 0x03, 0x64, 0xdd, 0xc4, 0x49, 0x40, 0xd4, 0x74, 0xf4, 0x58, 0x3c, 0xe7,\n\t0xcf, 0x36, 0xfd, 0xeb, 0x49, 0xd6, 0xcd, 0x86, 0xf0, 0xf9, 0xde, 0x4d, 0xf0, 0x33, 0x3c, 0xff,\n\t0xf1, 0x01, 0x35, 0x1d, 0x5d, 0x82, 0x9b, 0xcd, 0x67, 0x78, 0x8e, 0x43, 0xae, 0xd2, 0x21, 0x62,\n\t0xce, 0x82, 0x47, 0xdf, 0x4f, 0xdd, 0xd3, 0x2c, 0x93, 0x21, 0xd7, 0xa8, 0x05, 0x96, 0x98, 0xe0,\n\t0xb9, 0xf4, 0xf3, 0xf4, 0x0c, 0xcf, 0x57, 0xc8, 0x4d, 0x0a, 0x61, 0xcb, 0x5f, 0x82, 0x88, 0xa4,\n\t0x3c, 0xc3, 0x93, 0x72, 0xa2, 0xd2, 0x0e, 0xd1, 0x3d, 0xa0, 0x4b, 0x10, 0x12, 0xf0, 0x34, 0x4b,\n\t0xc0, 0xc9, 0x15, 0x34, 0xc7, 0x26, 0x55, 0xf0, 0x93, 0xed, 0x0c, 0x4f, 0x70, 0xfc, 0x76, 0xbc,\n\t0xb2, 0x79, 0x89, 0x75, 0x86, 0xa7, 0x30, 0xa4, 0x46, 0xf7, 0x8b, 0xea, 0xbb, 0x34, 0x8f, 0x4e,\n\t0xb0, 0xe4, 0x0b, 0xcf, 0xdd, 0x53, 0xe6, 0x03, 0xeb, 0xcc, 0x83, 0x18, 0xa9, 0x26, 0x9e, 0x86,\n\t0x25, 0xca, 0xdb, 0xe9, 0x5b, 0x87, 0xa5, 0x22, 0xae, 0x44, 0xa2, 0x6f, 0x1d, 0x1a, 0xa9, 0x26,\n\t0xad, 0x61, 0x1a, 0xd8, 0xa6, 0x6d, 0x0a, 0xb6, 0x25, 0x6f, 0xb3, 0x46, 0x5a, 0x45, 0x4a, 0x90,\n\t0x6a, 0xb6, 0xb7, 0x3b, 0x56, 0x69, 0x81, 0xf1, 0xac, 0x8e, 0x65, 0x24, 0x9b, 0xdb, 0x1d, 0x8b,\n\t0xbc, 0x05, 0x89, 0xc9, 0xd1, 0x7e, 0x89, 0x84, 0xbf, 0xac, 0xec, 0x1e, 0xed, 0xbb, 0x43, 0x31,\n\t0x28, 0x82, 0x2c, 0x43, 0x76, 0xe2, 0x8c, 0xdb, 0xbf, 0x60, 0x8e, 0xed, 0xd2, 0x79, 0x5c, 0xc2,\n\t0x73, 0x46, 0x66, 0xe2, 0x8c, 0x3f, 0x30, 0xc7, 0xf6, 0x19, 0x9d, 0x5f, 0xf9, 0x0a, 0xe4, 0x05,\n\t0xbb, 0xa4, 0x08, 0x92, 0xc5, 0x6e, 0x0a, 0x75, 0xe9, 0x8e, 0x21, 0x59, 0xe5, 0x3d, 0x28, 0xb8,\n\t0x39, 0x0c, 0xce, 0x57, 0xa3, 0x27, 0x69, 0x60, 0x8f, 0xf1, 0x7c, 0xce, 0x6b, 0x97, 0xc4, 0x10,\n\t0xe5, 0xc3, 0x78, 0xb8, 0x60, 0xd0, 0xb2, 0x12, 0x1a, 0x8a, 0x54, 0xfe, 0xa1, 0x04, 0x85, 0x2d,\n\t0x7b, 0xec, 0x3f, 0x30, 0x2f, 0x42, 0x6a, 0xdf, 0xb6, 0x07, 0x13, 0x34, 0x9b, 0x35, 0x58, 0x81,\n\t0xbc, 0x01, 0x05, 0xfc, 0xe1, 0xe6, 0x9e, 0xb2, 0xf7, 0xb4, 0x91, 0xc7, 0x7a, 0x9e, 0x70, 0x12,\n\t0x48, 0xf6, 0x2d, 0x67, 0xc2, 0x3d, 0x19, 0xfe, 0x26, 0x5f, 0x80, 0x3c, 0xfd, 0xeb, 0x32, 0x93,\n\t0xde, 0x85, 0x15, 0x68, 0x35, 0x27, 0xbe, 0x05, 0x73, 0xb8, 0xfb, 0x1e, 0x2c, 0xe3, 0x3d, 0x63,\n\t0x14, 0x58, 0x03, 0x07, 0x96, 0x20, 0xc3, 0x5c, 0xc1, 0x04, 0xbf, 0x96, 0xe5, 0x0c, 0xb7, 0x48,\n\t0xdd, 0x2b, 0x66, 0x02, 0x2c, 0xdc, 0x67, 0x0c, 0x5e, 0x2a, 0x3f, 0x80, 0x2c, 0x46, 0xa9, 0xd6,\n\t0xa0, 0x4b, 0xca, 0x20, 0xf5, 0x4a, 0x26, 0xc6, 0xc8, 0x45, 0xe1, 0x9a, 0xcf, 0x9b, 0x57, 0x36,\n\t0x0c, 0xa9, 0xb7, 0xb4, 0x00, 0xd2, 0x06, 0xbd, 0x77, 0x1f, 0x73, 0x37, 0x2d, 0x1d, 0x97, 0x5b,\n\t0xdc, 0xc4, 0xb6, 0xf9, 0x32, 0xce, 0xc4, 0xb6, 0xf9, 0x92, 0x99, 0xb8, 0x3a, 0x65, 0x82, 0x96,\n\t0x4e, 0xf8, 0xa7, 0x43, 0xe9, 0xa4, 0x5c, 0x85, 0x39, 0x3c, 0x9e, 0x7d, 0xab, 0xb7, 0x63, 0xf7,\n\t0x2d, 0xbc, 0xe7, 0x1f, 0xe2, 0x3d, 0x49, 0x32, 0xa4, 0x43, 0xba, 0x07, 0xe6, 0x71, 0xe7, 0x80,\n\t0xdd, 0x38, 0xb3, 0x06, 0x2b, 0x94, 0x3f, 0x4b, 0xc2, 0x3c, 0x77, 0xad, 0xef, 0xf7, 0x9d, 0x67,\n\t0x5b, 0x9d, 0x11, 0x79, 0x0a, 0x05, 0xea, 0x55, 0xdb, 0xc3, 0xce, 0x68, 0x44, 0x8f, 0xaf, 0x84,\n\t0x57, 0x8d, 0xeb, 0x53, 0xae, 0x9a, 0xe3, 0x57, 0xb6, 0x3b, 0x43, 0x73, 0x8b, 0x61, 0x1b, 0x96,\n\t0x33, 0x3e, 0x31, 0xf2, 0x96, 0x5f, 0x43, 0x36, 0x21, 0x3f, 0x9c, 0xf4, 0x3c, 0x63, 0x32, 0x1a,\n\t0xab, 0x44, 0x1a, 0xdb, 0x9a, 0xf4, 0x02, 0xb6, 0x60, 0xe8, 0x55, 0xd0, 0x81, 0x51, 0x7f, 0xec,\n\t0xd9, 0x4a, 0x9c, 0x32, 0x30, 0xea, 0x3a, 0x82, 0x03, 0xdb, 0xf7, 0x6b, 0xc8, 0x63, 0x00, 0x7a,\n\t0xbc, 0x1c, 0x9b, 0xa6, 0x4e, 0xa8, 0xa0, 0xbc, 0xf6, 0x66, 0xa4, 0xad, 0x5d, 0x67, 0xbc, 0x67,\n\t0xef, 0x3a, 0x63, 0x66, 0x88, 0x1e, 0x4c, 0x2c, 0x2e, 0xbd, 0x03, 0x4a, 0x78, 0xfe, 0xe2, 0x8d,\n\t0x3c, 0x35, 0xe3, 0x46, 0x9e, 0xe3, 0x37, 0xf2, 0xba, 0x7c, 0x57, 0x5a, 0x7a, 0x0f, 0x8a, 0xa1,\n\t0x29, 0x8b, 0x74, 0xc2, 0xe8, 0xb7, 0x45, 0x7a, 0x5e, 0x7b, 0x5d, 0xf8, 0x9c, 0x2d, 0x6e, 0xb8,\n\t0x68, 0xf7, 0x1d, 0x50, 0xc2, 0xd3, 0x17, 0x0d, 0x67, 0x63, 0x32, 0x05, 0xe4, 0xdf, 0x87, 0xb9,\n\t0xc0, 0x94, 0x45, 0x72, 0xee, 0x94, 0x49, 0x95, 0x7f, 0x29, 0x05, 0xa9, 0x96, 0x65, 0xda, 0x87,\n\t0xe4, 0xf5, 0x60, 0x9c, 0x7c, 0x72, 0xce, 0x8d, 0x91, 0x17, 0x43, 0x31, 0xf2, 0xc9, 0x39, 0x2f,\n\t0x42, 0x5e, 0x0c, 0x45, 0x48, 0xb7, 0xa9, 0xa6, 0x93, 0xcb, 0x53, 0xf1, 0xf1, 0xc9, 0x39, 0x21,\n\t0x38, 0x5e, 0x9e, 0x0a, 0x8e, 0x7e, 0x73, 0x4d, 0xa7, 0x0e, 0x35, 0x18, 0x19, 0x9f, 0x9c, 0xf3,\n\t0xa3, 0xe2, 0x72, 0x38, 0x2a, 0x7a, 0x8d, 0x35, 0x9d, 0x0d, 0x49, 0x88, 0x88, 0x38, 0x24, 0x16,\n\t0x0b, 0x97, 0xc3, 0xb1, 0x10, 0x79, 0x3c, 0x0a, 0x2e, 0x87, 0xa3, 0x20, 0x36, 0xf2, 0xa8, 0x77,\n\t0x31, 0x14, 0xf5, 0xd0, 0x28, 0x0b, 0x77, 0xcb, 0xe1, 0x70, 0xc7, 0x78, 0xc2, 0x48, 0xc5, 0x58,\n\t0xe7, 0x35, 0xd6, 0x74, 0xa2, 0x85, 0x02, 0x5d, 0xf4, 0x6d, 0x1f, 0xf7, 0x02, 0x9d, 0xbe, 0x4e,\n\t0x97, 0xcd, 0xbd, 0x88, 0x16, 0x63, 0xbe, 0xf8, 0xe3, 0x6a, 0xba, 0x17, 0x31, 0x0d, 0x32, 0x87,\n\t0x3c, 0x01, 0x56, 0xd0, 0x73, 0x09, 0xb2, 0xc4, 0xcd, 0x5f, 0x69, 0xb6, 0xd1, 0x83, 0xd1, 0x79,\n\t0x1d, 0xb2, 0x3b, 0x7d, 0x05, 0xe6, 0x9a, 0xed, 0xa7, 0x9d, 0x71, 0xcf, 0x9c, 0x38, 0xed, 0xbd,\n\t0x4e, 0xcf, 0x7b, 0x44, 0xa0, 0xfb, 0x9f, 0x6f, 0xf2, 0x96, 0xbd, 0x4e, 0x8f, 0x5c, 0x70, 0xc5,\n\t0xd5, 0xc5, 0x56, 0x89, 0xcb, 0x6b, 0xe9, 0x75, 0xba, 0x68, 0xcc, 0x18, 0xfa, 0xc2, 0x05, 0xee,\n\t0x0b, 0x1f, 0x66, 0x20, 0x75, 0x64, 0xf5, 0x6d, 0xeb, 0x61, 0x0e, 0x32, 0x8e, 0x3d, 0x1e, 0x76,\n\t0x1c, 0xbb, 0xfc, 0x23, 0x09, 0xe0, 0x91, 0x3d, 0x1c, 0x1e, 0x59, 0xfd, 0x17, 0x47, 0x26, 0xb9,\n\t0x02, 0xf9, 0x61, 0xe7, 0xb9, 0xd9, 0x1e, 0x9a, 0xed, 0x83, 0xb1, 0x7b, 0x0e, 0x72, 0xb4, 0x6a,\n\t0xcb, 0x7c, 0x34, 0x3e, 0x21, 0x25, 0xf7, 0x8a, 0x8e, 0xda, 0x41, 0x49, 0xf2, 0x2b, 0xfb, 0x22,\n\t0xbf, 0x74, 0xa6, 0xf9, 0x1e, 0xba, 0xd7, 0x4e, 0x96, 0x47, 0x64, 0xf8, 0xee, 0x61, 0x89, 0x4a,\n\t0xde, 0x31, 0x87, 0xa3, 0xf6, 0x01, 0x4a, 0x85, 0xca, 0x21, 0x45, 0xcb, 0x8f, 0xc8, 0x6d, 0x48,\n\t0x1c, 0xd8, 0x03, 0x14, 0xc9, 0x29, 0xfb, 0x42, 0x71, 0xe4, 0x0d, 0x48, 0x0c, 0x27, 0x4c, 0x36,\n\t0x79, 0x6d, 0x41, 0xb8, 0x27, 0xb0, 0xd0, 0x44, 0x61, 0xc3, 0x49, 0xcf, 0x9b, 0xf7, 0x8d, 0x22,\n\t0x24, 0x9a, 0xad, 0x16, 0x8d, 0xfd, 0xcd, 0x56, 0x6b, 0x4d, 0x91, 0xea, 0x5f, 0x82, 0x6c, 0x6f,\n\t0x6c, 0x9a, 0xd4, 0x3d, 0xcc, 0xce, 0x39, 0x3e, 0xc4, 0x58, 0xe7, 0x81, 0xea, 0x5b, 0x90, 0x39,\n\t0x60, 0x59, 0x07, 0x89, 0x48, 0x6b, 0x4b, 0x7f, 0xc8, 0x1e, 0x55, 0x96, 0xfc, 0xe6, 0x70, 0x9e,\n\t0x62, 0xb8, 0x36, 0xea, 0x3b, 0x90, 0x1b, 0xb7, 0x4f, 0x33, 0xf8, 0x31, 0x8b, 0x2e, 0x71, 0x06,\n\t0xb3, 0x63, 0x5e, 0x55, 0x6f, 0xc0, 0x82, 0x65, 0xbb, 0xdf, 0x50, 0xda, 0x5d, 0x76, 0xc6, 0x2e,\n\t0x4e, 0x5f, 0xe5, 0x5c, 0xe3, 0x26, 0xfb, 0x6e, 0x69, 0xd9, 0xbc, 0x81, 0x9d, 0xca, 0xfa, 0x23,\n\t0x50, 0x04, 0x33, 0x98, 0x7a, 0xc6, 0x59, 0x39, 0x64, 0x1f, 0x4a, 0x3d, 0x2b, 0x78, 0xee, 0x43,\n\t0x46, 0xd8, 0xc9, 0x8c, 0x31, 0xd2, 0x63, 0x5f, 0x9d, 0x3d, 0x23, 0xe8, 0xea, 0xa6, 0x8d, 0x50,\n\t0x5f, 0x13, 0x6d, 0xe4, 0x19, 0xfb, 0x20, 0x2d, 0x1a, 0xa9, 0xe9, 0xa1, 0x55, 0x39, 0x3a, 0x75,\n\t0x28, 0x7d, 0xf6, 0x3d, 0xd9, 0xb3, 0xc2, 0x1c, 0xe0, 0x0c, 0x33, 0xf1, 0x83, 0xf9, 0x90, 0x7d,\n\t0x6a, 0x0e, 0x98, 0x99, 0x1a, 0xcd, 0xe4, 0xd4, 0xd1, 0x3c, 0x67, 0xdf, 0x75, 0x3d, 0x33, 0xbb,\n\t0xb3, 0x46, 0x33, 0x39, 0x75, 0x34, 0x03, 0xf6, 0xc5, 0x37, 0x60, 0xa6, 0xa6, 0xd7, 0x37, 0x80,\n\t0x88, 0x5b, 0xcd, 0xe3, 0x44, 0x8c, 0x9d, 0x21, 0xfb, 0x8e, 0xef, 0x6f, 0x36, 0xa3, 0xcc, 0x32,\n\t0x14, 0x3f, 0x20, 0x8b, 0x7d, 0xe2, 0x0f, 0x1a, 0xaa, 0xe9, 0xf5, 0x4d, 0x38, 0x2f, 0x4e, 0xec,\n\t0x0c, 0x43, 0xb2, 0x55, 0xa9, 0x52, 0x34, 0x16, 0xfc, 0xa9, 0x71, 0xce, 0x4c, 0x53, 0xf1, 0x83,\n\t0x1a, 0xa9, 0x52, 0x45, 0x99, 0x32, 0x55, 0xd3, 0xeb, 0x0f, 0xa0, 0x28, 0x98, 0xda, 0xc7, 0x08,\n\t0x1d, 0x6d, 0xe6, 0x05, 0xfb, 0x5f, 0x0b, 0xcf, 0x0c, 0x8d, 0xe8, 0xe1, 0x1d, 0xe3, 0x31, 0x2e,\n\t0xda, 0xc8, 0x98, 0xfd, 0xa3, 0x80, 0x3f, 0x16, 0x64, 0x84, 0x8e, 0x04, 0xe6, 0xdf, 0x71, 0x56,\n\t0x26, 0xec, 0x5f, 0x08, 0xfc, 0xa1, 0x50, 0x42, 0xbd, 0x1f, 0x98, 0x8e, 0x49, 0x83, 0x5c, 0x8c,\n\t0x0d, 0x07, 0x3d, 0xf2, 0x9b, 0x91, 0x80, 0x15, 0xf1, 0x81, 0x44, 0x98, 0x36, 0x2d, 0xd6, 0x37,\n\t0x61, 0xfe, 0xec, 0x0e, 0xe9, 0x63, 0x89, 0x65, 0xcb, 0xd5, 0x15, 0x9a, 0x50, 0x1b, 0x73, 0xdd,\n\t0x80, 0x5f, 0x6a, 0xc0, 0xdc, 0x99, 0x9d, 0xd2, 0x27, 0x12, 0xcb, 0x39, 0xa9, 0x25, 0xa3, 0xd0,\n\t0x0d, 0x7a, 0xa6, 0xb9, 0x33, 0xbb, 0xa5, 0x4f, 0x25, 0xf6, 0x40, 0xa1, 0x6b, 0x9e, 0x11, 0xd7,\n\t0x33, 0xcd, 0x9d, 0xd9, 0x2d, 0x7d, 0x95, 0x65, 0x94, 0xb2, 0x5e, 0x15, 0x8d, 0xa0, 0x2f, 0x98,\n\t0x3f, 0xbb, 0x5b, 0xfa, 0x9a, 0x84, 0x8f, 0x15, 0xb2, 0xae, 0x7b, 0xeb, 0xe2, 0x79, 0xa6, 0xf9,\n\t0xb3, 0xbb, 0xa5, 0xaf, 0x4b, 0xf8, 0xa4, 0x21, 0xeb, 0xeb, 0x01, 0x33, 0xc1, 0xd1, 0x9c, 0xee,\n\t0x96, 0xbe, 0x21, 0xe1, 0x2b, 0x83, 0xac, 0xd7, 0x3c, 0x33, 0xbb, 0x53, 0xa3, 0x39, 0xdd, 0x2d,\n\t0x7d, 0x13, 0x6f, 0xf1, 0x75, 0x59, 0xbf, 0x13, 0x30, 0x83, 0x9e, 0xa9, 0xf8, 0x0a, 0x6e, 0xe9,\n\t0x5b, 0x12, 0x3e, 0x06, 0xc9, 0xfa, 0x5d, 0xc3, 0xed, 0xdd, 0xf7, 0x4c, 0xc5, 0x57, 0x70, 0x4b,\n\t0x9f, 0x49, 0xf8, 0x66, 0x24, 0xeb, 0xf7, 0x82, 0x86, 0xd0, 0x33, 0x29, 0xaf, 0xe2, 0x96, 0xbe,\n\t0x4d, 0x2d, 0x15, 0xeb, 0xf2, 0xfa, 0xaa, 0xe1, 0x0e, 0x40, 0xf0, 0x4c, 0xca, 0xab, 0xb8, 0xa5,\n\t0xef, 0x50, 0x53, 0x4a, 0x5d, 0x5e, 0x5f, 0x0b, 0x99, 0xaa, 0xe9, 0xf5, 0x47, 0x50, 0x38, 0xab,\n\t0x5b, 0xfa, 0xae, 0xf8, 0x16, 0x97, 0xef, 0x0a, 0xbe, 0x69, 0x47, 0xd8, 0xb3, 0x53, 0x1d, 0xd3,\n\t0xf7, 0x30, 0xc7, 0xa9, 0xcf, 0x3d, 0x61, 0xef, 0x55, 0x8c, 0xe0, 0x6f, 0x1f, 0x73, 0x53, 0x5b,\n\t0xfe, 0xf9, 0x38, 0xd5, 0x47, 0x7d, 0x5f, 0xc2, 0x47, 0xad, 0x02, 0x37, 0x88, 0x78, 0xef, 0xa4,\n\t0x30, 0x87, 0xf5, 0xa1, 0x3f, 0xcb, 0xd3, 0xbc, 0xd5, 0x0f, 0xa4, 0x57, 0x71, 0x57, 0xf5, 0x44,\n\t0x6b, 0xbb, 0xe1, 0x2d, 0x06, 0xd6, 0xbc, 0x0d, 0xc9, 0x63, 0x6d, 0x75, 0x4d, 0xbc, 0x92, 0x89,\n\t0x6f, 0xb9, 0xcc, 0x49, 0xe5, 0xb5, 0xa2, 0xf0, 0xdc, 0x3d, 0x1c, 0x39, 0x27, 0x06, 0xb2, 0x38,\n\t0x5b, 0x8b, 0x64, 0x7f, 0x12, 0xc3, 0xd6, 0x38, 0xbb, 0x1a, 0xc9, 0xfe, 0x34, 0x86, 0x5d, 0xe5,\n\t0x6c, 0x3d, 0x92, 0xfd, 0xd5, 0x18, 0xb6, 0xce, 0xd9, 0xeb, 0x91, 0xec, 0xaf, 0xc5, 0xb0, 0xd7,\n\t0x39, 0xbb, 0x16, 0xc9, 0xfe, 0x7a, 0x0c, 0xbb, 0xc6, 0xd9, 0x77, 0x22, 0xd9, 0xdf, 0x88, 0x61,\n\t0xdf, 0xe1, 0xec, 0xbb, 0x91, 0xec, 0x6f, 0xc6, 0xb0, 0xef, 0x72, 0xf6, 0xbd, 0x48, 0xf6, 0xb7,\n\t0x62, 0xd8, 0xf7, 0x18, 0x7b, 0x6d, 0x35, 0x92, 0xfd, 0x59, 0x34, 0x7b, 0x6d, 0x95, 0xb3, 0xa3,\n\t0xb5, 0xf6, 0xed, 0x18, 0x36, 0xd7, 0xda, 0x5a, 0xb4, 0xd6, 0xbe, 0x13, 0xc3, 0xe6, 0x5a, 0x5b,\n\t0x8b, 0xd6, 0xda, 0x77, 0x63, 0xd8, 0x5c, 0x6b, 0x6b, 0xd1, 0x5a, 0xfb, 0x5e, 0x0c, 0x9b, 0x6b,\n\t0x6d, 0x2d, 0x5a, 0x6b, 0xdf, 0x8f, 0x61, 0x73, 0xad, 0xad, 0x45, 0x6b, 0xed, 0x07, 0x31, 0x6c,\n\t0xae, 0xb5, 0xb5, 0x68, 0xad, 0xfd, 0x51, 0x0c, 0x9b, 0x6b, 0x6d, 0x2d, 0x5a, 0x6b, 0x7f, 0x1c,\n\t0xc3, 0xe6, 0x5a, 0x5b, 0x8b, 0xd6, 0xda, 0x9f, 0xc4, 0xb0, 0xb9, 0xd6, 0xb4, 0x68, 0xad, 0xfd,\n\t0x69, 0x34, 0x5b, 0xe3, 0x5a, 0xd3, 0xa2, 0xb5, 0xf6, 0x67, 0x31, 0x6c, 0xae, 0x35, 0x2d, 0x5a,\n\t0x6b, 0x7f, 0x1e, 0xc3, 0xe6, 0x5a, 0xd3, 0xa2, 0xb5, 0xf6, 0xc3, 0x18, 0x36, 0xd7, 0x9a, 0x16,\n\t0xad, 0xb5, 0xbf, 0x88, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xcb, 0x18, 0x36, 0xd7, 0x9a,\n\t0x16, 0xad, 0xb5, 0xbf, 0x8a, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xeb, 0x18, 0x36, 0xd7,\n\t0x9a, 0x16, 0xad, 0xb5, 0xbf, 0x89, 0x61, 0x73, 0xad, 0x69, 0xd1, 0x5a, 0xfb, 0xdb, 0x18, 0x36,\n\t0xd7, 0x5a, 0x35, 0x5a, 0x6b, 0x7f, 0x17, 0xcd, 0xae, 0x72, 0xad, 0x55, 0xa3, 0xb5, 0xf6, 0xf7,\n\t0x31, 0x6c, 0xae, 0xb5, 0x6a, 0xb4, 0xd6, 0xfe, 0x21, 0x86, 0xcd, 0xb5, 0x56, 0x8d, 0xd6, 0xda,\n\t0x3f, 0xc6, 0xb0, 0xb9, 0xd6, 0xaa, 0xd1, 0x5a, 0xfb, 0x51, 0x0c, 0x9b, 0x6b, 0xad, 0x1a, 0xad,\n\t0xb5, 0x7f, 0x8a, 0x61, 0x73, 0xad, 0x55, 0xa3, 0xb5, 0xf6, 0xcf, 0x31, 0x6c, 0xae, 0xb5, 0x6a,\n\t0xb4, 0xd6, 0xfe, 0x25, 0x86, 0xcd, 0xb5, 0x56, 0x8d, 0xd6, 0xda, 0xbf, 0xc6, 0xb0, 0xb9, 0xd6,\n\t0xaa, 0xd1, 0x5a, 0xfb, 0xb7, 0x18, 0x36, 0xd7, 0x9a, 0x1e, 0xad, 0xb5, 0x7f, 0x8f, 0x66, 0xeb,\n\t0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x23, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed, 0x3f, 0x63,\n\t0xd8, 0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x2b, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed, 0xbf,\n\t0x63, 0xd8, 0x5c, 0x6b, 0x7a, 0xb4, 0xd6, 0xfe, 0x27, 0x86, 0xcd, 0xb5, 0xa6, 0x47, 0x6b, 0xed,\n\t0xc7, 0x31, 0x6c, 0xae, 0x35, 0x3d, 0x5a, 0x6b, 0x3f, 0x89, 0x61, 0x73, 0xad, 0xe9, 0xd1, 0x5a,\n\t0xfb, 0xdf, 0x18, 0x36, 0xd7, 0x9a, 0x1e, 0xad, 0xb5, 0xff, 0x8b, 0x61, 0x73, 0xad, 0xad, 0x47,\n\t0x6b, 0xed, 0xff, 0xa3, 0xd9, 0xeb, 0xab, 0x3f, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x00, 0xcd,\n\t0x32, 0x57, 0x39, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/testdata/test.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A feature-rich test file for the protocol compiler and libraries.\n\nsyntax = \"proto2\";\n\npackage testdata;\n\nenum FOO { FOO1 = 1; };\n\nmessage GoEnum {\n  required FOO foo = 1;\n}\n\nmessage GoTestField {\n  required string Label = 1;\n  required string Type = 2;\n}\n\nmessage GoTest {\n  // An enum, for completeness.\n  enum KIND {\n    VOID = 0;\n\n    // Basic types\n    BOOL = 1;\n    BYTES = 2;\n    FINGERPRINT = 3;\n    FLOAT = 4;\n    INT = 5;\n    STRING = 6;\n    TIME = 7;\n\n    // Groupings\n    TUPLE = 8;\n    ARRAY = 9;\n    MAP = 10;\n\n    // Table types\n    TABLE = 11;\n\n    // Functions\n    FUNCTION = 12;  // last tag\n  };\n\n  // Some typical parameters\n  required KIND Kind = 1;\n  optional string Table = 2;\n  optional int32 Param = 3;\n\n  // Required, repeated and optional foreign fields.\n  required GoTestField RequiredField = 4;\n  repeated GoTestField RepeatedField = 5;\n  optional GoTestField OptionalField = 6;\n\n  // Required fields of all basic types\n  required bool F_Bool_required = 10;\n  required int32 F_Int32_required = 11;\n  required int64 F_Int64_required = 12;\n  required fixed32 F_Fixed32_required = 13;\n  required fixed64 F_Fixed64_required = 14;\n  required uint32 F_Uint32_required = 15;\n  required uint64 F_Uint64_required = 16;\n  required float F_Float_required = 17;\n  required double F_Double_required = 18;\n  required string F_String_required = 19;\n  required bytes F_Bytes_required = 101;\n  required sint32 F_Sint32_required = 102;\n  required sint64 F_Sint64_required = 103;\n\n  // Repeated fields of all basic types\n  repeated bool F_Bool_repeated = 20;\n  repeated int32 F_Int32_repeated = 21;\n  repeated int64 F_Int64_repeated = 22;\n  repeated fixed32 F_Fixed32_repeated = 23;\n  repeated fixed64 F_Fixed64_repeated = 24;\n  repeated uint32 F_Uint32_repeated = 25;\n  repeated uint64 F_Uint64_repeated = 26;\n  repeated float F_Float_repeated = 27;\n  repeated double F_Double_repeated = 28;\n  repeated string F_String_repeated = 29;\n  repeated bytes F_Bytes_repeated = 201;\n  repeated sint32 F_Sint32_repeated = 202;\n  repeated sint64 F_Sint64_repeated = 203;\n\n  // Optional fields of all basic types\n  optional bool F_Bool_optional = 30;\n  optional int32 F_Int32_optional = 31;\n  optional int64 F_Int64_optional = 32;\n  optional fixed32 F_Fixed32_optional = 33;\n  optional fixed64 F_Fixed64_optional = 34;\n  optional uint32 F_Uint32_optional = 35;\n  optional uint64 F_Uint64_optional = 36;\n  optional float F_Float_optional = 37;\n  optional double F_Double_optional = 38;\n  optional string F_String_optional = 39;\n  optional bytes F_Bytes_optional = 301;\n  optional sint32 F_Sint32_optional = 302;\n  optional sint64 F_Sint64_optional = 303;\n\n  // Default-valued fields of all basic types\n  optional bool F_Bool_defaulted = 40 [default=true];\n  optional int32 F_Int32_defaulted = 41 [default=32];\n  optional int64 F_Int64_defaulted = 42 [default=64];\n  optional fixed32 F_Fixed32_defaulted = 43 [default=320];\n  optional fixed64 F_Fixed64_defaulted = 44 [default=640];\n  optional uint32 F_Uint32_defaulted = 45 [default=3200];\n  optional uint64 F_Uint64_defaulted = 46 [default=6400];\n  optional float F_Float_defaulted = 47 [default=314159.];\n  optional double F_Double_defaulted = 48 [default=271828.];\n  optional string F_String_defaulted = 49 [default=\"hello, \\\"world!\\\"\\n\"];\n  optional bytes F_Bytes_defaulted = 401 [default=\"Bignose\"];\n  optional sint32 F_Sint32_defaulted = 402 [default = -32];\n  optional sint64 F_Sint64_defaulted = 403 [default = -64];\n\n  // Packed repeated fields (no string or bytes).\n  repeated bool F_Bool_repeated_packed = 50 [packed=true];\n  repeated int32 F_Int32_repeated_packed = 51 [packed=true];\n  repeated int64 F_Int64_repeated_packed = 52 [packed=true];\n  repeated fixed32 F_Fixed32_repeated_packed = 53 [packed=true];\n  repeated fixed64 F_Fixed64_repeated_packed = 54 [packed=true];\n  repeated uint32 F_Uint32_repeated_packed = 55 [packed=true];\n  repeated uint64 F_Uint64_repeated_packed = 56 [packed=true];\n  repeated float F_Float_repeated_packed = 57 [packed=true];\n  repeated double F_Double_repeated_packed = 58 [packed=true];\n  repeated sint32 F_Sint32_repeated_packed = 502 [packed=true];\n  repeated sint64 F_Sint64_repeated_packed = 503 [packed=true];\n\n  // Required, repeated, and optional groups.\n  required group RequiredGroup = 70 {\n    required string RequiredField = 71;\n  };\n\n  repeated group RepeatedGroup = 80 {\n    required string RequiredField = 81;\n  };\n\n  optional group OptionalGroup = 90 {\n    required string RequiredField = 91;\n  };\n}\n\n// For testing a group containing a required field.\nmessage GoTestRequiredGroupField {\n  required group Group = 1 {\n    required int32 Field = 2;\n  };\n}\n\n// For testing skipping of unrecognized fields.\n// Numbers are all big, larger than tag numbers in GoTestField,\n// the message used in the corresponding test.\nmessage GoSkipTest {\n  required int32 skip_int32 = 11;\n  required fixed32 skip_fixed32 = 12;\n  required fixed64 skip_fixed64 = 13;\n  required string skip_string = 14;\n  required group SkipGroup = 15 {\n    required int32 group_int32 = 16;\n    required string group_string = 17;\n  }\n}\n\n// For testing packed/non-packed decoder switching.\n// A serialized instance of one should be deserializable as the other.\nmessage NonPackedTest {\n  repeated int32 a = 1;\n}\n\nmessage PackedTest {\n  repeated int32 b = 1 [packed=true];\n}\n\nmessage MaxTag {\n  // Maximum possible tag number.\n  optional string last_field = 536870911;\n}\n\nmessage OldMessage {\n  message Nested {\n    optional string name = 1;\n  }\n  optional Nested nested = 1;\n\n  optional int32 num = 2;\n}\n\n// NewMessage is wire compatible with OldMessage;\n// imagine it as a future version.\nmessage NewMessage {\n  message Nested {\n    optional string name = 1;\n    optional string food_group = 2;\n  }\n  optional Nested nested = 1;\n\n  // This is an int32 in OldMessage.\n  optional int64 num = 2;\n}\n\n// Smaller tests for ASCII formatting.\n\nmessage InnerMessage {\n  required string host = 1;\n  optional int32 port = 2 [default=4000];\n  optional bool connected = 3;\n}\n\nmessage OtherMessage {\n  optional int64 key = 1;\n  optional bytes value = 2;\n  optional float weight = 3;\n  optional InnerMessage inner = 4;\n\n  extensions 100 to max;\n}\n\nmessage RequiredInnerMessage {\n  required InnerMessage leo_finally_won_an_oscar = 1;\n}\n\nmessage MyMessage {\n  required int32 count = 1;\n  optional string name = 2;\n  optional string quote = 3;\n  repeated string pet = 4;\n  optional InnerMessage inner = 5;\n  repeated OtherMessage others = 6;\n  optional RequiredInnerMessage we_must_go_deeper = 13;\n  repeated InnerMessage rep_inner = 12;\n\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  };\n  optional Color bikeshed = 7;\n\n  optional group SomeGroup = 8 {\n    optional int32 group_field = 9;\n  }\n\n  // This field becomes [][]byte in the generated code.\n  repeated bytes rep_bytes = 10;\n\n  optional double bigfloat = 11;\n\n  extensions 100 to max;\n}\n\nmessage Ext {\n  extend MyMessage {\n    optional Ext more = 103;\n    optional string text = 104;\n    optional int32 number = 105;\n  }\n\n  optional string data = 1;\n}\n\nextend MyMessage {\n  repeated string greeting = 106;\n}\n\nmessage ComplexExtension {\n  optional int32 first = 1;\n  optional int32 second = 2;\n  repeated int32 third = 3;\n}\n\nextend OtherMessage {\n  optional ComplexExtension complex = 200;\n  repeated ComplexExtension r_complex = 201;\n}\n\nmessage DefaultsMessage {\n  enum DefaultsEnum {\n    ZERO = 0;\n    ONE = 1;\n    TWO = 2;\n  };\n  extensions 100 to max;\n}\n\nextend DefaultsMessage {\n  optional double no_default_double = 101;\n  optional float no_default_float = 102;\n  optional int32 no_default_int32 = 103;\n  optional int64 no_default_int64 = 104;\n  optional uint32 no_default_uint32 = 105;\n  optional uint64 no_default_uint64 = 106;\n  optional sint32 no_default_sint32 = 107;\n  optional sint64 no_default_sint64 = 108;\n  optional fixed32 no_default_fixed32 = 109;\n  optional fixed64 no_default_fixed64 = 110;\n  optional sfixed32 no_default_sfixed32 = 111;\n  optional sfixed64 no_default_sfixed64 = 112;\n  optional bool no_default_bool = 113;\n  optional string no_default_string = 114;\n  optional bytes no_default_bytes = 115;\n  optional DefaultsMessage.DefaultsEnum no_default_enum = 116;\n\n  optional double default_double = 201 [default = 3.1415];\n  optional float default_float = 202 [default = 3.14];\n  optional int32 default_int32 = 203 [default = 42];\n  optional int64 default_int64 = 204 [default = 43];\n  optional uint32 default_uint32 = 205 [default = 44];\n  optional uint64 default_uint64 = 206 [default = 45];\n  optional sint32 default_sint32 = 207 [default = 46];\n  optional sint64 default_sint64 = 208 [default = 47];\n  optional fixed32 default_fixed32 = 209 [default = 48];\n  optional fixed64 default_fixed64 = 210 [default = 49];\n  optional sfixed32 default_sfixed32 = 211 [default = 50];\n  optional sfixed64 default_sfixed64 = 212 [default = 51];\n  optional bool default_bool = 213 [default = true];\n  optional string default_string = 214 [default = \"Hello, string\"];\n  optional bytes default_bytes = 215 [default = \"Hello, bytes\"];\n  optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE];\n}\n\nmessage MyMessageSet {\n  option message_set_wire_format = true;\n  extensions 100 to max;\n}\n\nmessage Empty {\n}\n\nextend MyMessageSet {\n    optional Empty x201 = 201;\n    optional Empty x202 = 202;\n    optional Empty x203 = 203;\n    optional Empty x204 = 204;\n    optional Empty x205 = 205;\n    optional Empty x206 = 206;\n    optional Empty x207 = 207;\n    optional Empty x208 = 208;\n    optional Empty x209 = 209;\n    optional Empty x210 = 210;\n    optional Empty x211 = 211;\n    optional Empty x212 = 212;\n    optional Empty x213 = 213;\n    optional Empty x214 = 214;\n    optional Empty x215 = 215;\n    optional Empty x216 = 216;\n    optional Empty x217 = 217;\n    optional Empty x218 = 218;\n    optional Empty x219 = 219;\n    optional Empty x220 = 220;\n    optional Empty x221 = 221;\n    optional Empty x222 = 222;\n    optional Empty x223 = 223;\n    optional Empty x224 = 224;\n    optional Empty x225 = 225;\n    optional Empty x226 = 226;\n    optional Empty x227 = 227;\n    optional Empty x228 = 228;\n    optional Empty x229 = 229;\n    optional Empty x230 = 230;\n    optional Empty x231 = 231;\n    optional Empty x232 = 232;\n    optional Empty x233 = 233;\n    optional Empty x234 = 234;\n    optional Empty x235 = 235;\n    optional Empty x236 = 236;\n    optional Empty x237 = 237;\n    optional Empty x238 = 238;\n    optional Empty x239 = 239;\n    optional Empty x240 = 240;\n    optional Empty x241 = 241;\n    optional Empty x242 = 242;\n    optional Empty x243 = 243;\n    optional Empty x244 = 244;\n    optional Empty x245 = 245;\n    optional Empty x246 = 246;\n    optional Empty x247 = 247;\n    optional Empty x248 = 248;\n    optional Empty x249 = 249;\n    optional Empty x250 = 250;\n}\n\nmessage MessageList {\n  repeated group Message = 1 {\n    required string name = 2;\n    required int32 count = 3;\n  }\n}\n\nmessage Strings {\n  optional string string_field = 1;\n  optional bytes bytes_field = 2;\n}\n\nmessage Defaults {\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  }\n\n  // Default-valued fields of all basic types.\n  // Same as GoTest, but copied here to make testing easier.\n  optional bool F_Bool = 1 [default=true];\n  optional int32 F_Int32 = 2 [default=32];\n  optional int64 F_Int64 = 3 [default=64];\n  optional fixed32 F_Fixed32 = 4 [default=320];\n  optional fixed64 F_Fixed64 = 5 [default=640];\n  optional uint32 F_Uint32 = 6 [default=3200];\n  optional uint64 F_Uint64 = 7 [default=6400];\n  optional float F_Float = 8 [default=314159.];\n  optional double F_Double = 9 [default=271828.];\n  optional string F_String = 10 [default=\"hello, \\\"world!\\\"\\n\"];\n  optional bytes F_Bytes = 11 [default=\"Bignose\"];\n  optional sint32 F_Sint32 = 12 [default=-32];\n  optional sint64 F_Sint64 = 13 [default=-64];\n  optional Color F_Enum = 14 [default=GREEN];\n\n  // More fields with crazy defaults.\n  optional float F_Pinf = 15 [default=inf];\n  optional float F_Ninf = 16 [default=-inf];\n  optional float F_Nan = 17 [default=nan];\n\n  // Sub-message.\n  optional SubDefaults sub = 18;\n\n  // Redundant but explicit defaults.\n  optional string str_zero = 19 [default=\"\"];\n}\n\nmessage SubDefaults {\n  optional int64 n = 1 [default=7];\n}\n\nmessage RepeatedEnum {\n  enum Color {\n    RED = 1;\n  }\n  repeated Color color = 1;\n}\n\nmessage MoreRepeated {\n  repeated bool bools = 1;\n  repeated bool bools_packed = 2 [packed=true];\n  repeated int32 ints = 3;\n  repeated int32 ints_packed = 4 [packed=true];\n  repeated int64 int64s_packed = 7 [packed=true];\n  repeated string strings = 5;\n  repeated fixed32 fixeds = 6;\n}\n\n// GroupOld and GroupNew have the same wire format.\n// GroupNew has a new field inside a group.\n\nmessage GroupOld {\n  optional group G = 101 {\n    optional int32 x = 2;\n  }\n}\n\nmessage GroupNew {\n  optional group G = 101 {\n    optional int32 x = 2;\n    optional int32 y = 3;\n  }\n}\n\nmessage FloatingPoint {\n  required double f = 1;\n  optional bool exact = 2;\n}\n\nmessage MessageWithMap {\n  map<int32, string> name_mapping = 1;\n  map<sint64, FloatingPoint> msg_mapping = 2;\n  map<bool, bytes> byte_mapping = 3;\n  map<string, string> str_to_str = 4;\n}\n\nmessage Oneof {\n  oneof union {\n    bool F_Bool = 1;\n    int32 F_Int32 = 2;\n    int64 F_Int64 = 3;\n    fixed32 F_Fixed32 = 4;\n    fixed64 F_Fixed64 = 5;\n    uint32 F_Uint32 = 6;\n    uint64 F_Uint64 = 7;\n    float F_Float = 8;\n    double F_Double = 9;\n    string F_String = 10;\n    bytes F_Bytes = 11;\n    sint32 F_Sint32 = 12;\n    sint64 F_Sint64 = 13;\n    MyMessage.Color F_Enum = 14;\n    GoTestField F_Message = 15;\n    group F_Group = 16 {\n      optional int32 x = 17;\n    }\n    int32 F_Largest_Tag = 536870911;\n  }\n\n  oneof tormato {\n    int32 value = 100;\n  }\n}\n\nmessage Communique {\n  optional bool make_me_cry = 1;\n\n  // This is a oneof, called \"union\".\n  oneof union {\n    int32 number = 5;\n    string name = 6;\n    bytes data = 7;\n    double temp_c = 8;\n    MyMessage.Color col = 9;\n    Strings msg = 10;\n  }\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/text.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n// Functions for writing the text protocol buffer format.\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"math\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n)\n\nvar (\n\tnewline         = []byte(\"\\n\")\n\tspaces          = []byte(\"                                        \")\n\tgtNewline       = []byte(\">\\n\")\n\tendBraceNewline = []byte(\"}\\n\")\n\tbackslashN      = []byte{'\\\\', 'n'}\n\tbackslashR      = []byte{'\\\\', 'r'}\n\tbackslashT      = []byte{'\\\\', 't'}\n\tbackslashDQ     = []byte{'\\\\', '\"'}\n\tbackslashBS     = []byte{'\\\\', '\\\\'}\n\tposInf          = []byte(\"inf\")\n\tnegInf          = []byte(\"-inf\")\n\tnan             = []byte(\"nan\")\n)\n\ntype writer interface {\n\tio.Writer\n\tWriteByte(byte) error\n}\n\n// textWriter is an io.Writer that tracks its indentation level.\ntype textWriter struct {\n\tind      int\n\tcomplete bool // if the current position is a complete line\n\tcompact  bool // whether to write out as a one-liner\n\tw        writer\n}\n\nfunc (w *textWriter) WriteString(s string) (n int, err error) {\n\tif !strings.Contains(s, \"\\n\") {\n\t\tif !w.compact && w.complete {\n\t\t\tw.writeIndent()\n\t\t}\n\t\tw.complete = false\n\t\treturn io.WriteString(w.w, s)\n\t}\n\t// WriteString is typically called without newlines, so this\n\t// codepath and its copy are rare.  We copy to avoid\n\t// duplicating all of Write's logic here.\n\treturn w.Write([]byte(s))\n}\n\nfunc (w *textWriter) Write(p []byte) (n int, err error) {\n\tnewlines := bytes.Count(p, newline)\n\tif newlines == 0 {\n\t\tif !w.compact && w.complete {\n\t\t\tw.writeIndent()\n\t\t}\n\t\tn, err = w.w.Write(p)\n\t\tw.complete = false\n\t\treturn n, err\n\t}\n\n\tfrags := bytes.SplitN(p, newline, newlines+1)\n\tif w.compact {\n\t\tfor i, frag := range frags {\n\t\t\tif i > 0 {\n\t\t\t\tif err := w.w.WriteByte(' '); err != nil {\n\t\t\t\t\treturn n, err\n\t\t\t\t}\n\t\t\t\tn++\n\t\t\t}\n\t\t\tnn, err := w.w.Write(frag)\n\t\t\tn += nn\n\t\t\tif err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t}\n\t\treturn n, nil\n\t}\n\n\tfor i, frag := range frags {\n\t\tif w.complete {\n\t\t\tw.writeIndent()\n\t\t}\n\t\tnn, err := w.w.Write(frag)\n\t\tn += nn\n\t\tif err != nil {\n\t\t\treturn n, err\n\t\t}\n\t\tif i+1 < len(frags) {\n\t\t\tif err := w.w.WriteByte('\\n'); err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t\tn++\n\t\t}\n\t}\n\tw.complete = len(frags[len(frags)-1]) == 0\n\treturn n, nil\n}\n\nfunc (w *textWriter) WriteByte(c byte) error {\n\tif w.compact && c == '\\n' {\n\t\tc = ' '\n\t}\n\tif !w.compact && w.complete {\n\t\tw.writeIndent()\n\t}\n\terr := w.w.WriteByte(c)\n\tw.complete = c == '\\n'\n\treturn err\n}\n\nfunc (w *textWriter) indent() { w.ind++ }\n\nfunc (w *textWriter) unindent() {\n\tif w.ind == 0 {\n\t\tlog.Print(\"proto: textWriter unindented too far\")\n\t\treturn\n\t}\n\tw.ind--\n}\n\nfunc writeName(w *textWriter, props *Properties) error {\n\tif _, err := w.WriteString(props.OrigName); err != nil {\n\t\treturn err\n\t}\n\tif props.Wire != \"group\" {\n\t\treturn w.WriteByte(':')\n\t}\n\treturn nil\n}\n\n// raw is the interface satisfied by RawMessage.\ntype raw interface {\n\tBytes() []byte\n}\n\nfunc requiresQuotes(u string) bool {\n\t// When type URL contains any characters except [0-9A-Za-z./\\-]*, it must be quoted.\n\tfor _, ch := range u {\n\t\tswitch {\n\t\tcase ch == '.' || ch == '/' || ch == '_':\n\t\t\tcontinue\n\t\tcase '0' <= ch && ch <= '9':\n\t\t\tcontinue\n\t\tcase 'A' <= ch && ch <= 'Z':\n\t\t\tcontinue\n\t\tcase 'a' <= ch && ch <= 'z':\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// isAny reports whether sv is a google.protobuf.Any message\nfunc isAny(sv reflect.Value) bool {\n\ttype wkt interface {\n\t\tXXX_WellKnownType() string\n\t}\n\tt, ok := sv.Addr().Interface().(wkt)\n\treturn ok && t.XXX_WellKnownType() == \"Any\"\n}\n\n// writeProto3Any writes an expanded google.protobuf.Any message.\n//\n// It returns (false, nil) if sv value can't be unmarshaled (e.g. because\n// required messages are not linked in).\n//\n// It returns (true, error) when sv was written in expanded format or an error\n// was encountered.\nfunc (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) {\n\tturl := sv.FieldByName(\"TypeUrl\")\n\tval := sv.FieldByName(\"Value\")\n\tif !turl.IsValid() || !val.IsValid() {\n\t\treturn true, errors.New(\"proto: invalid google.protobuf.Any message\")\n\t}\n\n\tb, ok := val.Interface().([]byte)\n\tif !ok {\n\t\treturn true, errors.New(\"proto: invalid google.protobuf.Any message\")\n\t}\n\n\tparts := strings.Split(turl.String(), \"/\")\n\tmt := MessageType(parts[len(parts)-1])\n\tif mt == nil {\n\t\treturn false, nil\n\t}\n\tm := reflect.New(mt.Elem())\n\tif err := Unmarshal(b, m.Interface().(Message)); err != nil {\n\t\treturn false, nil\n\t}\n\tw.Write([]byte(\"[\"))\n\tu := turl.String()\n\tif requiresQuotes(u) {\n\t\twriteString(w, u)\n\t} else {\n\t\tw.Write([]byte(u))\n\t}\n\tif w.compact {\n\t\tw.Write([]byte(\"]:<\"))\n\t} else {\n\t\tw.Write([]byte(\"]: <\\n\"))\n\t\tw.ind++\n\t}\n\tif err := tm.writeStruct(w, m.Elem()); err != nil {\n\t\treturn true, err\n\t}\n\tif w.compact {\n\t\tw.Write([]byte(\"> \"))\n\t} else {\n\t\tw.ind--\n\t\tw.Write([]byte(\">\\n\"))\n\t}\n\treturn true, nil\n}\n\nfunc (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {\n\tif tm.ExpandAny && isAny(sv) {\n\t\tif canExpand, err := tm.writeProto3Any(w, sv); canExpand {\n\t\t\treturn err\n\t\t}\n\t}\n\tst := sv.Type()\n\tsprops := GetProperties(st)\n\tfor i := 0; i < sv.NumField(); i++ {\n\t\tfv := sv.Field(i)\n\t\tprops := sprops.Prop[i]\n\t\tname := st.Field(i).Name\n\n\t\tif strings.HasPrefix(name, \"XXX_\") {\n\t\t\t// There are two XXX_ fields:\n\t\t\t//   XXX_unrecognized []byte\n\t\t\t//   XXX_extensions   map[int32]proto.Extension\n\t\t\t// The first is handled here;\n\t\t\t// the second is handled at the bottom of this function.\n\t\t\tif name == \"XXX_unrecognized\" && !fv.IsNil() {\n\t\t\t\tif err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif fv.Kind() == reflect.Ptr && fv.IsNil() {\n\t\t\t// Field not filled in. This could be an optional field or\n\t\t\t// a required field that wasn't filled in. Either way, there\n\t\t\t// isn't anything we can show for it.\n\t\t\tcontinue\n\t\t}\n\t\tif fv.Kind() == reflect.Slice && fv.IsNil() {\n\t\t\t// Repeated field that is empty, or a bytes field that is unused.\n\t\t\tcontinue\n\t\t}\n\n\t\tif props.Repeated && fv.Kind() == reflect.Slice {\n\t\t\t// Repeated field.\n\t\t\tfor j := 0; j < fv.Len(); j++ {\n\t\t\t\tif err := writeName(w, props); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !w.compact {\n\t\t\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tv := fv.Index(j)\n\t\t\t\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\t\t\t\t// A nil message in a repeated field is not valid,\n\t\t\t\t\t// but we can handle that more gracefully than panicking.\n\t\t\t\t\tif _, err := w.Write([]byte(\"<nil>\\n\")); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err := tm.writeAny(w, v, props); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif fv.Kind() == reflect.Map {\n\t\t\t// Map fields are rendered as a repeated struct with key/value fields.\n\t\t\tkeys := fv.MapKeys()\n\t\t\tsort.Sort(mapKeys(keys))\n\t\t\tfor _, key := range keys {\n\t\t\t\tval := fv.MapIndex(key)\n\t\t\t\tif err := writeName(w, props); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !w.compact {\n\t\t\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// open struct\n\t\t\t\tif err := w.WriteByte('<'); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !w.compact {\n\t\t\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tw.indent()\n\t\t\t\t// key\n\t\t\t\tif _, err := w.WriteString(\"key:\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif !w.compact {\n\t\t\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err := tm.writeAny(w, key, props.mkeyprop); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// nil values aren't legal, but we can avoid panicking because of them.\n\t\t\t\tif val.Kind() != reflect.Ptr || !val.IsNil() {\n\t\t\t\t\t// value\n\t\t\t\t\tif _, err := w.WriteString(\"value:\"); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif !w.compact {\n\t\t\t\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif err := tm.writeAny(w, val, props.mvalprop); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// close struct\n\t\t\t\tw.unindent()\n\t\t\t\tif err := w.WriteByte('>'); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {\n\t\t\t// empty bytes field\n\t\t\tcontinue\n\t\t}\n\t\tif fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {\n\t\t\t// proto3 non-repeated scalar field; skip if zero value\n\t\t\tif isProto3Zero(fv) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif fv.Kind() == reflect.Interface {\n\t\t\t// Check if it is a oneof.\n\t\t\tif st.Field(i).Tag.Get(\"protobuf_oneof\") != \"\" {\n\t\t\t\t// fv is nil, or holds a pointer to generated struct.\n\t\t\t\t// That generated struct has exactly one field,\n\t\t\t\t// which has a protobuf struct tag.\n\t\t\t\tif fv.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tinner := fv.Elem().Elem() // interface -> *T -> T\n\t\t\t\ttag := inner.Type().Field(0).Tag.Get(\"protobuf\")\n\t\t\t\tprops = new(Properties) // Overwrite the outer props var, but not its pointee.\n\t\t\t\tprops.Parse(tag)\n\t\t\t\t// Write the value in the oneof, not the oneof itself.\n\t\t\t\tfv = inner.Field(0)\n\n\t\t\t\t// Special case to cope with malformed messages gracefully:\n\t\t\t\t// If the value in the oneof is a nil pointer, don't panic\n\t\t\t\t// in writeAny.\n\t\t\t\tif fv.Kind() == reflect.Ptr && fv.IsNil() {\n\t\t\t\t\t// Use errors.New so writeAny won't render quotes.\n\t\t\t\t\tmsg := errors.New(\"/* nil */\")\n\t\t\t\t\tfv = reflect.ValueOf(&msg).Elem()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := writeName(w, props); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !w.compact {\n\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif b, ok := fv.Interface().(raw); ok {\n\t\t\tif err := writeRaw(w, b.Bytes()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Enums have a String method, so writeAny will work fine.\n\t\tif err := tm.writeAny(w, fv, props); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Extensions (the XXX_extensions field).\n\tpv := sv.Addr()\n\tif _, ok := extendable(pv.Interface()); ok {\n\t\tif err := tm.writeExtensions(w, pv); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// writeRaw writes an uninterpreted raw message.\nfunc writeRaw(w *textWriter, b []byte) error {\n\tif err := w.WriteByte('<'); err != nil {\n\t\treturn err\n\t}\n\tif !w.compact {\n\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tw.indent()\n\tif err := writeUnknownStruct(w, b); err != nil {\n\t\treturn err\n\t}\n\tw.unindent()\n\tif err := w.WriteByte('>'); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// writeAny writes an arbitrary field.\nfunc (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {\n\tv = reflect.Indirect(v)\n\n\t// Floats have special cases.\n\tif v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {\n\t\tx := v.Float()\n\t\tvar b []byte\n\t\tswitch {\n\t\tcase math.IsInf(x, 1):\n\t\t\tb = posInf\n\t\tcase math.IsInf(x, -1):\n\t\t\tb = negInf\n\t\tcase math.IsNaN(x):\n\t\t\tb = nan\n\t\t}\n\t\tif b != nil {\n\t\t\t_, err := w.Write(b)\n\t\t\treturn err\n\t\t}\n\t\t// Other values are handled below.\n\t}\n\n\t// We don't attempt to serialise every possible value type; only those\n\t// that can occur in protocol buffers.\n\tswitch v.Kind() {\n\tcase reflect.Slice:\n\t\t// Should only be a []byte; repeated fields are handled in writeStruct.\n\t\tif err := writeString(w, string(v.Bytes())); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase reflect.String:\n\t\tif err := writeString(w, v.String()); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase reflect.Struct:\n\t\t// Required/optional group/message.\n\t\tvar bra, ket byte = '<', '>'\n\t\tif props != nil && props.Wire == \"group\" {\n\t\t\tbra, ket = '{', '}'\n\t\t}\n\t\tif err := w.WriteByte(bra); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !w.compact {\n\t\t\tif err := w.WriteByte('\\n'); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tw.indent()\n\t\tif etm, ok := v.Interface().(encoding.TextMarshaler); ok {\n\t\t\ttext, err := etm.MarshalText()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif _, err = w.Write(text); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if err := tm.writeStruct(w, v); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tw.unindent()\n\t\tif err := w.WriteByte(ket); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\t_, err := fmt.Fprint(w, v.Interface())\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// equivalent to C's isprint.\nfunc isprint(c byte) bool {\n\treturn c >= 0x20 && c < 0x7f\n}\n\n// writeString writes a string in the protocol buffer text format.\n// It is similar to strconv.Quote except we don't use Go escape sequences,\n// we treat the string as a byte sequence, and we use octal escapes.\n// These differences are to maintain interoperability with the other\n// languages' implementations of the text format.\nfunc writeString(w *textWriter, s string) error {\n\t// use WriteByte here to get any needed indent\n\tif err := w.WriteByte('\"'); err != nil {\n\t\treturn err\n\t}\n\t// Loop over the bytes, not the runes.\n\tfor i := 0; i < len(s); i++ {\n\t\tvar err error\n\t\t// Divergence from C++: we don't escape apostrophes.\n\t\t// There's no need to escape them, and the C++ parser\n\t\t// copes with a naked apostrophe.\n\t\tswitch c := s[i]; c {\n\t\tcase '\\n':\n\t\t\t_, err = w.w.Write(backslashN)\n\t\tcase '\\r':\n\t\t\t_, err = w.w.Write(backslashR)\n\t\tcase '\\t':\n\t\t\t_, err = w.w.Write(backslashT)\n\t\tcase '\"':\n\t\t\t_, err = w.w.Write(backslashDQ)\n\t\tcase '\\\\':\n\t\t\t_, err = w.w.Write(backslashBS)\n\t\tdefault:\n\t\t\tif isprint(c) {\n\t\t\t\terr = w.w.WriteByte(c)\n\t\t\t} else {\n\t\t\t\t_, err = fmt.Fprintf(w.w, \"\\\\%03o\", c)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn w.WriteByte('\"')\n}\n\nfunc writeUnknownStruct(w *textWriter, data []byte) (err error) {\n\tif !w.compact {\n\t\tif _, err := fmt.Fprintf(w, \"/* %d unknown bytes */\\n\", len(data)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tb := NewBuffer(data)\n\tfor b.index < len(b.buf) {\n\t\tx, err := b.DecodeVarint()\n\t\tif err != nil {\n\t\t\t_, err := fmt.Fprintf(w, \"/* %v */\\n\", err)\n\t\t\treturn err\n\t\t}\n\t\twire, tag := x&7, x>>3\n\t\tif wire == WireEndGroup {\n\t\t\tw.unindent()\n\t\t\tif _, err := w.Write(endBraceNewline); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := fmt.Fprint(w, tag); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif wire != WireStartGroup {\n\t\t\tif err := w.WriteByte(':'); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif !w.compact || wire == WireStartGroup {\n\t\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tswitch wire {\n\t\tcase WireBytes:\n\t\t\tbuf, e := b.DecodeRawBytes(false)\n\t\t\tif e == nil {\n\t\t\t\t_, err = fmt.Fprintf(w, \"%q\", buf)\n\t\t\t} else {\n\t\t\t\t_, err = fmt.Fprintf(w, \"/* %v */\", e)\n\t\t\t}\n\t\tcase WireFixed32:\n\t\t\tx, err = b.DecodeFixed32()\n\t\t\terr = writeUnknownInt(w, x, err)\n\t\tcase WireFixed64:\n\t\t\tx, err = b.DecodeFixed64()\n\t\t\terr = writeUnknownInt(w, x, err)\n\t\tcase WireStartGroup:\n\t\t\terr = w.WriteByte('{')\n\t\t\tw.indent()\n\t\tcase WireVarint:\n\t\t\tx, err = b.DecodeVarint()\n\t\t\terr = writeUnknownInt(w, x, err)\n\t\tdefault:\n\t\t\t_, err = fmt.Fprintf(w, \"/* unknown wire type %d */\", wire)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = w.WriteByte('\\n'); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc writeUnknownInt(w *textWriter, x uint64, err error) error {\n\tif err == nil {\n\t\t_, err = fmt.Fprint(w, x)\n\t} else {\n\t\t_, err = fmt.Fprintf(w, \"/* %v */\", err)\n\t}\n\treturn err\n}\n\ntype int32Slice []int32\n\nfunc (s int32Slice) Len() int           { return len(s) }\nfunc (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }\nfunc (s int32Slice) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }\n\n// writeExtensions writes all the extensions in pv.\n// pv is assumed to be a pointer to a protocol message struct that is extendable.\nfunc (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error {\n\temap := extensionMaps[pv.Type().Elem()]\n\tep, _ := extendable(pv.Interface())\n\n\t// Order the extensions by ID.\n\t// This isn't strictly necessary, but it will give us\n\t// canonical output, which will also make testing easier.\n\tm, mu := ep.extensionsRead()\n\tif m == nil {\n\t\treturn nil\n\t}\n\tmu.Lock()\n\tids := make([]int32, 0, len(m))\n\tfor id := range m {\n\t\tids = append(ids, id)\n\t}\n\tsort.Sort(int32Slice(ids))\n\tmu.Unlock()\n\n\tfor _, extNum := range ids {\n\t\text := m[extNum]\n\t\tvar desc *ExtensionDesc\n\t\tif emap != nil {\n\t\t\tdesc = emap[extNum]\n\t\t}\n\t\tif desc == nil {\n\t\t\t// Unknown extension.\n\t\t\tif err := writeUnknownStruct(w, ext.enc); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tpb, err := GetExtension(ep, desc)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed getting extension: %v\", err)\n\t\t}\n\n\t\t// Repeated extensions will appear as a slice.\n\t\tif !desc.repeated() {\n\t\t\tif err := tm.writeExtension(w, desc.Name, pb); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tv := reflect.ValueOf(pb)\n\t\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\t\tif err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error {\n\tif _, err := fmt.Fprintf(w, \"[%s]:\", name); err != nil {\n\t\treturn err\n\t}\n\tif !w.compact {\n\t\tif err := w.WriteByte(' '); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil {\n\t\treturn err\n\t}\n\tif err := w.WriteByte('\\n'); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (w *textWriter) writeIndent() {\n\tif !w.complete {\n\t\treturn\n\t}\n\tremain := w.ind * 2\n\tfor remain > 0 {\n\t\tn := remain\n\t\tif n > len(spaces) {\n\t\t\tn = len(spaces)\n\t\t}\n\t\tw.w.Write(spaces[:n])\n\t\tremain -= n\n\t}\n\tw.complete = false\n}\n\n// TextMarshaler is a configurable text format marshaler.\ntype TextMarshaler struct {\n\tCompact   bool // use compact text format (one line).\n\tExpandAny bool // expand google.protobuf.Any messages of known types\n}\n\n// Marshal writes a given protocol buffer in text format.\n// The only errors returned are from w.\nfunc (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {\n\tval := reflect.ValueOf(pb)\n\tif pb == nil || val.IsNil() {\n\t\tw.Write([]byte(\"<nil>\"))\n\t\treturn nil\n\t}\n\tvar bw *bufio.Writer\n\tww, ok := w.(writer)\n\tif !ok {\n\t\tbw = bufio.NewWriter(w)\n\t\tww = bw\n\t}\n\taw := &textWriter{\n\t\tw:        ww,\n\t\tcomplete: true,\n\t\tcompact:  tm.Compact,\n\t}\n\n\tif etm, ok := pb.(encoding.TextMarshaler); ok {\n\t\ttext, err := etm.MarshalText()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err = aw.Write(text); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif bw != nil {\n\t\t\treturn bw.Flush()\n\t\t}\n\t\treturn nil\n\t}\n\t// Dereference the received pointer so we don't have outer < and >.\n\tv := reflect.Indirect(val)\n\tif err := tm.writeStruct(aw, v); err != nil {\n\t\treturn err\n\t}\n\tif bw != nil {\n\t\treturn bw.Flush()\n\t}\n\treturn nil\n}\n\n// Text is the same as Marshal, but returns the string directly.\nfunc (tm *TextMarshaler) Text(pb Message) string {\n\tvar buf bytes.Buffer\n\ttm.Marshal(&buf, pb)\n\treturn buf.String()\n}\n\nvar (\n\tdefaultTextMarshaler = TextMarshaler{}\n\tcompactTextMarshaler = TextMarshaler{Compact: true}\n)\n\n// TODO: consider removing some of the Marshal functions below.\n\n// MarshalText writes a given protocol buffer in text format.\n// The only errors returned are from w.\nfunc MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }\n\n// MarshalTextString is the same as MarshalText, but returns the string directly.\nfunc MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }\n\n// CompactText writes a given protocol buffer in compact text format (one line).\nfunc CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }\n\n// CompactTextString is the same as CompactText, but returns the string directly.\nfunc CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/text_parser.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto\n\n// Functions for parsing the Text protocol buffer format.\n// TODO: message sets.\n\nimport (\n\t\"encoding\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode/utf8\"\n)\n\n// Error string emitted when deserializing Any and fields are already set\nconst anyRepeatedlyUnpacked = \"Any message unpacked multiple times, or %q already set\"\n\ntype ParseError struct {\n\tMessage string\n\tLine    int // 1-based line number\n\tOffset  int // 0-based byte offset from start of input\n}\n\nfunc (p *ParseError) Error() string {\n\tif p.Line == 1 {\n\t\t// show offset only for first line\n\t\treturn fmt.Sprintf(\"line 1.%d: %v\", p.Offset, p.Message)\n\t}\n\treturn fmt.Sprintf(\"line %d: %v\", p.Line, p.Message)\n}\n\ntype token struct {\n\tvalue    string\n\terr      *ParseError\n\tline     int    // line number\n\toffset   int    // byte number from start of input, not start of line\n\tunquoted string // the unquoted version of value, if it was a quoted string\n}\n\nfunc (t *token) String() string {\n\tif t.err == nil {\n\t\treturn fmt.Sprintf(\"%q (line=%d, offset=%d)\", t.value, t.line, t.offset)\n\t}\n\treturn fmt.Sprintf(\"parse error: %v\", t.err)\n}\n\ntype textParser struct {\n\ts            string // remaining input\n\tdone         bool   // whether the parsing is finished (success or error)\n\tbacked       bool   // whether back() was called\n\toffset, line int\n\tcur          token\n}\n\nfunc newTextParser(s string) *textParser {\n\tp := new(textParser)\n\tp.s = s\n\tp.line = 1\n\tp.cur.line = 1\n\treturn p\n}\n\nfunc (p *textParser) errorf(format string, a ...interface{}) *ParseError {\n\tpe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}\n\tp.cur.err = pe\n\tp.done = true\n\treturn pe\n}\n\n// Numbers and identifiers are matched by [-+._A-Za-z0-9]\nfunc isIdentOrNumberChar(c byte) bool {\n\tswitch {\n\tcase 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':\n\t\treturn true\n\tcase '0' <= c && c <= '9':\n\t\treturn true\n\t}\n\tswitch c {\n\tcase '-', '+', '.', '_':\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc isWhitespace(c byte) bool {\n\tswitch c {\n\tcase ' ', '\\t', '\\n', '\\r':\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc isQuote(c byte) bool {\n\tswitch c {\n\tcase '\"', '\\'':\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (p *textParser) skipWhitespace() {\n\ti := 0\n\tfor i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {\n\t\tif p.s[i] == '#' {\n\t\t\t// comment; skip to end of line or input\n\t\t\tfor i < len(p.s) && p.s[i] != '\\n' {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tif i == len(p.s) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif p.s[i] == '\\n' {\n\t\t\tp.line++\n\t\t}\n\t\ti++\n\t}\n\tp.offset += i\n\tp.s = p.s[i:len(p.s)]\n\tif len(p.s) == 0 {\n\t\tp.done = true\n\t}\n}\n\nfunc (p *textParser) advance() {\n\t// Skip whitespace\n\tp.skipWhitespace()\n\tif p.done {\n\t\treturn\n\t}\n\n\t// Start of non-whitespace\n\tp.cur.err = nil\n\tp.cur.offset, p.cur.line = p.offset, p.line\n\tp.cur.unquoted = \"\"\n\tswitch p.s[0] {\n\tcase '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':\n\t\t// Single symbol\n\t\tp.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]\n\tcase '\"', '\\'':\n\t\t// Quoted string\n\t\ti := 1\n\t\tfor i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\\n' {\n\t\t\tif p.s[i] == '\\\\' && i+1 < len(p.s) {\n\t\t\t\t// skip escaped char\n\t\t\t\ti++\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tif i >= len(p.s) || p.s[i] != p.s[0] {\n\t\t\tp.errorf(\"unmatched quote\")\n\t\t\treturn\n\t\t}\n\t\tunq, err := unquoteC(p.s[1:i], rune(p.s[0]))\n\t\tif err != nil {\n\t\t\tp.errorf(\"invalid quoted string %s: %v\", p.s[0:i+1], err)\n\t\t\treturn\n\t\t}\n\t\tp.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]\n\t\tp.cur.unquoted = unq\n\tdefault:\n\t\ti := 0\n\t\tfor i < len(p.s) && isIdentOrNumberChar(p.s[i]) {\n\t\t\ti++\n\t\t}\n\t\tif i == 0 {\n\t\t\tp.errorf(\"unexpected byte %#x\", p.s[0])\n\t\t\treturn\n\t\t}\n\t\tp.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]\n\t}\n\tp.offset += len(p.cur.value)\n}\n\nvar (\n\terrBadUTF8 = errors.New(\"proto: bad UTF-8\")\n\terrBadHex  = errors.New(\"proto: bad hexadecimal\")\n)\n\nfunc unquoteC(s string, quote rune) (string, error) {\n\t// This is based on C++'s tokenizer.cc.\n\t// Despite its name, this is *not* parsing C syntax.\n\t// For instance, \"\\0\" is an invalid quoted string.\n\n\t// Avoid allocation in trivial cases.\n\tsimple := true\n\tfor _, r := range s {\n\t\tif r == '\\\\' || r == quote {\n\t\t\tsimple = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif simple {\n\t\treturn s, nil\n\t}\n\n\tbuf := make([]byte, 0, 3*len(s)/2)\n\tfor len(s) > 0 {\n\t\tr, n := utf8.DecodeRuneInString(s)\n\t\tif r == utf8.RuneError && n == 1 {\n\t\t\treturn \"\", errBadUTF8\n\t\t}\n\t\ts = s[n:]\n\t\tif r != '\\\\' {\n\t\t\tif r < utf8.RuneSelf {\n\t\t\t\tbuf = append(buf, byte(r))\n\t\t\t} else {\n\t\t\t\tbuf = append(buf, string(r)...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tch, tail, err := unescape(s)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tbuf = append(buf, ch...)\n\t\ts = tail\n\t}\n\treturn string(buf), nil\n}\n\nfunc unescape(s string) (ch string, tail string, err error) {\n\tr, n := utf8.DecodeRuneInString(s)\n\tif r == utf8.RuneError && n == 1 {\n\t\treturn \"\", \"\", errBadUTF8\n\t}\n\ts = s[n:]\n\tswitch r {\n\tcase 'a':\n\t\treturn \"\\a\", s, nil\n\tcase 'b':\n\t\treturn \"\\b\", s, nil\n\tcase 'f':\n\t\treturn \"\\f\", s, nil\n\tcase 'n':\n\t\treturn \"\\n\", s, nil\n\tcase 'r':\n\t\treturn \"\\r\", s, nil\n\tcase 't':\n\t\treturn \"\\t\", s, nil\n\tcase 'v':\n\t\treturn \"\\v\", s, nil\n\tcase '?':\n\t\treturn \"?\", s, nil // trigraph workaround\n\tcase '\\'', '\"', '\\\\':\n\t\treturn string(r), s, nil\n\tcase '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X':\n\t\tif len(s) < 2 {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c requires 2 following digits`, r)\n\t\t}\n\t\tbase := 8\n\t\tss := s[:2]\n\t\ts = s[2:]\n\t\tif r == 'x' || r == 'X' {\n\t\t\tbase = 16\n\t\t} else {\n\t\t\tss = string(r) + ss\n\t\t}\n\t\ti, err := strconv.ParseUint(ss, base, 8)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t\treturn string([]byte{byte(i)}), s, nil\n\tcase 'u', 'U':\n\t\tn := 4\n\t\tif r == 'U' {\n\t\t\tn = 8\n\t\t}\n\t\tif len(s) < n {\n\t\t\treturn \"\", \"\", fmt.Errorf(`\\%c requires %d digits`, r, n)\n\t\t}\n\n\t\tbs := make([]byte, n/2)\n\t\tfor i := 0; i < n; i += 2 {\n\t\t\ta, ok1 := unhex(s[i])\n\t\t\tb, ok2 := unhex(s[i+1])\n\t\t\tif !ok1 || !ok2 {\n\t\t\t\treturn \"\", \"\", errBadHex\n\t\t\t}\n\t\t\tbs[i/2] = a<<4 | b\n\t\t}\n\t\ts = s[n:]\n\t\treturn string(bs), s, nil\n\t}\n\treturn \"\", \"\", fmt.Errorf(`unknown escape \\%c`, r)\n}\n\n// Adapted from src/pkg/strconv/quote.go.\nfunc unhex(b byte) (v byte, ok bool) {\n\tswitch {\n\tcase '0' <= b && b <= '9':\n\t\treturn b - '0', true\n\tcase 'a' <= b && b <= 'f':\n\t\treturn b - 'a' + 10, true\n\tcase 'A' <= b && b <= 'F':\n\t\treturn b - 'A' + 10, true\n\t}\n\treturn 0, false\n}\n\n// Back off the parser by one token. Can only be done between calls to next().\n// It makes the next advance() a no-op.\nfunc (p *textParser) back() { p.backed = true }\n\n// Advances the parser and returns the new current token.\nfunc (p *textParser) next() *token {\n\tif p.backed || p.done {\n\t\tp.backed = false\n\t\treturn &p.cur\n\t}\n\tp.advance()\n\tif p.done {\n\t\tp.cur.value = \"\"\n\t} else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {\n\t\t// Look for multiple quoted strings separated by whitespace,\n\t\t// and concatenate them.\n\t\tcat := p.cur\n\t\tfor {\n\t\t\tp.skipWhitespace()\n\t\t\tif p.done || !isQuote(p.s[0]) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp.advance()\n\t\t\tif p.cur.err != nil {\n\t\t\t\treturn &p.cur\n\t\t\t}\n\t\t\tcat.value += \" \" + p.cur.value\n\t\t\tcat.unquoted += p.cur.unquoted\n\t\t}\n\t\tp.done = false // parser may have seen EOF, but we want to return cat\n\t\tp.cur = cat\n\t}\n\treturn &p.cur\n}\n\nfunc (p *textParser) consumeToken(s string) error {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != s {\n\t\tp.back()\n\t\treturn p.errorf(\"expected %q, found %q\", s, tok.value)\n\t}\n\treturn nil\n}\n\n// Return a RequiredNotSetError indicating which required field was not set.\nfunc (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {\n\tst := sv.Type()\n\tsprops := GetProperties(st)\n\tfor i := 0; i < st.NumField(); i++ {\n\t\tif !isNil(sv.Field(i)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tprops := sprops.Prop[i]\n\t\tif props.Required {\n\t\t\treturn &RequiredNotSetError{fmt.Sprintf(\"%v.%v\", st, props.OrigName)}\n\t\t}\n\t}\n\treturn &RequiredNotSetError{fmt.Sprintf(\"%v.<unknown field name>\", st)} // should not happen\n}\n\n// Returns the index in the struct for the named field, as well as the parsed tag properties.\nfunc structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {\n\ti, ok := sprops.decoderOrigNames[name]\n\tif ok {\n\t\treturn i, sprops.Prop[i], true\n\t}\n\treturn -1, nil, false\n}\n\n// Consume a ':' from the input stream (if the next token is a colon),\n// returning an error if a colon is needed but not present.\nfunc (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != \":\" {\n\t\t// Colon is optional when the field is a group or message.\n\t\tneedColon := true\n\t\tswitch props.Wire {\n\t\tcase \"group\":\n\t\t\tneedColon = false\n\t\tcase \"bytes\":\n\t\t\t// A \"bytes\" field is either a message, a string, or a repeated field;\n\t\t\t// those three become *T, *string and []T respectively, so we can check for\n\t\t\t// this field being a pointer to a non-string.\n\t\t\tif typ.Kind() == reflect.Ptr {\n\t\t\t\t// *T or *string\n\t\t\t\tif typ.Elem().Kind() == reflect.String {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if typ.Kind() == reflect.Slice {\n\t\t\t\t// []T or []*T\n\t\t\t\tif typ.Elem().Kind() != reflect.Ptr {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if typ.Kind() == reflect.String {\n\t\t\t\t// The proto3 exception is for a string field,\n\t\t\t\t// which requires a colon.\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tneedColon = false\n\t\t}\n\t\tif needColon {\n\t\t\treturn p.errorf(\"expected ':', found %q\", tok.value)\n\t\t}\n\t\tp.back()\n\t}\n\treturn nil\n}\n\nfunc (p *textParser) readStruct(sv reflect.Value, terminator string) error {\n\tst := sv.Type()\n\tsprops := GetProperties(st)\n\treqCount := sprops.reqCount\n\tvar reqFieldErr error\n\tfieldSet := make(map[string]bool)\n\t// A struct is a sequence of \"name: value\", terminated by one of\n\t// '>' or '}', or the end of the input.  A name may also be\n\t// \"[extension]\" or \"[type/url]\".\n\t//\n\t// The whole struct can also be an expanded Any message, like:\n\t// [type/url] < ... struct contents ... >\n\tfor {\n\t\ttok := p.next()\n\t\tif tok.err != nil {\n\t\t\treturn tok.err\n\t\t}\n\t\tif tok.value == terminator {\n\t\t\tbreak\n\t\t}\n\t\tif tok.value == \"[\" {\n\t\t\t// Looks like an extension or an Any.\n\t\t\t//\n\t\t\t// TODO: Check whether we need to handle\n\t\t\t// namespace rooted names (e.g. \".something.Foo\").\n\t\t\textName, err := p.consumeExtName()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif s := strings.LastIndex(extName, \"/\"); s >= 0 {\n\t\t\t\t// If it contains a slash, it's an Any type URL.\n\t\t\t\tmessageName := extName[s+1:]\n\t\t\t\tmt := MessageType(messageName)\n\t\t\t\tif mt == nil {\n\t\t\t\t\treturn p.errorf(\"unrecognized message %q in google.protobuf.Any\", messageName)\n\t\t\t\t}\n\t\t\t\ttok = p.next()\n\t\t\t\tif tok.err != nil {\n\t\t\t\t\treturn tok.err\n\t\t\t\t}\n\t\t\t\t// consume an optional colon\n\t\t\t\tif tok.value == \":\" {\n\t\t\t\t\ttok = p.next()\n\t\t\t\t\tif tok.err != nil {\n\t\t\t\t\t\treturn tok.err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar terminator string\n\t\t\t\tswitch tok.value {\n\t\t\t\tcase \"<\":\n\t\t\t\t\tterminator = \">\"\n\t\t\t\tcase \"{\":\n\t\t\t\t\tterminator = \"}\"\n\t\t\t\tdefault:\n\t\t\t\t\treturn p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t\t\t}\n\t\t\t\tv := reflect.New(mt.Elem())\n\t\t\t\tif pe := p.readStruct(v.Elem(), terminator); pe != nil {\n\t\t\t\t\treturn pe\n\t\t\t\t}\n\t\t\t\tb, err := Marshal(v.Interface().(Message))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn p.errorf(\"failed to marshal message of type %q: %v\", messageName, err)\n\t\t\t\t}\n\t\t\t\tif fieldSet[\"type_url\"] {\n\t\t\t\t\treturn p.errorf(anyRepeatedlyUnpacked, \"type_url\")\n\t\t\t\t}\n\t\t\t\tif fieldSet[\"value\"] {\n\t\t\t\t\treturn p.errorf(anyRepeatedlyUnpacked, \"value\")\n\t\t\t\t}\n\t\t\t\tsv.FieldByName(\"TypeUrl\").SetString(extName)\n\t\t\t\tsv.FieldByName(\"Value\").SetBytes(b)\n\t\t\t\tfieldSet[\"type_url\"] = true\n\t\t\t\tfieldSet[\"value\"] = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar desc *ExtensionDesc\n\t\t\t// This could be faster, but it's functional.\n\t\t\t// TODO: Do something smarter than a linear scan.\n\t\t\tfor _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {\n\t\t\t\tif d.Name == extName {\n\t\t\t\t\tdesc = d\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif desc == nil {\n\t\t\t\treturn p.errorf(\"unrecognized extension %q\", extName)\n\t\t\t}\n\n\t\t\tprops := &Properties{}\n\t\t\tprops.Parse(desc.Tag)\n\n\t\t\ttyp := reflect.TypeOf(desc.ExtensionType)\n\t\t\tif err := p.checkForColon(props, typ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\trep := desc.repeated()\n\n\t\t\t// Read the extension structure, and set it in\n\t\t\t// the value we're constructing.\n\t\t\tvar ext reflect.Value\n\t\t\tif !rep {\n\t\t\t\text = reflect.New(typ).Elem()\n\t\t\t} else {\n\t\t\t\text = reflect.New(typ.Elem()).Elem()\n\t\t\t}\n\t\t\tif err := p.readAny(ext, props); err != nil {\n\t\t\t\tif _, ok := err.(*RequiredNotSetError); !ok {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treqFieldErr = err\n\t\t\t}\n\t\t\tep := sv.Addr().Interface().(Message)\n\t\t\tif !rep {\n\t\t\t\tSetExtension(ep, desc, ext.Interface())\n\t\t\t} else {\n\t\t\t\told, err := GetExtension(ep, desc)\n\t\t\t\tvar sl reflect.Value\n\t\t\t\tif err == nil {\n\t\t\t\t\tsl = reflect.ValueOf(old) // existing slice\n\t\t\t\t} else {\n\t\t\t\t\tsl = reflect.MakeSlice(typ, 0, 1)\n\t\t\t\t}\n\t\t\t\tsl = reflect.Append(sl, ext)\n\t\t\t\tSetExtension(ep, desc, sl.Interface())\n\t\t\t}\n\t\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// This is a normal, non-extension field.\n\t\tname := tok.value\n\t\tvar dst reflect.Value\n\t\tfi, props, ok := structFieldByName(sprops, name)\n\t\tif ok {\n\t\t\tdst = sv.Field(fi)\n\t\t} else if oop, ok := sprops.OneofTypes[name]; ok {\n\t\t\t// It is a oneof.\n\t\t\tprops = oop.Prop\n\t\t\tnv := reflect.New(oop.Type.Elem())\n\t\t\tdst = nv.Elem().Field(0)\n\t\t\tfield := sv.Field(oop.Field)\n\t\t\tif !field.IsNil() {\n\t\t\t\treturn p.errorf(\"field '%s' would overwrite already parsed oneof '%s'\", name, sv.Type().Field(oop.Field).Name)\n\t\t\t}\n\t\t\tfield.Set(nv)\n\t\t}\n\t\tif !dst.IsValid() {\n\t\t\treturn p.errorf(\"unknown field name %q in %v\", name, st)\n\t\t}\n\n\t\tif dst.Kind() == reflect.Map {\n\t\t\t// Consume any colon.\n\t\t\tif err := p.checkForColon(props, dst.Type()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Construct the map if it doesn't already exist.\n\t\t\tif dst.IsNil() {\n\t\t\t\tdst.Set(reflect.MakeMap(dst.Type()))\n\t\t\t}\n\t\t\tkey := reflect.New(dst.Type().Key()).Elem()\n\t\t\tval := reflect.New(dst.Type().Elem()).Elem()\n\n\t\t\t// The map entry should be this sequence of tokens:\n\t\t\t//\t< key : KEY value : VALUE >\n\t\t\t// However, implementations may omit key or value, and technically\n\t\t\t// we should support them in any order.  See b/28924776 for a time\n\t\t\t// this went wrong.\n\n\t\t\ttok := p.next()\n\t\t\tvar terminator string\n\t\t\tswitch tok.value {\n\t\t\tcase \"<\":\n\t\t\t\tterminator = \">\"\n\t\t\tcase \"{\":\n\t\t\t\tterminator = \"}\"\n\t\t\tdefault:\n\t\t\t\treturn p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t\t}\n\t\t\tfor {\n\t\t\t\ttok := p.next()\n\t\t\t\tif tok.err != nil {\n\t\t\t\t\treturn tok.err\n\t\t\t\t}\n\t\t\t\tif tok.value == terminator {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tswitch tok.value {\n\t\t\t\tcase \"key\":\n\t\t\t\t\tif err := p.consumeToken(\":\"); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := p.readAny(key, props.mkeyprop); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\tcase \"value\":\n\t\t\t\t\tif err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := p.readAny(val, props.mvalprop); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tp.back()\n\t\t\t\t\treturn p.errorf(`expected \"key\", \"value\", or %q, found %q`, terminator, tok.value)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdst.SetMapIndex(key, val)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check that it's not already set if it's not a repeated field.\n\t\tif !props.Repeated && fieldSet[name] {\n\t\t\treturn p.errorf(\"non-repeated field %q was repeated\", name)\n\t\t}\n\n\t\tif err := p.checkForColon(props, dst.Type()); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Parse into the field.\n\t\tfieldSet[name] = true\n\t\tif err := p.readAny(dst, props); err != nil {\n\t\t\tif _, ok := err.(*RequiredNotSetError); !ok {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treqFieldErr = err\n\t\t}\n\t\tif props.Required {\n\t\t\treqCount--\n\t\t}\n\n\t\tif err := p.consumeOptionalSeparator(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif reqCount > 0 {\n\t\treturn p.missingRequiredFieldError(sv)\n\t}\n\treturn reqFieldErr\n}\n\n// consumeExtName consumes extension name or expanded Any type URL and the\n// following ']'. It returns the name or URL consumed.\nfunc (p *textParser) consumeExtName() (string, error) {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn \"\", tok.err\n\t}\n\n\t// If extension name or type url is quoted, it's a single token.\n\tif len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {\n\t\tname, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn name, p.consumeToken(\"]\")\n\t}\n\n\t// Consume everything up to \"]\"\n\tvar parts []string\n\tfor tok.value != \"]\" {\n\t\tparts = append(parts, tok.value)\n\t\ttok = p.next()\n\t\tif tok.err != nil {\n\t\t\treturn \"\", p.errorf(\"unrecognized type_url or extension name: %s\", tok.err)\n\t\t}\n\t}\n\treturn strings.Join(parts, \"\"), nil\n}\n\n// consumeOptionalSeparator consumes an optional semicolon or comma.\n// It is used in readStruct to provide backward compatibility.\nfunc (p *textParser) consumeOptionalSeparator() error {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value != \";\" && tok.value != \",\" {\n\t\tp.back()\n\t}\n\treturn nil\n}\n\nfunc (p *textParser) readAny(v reflect.Value, props *Properties) error {\n\ttok := p.next()\n\tif tok.err != nil {\n\t\treturn tok.err\n\t}\n\tif tok.value == \"\" {\n\t\treturn p.errorf(\"unexpected EOF\")\n\t}\n\n\tswitch fv := v; fv.Kind() {\n\tcase reflect.Slice:\n\t\tat := v.Type()\n\t\tif at.Elem().Kind() == reflect.Uint8 {\n\t\t\t// Special case for []byte\n\t\t\tif tok.value[0] != '\"' && tok.value[0] != '\\'' {\n\t\t\t\t// Deliberately written out here, as the error after\n\t\t\t\t// this switch statement would write \"invalid []byte: ...\",\n\t\t\t\t// which is not as user-friendly.\n\t\t\t\treturn p.errorf(\"invalid string: %v\", tok.value)\n\t\t\t}\n\t\t\tbytes := []byte(tok.unquoted)\n\t\t\tfv.Set(reflect.ValueOf(bytes))\n\t\t\treturn nil\n\t\t}\n\t\t// Repeated field.\n\t\tif tok.value == \"[\" {\n\t\t\t// Repeated field with list notation, like [1,2,3].\n\t\t\tfor {\n\t\t\t\tfv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))\n\t\t\t\terr := p.readAny(fv.Index(fv.Len()-1), props)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttok := p.next()\n\t\t\t\tif tok.err != nil {\n\t\t\t\t\treturn tok.err\n\t\t\t\t}\n\t\t\t\tif tok.value == \"]\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif tok.value != \",\" {\n\t\t\t\t\treturn p.errorf(\"Expected ']' or ',' found %q\", tok.value)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\t// One value of the repeated field.\n\t\tp.back()\n\t\tfv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))\n\t\treturn p.readAny(fv.Index(fv.Len()-1), props)\n\tcase reflect.Bool:\n\t\t// true/1/t/True or false/f/0/False.\n\t\tswitch tok.value {\n\t\tcase \"true\", \"1\", \"t\", \"True\":\n\t\t\tfv.SetBool(true)\n\t\t\treturn nil\n\t\tcase \"false\", \"0\", \"f\", \"False\":\n\t\t\tfv.SetBool(false)\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tv := tok.value\n\t\t// Ignore 'f' for compatibility with output generated by C++, but don't\n\t\t// remove 'f' when the value is \"-inf\" or \"inf\".\n\t\tif strings.HasSuffix(v, \"f\") && tok.value != \"-inf\" && tok.value != \"inf\" {\n\t\t\tv = v[:len(v)-1]\n\t\t}\n\t\tif f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {\n\t\t\tfv.SetFloat(f)\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Int32:\n\t\tif x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {\n\t\t\tfv.SetInt(x)\n\t\t\treturn nil\n\t\t}\n\n\t\tif len(props.Enum) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tm, ok := enumValueMaps[props.Enum]\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tx, ok := m[tok.value]\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tfv.SetInt(int64(x))\n\t\treturn nil\n\tcase reflect.Int64:\n\t\tif x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {\n\t\t\tfv.SetInt(x)\n\t\t\treturn nil\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// A basic field (indirected through pointer), or a repeated message/group\n\t\tp.back()\n\t\tfv.Set(reflect.New(fv.Type().Elem()))\n\t\treturn p.readAny(fv.Elem(), props)\n\tcase reflect.String:\n\t\tif tok.value[0] == '\"' || tok.value[0] == '\\'' {\n\t\t\tfv.SetString(tok.unquoted)\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Struct:\n\t\tvar terminator string\n\t\tswitch tok.value {\n\t\tcase \"{\":\n\t\t\tterminator = \"}\"\n\t\tcase \"<\":\n\t\t\tterminator = \">\"\n\t\tdefault:\n\t\t\treturn p.errorf(\"expected '{' or '<', found %q\", tok.value)\n\t\t}\n\t\t// TODO: Handle nested messages which implement encoding.TextUnmarshaler.\n\t\treturn p.readStruct(fv, terminator)\n\tcase reflect.Uint32:\n\t\tif x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {\n\t\t\tfv.SetUint(x)\n\t\t\treturn nil\n\t\t}\n\tcase reflect.Uint64:\n\t\tif x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {\n\t\t\tfv.SetUint(x)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn p.errorf(\"invalid %v: %v\", v.Type(), tok.value)\n}\n\n// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb\n// before starting to unmarshal, so any existing data in pb is always removed.\n// If a required field is not set and no other error occurs,\n// UnmarshalText returns *RequiredNotSetError.\nfunc UnmarshalText(s string, pb Message) error {\n\tif um, ok := pb.(encoding.TextUnmarshaler); ok {\n\t\terr := um.UnmarshalText([]byte(s))\n\t\treturn err\n\t}\n\tpb.Reset()\n\tv := reflect.ValueOf(pb)\n\tif pe := newTextParser(s).readStruct(v.Elem(), \"\"); pe != nil {\n\t\treturn pe\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/text_parser_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"math\"\n\t\"reflect\"\n\t\"testing\"\n\n\t. \"github.com/golang/protobuf/proto\"\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\t. \"github.com/golang/protobuf/proto/testdata\"\n)\n\ntype UnmarshalTextTest struct {\n\tin  string\n\terr string // if \"\", no error expected\n\tout *MyMessage\n}\n\nfunc buildExtStructTest(text string) UnmarshalTextTest {\n\tmsg := &MyMessage{\n\t\tCount: Int32(42),\n\t}\n\tSetExtension(msg, E_Ext_More, &Ext{\n\t\tData: String(\"Hello, world!\"),\n\t})\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nfunc buildExtDataTest(text string) UnmarshalTextTest {\n\tmsg := &MyMessage{\n\t\tCount: Int32(42),\n\t}\n\tSetExtension(msg, E_Ext_Text, String(\"Hello, world!\"))\n\tSetExtension(msg, E_Ext_Number, Int32(1729))\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nfunc buildExtRepStringTest(text string) UnmarshalTextTest {\n\tmsg := &MyMessage{\n\t\tCount: Int32(42),\n\t}\n\tif err := SetExtension(msg, E_Greeting, []string{\"bula\", \"hola\"}); err != nil {\n\t\tpanic(err)\n\t}\n\treturn UnmarshalTextTest{in: text, out: msg}\n}\n\nvar unMarshalTextTests = []UnmarshalTextTest{\n\t// Basic\n\t{\n\t\tin: \" count:42\\n  name:\\\"Dave\\\" \",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"Dave\"),\n\t\t},\n\t},\n\n\t// Empty quoted string\n\t{\n\t\tin: `count:42 name:\"\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenation with double quotes\n\t{\n\t\tin: `count:42 name: \"My name is \"` + \"\\n\" + `\"elsewhere\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenation with single quotes\n\t{\n\t\tin: \"count:42 name: 'My name is '\\n'elsewhere'\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string concatenations with mixed quotes\n\t{\n\t\tin: \"count:42 name: 'My name is '\\n\\\"elsewhere\\\"\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\t{\n\t\tin: \"count:42 name: \\\"My name is \\\"\\n'elsewhere'\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"My name is elsewhere\"),\n\t\t},\n\t},\n\n\t// Quoted string with escaped apostrophe\n\t{\n\t\tin: `count:42 name: \"HOLIDAY - New Year\\'s Day\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"HOLIDAY - New Year's Day\"),\n\t\t},\n\t},\n\n\t// Quoted string with single quote\n\t{\n\t\tin: `count:42 name: 'Roger \"The Ramster\" Ramjet'`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(`Roger \"The Ramster\" Ramjet`),\n\t\t},\n\t},\n\n\t// Quoted string with all the accepted special characters from the C++ test\n\t{\n\t\tin: `count:42 name: ` + \"\\\"\\\\\\\"A string with \\\\' characters \\\\n and \\\\r newlines and \\\\t tabs and \\\\001 slashes \\\\\\\\ and  multiple   spaces\\\"\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and  multiple   spaces\"),\n\t\t},\n\t},\n\n\t// Quoted string with quoted backslash\n\t{\n\t\tin: `count:42 name: \"\\\\'xyz\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(`\\'xyz`),\n\t\t},\n\t},\n\n\t// Quoted string with UTF-8 bytes.\n\t{\n\t\tin: \"count:42 name: '\\303\\277\\302\\201\\xAB'\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"\\303\\277\\302\\201\\xAB\"),\n\t\t},\n\t},\n\n\t// Bad quoted string\n\t{\n\t\tin:  `inner: < host: \"\\0\" >` + \"\\n\",\n\t\terr: `line 1.15: invalid quoted string \"\\0\": \\0 requires 2 following digits`,\n\t},\n\n\t// Number too large for int64\n\t{\n\t\tin:  \"count: 1 others { key: 123456789012345678901 }\",\n\t\terr: \"line 1.23: invalid int64: 123456789012345678901\",\n\t},\n\n\t// Number too large for int32\n\t{\n\t\tin:  \"count: 1234567890123\",\n\t\terr: \"line 1.7: invalid int32: 1234567890123\",\n\t},\n\n\t// Number in hexadecimal\n\t{\n\t\tin: \"count: 0x2beef\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(0x2beef),\n\t\t},\n\t},\n\n\t// Number in octal\n\t{\n\t\tin: \"count: 024601\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(024601),\n\t\t},\n\t},\n\n\t// Floating point number with \"f\" suffix\n\t{\n\t\tin: \"count: 4 others:< weight: 17.0f >\",\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(4),\n\t\t\tOthers: []*OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tWeight: Float32(17),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\n\t// Floating point positive infinity\n\t{\n\t\tin: \"count: 4 bigfloat: inf\",\n\t\tout: &MyMessage{\n\t\t\tCount:    Int32(4),\n\t\t\tBigfloat: Float64(math.Inf(1)),\n\t\t},\n\t},\n\n\t// Floating point negative infinity\n\t{\n\t\tin: \"count: 4 bigfloat: -inf\",\n\t\tout: &MyMessage{\n\t\t\tCount:    Int32(4),\n\t\t\tBigfloat: Float64(math.Inf(-1)),\n\t\t},\n\t},\n\n\t// Number too large for float32\n\t{\n\t\tin:  \"others:< weight: 12345678901234567890123456789012345678901234567890 >\",\n\t\terr: \"line 1.17: invalid float32: 12345678901234567890123456789012345678901234567890\",\n\t},\n\n\t// Number posing as a quoted string\n\t{\n\t\tin:  `inner: < host: 12 >` + \"\\n\",\n\t\terr: `line 1.15: invalid string: 12`,\n\t},\n\n\t// Quoted string posing as int32\n\t{\n\t\tin:  `count: \"12\"`,\n\t\terr: `line 1.7: invalid int32: \"12\"`,\n\t},\n\n\t// Quoted string posing a float32\n\t{\n\t\tin:  `others:< weight: \"17.4\" >`,\n\t\terr: `line 1.17: invalid float32: \"17.4\"`,\n\t},\n\n\t// Enum\n\t{\n\t\tin: `count:42 bikeshed: BLUE`,\n\t\tout: &MyMessage{\n\t\t\tCount:    Int32(42),\n\t\t\tBikeshed: MyMessage_BLUE.Enum(),\n\t\t},\n\t},\n\n\t// Repeated field\n\t{\n\t\tin: `count:42 pet: \"horsey\" pet:\"bunny\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tPet:   []string{\"horsey\", \"bunny\"},\n\t\t},\n\t},\n\n\t// Repeated field with list notation\n\t{\n\t\tin: `count:42 pet: [\"horsey\", \"bunny\"]`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tPet:   []string{\"horsey\", \"bunny\"},\n\t\t},\n\t},\n\n\t// Repeated message with/without colon and <>/{}\n\t{\n\t\tin: `count:42 others:{} others{} others:<> others:{}`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tOthers: []*OtherMessage{\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t},\n\n\t// Missing colon for inner message\n\t{\n\t\tin: `count:42 inner < host: \"cauchy.syd\" >`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost: String(\"cauchy.syd\"),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Missing colon for string field\n\t{\n\t\tin:  `name \"Dave\"`,\n\t\terr: `line 1.5: expected ':', found \"\\\"Dave\\\"\"`,\n\t},\n\n\t// Missing colon for int32 field\n\t{\n\t\tin:  `count 42`,\n\t\terr: `line 1.6: expected ':', found \"42\"`,\n\t},\n\n\t// Missing required field\n\t{\n\t\tin:  `name: \"Pawel\"`,\n\t\terr: `proto: required field \"testdata.MyMessage.count\" not set`,\n\t\tout: &MyMessage{\n\t\t\tName: String(\"Pawel\"),\n\t\t},\n\t},\n\n\t// Missing required field in a required submessage\n\t{\n\t\tin:  `count: 42 we_must_go_deeper < leo_finally_won_an_oscar <> >`,\n\t\terr: `proto: required field \"testdata.InnerMessage.host\" not set`,\n\t\tout: &MyMessage{\n\t\t\tCount:          Int32(42),\n\t\t\tWeMustGoDeeper: &RequiredInnerMessage{LeoFinallyWonAnOscar: &InnerMessage{}},\n\t\t},\n\t},\n\n\t// Repeated non-repeated field\n\t{\n\t\tin:  `name: \"Rob\" name: \"Russ\"`,\n\t\terr: `line 1.12: non-repeated field \"name\" was repeated`,\n\t},\n\n\t// Group\n\t{\n\t\tin: `count: 17 SomeGroup { group_field: 12 }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(17),\n\t\t\tSomegroup: &MyMessage_SomeGroup{\n\t\t\t\tGroupField: Int32(12),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Semicolon between fields\n\t{\n\t\tin: `count:3;name:\"Calvin\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(3),\n\t\t\tName:  String(\"Calvin\"),\n\t\t},\n\t},\n\t// Comma between fields\n\t{\n\t\tin: `count:4,name:\"Ezekiel\"`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(4),\n\t\t\tName:  String(\"Ezekiel\"),\n\t\t},\n\t},\n\n\t// Boolean false\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: false }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean true\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: true }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean 0\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: 0 }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean 1\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: 1 }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean f\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: f }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean t\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: t }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean False\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: False }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(false),\n\t\t\t},\n\t\t},\n\t},\n\t// Boolean True\n\t{\n\t\tin: `count:42 inner { host: \"example.com\" connected: True }`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"example.com\"),\n\t\t\t\tConnected: Bool(true),\n\t\t\t},\n\t\t},\n\t},\n\n\t// Extension\n\tbuildExtStructTest(`count: 42 [testdata.Ext.more]:<data:\"Hello, world!\" >`),\n\tbuildExtStructTest(`count: 42 [testdata.Ext.more] {data:\"Hello, world!\"}`),\n\tbuildExtDataTest(`count: 42 [testdata.Ext.text]:\"Hello, world!\" [testdata.Ext.number]:1729`),\n\tbuildExtRepStringTest(`count: 42 [testdata.greeting]:\"bula\" [testdata.greeting]:\"hola\"`),\n\n\t// Big all-in-one\n\t{\n\t\tin: \"count:42  # Meaning\\n\" +\n\t\t\t`name:\"Dave\" ` +\n\t\t\t`quote:\"\\\"I didn't want to go.\\\"\" ` +\n\t\t\t`pet:\"bunny\" ` +\n\t\t\t`pet:\"kitty\" ` +\n\t\t\t`pet:\"horsey\" ` +\n\t\t\t`inner:<` +\n\t\t\t`  host:\"footrest.syd\" ` +\n\t\t\t`  port:7001 ` +\n\t\t\t`  connected:true ` +\n\t\t\t`> ` +\n\t\t\t`others:<` +\n\t\t\t`  key:3735928559 ` +\n\t\t\t`  value:\"\\x01A\\a\\f\" ` +\n\t\t\t`> ` +\n\t\t\t`others:<` +\n\t\t\t\"  weight:58.9  # Atomic weight of Co\\n\" +\n\t\t\t`  inner:<` +\n\t\t\t`    host:\"lesha.mtv\" ` +\n\t\t\t`    port:8002 ` +\n\t\t\t`  >` +\n\t\t\t`>`,\n\t\tout: &MyMessage{\n\t\t\tCount: Int32(42),\n\t\t\tName:  String(\"Dave\"),\n\t\t\tQuote: String(`\"I didn't want to go.\"`),\n\t\t\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\t\tInner: &InnerMessage{\n\t\t\t\tHost:      String(\"footrest.syd\"),\n\t\t\t\tPort:      Int32(7001),\n\t\t\t\tConnected: Bool(true),\n\t\t\t},\n\t\t\tOthers: []*OtherMessage{\n\t\t\t\t{\n\t\t\t\t\tKey:   Int64(3735928559),\n\t\t\t\t\tValue: []byte{0x1, 'A', '\\a', '\\f'},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tWeight: Float32(58.9),\n\t\t\t\t\tInner: &InnerMessage{\n\t\t\t\t\t\tHost: String(\"lesha.mtv\"),\n\t\t\t\t\t\tPort: Int32(8002),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n}\n\nfunc TestUnmarshalText(t *testing.T) {\n\tfor i, test := range unMarshalTextTests {\n\t\tpb := new(MyMessage)\n\t\terr := UnmarshalText(test.in, pb)\n\t\tif test.err == \"\" {\n\t\t\t// We don't expect failure.\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Test %d: Unexpected error: %v\", i, err)\n\t\t\t} else if !reflect.DeepEqual(pb, test.out) {\n\t\t\t\tt.Errorf(\"Test %d: Incorrect populated \\nHave: %v\\nWant: %v\",\n\t\t\t\t\ti, pb, test.out)\n\t\t\t}\n\t\t} else {\n\t\t\t// We do expect failure.\n\t\t\tif err == nil {\n\t\t\t\tt.Errorf(\"Test %d: Didn't get expected error: %v\", i, test.err)\n\t\t\t} else if err.Error() != test.err {\n\t\t\t\tt.Errorf(\"Test %d: Incorrect error.\\nHave: %v\\nWant: %v\",\n\t\t\t\t\ti, err.Error(), test.err)\n\t\t\t} else if _, ok := err.(*RequiredNotSetError); ok && test.out != nil && !reflect.DeepEqual(pb, test.out) {\n\t\t\t\tt.Errorf(\"Test %d: Incorrect populated \\nHave: %v\\nWant: %v\",\n\t\t\t\t\ti, pb, test.out)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc TestUnmarshalTextCustomMessage(t *testing.T) {\n\tmsg := &textMessage{}\n\tif err := UnmarshalText(\"custom\", msg); err != nil {\n\t\tt.Errorf(\"Unexpected error from custom unmarshal: %v\", err)\n\t}\n\tif UnmarshalText(\"not custom\", msg) == nil {\n\t\tt.Errorf(\"Didn't get expected error from custom unmarshal\")\n\t}\n}\n\n// Regression test; this caused a panic.\nfunc TestRepeatedEnum(t *testing.T) {\n\tpb := new(RepeatedEnum)\n\tif err := UnmarshalText(\"color: RED\", pb); err != nil {\n\t\tt.Fatal(err)\n\t}\n\texp := &RepeatedEnum{\n\t\tColor: []RepeatedEnum_Color{RepeatedEnum_RED},\n\t}\n\tif !Equal(pb, exp) {\n\t\tt.Errorf(\"Incorrect populated \\nHave: %v\\nWant: %v\", pb, exp)\n\t}\n}\n\nfunc TestProto3TextParsing(t *testing.T) {\n\tm := new(proto3pb.Message)\n\tconst in = `name: \"Wallace\" true_scotsman: true`\n\twant := &proto3pb.Message{\n\t\tName:         \"Wallace\",\n\t\tTrueScotsman: true,\n\t}\n\tif err := UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !Equal(m, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, want)\n\t}\n}\n\nfunc TestMapParsing(t *testing.T) {\n\tm := new(MessageWithMap)\n\tconst in = `name_mapping:<key:1234 value:\"Feist\"> name_mapping:<key:1 value:\"Beatles\">` +\n\t\t`msg_mapping:<key:-4, value:<f: 2.0>,>` + // separating commas are okay\n\t\t`msg_mapping<key:-2 value<f: 4.0>>` + // no colon after \"value\"\n\t\t`msg_mapping:<value:<f: 5.0>>` + // omitted key\n\t\t`msg_mapping:<key:1>` + // omitted value\n\t\t`byte_mapping:<key:true value:\"so be it\">` +\n\t\t`byte_mapping:<>` // omitted key and value\n\twant := &MessageWithMap{\n\t\tNameMapping: map[int32]string{\n\t\t\t1:    \"Beatles\",\n\t\t\t1234: \"Feist\",\n\t\t},\n\t\tMsgMapping: map[int64]*FloatingPoint{\n\t\t\t-4: {F: Float64(2.0)},\n\t\t\t-2: {F: Float64(4.0)},\n\t\t\t0:  {F: Float64(5.0)},\n\t\t\t1:  nil,\n\t\t},\n\t\tByteMapping: map[bool][]byte{\n\t\t\tfalse: nil,\n\t\t\ttrue:  []byte(\"so be it\"),\n\t\t},\n\t}\n\tif err := UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !Equal(m, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, want)\n\t}\n}\n\nfunc TestOneofParsing(t *testing.T) {\n\tconst in = `name:\"Shrek\"`\n\tm := new(Communique)\n\twant := &Communique{Union: &Communique_Name{\"Shrek\"}}\n\tif err := UnmarshalText(in, m); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !Equal(m, want) {\n\t\tt.Errorf(\"\\n got %v\\nwant %v\", m, want)\n\t}\n\n\tconst inOverwrite = `name:\"Shrek\" number:42`\n\tm = new(Communique)\n\ttestErr := \"line 1.13: field 'number' would overwrite already parsed oneof 'Union'\"\n\tif err := UnmarshalText(inOverwrite, m); err == nil {\n\t\tt.Errorf(\"TestOneofParsing: Didn't get expected error: %v\", testErr)\n\t} else if err.Error() != testErr {\n\t\tt.Errorf(\"TestOneofParsing: Incorrect error.\\nHave: %v\\nWant: %v\",\n\t\t\terr.Error(), testErr)\n\t}\n\n}\n\nvar benchInput string\n\nfunc init() {\n\tbenchInput = \"count: 4\\n\"\n\tfor i := 0; i < 1000; i++ {\n\t\tbenchInput += \"pet: \\\"fido\\\"\\n\"\n\t}\n\n\t// Check it is valid input.\n\tpb := new(MyMessage)\n\terr := UnmarshalText(benchInput, pb)\n\tif err != nil {\n\t\tpanic(\"Bad benchmark input: \" + err.Error())\n\t}\n}\n\nfunc BenchmarkUnmarshalText(b *testing.B) {\n\tpb := new(MyMessage)\n\tfor i := 0; i < b.N; i++ {\n\t\tUnmarshalText(benchInput, pb)\n\t}\n\tb.SetBytes(int64(len(benchInput)))\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/proto/text_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage proto_test\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"io/ioutil\"\n\t\"math\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\tproto3pb \"github.com/golang/protobuf/proto/proto3_proto\"\n\tpb \"github.com/golang/protobuf/proto/testdata\"\n)\n\n// textMessage implements the methods that allow it to marshal and unmarshal\n// itself as text.\ntype textMessage struct {\n}\n\nfunc (*textMessage) MarshalText() ([]byte, error) {\n\treturn []byte(\"custom\"), nil\n}\n\nfunc (*textMessage) UnmarshalText(bytes []byte) error {\n\tif string(bytes) != \"custom\" {\n\t\treturn errors.New(\"expected 'custom'\")\n\t}\n\treturn nil\n}\n\nfunc (*textMessage) Reset()         {}\nfunc (*textMessage) String() string { return \"\" }\nfunc (*textMessage) ProtoMessage()  {}\n\nfunc newTestMessage() *pb.MyMessage {\n\tmsg := &pb.MyMessage{\n\t\tCount: proto.Int32(42),\n\t\tName:  proto.String(\"Dave\"),\n\t\tQuote: proto.String(`\"I didn't want to go.\"`),\n\t\tPet:   []string{\"bunny\", \"kitty\", \"horsey\"},\n\t\tInner: &pb.InnerMessage{\n\t\t\tHost:      proto.String(\"footrest.syd\"),\n\t\t\tPort:      proto.Int32(7001),\n\t\t\tConnected: proto.Bool(true),\n\t\t},\n\t\tOthers: []*pb.OtherMessage{\n\t\t\t{\n\t\t\t\tKey:   proto.Int64(0xdeadbeef),\n\t\t\t\tValue: []byte{1, 65, 7, 12},\n\t\t\t},\n\t\t\t{\n\t\t\t\tWeight: proto.Float32(6.022),\n\t\t\t\tInner: &pb.InnerMessage{\n\t\t\t\t\tHost: proto.String(\"lesha.mtv\"),\n\t\t\t\t\tPort: proto.Int32(8002),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tBikeshed: pb.MyMessage_BLUE.Enum(),\n\t\tSomegroup: &pb.MyMessage_SomeGroup{\n\t\t\tGroupField: proto.Int32(8),\n\t\t},\n\t\t// One normally wouldn't do this.\n\t\t// This is an undeclared tag 13, as a varint (wire type 0) with value 4.\n\t\tXXX_unrecognized: []byte{13<<3 | 0, 4},\n\t}\n\text := &pb.Ext{\n\t\tData: proto.String(\"Big gobs for big rats\"),\n\t}\n\tif err := proto.SetExtension(msg, pb.E_Ext_More, ext); err != nil {\n\t\tpanic(err)\n\t}\n\tgreetings := []string{\"adg\", \"easy\", \"cow\"}\n\tif err := proto.SetExtension(msg, pb.E_Greeting, greetings); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Add an unknown extension. We marshal a pb.Ext, and fake the ID.\n\tb, err := proto.Marshal(&pb.Ext{Data: proto.String(\"3G skiing\")})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb = append(proto.EncodeVarint(201<<3|proto.WireBytes), b...)\n\tproto.SetRawExtension(msg, 201, b)\n\n\t// Extensions can be plain fields, too, so let's test that.\n\tb = append(proto.EncodeVarint(202<<3|proto.WireVarint), 19)\n\tproto.SetRawExtension(msg, 202, b)\n\n\treturn msg\n}\n\nconst text = `count: 42\nname: \"Dave\"\nquote: \"\\\"I didn't want to go.\\\"\"\npet: \"bunny\"\npet: \"kitty\"\npet: \"horsey\"\ninner: <\n  host: \"footrest.syd\"\n  port: 7001\n  connected: true\n>\nothers: <\n  key: 3735928559\n  value: \"\\001A\\007\\014\"\n>\nothers: <\n  weight: 6.022\n  inner: <\n    host: \"lesha.mtv\"\n    port: 8002\n  >\n>\nbikeshed: BLUE\nSomeGroup {\n  group_field: 8\n}\n/* 2 unknown bytes */\n13: 4\n[testdata.Ext.more]: <\n  data: \"Big gobs for big rats\"\n>\n[testdata.greeting]: \"adg\"\n[testdata.greeting]: \"easy\"\n[testdata.greeting]: \"cow\"\n/* 13 unknown bytes */\n201: \"\\t3G skiing\"\n/* 3 unknown bytes */\n202: 19\n`\n\nfunc TestMarshalText(t *testing.T) {\n\tbuf := new(bytes.Buffer)\n\tif err := proto.MarshalText(buf, newTestMessage()); err != nil {\n\t\tt.Fatalf(\"proto.MarshalText: %v\", err)\n\t}\n\ts := buf.String()\n\tif s != text {\n\t\tt.Errorf(\"Got:\\n===\\n%v===\\nExpected:\\n===\\n%v===\\n\", s, text)\n\t}\n}\n\nfunc TestMarshalTextCustomMessage(t *testing.T) {\n\tbuf := new(bytes.Buffer)\n\tif err := proto.MarshalText(buf, &textMessage{}); err != nil {\n\t\tt.Fatalf(\"proto.MarshalText: %v\", err)\n\t}\n\ts := buf.String()\n\tif s != \"custom\" {\n\t\tt.Errorf(\"Got %q, expected %q\", s, \"custom\")\n\t}\n}\nfunc TestMarshalTextNil(t *testing.T) {\n\twant := \"<nil>\"\n\ttests := []proto.Message{nil, (*pb.MyMessage)(nil)}\n\tfor i, test := range tests {\n\t\tbuf := new(bytes.Buffer)\n\t\tif err := proto.MarshalText(buf, test); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif got := buf.String(); got != want {\n\t\t\tt.Errorf(\"%d: got %q want %q\", i, got, want)\n\t\t}\n\t}\n}\n\nfunc TestMarshalTextUnknownEnum(t *testing.T) {\n\t// The Color enum only specifies values 0-2.\n\tm := &pb.MyMessage{Bikeshed: pb.MyMessage_Color(3).Enum()}\n\tgot := m.String()\n\tconst want = `bikeshed:3 `\n\tif got != want {\n\t\tt.Errorf(\"\\n got %q\\nwant %q\", got, want)\n\t}\n}\n\nfunc TestTextOneof(t *testing.T) {\n\ttests := []struct {\n\t\tm    proto.Message\n\t\twant string\n\t}{\n\t\t// zero message\n\t\t{&pb.Communique{}, ``},\n\t\t// scalar field\n\t\t{&pb.Communique{Union: &pb.Communique_Number{4}}, `number:4`},\n\t\t// message field\n\t\t{&pb.Communique{Union: &pb.Communique_Msg{\n\t\t\t&pb.Strings{StringField: proto.String(\"why hello!\")},\n\t\t}}, `msg:<string_field:\"why hello!\" >`},\n\t\t// bad oneof (should not panic)\n\t\t{&pb.Communique{Union: &pb.Communique_Msg{nil}}, `msg:/* nil */`},\n\t}\n\tfor _, test := range tests {\n\t\tgot := strings.TrimSpace(test.m.String())\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"\\n got %s\\nwant %s\", got, test.want)\n\t\t}\n\t}\n}\n\nfunc BenchmarkMarshalTextBuffered(b *testing.B) {\n\tbuf := new(bytes.Buffer)\n\tm := newTestMessage()\n\tfor i := 0; i < b.N; i++ {\n\t\tbuf.Reset()\n\t\tproto.MarshalText(buf, m)\n\t}\n}\n\nfunc BenchmarkMarshalTextUnbuffered(b *testing.B) {\n\tw := ioutil.Discard\n\tm := newTestMessage()\n\tfor i := 0; i < b.N; i++ {\n\t\tproto.MarshalText(w, m)\n\t}\n}\n\nfunc compact(src string) string {\n\t// s/[ \\n]+/ /g; s/ $//;\n\tdst := make([]byte, len(src))\n\tspace, comment := false, false\n\tj := 0\n\tfor i := 0; i < len(src); i++ {\n\t\tif strings.HasPrefix(src[i:], \"/*\") {\n\t\t\tcomment = true\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tif comment && strings.HasPrefix(src[i:], \"*/\") {\n\t\t\tcomment = false\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tif comment {\n\t\t\tcontinue\n\t\t}\n\t\tc := src[i]\n\t\tif c == ' ' || c == '\\n' {\n\t\t\tspace = true\n\t\t\tcontinue\n\t\t}\n\t\tif j > 0 && (dst[j-1] == ':' || dst[j-1] == '<' || dst[j-1] == '{') {\n\t\t\tspace = false\n\t\t}\n\t\tif c == '{' {\n\t\t\tspace = false\n\t\t}\n\t\tif space {\n\t\t\tdst[j] = ' '\n\t\t\tj++\n\t\t\tspace = false\n\t\t}\n\t\tdst[j] = c\n\t\tj++\n\t}\n\tif space {\n\t\tdst[j] = ' '\n\t\tj++\n\t}\n\treturn string(dst[0:j])\n}\n\nvar compactText = compact(text)\n\nfunc TestCompactText(t *testing.T) {\n\ts := proto.CompactTextString(newTestMessage())\n\tif s != compactText {\n\t\tt.Errorf(\"Got:\\n===\\n%v===\\nExpected:\\n===\\n%v\\n===\\n\", s, compactText)\n\t}\n}\n\nfunc TestStringEscaping(t *testing.T) {\n\ttestCases := []struct {\n\t\tin  *pb.Strings\n\t\tout string\n\t}{\n\t\t{\n\t\t\t// Test data from C++ test (TextFormatTest.StringEscape).\n\t\t\t// Single divergence: we don't escape apostrophes.\n\t\t\t&pb.Strings{StringField: proto.String(\"\\\"A string with ' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and  multiple   spaces\")},\n\t\t\t\"string_field: \\\"\\\\\\\"A string with ' characters \\\\n and \\\\r newlines and \\\\t tabs and \\\\001 slashes \\\\\\\\ and  multiple   spaces\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\t// Test data from the same C++ test.\n\t\t\t&pb.Strings{StringField: proto.String(\"\\350\\260\\267\\346\\255\\214\")},\n\t\t\t\"string_field: \\\"\\\\350\\\\260\\\\267\\\\346\\\\255\\\\214\\\"\\n\",\n\t\t},\n\t\t{\n\t\t\t// Some UTF-8.\n\t\t\t&pb.Strings{StringField: proto.String(\"\\x00\\x01\\xff\\x81\")},\n\t\t\t`string_field: \"\\000\\001\\377\\201\"` + \"\\n\",\n\t\t},\n\t}\n\n\tfor i, tc := range testCases {\n\t\tvar buf bytes.Buffer\n\t\tif err := proto.MarshalText(&buf, tc.in); err != nil {\n\t\t\tt.Errorf(\"proto.MarsalText: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\ts := buf.String()\n\t\tif s != tc.out {\n\t\t\tt.Errorf(\"#%d: Got:\\n%s\\nExpected:\\n%s\\n\", i, s, tc.out)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check round-trip.\n\t\tpb := new(pb.Strings)\n\t\tif err := proto.UnmarshalText(s, pb); err != nil {\n\t\t\tt.Errorf(\"#%d: UnmarshalText: %v\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !proto.Equal(pb, tc.in) {\n\t\t\tt.Errorf(\"#%d: Round-trip failed:\\nstart: %v\\n  end: %v\", i, tc.in, pb)\n\t\t}\n\t}\n}\n\n// A limitedWriter accepts some output before it fails.\n// This is a proxy for something like a nearly-full or imminently-failing disk,\n// or a network connection that is about to die.\ntype limitedWriter struct {\n\tb     bytes.Buffer\n\tlimit int\n}\n\nvar outOfSpace = errors.New(\"proto: insufficient space\")\n\nfunc (w *limitedWriter) Write(p []byte) (n int, err error) {\n\tvar avail = w.limit - w.b.Len()\n\tif avail <= 0 {\n\t\treturn 0, outOfSpace\n\t}\n\tif len(p) <= avail {\n\t\treturn w.b.Write(p)\n\t}\n\tn, _ = w.b.Write(p[:avail])\n\treturn n, outOfSpace\n}\n\nfunc TestMarshalTextFailing(t *testing.T) {\n\t// Try lots of different sizes to exercise more error code-paths.\n\tfor lim := 0; lim < len(text); lim++ {\n\t\tbuf := new(limitedWriter)\n\t\tbuf.limit = lim\n\t\terr := proto.MarshalText(buf, newTestMessage())\n\t\t// We expect a certain error, but also some partial results in the buffer.\n\t\tif err != outOfSpace {\n\t\t\tt.Errorf(\"Got:\\n===\\n%v===\\nExpected:\\n===\\n%v===\\n\", err, outOfSpace)\n\t\t}\n\t\ts := buf.b.String()\n\t\tx := text[:buf.limit]\n\t\tif s != x {\n\t\t\tt.Errorf(\"Got:\\n===\\n%v===\\nExpected:\\n===\\n%v===\\n\", s, x)\n\t\t}\n\t}\n}\n\nfunc TestFloats(t *testing.T) {\n\ttests := []struct {\n\t\tf    float64\n\t\twant string\n\t}{\n\t\t{0, \"0\"},\n\t\t{4.7, \"4.7\"},\n\t\t{math.Inf(1), \"inf\"},\n\t\t{math.Inf(-1), \"-inf\"},\n\t\t{math.NaN(), \"nan\"},\n\t}\n\tfor _, test := range tests {\n\t\tmsg := &pb.FloatingPoint{F: &test.f}\n\t\tgot := strings.TrimSpace(msg.String())\n\t\twant := `f:` + test.want\n\t\tif got != want {\n\t\t\tt.Errorf(\"f=%f: got %q, want %q\", test.f, got, want)\n\t\t}\n\t}\n}\n\nfunc TestRepeatedNilText(t *testing.T) {\n\tm := &pb.MessageList{\n\t\tMessage: []*pb.MessageList_Message{\n\t\t\tnil,\n\t\t\t&pb.MessageList_Message{\n\t\t\t\tName: proto.String(\"Horse\"),\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t}\n\twant := `Message <nil>\nMessage {\n  name: \"Horse\"\n}\nMessage <nil>\n`\n\tif s := proto.MarshalTextString(m); s != want {\n\t\tt.Errorf(\" got: %s\\nwant: %s\", s, want)\n\t}\n}\n\nfunc TestProto3Text(t *testing.T) {\n\ttests := []struct {\n\t\tm    proto.Message\n\t\twant string\n\t}{\n\t\t// zero message\n\t\t{&proto3pb.Message{}, ``},\n\t\t// zero message except for an empty byte slice\n\t\t{&proto3pb.Message{Data: []byte{}}, ``},\n\t\t// trivial case\n\t\t{&proto3pb.Message{Name: \"Rob\", HeightInCm: 175}, `name:\"Rob\" height_in_cm:175`},\n\t\t// empty map\n\t\t{&pb.MessageWithMap{}, ``},\n\t\t// non-empty map; map format is the same as a repeated struct,\n\t\t// and they are sorted by key (numerically for numeric keys).\n\t\t{\n\t\t\t&pb.MessageWithMap{NameMapping: map[int32]string{\n\t\t\t\t-1:      \"Negatory\",\n\t\t\t\t7:       \"Lucky\",\n\t\t\t\t1234:    \"Feist\",\n\t\t\t\t6345789: \"Otis\",\n\t\t\t}},\n\t\t\t`name_mapping:<key:-1 value:\"Negatory\" > ` +\n\t\t\t\t`name_mapping:<key:7 value:\"Lucky\" > ` +\n\t\t\t\t`name_mapping:<key:1234 value:\"Feist\" > ` +\n\t\t\t\t`name_mapping:<key:6345789 value:\"Otis\" >`,\n\t\t},\n\t\t// map with nil value; not well-defined, but we shouldn't crash\n\t\t{\n\t\t\t&pb.MessageWithMap{MsgMapping: map[int64]*pb.FloatingPoint{7: nil}},\n\t\t\t`msg_mapping:<key:7 >`,\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tgot := strings.TrimSpace(test.m.String())\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"\\n got %s\\nwant %s\", got, test.want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ntest:\n\tcd testdata && make test\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/descriptor/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Not stored here, but descriptor.proto is in https://github.com/google/protobuf/\n# at src/google/protobuf/descriptor.proto\nregenerate:\n\t@echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION\n\tcp $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto .\n\tprotoc --go_out=../../../../.. -I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/descriptor.proto\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/descriptor.proto\n\n/*\nPackage descriptor is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/descriptor.proto\n\nIt has these top-level messages:\n\tFileDescriptorSet\n\tFileDescriptorProto\n\tDescriptorProto\n\tExtensionRangeOptions\n\tFieldDescriptorProto\n\tOneofDescriptorProto\n\tEnumDescriptorProto\n\tEnumValueDescriptorProto\n\tServiceDescriptorProto\n\tMethodDescriptorProto\n\tFileOptions\n\tMessageOptions\n\tFieldOptions\n\tOneofOptions\n\tEnumOptions\n\tEnumValueOptions\n\tServiceOptions\n\tMethodOptions\n\tUninterpretedOption\n\tSourceCodeInfo\n\tGeneratedCodeInfo\n*/\npackage descriptor\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype FieldDescriptorProto_Type int32\n\nconst (\n\t// 0 is reserved for errors.\n\t// Order is weird for historical reasons.\n\tFieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1\n\tFieldDescriptorProto_TYPE_FLOAT  FieldDescriptorProto_Type = 2\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT64  FieldDescriptorProto_Type = 3\n\tFieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT32   FieldDescriptorProto_Type = 5\n\tFieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6\n\tFieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7\n\tFieldDescriptorProto_TYPE_BOOL    FieldDescriptorProto_Type = 8\n\tFieldDescriptorProto_TYPE_STRING  FieldDescriptorProto_Type = 9\n\t// Tag-delimited aggregate.\n\t// Group type is deprecated and not supported in proto3. However, Proto3\n\t// implementations should still be able to parse the group wire format and\n\t// treat group fields as unknown fields.\n\tFieldDescriptorProto_TYPE_GROUP   FieldDescriptorProto_Type = 10\n\tFieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11\n\t// New in version 2.\n\tFieldDescriptorProto_TYPE_BYTES    FieldDescriptorProto_Type = 12\n\tFieldDescriptorProto_TYPE_UINT32   FieldDescriptorProto_Type = 13\n\tFieldDescriptorProto_TYPE_ENUM     FieldDescriptorProto_Type = 14\n\tFieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15\n\tFieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16\n\tFieldDescriptorProto_TYPE_SINT32   FieldDescriptorProto_Type = 17\n\tFieldDescriptorProto_TYPE_SINT64   FieldDescriptorProto_Type = 18\n)\n\nvar FieldDescriptorProto_Type_name = map[int32]string{\n\t1:  \"TYPE_DOUBLE\",\n\t2:  \"TYPE_FLOAT\",\n\t3:  \"TYPE_INT64\",\n\t4:  \"TYPE_UINT64\",\n\t5:  \"TYPE_INT32\",\n\t6:  \"TYPE_FIXED64\",\n\t7:  \"TYPE_FIXED32\",\n\t8:  \"TYPE_BOOL\",\n\t9:  \"TYPE_STRING\",\n\t10: \"TYPE_GROUP\",\n\t11: \"TYPE_MESSAGE\",\n\t12: \"TYPE_BYTES\",\n\t13: \"TYPE_UINT32\",\n\t14: \"TYPE_ENUM\",\n\t15: \"TYPE_SFIXED32\",\n\t16: \"TYPE_SFIXED64\",\n\t17: \"TYPE_SINT32\",\n\t18: \"TYPE_SINT64\",\n}\nvar FieldDescriptorProto_Type_value = map[string]int32{\n\t\"TYPE_DOUBLE\":   1,\n\t\"TYPE_FLOAT\":    2,\n\t\"TYPE_INT64\":    3,\n\t\"TYPE_UINT64\":   4,\n\t\"TYPE_INT32\":    5,\n\t\"TYPE_FIXED64\":  6,\n\t\"TYPE_FIXED32\":  7,\n\t\"TYPE_BOOL\":     8,\n\t\"TYPE_STRING\":   9,\n\t\"TYPE_GROUP\":    10,\n\t\"TYPE_MESSAGE\":  11,\n\t\"TYPE_BYTES\":    12,\n\t\"TYPE_UINT32\":   13,\n\t\"TYPE_ENUM\":     14,\n\t\"TYPE_SFIXED32\": 15,\n\t\"TYPE_SFIXED64\": 16,\n\t\"TYPE_SINT32\":   17,\n\t\"TYPE_SINT64\":   18,\n}\n\nfunc (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type {\n\tp := new(FieldDescriptorProto_Type)\n\t*p = x\n\treturn p\n}\nfunc (x FieldDescriptorProto_Type) String() string {\n\treturn proto.EnumName(FieldDescriptorProto_Type_name, int32(x))\n}\nfunc (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, \"FieldDescriptorProto_Type\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Type(value)\n\treturn nil\n}\nfunc (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} }\n\ntype FieldDescriptorProto_Label int32\n\nconst (\n\t// 0 is reserved for errors\n\tFieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1\n\tFieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2\n\tFieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3\n)\n\nvar FieldDescriptorProto_Label_name = map[int32]string{\n\t1: \"LABEL_OPTIONAL\",\n\t2: \"LABEL_REQUIRED\",\n\t3: \"LABEL_REPEATED\",\n}\nvar FieldDescriptorProto_Label_value = map[string]int32{\n\t\"LABEL_OPTIONAL\": 1,\n\t\"LABEL_REQUIRED\": 2,\n\t\"LABEL_REPEATED\": 3,\n}\n\nfunc (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label {\n\tp := new(FieldDescriptorProto_Label)\n\t*p = x\n\treturn p\n}\nfunc (x FieldDescriptorProto_Label) String() string {\n\treturn proto.EnumName(FieldDescriptorProto_Label_name, int32(x))\n}\nfunc (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, \"FieldDescriptorProto_Label\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Label(value)\n\treturn nil\n}\nfunc (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{4, 1}\n}\n\n// Generated classes can be optimized for speed or code size.\ntype FileOptions_OptimizeMode int32\n\nconst (\n\tFileOptions_SPEED FileOptions_OptimizeMode = 1\n\t// etc.\n\tFileOptions_CODE_SIZE    FileOptions_OptimizeMode = 2\n\tFileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3\n)\n\nvar FileOptions_OptimizeMode_name = map[int32]string{\n\t1: \"SPEED\",\n\t2: \"CODE_SIZE\",\n\t3: \"LITE_RUNTIME\",\n}\nvar FileOptions_OptimizeMode_value = map[string]int32{\n\t\"SPEED\":        1,\n\t\"CODE_SIZE\":    2,\n\t\"LITE_RUNTIME\": 3,\n}\n\nfunc (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode {\n\tp := new(FileOptions_OptimizeMode)\n\t*p = x\n\treturn p\n}\nfunc (x FileOptions_OptimizeMode) String() string {\n\treturn proto.EnumName(FileOptions_OptimizeMode_name, int32(x))\n}\nfunc (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, \"FileOptions_OptimizeMode\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FileOptions_OptimizeMode(value)\n\treturn nil\n}\nfunc (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} }\n\ntype FieldOptions_CType int32\n\nconst (\n\t// Default mode.\n\tFieldOptions_STRING       FieldOptions_CType = 0\n\tFieldOptions_CORD         FieldOptions_CType = 1\n\tFieldOptions_STRING_PIECE FieldOptions_CType = 2\n)\n\nvar FieldOptions_CType_name = map[int32]string{\n\t0: \"STRING\",\n\t1: \"CORD\",\n\t2: \"STRING_PIECE\",\n}\nvar FieldOptions_CType_value = map[string]int32{\n\t\"STRING\":       0,\n\t\"CORD\":         1,\n\t\"STRING_PIECE\": 2,\n}\n\nfunc (x FieldOptions_CType) Enum() *FieldOptions_CType {\n\tp := new(FieldOptions_CType)\n\t*p = x\n\treturn p\n}\nfunc (x FieldOptions_CType) String() string {\n\treturn proto.EnumName(FieldOptions_CType_name, int32(x))\n}\nfunc (x *FieldOptions_CType) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, \"FieldOptions_CType\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_CType(value)\n\treturn nil\n}\nfunc (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} }\n\ntype FieldOptions_JSType int32\n\nconst (\n\t// Use the default type.\n\tFieldOptions_JS_NORMAL FieldOptions_JSType = 0\n\t// Use JavaScript strings.\n\tFieldOptions_JS_STRING FieldOptions_JSType = 1\n\t// Use JavaScript numbers.\n\tFieldOptions_JS_NUMBER FieldOptions_JSType = 2\n)\n\nvar FieldOptions_JSType_name = map[int32]string{\n\t0: \"JS_NORMAL\",\n\t1: \"JS_STRING\",\n\t2: \"JS_NUMBER\",\n}\nvar FieldOptions_JSType_value = map[string]int32{\n\t\"JS_NORMAL\": 0,\n\t\"JS_STRING\": 1,\n\t\"JS_NUMBER\": 2,\n}\n\nfunc (x FieldOptions_JSType) Enum() *FieldOptions_JSType {\n\tp := new(FieldOptions_JSType)\n\t*p = x\n\treturn p\n}\nfunc (x FieldOptions_JSType) String() string {\n\treturn proto.EnumName(FieldOptions_JSType_name, int32(x))\n}\nfunc (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, \"FieldOptions_JSType\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_JSType(value)\n\treturn nil\n}\nfunc (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 1} }\n\n// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n// or neither? HTTP based RPC implementation may choose GET verb for safe\n// methods, and PUT verb for idempotent methods instead of the default POST.\ntype MethodOptions_IdempotencyLevel int32\n\nconst (\n\tMethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0\n\tMethodOptions_NO_SIDE_EFFECTS     MethodOptions_IdempotencyLevel = 1\n\tMethodOptions_IDEMPOTENT          MethodOptions_IdempotencyLevel = 2\n)\n\nvar MethodOptions_IdempotencyLevel_name = map[int32]string{\n\t0: \"IDEMPOTENCY_UNKNOWN\",\n\t1: \"NO_SIDE_EFFECTS\",\n\t2: \"IDEMPOTENT\",\n}\nvar MethodOptions_IdempotencyLevel_value = map[string]int32{\n\t\"IDEMPOTENCY_UNKNOWN\": 0,\n\t\"NO_SIDE_EFFECTS\":     1,\n\t\"IDEMPOTENT\":          2,\n}\n\nfunc (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel {\n\tp := new(MethodOptions_IdempotencyLevel)\n\t*p = x\n\treturn p\n}\nfunc (x MethodOptions_IdempotencyLevel) String() string {\n\treturn proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x))\n}\nfunc (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, \"MethodOptions_IdempotencyLevel\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MethodOptions_IdempotencyLevel(value)\n\treturn nil\n}\nfunc (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{17, 0}\n}\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\ntype FileDescriptorSet struct {\n\tFile             []*FileDescriptorProto `protobuf:\"bytes,1,rep,name=file\" json:\"file,omitempty\"`\n\tXXX_unrecognized []byte                 `json:\"-\"`\n}\n\nfunc (m *FileDescriptorSet) Reset()                    { *m = FileDescriptorSet{} }\nfunc (m *FileDescriptorSet) String() string            { return proto.CompactTextString(m) }\nfunc (*FileDescriptorSet) ProtoMessage()               {}\nfunc (*FileDescriptorSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\nfunc (m *FileDescriptorSet) GetFile() []*FileDescriptorProto {\n\tif m != nil {\n\t\treturn m.File\n\t}\n\treturn nil\n}\n\n// Describes a complete .proto file.\ntype FileDescriptorProto struct {\n\tName    *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tPackage *string `protobuf:\"bytes,2,opt,name=package\" json:\"package,omitempty\"`\n\t// Names of files imported by this file.\n\tDependency []string `protobuf:\"bytes,3,rep,name=dependency\" json:\"dependency,omitempty\"`\n\t// Indexes of the public imported files in the dependency list above.\n\tPublicDependency []int32 `protobuf:\"varint,10,rep,name=public_dependency,json=publicDependency\" json:\"public_dependency,omitempty\"`\n\t// Indexes of the weak imported files in the dependency list.\n\t// For Google-internal migration only. Do not use.\n\tWeakDependency []int32 `protobuf:\"varint,11,rep,name=weak_dependency,json=weakDependency\" json:\"weak_dependency,omitempty\"`\n\t// All top-level definitions in this file.\n\tMessageType []*DescriptorProto        `protobuf:\"bytes,4,rep,name=message_type,json=messageType\" json:\"message_type,omitempty\"`\n\tEnumType    []*EnumDescriptorProto    `protobuf:\"bytes,5,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tService     []*ServiceDescriptorProto `protobuf:\"bytes,6,rep,name=service\" json:\"service,omitempty\"`\n\tExtension   []*FieldDescriptorProto   `protobuf:\"bytes,7,rep,name=extension\" json:\"extension,omitempty\"`\n\tOptions     *FileOptions              `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\t// This field contains optional information about the original source code.\n\t// You may safely remove this entire field without harming runtime\n\t// functionality of the descriptors -- the information is needed only by\n\t// development tools.\n\tSourceCodeInfo *SourceCodeInfo `protobuf:\"bytes,9,opt,name=source_code_info,json=sourceCodeInfo\" json:\"source_code_info,omitempty\"`\n\t// The syntax of the proto file.\n\t// The supported values are \"proto2\" and \"proto3\".\n\tSyntax           *string `protobuf:\"bytes,12,opt,name=syntax\" json:\"syntax,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *FileDescriptorProto) Reset()                    { *m = FileDescriptorProto{} }\nfunc (m *FileDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*FileDescriptorProto) ProtoMessage()               {}\nfunc (*FileDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\nfunc (m *FileDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileDescriptorProto) GetPackage() string {\n\tif m != nil && m.Package != nil {\n\t\treturn *m.Package\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileDescriptorProto) GetDependency() []string {\n\tif m != nil {\n\t\treturn m.Dependency\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetPublicDependency() []int32 {\n\tif m != nil {\n\t\treturn m.PublicDependency\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetWeakDependency() []int32 {\n\tif m != nil {\n\t\treturn m.WeakDependency\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetMessageType() []*DescriptorProto {\n\tif m != nil {\n\t\treturn m.MessageType\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif m != nil {\n\t\treturn m.EnumType\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto {\n\tif m != nil {\n\t\treturn m.Service\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif m != nil {\n\t\treturn m.Extension\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetOptions() *FileOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo {\n\tif m != nil {\n\t\treturn m.SourceCodeInfo\n\t}\n\treturn nil\n}\n\nfunc (m *FileDescriptorProto) GetSyntax() string {\n\tif m != nil && m.Syntax != nil {\n\t\treturn *m.Syntax\n\t}\n\treturn \"\"\n}\n\n// Describes a message type.\ntype DescriptorProto struct {\n\tName           *string                           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tField          []*FieldDescriptorProto           `protobuf:\"bytes,2,rep,name=field\" json:\"field,omitempty\"`\n\tExtension      []*FieldDescriptorProto           `protobuf:\"bytes,6,rep,name=extension\" json:\"extension,omitempty\"`\n\tNestedType     []*DescriptorProto                `protobuf:\"bytes,3,rep,name=nested_type,json=nestedType\" json:\"nested_type,omitempty\"`\n\tEnumType       []*EnumDescriptorProto            `protobuf:\"bytes,4,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tExtensionRange []*DescriptorProto_ExtensionRange `protobuf:\"bytes,5,rep,name=extension_range,json=extensionRange\" json:\"extension_range,omitempty\"`\n\tOneofDecl      []*OneofDescriptorProto           `protobuf:\"bytes,8,rep,name=oneof_decl,json=oneofDecl\" json:\"oneof_decl,omitempty\"`\n\tOptions        *MessageOptions                   `protobuf:\"bytes,7,opt,name=options\" json:\"options,omitempty\"`\n\tReservedRange  []*DescriptorProto_ReservedRange  `protobuf:\"bytes,9,rep,name=reserved_range,json=reservedRange\" json:\"reserved_range,omitempty\"`\n\t// Reserved field names, which may not be used by fields in the same message.\n\t// A given name may only be reserved once.\n\tReservedName     []string `protobuf:\"bytes,10,rep,name=reserved_name,json=reservedName\" json:\"reserved_name,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *DescriptorProto) Reset()                    { *m = DescriptorProto{} }\nfunc (m *DescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*DescriptorProto) ProtoMessage()               {}\nfunc (*DescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\nfunc (m *DescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *DescriptorProto) GetField() []*FieldDescriptorProto {\n\tif m != nil {\n\t\treturn m.Field\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif m != nil {\n\t\treturn m.Extension\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetNestedType() []*DescriptorProto {\n\tif m != nil {\n\t\treturn m.NestedType\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif m != nil {\n\t\treturn m.EnumType\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange {\n\tif m != nil {\n\t\treturn m.ExtensionRange\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto {\n\tif m != nil {\n\t\treturn m.OneofDecl\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetOptions() *MessageOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange {\n\tif m != nil {\n\t\treturn m.ReservedRange\n\t}\n\treturn nil\n}\n\nfunc (m *DescriptorProto) GetReservedName() []string {\n\tif m != nil {\n\t\treturn m.ReservedName\n\t}\n\treturn nil\n}\n\ntype DescriptorProto_ExtensionRange struct {\n\tStart            *int32                 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"`\n\tEnd              *int32                 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`\n\tOptions          *ExtensionRangeOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte                 `json:\"-\"`\n}\n\nfunc (m *DescriptorProto_ExtensionRange) Reset()         { *m = DescriptorProto_ExtensionRange{} }\nfunc (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) }\nfunc (*DescriptorProto_ExtensionRange) ProtoMessage()    {}\nfunc (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{2, 0}\n}\n\nfunc (m *DescriptorProto_ExtensionRange) GetStart() int32 {\n\tif m != nil && m.Start != nil {\n\t\treturn *m.Start\n\t}\n\treturn 0\n}\n\nfunc (m *DescriptorProto_ExtensionRange) GetEnd() int32 {\n\tif m != nil && m.End != nil {\n\t\treturn *m.End\n\t}\n\treturn 0\n}\n\nfunc (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Range of reserved tag numbers. Reserved tag numbers may not be used by\n// fields or extension ranges in the same message. Reserved ranges may\n// not overlap.\ntype DescriptorProto_ReservedRange struct {\n\tStart            *int32 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"`\n\tEnd              *int32 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *DescriptorProto_ReservedRange) Reset()         { *m = DescriptorProto_ReservedRange{} }\nfunc (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) }\nfunc (*DescriptorProto_ReservedRange) ProtoMessage()    {}\nfunc (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{2, 1}\n}\n\nfunc (m *DescriptorProto_ReservedRange) GetStart() int32 {\n\tif m != nil && m.Start != nil {\n\t\treturn *m.Start\n\t}\n\treturn 0\n}\n\nfunc (m *DescriptorProto_ReservedRange) GetEnd() int32 {\n\tif m != nil && m.End != nil {\n\t\treturn *m.End\n\t}\n\treturn 0\n}\n\ntype ExtensionRangeOptions struct {\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *ExtensionRangeOptions) Reset()                    { *m = ExtensionRangeOptions{} }\nfunc (m *ExtensionRangeOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*ExtensionRangeOptions) ProtoMessage()               {}\nfunc (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\n\nvar extRange_ExtensionRangeOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_ExtensionRangeOptions\n}\n\nfunc (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// Describes a field within a message.\ntype FieldDescriptorProto struct {\n\tName   *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber *int32                      `protobuf:\"varint,3,opt,name=number\" json:\"number,omitempty\"`\n\tLabel  *FieldDescriptorProto_Label `protobuf:\"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label\" json:\"label,omitempty\"`\n\t// If type_name is set, this need not be set.  If both this and type_name\n\t// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n\tType *FieldDescriptorProto_Type `protobuf:\"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type\" json:\"type,omitempty\"`\n\t// For message and enum types, this is the name of the type.  If the name\n\t// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n\t// rules are used to find the type (i.e. first the nested types within this\n\t// message are searched, then within the parent, on up to the root\n\t// namespace).\n\tTypeName *string `protobuf:\"bytes,6,opt,name=type_name,json=typeName\" json:\"type_name,omitempty\"`\n\t// For extensions, this is the name of the type being extended.  It is\n\t// resolved in the same manner as type_name.\n\tExtendee *string `protobuf:\"bytes,2,opt,name=extendee\" json:\"extendee,omitempty\"`\n\t// For numeric types, contains the original text representation of the value.\n\t// For booleans, \"true\" or \"false\".\n\t// For strings, contains the default text contents (not escaped in any way).\n\t// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n\t// TODO(kenton):  Base-64 encode?\n\tDefaultValue *string `protobuf:\"bytes,7,opt,name=default_value,json=defaultValue\" json:\"default_value,omitempty\"`\n\t// If set, gives the index of a oneof in the containing type's oneof_decl\n\t// list.  This field is a member of that oneof.\n\tOneofIndex *int32 `protobuf:\"varint,9,opt,name=oneof_index,json=oneofIndex\" json:\"oneof_index,omitempty\"`\n\t// JSON name of this field. The value is set by protocol compiler. If the\n\t// user has set a \"json_name\" option on this field, that option's value\n\t// will be used. Otherwise, it's deduced from the field's name by converting\n\t// it to camelCase.\n\tJsonName         *string       `protobuf:\"bytes,10,opt,name=json_name,json=jsonName\" json:\"json_name,omitempty\"`\n\tOptions          *FieldOptions `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte        `json:\"-\"`\n}\n\nfunc (m *FieldDescriptorProto) Reset()                    { *m = FieldDescriptorProto{} }\nfunc (m *FieldDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*FieldDescriptorProto) ProtoMessage()               {}\nfunc (*FieldDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }\n\nfunc (m *FieldDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *FieldDescriptorProto) GetNumber() int32 {\n\tif m != nil && m.Number != nil {\n\t\treturn *m.Number\n\t}\n\treturn 0\n}\n\nfunc (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {\n\tif m != nil && m.Label != nil {\n\t\treturn *m.Label\n\t}\n\treturn FieldDescriptorProto_LABEL_OPTIONAL\n}\n\nfunc (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {\n\tif m != nil && m.Type != nil {\n\t\treturn *m.Type\n\t}\n\treturn FieldDescriptorProto_TYPE_DOUBLE\n}\n\nfunc (m *FieldDescriptorProto) GetTypeName() string {\n\tif m != nil && m.TypeName != nil {\n\t\treturn *m.TypeName\n\t}\n\treturn \"\"\n}\n\nfunc (m *FieldDescriptorProto) GetExtendee() string {\n\tif m != nil && m.Extendee != nil {\n\t\treturn *m.Extendee\n\t}\n\treturn \"\"\n}\n\nfunc (m *FieldDescriptorProto) GetDefaultValue() string {\n\tif m != nil && m.DefaultValue != nil {\n\t\treturn *m.DefaultValue\n\t}\n\treturn \"\"\n}\n\nfunc (m *FieldDescriptorProto) GetOneofIndex() int32 {\n\tif m != nil && m.OneofIndex != nil {\n\t\treturn *m.OneofIndex\n\t}\n\treturn 0\n}\n\nfunc (m *FieldDescriptorProto) GetJsonName() string {\n\tif m != nil && m.JsonName != nil {\n\t\treturn *m.JsonName\n\t}\n\treturn \"\"\n}\n\nfunc (m *FieldDescriptorProto) GetOptions() *FieldOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Describes a oneof.\ntype OneofDescriptorProto struct {\n\tName             *string       `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tOptions          *OneofOptions `protobuf:\"bytes,2,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte        `json:\"-\"`\n}\n\nfunc (m *OneofDescriptorProto) Reset()                    { *m = OneofDescriptorProto{} }\nfunc (m *OneofDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*OneofDescriptorProto) ProtoMessage()               {}\nfunc (*OneofDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }\n\nfunc (m *OneofDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *OneofDescriptorProto) GetOptions() *OneofOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Describes an enum type.\ntype EnumDescriptorProto struct {\n\tName             *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tValue            []*EnumValueDescriptorProto `protobuf:\"bytes,2,rep,name=value\" json:\"value,omitempty\"`\n\tOptions          *EnumOptions                `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte                      `json:\"-\"`\n}\n\nfunc (m *EnumDescriptorProto) Reset()                    { *m = EnumDescriptorProto{} }\nfunc (m *EnumDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*EnumDescriptorProto) ProtoMessage()               {}\nfunc (*EnumDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }\n\nfunc (m *EnumDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn nil\n}\n\nfunc (m *EnumDescriptorProto) GetOptions() *EnumOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Describes a value within an enum.\ntype EnumValueDescriptorProto struct {\n\tName             *string           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber           *int32            `protobuf:\"varint,2,opt,name=number\" json:\"number,omitempty\"`\n\tOptions          *EnumValueOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte            `json:\"-\"`\n}\n\nfunc (m *EnumValueDescriptorProto) Reset()                    { *m = EnumValueDescriptorProto{} }\nfunc (m *EnumValueDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*EnumValueDescriptorProto) ProtoMessage()               {}\nfunc (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }\n\nfunc (m *EnumValueDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *EnumValueDescriptorProto) GetNumber() int32 {\n\tif m != nil && m.Number != nil {\n\t\treturn *m.Number\n\t}\n\treturn 0\n}\n\nfunc (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Describes a service.\ntype ServiceDescriptorProto struct {\n\tName             *string                  `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tMethod           []*MethodDescriptorProto `protobuf:\"bytes,2,rep,name=method\" json:\"method,omitempty\"`\n\tOptions          *ServiceOptions          `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\tXXX_unrecognized []byte                   `json:\"-\"`\n}\n\nfunc (m *ServiceDescriptorProto) Reset()                    { *m = ServiceDescriptorProto{} }\nfunc (m *ServiceDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*ServiceDescriptorProto) ProtoMessage()               {}\nfunc (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }\n\nfunc (m *ServiceDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto {\n\tif m != nil {\n\t\treturn m.Method\n\t}\n\treturn nil\n}\n\nfunc (m *ServiceDescriptorProto) GetOptions() *ServiceOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\n// Describes a method of a service.\ntype MethodDescriptorProto struct {\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// Input and output type names.  These are resolved in the same way as\n\t// FieldDescriptorProto.type_name, but must refer to a message type.\n\tInputType  *string        `protobuf:\"bytes,2,opt,name=input_type,json=inputType\" json:\"input_type,omitempty\"`\n\tOutputType *string        `protobuf:\"bytes,3,opt,name=output_type,json=outputType\" json:\"output_type,omitempty\"`\n\tOptions    *MethodOptions `protobuf:\"bytes,4,opt,name=options\" json:\"options,omitempty\"`\n\t// Identifies if client streams multiple client messages\n\tClientStreaming *bool `protobuf:\"varint,5,opt,name=client_streaming,json=clientStreaming,def=0\" json:\"client_streaming,omitempty\"`\n\t// Identifies if server streams multiple server messages\n\tServerStreaming  *bool  `protobuf:\"varint,6,opt,name=server_streaming,json=serverStreaming,def=0\" json:\"server_streaming,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *MethodDescriptorProto) Reset()                    { *m = MethodDescriptorProto{} }\nfunc (m *MethodDescriptorProto) String() string            { return proto.CompactTextString(m) }\nfunc (*MethodDescriptorProto) ProtoMessage()               {}\nfunc (*MethodDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }\n\nconst Default_MethodDescriptorProto_ClientStreaming bool = false\nconst Default_MethodDescriptorProto_ServerStreaming bool = false\n\nfunc (m *MethodDescriptorProto) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *MethodDescriptorProto) GetInputType() string {\n\tif m != nil && m.InputType != nil {\n\t\treturn *m.InputType\n\t}\n\treturn \"\"\n}\n\nfunc (m *MethodDescriptorProto) GetOutputType() string {\n\tif m != nil && m.OutputType != nil {\n\t\treturn *m.OutputType\n\t}\n\treturn \"\"\n}\n\nfunc (m *MethodDescriptorProto) GetOptions() *MethodOptions {\n\tif m != nil {\n\t\treturn m.Options\n\t}\n\treturn nil\n}\n\nfunc (m *MethodDescriptorProto) GetClientStreaming() bool {\n\tif m != nil && m.ClientStreaming != nil {\n\t\treturn *m.ClientStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ClientStreaming\n}\n\nfunc (m *MethodDescriptorProto) GetServerStreaming() bool {\n\tif m != nil && m.ServerStreaming != nil {\n\t\treturn *m.ServerStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ServerStreaming\n}\n\ntype FileOptions struct {\n\t// Sets the Java package where classes generated from this .proto will be\n\t// placed.  By default, the proto package is used, but this is often\n\t// inappropriate because proto packages do not normally start with backwards\n\t// domain names.\n\tJavaPackage *string `protobuf:\"bytes,1,opt,name=java_package,json=javaPackage\" json:\"java_package,omitempty\"`\n\t// If set, all the classes from the .proto file are wrapped in a single\n\t// outer class with the given name.  This applies to both Proto1\n\t// (equivalent to the old \"--one_java_file\" option) and Proto2 (where\n\t// a .proto always translates to a single class, but you may want to\n\t// explicitly choose the class name).\n\tJavaOuterClassname *string `protobuf:\"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname\" json:\"java_outer_classname,omitempty\"`\n\t// If set true, then the Java code generator will generate a separate .java\n\t// file for each top-level message, enum, and service defined in the .proto\n\t// file.  Thus, these types will *not* be nested inside the outer class\n\t// named by java_outer_classname.  However, the outer class will still be\n\t// generated to contain the file's getDescriptor() method as well as any\n\t// top-level extensions defined in the file.\n\tJavaMultipleFiles *bool `protobuf:\"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0\" json:\"java_multiple_files,omitempty\"`\n\t// This option does nothing.\n\tJavaGenerateEqualsAndHash *bool `protobuf:\"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash\" json:\"java_generate_equals_and_hash,omitempty\"`\n\t// If set true, then the Java2 code generator will generate code that\n\t// throws an exception whenever an attempt is made to assign a non-UTF-8\n\t// byte sequence to a string field.\n\t// Message reflection will do the same.\n\t// However, an extension field still accepts non-UTF-8 byte sequences.\n\t// This option has no effect on when used with the lite runtime.\n\tJavaStringCheckUtf8 *bool                     `protobuf:\"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0\" json:\"java_string_check_utf8,omitempty\"`\n\tOptimizeFor         *FileOptions_OptimizeMode `protobuf:\"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1\" json:\"optimize_for,omitempty\"`\n\t// Sets the Go package where structs generated from this .proto will be\n\t// placed. If omitted, the Go package will be derived from the following:\n\t//   - The basename of the package import path, if provided.\n\t//   - Otherwise, the package statement in the .proto file, if present.\n\t//   - Otherwise, the basename of the .proto file, without extension.\n\tGoPackage *string `protobuf:\"bytes,11,opt,name=go_package,json=goPackage\" json:\"go_package,omitempty\"`\n\t// Should generic services be generated in each language?  \"Generic\" services\n\t// are not specific to any particular RPC system.  They are generated by the\n\t// main code generators in each language (without additional plugins).\n\t// Generic services were the only kind of service generation supported by\n\t// early versions of google.protobuf.\n\t//\n\t// Generic services are now considered deprecated in favor of using plugins\n\t// that generate code specific to your particular RPC system.  Therefore,\n\t// these default to false.  Old code which depends on generic services should\n\t// explicitly set them to true.\n\tCcGenericServices   *bool `protobuf:\"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0\" json:\"cc_generic_services,omitempty\"`\n\tJavaGenericServices *bool `protobuf:\"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0\" json:\"java_generic_services,omitempty\"`\n\tPyGenericServices   *bool `protobuf:\"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0\" json:\"py_generic_services,omitempty\"`\n\tPhpGenericServices  *bool `protobuf:\"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0\" json:\"php_generic_services,omitempty\"`\n\t// Is this file deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for everything in the file, or it will be completely ignored; in the very\n\t// least, this is a formalization for deprecating files.\n\tDeprecated *bool `protobuf:\"varint,23,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Enables the use of arenas for the proto messages in this file. This applies\n\t// only to generated classes for C++.\n\tCcEnableArenas *bool `protobuf:\"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0\" json:\"cc_enable_arenas,omitempty\"`\n\t// Sets the objective c class prefix which is prepended to all objective c\n\t// generated classes from this .proto. There is no default.\n\tObjcClassPrefix *string `protobuf:\"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix\" json:\"objc_class_prefix,omitempty\"`\n\t// Namespace for generated classes; defaults to the package.\n\tCsharpNamespace *string `protobuf:\"bytes,37,opt,name=csharp_namespace,json=csharpNamespace\" json:\"csharp_namespace,omitempty\"`\n\t// By default Swift generators will take the proto package and CamelCase it\n\t// replacing '.' with underscore and use that to prefix the types/symbols\n\t// defined. When this options is provided, they will use this value instead\n\t// to prefix the types/symbols defined.\n\tSwiftPrefix *string `protobuf:\"bytes,39,opt,name=swift_prefix,json=swiftPrefix\" json:\"swift_prefix,omitempty\"`\n\t// Sets the php class prefix which is prepended to all php generated classes\n\t// from this .proto. Default is empty.\n\tPhpClassPrefix *string `protobuf:\"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix\" json:\"php_class_prefix,omitempty\"`\n\t// Use this option to change the namespace of php generated classes. Default\n\t// is empty. When this option is empty, the package name will be used for\n\t// determining the namespace.\n\tPhpNamespace *string `protobuf:\"bytes,41,opt,name=php_namespace,json=phpNamespace\" json:\"php_namespace,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *FileOptions) Reset()                    { *m = FileOptions{} }\nfunc (m *FileOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*FileOptions) ProtoMessage()               {}\nfunc (*FileOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }\n\nvar extRange_FileOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_FileOptions\n}\n\nconst Default_FileOptions_JavaMultipleFiles bool = false\nconst Default_FileOptions_JavaStringCheckUtf8 bool = false\nconst Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED\nconst Default_FileOptions_CcGenericServices bool = false\nconst Default_FileOptions_JavaGenericServices bool = false\nconst Default_FileOptions_PyGenericServices bool = false\nconst Default_FileOptions_PhpGenericServices bool = false\nconst Default_FileOptions_Deprecated bool = false\nconst Default_FileOptions_CcEnableArenas bool = false\n\nfunc (m *FileOptions) GetJavaPackage() string {\n\tif m != nil && m.JavaPackage != nil {\n\t\treturn *m.JavaPackage\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetJavaOuterClassname() string {\n\tif m != nil && m.JavaOuterClassname != nil {\n\t\treturn *m.JavaOuterClassname\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetJavaMultipleFiles() bool {\n\tif m != nil && m.JavaMultipleFiles != nil {\n\t\treturn *m.JavaMultipleFiles\n\t}\n\treturn Default_FileOptions_JavaMultipleFiles\n}\n\nfunc (m *FileOptions) GetJavaGenerateEqualsAndHash() bool {\n\tif m != nil && m.JavaGenerateEqualsAndHash != nil {\n\t\treturn *m.JavaGenerateEqualsAndHash\n\t}\n\treturn false\n}\n\nfunc (m *FileOptions) GetJavaStringCheckUtf8() bool {\n\tif m != nil && m.JavaStringCheckUtf8 != nil {\n\t\treturn *m.JavaStringCheckUtf8\n\t}\n\treturn Default_FileOptions_JavaStringCheckUtf8\n}\n\nfunc (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {\n\tif m != nil && m.OptimizeFor != nil {\n\t\treturn *m.OptimizeFor\n\t}\n\treturn Default_FileOptions_OptimizeFor\n}\n\nfunc (m *FileOptions) GetGoPackage() string {\n\tif m != nil && m.GoPackage != nil {\n\t\treturn *m.GoPackage\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetCcGenericServices() bool {\n\tif m != nil && m.CcGenericServices != nil {\n\t\treturn *m.CcGenericServices\n\t}\n\treturn Default_FileOptions_CcGenericServices\n}\n\nfunc (m *FileOptions) GetJavaGenericServices() bool {\n\tif m != nil && m.JavaGenericServices != nil {\n\t\treturn *m.JavaGenericServices\n\t}\n\treturn Default_FileOptions_JavaGenericServices\n}\n\nfunc (m *FileOptions) GetPyGenericServices() bool {\n\tif m != nil && m.PyGenericServices != nil {\n\t\treturn *m.PyGenericServices\n\t}\n\treturn Default_FileOptions_PyGenericServices\n}\n\nfunc (m *FileOptions) GetPhpGenericServices() bool {\n\tif m != nil && m.PhpGenericServices != nil {\n\t\treturn *m.PhpGenericServices\n\t}\n\treturn Default_FileOptions_PhpGenericServices\n}\n\nfunc (m *FileOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_FileOptions_Deprecated\n}\n\nfunc (m *FileOptions) GetCcEnableArenas() bool {\n\tif m != nil && m.CcEnableArenas != nil {\n\t\treturn *m.CcEnableArenas\n\t}\n\treturn Default_FileOptions_CcEnableArenas\n}\n\nfunc (m *FileOptions) GetObjcClassPrefix() string {\n\tif m != nil && m.ObjcClassPrefix != nil {\n\t\treturn *m.ObjcClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetCsharpNamespace() string {\n\tif m != nil && m.CsharpNamespace != nil {\n\t\treturn *m.CsharpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetSwiftPrefix() string {\n\tif m != nil && m.SwiftPrefix != nil {\n\t\treturn *m.SwiftPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetPhpClassPrefix() string {\n\tif m != nil && m.PhpClassPrefix != nil {\n\t\treturn *m.PhpClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetPhpNamespace() string {\n\tif m != nil && m.PhpNamespace != nil {\n\t\treturn *m.PhpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MessageOptions struct {\n\t// Set true to use the old proto1 MessageSet wire format for extensions.\n\t// This is provided for backwards-compatibility with the MessageSet wire\n\t// format.  You should not use this for any other reason:  It's less\n\t// efficient, has fewer features, and is more complicated.\n\t//\n\t// The message must be defined exactly as follows:\n\t//   message Foo {\n\t//     option message_set_wire_format = true;\n\t//     extensions 4 to max;\n\t//   }\n\t// Note that the message cannot have any defined fields; MessageSets only\n\t// have extensions.\n\t//\n\t// All extensions of your type must be singular messages; e.g. they cannot\n\t// be int32s, enums, or repeated messages.\n\t//\n\t// Because this is an option, the above two restrictions are not enforced by\n\t// the protocol compiler.\n\tMessageSetWireFormat *bool `protobuf:\"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0\" json:\"message_set_wire_format,omitempty\"`\n\t// Disables the generation of the standard \"descriptor()\" accessor, which can\n\t// conflict with a field of the same name.  This is meant to make migration\n\t// from proto1 easier; new code should avoid fields named \"descriptor\".\n\tNoStandardDescriptorAccessor *bool `protobuf:\"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0\" json:\"no_standard_descriptor_accessor,omitempty\"`\n\t// Is this message deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the message, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating messages.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Whether the message is an automatically generated map entry type for the\n\t// maps field.\n\t//\n\t// For maps fields:\n\t//     map<KeyType, ValueType> map_field = 1;\n\t// The parsed descriptor looks like:\n\t//     message MapFieldEntry {\n\t//         option map_entry = true;\n\t//         optional KeyType key = 1;\n\t//         optional ValueType value = 2;\n\t//     }\n\t//     repeated MapFieldEntry map_field = 1;\n\t//\n\t// Implementations may choose not to generate the map_entry=true message, but\n\t// use a native map in the target language to hold the keys and values.\n\t// The reflection APIs in such implementions still need to work as\n\t// if the field is a repeated message field.\n\t//\n\t// NOTE: Do not set the option in .proto files. Always use the maps syntax\n\t// instead. The option should only be implicitly set by the proto compiler\n\t// parser.\n\tMapEntry *bool `protobuf:\"varint,7,opt,name=map_entry,json=mapEntry\" json:\"map_entry,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *MessageOptions) Reset()                    { *m = MessageOptions{} }\nfunc (m *MessageOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*MessageOptions) ProtoMessage()               {}\nfunc (*MessageOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }\n\nvar extRange_MessageOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_MessageOptions\n}\n\nconst Default_MessageOptions_MessageSetWireFormat bool = false\nconst Default_MessageOptions_NoStandardDescriptorAccessor bool = false\nconst Default_MessageOptions_Deprecated bool = false\n\nfunc (m *MessageOptions) GetMessageSetWireFormat() bool {\n\tif m != nil && m.MessageSetWireFormat != nil {\n\t\treturn *m.MessageSetWireFormat\n\t}\n\treturn Default_MessageOptions_MessageSetWireFormat\n}\n\nfunc (m *MessageOptions) GetNoStandardDescriptorAccessor() bool {\n\tif m != nil && m.NoStandardDescriptorAccessor != nil {\n\t\treturn *m.NoStandardDescriptorAccessor\n\t}\n\treturn Default_MessageOptions_NoStandardDescriptorAccessor\n}\n\nfunc (m *MessageOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_MessageOptions_Deprecated\n}\n\nfunc (m *MessageOptions) GetMapEntry() bool {\n\tif m != nil && m.MapEntry != nil {\n\t\treturn *m.MapEntry\n\t}\n\treturn false\n}\n\nfunc (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype FieldOptions struct {\n\t// The ctype option instructs the C++ code generator to use a different\n\t// representation of the field than it normally would.  See the specific\n\t// options below.  This option is not yet implemented in the open source\n\t// release -- sorry, we'll try to include it in a future version!\n\tCtype *FieldOptions_CType `protobuf:\"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0\" json:\"ctype,omitempty\"`\n\t// The packed option can be enabled for repeated primitive fields to enable\n\t// a more efficient representation on the wire. Rather than repeatedly\n\t// writing the tag and type for each element, the entire array is encoded as\n\t// a single length-delimited blob. In proto3, only explicit setting it to\n\t// false will avoid using packed encoding.\n\tPacked *bool `protobuf:\"varint,2,opt,name=packed\" json:\"packed,omitempty\"`\n\t// The jstype option determines the JavaScript type used for values of the\n\t// field.  The option is permitted only for 64 bit integral and fixed types\n\t// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING\n\t// is represented as JavaScript string, which avoids loss of precision that\n\t// can happen when a large value is converted to a floating point JavaScript.\n\t// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n\t// use the JavaScript \"number\" type.  The behavior of the default option\n\t// JS_NORMAL is implementation dependent.\n\t//\n\t// This option is an enum to permit additional types to be added, e.g.\n\t// goog.math.Integer.\n\tJstype *FieldOptions_JSType `protobuf:\"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0\" json:\"jstype,omitempty\"`\n\t// Should this field be parsed lazily?  Lazy applies only to message-type\n\t// fields.  It means that when the outer message is initially parsed, the\n\t// inner message's contents will not be parsed but instead stored in encoded\n\t// form.  The inner message will actually be parsed when it is first accessed.\n\t//\n\t// This is only a hint.  Implementations are free to choose whether to use\n\t// eager or lazy parsing regardless of the value of this option.  However,\n\t// setting this option true suggests that the protocol author believes that\n\t// using lazy parsing on this field is worth the additional bookkeeping\n\t// overhead typically needed to implement it.\n\t//\n\t// This option does not affect the public interface of any generated code;\n\t// all method signatures remain the same.  Furthermore, thread-safety of the\n\t// interface is not affected by this option; const methods remain safe to\n\t// call from multiple threads concurrently, while non-const methods continue\n\t// to require exclusive access.\n\t//\n\t//\n\t// Note that implementations may choose not to check required fields within\n\t// a lazy sub-message.  That is, calling IsInitialized() on the outer message\n\t// may return true even if the inner message has missing required fields.\n\t// This is necessary because otherwise the inner message would have to be\n\t// parsed in order to perform the check, defeating the purpose of lazy\n\t// parsing.  An implementation which chooses not to check required fields\n\t// must be consistent about it.  That is, for any particular sub-message, the\n\t// implementation must either *always* check its required fields, or *never*\n\t// check its required fields, regardless of whether or not the message has\n\t// been parsed.\n\tLazy *bool `protobuf:\"varint,5,opt,name=lazy,def=0\" json:\"lazy,omitempty\"`\n\t// Is this field deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for accessors, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating fields.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// For Google-internal migration only. Do not use.\n\tWeak *bool `protobuf:\"varint,10,opt,name=weak,def=0\" json:\"weak,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *FieldOptions) Reset()                    { *m = FieldOptions{} }\nfunc (m *FieldOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*FieldOptions) ProtoMessage()               {}\nfunc (*FieldOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }\n\nvar extRange_FieldOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_FieldOptions\n}\n\nconst Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING\nconst Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL\nconst Default_FieldOptions_Lazy bool = false\nconst Default_FieldOptions_Deprecated bool = false\nconst Default_FieldOptions_Weak bool = false\n\nfunc (m *FieldOptions) GetCtype() FieldOptions_CType {\n\tif m != nil && m.Ctype != nil {\n\t\treturn *m.Ctype\n\t}\n\treturn Default_FieldOptions_Ctype\n}\n\nfunc (m *FieldOptions) GetPacked() bool {\n\tif m != nil && m.Packed != nil {\n\t\treturn *m.Packed\n\t}\n\treturn false\n}\n\nfunc (m *FieldOptions) GetJstype() FieldOptions_JSType {\n\tif m != nil && m.Jstype != nil {\n\t\treturn *m.Jstype\n\t}\n\treturn Default_FieldOptions_Jstype\n}\n\nfunc (m *FieldOptions) GetLazy() bool {\n\tif m != nil && m.Lazy != nil {\n\t\treturn *m.Lazy\n\t}\n\treturn Default_FieldOptions_Lazy\n}\n\nfunc (m *FieldOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_FieldOptions_Deprecated\n}\n\nfunc (m *FieldOptions) GetWeak() bool {\n\tif m != nil && m.Weak != nil {\n\t\treturn *m.Weak\n\t}\n\treturn Default_FieldOptions_Weak\n}\n\nfunc (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype OneofOptions struct {\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OneofOptions) Reset()                    { *m = OneofOptions{} }\nfunc (m *OneofOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*OneofOptions) ProtoMessage()               {}\nfunc (*OneofOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }\n\nvar extRange_OneofOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OneofOptions\n}\n\nfunc (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumOptions struct {\n\t// Set this option to true to allow mapping different tag names to the same\n\t// value.\n\tAllowAlias *bool `protobuf:\"varint,2,opt,name=allow_alias,json=allowAlias\" json:\"allow_alias,omitempty\"`\n\t// Is this enum deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating enums.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *EnumOptions) Reset()                    { *m = EnumOptions{} }\nfunc (m *EnumOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*EnumOptions) ProtoMessage()               {}\nfunc (*EnumOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }\n\nvar extRange_EnumOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_EnumOptions\n}\n\nconst Default_EnumOptions_Deprecated bool = false\n\nfunc (m *EnumOptions) GetAllowAlias() bool {\n\tif m != nil && m.AllowAlias != nil {\n\t\treturn *m.AllowAlias\n\t}\n\treturn false\n}\n\nfunc (m *EnumOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_EnumOptions_Deprecated\n}\n\nfunc (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumValueOptions struct {\n\t// Is this enum value deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum value, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating enum values.\n\tDeprecated *bool `protobuf:\"varint,1,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *EnumValueOptions) Reset()                    { *m = EnumValueOptions{} }\nfunc (m *EnumValueOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*EnumValueOptions) ProtoMessage()               {}\nfunc (*EnumValueOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }\n\nvar extRange_EnumValueOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_EnumValueOptions\n}\n\nconst Default_EnumValueOptions_Deprecated bool = false\n\nfunc (m *EnumValueOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_EnumValueOptions_Deprecated\n}\n\nfunc (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype ServiceOptions struct {\n\t// Is this service deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the service, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating services.\n\tDeprecated *bool `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *ServiceOptions) Reset()                    { *m = ServiceOptions{} }\nfunc (m *ServiceOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*ServiceOptions) ProtoMessage()               {}\nfunc (*ServiceOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }\n\nvar extRange_ServiceOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_ServiceOptions\n}\n\nconst Default_ServiceOptions_Deprecated bool = false\n\nfunc (m *ServiceOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_ServiceOptions_Deprecated\n}\n\nfunc (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MethodOptions struct {\n\t// Is this method deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the method, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating methods.\n\tDeprecated       *bool                           `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\tIdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:\"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0\" json:\"idempotency_level,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption          []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *MethodOptions) Reset()                    { *m = MethodOptions{} }\nfunc (m *MethodOptions) String() string            { return proto.CompactTextString(m) }\nfunc (*MethodOptions) ProtoMessage()               {}\nfunc (*MethodOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }\n\nvar extRange_MethodOptions = []proto.ExtensionRange{\n\t{1000, 536870911},\n}\n\nfunc (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_MethodOptions\n}\n\nconst Default_MethodOptions_Deprecated bool = false\nconst Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN\n\nfunc (m *MethodOptions) GetDeprecated() bool {\n\tif m != nil && m.Deprecated != nil {\n\t\treturn *m.Deprecated\n\t}\n\treturn Default_MethodOptions_Deprecated\n}\n\nfunc (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel {\n\tif m != nil && m.IdempotencyLevel != nil {\n\t\treturn *m.IdempotencyLevel\n\t}\n\treturn Default_MethodOptions_IdempotencyLevel\n}\n\nfunc (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif m != nil {\n\t\treturn m.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\ntype UninterpretedOption struct {\n\tName []*UninterpretedOption_NamePart `protobuf:\"bytes,2,rep,name=name\" json:\"name,omitempty\"`\n\t// The value of the uninterpreted option, in whatever type the tokenizer\n\t// identified it as during parsing. Exactly one of these should be set.\n\tIdentifierValue  *string  `protobuf:\"bytes,3,opt,name=identifier_value,json=identifierValue\" json:\"identifier_value,omitempty\"`\n\tPositiveIntValue *uint64  `protobuf:\"varint,4,opt,name=positive_int_value,json=positiveIntValue\" json:\"positive_int_value,omitempty\"`\n\tNegativeIntValue *int64   `protobuf:\"varint,5,opt,name=negative_int_value,json=negativeIntValue\" json:\"negative_int_value,omitempty\"`\n\tDoubleValue      *float64 `protobuf:\"fixed64,6,opt,name=double_value,json=doubleValue\" json:\"double_value,omitempty\"`\n\tStringValue      []byte   `protobuf:\"bytes,7,opt,name=string_value,json=stringValue\" json:\"string_value,omitempty\"`\n\tAggregateValue   *string  `protobuf:\"bytes,8,opt,name=aggregate_value,json=aggregateValue\" json:\"aggregate_value,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *UninterpretedOption) Reset()                    { *m = UninterpretedOption{} }\nfunc (m *UninterpretedOption) String() string            { return proto.CompactTextString(m) }\nfunc (*UninterpretedOption) ProtoMessage()               {}\nfunc (*UninterpretedOption) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }\n\nfunc (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart {\n\tif m != nil {\n\t\treturn m.Name\n\t}\n\treturn nil\n}\n\nfunc (m *UninterpretedOption) GetIdentifierValue() string {\n\tif m != nil && m.IdentifierValue != nil {\n\t\treturn *m.IdentifierValue\n\t}\n\treturn \"\"\n}\n\nfunc (m *UninterpretedOption) GetPositiveIntValue() uint64 {\n\tif m != nil && m.PositiveIntValue != nil {\n\t\treturn *m.PositiveIntValue\n\t}\n\treturn 0\n}\n\nfunc (m *UninterpretedOption) GetNegativeIntValue() int64 {\n\tif m != nil && m.NegativeIntValue != nil {\n\t\treturn *m.NegativeIntValue\n\t}\n\treturn 0\n}\n\nfunc (m *UninterpretedOption) GetDoubleValue() float64 {\n\tif m != nil && m.DoubleValue != nil {\n\t\treturn *m.DoubleValue\n\t}\n\treturn 0\n}\n\nfunc (m *UninterpretedOption) GetStringValue() []byte {\n\tif m != nil {\n\t\treturn m.StringValue\n\t}\n\treturn nil\n}\n\nfunc (m *UninterpretedOption) GetAggregateValue() string {\n\tif m != nil && m.AggregateValue != nil {\n\t\treturn *m.AggregateValue\n\t}\n\treturn \"\"\n}\n\n// The name of the uninterpreted option.  Each string represents a segment in\n// a dot-separated name.  is_extension is true iff a segment represents an\n// extension (denoted with parentheses in options specs in .proto files).\n// E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n// \"foo.(bar.baz).qux\".\ntype UninterpretedOption_NamePart struct {\n\tNamePart         *string `protobuf:\"bytes,1,req,name=name_part,json=namePart\" json:\"name_part,omitempty\"`\n\tIsExtension      *bool   `protobuf:\"varint,2,req,name=is_extension,json=isExtension\" json:\"is_extension,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *UninterpretedOption_NamePart) Reset()         { *m = UninterpretedOption_NamePart{} }\nfunc (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) }\nfunc (*UninterpretedOption_NamePart) ProtoMessage()    {}\nfunc (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{18, 0}\n}\n\nfunc (m *UninterpretedOption_NamePart) GetNamePart() string {\n\tif m != nil && m.NamePart != nil {\n\t\treturn *m.NamePart\n\t}\n\treturn \"\"\n}\n\nfunc (m *UninterpretedOption_NamePart) GetIsExtension() bool {\n\tif m != nil && m.IsExtension != nil {\n\t\treturn *m.IsExtension\n\t}\n\treturn false\n}\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\ntype SourceCodeInfo struct {\n\t// A Location identifies a piece of source code in a .proto file which\n\t// corresponds to a particular definition.  This information is intended\n\t// to be useful to IDEs, code indexers, documentation generators, and similar\n\t// tools.\n\t//\n\t// For example, say we have a file like:\n\t//   message Foo {\n\t//     optional string foo = 1;\n\t//   }\n\t// Let's look at just the field definition:\n\t//   optional string foo = 1;\n\t//   ^       ^^     ^^  ^  ^^^\n\t//   a       bc     de  f  ghi\n\t// We have the following locations:\n\t//   span   path               represents\n\t//   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n\t//   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n\t//   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n\t//   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n\t//   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n\t//\n\t// Notes:\n\t// - A location may refer to a repeated field itself (i.e. not to any\n\t//   particular index within it).  This is used whenever a set of elements are\n\t//   logically enclosed in a single code segment.  For example, an entire\n\t//   extend block (possibly containing multiple extension definitions) will\n\t//   have an outer location whose path refers to the \"extensions\" repeated\n\t//   field without an index.\n\t// - Multiple locations may have the same path.  This happens when a single\n\t//   logical declaration is spread out across multiple places.  The most\n\t//   obvious example is the \"extend\" block again -- there may be multiple\n\t//   extend blocks in the same scope, each of which will have the same path.\n\t// - A location's span is not always a subset of its parent's span.  For\n\t//   example, the \"extendee\" of an extension declaration appears at the\n\t//   beginning of the \"extend\" block and is shared by all extensions within\n\t//   the block.\n\t// - Just because a location's span is a subset of some other location's span\n\t//   does not mean that it is a descendent.  For example, a \"group\" defines\n\t//   both a type and a field in a single declaration.  Thus, the locations\n\t//   corresponding to the type and field and their components will overlap.\n\t// - Code which tries to interpret locations should probably be designed to\n\t//   ignore those that it doesn't understand, as more types of locations could\n\t//   be recorded in the future.\n\tLocation         []*SourceCodeInfo_Location `protobuf:\"bytes,1,rep,name=location\" json:\"location,omitempty\"`\n\tXXX_unrecognized []byte                     `json:\"-\"`\n}\n\nfunc (m *SourceCodeInfo) Reset()                    { *m = SourceCodeInfo{} }\nfunc (m *SourceCodeInfo) String() string            { return proto.CompactTextString(m) }\nfunc (*SourceCodeInfo) ProtoMessage()               {}\nfunc (*SourceCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }\n\nfunc (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location {\n\tif m != nil {\n\t\treturn m.Location\n\t}\n\treturn nil\n}\n\ntype SourceCodeInfo_Location struct {\n\t// Identifies which part of the FileDescriptorProto was defined at this\n\t// location.\n\t//\n\t// Each element is a field number or an index.  They form a path from\n\t// the root FileDescriptorProto to the place where the definition.  For\n\t// example, this path:\n\t//   [ 4, 3, 2, 7, 1 ]\n\t// refers to:\n\t//   file.message_type(3)  // 4, 3\n\t//       .field(7)         // 2, 7\n\t//       .name()           // 1\n\t// This is because FileDescriptorProto.message_type has field number 4:\n\t//   repeated DescriptorProto message_type = 4;\n\t// and DescriptorProto.field has field number 2:\n\t//   repeated FieldDescriptorProto field = 2;\n\t// and FieldDescriptorProto.name has field number 1:\n\t//   optional string name = 1;\n\t//\n\t// Thus, the above path gives the location of a field name.  If we removed\n\t// the last element:\n\t//   [ 4, 3, 2, 7 ]\n\t// this path refers to the whole field declaration (from the beginning\n\t// of the label to the terminating semicolon).\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Always has exactly three or four elements: start line, start column,\n\t// end line (optional, otherwise assumed same as start line), end column.\n\t// These are packed into a single field for efficiency.  Note that line\n\t// and column numbers are zero-based -- typically you will want to add\n\t// 1 to each before displaying to a user.\n\tSpan []int32 `protobuf:\"varint,2,rep,packed,name=span\" json:\"span,omitempty\"`\n\t// If this SourceCodeInfo represents a complete declaration, these are any\n\t// comments appearing before and after the declaration which appear to be\n\t// attached to the declaration.\n\t//\n\t// A series of line comments appearing on consecutive lines, with no other\n\t// tokens appearing on those lines, will be treated as a single comment.\n\t//\n\t// leading_detached_comments will keep paragraphs of comments that appear\n\t// before (but not connected to) the current element. Each paragraph,\n\t// separated by empty lines, will be one comment element in the repeated\n\t// field.\n\t//\n\t// Only the comment content is provided; comment markers (e.g. //) are\n\t// stripped out.  For block comments, leading whitespace and an asterisk\n\t// will be stripped from the beginning of each line other than the first.\n\t// Newlines are included in the output.\n\t//\n\t// Examples:\n\t//\n\t//   optional int32 foo = 1;  // Comment attached to foo.\n\t//   // Comment attached to bar.\n\t//   optional int32 bar = 2;\n\t//\n\t//   optional string baz = 3;\n\t//   // Comment attached to baz.\n\t//   // Another line attached to baz.\n\t//\n\t//   // Comment attached to qux.\n\t//   //\n\t//   // Another line attached to qux.\n\t//   optional double qux = 4;\n\t//\n\t//   // Detached comment for corge. This is not leading or trailing comments\n\t//   // to qux or corge because there are blank lines separating it from\n\t//   // both.\n\t//\n\t//   // Detached comment for corge paragraph 2.\n\t//\n\t//   optional string corge = 5;\n\t//   /* Block comment attached\n\t//    * to corge.  Leading asterisks\n\t//    * will be removed. */\n\t//   /* Block comment attached to\n\t//    * grault. */\n\t//   optional int32 grault = 6;\n\t//\n\t//   // ignored detached comments.\n\tLeadingComments         *string  `protobuf:\"bytes,3,opt,name=leading_comments,json=leadingComments\" json:\"leading_comments,omitempty\"`\n\tTrailingComments        *string  `protobuf:\"bytes,4,opt,name=trailing_comments,json=trailingComments\" json:\"trailing_comments,omitempty\"`\n\tLeadingDetachedComments []string `protobuf:\"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments\" json:\"leading_detached_comments,omitempty\"`\n\tXXX_unrecognized        []byte   `json:\"-\"`\n}\n\nfunc (m *SourceCodeInfo_Location) Reset()                    { *m = SourceCodeInfo_Location{} }\nfunc (m *SourceCodeInfo_Location) String() string            { return proto.CompactTextString(m) }\nfunc (*SourceCodeInfo_Location) ProtoMessage()               {}\nfunc (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} }\n\nfunc (m *SourceCodeInfo_Location) GetPath() []int32 {\n\tif m != nil {\n\t\treturn m.Path\n\t}\n\treturn nil\n}\n\nfunc (m *SourceCodeInfo_Location) GetSpan() []int32 {\n\tif m != nil {\n\t\treturn m.Span\n\t}\n\treturn nil\n}\n\nfunc (m *SourceCodeInfo_Location) GetLeadingComments() string {\n\tif m != nil && m.LeadingComments != nil {\n\t\treturn *m.LeadingComments\n\t}\n\treturn \"\"\n}\n\nfunc (m *SourceCodeInfo_Location) GetTrailingComments() string {\n\tif m != nil && m.TrailingComments != nil {\n\t\treturn *m.TrailingComments\n\t}\n\treturn \"\"\n}\n\nfunc (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string {\n\tif m != nil {\n\t\treturn m.LeadingDetachedComments\n\t}\n\treturn nil\n}\n\n// Describes the relationship between generated code and its original source\n// file. A GeneratedCodeInfo message is associated with only one generated\n// source file, but may contain references to different source .proto files.\ntype GeneratedCodeInfo struct {\n\t// An Annotation connects some span of text in generated code to an element\n\t// of its generating .proto file.\n\tAnnotation       []*GeneratedCodeInfo_Annotation `protobuf:\"bytes,1,rep,name=annotation\" json:\"annotation,omitempty\"`\n\tXXX_unrecognized []byte                          `json:\"-\"`\n}\n\nfunc (m *GeneratedCodeInfo) Reset()                    { *m = GeneratedCodeInfo{} }\nfunc (m *GeneratedCodeInfo) String() string            { return proto.CompactTextString(m) }\nfunc (*GeneratedCodeInfo) ProtoMessage()               {}\nfunc (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }\n\nfunc (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation {\n\tif m != nil {\n\t\treturn m.Annotation\n\t}\n\treturn nil\n}\n\ntype GeneratedCodeInfo_Annotation struct {\n\t// Identifies the element in the original source .proto file. This field\n\t// is formatted the same as SourceCodeInfo.Location.path.\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Identifies the filesystem path to the original source .proto.\n\tSourceFile *string `protobuf:\"bytes,2,opt,name=source_file,json=sourceFile\" json:\"source_file,omitempty\"`\n\t// Identifies the starting offset in bytes in the generated code\n\t// that relates to the identified object.\n\tBegin *int32 `protobuf:\"varint,3,opt,name=begin\" json:\"begin,omitempty\"`\n\t// Identifies the ending offset in bytes in the generated code that\n\t// relates to the identified offset. The end offset should be one past\n\t// the last relevant byte (so the length of the text = end - begin).\n\tEnd              *int32 `protobuf:\"varint,4,opt,name=end\" json:\"end,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *GeneratedCodeInfo_Annotation) Reset()         { *m = GeneratedCodeInfo_Annotation{} }\nfunc (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) }\nfunc (*GeneratedCodeInfo_Annotation) ProtoMessage()    {}\nfunc (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) {\n\treturn fileDescriptor0, []int{20, 0}\n}\n\nfunc (m *GeneratedCodeInfo_Annotation) GetPath() []int32 {\n\tif m != nil {\n\t\treturn m.Path\n\t}\n\treturn nil\n}\n\nfunc (m *GeneratedCodeInfo_Annotation) GetSourceFile() string {\n\tif m != nil && m.SourceFile != nil {\n\t\treturn *m.SourceFile\n\t}\n\treturn \"\"\n}\n\nfunc (m *GeneratedCodeInfo_Annotation) GetBegin() int32 {\n\tif m != nil && m.Begin != nil {\n\t\treturn *m.Begin\n\t}\n\treturn 0\n}\n\nfunc (m *GeneratedCodeInfo_Annotation) GetEnd() int32 {\n\tif m != nil && m.End != nil {\n\t\treturn *m.End\n\t}\n\treturn 0\n}\n\nfunc init() {\n\tproto.RegisterType((*FileDescriptorSet)(nil), \"google.protobuf.FileDescriptorSet\")\n\tproto.RegisterType((*FileDescriptorProto)(nil), \"google.protobuf.FileDescriptorProto\")\n\tproto.RegisterType((*DescriptorProto)(nil), \"google.protobuf.DescriptorProto\")\n\tproto.RegisterType((*DescriptorProto_ExtensionRange)(nil), \"google.protobuf.DescriptorProto.ExtensionRange\")\n\tproto.RegisterType((*DescriptorProto_ReservedRange)(nil), \"google.protobuf.DescriptorProto.ReservedRange\")\n\tproto.RegisterType((*ExtensionRangeOptions)(nil), \"google.protobuf.ExtensionRangeOptions\")\n\tproto.RegisterType((*FieldDescriptorProto)(nil), \"google.protobuf.FieldDescriptorProto\")\n\tproto.RegisterType((*OneofDescriptorProto)(nil), \"google.protobuf.OneofDescriptorProto\")\n\tproto.RegisterType((*EnumDescriptorProto)(nil), \"google.protobuf.EnumDescriptorProto\")\n\tproto.RegisterType((*EnumValueDescriptorProto)(nil), \"google.protobuf.EnumValueDescriptorProto\")\n\tproto.RegisterType((*ServiceDescriptorProto)(nil), \"google.protobuf.ServiceDescriptorProto\")\n\tproto.RegisterType((*MethodDescriptorProto)(nil), \"google.protobuf.MethodDescriptorProto\")\n\tproto.RegisterType((*FileOptions)(nil), \"google.protobuf.FileOptions\")\n\tproto.RegisterType((*MessageOptions)(nil), \"google.protobuf.MessageOptions\")\n\tproto.RegisterType((*FieldOptions)(nil), \"google.protobuf.FieldOptions\")\n\tproto.RegisterType((*OneofOptions)(nil), \"google.protobuf.OneofOptions\")\n\tproto.RegisterType((*EnumOptions)(nil), \"google.protobuf.EnumOptions\")\n\tproto.RegisterType((*EnumValueOptions)(nil), \"google.protobuf.EnumValueOptions\")\n\tproto.RegisterType((*ServiceOptions)(nil), \"google.protobuf.ServiceOptions\")\n\tproto.RegisterType((*MethodOptions)(nil), \"google.protobuf.MethodOptions\")\n\tproto.RegisterType((*UninterpretedOption)(nil), \"google.protobuf.UninterpretedOption\")\n\tproto.RegisterType((*UninterpretedOption_NamePart)(nil), \"google.protobuf.UninterpretedOption.NamePart\")\n\tproto.RegisterType((*SourceCodeInfo)(nil), \"google.protobuf.SourceCodeInfo\")\n\tproto.RegisterType((*SourceCodeInfo_Location)(nil), \"google.protobuf.SourceCodeInfo.Location\")\n\tproto.RegisterType((*GeneratedCodeInfo)(nil), \"google.protobuf.GeneratedCodeInfo\")\n\tproto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), \"google.protobuf.GeneratedCodeInfo.Annotation\")\n\tproto.RegisterEnum(\"google.protobuf.FieldDescriptorProto_Type\", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value)\n\tproto.RegisterEnum(\"google.protobuf.FieldDescriptorProto_Label\", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value)\n\tproto.RegisterEnum(\"google.protobuf.FileOptions_OptimizeMode\", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value)\n\tproto.RegisterEnum(\"google.protobuf.FieldOptions_CType\", FieldOptions_CType_name, FieldOptions_CType_value)\n\tproto.RegisterEnum(\"google.protobuf.FieldOptions_JSType\", FieldOptions_JSType_name, FieldOptions_JSType_value)\n\tproto.RegisterEnum(\"google.protobuf.MethodOptions_IdempotencyLevel\", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value)\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/descriptor.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 2519 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x6e, 0x1b, 0xc7,\n\t0x15, 0x0e, 0x7f, 0x45, 0x1e, 0x52, 0xd4, 0x68, 0xa4, 0xd8, 0x6b, 0xe5, 0xc7, 0x32, 0xf3, 0x63,\n\t0xd9, 0x69, 0xa8, 0x40, 0xb1, 0x1d, 0x47, 0x29, 0xd2, 0x52, 0xe4, 0x5a, 0xa1, 0x4a, 0x91, 0xec,\n\t0x92, 0x6a, 0x7e, 0x6e, 0x16, 0xa3, 0xdd, 0x21, 0xb9, 0xf6, 0x72, 0x77, 0xb3, 0xbb, 0xb4, 0xad,\n\t0xa0, 0x17, 0x06, 0x7a, 0x55, 0xa0, 0x0f, 0x50, 0x14, 0x45, 0x2f, 0x72, 0x13, 0xa0, 0x0f, 0x50,\n\t0x20, 0x77, 0x7d, 0x82, 0x02, 0x79, 0x83, 0xa2, 0x28, 0xd0, 0x3e, 0x46, 0x31, 0x33, 0xbb, 0xcb,\n\t0x5d, 0xfe, 0xc4, 0x6a, 0x80, 0x38, 0x57, 0xe4, 0x7c, 0xe7, 0x3b, 0x67, 0xce, 0x9c, 0x39, 0x33,\n\t0x73, 0x66, 0x16, 0x76, 0x47, 0xb6, 0x3d, 0x32, 0xe9, 0xbe, 0xe3, 0xda, 0xbe, 0x7d, 0x3e, 0x1d,\n\t0xee, 0xeb, 0xd4, 0xd3, 0x5c, 0xc3, 0xf1, 0x6d, 0xb7, 0xc6, 0x31, 0xbc, 0x21, 0x18, 0xb5, 0x90,\n\t0x51, 0x3d, 0x85, 0xcd, 0x07, 0x86, 0x49, 0x9b, 0x11, 0xb1, 0x4f, 0x7d, 0x7c, 0x1f, 0xb2, 0x43,\n\t0xc3, 0xa4, 0x52, 0x6a, 0x37, 0xb3, 0x57, 0x3a, 0x78, 0xb3, 0x36, 0xa7, 0x54, 0x4b, 0x6a, 0xf4,\n\t0x18, 0xac, 0x70, 0x8d, 0xea, 0xbf, 0xb3, 0xb0, 0xb5, 0x44, 0x8a, 0x31, 0x64, 0x2d, 0x32, 0x61,\n\t0x16, 0x53, 0x7b, 0x45, 0x85, 0xff, 0xc7, 0x12, 0xac, 0x39, 0x44, 0x7b, 0x44, 0x46, 0x54, 0x4a,\n\t0x73, 0x38, 0x6c, 0xe2, 0xd7, 0x01, 0x74, 0xea, 0x50, 0x4b, 0xa7, 0x96, 0x76, 0x21, 0x65, 0x76,\n\t0x33, 0x7b, 0x45, 0x25, 0x86, 0xe0, 0x77, 0x60, 0xd3, 0x99, 0x9e, 0x9b, 0x86, 0xa6, 0xc6, 0x68,\n\t0xb0, 0x9b, 0xd9, 0xcb, 0x29, 0x48, 0x08, 0x9a, 0x33, 0xf2, 0x4d, 0xd8, 0x78, 0x42, 0xc9, 0xa3,\n\t0x38, 0xb5, 0xc4, 0xa9, 0x15, 0x06, 0xc7, 0x88, 0x0d, 0x28, 0x4f, 0xa8, 0xe7, 0x91, 0x11, 0x55,\n\t0xfd, 0x0b, 0x87, 0x4a, 0x59, 0x3e, 0xfa, 0xdd, 0x85, 0xd1, 0xcf, 0x8f, 0xbc, 0x14, 0x68, 0x0d,\n\t0x2e, 0x1c, 0x8a, 0xeb, 0x50, 0xa4, 0xd6, 0x74, 0x22, 0x2c, 0xe4, 0x56, 0xc4, 0x4f, 0xb6, 0xa6,\n\t0x93, 0x79, 0x2b, 0x05, 0xa6, 0x16, 0x98, 0x58, 0xf3, 0xa8, 0xfb, 0xd8, 0xd0, 0xa8, 0x94, 0xe7,\n\t0x06, 0x6e, 0x2e, 0x18, 0xe8, 0x0b, 0xf9, 0xbc, 0x8d, 0x50, 0x0f, 0x37, 0xa0, 0x48, 0x9f, 0xfa,\n\t0xd4, 0xf2, 0x0c, 0xdb, 0x92, 0xd6, 0xb8, 0x91, 0xb7, 0x96, 0xcc, 0x22, 0x35, 0xf5, 0x79, 0x13,\n\t0x33, 0x3d, 0x7c, 0x0f, 0xd6, 0x6c, 0xc7, 0x37, 0x6c, 0xcb, 0x93, 0x0a, 0xbb, 0xa9, 0xbd, 0xd2,\n\t0xc1, 0xab, 0x4b, 0x13, 0xa1, 0x2b, 0x38, 0x4a, 0x48, 0xc6, 0x2d, 0x40, 0x9e, 0x3d, 0x75, 0x35,\n\t0xaa, 0x6a, 0xb6, 0x4e, 0x55, 0xc3, 0x1a, 0xda, 0x52, 0x91, 0x1b, 0xb8, 0xbe, 0x38, 0x10, 0x4e,\n\t0x6c, 0xd8, 0x3a, 0x6d, 0x59, 0x43, 0x5b, 0xa9, 0x78, 0x89, 0x36, 0xbe, 0x02, 0x79, 0xef, 0xc2,\n\t0xf2, 0xc9, 0x53, 0xa9, 0xcc, 0x33, 0x24, 0x68, 0x55, 0xbf, 0xcd, 0xc3, 0xc6, 0x65, 0x52, 0xec,\n\t0x23, 0xc8, 0x0d, 0xd9, 0x28, 0xa5, 0xf4, 0xff, 0x13, 0x03, 0xa1, 0x93, 0x0c, 0x62, 0xfe, 0x07,\n\t0x06, 0xb1, 0x0e, 0x25, 0x8b, 0x7a, 0x3e, 0xd5, 0x45, 0x46, 0x64, 0x2e, 0x99, 0x53, 0x20, 0x94,\n\t0x16, 0x53, 0x2a, 0xfb, 0x83, 0x52, 0xea, 0x33, 0xd8, 0x88, 0x5c, 0x52, 0x5d, 0x62, 0x8d, 0xc2,\n\t0xdc, 0xdc, 0x7f, 0x9e, 0x27, 0x35, 0x39, 0xd4, 0x53, 0x98, 0x9a, 0x52, 0xa1, 0x89, 0x36, 0x6e,\n\t0x02, 0xd8, 0x16, 0xb5, 0x87, 0xaa, 0x4e, 0x35, 0x53, 0x2a, 0xac, 0x88, 0x52, 0x97, 0x51, 0x16,\n\t0xa2, 0x64, 0x0b, 0x54, 0x33, 0xf1, 0x87, 0xb3, 0x54, 0x5b, 0x5b, 0x91, 0x29, 0xa7, 0x62, 0x91,\n\t0x2d, 0x64, 0xdb, 0x19, 0x54, 0x5c, 0xca, 0xf2, 0x9e, 0xea, 0xc1, 0xc8, 0x8a, 0xdc, 0x89, 0xda,\n\t0x73, 0x47, 0xa6, 0x04, 0x6a, 0x62, 0x60, 0xeb, 0x6e, 0xbc, 0x89, 0xdf, 0x80, 0x08, 0x50, 0x79,\n\t0x5a, 0x01, 0xdf, 0x85, 0xca, 0x21, 0xd8, 0x21, 0x13, 0xba, 0xf3, 0x15, 0x54, 0x92, 0xe1, 0xc1,\n\t0xdb, 0x90, 0xf3, 0x7c, 0xe2, 0xfa, 0x3c, 0x0b, 0x73, 0x8a, 0x68, 0x60, 0x04, 0x19, 0x6a, 0xe9,\n\t0x7c, 0x97, 0xcb, 0x29, 0xec, 0x2f, 0xfe, 0xe5, 0x6c, 0xc0, 0x19, 0x3e, 0xe0, 0xb7, 0x17, 0x67,\n\t0x34, 0x61, 0x79, 0x7e, 0xdc, 0x3b, 0x1f, 0xc0, 0x7a, 0x62, 0x00, 0x97, 0xed, 0xba, 0xfa, 0x5b,\n\t0x78, 0x79, 0xa9, 0x69, 0xfc, 0x19, 0x6c, 0x4f, 0x2d, 0xc3, 0xf2, 0xa9, 0xeb, 0xb8, 0x94, 0x65,\n\t0xac, 0xe8, 0x4a, 0xfa, 0xcf, 0xda, 0x8a, 0x9c, 0x3b, 0x8b, 0xb3, 0x85, 0x15, 0x65, 0x6b, 0xba,\n\t0x08, 0xde, 0x2e, 0x16, 0xfe, 0xbb, 0x86, 0x9e, 0x3d, 0x7b, 0xf6, 0x2c, 0x5d, 0xfd, 0x63, 0x1e,\n\t0xb6, 0x97, 0xad, 0x99, 0xa5, 0xcb, 0xf7, 0x0a, 0xe4, 0xad, 0xe9, 0xe4, 0x9c, 0xba, 0x3c, 0x48,\n\t0x39, 0x25, 0x68, 0xe1, 0x3a, 0xe4, 0x4c, 0x72, 0x4e, 0x4d, 0x29, 0xbb, 0x9b, 0xda, 0xab, 0x1c,\n\t0xbc, 0x73, 0xa9, 0x55, 0x59, 0x6b, 0x33, 0x15, 0x45, 0x68, 0xe2, 0x8f, 0x21, 0x1b, 0x6c, 0xd1,\n\t0xcc, 0xc2, 0xed, 0xcb, 0x59, 0x60, 0x6b, 0x49, 0xe1, 0x7a, 0xf8, 0x15, 0x28, 0xb2, 0x5f, 0x91,\n\t0x1b, 0x79, 0xee, 0x73, 0x81, 0x01, 0x2c, 0x2f, 0xf0, 0x0e, 0x14, 0xf8, 0x32, 0xd1, 0x69, 0x78,\n\t0xb4, 0x45, 0x6d, 0x96, 0x58, 0x3a, 0x1d, 0x92, 0xa9, 0xe9, 0xab, 0x8f, 0x89, 0x39, 0xa5, 0x3c,\n\t0xe1, 0x8b, 0x4a, 0x39, 0x00, 0x7f, 0xc3, 0x30, 0x7c, 0x1d, 0x4a, 0x62, 0x55, 0x19, 0x96, 0x4e,\n\t0x9f, 0xf2, 0xdd, 0x33, 0xa7, 0x88, 0x85, 0xd6, 0x62, 0x08, 0xeb, 0xfe, 0xa1, 0x67, 0x5b, 0x61,\n\t0x6a, 0xf2, 0x2e, 0x18, 0xc0, 0xbb, 0xff, 0x60, 0x7e, 0xe3, 0x7e, 0x6d, 0xf9, 0xf0, 0xe6, 0x73,\n\t0xaa, 0xfa, 0xb7, 0x34, 0x64, 0xf9, 0x7e, 0xb1, 0x01, 0xa5, 0xc1, 0xe7, 0x3d, 0x59, 0x6d, 0x76,\n\t0xcf, 0x8e, 0xda, 0x32, 0x4a, 0xe1, 0x0a, 0x00, 0x07, 0x1e, 0xb4, 0xbb, 0xf5, 0x01, 0x4a, 0x47,\n\t0xed, 0x56, 0x67, 0x70, 0xef, 0x0e, 0xca, 0x44, 0x0a, 0x67, 0x02, 0xc8, 0xc6, 0x09, 0xef, 0x1f,\n\t0xa0, 0x1c, 0x46, 0x50, 0x16, 0x06, 0x5a, 0x9f, 0xc9, 0xcd, 0x7b, 0x77, 0x50, 0x3e, 0x89, 0xbc,\n\t0x7f, 0x80, 0xd6, 0xf0, 0x3a, 0x14, 0x39, 0x72, 0xd4, 0xed, 0xb6, 0x51, 0x21, 0xb2, 0xd9, 0x1f,\n\t0x28, 0xad, 0xce, 0x31, 0x2a, 0x46, 0x36, 0x8f, 0x95, 0xee, 0x59, 0x0f, 0x41, 0x64, 0xe1, 0x54,\n\t0xee, 0xf7, 0xeb, 0xc7, 0x32, 0x2a, 0x45, 0x8c, 0xa3, 0xcf, 0x07, 0x72, 0x1f, 0x95, 0x13, 0x6e,\n\t0xbd, 0x7f, 0x80, 0xd6, 0xa3, 0x2e, 0xe4, 0xce, 0xd9, 0x29, 0xaa, 0xe0, 0x4d, 0x58, 0x17, 0x5d,\n\t0x84, 0x4e, 0x6c, 0xcc, 0x41, 0xf7, 0xee, 0x20, 0x34, 0x73, 0x44, 0x58, 0xd9, 0x4c, 0x00, 0xf7,\n\t0xee, 0x20, 0x5c, 0x6d, 0x40, 0x8e, 0x67, 0x17, 0xc6, 0x50, 0x69, 0xd7, 0x8f, 0xe4, 0xb6, 0xda,\n\t0xed, 0x0d, 0x5a, 0xdd, 0x4e, 0xbd, 0x8d, 0x52, 0x33, 0x4c, 0x91, 0x7f, 0x7d, 0xd6, 0x52, 0xe4,\n\t0x26, 0x4a, 0xc7, 0xb1, 0x9e, 0x5c, 0x1f, 0xc8, 0x4d, 0x94, 0xa9, 0x6a, 0xb0, 0xbd, 0x6c, 0x9f,\n\t0x5c, 0xba, 0x32, 0x62, 0x53, 0x9c, 0x5e, 0x31, 0xc5, 0xdc, 0xd6, 0xc2, 0x14, 0x7f, 0x9d, 0x82,\n\t0xad, 0x25, 0x67, 0xc5, 0xd2, 0x4e, 0x7e, 0x01, 0x39, 0x91, 0xa2, 0xe2, 0xf4, 0xbc, 0xb5, 0xf4,\n\t0xd0, 0xe1, 0x09, 0xbb, 0x70, 0x82, 0x72, 0xbd, 0x78, 0x05, 0x91, 0x59, 0x51, 0x41, 0x30, 0x13,\n\t0x0b, 0x4e, 0xfe, 0x2e, 0x05, 0xd2, 0x2a, 0xdb, 0xcf, 0xd9, 0x28, 0xd2, 0x89, 0x8d, 0xe2, 0xa3,\n\t0x79, 0x07, 0x6e, 0xac, 0x1e, 0xc3, 0x82, 0x17, 0xdf, 0xa4, 0xe0, 0xca, 0xf2, 0x42, 0x6b, 0xa9,\n\t0x0f, 0x1f, 0x43, 0x7e, 0x42, 0xfd, 0xb1, 0x1d, 0x16, 0x1b, 0x6f, 0x2f, 0x39, 0xc2, 0x98, 0x78,\n\t0x3e, 0x56, 0x81, 0x56, 0xfc, 0x0c, 0xcc, 0xac, 0xaa, 0x96, 0x84, 0x37, 0x0b, 0x9e, 0xfe, 0x3e,\n\t0x0d, 0x2f, 0x2f, 0x35, 0xbe, 0xd4, 0xd1, 0xd7, 0x00, 0x0c, 0xcb, 0x99, 0xfa, 0xa2, 0xa0, 0x10,\n\t0xfb, 0x53, 0x91, 0x23, 0x7c, 0xed, 0xb3, 0xbd, 0x67, 0xea, 0x47, 0xf2, 0x0c, 0x97, 0x83, 0x80,\n\t0x38, 0xe1, 0xfe, 0xcc, 0xd1, 0x2c, 0x77, 0xf4, 0xf5, 0x15, 0x23, 0x5d, 0x38, 0xab, 0xdf, 0x03,\n\t0xa4, 0x99, 0x06, 0xb5, 0x7c, 0xd5, 0xf3, 0x5d, 0x4a, 0x26, 0x86, 0x35, 0xe2, 0x1b, 0x70, 0xe1,\n\t0x30, 0x37, 0x24, 0xa6, 0x47, 0x95, 0x0d, 0x21, 0xee, 0x87, 0x52, 0xa6, 0xc1, 0xcf, 0x38, 0x37,\n\t0xa6, 0x91, 0x4f, 0x68, 0x08, 0x71, 0xa4, 0x51, 0xfd, 0xb6, 0x00, 0xa5, 0x58, 0x59, 0x8a, 0x6f,\n\t0x40, 0xf9, 0x21, 0x79, 0x4c, 0xd4, 0xf0, 0xaa, 0x21, 0x22, 0x51, 0x62, 0x58, 0x2f, 0xb8, 0x6e,\n\t0xbc, 0x07, 0xdb, 0x9c, 0x62, 0x4f, 0x7d, 0xea, 0xaa, 0x9a, 0x49, 0x3c, 0x8f, 0x07, 0xad, 0xc0,\n\t0xa9, 0x98, 0xc9, 0xba, 0x4c, 0xd4, 0x08, 0x25, 0xf8, 0x2e, 0x6c, 0x71, 0x8d, 0xc9, 0xd4, 0xf4,\n\t0x0d, 0xc7, 0xa4, 0x2a, 0xbb, 0xfc, 0x78, 0x7c, 0x23, 0x8e, 0x3c, 0xdb, 0x64, 0x8c, 0xd3, 0x80,\n\t0xc0, 0x3c, 0xf2, 0x70, 0x13, 0x5e, 0xe3, 0x6a, 0x23, 0x6a, 0x51, 0x97, 0xf8, 0x54, 0xa5, 0x5f,\n\t0x4e, 0x89, 0xe9, 0xa9, 0xc4, 0xd2, 0xd5, 0x31, 0xf1, 0xc6, 0xd2, 0x36, 0x33, 0x70, 0x94, 0x96,\n\t0x52, 0xca, 0x35, 0x46, 0x3c, 0x0e, 0x78, 0x32, 0xa7, 0xd5, 0x2d, 0xfd, 0x13, 0xe2, 0x8d, 0xf1,\n\t0x21, 0x5c, 0xe1, 0x56, 0x3c, 0xdf, 0x35, 0xac, 0x91, 0xaa, 0x8d, 0xa9, 0xf6, 0x48, 0x9d, 0xfa,\n\t0xc3, 0xfb, 0xd2, 0x2b, 0xf1, 0xfe, 0xb9, 0x87, 0x7d, 0xce, 0x69, 0x30, 0xca, 0x99, 0x3f, 0xbc,\n\t0x8f, 0xfb, 0x50, 0x66, 0x93, 0x31, 0x31, 0xbe, 0xa2, 0xea, 0xd0, 0x76, 0xf9, 0xc9, 0x52, 0x59,\n\t0xb2, 0xb2, 0x63, 0x11, 0xac, 0x75, 0x03, 0x85, 0x53, 0x5b, 0xa7, 0x87, 0xb9, 0x7e, 0x4f, 0x96,\n\t0x9b, 0x4a, 0x29, 0xb4, 0xf2, 0xc0, 0x76, 0x59, 0x42, 0x8d, 0xec, 0x28, 0xc0, 0x25, 0x91, 0x50,\n\t0x23, 0x3b, 0x0c, 0xef, 0x5d, 0xd8, 0xd2, 0x34, 0x31, 0x66, 0x43, 0x53, 0x83, 0x2b, 0x8a, 0x27,\n\t0xa1, 0x44, 0xb0, 0x34, 0xed, 0x58, 0x10, 0x82, 0x1c, 0xf7, 0xf0, 0x87, 0xf0, 0xf2, 0x2c, 0x58,\n\t0x71, 0xc5, 0xcd, 0x85, 0x51, 0xce, 0xab, 0xde, 0x85, 0x2d, 0xe7, 0x62, 0x51, 0x11, 0x27, 0x7a,\n\t0x74, 0x2e, 0xe6, 0xd5, 0x3e, 0x80, 0x6d, 0x67, 0xec, 0x2c, 0xea, 0xdd, 0x8e, 0xeb, 0x61, 0x67,\n\t0xec, 0xcc, 0x2b, 0xbe, 0xc5, 0xef, 0xab, 0x2e, 0xd5, 0x88, 0x4f, 0x75, 0xe9, 0x6a, 0x9c, 0x1e,\n\t0x13, 0xe0, 0x7d, 0x40, 0x9a, 0xa6, 0x52, 0x8b, 0x9c, 0x9b, 0x54, 0x25, 0x2e, 0xb5, 0x88, 0x27,\n\t0x5d, 0x8f, 0x93, 0x2b, 0x9a, 0x26, 0x73, 0x69, 0x9d, 0x0b, 0xf1, 0x6d, 0xd8, 0xb4, 0xcf, 0x1f,\n\t0x6a, 0x22, 0x25, 0x55, 0xc7, 0xa5, 0x43, 0xe3, 0xa9, 0xf4, 0x26, 0x8f, 0xef, 0x06, 0x13, 0xf0,\n\t0x84, 0xec, 0x71, 0x18, 0xdf, 0x02, 0xa4, 0x79, 0x63, 0xe2, 0x3a, 0xbc, 0x26, 0xf0, 0x1c, 0xa2,\n\t0x51, 0xe9, 0x2d, 0x41, 0x15, 0x78, 0x27, 0x84, 0xd9, 0x92, 0xf0, 0x9e, 0x18, 0x43, 0x3f, 0xb4,\n\t0x78, 0x53, 0x2c, 0x09, 0x8e, 0x05, 0xd6, 0xf6, 0x00, 0xb1, 0x50, 0x24, 0x3a, 0xde, 0xe3, 0xb4,\n\t0x8a, 0x33, 0x76, 0xe2, 0xfd, 0xbe, 0x01, 0xeb, 0x8c, 0x39, 0xeb, 0xf4, 0x96, 0xa8, 0x67, 0x9c,\n\t0x71, 0xac, 0xc7, 0x1f, 0xad, 0xb4, 0xac, 0x1e, 0x42, 0x39, 0x9e, 0x9f, 0xb8, 0x08, 0x22, 0x43,\n\t0x51, 0x8a, 0x9d, 0xf5, 0x8d, 0x6e, 0x93, 0x9d, 0xd2, 0x5f, 0xc8, 0x28, 0xcd, 0xaa, 0x85, 0x76,\n\t0x6b, 0x20, 0xab, 0xca, 0x59, 0x67, 0xd0, 0x3a, 0x95, 0x51, 0x26, 0x56, 0x96, 0x9e, 0x64, 0x0b,\n\t0x6f, 0xa3, 0x9b, 0xd5, 0xef, 0xd2, 0x50, 0x49, 0xde, 0x33, 0xf0, 0xcf, 0xe1, 0x6a, 0xf8, 0x28,\n\t0xe0, 0x51, 0x5f, 0x7d, 0x62, 0xb8, 0x7c, 0xe1, 0x4c, 0x88, 0xa8, 0xb3, 0xa3, 0xa9, 0xdb, 0x0e,\n\t0x58, 0x7d, 0xea, 0x7f, 0x6a, 0xb8, 0x6c, 0x59, 0x4c, 0x88, 0x8f, 0xdb, 0x70, 0xdd, 0xb2, 0x55,\n\t0xcf, 0x27, 0x96, 0x4e, 0x5c, 0x5d, 0x9d, 0x3d, 0xc7, 0xa8, 0x44, 0xd3, 0xa8, 0xe7, 0xd9, 0xe2,\n\t0xc0, 0x8a, 0xac, 0xbc, 0x6a, 0xd9, 0xfd, 0x80, 0x3c, 0xdb, 0xc9, 0xeb, 0x01, 0x75, 0x2e, 0xcd,\n\t0x32, 0xab, 0xd2, 0xec, 0x15, 0x28, 0x4e, 0x88, 0xa3, 0x52, 0xcb, 0x77, 0x2f, 0x78, 0x75, 0x59,\n\t0x50, 0x0a, 0x13, 0xe2, 0xc8, 0xac, 0xfd, 0x42, 0x8a, 0xfc, 0x93, 0x6c, 0xa1, 0x80, 0x8a, 0x27,\n\t0xd9, 0x42, 0x11, 0x41, 0xf5, 0x5f, 0x19, 0x28, 0xc7, 0xab, 0x4d, 0x56, 0xbc, 0x6b, 0xfc, 0x64,\n\t0x49, 0xf1, 0xbd, 0xe7, 0x8d, 0xef, 0xad, 0x4d, 0x6b, 0x0d, 0x76, 0xe4, 0x1c, 0xe6, 0x45, 0x0d,\n\t0xa8, 0x08, 0x4d, 0x76, 0xdc, 0xb3, 0xdd, 0x86, 0x8a, 0x7b, 0x4d, 0x41, 0x09, 0x5a, 0xf8, 0x18,\n\t0xf2, 0x0f, 0x3d, 0x6e, 0x3b, 0xcf, 0x6d, 0xbf, 0xf9, 0xfd, 0xb6, 0x4f, 0xfa, 0xdc, 0x78, 0xf1,\n\t0xa4, 0xaf, 0x76, 0xba, 0xca, 0x69, 0xbd, 0xad, 0x04, 0xea, 0xf8, 0x1a, 0x64, 0x4d, 0xf2, 0xd5,\n\t0x45, 0xf2, 0x70, 0xe2, 0xd0, 0x65, 0x27, 0xe1, 0x1a, 0x64, 0x9f, 0x50, 0xf2, 0x28, 0x79, 0x24,\n\t0x70, 0xe8, 0x47, 0x5c, 0x0c, 0xfb, 0x90, 0xe3, 0xf1, 0xc2, 0x00, 0x41, 0xc4, 0xd0, 0x4b, 0xb8,\n\t0x00, 0xd9, 0x46, 0x57, 0x61, 0x0b, 0x02, 0x41, 0x59, 0xa0, 0x6a, 0xaf, 0x25, 0x37, 0x64, 0x94,\n\t0xae, 0xde, 0x85, 0xbc, 0x08, 0x02, 0x5b, 0x2c, 0x51, 0x18, 0xd0, 0x4b, 0x41, 0x33, 0xb0, 0x91,\n\t0x0a, 0xa5, 0x67, 0xa7, 0x47, 0xb2, 0x82, 0xd2, 0xc9, 0xa9, 0xce, 0xa2, 0x5c, 0xd5, 0x83, 0x72,\n\t0xbc, 0xdc, 0x7c, 0x31, 0x57, 0xc9, 0xbf, 0xa7, 0xa0, 0x14, 0x2b, 0x1f, 0x59, 0xe1, 0x42, 0x4c,\n\t0xd3, 0x7e, 0xa2, 0x12, 0xd3, 0x20, 0x5e, 0x90, 0x1a, 0xc0, 0xa1, 0x3a, 0x43, 0x2e, 0x3b, 0x75,\n\t0x2f, 0x68, 0x89, 0xe4, 0x50, 0xbe, 0xfa, 0x97, 0x14, 0xa0, 0xf9, 0x02, 0x74, 0xce, 0xcd, 0xd4,\n\t0x4f, 0xe9, 0x66, 0xf5, 0xcf, 0x29, 0xa8, 0x24, 0xab, 0xce, 0x39, 0xf7, 0x6e, 0xfc, 0xa4, 0xee,\n\t0xfd, 0x33, 0x0d, 0xeb, 0x89, 0x5a, 0xf3, 0xb2, 0xde, 0x7d, 0x09, 0x9b, 0x86, 0x4e, 0x27, 0x8e,\n\t0xed, 0x53, 0x4b, 0xbb, 0x50, 0x4d, 0xfa, 0x98, 0x9a, 0x52, 0x95, 0x6f, 0x1a, 0xfb, 0xdf, 0x5f,\n\t0xcd, 0xd6, 0x5a, 0x33, 0xbd, 0x36, 0x53, 0x3b, 0xdc, 0x6a, 0x35, 0xe5, 0xd3, 0x5e, 0x77, 0x20,\n\t0x77, 0x1a, 0x9f, 0xab, 0x67, 0x9d, 0x5f, 0x75, 0xba, 0x9f, 0x76, 0x14, 0x64, 0xcc, 0xd1, 0x7e,\n\t0xc4, 0x65, 0xdf, 0x03, 0x34, 0xef, 0x14, 0xbe, 0x0a, 0xcb, 0xdc, 0x42, 0x2f, 0xe1, 0x2d, 0xd8,\n\t0xe8, 0x74, 0xd5, 0x7e, 0xab, 0x29, 0xab, 0xf2, 0x83, 0x07, 0x72, 0x63, 0xd0, 0x17, 0xd7, 0xfb,\n\t0x88, 0x3d, 0x48, 0x2c, 0xf0, 0xea, 0x9f, 0x32, 0xb0, 0xb5, 0xc4, 0x13, 0x5c, 0x0f, 0x6e, 0x16,\n\t0xe2, 0xb2, 0xf3, 0xee, 0x65, 0xbc, 0xaf, 0xb1, 0x82, 0xa0, 0x47, 0x5c, 0x3f, 0xb8, 0x88, 0xdc,\n\t0x02, 0x16, 0x25, 0xcb, 0x37, 0x86, 0x06, 0x75, 0x83, 0xd7, 0x10, 0x71, 0xdd, 0xd8, 0x98, 0xe1,\n\t0xe2, 0x41, 0xe4, 0x67, 0x80, 0x1d, 0xdb, 0x33, 0x7c, 0xe3, 0x31, 0x55, 0x0d, 0x2b, 0x7c, 0x3a,\n\t0x61, 0xd7, 0x8f, 0xac, 0x82, 0x42, 0x49, 0xcb, 0xf2, 0x23, 0xb6, 0x45, 0x47, 0x64, 0x8e, 0xcd,\n\t0x36, 0xf3, 0x8c, 0x82, 0x42, 0x49, 0xc4, 0xbe, 0x01, 0x65, 0xdd, 0x9e, 0xb2, 0x9a, 0x4c, 0xf0,\n\t0xd8, 0xd9, 0x91, 0x52, 0x4a, 0x02, 0x8b, 0x28, 0x41, 0xb5, 0x3d, 0x7b, 0xb3, 0x29, 0x2b, 0x25,\n\t0x81, 0x09, 0xca, 0x4d, 0xd8, 0x20, 0xa3, 0x91, 0xcb, 0x8c, 0x87, 0x86, 0xc4, 0xfd, 0xa1, 0x12,\n\t0xc1, 0x9c, 0xb8, 0x73, 0x02, 0x85, 0x30, 0x0e, 0xec, 0xa8, 0x66, 0x91, 0x50, 0x1d, 0xf1, 0x6e,\n\t0x97, 0xde, 0x2b, 0x2a, 0x05, 0x2b, 0x14, 0xde, 0x80, 0xb2, 0xe1, 0xa9, 0xb3, 0x27, 0xe8, 0xf4,\n\t0x6e, 0x7a, 0xaf, 0xa0, 0x94, 0x0c, 0x2f, 0x7a, 0xbe, 0xab, 0x7e, 0x93, 0x86, 0x4a, 0xf2, 0x09,\n\t0x1d, 0x37, 0xa1, 0x60, 0xda, 0x1a, 0xe1, 0xa9, 0x25, 0xbe, 0xdf, 0xec, 0x3d, 0xe7, 0xd5, 0xbd,\n\t0xd6, 0x0e, 0xf8, 0x4a, 0xa4, 0xb9, 0xf3, 0x8f, 0x14, 0x14, 0x42, 0x18, 0x5f, 0x81, 0xac, 0x43,\n\t0xfc, 0x31, 0x37, 0x97, 0x3b, 0x4a, 0xa3, 0x94, 0xc2, 0xdb, 0x0c, 0xf7, 0x1c, 0x62, 0xf1, 0x14,\n\t0x08, 0x70, 0xd6, 0x66, 0xf3, 0x6a, 0x52, 0xa2, 0xf3, 0xcb, 0x89, 0x3d, 0x99, 0x50, 0xcb, 0xf7,\n\t0xc2, 0x79, 0x0d, 0xf0, 0x46, 0x00, 0xe3, 0x77, 0x60, 0xd3, 0x77, 0x89, 0x61, 0x26, 0xb8, 0x59,\n\t0xce, 0x45, 0xa1, 0x20, 0x22, 0x1f, 0xc2, 0xb5, 0xd0, 0xae, 0x4e, 0x7d, 0xa2, 0x8d, 0xa9, 0x3e,\n\t0x53, 0xca, 0xf3, 0xf7, 0xd9, 0xab, 0x01, 0xa1, 0x19, 0xc8, 0x43, 0xdd, 0xea, 0x77, 0x29, 0xd8,\n\t0x0c, 0xaf, 0x53, 0x7a, 0x14, 0xac, 0x53, 0x00, 0x62, 0x59, 0xb6, 0x1f, 0x0f, 0xd7, 0x62, 0x2a,\n\t0x2f, 0xe8, 0xd5, 0xea, 0x91, 0x92, 0x12, 0x33, 0xb0, 0x33, 0x01, 0x98, 0x49, 0x56, 0x86, 0xed,\n\t0x3a, 0x94, 0x82, 0xef, 0x23, 0xfc, 0x23, 0x9b, 0xb8, 0x80, 0x83, 0x80, 0xd8, 0xbd, 0x0b, 0x6f,\n\t0x43, 0xee, 0x9c, 0x8e, 0x0c, 0x2b, 0x78, 0xf5, 0x14, 0x8d, 0xf0, 0x25, 0x37, 0x1b, 0xbd, 0xe4,\n\t0x1e, 0xfd, 0x21, 0x05, 0x5b, 0x9a, 0x3d, 0x99, 0xf7, 0xf7, 0x08, 0xcd, 0xbd, 0x02, 0x78, 0x9f,\n\t0xa4, 0xbe, 0xf8, 0x78, 0x64, 0xf8, 0xe3, 0xe9, 0x79, 0x4d, 0xb3, 0x27, 0xfb, 0x23, 0xdb, 0x24,\n\t0xd6, 0x68, 0xf6, 0x95, 0x90, 0xff, 0xd1, 0xde, 0x1d, 0x51, 0xeb, 0xdd, 0x91, 0x1d, 0xfb, 0x66,\n\t0xf8, 0xd1, 0xec, 0xef, 0xd7, 0xe9, 0xcc, 0x71, 0xef, 0xe8, 0xaf, 0xe9, 0x9d, 0x63, 0xd1, 0x57,\n\t0x2f, 0x8c, 0x8d, 0x42, 0x87, 0x26, 0xd5, 0xd8, 0x78, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x0c,\n\t0xab, 0xb6, 0x37, 0x7e, 0x1c, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//  Based on original Protocol Buffers design by\n//  Sanjay Ghemawat, Jeff Dean, and others.\n//\n// The messages in this file describe the definitions found in .proto files.\n// A valid .proto file can be translated directly to a FileDescriptorProto\n// without any other information (e.g. without reading its imports).\n\n\nsyntax = \"proto2\";\n\npackage google.protobuf;\noption go_package = \"github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"DescriptorProtos\";\noption csharp_namespace = \"Google.Protobuf.Reflection\";\noption objc_class_prefix = \"GPB\";\n\n// descriptor.proto must be optimized for speed because reflection-based\n// algorithms don't work during bootstrapping.\noption optimize_for = SPEED;\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\nmessage FileDescriptorSet {\n  repeated FileDescriptorProto file = 1;\n}\n\n// Describes a complete .proto file.\nmessage FileDescriptorProto {\n  optional string name = 1;       // file name, relative to root of source tree\n  optional string package = 2;    // e.g. \"foo\", \"foo.bar\", etc.\n\n  // Names of files imported by this file.\n  repeated string dependency = 3;\n  // Indexes of the public imported files in the dependency list above.\n  repeated int32 public_dependency = 10;\n  // Indexes of the weak imported files in the dependency list.\n  // For Google-internal migration only. Do not use.\n  repeated int32 weak_dependency = 11;\n\n  // All top-level definitions in this file.\n  repeated DescriptorProto message_type = 4;\n  repeated EnumDescriptorProto enum_type = 5;\n  repeated ServiceDescriptorProto service = 6;\n  repeated FieldDescriptorProto extension = 7;\n\n  optional FileOptions options = 8;\n\n  // This field contains optional information about the original source code.\n  // You may safely remove this entire field without harming runtime\n  // functionality of the descriptors -- the information is needed only by\n  // development tools.\n  optional SourceCodeInfo source_code_info = 9;\n\n  // The syntax of the proto file.\n  // The supported values are \"proto2\" and \"proto3\".\n  optional string syntax = 12;\n}\n\n// Describes a message type.\nmessage DescriptorProto {\n  optional string name = 1;\n\n  repeated FieldDescriptorProto field = 2;\n  repeated FieldDescriptorProto extension = 6;\n\n  repeated DescriptorProto nested_type = 3;\n  repeated EnumDescriptorProto enum_type = 4;\n\n  message ExtensionRange {\n    optional int32 start = 1;\n    optional int32 end = 2;\n\n    optional ExtensionRangeOptions options = 3;\n  }\n  repeated ExtensionRange extension_range = 5;\n\n  repeated OneofDescriptorProto oneof_decl = 8;\n\n  optional MessageOptions options = 7;\n\n  // Range of reserved tag numbers. Reserved tag numbers may not be used by\n  // fields or extension ranges in the same message. Reserved ranges may\n  // not overlap.\n  message ReservedRange {\n    optional int32 start = 1; // Inclusive.\n    optional int32 end = 2;   // Exclusive.\n  }\n  repeated ReservedRange reserved_range = 9;\n  // Reserved field names, which may not be used by fields in the same message.\n  // A given name may only be reserved once.\n  repeated string reserved_name = 10;\n}\n\nmessage ExtensionRangeOptions {\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\n// Describes a field within a message.\nmessage FieldDescriptorProto {\n  enum Type {\n    // 0 is reserved for errors.\n    // Order is weird for historical reasons.\n    TYPE_DOUBLE         = 1;\n    TYPE_FLOAT          = 2;\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n    // negative values are likely.\n    TYPE_INT64          = 3;\n    TYPE_UINT64         = 4;\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n    // negative values are likely.\n    TYPE_INT32          = 5;\n    TYPE_FIXED64        = 6;\n    TYPE_FIXED32        = 7;\n    TYPE_BOOL           = 8;\n    TYPE_STRING         = 9;\n    // Tag-delimited aggregate.\n    // Group type is deprecated and not supported in proto3. However, Proto3\n    // implementations should still be able to parse the group wire format and\n    // treat group fields as unknown fields.\n    TYPE_GROUP          = 10;\n    TYPE_MESSAGE        = 11;  // Length-delimited aggregate.\n\n    // New in version 2.\n    TYPE_BYTES          = 12;\n    TYPE_UINT32         = 13;\n    TYPE_ENUM           = 14;\n    TYPE_SFIXED32       = 15;\n    TYPE_SFIXED64       = 16;\n    TYPE_SINT32         = 17;  // Uses ZigZag encoding.\n    TYPE_SINT64         = 18;  // Uses ZigZag encoding.\n  };\n\n  enum Label {\n    // 0 is reserved for errors\n    LABEL_OPTIONAL      = 1;\n    LABEL_REQUIRED      = 2;\n    LABEL_REPEATED      = 3;\n  };\n\n  optional string name = 1;\n  optional int32 number = 3;\n  optional Label label = 4;\n\n  // If type_name is set, this need not be set.  If both this and type_name\n  // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n  optional Type type = 5;\n\n  // For message and enum types, this is the name of the type.  If the name\n  // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n  // rules are used to find the type (i.e. first the nested types within this\n  // message are searched, then within the parent, on up to the root\n  // namespace).\n  optional string type_name = 6;\n\n  // For extensions, this is the name of the type being extended.  It is\n  // resolved in the same manner as type_name.\n  optional string extendee = 2;\n\n  // For numeric types, contains the original text representation of the value.\n  // For booleans, \"true\" or \"false\".\n  // For strings, contains the default text contents (not escaped in any way).\n  // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n  // TODO(kenton):  Base-64 encode?\n  optional string default_value = 7;\n\n  // If set, gives the index of a oneof in the containing type's oneof_decl\n  // list.  This field is a member of that oneof.\n  optional int32 oneof_index = 9;\n\n  // JSON name of this field. The value is set by protocol compiler. If the\n  // user has set a \"json_name\" option on this field, that option's value\n  // will be used. Otherwise, it's deduced from the field's name by converting\n  // it to camelCase.\n  optional string json_name = 10;\n\n  optional FieldOptions options = 8;\n}\n\n// Describes a oneof.\nmessage OneofDescriptorProto {\n  optional string name = 1;\n  optional OneofOptions options = 2;\n}\n\n// Describes an enum type.\nmessage EnumDescriptorProto {\n  optional string name = 1;\n\n  repeated EnumValueDescriptorProto value = 2;\n\n  optional EnumOptions options = 3;\n}\n\n// Describes a value within an enum.\nmessage EnumValueDescriptorProto {\n  optional string name = 1;\n  optional int32 number = 2;\n\n  optional EnumValueOptions options = 3;\n}\n\n// Describes a service.\nmessage ServiceDescriptorProto {\n  optional string name = 1;\n  repeated MethodDescriptorProto method = 2;\n\n  optional ServiceOptions options = 3;\n}\n\n// Describes a method of a service.\nmessage MethodDescriptorProto {\n  optional string name = 1;\n\n  // Input and output type names.  These are resolved in the same way as\n  // FieldDescriptorProto.type_name, but must refer to a message type.\n  optional string input_type = 2;\n  optional string output_type = 3;\n\n  optional MethodOptions options = 4;\n\n  // Identifies if client streams multiple client messages\n  optional bool client_streaming = 5 [default=false];\n  // Identifies if server streams multiple server messages\n  optional bool server_streaming = 6 [default=false];\n}\n\n\n// ===================================================================\n// Options\n\n// Each of the definitions above may have \"options\" attached.  These are\n// just annotations which may cause code to be generated slightly differently\n// or may contain hints for code that manipulates protocol messages.\n//\n// Clients may define custom options as extensions of the *Options messages.\n// These extensions may not yet be known at parsing time, so the parser cannot\n// store the values in them.  Instead it stores them in a field in the *Options\n// message called uninterpreted_option. This field must have the same name\n// across all *Options messages. We then use this field to populate the\n// extensions when we build a descriptor, at which point all protos have been\n// parsed and so all extensions are known.\n//\n// Extension numbers for custom options may be chosen as follows:\n// * For options which will only be used within a single application or\n//   organization, or for experimental options, use field numbers 50000\n//   through 99999.  It is up to you to ensure that you do not use the\n//   same number for multiple options.\n// * For options which will be published and used publicly by multiple\n//   independent entities, e-mail protobuf-global-extension-registry@google.com\n//   to reserve extension numbers. Simply provide your project name (e.g.\n//   Objective-C plugin) and your project website (if available) -- there's no\n//   need to explain how you intend to use them. Usually you only need one\n//   extension number. You can declare multiple options with only one extension\n//   number by putting them in a sub-message. See the Custom Options section of\n//   the docs for examples:\n//   https://developers.google.com/protocol-buffers/docs/proto#options\n//   If this turns out to be popular, a web service will be set up\n//   to automatically assign option numbers.\n\n\nmessage FileOptions {\n\n  // Sets the Java package where classes generated from this .proto will be\n  // placed.  By default, the proto package is used, but this is often\n  // inappropriate because proto packages do not normally start with backwards\n  // domain names.\n  optional string java_package = 1;\n\n\n  // If set, all the classes from the .proto file are wrapped in a single\n  // outer class with the given name.  This applies to both Proto1\n  // (equivalent to the old \"--one_java_file\" option) and Proto2 (where\n  // a .proto always translates to a single class, but you may want to\n  // explicitly choose the class name).\n  optional string java_outer_classname = 8;\n\n  // If set true, then the Java code generator will generate a separate .java\n  // file for each top-level message, enum, and service defined in the .proto\n  // file.  Thus, these types will *not* be nested inside the outer class\n  // named by java_outer_classname.  However, the outer class will still be\n  // generated to contain the file's getDescriptor() method as well as any\n  // top-level extensions defined in the file.\n  optional bool java_multiple_files = 10 [default=false];\n\n  // This option does nothing.\n  optional bool java_generate_equals_and_hash = 20 [deprecated=true];\n\n  // If set true, then the Java2 code generator will generate code that\n  // throws an exception whenever an attempt is made to assign a non-UTF-8\n  // byte sequence to a string field.\n  // Message reflection will do the same.\n  // However, an extension field still accepts non-UTF-8 byte sequences.\n  // This option has no effect on when used with the lite runtime.\n  optional bool java_string_check_utf8 = 27 [default=false];\n\n\n  // Generated classes can be optimized for speed or code size.\n  enum OptimizeMode {\n    SPEED = 1;        // Generate complete code for parsing, serialization,\n                      // etc.\n    CODE_SIZE = 2;    // Use ReflectionOps to implement these methods.\n    LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.\n  }\n  optional OptimizeMode optimize_for = 9 [default=SPEED];\n\n  // Sets the Go package where structs generated from this .proto will be\n  // placed. If omitted, the Go package will be derived from the following:\n  //   - The basename of the package import path, if provided.\n  //   - Otherwise, the package statement in the .proto file, if present.\n  //   - Otherwise, the basename of the .proto file, without extension.\n  optional string go_package = 11;\n\n\n\n  // Should generic services be generated in each language?  \"Generic\" services\n  // are not specific to any particular RPC system.  They are generated by the\n  // main code generators in each language (without additional plugins).\n  // Generic services were the only kind of service generation supported by\n  // early versions of google.protobuf.\n  //\n  // Generic services are now considered deprecated in favor of using plugins\n  // that generate code specific to your particular RPC system.  Therefore,\n  // these default to false.  Old code which depends on generic services should\n  // explicitly set them to true.\n  optional bool cc_generic_services = 16 [default=false];\n  optional bool java_generic_services = 17 [default=false];\n  optional bool py_generic_services = 18 [default=false];\n  optional bool php_generic_services = 42 [default=false];\n\n  // Is this file deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for everything in the file, or it will be completely ignored; in the very\n  // least, this is a formalization for deprecating files.\n  optional bool deprecated = 23 [default=false];\n\n  // Enables the use of arenas for the proto messages in this file. This applies\n  // only to generated classes for C++.\n  optional bool cc_enable_arenas = 31 [default=false];\n\n\n  // Sets the objective c class prefix which is prepended to all objective c\n  // generated classes from this .proto. There is no default.\n  optional string objc_class_prefix = 36;\n\n  // Namespace for generated classes; defaults to the package.\n  optional string csharp_namespace = 37;\n\n  // By default Swift generators will take the proto package and CamelCase it\n  // replacing '.' with underscore and use that to prefix the types/symbols\n  // defined. When this options is provided, they will use this value instead\n  // to prefix the types/symbols defined.\n  optional string swift_prefix = 39;\n\n  // Sets the php class prefix which is prepended to all php generated classes\n  // from this .proto. Default is empty.\n  optional string php_class_prefix = 40;\n\n  // Use this option to change the namespace of php generated classes. Default\n  // is empty. When this option is empty, the package name will be used for\n  // determining the namespace.\n  optional string php_namespace = 41;\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n\n  reserved 38;\n}\n\nmessage MessageOptions {\n  // Set true to use the old proto1 MessageSet wire format for extensions.\n  // This is provided for backwards-compatibility with the MessageSet wire\n  // format.  You should not use this for any other reason:  It's less\n  // efficient, has fewer features, and is more complicated.\n  //\n  // The message must be defined exactly as follows:\n  //   message Foo {\n  //     option message_set_wire_format = true;\n  //     extensions 4 to max;\n  //   }\n  // Note that the message cannot have any defined fields; MessageSets only\n  // have extensions.\n  //\n  // All extensions of your type must be singular messages; e.g. they cannot\n  // be int32s, enums, or repeated messages.\n  //\n  // Because this is an option, the above two restrictions are not enforced by\n  // the protocol compiler.\n  optional bool message_set_wire_format = 1 [default=false];\n\n  // Disables the generation of the standard \"descriptor()\" accessor, which can\n  // conflict with a field of the same name.  This is meant to make migration\n  // from proto1 easier; new code should avoid fields named \"descriptor\".\n  optional bool no_standard_descriptor_accessor = 2 [default=false];\n\n  // Is this message deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the message, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating messages.\n  optional bool deprecated = 3 [default=false];\n\n  // Whether the message is an automatically generated map entry type for the\n  // maps field.\n  //\n  // For maps fields:\n  //     map<KeyType, ValueType> map_field = 1;\n  // The parsed descriptor looks like:\n  //     message MapFieldEntry {\n  //         option map_entry = true;\n  //         optional KeyType key = 1;\n  //         optional ValueType value = 2;\n  //     }\n  //     repeated MapFieldEntry map_field = 1;\n  //\n  // Implementations may choose not to generate the map_entry=true message, but\n  // use a native map in the target language to hold the keys and values.\n  // The reflection APIs in such implementions still need to work as\n  // if the field is a repeated message field.\n  //\n  // NOTE: Do not set the option in .proto files. Always use the maps syntax\n  // instead. The option should only be implicitly set by the proto compiler\n  // parser.\n  optional bool map_entry = 7;\n\n  reserved 8;  // javalite_serializable\n  reserved 9;  // javanano_as_lite\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage FieldOptions {\n  // The ctype option instructs the C++ code generator to use a different\n  // representation of the field than it normally would.  See the specific\n  // options below.  This option is not yet implemented in the open source\n  // release -- sorry, we'll try to include it in a future version!\n  optional CType ctype = 1 [default = STRING];\n  enum CType {\n    // Default mode.\n    STRING = 0;\n\n    CORD = 1;\n\n    STRING_PIECE = 2;\n  }\n  // The packed option can be enabled for repeated primitive fields to enable\n  // a more efficient representation on the wire. Rather than repeatedly\n  // writing the tag and type for each element, the entire array is encoded as\n  // a single length-delimited blob. In proto3, only explicit setting it to\n  // false will avoid using packed encoding.\n  optional bool packed = 2;\n\n  // The jstype option determines the JavaScript type used for values of the\n  // field.  The option is permitted only for 64 bit integral and fixed types\n  // (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING\n  // is represented as JavaScript string, which avoids loss of precision that\n  // can happen when a large value is converted to a floating point JavaScript.\n  // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n  // use the JavaScript \"number\" type.  The behavior of the default option\n  // JS_NORMAL is implementation dependent.\n  //\n  // This option is an enum to permit additional types to be added, e.g.\n  // goog.math.Integer.\n  optional JSType jstype = 6 [default = JS_NORMAL];\n  enum JSType {\n    // Use the default type.\n    JS_NORMAL = 0;\n\n    // Use JavaScript strings.\n    JS_STRING = 1;\n\n    // Use JavaScript numbers.\n    JS_NUMBER = 2;\n  }\n\n  // Should this field be parsed lazily?  Lazy applies only to message-type\n  // fields.  It means that when the outer message is initially parsed, the\n  // inner message's contents will not be parsed but instead stored in encoded\n  // form.  The inner message will actually be parsed when it is first accessed.\n  //\n  // This is only a hint.  Implementations are free to choose whether to use\n  // eager or lazy parsing regardless of the value of this option.  However,\n  // setting this option true suggests that the protocol author believes that\n  // using lazy parsing on this field is worth the additional bookkeeping\n  // overhead typically needed to implement it.\n  //\n  // This option does not affect the public interface of any generated code;\n  // all method signatures remain the same.  Furthermore, thread-safety of the\n  // interface is not affected by this option; const methods remain safe to\n  // call from multiple threads concurrently, while non-const methods continue\n  // to require exclusive access.\n  //\n  //\n  // Note that implementations may choose not to check required fields within\n  // a lazy sub-message.  That is, calling IsInitialized() on the outer message\n  // may return true even if the inner message has missing required fields.\n  // This is necessary because otherwise the inner message would have to be\n  // parsed in order to perform the check, defeating the purpose of lazy\n  // parsing.  An implementation which chooses not to check required fields\n  // must be consistent about it.  That is, for any particular sub-message, the\n  // implementation must either *always* check its required fields, or *never*\n  // check its required fields, regardless of whether or not the message has\n  // been parsed.\n  optional bool lazy = 5 [default=false];\n\n  // Is this field deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for accessors, or it will be completely ignored; in the very least, this\n  // is a formalization for deprecating fields.\n  optional bool deprecated = 3 [default=false];\n\n  // For Google-internal migration only. Do not use.\n  optional bool weak = 10 [default=false];\n\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n\n  reserved 4;  // removed jtype\n}\n\nmessage OneofOptions {\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumOptions {\n\n  // Set this option to true to allow mapping different tag names to the same\n  // value.\n  optional bool allow_alias = 2;\n\n  // Is this enum deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the enum, or it will be completely ignored; in the very least, this\n  // is a formalization for deprecating enums.\n  optional bool deprecated = 3 [default=false];\n\n  reserved 5;  // javanano_as_lite\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumValueOptions {\n  // Is this enum value deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the enum value, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating enum values.\n  optional bool deprecated = 1 [default=false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage ServiceOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // Is this service deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the service, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating services.\n  optional bool deprecated = 33 [default=false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage MethodOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // Is this method deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the method, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating methods.\n  optional bool deprecated = 33 [default=false];\n\n  // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n  // or neither? HTTP based RPC implementation may choose GET verb for safe\n  // methods, and PUT verb for idempotent methods instead of the default POST.\n  enum IdempotencyLevel {\n    IDEMPOTENCY_UNKNOWN = 0;\n    NO_SIDE_EFFECTS     = 1; // implies idempotent\n    IDEMPOTENT          = 2; // idempotent, but may have side effects\n  }\n  optional IdempotencyLevel idempotency_level =\n      34 [default=IDEMPOTENCY_UNKNOWN];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\nmessage UninterpretedOption {\n  // The name of the uninterpreted option.  Each string represents a segment in\n  // a dot-separated name.  is_extension is true iff a segment represents an\n  // extension (denoted with parentheses in options specs in .proto files).\n  // E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n  // \"foo.(bar.baz).qux\".\n  message NamePart {\n    required string name_part = 1;\n    required bool is_extension = 2;\n  }\n  repeated NamePart name = 2;\n\n  // The value of the uninterpreted option, in whatever type the tokenizer\n  // identified it as during parsing. Exactly one of these should be set.\n  optional string identifier_value = 3;\n  optional uint64 positive_int_value = 4;\n  optional int64 negative_int_value = 5;\n  optional double double_value = 6;\n  optional bytes string_value = 7;\n  optional string aggregate_value = 8;\n}\n\n// ===================================================================\n// Optional source code info\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\nmessage SourceCodeInfo {\n  // A Location identifies a piece of source code in a .proto file which\n  // corresponds to a particular definition.  This information is intended\n  // to be useful to IDEs, code indexers, documentation generators, and similar\n  // tools.\n  //\n  // For example, say we have a file like:\n  //   message Foo {\n  //     optional string foo = 1;\n  //   }\n  // Let's look at just the field definition:\n  //   optional string foo = 1;\n  //   ^       ^^     ^^  ^  ^^^\n  //   a       bc     de  f  ghi\n  // We have the following locations:\n  //   span   path               represents\n  //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n  //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n  //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n  //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n  //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n  //\n  // Notes:\n  // - A location may refer to a repeated field itself (i.e. not to any\n  //   particular index within it).  This is used whenever a set of elements are\n  //   logically enclosed in a single code segment.  For example, an entire\n  //   extend block (possibly containing multiple extension definitions) will\n  //   have an outer location whose path refers to the \"extensions\" repeated\n  //   field without an index.\n  // - Multiple locations may have the same path.  This happens when a single\n  //   logical declaration is spread out across multiple places.  The most\n  //   obvious example is the \"extend\" block again -- there may be multiple\n  //   extend blocks in the same scope, each of which will have the same path.\n  // - A location's span is not always a subset of its parent's span.  For\n  //   example, the \"extendee\" of an extension declaration appears at the\n  //   beginning of the \"extend\" block and is shared by all extensions within\n  //   the block.\n  // - Just because a location's span is a subset of some other location's span\n  //   does not mean that it is a descendent.  For example, a \"group\" defines\n  //   both a type and a field in a single declaration.  Thus, the locations\n  //   corresponding to the type and field and their components will overlap.\n  // - Code which tries to interpret locations should probably be designed to\n  //   ignore those that it doesn't understand, as more types of locations could\n  //   be recorded in the future.\n  repeated Location location = 1;\n  message Location {\n    // Identifies which part of the FileDescriptorProto was defined at this\n    // location.\n    //\n    // Each element is a field number or an index.  They form a path from\n    // the root FileDescriptorProto to the place where the definition.  For\n    // example, this path:\n    //   [ 4, 3, 2, 7, 1 ]\n    // refers to:\n    //   file.message_type(3)  // 4, 3\n    //       .field(7)         // 2, 7\n    //       .name()           // 1\n    // This is because FileDescriptorProto.message_type has field number 4:\n    //   repeated DescriptorProto message_type = 4;\n    // and DescriptorProto.field has field number 2:\n    //   repeated FieldDescriptorProto field = 2;\n    // and FieldDescriptorProto.name has field number 1:\n    //   optional string name = 1;\n    //\n    // Thus, the above path gives the location of a field name.  If we removed\n    // the last element:\n    //   [ 4, 3, 2, 7 ]\n    // this path refers to the whole field declaration (from the beginning\n    // of the label to the terminating semicolon).\n    repeated int32 path = 1 [packed=true];\n\n    // Always has exactly three or four elements: start line, start column,\n    // end line (optional, otherwise assumed same as start line), end column.\n    // These are packed into a single field for efficiency.  Note that line\n    // and column numbers are zero-based -- typically you will want to add\n    // 1 to each before displaying to a user.\n    repeated int32 span = 2 [packed=true];\n\n    // If this SourceCodeInfo represents a complete declaration, these are any\n    // comments appearing before and after the declaration which appear to be\n    // attached to the declaration.\n    //\n    // A series of line comments appearing on consecutive lines, with no other\n    // tokens appearing on those lines, will be treated as a single comment.\n    //\n    // leading_detached_comments will keep paragraphs of comments that appear\n    // before (but not connected to) the current element. Each paragraph,\n    // separated by empty lines, will be one comment element in the repeated\n    // field.\n    //\n    // Only the comment content is provided; comment markers (e.g. //) are\n    // stripped out.  For block comments, leading whitespace and an asterisk\n    // will be stripped from the beginning of each line other than the first.\n    // Newlines are included in the output.\n    //\n    // Examples:\n    //\n    //   optional int32 foo = 1;  // Comment attached to foo.\n    //   // Comment attached to bar.\n    //   optional int32 bar = 2;\n    //\n    //   optional string baz = 3;\n    //   // Comment attached to baz.\n    //   // Another line attached to baz.\n    //\n    //   // Comment attached to qux.\n    //   //\n    //   // Another line attached to qux.\n    //   optional double qux = 4;\n    //\n    //   // Detached comment for corge. This is not leading or trailing comments\n    //   // to qux or corge because there are blank lines separating it from\n    //   // both.\n    //\n    //   // Detached comment for corge paragraph 2.\n    //\n    //   optional string corge = 5;\n    //   /* Block comment attached\n    //    * to corge.  Leading asterisks\n    //    * will be removed. */\n    //   /* Block comment attached to\n    //    * grault. */\n    //   optional int32 grault = 6;\n    //\n    //   // ignored detached comments.\n    optional string leading_comments = 3;\n    optional string trailing_comments = 4;\n    repeated string leading_detached_comments = 6;\n  }\n}\n\n// Describes the relationship between generated code and its original source\n// file. A GeneratedCodeInfo message is associated with only one generated\n// source file, but may contain references to different source .proto files.\nmessage GeneratedCodeInfo {\n  // An Annotation connects some span of text in generated code to an element\n  // of its generating .proto file.\n  repeated Annotation annotation = 1;\n  message Annotation {\n    // Identifies the element in the original source .proto file. This field\n    // is formatted the same as SourceCodeInfo.Location.path.\n    repeated int32 path = 1 [packed=true];\n\n    // Identifies the filesystem path to the original source .proto.\n    optional string source_file = 2;\n\n    // Identifies the starting offset in bytes in the generated code\n    // that relates to the identified object.\n    optional int32 begin = 3;\n\n    // Identifies the ending offset in bytes in the generated code that\n    // relates to the identified offset. The end offset should be one past\n    // the last relevant byte (so the length of the text = end - begin).\n    optional int32 end = 4;\n  }\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/doc.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/*\n\tA plugin for the Google protocol buffer compiler to generate Go code.\n\tRun it by building this program and putting it in your path with the name\n\t\tprotoc-gen-go\n\tThat word 'go' at the end becomes part of the option string set for the\n\tprotocol compiler, so once the protocol compiler (protoc) is installed\n\tyou can run\n\t\tprotoc --go_out=output_directory input_directory/file.proto\n\tto generate Go bindings for the protocol defined by file.proto.\n\tWith that input, the output will be written to\n\t\toutput_directory/file.pb.go\n\n\tThe generated code is documented in the package comment for\n\tthe library.\n\n\tSee the README and documentation for protocol buffers to learn more:\n\t\thttps://developers.google.com/protocol-buffers/\n\n*/\npackage documentation\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/generator/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ninclude $(GOROOT)/src/Make.inc\n\nTARG=github.com/golang/protobuf/compiler/generator\nGOFILES=\\\n\tgenerator.go\\\n\nDEPS=../descriptor ../plugin ../../proto\n\ninclude $(GOROOT)/src/Make.pkg\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/generator/generator.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/*\n\tThe code generator for the plugin for the Google protocol buffer compiler.\n\tIt generates Go code from the protocol buffer description files read by the\n\tmain routine.\n*/\npackage generator\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"fmt\"\n\t\"go/parser\"\n\t\"go/printer\"\n\t\"go/token\"\n\t\"log\"\n\t\"os\"\n\t\"path\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"github.com/golang/protobuf/proto\"\n\n\t\"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\tplugin \"github.com/golang/protobuf/protoc-gen-go/plugin\"\n)\n\n// generatedCodeVersion indicates a version of the generated code.\n// It is incremented whenever an incompatibility between the generated code and\n// proto package is introduced; the generated code references\n// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion).\nconst generatedCodeVersion = 2\n\n// A Plugin provides functionality to add to the output during Go code generation,\n// such as to produce RPC stubs.\ntype Plugin interface {\n\t// Name identifies the plugin.\n\tName() string\n\t// Init is called once after data structures are built but before\n\t// code generation begins.\n\tInit(g *Generator)\n\t// Generate produces the code generated by the plugin for this file,\n\t// except for the imports, by calling the generator's methods P, In, and Out.\n\tGenerate(file *FileDescriptor)\n\t// GenerateImports produces the import declarations for this file.\n\t// It is called after Generate.\n\tGenerateImports(file *FileDescriptor)\n}\n\nvar plugins []Plugin\n\n// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated.\n// It is typically called during initialization.\nfunc RegisterPlugin(p Plugin) {\n\tplugins = append(plugins, p)\n}\n\n// Each type we import as a protocol buffer (other than FileDescriptorProto) needs\n// a pointer to the FileDescriptorProto that represents it.  These types achieve that\n// wrapping by placing each Proto inside a struct with the pointer to its File. The\n// structs have the same names as their contents, with \"Proto\" removed.\n// FileDescriptor is used to store the things that it points to.\n\n// The file and package name method are common to messages and enums.\ntype common struct {\n\tfile *descriptor.FileDescriptorProto // File this object comes from.\n}\n\n// PackageName is name in the package clause in the generated file.\nfunc (c *common) PackageName() string { return uniquePackageOf(c.file) }\n\nfunc (c *common) File() *descriptor.FileDescriptorProto { return c.file }\n\nfunc fileIsProto3(file *descriptor.FileDescriptorProto) bool {\n\treturn file.GetSyntax() == \"proto3\"\n}\n\nfunc (c *common) proto3() bool { return fileIsProto3(c.file) }\n\n// Descriptor represents a protocol buffer message.\ntype Descriptor struct {\n\tcommon\n\t*descriptor.DescriptorProto\n\tparent   *Descriptor            // The containing message, if any.\n\tnested   []*Descriptor          // Inner messages, if any.\n\tenums    []*EnumDescriptor      // Inner enums, if any.\n\text      []*ExtensionDescriptor // Extensions, if any.\n\ttypename []string               // Cached typename vector.\n\tindex    int                    // The index into the container, whether the file or another message.\n\tpath     string                 // The SourceCodeInfo path as comma-separated integers.\n\tgroup    bool\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (d *Descriptor) TypeName() []string {\n\tif d.typename != nil {\n\t\treturn d.typename\n\t}\n\tn := 0\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn++\n\t}\n\ts := make([]string, n, n)\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn--\n\t\ts[n] = parent.GetName()\n\t}\n\td.typename = s\n\treturn s\n}\n\n// EnumDescriptor describes an enum. If it's at top level, its parent will be nil.\n// Otherwise it will be the descriptor of the message in which it is defined.\ntype EnumDescriptor struct {\n\tcommon\n\t*descriptor.EnumDescriptorProto\n\tparent   *Descriptor // The containing message, if any.\n\ttypename []string    // Cached typename vector.\n\tindex    int         // The index into the container, whether the file or a message.\n\tpath     string      // The SourceCodeInfo path as comma-separated integers.\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (e *EnumDescriptor) TypeName() (s []string) {\n\tif e.typename != nil {\n\t\treturn e.typename\n\t}\n\tname := e.GetName()\n\tif e.parent == nil {\n\t\ts = make([]string, 1)\n\t} else {\n\t\tpname := e.parent.TypeName()\n\t\ts = make([]string, len(pname)+1)\n\t\tcopy(s, pname)\n\t}\n\ts[len(s)-1] = name\n\te.typename = s\n\treturn s\n}\n\n// Everything but the last element of the full type name, CamelCased.\n// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... .\nfunc (e *EnumDescriptor) prefix() string {\n\tif e.parent == nil {\n\t\t// If the enum is not part of a message, the prefix is just the type name.\n\t\treturn CamelCase(*e.Name) + \"_\"\n\t}\n\ttypeName := e.TypeName()\n\treturn CamelCaseSlice(typeName[0:len(typeName)-1]) + \"_\"\n}\n\n// The integer value of the named constant in this enumerated type.\nfunc (e *EnumDescriptor) integerValueAsString(name string) string {\n\tfor _, c := range e.Value {\n\t\tif c.GetName() == name {\n\t\t\treturn fmt.Sprint(c.GetNumber())\n\t\t}\n\t}\n\tlog.Fatal(\"cannot find value for enum constant\")\n\treturn \"\"\n}\n\n// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil.\n// Otherwise it will be the descriptor of the message in which it is defined.\ntype ExtensionDescriptor struct {\n\tcommon\n\t*descriptor.FieldDescriptorProto\n\tparent *Descriptor // The containing message, if any.\n}\n\n// TypeName returns the elements of the dotted type name.\n// The package name is not part of this name.\nfunc (e *ExtensionDescriptor) TypeName() (s []string) {\n\tname := e.GetName()\n\tif e.parent == nil {\n\t\t// top-level extension\n\t\ts = make([]string, 1)\n\t} else {\n\t\tpname := e.parent.TypeName()\n\t\ts = make([]string, len(pname)+1)\n\t\tcopy(s, pname)\n\t}\n\ts[len(s)-1] = name\n\treturn s\n}\n\n// DescName returns the variable name used for the generated descriptor.\nfunc (e *ExtensionDescriptor) DescName() string {\n\t// The full type name.\n\ttypeName := e.TypeName()\n\t// Each scope of the extension is individually CamelCased, and all are joined with \"_\" with an \"E_\" prefix.\n\tfor i, s := range typeName {\n\t\ttypeName[i] = CamelCase(s)\n\t}\n\treturn \"E_\" + strings.Join(typeName, \"_\")\n}\n\n// ImportedDescriptor describes a type that has been publicly imported from another file.\ntype ImportedDescriptor struct {\n\tcommon\n\to Object\n}\n\nfunc (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() }\n\n// FileDescriptor describes an protocol buffer descriptor file (.proto).\n// It includes slices of all the messages and enums defined within it.\n// Those slices are constructed by WrapTypes.\ntype FileDescriptor struct {\n\t*descriptor.FileDescriptorProto\n\tdesc []*Descriptor          // All the messages defined in this file.\n\tenum []*EnumDescriptor      // All the enums defined in this file.\n\text  []*ExtensionDescriptor // All the top-level extensions defined in this file.\n\timp  []*ImportedDescriptor  // All types defined in files publicly imported by this file.\n\n\t// Comments, stored as a map of path (comma-separated integers) to the comment.\n\tcomments map[string]*descriptor.SourceCodeInfo_Location\n\n\t// The full list of symbols that are exported,\n\t// as a map from the exported object to its symbols.\n\t// This is used for supporting public imports.\n\texported map[Object][]symbol\n\n\tindex int // The index of this file in the list of files to generate code for\n\n\tproto3 bool // whether to generate proto3 code for this file\n}\n\n// PackageName is the package name we'll use in the generated code to refer to this file.\nfunc (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDescriptorProto) }\n\n// VarName is the variable name we'll use in the generated code to refer\n// to the compressed bytes of this descriptor. It is not exported, so\n// it is only valid inside the generated package.\nfunc (d *FileDescriptor) VarName() string { return fmt.Sprintf(\"fileDescriptor%d\", d.index) }\n\n// goPackageOption interprets the file's go_package option.\n// If there is no go_package, it returns (\"\", \"\", false).\n// If there's a simple name, it returns (\"\", pkg, true).\n// If the option implies an import path, it returns (impPath, pkg, true).\nfunc (d *FileDescriptor) goPackageOption() (impPath, pkg string, ok bool) {\n\tpkg = d.GetOptions().GetGoPackage()\n\tif pkg == \"\" {\n\t\treturn\n\t}\n\tok = true\n\t// The presence of a slash implies there's an import path.\n\tslash := strings.LastIndex(pkg, \"/\")\n\tif slash < 0 {\n\t\treturn\n\t}\n\timpPath, pkg = pkg, pkg[slash+1:]\n\t// A semicolon-delimited suffix overrides the package name.\n\tsc := strings.IndexByte(impPath, ';')\n\tif sc < 0 {\n\t\treturn\n\t}\n\timpPath, pkg = impPath[:sc], impPath[sc+1:]\n\treturn\n}\n\n// goPackageName returns the Go package name to use in the\n// generated Go file.  The result explicit reports whether the name\n// came from an option go_package statement.  If explicit is false,\n// the name was derived from the protocol buffer's package statement\n// or the input file name.\nfunc (d *FileDescriptor) goPackageName() (name string, explicit bool) {\n\t// Does the file have a \"go_package\" option?\n\tif _, pkg, ok := d.goPackageOption(); ok {\n\t\treturn pkg, true\n\t}\n\n\t// Does the file have a package clause?\n\tif pkg := d.GetPackage(); pkg != \"\" {\n\t\treturn pkg, false\n\t}\n\t// Use the file base name.\n\treturn baseName(d.GetName()), false\n}\n\n// goFileName returns the output name for the generated Go file.\nfunc (d *FileDescriptor) goFileName() string {\n\tname := *d.Name\n\tif ext := path.Ext(name); ext == \".proto\" || ext == \".protodevel\" {\n\t\tname = name[:len(name)-len(ext)]\n\t}\n\tname += \".pb.go\"\n\n\t// Does the file have a \"go_package\" option?\n\t// If it does, it may override the filename.\n\tif impPath, _, ok := d.goPackageOption(); ok && impPath != \"\" {\n\t\t// Replace the existing dirname with the declared import path.\n\t\t_, name = path.Split(name)\n\t\tname = path.Join(impPath, name)\n\t\treturn name\n\t}\n\n\treturn name\n}\n\nfunc (d *FileDescriptor) addExport(obj Object, sym symbol) {\n\td.exported[obj] = append(d.exported[obj], sym)\n}\n\n// symbol is an interface representing an exported Go symbol.\ntype symbol interface {\n\t// GenerateAlias should generate an appropriate alias\n\t// for the symbol from the named package.\n\tGenerateAlias(g *Generator, pkg string)\n}\n\ntype messageSymbol struct {\n\tsym                         string\n\thasExtensions, isMessageSet bool\n\thasOneof                    bool\n\tgetters                     []getterSymbol\n}\n\ntype getterSymbol struct {\n\tname     string\n\ttyp      string\n\ttypeName string // canonical name in proto world; empty for proto.Message and similar\n\tgenType  bool   // whether typ contains a generated type (message/group/enum)\n}\n\nfunc (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) {\n\tremoteSym := pkg + \".\" + ms.sym\n\n\tg.P(\"type \", ms.sym, \" \", remoteSym)\n\tg.P(\"func (m *\", ms.sym, \") Reset() { (*\", remoteSym, \")(m).Reset() }\")\n\tg.P(\"func (m *\", ms.sym, \") String() string { return (*\", remoteSym, \")(m).String() }\")\n\tg.P(\"func (*\", ms.sym, \") ProtoMessage() {}\")\n\tif ms.hasExtensions {\n\t\tg.P(\"func (*\", ms.sym, \") ExtensionRangeArray() []\", g.Pkg[\"proto\"], \".ExtensionRange \",\n\t\t\t\"{ return (*\", remoteSym, \")(nil).ExtensionRangeArray() }\")\n\t\tif ms.isMessageSet {\n\t\t\tg.P(\"func (m *\", ms.sym, \") Marshal() ([]byte, error) \",\n\t\t\t\t\"{ return (*\", remoteSym, \")(m).Marshal() }\")\n\t\t\tg.P(\"func (m *\", ms.sym, \") Unmarshal(buf []byte) error \",\n\t\t\t\t\"{ return (*\", remoteSym, \")(m).Unmarshal(buf) }\")\n\t\t}\n\t}\n\tif ms.hasOneof {\n\t\t// Oneofs and public imports do not mix well.\n\t\t// We can make them work okay for the binary format,\n\t\t// but they're going to break weirdly for text/JSON.\n\t\tenc := \"_\" + ms.sym + \"_OneofMarshaler\"\n\t\tdec := \"_\" + ms.sym + \"_OneofUnmarshaler\"\n\t\tsize := \"_\" + ms.sym + \"_OneofSizer\"\n\t\tencSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message, b *\" + g.Pkg[\"proto\"] + \".Buffer) error\"\n\t\tdecSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message, tag, wire int, b *\" + g.Pkg[\"proto\"] + \".Buffer) (bool, error)\"\n\t\tsizeSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message) int\"\n\t\tg.P(\"func (m *\", ms.sym, \") XXX_OneofFuncs() (func\", encSig, \", func\", decSig, \", func\", sizeSig, \", []interface{}) {\")\n\t\tg.P(\"return \", enc, \", \", dec, \", \", size, \", nil\")\n\t\tg.P(\"}\")\n\n\t\tg.P(\"func \", enc, encSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ms.sym, \")\")\n\t\tg.P(\"m0 := (*\", remoteSym, \")(m)\")\n\t\tg.P(\"enc, _, _, _ := m0.XXX_OneofFuncs()\")\n\t\tg.P(\"return enc(m0, b)\")\n\t\tg.P(\"}\")\n\n\t\tg.P(\"func \", dec, decSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ms.sym, \")\")\n\t\tg.P(\"m0 := (*\", remoteSym, \")(m)\")\n\t\tg.P(\"_, dec, _, _ := m0.XXX_OneofFuncs()\")\n\t\tg.P(\"return dec(m0, tag, wire, b)\")\n\t\tg.P(\"}\")\n\n\t\tg.P(\"func \", size, sizeSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ms.sym, \")\")\n\t\tg.P(\"m0 := (*\", remoteSym, \")(m)\")\n\t\tg.P(\"_, _, size, _ := m0.XXX_OneofFuncs()\")\n\t\tg.P(\"return size(m0)\")\n\t\tg.P(\"}\")\n\t}\n\tfor _, get := range ms.getters {\n\n\t\tif get.typeName != \"\" {\n\t\t\tg.RecordTypeUse(get.typeName)\n\t\t}\n\t\ttyp := get.typ\n\t\tval := \"(*\" + remoteSym + \")(m).\" + get.name + \"()\"\n\t\tif get.genType {\n\t\t\t// typ will be \"*pkg.T\" (message/group) or \"pkg.T\" (enum)\n\t\t\t// or \"map[t]*pkg.T\" (map to message/enum).\n\t\t\t// The first two of those might have a \"[]\" prefix if it is repeated.\n\t\t\t// Drop any package qualifier since we have hoisted the type into this package.\n\t\t\trep := strings.HasPrefix(typ, \"[]\")\n\t\t\tif rep {\n\t\t\t\ttyp = typ[2:]\n\t\t\t}\n\t\t\tisMap := strings.HasPrefix(typ, \"map[\")\n\t\t\tstar := typ[0] == '*'\n\t\t\tif !isMap { // map types handled lower down\n\t\t\t\ttyp = typ[strings.Index(typ, \".\")+1:]\n\t\t\t}\n\t\t\tif star {\n\t\t\t\ttyp = \"*\" + typ\n\t\t\t}\n\t\t\tif rep {\n\t\t\t\t// Go does not permit conversion between slice types where both\n\t\t\t\t// element types are named. That means we need to generate a bit\n\t\t\t\t// of code in this situation.\n\t\t\t\t// typ is the element type.\n\t\t\t\t// val is the expression to get the slice from the imported type.\n\n\t\t\t\tctyp := typ // conversion type expression; \"Foo\" or \"(*Foo)\"\n\t\t\t\tif star {\n\t\t\t\t\tctyp = \"(\" + typ + \")\"\n\t\t\t\t}\n\n\t\t\t\tg.P(\"func (m *\", ms.sym, \") \", get.name, \"() []\", typ, \" {\")\n\t\t\t\tg.In()\n\t\t\t\tg.P(\"o := \", val)\n\t\t\t\tg.P(\"if o == nil {\")\n\t\t\t\tg.In()\n\t\t\t\tg.P(\"return nil\")\n\t\t\t\tg.Out()\n\t\t\t\tg.P(\"}\")\n\t\t\t\tg.P(\"s := make([]\", typ, \", len(o))\")\n\t\t\t\tg.P(\"for i, x := range o {\")\n\t\t\t\tg.In()\n\t\t\t\tg.P(\"s[i] = \", ctyp, \"(x)\")\n\t\t\t\tg.Out()\n\t\t\t\tg.P(\"}\")\n\t\t\t\tg.P(\"return s\")\n\t\t\t\tg.Out()\n\t\t\t\tg.P(\"}\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isMap {\n\t\t\t\t// Split map[keyTyp]valTyp.\n\t\t\t\tbra, ket := strings.Index(typ, \"[\"), strings.Index(typ, \"]\")\n\t\t\t\tkeyTyp, valTyp := typ[bra+1:ket], typ[ket+1:]\n\t\t\t\t// Drop any package qualifier.\n\t\t\t\t// Only the value type may be foreign.\n\t\t\t\tstar := valTyp[0] == '*'\n\t\t\t\tvalTyp = valTyp[strings.Index(valTyp, \".\")+1:]\n\t\t\t\tif star {\n\t\t\t\t\tvalTyp = \"*\" + valTyp\n\t\t\t\t}\n\n\t\t\t\ttyp := \"map[\" + keyTyp + \"]\" + valTyp\n\t\t\t\tg.P(\"func (m *\", ms.sym, \") \", get.name, \"() \", typ, \" {\")\n\t\t\t\tg.P(\"o := \", val)\n\t\t\t\tg.P(\"if o == nil { return nil }\")\n\t\t\t\tg.P(\"s := make(\", typ, \", len(o))\")\n\t\t\t\tg.P(\"for k, v := range o {\")\n\t\t\t\tg.P(\"s[k] = (\", valTyp, \")(v)\")\n\t\t\t\tg.P(\"}\")\n\t\t\t\tg.P(\"return s\")\n\t\t\t\tg.P(\"}\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Convert imported type into the forwarding type.\n\t\t\tval = \"(\" + typ + \")(\" + val + \")\"\n\t\t}\n\n\t\tg.P(\"func (m *\", ms.sym, \") \", get.name, \"() \", typ, \" { return \", val, \" }\")\n\t}\n\n}\n\ntype enumSymbol struct {\n\tname   string\n\tproto3 bool // Whether this came from a proto3 file.\n}\n\nfunc (es enumSymbol) GenerateAlias(g *Generator, pkg string) {\n\ts := es.name\n\tg.P(\"type \", s, \" \", pkg, \".\", s)\n\tg.P(\"var \", s, \"_name = \", pkg, \".\", s, \"_name\")\n\tg.P(\"var \", s, \"_value = \", pkg, \".\", s, \"_value\")\n\tg.P(\"func (x \", s, \") String() string { return (\", pkg, \".\", s, \")(x).String() }\")\n\tif !es.proto3 {\n\t\tg.P(\"func (x \", s, \") Enum() *\", s, \"{ return (*\", s, \")((\", pkg, \".\", s, \")(x).Enum()) }\")\n\t\tg.P(\"func (x *\", s, \") UnmarshalJSON(data []byte) error { return (*\", pkg, \".\", s, \")(x).UnmarshalJSON(data) }\")\n\t}\n}\n\ntype constOrVarSymbol struct {\n\tsym  string\n\ttyp  string // either \"const\" or \"var\"\n\tcast string // if non-empty, a type cast is required (used for enums)\n}\n\nfunc (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg string) {\n\tv := pkg + \".\" + cs.sym\n\tif cs.cast != \"\" {\n\t\tv = cs.cast + \"(\" + v + \")\"\n\t}\n\tg.P(cs.typ, \" \", cs.sym, \" = \", v)\n}\n\n// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects.\ntype Object interface {\n\tPackageName() string // The name we use in our output (a_b_c), possibly renamed for uniqueness.\n\tTypeName() []string\n\tFile() *descriptor.FileDescriptorProto\n}\n\n// Each package name we generate must be unique. The package we're generating\n// gets its own name but every other package must have a unique name that does\n// not conflict in the code we generate.  These names are chosen globally (although\n// they don't have to be, it simplifies things to do them globally).\nfunc uniquePackageOf(fd *descriptor.FileDescriptorProto) string {\n\ts, ok := uniquePackageName[fd]\n\tif !ok {\n\t\tlog.Fatal(\"internal error: no package name defined for \" + fd.GetName())\n\t}\n\treturn s\n}\n\n// Generator is the type whose methods generate the output, stored in the associated response structure.\ntype Generator struct {\n\t*bytes.Buffer\n\n\tRequest  *plugin.CodeGeneratorRequest  // The input.\n\tResponse *plugin.CodeGeneratorResponse // The output.\n\n\tParam             map[string]string // Command-line parameters.\n\tPackageImportPath string            // Go import path of the package we're generating code for\n\tImportPrefix      string            // String to prefix to imported package file names.\n\tImportMap         map[string]string // Mapping from .proto file name to import path\n\n\tPkg map[string]string // The names under which we import support packages\n\n\tpackageName      string                     // What we're calling ourselves.\n\tallFiles         []*FileDescriptor          // All files in the tree\n\tallFilesByName   map[string]*FileDescriptor // All files by filename.\n\tgenFiles         []*FileDescriptor          // Those files we will generate output for.\n\tfile             *FileDescriptor            // The file we are compiling now.\n\tusedPackages     map[string]bool            // Names of packages used in current file.\n\ttypeNameToObject map[string]Object          // Key is a fully-qualified name in input syntax.\n\tinit             []string                   // Lines to emit in the init function.\n\tindent           string\n\twriteOutput      bool\n}\n\n// New creates a new generator and allocates the request and response protobufs.\nfunc New() *Generator {\n\tg := new(Generator)\n\tg.Buffer = new(bytes.Buffer)\n\tg.Request = new(plugin.CodeGeneratorRequest)\n\tg.Response = new(plugin.CodeGeneratorResponse)\n\treturn g\n}\n\n// Error reports a problem, including an error, and exits the program.\nfunc (g *Generator) Error(err error, msgs ...string) {\n\ts := strings.Join(msgs, \" \") + \":\" + err.Error()\n\tlog.Print(\"protoc-gen-go: error:\", s)\n\tos.Exit(1)\n}\n\n// Fail reports a problem and exits the program.\nfunc (g *Generator) Fail(msgs ...string) {\n\ts := strings.Join(msgs, \" \")\n\tlog.Print(\"protoc-gen-go: error:\", s)\n\tos.Exit(1)\n}\n\n// CommandLineParameters breaks the comma-separated list of key=value pairs\n// in the parameter (a member of the request protobuf) into a key/value map.\n// It then sets file name mappings defined by those entries.\nfunc (g *Generator) CommandLineParameters(parameter string) {\n\tg.Param = make(map[string]string)\n\tfor _, p := range strings.Split(parameter, \",\") {\n\t\tif i := strings.Index(p, \"=\"); i < 0 {\n\t\t\tg.Param[p] = \"\"\n\t\t} else {\n\t\t\tg.Param[p[0:i]] = p[i+1:]\n\t\t}\n\t}\n\n\tg.ImportMap = make(map[string]string)\n\tpluginList := \"none\" // Default list of plugin names to enable (empty means all).\n\tfor k, v := range g.Param {\n\t\tswitch k {\n\t\tcase \"import_prefix\":\n\t\t\tg.ImportPrefix = v\n\t\tcase \"import_path\":\n\t\t\tg.PackageImportPath = v\n\t\tcase \"plugins\":\n\t\t\tpluginList = v\n\t\tdefault:\n\t\t\tif len(k) > 0 && k[0] == 'M' {\n\t\t\t\tg.ImportMap[k[1:]] = v\n\t\t\t}\n\t\t}\n\t}\n\tif pluginList != \"\" {\n\t\t// Amend the set of plugins.\n\t\tenabled := make(map[string]bool)\n\t\tfor _, name := range strings.Split(pluginList, \"+\") {\n\t\t\tenabled[name] = true\n\t\t}\n\t\tvar nplugins []Plugin\n\t\tfor _, p := range plugins {\n\t\t\tif enabled[p.Name()] {\n\t\t\t\tnplugins = append(nplugins, p)\n\t\t\t}\n\t\t}\n\t\tplugins = nplugins\n\t}\n}\n\n// DefaultPackageName returns the package name printed for the object.\n// If its file is in a different package, it returns the package name we're using for this file, plus \".\".\n// Otherwise it returns the empty string.\nfunc (g *Generator) DefaultPackageName(obj Object) string {\n\tpkg := obj.PackageName()\n\tif pkg == g.packageName {\n\t\treturn \"\"\n\t}\n\treturn pkg + \".\"\n}\n\n// For each input file, the unique package name to use, underscored.\nvar uniquePackageName = make(map[*descriptor.FileDescriptorProto]string)\n\n// Package names already registered.  Key is the name from the .proto file;\n// value is the name that appears in the generated code.\nvar pkgNamesInUse = make(map[string]bool)\n\n// Create and remember a guaranteed unique package name for this file descriptor.\n// Pkg is the candidate name.  If f is nil, it's a builtin package like \"proto\" and\n// has no file descriptor.\nfunc RegisterUniquePackageName(pkg string, f *FileDescriptor) string {\n\t// Convert dots to underscores before finding a unique alias.\n\tpkg = strings.Map(badToUnderscore, pkg)\n\n\tfor i, orig := 1, pkg; pkgNamesInUse[pkg]; i++ {\n\t\t// It's a duplicate; must rename.\n\t\tpkg = orig + strconv.Itoa(i)\n\t}\n\t// Install it.\n\tpkgNamesInUse[pkg] = true\n\tif f != nil {\n\t\tuniquePackageName[f.FileDescriptorProto] = pkg\n\t}\n\treturn pkg\n}\n\nvar isGoKeyword = map[string]bool{\n\t\"break\":       true,\n\t\"case\":        true,\n\t\"chan\":        true,\n\t\"const\":       true,\n\t\"continue\":    true,\n\t\"default\":     true,\n\t\"else\":        true,\n\t\"defer\":       true,\n\t\"fallthrough\": true,\n\t\"for\":         true,\n\t\"func\":        true,\n\t\"go\":          true,\n\t\"goto\":        true,\n\t\"if\":          true,\n\t\"import\":      true,\n\t\"interface\":   true,\n\t\"map\":         true,\n\t\"package\":     true,\n\t\"range\":       true,\n\t\"return\":      true,\n\t\"select\":      true,\n\t\"struct\":      true,\n\t\"switch\":      true,\n\t\"type\":        true,\n\t\"var\":         true,\n}\n\n// defaultGoPackage returns the package name to use,\n// derived from the import path of the package we're building code for.\nfunc (g *Generator) defaultGoPackage() string {\n\tp := g.PackageImportPath\n\tif i := strings.LastIndex(p, \"/\"); i >= 0 {\n\t\tp = p[i+1:]\n\t}\n\tif p == \"\" {\n\t\treturn \"\"\n\t}\n\n\tp = strings.Map(badToUnderscore, p)\n\t// Identifier must not be keyword: insert _.\n\tif isGoKeyword[p] {\n\t\tp = \"_\" + p\n\t}\n\t// Identifier must not begin with digit: insert _.\n\tif r, _ := utf8.DecodeRuneInString(p); unicode.IsDigit(r) {\n\t\tp = \"_\" + p\n\t}\n\treturn p\n}\n\n// SetPackageNames sets the package name for this run.\n// The package name must agree across all files being generated.\n// It also defines unique package names for all imported files.\nfunc (g *Generator) SetPackageNames() {\n\t// Register the name for this package.  It will be the first name\n\t// registered so is guaranteed to be unmodified.\n\tpkg, explicit := g.genFiles[0].goPackageName()\n\n\t// Check all files for an explicit go_package option.\n\tfor _, f := range g.genFiles {\n\t\tthisPkg, thisExplicit := f.goPackageName()\n\t\tif thisExplicit {\n\t\t\tif !explicit {\n\t\t\t\t// Let this file's go_package option serve for all input files.\n\t\t\t\tpkg, explicit = thisPkg, true\n\t\t\t} else if thisPkg != pkg {\n\t\t\t\tg.Fail(\"inconsistent package names:\", thisPkg, pkg)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we don't have an explicit go_package option but we have an\n\t// import path, use that.\n\tif !explicit {\n\t\tp := g.defaultGoPackage()\n\t\tif p != \"\" {\n\t\t\tpkg, explicit = p, true\n\t\t}\n\t}\n\n\t// If there was no go_package and no import path to use,\n\t// double-check that all the inputs have the same implicit\n\t// Go package name.\n\tif !explicit {\n\t\tfor _, f := range g.genFiles {\n\t\t\tthisPkg, _ := f.goPackageName()\n\t\t\tif thisPkg != pkg {\n\t\t\t\tg.Fail(\"inconsistent package names:\", thisPkg, pkg)\n\t\t\t}\n\t\t}\n\t}\n\n\tg.packageName = RegisterUniquePackageName(pkg, g.genFiles[0])\n\n\t// Register the support package names. They might collide with the\n\t// name of a package we import.\n\tg.Pkg = map[string]string{\n\t\t\"fmt\":   RegisterUniquePackageName(\"fmt\", nil),\n\t\t\"math\":  RegisterUniquePackageName(\"math\", nil),\n\t\t\"proto\": RegisterUniquePackageName(\"proto\", nil),\n\t}\n\nAllFiles:\n\tfor _, f := range g.allFiles {\n\t\tfor _, genf := range g.genFiles {\n\t\t\tif f == genf {\n\t\t\t\t// In this package already.\n\t\t\t\tuniquePackageName[f.FileDescriptorProto] = g.packageName\n\t\t\t\tcontinue AllFiles\n\t\t\t}\n\t\t}\n\t\t// The file is a dependency, so we want to ignore its go_package option\n\t\t// because that is only relevant for its specific generated output.\n\t\tpkg := f.GetPackage()\n\t\tif pkg == \"\" {\n\t\t\tpkg = baseName(*f.Name)\n\t\t}\n\t\tRegisterUniquePackageName(pkg, f)\n\t}\n}\n\n// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos\n// and FileDescriptorProtos into file-referenced objects within the Generator.\n// It also creates the list of files to generate and so should be called before GenerateAllFiles.\nfunc (g *Generator) WrapTypes() {\n\tg.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile))\n\tg.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles))\n\tfor _, f := range g.Request.ProtoFile {\n\t\t// We must wrap the descriptors before we wrap the enums\n\t\tdescs := wrapDescriptors(f)\n\t\tg.buildNestedDescriptors(descs)\n\t\tenums := wrapEnumDescriptors(f, descs)\n\t\tg.buildNestedEnums(descs, enums)\n\t\texts := wrapExtensions(f)\n\t\tfd := &FileDescriptor{\n\t\t\tFileDescriptorProto: f,\n\t\t\tdesc:                descs,\n\t\t\tenum:                enums,\n\t\t\text:                 exts,\n\t\t\texported:            make(map[Object][]symbol),\n\t\t\tproto3:              fileIsProto3(f),\n\t\t}\n\t\textractComments(fd)\n\t\tg.allFiles = append(g.allFiles, fd)\n\t\tg.allFilesByName[f.GetName()] = fd\n\t}\n\tfor _, fd := range g.allFiles {\n\t\tfd.imp = wrapImported(fd.FileDescriptorProto, g)\n\t}\n\n\tg.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate))\n\tfor _, fileName := range g.Request.FileToGenerate {\n\t\tfd := g.allFilesByName[fileName]\n\t\tif fd == nil {\n\t\t\tg.Fail(\"could not find file named\", fileName)\n\t\t}\n\t\tfd.index = len(g.genFiles)\n\t\tg.genFiles = append(g.genFiles, fd)\n\t}\n}\n\n// Scan the descriptors in this file.  For each one, build the slice of nested descriptors\nfunc (g *Generator) buildNestedDescriptors(descs []*Descriptor) {\n\tfor _, desc := range descs {\n\t\tif len(desc.NestedType) != 0 {\n\t\t\tfor _, nest := range descs {\n\t\t\t\tif nest.parent == desc {\n\t\t\t\t\tdesc.nested = append(desc.nested, nest)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(desc.nested) != len(desc.NestedType) {\n\t\t\t\tg.Fail(\"internal error: nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) {\n\tfor _, desc := range descs {\n\t\tif len(desc.EnumType) != 0 {\n\t\t\tfor _, enum := range enums {\n\t\t\t\tif enum.parent == desc {\n\t\t\t\t\tdesc.enums = append(desc.enums, enum)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(desc.enums) != len(desc.EnumType) {\n\t\t\t\tg.Fail(\"internal error: enum nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Construct the Descriptor\nfunc newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *Descriptor {\n\td := &Descriptor{\n\t\tcommon:          common{file},\n\t\tDescriptorProto: desc,\n\t\tparent:          parent,\n\t\tindex:           index,\n\t}\n\tif parent == nil {\n\t\td.path = fmt.Sprintf(\"%d,%d\", messagePath, index)\n\t} else {\n\t\td.path = fmt.Sprintf(\"%s,%d,%d\", parent.path, messageMessagePath, index)\n\t}\n\n\t// The only way to distinguish a group from a message is whether\n\t// the containing message has a TYPE_GROUP field that matches.\n\tif parent != nil {\n\t\tparts := d.TypeName()\n\t\tif file.Package != nil {\n\t\t\tparts = append([]string{*file.Package}, parts...)\n\t\t}\n\t\texp := \".\" + strings.Join(parts, \".\")\n\t\tfor _, field := range parent.Field {\n\t\t\tif field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp {\n\t\t\t\td.group = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, field := range desc.Extension {\n\t\td.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d})\n\t}\n\n\treturn d\n}\n\n// Return a slice of all the Descriptors defined within this file\nfunc wrapDescriptors(file *descriptor.FileDescriptorProto) []*Descriptor {\n\tsl := make([]*Descriptor, 0, len(file.MessageType)+10)\n\tfor i, desc := range file.MessageType {\n\t\tsl = wrapThisDescriptor(sl, desc, nil, file, i)\n\t}\n\treturn sl\n}\n\n// Wrap this Descriptor, recursively\nfunc wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) []*Descriptor {\n\tsl = append(sl, newDescriptor(desc, parent, file, index))\n\tme := sl[len(sl)-1]\n\tfor i, nested := range desc.NestedType {\n\t\tsl = wrapThisDescriptor(sl, nested, me, file, i)\n\t}\n\treturn sl\n}\n\n// Construct the EnumDescriptor\nfunc newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *EnumDescriptor {\n\ted := &EnumDescriptor{\n\t\tcommon:              common{file},\n\t\tEnumDescriptorProto: desc,\n\t\tparent:              parent,\n\t\tindex:               index,\n\t}\n\tif parent == nil {\n\t\ted.path = fmt.Sprintf(\"%d,%d\", enumPath, index)\n\t} else {\n\t\ted.path = fmt.Sprintf(\"%s,%d,%d\", parent.path, messageEnumPath, index)\n\t}\n\treturn ed\n}\n\n// Return a slice of all the EnumDescriptors defined within this file\nfunc wrapEnumDescriptors(file *descriptor.FileDescriptorProto, descs []*Descriptor) []*EnumDescriptor {\n\tsl := make([]*EnumDescriptor, 0, len(file.EnumType)+10)\n\t// Top-level enums.\n\tfor i, enum := range file.EnumType {\n\t\tsl = append(sl, newEnumDescriptor(enum, nil, file, i))\n\t}\n\t// Enums within messages. Enums within embedded messages appear in the outer-most message.\n\tfor _, nested := range descs {\n\t\tfor i, enum := range nested.EnumType {\n\t\t\tsl = append(sl, newEnumDescriptor(enum, nested, file, i))\n\t\t}\n\t}\n\treturn sl\n}\n\n// Return a slice of all the top-level ExtensionDescriptors defined within this file.\nfunc wrapExtensions(file *descriptor.FileDescriptorProto) []*ExtensionDescriptor {\n\tvar sl []*ExtensionDescriptor\n\tfor _, field := range file.Extension {\n\t\tsl = append(sl, &ExtensionDescriptor{common{file}, field, nil})\n\t}\n\treturn sl\n}\n\n// Return a slice of all the types that are publicly imported into this file.\nfunc wrapImported(file *descriptor.FileDescriptorProto, g *Generator) (sl []*ImportedDescriptor) {\n\tfor _, index := range file.PublicDependency {\n\t\tdf := g.fileByName(file.Dependency[index])\n\t\tfor _, d := range df.desc {\n\t\t\tif d.GetOptions().GetMapEntry() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, d})\n\t\t}\n\t\tfor _, e := range df.enum {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, e})\n\t\t}\n\t\tfor _, ext := range df.ext {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, ext})\n\t\t}\n\t}\n\treturn\n}\n\nfunc extractComments(file *FileDescriptor) {\n\tfile.comments = make(map[string]*descriptor.SourceCodeInfo_Location)\n\tfor _, loc := range file.GetSourceCodeInfo().GetLocation() {\n\t\tif loc.LeadingComments == nil {\n\t\t\tcontinue\n\t\t}\n\t\tvar p []string\n\t\tfor _, n := range loc.Path {\n\t\t\tp = append(p, strconv.Itoa(int(n)))\n\t\t}\n\t\tfile.comments[strings.Join(p, \",\")] = loc\n\t}\n}\n\n// BuildTypeNameMap builds the map from fully qualified type names to objects.\n// The key names for the map come from the input data, which puts a period at the beginning.\n// It should be called after SetPackageNames and before GenerateAllFiles.\nfunc (g *Generator) BuildTypeNameMap() {\n\tg.typeNameToObject = make(map[string]Object)\n\tfor _, f := range g.allFiles {\n\t\t// The names in this loop are defined by the proto world, not us, so the\n\t\t// package name may be empty.  If so, the dotted package name of X will\n\t\t// be \".X\"; otherwise it will be \".pkg.X\".\n\t\tdottedPkg := \".\" + f.GetPackage()\n\t\tif dottedPkg != \".\" {\n\t\t\tdottedPkg += \".\"\n\t\t}\n\t\tfor _, enum := range f.enum {\n\t\t\tname := dottedPkg + dottedSlice(enum.TypeName())\n\t\t\tg.typeNameToObject[name] = enum\n\t\t}\n\t\tfor _, desc := range f.desc {\n\t\t\tname := dottedPkg + dottedSlice(desc.TypeName())\n\t\t\tg.typeNameToObject[name] = desc\n\t\t}\n\t}\n}\n\n// ObjectNamed, given a fully-qualified input type name as it appears in the input data,\n// returns the descriptor for the message or enum with that name.\nfunc (g *Generator) ObjectNamed(typeName string) Object {\n\to, ok := g.typeNameToObject[typeName]\n\tif !ok {\n\t\tg.Fail(\"can't find object with type\", typeName)\n\t}\n\n\t// If the file of this object isn't a direct dependency of the current file,\n\t// or in the current file, then this object has been publicly imported into\n\t// a dependency of the current file.\n\t// We should return the ImportedDescriptor object for it instead.\n\tdirect := *o.File().Name == *g.file.Name\n\tif !direct {\n\t\tfor _, dep := range g.file.Dependency {\n\t\t\tif *g.fileByName(dep).Name == *o.File().Name {\n\t\t\t\tdirect = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif !direct {\n\t\tfound := false\n\tLoop:\n\t\tfor _, dep := range g.file.Dependency {\n\t\t\tdf := g.fileByName(*g.fileByName(dep).Name)\n\t\t\tfor _, td := range df.imp {\n\t\t\t\tif td.o == o {\n\t\t\t\t\t// Found it!\n\t\t\t\t\to = td\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tlog.Printf(\"protoc-gen-go: WARNING: failed finding publicly imported dependency for %v, used in %v\", typeName, *g.file.Name)\n\t\t}\n\t}\n\n\treturn o\n}\n\n// P prints the arguments to the generated output.  It handles strings and int32s, plus\n// handling indirections because they may be *string, etc.\nfunc (g *Generator) P(str ...interface{}) {\n\tif !g.writeOutput {\n\t\treturn\n\t}\n\tg.WriteString(g.indent)\n\tfor _, v := range str {\n\t\tswitch s := v.(type) {\n\t\tcase string:\n\t\t\tg.WriteString(s)\n\t\tcase *string:\n\t\t\tg.WriteString(*s)\n\t\tcase bool:\n\t\t\tfmt.Fprintf(g, \"%t\", s)\n\t\tcase *bool:\n\t\t\tfmt.Fprintf(g, \"%t\", *s)\n\t\tcase int:\n\t\t\tfmt.Fprintf(g, \"%d\", s)\n\t\tcase *int32:\n\t\t\tfmt.Fprintf(g, \"%d\", *s)\n\t\tcase *int64:\n\t\t\tfmt.Fprintf(g, \"%d\", *s)\n\t\tcase float64:\n\t\t\tfmt.Fprintf(g, \"%g\", s)\n\t\tcase *float64:\n\t\t\tfmt.Fprintf(g, \"%g\", *s)\n\t\tdefault:\n\t\t\tg.Fail(fmt.Sprintf(\"unknown type in printer: %T\", v))\n\t\t}\n\t}\n\tg.WriteByte('\\n')\n}\n\n// addInitf stores the given statement to be printed inside the file's init function.\n// The statement is given as a format specifier and arguments.\nfunc (g *Generator) addInitf(stmt string, a ...interface{}) {\n\tg.init = append(g.init, fmt.Sprintf(stmt, a...))\n}\n\n// In Indents the output one tab stop.\nfunc (g *Generator) In() { g.indent += \"\\t\" }\n\n// Out unindents the output one tab stop.\nfunc (g *Generator) Out() {\n\tif len(g.indent) > 0 {\n\t\tg.indent = g.indent[1:]\n\t}\n}\n\n// GenerateAllFiles generates the output for all the files we're outputting.\nfunc (g *Generator) GenerateAllFiles() {\n\t// Initialize the plugins\n\tfor _, p := range plugins {\n\t\tp.Init(g)\n\t}\n\t// Generate the output. The generator runs for every file, even the files\n\t// that we don't generate output for, so that we can collate the full list\n\t// of exported symbols to support public imports.\n\tgenFileMap := make(map[*FileDescriptor]bool, len(g.genFiles))\n\tfor _, file := range g.genFiles {\n\t\tgenFileMap[file] = true\n\t}\n\tfor _, file := range g.allFiles {\n\t\tg.Reset()\n\t\tg.writeOutput = genFileMap[file]\n\t\tg.generate(file)\n\t\tif !g.writeOutput {\n\t\t\tcontinue\n\t\t}\n\t\tg.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{\n\t\t\tName:    proto.String(file.goFileName()),\n\t\t\tContent: proto.String(g.String()),\n\t\t})\n\t}\n}\n\n// Run all the plugins associated with the file.\nfunc (g *Generator) runPlugins(file *FileDescriptor) {\n\tfor _, p := range plugins {\n\t\tp.Generate(file)\n\t}\n}\n\n// FileOf return the FileDescriptor for this FileDescriptorProto.\nfunc (g *Generator) FileOf(fd *descriptor.FileDescriptorProto) *FileDescriptor {\n\tfor _, file := range g.allFiles {\n\t\tif file.FileDescriptorProto == fd {\n\t\t\treturn file\n\t\t}\n\t}\n\tg.Fail(\"could not find file in table:\", fd.GetName())\n\treturn nil\n}\n\n// Fill the response protocol buffer with the generated output for all the files we're\n// supposed to generate.\nfunc (g *Generator) generate(file *FileDescriptor) {\n\tg.file = g.FileOf(file.FileDescriptorProto)\n\tg.usedPackages = make(map[string]bool)\n\n\tif g.file.index == 0 {\n\t\t// For one file in the package, assert version compatibility.\n\t\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\t\tg.P(\"// is compatible with the proto package it is being compiled against.\")\n\t\tg.P(\"// A compilation error at this line likely means your copy of the\")\n\t\tg.P(\"// proto package needs to be updated.\")\n\t\tg.P(\"const _ = \", g.Pkg[\"proto\"], \".ProtoPackageIsVersion\", generatedCodeVersion, \" // please upgrade the proto package\")\n\t\tg.P()\n\t}\n\tfor _, td := range g.file.imp {\n\t\tg.generateImported(td)\n\t}\n\tfor _, enum := range g.file.enum {\n\t\tg.generateEnum(enum)\n\t}\n\tfor _, desc := range g.file.desc {\n\t\t// Don't generate virtual messages for maps.\n\t\tif desc.GetOptions().GetMapEntry() {\n\t\t\tcontinue\n\t\t}\n\t\tg.generateMessage(desc)\n\t}\n\tfor _, ext := range g.file.ext {\n\t\tg.generateExtension(ext)\n\t}\n\tg.generateInitFunction()\n\n\t// Run the plugins before the imports so we know which imports are necessary.\n\tg.runPlugins(file)\n\n\tg.generateFileDescriptor(file)\n\n\t// Generate header and imports last, though they appear first in the output.\n\trem := g.Buffer\n\tg.Buffer = new(bytes.Buffer)\n\tg.generateHeader()\n\tg.generateImports()\n\tif !g.writeOutput {\n\t\treturn\n\t}\n\tg.Write(rem.Bytes())\n\n\t// Reformat generated code.\n\tfset := token.NewFileSet()\n\traw := g.Bytes()\n\tast, err := parser.ParseFile(fset, \"\", g, parser.ParseComments)\n\tif err != nil {\n\t\t// Print out the bad code with line numbers.\n\t\t// This should never happen in practice, but it can while changing generated code,\n\t\t// so consider this a debugging aid.\n\t\tvar src bytes.Buffer\n\t\ts := bufio.NewScanner(bytes.NewReader(raw))\n\t\tfor line := 1; s.Scan(); line++ {\n\t\t\tfmt.Fprintf(&src, \"%5d\\t%s\\n\", line, s.Bytes())\n\t\t}\n\t\tg.Fail(\"bad Go source code was generated:\", err.Error(), \"\\n\"+src.String())\n\t}\n\tg.Reset()\n\terr = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast)\n\tif err != nil {\n\t\tg.Fail(\"generated Go source code could not be reformatted:\", err.Error())\n\t}\n}\n\n// Generate the header, including package definition\nfunc (g *Generator) generateHeader() {\n\tg.P(\"// Code generated by protoc-gen-go. DO NOT EDIT.\")\n\tg.P(\"// source: \", g.file.Name)\n\tg.P()\n\n\tname := g.file.PackageName()\n\n\tif g.file.index == 0 {\n\t\t// Generate package docs for the first file in the package.\n\t\tg.P(\"/*\")\n\t\tg.P(\"Package \", name, \" is a generated protocol buffer package.\")\n\t\tg.P()\n\t\tif loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok {\n\t\t\t// not using g.PrintComments because this is a /* */ comment block.\n\t\t\ttext := strings.TrimSuffix(loc.GetLeadingComments(), \"\\n\")\n\t\t\tfor _, line := range strings.Split(text, \"\\n\") {\n\t\t\t\tline = strings.TrimPrefix(line, \" \")\n\t\t\t\t// ensure we don't escape from the block comment\n\t\t\t\tline = strings.Replace(line, \"*/\", \"* /\", -1)\n\t\t\t\tg.P(line)\n\t\t\t}\n\t\t\tg.P()\n\t\t}\n\t\tvar topMsgs []string\n\t\tg.P(\"It is generated from these files:\")\n\t\tfor _, f := range g.genFiles {\n\t\t\tg.P(\"\\t\", f.Name)\n\t\t\tfor _, msg := range f.desc {\n\t\t\t\tif msg.parent != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttopMsgs = append(topMsgs, CamelCaseSlice(msg.TypeName()))\n\t\t\t}\n\t\t}\n\t\tg.P()\n\t\tg.P(\"It has these top-level messages:\")\n\t\tfor _, msg := range topMsgs {\n\t\t\tg.P(\"\\t\", msg)\n\t\t}\n\t\tg.P(\"*/\")\n\t}\n\n\tg.P(\"package \", name)\n\tg.P()\n}\n\n// PrintComments prints any comments from the source .proto file.\n// The path is a comma-separated list of integers.\n// It returns an indication of whether any comments were printed.\n// See descriptor.proto for its format.\nfunc (g *Generator) PrintComments(path string) bool {\n\tif !g.writeOutput {\n\t\treturn false\n\t}\n\tif loc, ok := g.file.comments[path]; ok {\n\t\ttext := strings.TrimSuffix(loc.GetLeadingComments(), \"\\n\")\n\t\tfor _, line := range strings.Split(text, \"\\n\") {\n\t\t\tg.P(\"// \", strings.TrimPrefix(line, \" \"))\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (g *Generator) fileByName(filename string) *FileDescriptor {\n\treturn g.allFilesByName[filename]\n}\n\n// weak returns whether the ith import of the current file is a weak import.\nfunc (g *Generator) weak(i int32) bool {\n\tfor _, j := range g.file.WeakDependency {\n\t\tif j == i {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// Generate the imports\nfunc (g *Generator) generateImports() {\n\t// We almost always need a proto import.  Rather than computing when we\n\t// do, which is tricky when there's a plugin, just import it and\n\t// reference it later. The same argument applies to the fmt and math packages.\n\tg.P(\"import \" + g.Pkg[\"proto\"] + \" \" + strconv.Quote(g.ImportPrefix+\"github.com/golang/protobuf/proto\"))\n\tg.P(\"import \" + g.Pkg[\"fmt\"] + ` \"fmt\"`)\n\tg.P(\"import \" + g.Pkg[\"math\"] + ` \"math\"`)\n\tfor i, s := range g.file.Dependency {\n\t\tfd := g.fileByName(s)\n\t\t// Do not import our own package.\n\t\tif fd.PackageName() == g.packageName {\n\t\t\tcontinue\n\t\t}\n\t\tfilename := fd.goFileName()\n\t\t// By default, import path is the dirname of the Go filename.\n\t\timportPath := path.Dir(filename)\n\t\tif substitution, ok := g.ImportMap[s]; ok {\n\t\t\timportPath = substitution\n\t\t}\n\t\timportPath = g.ImportPrefix + importPath\n\t\t// Skip weak imports.\n\t\tif g.weak(int32(i)) {\n\t\t\tg.P(\"// skipping weak import \", fd.PackageName(), \" \", strconv.Quote(importPath))\n\t\t\tcontinue\n\t\t}\n\t\t// We need to import all the dependencies, even if we don't reference them,\n\t\t// because other code and tools depend on having the full transitive closure\n\t\t// of protocol buffer types in the binary.\n\t\tpname := fd.PackageName()\n\t\tif _, ok := g.usedPackages[pname]; !ok {\n\t\t\tpname = \"_\"\n\t\t}\n\t\tg.P(\"import \", pname, \" \", strconv.Quote(importPath))\n\t}\n\tg.P()\n\t// TODO: may need to worry about uniqueness across plugins\n\tfor _, p := range plugins {\n\t\tp.GenerateImports(g.file)\n\t\tg.P()\n\t}\n\tg.P(\"// Reference imports to suppress errors if they are not otherwise used.\")\n\tg.P(\"var _ = \", g.Pkg[\"proto\"], \".Marshal\")\n\tg.P(\"var _ = \", g.Pkg[\"fmt\"], \".Errorf\")\n\tg.P(\"var _ = \", g.Pkg[\"math\"], \".Inf\")\n\tg.P()\n}\n\nfunc (g *Generator) generateImported(id *ImportedDescriptor) {\n\t// Don't generate public import symbols for files that we are generating\n\t// code for, since those symbols will already be in this package.\n\t// We can't simply avoid creating the ImportedDescriptor objects,\n\t// because g.genFiles isn't populated at that stage.\n\ttn := id.TypeName()\n\tsn := tn[len(tn)-1]\n\tdf := g.FileOf(id.o.File())\n\tfilename := *df.Name\n\tfor _, fd := range g.genFiles {\n\t\tif *fd.Name == filename {\n\t\t\tg.P(\"// Ignoring public import of \", sn, \" from \", filename)\n\t\t\tg.P()\n\t\t\treturn\n\t\t}\n\t}\n\tg.P(\"// \", sn, \" from public import \", filename)\n\tg.usedPackages[df.PackageName()] = true\n\n\tfor _, sym := range df.exported[id.o] {\n\t\tsym.GenerateAlias(g, df.PackageName())\n\t}\n\n\tg.P()\n}\n\n// Generate the enum definitions for this EnumDescriptor.\nfunc (g *Generator) generateEnum(enum *EnumDescriptor) {\n\t// The full type name\n\ttypeName := enum.TypeName()\n\t// The full type name, CamelCased.\n\tccTypeName := CamelCaseSlice(typeName)\n\tccPrefix := enum.prefix()\n\n\tg.PrintComments(enum.path)\n\tg.P(\"type \", ccTypeName, \" int32\")\n\tg.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()})\n\tg.P(\"const (\")\n\tg.In()\n\tfor i, e := range enum.Value {\n\t\tg.PrintComments(fmt.Sprintf(\"%s,%d,%d\", enum.path, enumValuePath, i))\n\n\t\tname := ccPrefix + *e.Name\n\t\tg.P(name, \" \", ccTypeName, \" = \", e.Number)\n\t\tg.file.addExport(enum, constOrVarSymbol{name, \"const\", ccTypeName})\n\t}\n\tg.Out()\n\tg.P(\")\")\n\tg.P(\"var \", ccTypeName, \"_name = map[int32]string{\")\n\tg.In()\n\tgenerated := make(map[int32]bool) // avoid duplicate values\n\tfor _, e := range enum.Value {\n\t\tduplicate := \"\"\n\t\tif _, present := generated[*e.Number]; present {\n\t\t\tduplicate = \"// Duplicate value: \"\n\t\t}\n\t\tg.P(duplicate, e.Number, \": \", strconv.Quote(*e.Name), \",\")\n\t\tgenerated[*e.Number] = true\n\t}\n\tg.Out()\n\tg.P(\"}\")\n\tg.P(\"var \", ccTypeName, \"_value = map[string]int32{\")\n\tg.In()\n\tfor _, e := range enum.Value {\n\t\tg.P(strconv.Quote(*e.Name), \": \", e.Number, \",\")\n\t}\n\tg.Out()\n\tg.P(\"}\")\n\n\tif !enum.proto3() {\n\t\tg.P(\"func (x \", ccTypeName, \") Enum() *\", ccTypeName, \" {\")\n\t\tg.In()\n\t\tg.P(\"p := new(\", ccTypeName, \")\")\n\t\tg.P(\"*p = x\")\n\t\tg.P(\"return p\")\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t}\n\n\tg.P(\"func (x \", ccTypeName, \") String() string {\")\n\tg.In()\n\tg.P(\"return \", g.Pkg[\"proto\"], \".EnumName(\", ccTypeName, \"_name, int32(x))\")\n\tg.Out()\n\tg.P(\"}\")\n\n\tif !enum.proto3() {\n\t\tg.P(\"func (x *\", ccTypeName, \") UnmarshalJSON(data []byte) error {\")\n\t\tg.In()\n\t\tg.P(\"value, err := \", g.Pkg[\"proto\"], \".UnmarshalJSONEnum(\", ccTypeName, `_value, data, \"`, ccTypeName, `\")`)\n\t\tg.P(\"if err != nil {\")\n\t\tg.In()\n\t\tg.P(\"return err\")\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t\tg.P(\"*x = \", ccTypeName, \"(value)\")\n\t\tg.P(\"return nil\")\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t}\n\n\tvar indexes []string\n\tfor m := enum.parent; m != nil; m = m.parent {\n\t\t// XXX: skip groups?\n\t\tindexes = append([]string{strconv.Itoa(m.index)}, indexes...)\n\t}\n\tindexes = append(indexes, strconv.Itoa(enum.index))\n\tg.P(\"func (\", ccTypeName, \") EnumDescriptor() ([]byte, []int) { return \", g.file.VarName(), \", []int{\", strings.Join(indexes, \", \"), \"} }\")\n\tif enum.file.GetPackage() == \"google.protobuf\" && enum.GetName() == \"NullValue\" {\n\t\tg.P(\"func (\", ccTypeName, `) XXX_WellKnownType() string { return \"`, enum.GetName(), `\" }`)\n\t}\n\n\tg.P()\n}\n\n// The tag is a string like \"varint,2,opt,name=fieldname,def=7\" that\n// identifies details of the field for the protocol buffer marshaling and unmarshaling\n// code.  The fields are:\n//\twire encoding\n//\tprotocol tag number\n//\topt,req,rep for optional, required, or repeated\n//\tpacked whether the encoding is \"packed\" (optional; repeated primitives only)\n//\tname= the original declared name\n//\tenum= the name of the enum type if it is an enum-typed field.\n//\tproto3 if this field is in a proto3 message\n//\tdef= string representation of the default value, if any.\n// The default value must be in a representation that can be used at run-time\n// to generate the default value. Thus bools become 0 and 1, for instance.\nfunc (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string {\n\toptrepreq := \"\"\n\tswitch {\n\tcase isOptional(field):\n\t\toptrepreq = \"opt\"\n\tcase isRequired(field):\n\t\toptrepreq = \"req\"\n\tcase isRepeated(field):\n\t\toptrepreq = \"rep\"\n\t}\n\tvar defaultValue string\n\tif dv := field.DefaultValue; dv != nil { // set means an explicit default\n\t\tdefaultValue = *dv\n\t\t// Some types need tweaking.\n\t\tswitch *field.Type {\n\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\tif defaultValue == \"true\" {\n\t\t\t\tdefaultValue = \"1\"\n\t\t\t} else {\n\t\t\t\tdefaultValue = \"0\"\n\t\t\t}\n\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING,\n\t\t\tdescriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t// Nothing to do. Quoting is done for the whole tag.\n\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t// For enums we need to provide the integer constant.\n\t\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t// It is an enum that was publicly imported.\n\t\t\t\t// We need the underlying type.\n\t\t\t\tobj = id.o\n\t\t\t}\n\t\t\tenum, ok := obj.(*EnumDescriptor)\n\t\t\tif !ok {\n\t\t\t\tlog.Printf(\"obj is a %T\", obj)\n\t\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t\tlog.Printf(\"id.o is a %T\", id.o)\n\t\t\t\t}\n\t\t\t\tg.Fail(\"unknown enum type\", CamelCaseSlice(obj.TypeName()))\n\t\t\t}\n\t\t\tdefaultValue = enum.integerValueAsString(defaultValue)\n\t\t}\n\t\tdefaultValue = \",def=\" + defaultValue\n\t}\n\tenum := \"\"\n\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM {\n\t\t// We avoid using obj.PackageName(), because we want to use the\n\t\t// original (proto-world) package name.\n\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\tobj = id.o\n\t\t}\n\t\tenum = \",enum=\"\n\t\tif pkg := obj.File().GetPackage(); pkg != \"\" {\n\t\t\tenum += pkg + \".\"\n\t\t}\n\t\tenum += CamelCaseSlice(obj.TypeName())\n\t}\n\tpacked := \"\"\n\tif (field.Options != nil && field.Options.GetPacked()) ||\n\t\t// Per https://developers.google.com/protocol-buffers/docs/proto3#simple:\n\t\t// \"In proto3, repeated fields of scalar numeric types use packed encoding by default.\"\n\t\t(message.proto3() && (field.Options == nil || field.Options.Packed == nil) &&\n\t\t\tisRepeated(field) && isScalar(field)) {\n\t\tpacked = \",packed\"\n\t}\n\tfieldName := field.GetName()\n\tname := fieldName\n\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP {\n\t\t// We must use the type name for groups instead of\n\t\t// the field name to preserve capitalization.\n\t\t// type_name in FieldDescriptorProto is fully-qualified,\n\t\t// but we only want the local part.\n\t\tname = *field.TypeName\n\t\tif i := strings.LastIndex(name, \".\"); i >= 0 {\n\t\t\tname = name[i+1:]\n\t\t}\n\t}\n\tif json := field.GetJsonName(); json != \"\" && json != name {\n\t\t// TODO: escaping might be needed, in which case\n\t\t// perhaps this should be in its own \"json\" tag.\n\t\tname += \",json=\" + json\n\t}\n\tname = \",name=\" + name\n\tif message.proto3() {\n\t\t// We only need the extra tag for []byte fields;\n\t\t// no need to add noise for the others.\n\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES {\n\t\t\tname += \",proto3\"\n\t\t}\n\n\t}\n\toneof := \"\"\n\tif field.OneofIndex != nil {\n\t\toneof = \",oneof\"\n\t}\n\treturn strconv.Quote(fmt.Sprintf(\"%s,%d,%s%s%s%s%s%s\",\n\t\twiretype,\n\t\tfield.GetNumber(),\n\t\toptrepreq,\n\t\tpacked,\n\t\tname,\n\t\tenum,\n\t\toneof,\n\t\tdefaultValue))\n}\n\nfunc needsStar(typ descriptor.FieldDescriptorProto_Type) bool {\n\tswitch typ {\n\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\treturn false\n\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\treturn false\n\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\treturn false\n\t}\n\treturn true\n}\n\n// TypeName is the printed name appropriate for an item. If the object is in the current file,\n// TypeName drops the package name and underscores the rest.\n// Otherwise the object is from another package; and the result is the underscored\n// package name followed by the item name.\n// The result always has an initial capital.\nfunc (g *Generator) TypeName(obj Object) string {\n\treturn g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName())\n}\n\n// TypeNameWithPackage is like TypeName, but always includes the package\n// name even if the object is in our own package.\nfunc (g *Generator) TypeNameWithPackage(obj Object) string {\n\treturn obj.PackageName() + CamelCaseSlice(obj.TypeName())\n}\n\n// GoType returns a string representing the type name, and the wire type\nfunc (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) {\n\t// TODO: Options.\n\tswitch *field.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\ttyp, wire = \"float64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\ttyp, wire = \"float32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_INT64:\n\t\ttyp, wire = \"int64\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_UINT64:\n\t\ttyp, wire = \"uint64\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_INT32:\n\t\ttyp, wire = \"int32\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_UINT32:\n\t\ttyp, wire = \"uint32\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FIXED64:\n\t\ttyp, wire = \"uint64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_FIXED32:\n\t\ttyp, wire = \"uint32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\ttyp, wire = \"bool\", \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\ttyp, wire = \"string\", \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = \"*\"+g.TypeName(desc), \"group\"\n\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = \"*\"+g.TypeName(desc), \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\ttyp, wire = \"[]byte\", \"bytes\"\n\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\ttyp, wire = g.TypeName(desc), \"varint\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED32:\n\t\ttyp, wire = \"int32\", \"fixed32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED64:\n\t\ttyp, wire = \"int64\", \"fixed64\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SINT32:\n\t\ttyp, wire = \"int32\", \"zigzag32\"\n\tcase descriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\ttyp, wire = \"int64\", \"zigzag64\"\n\tdefault:\n\t\tg.Fail(\"unknown type for\", field.GetName())\n\t}\n\tif isRepeated(field) {\n\t\ttyp = \"[]\" + typ\n\t} else if message != nil && message.proto3() {\n\t\treturn\n\t} else if field.OneofIndex != nil && message != nil {\n\t\treturn\n\t} else if needsStar(*field.Type) {\n\t\ttyp = \"*\" + typ\n\t}\n\treturn\n}\n\nfunc (g *Generator) RecordTypeUse(t string) {\n\tif obj, ok := g.typeNameToObject[t]; ok {\n\t\t// Call ObjectNamed to get the true object to record the use.\n\t\tobj = g.ObjectNamed(t)\n\t\tg.usedPackages[obj.PackageName()] = true\n\t}\n}\n\n// Method names that may be generated.  Fields with these names get an\n// underscore appended. Any change to this set is a potential incompatible\n// API change because it changes generated field names.\nvar methodNames = [...]string{\n\t\"Reset\",\n\t\"String\",\n\t\"ProtoMessage\",\n\t\"Marshal\",\n\t\"Unmarshal\",\n\t\"ExtensionRangeArray\",\n\t\"ExtensionMap\",\n\t\"Descriptor\",\n}\n\n// Names of messages in the `google.protobuf` package for which\n// we will generate XXX_WellKnownType methods.\nvar wellKnownTypes = map[string]bool{\n\t\"Any\":       true,\n\t\"Duration\":  true,\n\t\"Empty\":     true,\n\t\"Struct\":    true,\n\t\"Timestamp\": true,\n\n\t\"Value\":       true,\n\t\"ListValue\":   true,\n\t\"DoubleValue\": true,\n\t\"FloatValue\":  true,\n\t\"Int64Value\":  true,\n\t\"UInt64Value\": true,\n\t\"Int32Value\":  true,\n\t\"UInt32Value\": true,\n\t\"BoolValue\":   true,\n\t\"StringValue\": true,\n\t\"BytesValue\":  true,\n}\n\n// Generate the type and default constant definitions for this Descriptor.\nfunc (g *Generator) generateMessage(message *Descriptor) {\n\t// The full type name\n\ttypeName := message.TypeName()\n\t// The full type name, CamelCased.\n\tccTypeName := CamelCaseSlice(typeName)\n\n\tusedNames := make(map[string]bool)\n\tfor _, n := range methodNames {\n\t\tusedNames[n] = true\n\t}\n\tfieldNames := make(map[*descriptor.FieldDescriptorProto]string)\n\tfieldGetterNames := make(map[*descriptor.FieldDescriptorProto]string)\n\tfieldTypes := make(map[*descriptor.FieldDescriptorProto]string)\n\tmapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string)\n\n\toneofFieldName := make(map[int32]string)                           // indexed by oneof_index field of FieldDescriptorProto\n\toneofDisc := make(map[int32]string)                                // name of discriminator method\n\toneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star\n\toneofInsertPoints := make(map[int32]int)                           // oneof_index => offset of g.Buffer\n\n\tg.PrintComments(message.path)\n\tg.P(\"type \", ccTypeName, \" struct {\")\n\tg.In()\n\n\t// allocNames finds a conflict-free variation of the given strings,\n\t// consistently mutating their suffixes.\n\t// It returns the same number of strings.\n\tallocNames := func(ns ...string) []string {\n\tLoop:\n\t\tfor {\n\t\t\tfor _, n := range ns {\n\t\t\t\tif usedNames[n] {\n\t\t\t\t\tfor i := range ns {\n\t\t\t\t\t\tns[i] += \"_\"\n\t\t\t\t\t}\n\t\t\t\t\tcontinue Loop\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, n := range ns {\n\t\t\t\tusedNames[n] = true\n\t\t\t}\n\t\t\treturn ns\n\t\t}\n\t}\n\n\tfor i, field := range message.Field {\n\t\t// Allocate the getter and the field at the same time so name\n\t\t// collisions create field/method consistent names.\n\t\t// TODO: This allocation occurs based on the order of the fields\n\t\t// in the proto file, meaning that a change in the field\n\t\t// ordering can change generated Method/Field names.\n\t\tbase := CamelCase(*field.Name)\n\t\tns := allocNames(base, \"Get\"+base)\n\t\tfieldName, fieldGetterName := ns[0], ns[1]\n\t\ttypename, wiretype := g.GoType(message, field)\n\t\tjsonName := *field.Name\n\t\ttag := fmt.Sprintf(\"protobuf:%s json:%q\", g.goTag(message, field, wiretype), jsonName+\",omitempty\")\n\n\t\tfieldNames[field] = fieldName\n\t\tfieldGetterNames[field] = fieldGetterName\n\n\t\toneof := field.OneofIndex != nil\n\t\tif oneof && oneofFieldName[*field.OneofIndex] == \"\" {\n\t\t\todp := message.OneofDecl[int(*field.OneofIndex)]\n\t\t\tfname := allocNames(CamelCase(odp.GetName()))[0]\n\n\t\t\t// This is the first field of a oneof we haven't seen before.\n\t\t\t// Generate the union field.\n\t\t\tcom := g.PrintComments(fmt.Sprintf(\"%s,%d,%d\", message.path, messageOneofPath, *field.OneofIndex))\n\t\t\tif com {\n\t\t\t\tg.P(\"//\")\n\t\t\t}\n\t\t\tg.P(\"// Types that are valid to be assigned to \", fname, \":\")\n\t\t\t// Generate the rest of this comment later,\n\t\t\t// when we've computed any disambiguation.\n\t\t\toneofInsertPoints[*field.OneofIndex] = g.Buffer.Len()\n\n\t\t\tdname := \"is\" + ccTypeName + \"_\" + fname\n\t\t\toneofFieldName[*field.OneofIndex] = fname\n\t\t\toneofDisc[*field.OneofIndex] = dname\n\t\t\ttag := `protobuf_oneof:\"` + odp.GetName() + `\"`\n\t\t\tg.P(fname, \" \", dname, \" `\", tag, \"`\")\n\t\t}\n\n\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE {\n\t\t\tdesc := g.ObjectNamed(field.GetTypeName())\n\t\t\tif d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() {\n\t\t\t\t// Figure out the Go types and tags for the key and value types.\n\t\t\t\tkeyField, valField := d.Field[0], d.Field[1]\n\t\t\t\tkeyType, keyWire := g.GoType(d, keyField)\n\t\t\t\tvalType, valWire := g.GoType(d, valField)\n\t\t\t\tkeyTag, valTag := g.goTag(d, keyField, keyWire), g.goTag(d, valField, valWire)\n\n\t\t\t\t// We don't use stars, except for message-typed values.\n\t\t\t\t// Message and enum types are the only two possibly foreign types used in maps,\n\t\t\t\t// so record their use. They are not permitted as map keys.\n\t\t\t\tkeyType = strings.TrimPrefix(keyType, \"*\")\n\t\t\t\tswitch *valField.Type {\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\t\tvalType = strings.TrimPrefix(valType, \"*\")\n\t\t\t\t\tg.RecordTypeUse(valField.GetTypeName())\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\t\tg.RecordTypeUse(valField.GetTypeName())\n\t\t\t\tdefault:\n\t\t\t\t\tvalType = strings.TrimPrefix(valType, \"*\")\n\t\t\t\t}\n\n\t\t\t\ttypename = fmt.Sprintf(\"map[%s]%s\", keyType, valType)\n\t\t\t\tmapFieldTypes[field] = typename // record for the getter generation\n\n\t\t\t\ttag += fmt.Sprintf(\" protobuf_key:%s protobuf_val:%s\", keyTag, valTag)\n\t\t\t}\n\t\t}\n\n\t\tfieldTypes[field] = typename\n\n\t\tif oneof {\n\t\t\ttname := ccTypeName + \"_\" + fieldName\n\t\t\t// It is possible for this to collide with a message or enum\n\t\t\t// nested in this message. Check for collisions.\n\t\t\tfor {\n\t\t\t\tok := true\n\t\t\t\tfor _, desc := range message.nested {\n\t\t\t\t\tif CamelCaseSlice(desc.TypeName()) == tname {\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, enum := range message.enums {\n\t\t\t\t\tif CamelCaseSlice(enum.TypeName()) == tname {\n\t\t\t\t\t\tok = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\ttname += \"_\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\toneofTypeName[field] = tname\n\t\t\tcontinue\n\t\t}\n\n\t\tg.PrintComments(fmt.Sprintf(\"%s,%d,%d\", message.path, messageFieldPath, i))\n\t\tg.P(fieldName, \"\\t\", typename, \"\\t`\", tag, \"`\")\n\t\tg.RecordTypeUse(field.GetTypeName())\n\t}\n\tif len(message.ExtensionRange) > 0 {\n\t\tg.P(g.Pkg[\"proto\"], \".XXX_InternalExtensions `json:\\\"-\\\"`\")\n\t}\n\tif !message.proto3() {\n\t\tg.P(\"XXX_unrecognized\\t[]byte `json:\\\"-\\\"`\")\n\t}\n\tg.Out()\n\tg.P(\"}\")\n\n\t// Update g.Buffer to list valid oneof types.\n\t// We do this down here, after we've disambiguated the oneof type names.\n\t// We go in reverse order of insertion point to avoid invalidating offsets.\n\tfor oi := int32(len(message.OneofDecl)); oi >= 0; oi-- {\n\t\tip := oneofInsertPoints[oi]\n\t\tall := g.Buffer.Bytes()\n\t\trem := all[ip:]\n\t\tg.Buffer = bytes.NewBuffer(all[:ip:ip]) // set cap so we don't scribble on rem\n\t\tfor _, field := range message.Field {\n\t\t\tif field.OneofIndex == nil || *field.OneofIndex != oi {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.P(\"//\\t*\", oneofTypeName[field])\n\t\t}\n\t\tg.Buffer.Write(rem)\n\t}\n\n\t// Reset, String and ProtoMessage methods.\n\tg.P(\"func (m *\", ccTypeName, \") Reset() { *m = \", ccTypeName, \"{} }\")\n\tg.P(\"func (m *\", ccTypeName, \") String() string { return \", g.Pkg[\"proto\"], \".CompactTextString(m) }\")\n\tg.P(\"func (*\", ccTypeName, \") ProtoMessage() {}\")\n\tvar indexes []string\n\tfor m := message; m != nil; m = m.parent {\n\t\tindexes = append([]string{strconv.Itoa(m.index)}, indexes...)\n\t}\n\tg.P(\"func (*\", ccTypeName, \") Descriptor() ([]byte, []int) { return \", g.file.VarName(), \", []int{\", strings.Join(indexes, \", \"), \"} }\")\n\t// TODO: Revisit the decision to use a XXX_WellKnownType method\n\t// if we change proto.MessageName to work with multiple equivalents.\n\tif message.file.GetPackage() == \"google.protobuf\" && wellKnownTypes[message.GetName()] {\n\t\tg.P(\"func (*\", ccTypeName, `) XXX_WellKnownType() string { return \"`, message.GetName(), `\" }`)\n\t}\n\n\t// Extension support methods\n\tvar hasExtensions, isMessageSet bool\n\tif len(message.ExtensionRange) > 0 {\n\t\thasExtensions = true\n\t\t// message_set_wire_format only makes sense when extensions are defined.\n\t\tif opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() {\n\t\t\tisMessageSet = true\n\t\t\tg.P()\n\t\t\tg.P(\"func (m *\", ccTypeName, \") Marshal() ([]byte, error) {\")\n\t\t\tg.In()\n\t\t\tg.P(\"return \", g.Pkg[\"proto\"], \".MarshalMessageSet(&m.XXX_InternalExtensions)\")\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"func (m *\", ccTypeName, \") Unmarshal(buf []byte) error {\")\n\t\t\tg.In()\n\t\t\tg.P(\"return \", g.Pkg[\"proto\"], \".UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)\")\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"func (m *\", ccTypeName, \") MarshalJSON() ([]byte, error) {\")\n\t\t\tg.In()\n\t\t\tg.P(\"return \", g.Pkg[\"proto\"], \".MarshalMessageSetJSON(&m.XXX_InternalExtensions)\")\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"func (m *\", ccTypeName, \") UnmarshalJSON(buf []byte) error {\")\n\t\t\tg.In()\n\t\t\tg.P(\"return \", g.Pkg[\"proto\"], \".UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)\")\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"// ensure \", ccTypeName, \" satisfies proto.Marshaler and proto.Unmarshaler\")\n\t\t\tg.P(\"var _ \", g.Pkg[\"proto\"], \".Marshaler = (*\", ccTypeName, \")(nil)\")\n\t\t\tg.P(\"var _ \", g.Pkg[\"proto\"], \".Unmarshaler = (*\", ccTypeName, \")(nil)\")\n\t\t}\n\n\t\tg.P()\n\t\tg.P(\"var extRange_\", ccTypeName, \" = []\", g.Pkg[\"proto\"], \".ExtensionRange{\")\n\t\tg.In()\n\t\tfor _, r := range message.ExtensionRange {\n\t\t\tend := fmt.Sprint(*r.End - 1) // make range inclusive on both ends\n\t\t\tg.P(\"{\", r.Start, \", \", end, \"},\")\n\t\t}\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t\tg.P(\"func (*\", ccTypeName, \") ExtensionRangeArray() []\", g.Pkg[\"proto\"], \".ExtensionRange {\")\n\t\tg.In()\n\t\tg.P(\"return extRange_\", ccTypeName)\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t}\n\n\t// Default constants\n\tdefNames := make(map[*descriptor.FieldDescriptorProto]string)\n\tfor _, field := range message.Field {\n\t\tdef := field.GetDefaultValue()\n\t\tif def == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tfieldname := \"Default_\" + ccTypeName + \"_\" + CamelCase(*field.Name)\n\t\tdefNames[field] = fieldname\n\t\ttypename, _ := g.GoType(message, field)\n\t\tif typename[0] == '*' {\n\t\t\ttypename = typename[1:]\n\t\t}\n\t\tkind := \"const \"\n\t\tswitch {\n\t\tcase typename == \"bool\":\n\t\tcase typename == \"string\":\n\t\t\tdef = strconv.Quote(def)\n\t\tcase typename == \"[]byte\":\n\t\t\tdef = \"[]byte(\" + strconv.Quote(unescape(def)) + \")\"\n\t\t\tkind = \"var \"\n\t\tcase def == \"inf\", def == \"-inf\", def == \"nan\":\n\t\t\t// These names are known to, and defined by, the protocol language.\n\t\t\tswitch def {\n\t\t\tcase \"inf\":\n\t\t\t\tdef = \"math.Inf(1)\"\n\t\t\tcase \"-inf\":\n\t\t\t\tdef = \"math.Inf(-1)\"\n\t\t\tcase \"nan\":\n\t\t\t\tdef = \"math.NaN()\"\n\t\t\t}\n\t\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_FLOAT {\n\t\t\t\tdef = \"float32(\" + def + \")\"\n\t\t\t}\n\t\t\tkind = \"var \"\n\t\tcase *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t// Must be an enum.  Need to construct the prefixed name.\n\t\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\t\tvar enum *EnumDescriptor\n\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t// The enum type has been publicly imported.\n\t\t\t\tenum, _ = id.o.(*EnumDescriptor)\n\t\t\t} else {\n\t\t\t\tenum, _ = obj.(*EnumDescriptor)\n\t\t\t}\n\t\t\tif enum == nil {\n\t\t\t\tlog.Printf(\"don't know how to generate constant for %s\", fieldname)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdef = g.DefaultPackageName(obj) + enum.prefix() + def\n\t\t}\n\t\tg.P(kind, fieldname, \" \", typename, \" = \", def)\n\t\tg.file.addExport(message, constOrVarSymbol{fieldname, kind, \"\"})\n\t}\n\tg.P()\n\n\t// Oneof per-field types, discriminants and getters.\n\t//\n\t// Generate unexported named types for the discriminant interfaces.\n\t// We shouldn't have to do this, but there was (~19 Aug 2015) a compiler/linker bug\n\t// that was triggered by using anonymous interfaces here.\n\t// TODO: Revisit this and consider reverting back to anonymous interfaces.\n\tfor oi := range message.OneofDecl {\n\t\tdname := oneofDisc[int32(oi)]\n\t\tg.P(\"type \", dname, \" interface {\")\n\t\tg.In()\n\t\tg.P(dname, \"()\")\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t}\n\tg.P()\n\tfor _, field := range message.Field {\n\t\tif field.OneofIndex == nil {\n\t\t\tcontinue\n\t\t}\n\t\t_, wiretype := g.GoType(message, field)\n\t\ttag := \"protobuf:\" + g.goTag(message, field, wiretype)\n\t\tg.P(\"type \", oneofTypeName[field], \" struct{ \", fieldNames[field], \" \", fieldTypes[field], \" `\", tag, \"` }\")\n\t\tg.RecordTypeUse(field.GetTypeName())\n\t}\n\tg.P()\n\tfor _, field := range message.Field {\n\t\tif field.OneofIndex == nil {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"func (*\", oneofTypeName[field], \") \", oneofDisc[*field.OneofIndex], \"() {}\")\n\t}\n\tg.P()\n\tfor oi := range message.OneofDecl {\n\t\tfname := oneofFieldName[int32(oi)]\n\t\tg.P(\"func (m *\", ccTypeName, \") Get\", fname, \"() \", oneofDisc[int32(oi)], \" {\")\n\t\tg.P(\"if m != nil { return m.\", fname, \" }\")\n\t\tg.P(\"return nil\")\n\t\tg.P(\"}\")\n\t}\n\tg.P()\n\n\t// Field getters\n\tvar getters []getterSymbol\n\tfor _, field := range message.Field {\n\t\toneof := field.OneofIndex != nil\n\n\t\tfname := fieldNames[field]\n\t\ttypename, _ := g.GoType(message, field)\n\t\tif t, ok := mapFieldTypes[field]; ok {\n\t\t\ttypename = t\n\t\t}\n\t\tmname := fieldGetterNames[field]\n\t\tstar := \"\"\n\t\tif needsStar(*field.Type) && typename[0] == '*' {\n\t\t\ttypename = typename[1:]\n\t\t\tstar = \"*\"\n\t\t}\n\n\t\t// Only export getter symbols for basic types,\n\t\t// and for messages and enums in the same package.\n\t\t// Groups are not exported.\n\t\t// Foreign types can't be hoisted through a public import because\n\t\t// the importer may not already be importing the defining .proto.\n\t\t// As an example, imagine we have an import tree like this:\n\t\t//   A.proto -> B.proto -> C.proto\n\t\t// If A publicly imports B, we need to generate the getters from B in A's output,\n\t\t// but if one such getter returns something from C then we cannot do that\n\t\t// because A is not importing C already.\n\t\tvar getter, genType bool\n\t\tswitch *field.Type {\n\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\t\tgetter = false\n\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t// Only export getter if its return type is in this package.\n\t\t\tgetter = g.ObjectNamed(field.GetTypeName()).PackageName() == message.PackageName()\n\t\t\tgenType = true\n\t\tdefault:\n\t\t\tgetter = true\n\t\t}\n\t\tif getter {\n\t\t\tgetters = append(getters, getterSymbol{\n\t\t\t\tname:     mname,\n\t\t\t\ttyp:      typename,\n\t\t\t\ttypeName: field.GetTypeName(),\n\t\t\t\tgenType:  genType,\n\t\t\t})\n\t\t}\n\n\t\tg.P(\"func (m *\", ccTypeName, \") \"+mname+\"() \"+typename+\" {\")\n\t\tg.In()\n\t\tdef, hasDef := defNames[field]\n\t\ttypeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified\n\t\tswitch *field.Type {\n\t\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\ttypeDefaultIsNil = !hasDef\n\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\ttypeDefaultIsNil = true\n\t\t}\n\t\tif isRepeated(field) {\n\t\t\ttypeDefaultIsNil = true\n\t\t}\n\t\tif typeDefaultIsNil && !oneof {\n\t\t\t// A bytes field with no explicit default needs less generated code,\n\t\t\t// as does a message or group field, or a repeated field.\n\t\t\tg.P(\"if m != nil {\")\n\t\t\tg.In()\n\t\t\tg.P(\"return m.\" + fname)\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"return nil\")\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t\tg.P()\n\t\t\tcontinue\n\t\t}\n\t\tif !oneof {\n\t\t\tif message.proto3() {\n\t\t\t\tg.P(\"if m != nil {\")\n\t\t\t} else {\n\t\t\t\tg.P(\"if m != nil && m.\" + fname + \" != nil {\")\n\t\t\t}\n\t\t\tg.In()\n\t\t\tg.P(\"return \" + star + \"m.\" + fname)\n\t\t\tg.Out()\n\t\t\tg.P(\"}\")\n\t\t} else {\n\t\t\tuname := oneofFieldName[*field.OneofIndex]\n\t\t\ttname := oneofTypeName[field]\n\t\t\tg.P(\"if x, ok := m.Get\", uname, \"().(*\", tname, \"); ok {\")\n\t\t\tg.P(\"return x.\", fname)\n\t\t\tg.P(\"}\")\n\t\t}\n\t\tif hasDef {\n\t\t\tif *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES {\n\t\t\t\tg.P(\"return \" + def)\n\t\t\t} else {\n\t\t\t\t// The default is a []byte var.\n\t\t\t\t// Make a copy when returning it to be safe.\n\t\t\t\tg.P(\"return append([]byte(nil), \", def, \"...)\")\n\t\t\t}\n\t\t} else {\n\t\t\tswitch *field.Type {\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\t\tg.P(\"return false\")\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\t\t\tg.P(`return \"\"`)\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP,\n\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_MESSAGE,\n\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t\t// This is only possible for oneof fields.\n\t\t\t\tg.P(\"return nil\")\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\t// The default default for an enum is the first value in the enum,\n\t\t\t\t// not zero.\n\t\t\t\tobj := g.ObjectNamed(field.GetTypeName())\n\t\t\t\tvar enum *EnumDescriptor\n\t\t\t\tif id, ok := obj.(*ImportedDescriptor); ok {\n\t\t\t\t\t// The enum type has been publicly imported.\n\t\t\t\t\tenum, _ = id.o.(*EnumDescriptor)\n\t\t\t\t} else {\n\t\t\t\t\tenum, _ = obj.(*EnumDescriptor)\n\t\t\t\t}\n\t\t\t\tif enum == nil {\n\t\t\t\t\tlog.Printf(\"don't know how to generate getter for %s\", field.GetName())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif len(enum.Value) == 0 {\n\t\t\t\t\tg.P(\"return 0 // empty enum\")\n\t\t\t\t} else {\n\t\t\t\t\tfirst := enum.Value[0].GetName()\n\t\t\t\t\tg.P(\"return \", g.DefaultPackageName(obj)+enum.prefix()+first)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tg.P(\"return 0\")\n\t\t\t}\n\t\t}\n\t\tg.Out()\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\tif !message.group {\n\t\tms := &messageSymbol{\n\t\t\tsym:           ccTypeName,\n\t\t\thasExtensions: hasExtensions,\n\t\t\tisMessageSet:  isMessageSet,\n\t\t\thasOneof:      len(message.OneofDecl) > 0,\n\t\t\tgetters:       getters,\n\t\t}\n\t\tg.file.addExport(message, ms)\n\t}\n\n\t// Oneof functions\n\tif len(message.OneofDecl) > 0 {\n\t\tfieldWire := make(map[*descriptor.FieldDescriptorProto]string)\n\n\t\t// method\n\t\tenc := \"_\" + ccTypeName + \"_OneofMarshaler\"\n\t\tdec := \"_\" + ccTypeName + \"_OneofUnmarshaler\"\n\t\tsize := \"_\" + ccTypeName + \"_OneofSizer\"\n\t\tencSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message, b *\" + g.Pkg[\"proto\"] + \".Buffer) error\"\n\t\tdecSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message, tag, wire int, b *\" + g.Pkg[\"proto\"] + \".Buffer) (bool, error)\"\n\t\tsizeSig := \"(msg \" + g.Pkg[\"proto\"] + \".Message) (n int)\"\n\n\t\tg.P(\"// XXX_OneofFuncs is for the internal use of the proto package.\")\n\t\tg.P(\"func (*\", ccTypeName, \") XXX_OneofFuncs() (func\", encSig, \", func\", decSig, \", func\", sizeSig, \", []interface{}) {\")\n\t\tg.P(\"return \", enc, \", \", dec, \", \", size, \", []interface{}{\")\n\t\tfor _, field := range message.Field {\n\t\t\tif field.OneofIndex == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.P(\"(*\", oneofTypeName[field], \")(nil),\")\n\t\t}\n\t\tg.P(\"}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\t// marshaler\n\t\tg.P(\"func \", enc, encSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ccTypeName, \")\")\n\t\tfor oi, odp := range message.OneofDecl {\n\t\t\tg.P(\"// \", odp.GetName())\n\t\t\tfname := oneofFieldName[int32(oi)]\n\t\t\tg.P(\"switch x := m.\", fname, \".(type) {\")\n\t\t\tfor _, field := range message.Field {\n\t\t\t\tif field.OneofIndex == nil || int(*field.OneofIndex) != oi {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.P(\"case *\", oneofTypeName[field], \":\")\n\t\t\t\tvar wire, pre, post string\n\t\t\t\tval := \"x.\" + fieldNames[field] // overridden for TYPE_BOOL\n\t\t\t\tcanFail := false                // only TYPE_MESSAGE and TYPE_GROUP can fail\n\t\t\t\tswitch *field.Type {\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\t\t\t\twire = \"WireFixed64\"\n\t\t\t\t\tpre = \"b.EncodeFixed64(\" + g.Pkg[\"math\"] + \".Float64bits(\"\n\t\t\t\t\tpost = \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\t\t\t\twire = \"WireFixed32\"\n\t\t\t\t\tpre = \"b.EncodeFixed32(uint64(\" + g.Pkg[\"math\"] + \".Float32bits(\"\n\t\t\t\t\tpost = \")))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_INT64,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_UINT64:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tpre, post = \"b.EncodeVarint(uint64(\", \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_INT32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_UINT32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tpre, post = \"b.EncodeVarint(uint64(\", \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED64,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED64:\n\t\t\t\t\twire = \"WireFixed64\"\n\t\t\t\t\tpre, post = \"b.EncodeFixed64(uint64(\", \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED32:\n\t\t\t\t\twire = \"WireFixed32\"\n\t\t\t\t\tpre, post = \"b.EncodeFixed32(uint64(\", \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\t\t\t// bool needs special handling.\n\t\t\t\t\tg.P(\"t := uint64(0)\")\n\t\t\t\t\tg.P(\"if \", val, \" { t = 1 }\")\n\t\t\t\t\tval = \"t\"\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tpre, post = \"b.EncodeVarint(\", \")\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tpre, post = \"b.EncodeStringBytes(\", \")\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\t\t\t\twire = \"WireStartGroup\"\n\t\t\t\t\tpre, post = \"b.Marshal(\", \")\"\n\t\t\t\t\tcanFail = true\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tpre, post = \"b.EncodeMessage(\", \")\"\n\t\t\t\t\tcanFail = true\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tpre, post = \"b.EncodeRawBytes(\", \")\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT32:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tpre, post = \"b.EncodeZigzag32(uint64(\", \"))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tpre, post = \"b.EncodeZigzag64(uint64(\", \"))\"\n\t\t\t\tdefault:\n\t\t\t\t\tg.Fail(\"unhandled oneof field type \", field.Type.String())\n\t\t\t\t}\n\t\t\t\tfieldWire[field] = wire\n\t\t\t\tg.P(\"b.EncodeVarint(\", field.Number, \"<<3|\", g.Pkg[\"proto\"], \".\", wire, \")\")\n\t\t\t\tif !canFail {\n\t\t\t\t\tg.P(pre, val, post)\n\t\t\t\t} else {\n\t\t\t\t\tg.P(\"if err := \", pre, val, post, \"; err != nil {\")\n\t\t\t\t\tg.P(\"return err\")\n\t\t\t\t\tg.P(\"}\")\n\t\t\t\t}\n\t\t\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP {\n\t\t\t\t\tg.P(\"b.EncodeVarint(\", field.Number, \"<<3|\", g.Pkg[\"proto\"], \".WireEndGroup)\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tg.P(\"case nil:\")\n\t\t\tg.P(\"default: return \", g.Pkg[\"fmt\"], `.Errorf(\"`, ccTypeName, \".\", fname, ` has unexpected type %T\", x)`)\n\t\t\tg.P(\"}\")\n\t\t}\n\t\tg.P(\"return nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\t// unmarshaler\n\t\tg.P(\"func \", dec, decSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ccTypeName, \")\")\n\t\tg.P(\"switch tag {\")\n\t\tfor _, field := range message.Field {\n\t\t\tif field.OneofIndex == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\todp := message.OneofDecl[int(*field.OneofIndex)]\n\t\t\tg.P(\"case \", field.Number, \": // \", odp.GetName(), \".\", *field.Name)\n\t\t\tg.P(\"if wire != \", g.Pkg[\"proto\"], \".\", fieldWire[field], \" {\")\n\t\t\tg.P(\"return true, \", g.Pkg[\"proto\"], \".ErrInternalBadWireType\")\n\t\t\tg.P(\"}\")\n\t\t\tlhs := \"x, err\" // overridden for TYPE_MESSAGE and TYPE_GROUP\n\t\t\tvar dec, cast, cast2 string\n\t\t\tswitch *field.Type {\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\t\t\tdec, cast = \"b.DecodeFixed64()\", g.Pkg[\"math\"]+\".Float64frombits\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\t\t\tdec, cast, cast2 = \"b.DecodeFixed32()\", \"uint32\", g.Pkg[\"math\"]+\".Float32frombits\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_INT64:\n\t\t\t\tdec, cast = \"b.DecodeVarint()\", \"int64\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_UINT64:\n\t\t\t\tdec = \"b.DecodeVarint()\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_INT32:\n\t\t\t\tdec, cast = \"b.DecodeVarint()\", \"int32\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED64:\n\t\t\t\tdec = \"b.DecodeFixed64()\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED32:\n\t\t\t\tdec, cast = \"b.DecodeFixed32()\", \"uint32\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\t\tdec = \"b.DecodeVarint()\"\n\t\t\t\t// handled specially below\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\t\t\tdec = \"b.DecodeStringBytes()\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\t\t\tg.P(\"msg := new(\", fieldTypes[field][1:], \")\") // drop star\n\t\t\t\tlhs = \"err\"\n\t\t\t\tdec = \"b.DecodeGroup(msg)\"\n\t\t\t\t// handled specially below\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\tg.P(\"msg := new(\", fieldTypes[field][1:], \")\") // drop star\n\t\t\t\tlhs = \"err\"\n\t\t\t\tdec = \"b.DecodeMessage(msg)\"\n\t\t\t\t// handled specially below\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t\tdec = \"b.DecodeRawBytes(true)\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_UINT32:\n\t\t\t\tdec, cast = \"b.DecodeVarint()\", \"uint32\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\tdec, cast = \"b.DecodeVarint()\", fieldTypes[field]\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED32:\n\t\t\t\tdec, cast = \"b.DecodeFixed32()\", \"int32\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SFIXED64:\n\t\t\t\tdec, cast = \"b.DecodeFixed64()\", \"int64\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT32:\n\t\t\t\tdec, cast = \"b.DecodeZigzag32()\", \"int32\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\t\t\tdec, cast = \"b.DecodeZigzag64()\", \"int64\"\n\t\t\tdefault:\n\t\t\t\tg.Fail(\"unhandled oneof field type \", field.Type.String())\n\t\t\t}\n\t\t\tg.P(lhs, \" := \", dec)\n\t\t\tval := \"x\"\n\t\t\tif cast != \"\" {\n\t\t\t\tval = cast + \"(\" + val + \")\"\n\t\t\t}\n\t\t\tif cast2 != \"\" {\n\t\t\t\tval = cast2 + \"(\" + val + \")\"\n\t\t\t}\n\t\t\tswitch *field.Type {\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\t\tval += \" != 0\"\n\t\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP,\n\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\tval = \"msg\"\n\t\t\t}\n\t\t\tg.P(\"m.\", oneofFieldName[*field.OneofIndex], \" = &\", oneofTypeName[field], \"{\", val, \"}\")\n\t\t\tg.P(\"return true, err\")\n\t\t}\n\t\tg.P(\"default: return false, nil\")\n\t\tg.P(\"}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\t// sizer\n\t\tg.P(\"func \", size, sizeSig, \" {\")\n\t\tg.P(\"m := msg.(*\", ccTypeName, \")\")\n\t\tfor oi, odp := range message.OneofDecl {\n\t\t\tg.P(\"// \", odp.GetName())\n\t\t\tfname := oneofFieldName[int32(oi)]\n\t\t\tg.P(\"switch x := m.\", fname, \".(type) {\")\n\t\t\tfor _, field := range message.Field {\n\t\t\t\tif field.OneofIndex == nil || int(*field.OneofIndex) != oi {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.P(\"case *\", oneofTypeName[field], \":\")\n\t\t\t\tval := \"x.\" + fieldNames[field]\n\t\t\t\tvar wire, varint, fixed string\n\t\t\t\tswitch *field.Type {\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\t\t\t\twire = \"WireFixed64\"\n\t\t\t\t\tfixed = \"8\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FLOAT:\n\t\t\t\t\twire = \"WireFixed32\"\n\t\t\t\t\tfixed = \"4\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_INT64,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_UINT64,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_INT32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_UINT32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_ENUM:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tvarint = val\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED64,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED64:\n\t\t\t\t\twire = \"WireFixed64\"\n\t\t\t\t\tfixed = \"8\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_FIXED32,\n\t\t\t\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED32:\n\t\t\t\t\twire = \"WireFixed32\"\n\t\t\t\t\tfixed = \"4\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BOOL:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tfixed = \"1\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_STRING:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tfixed = \"len(\" + val + \")\"\n\t\t\t\t\tvarint = fixed\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_GROUP:\n\t\t\t\t\twire = \"WireStartGroup\"\n\t\t\t\t\tfixed = g.Pkg[\"proto\"] + \".Size(\" + val + \")\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tg.P(\"s := \", g.Pkg[\"proto\"], \".Size(\", val, \")\")\n\t\t\t\t\tfixed = \"s\"\n\t\t\t\t\tvarint = fixed\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_BYTES:\n\t\t\t\t\twire = \"WireBytes\"\n\t\t\t\t\tfixed = \"len(\" + val + \")\"\n\t\t\t\t\tvarint = fixed\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT32:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tvarint = \"(uint32(\" + val + \") << 1) ^ uint32((int32(\" + val + \") >> 31))\"\n\t\t\t\tcase descriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\t\t\t\twire = \"WireVarint\"\n\t\t\t\t\tvarint = \"uint64(\" + val + \" << 1) ^ uint64((int64(\" + val + \") >> 63))\"\n\t\t\t\tdefault:\n\t\t\t\t\tg.Fail(\"unhandled oneof field type \", field.Type.String())\n\t\t\t\t}\n\t\t\t\tg.P(\"n += \", g.Pkg[\"proto\"], \".SizeVarint(\", field.Number, \"<<3|\", g.Pkg[\"proto\"], \".\", wire, \")\")\n\t\t\t\tif varint != \"\" {\n\t\t\t\t\tg.P(\"n += \", g.Pkg[\"proto\"], \".SizeVarint(uint64(\", varint, \"))\")\n\t\t\t\t}\n\t\t\t\tif fixed != \"\" {\n\t\t\t\t\tg.P(\"n += \", fixed)\n\t\t\t\t}\n\t\t\t\tif *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP {\n\t\t\t\t\tg.P(\"n += \", g.Pkg[\"proto\"], \".SizeVarint(\", field.Number, \"<<3|\", g.Pkg[\"proto\"], \".WireEndGroup)\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tg.P(\"case nil:\")\n\t\t\tg.P(\"default:\")\n\t\t\tg.P(\"panic(\", g.Pkg[\"fmt\"], \".Sprintf(\\\"proto: unexpected type %T in oneof\\\", x))\")\n\t\t\tg.P(\"}\")\n\t\t}\n\t\tg.P(\"return n\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\tfor _, ext := range message.ext {\n\t\tg.generateExtension(ext)\n\t}\n\n\tfullName := strings.Join(message.TypeName(), \".\")\n\tif g.file.Package != nil {\n\t\tfullName = *g.file.Package + \".\" + fullName\n\t}\n\n\tg.addInitf(\"%s.RegisterType((*%s)(nil), %q)\", g.Pkg[\"proto\"], ccTypeName, fullName)\n}\n\nvar escapeChars = [256]byte{\n\t'a': '\\a', 'b': '\\b', 'f': '\\f', 'n': '\\n', 'r': '\\r', 't': '\\t', 'v': '\\v', '\\\\': '\\\\', '\"': '\"', '\\'': '\\'', '?': '?',\n}\n\n// unescape reverses the \"C\" escaping that protoc does for default values of bytes fields.\n// It is best effort in that it effectively ignores malformed input. Seemingly invalid escape\n// sequences are conveyed, unmodified, into the decoded result.\nfunc unescape(s string) string {\n\t// NB: Sadly, we can't use strconv.Unquote because protoc will escape both\n\t// single and double quotes, but strconv.Unquote only allows one or the\n\t// other (based on actual surrounding quotes of its input argument).\n\n\tvar out []byte\n\tfor len(s) > 0 {\n\t\t// regular character, or too short to be valid escape\n\t\tif s[0] != '\\\\' || len(s) < 2 {\n\t\t\tout = append(out, s[0])\n\t\t\ts = s[1:]\n\t\t} else if c := escapeChars[s[1]]; c != 0 {\n\t\t\t// escape sequence\n\t\t\tout = append(out, c)\n\t\t\ts = s[2:]\n\t\t} else if s[1] == 'x' || s[1] == 'X' {\n\t\t\t// hex escape, e.g. \"\\x80\n\t\t\tif len(s) < 4 {\n\t\t\t\t// too short to be valid\n\t\t\t\tout = append(out, s[:2]...)\n\t\t\t\ts = s[2:]\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv, err := strconv.ParseUint(s[2:4], 16, 8)\n\t\t\tif err != nil {\n\t\t\t\tout = append(out, s[:4]...)\n\t\t\t} else {\n\t\t\t\tout = append(out, byte(v))\n\t\t\t}\n\t\t\ts = s[4:]\n\t\t} else if '0' <= s[1] && s[1] <= '7' {\n\t\t\t// octal escape, can vary from 1 to 3 octal digits; e.g., \"\\0\" \"\\40\" or \"\\164\"\n\t\t\t// so consume up to 2 more bytes or up to end-of-string\n\t\t\tn := len(s[1:]) - len(strings.TrimLeft(s[1:], \"01234567\"))\n\t\t\tif n > 3 {\n\t\t\t\tn = 3\n\t\t\t}\n\t\t\tv, err := strconv.ParseUint(s[1:1+n], 8, 8)\n\t\t\tif err != nil {\n\t\t\t\tout = append(out, s[:1+n]...)\n\t\t\t} else {\n\t\t\t\tout = append(out, byte(v))\n\t\t\t}\n\t\t\ts = s[1+n:]\n\t\t} else {\n\t\t\t// bad escape, just propagate the slash as-is\n\t\t\tout = append(out, s[0])\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\treturn string(out)\n}\n\nfunc (g *Generator) generateExtension(ext *ExtensionDescriptor) {\n\tccTypeName := ext.DescName()\n\n\textObj := g.ObjectNamed(*ext.Extendee)\n\tvar extDesc *Descriptor\n\tif id, ok := extObj.(*ImportedDescriptor); ok {\n\t\t// This is extending a publicly imported message.\n\t\t// We need the underlying type for goTag.\n\t\textDesc = id.o.(*Descriptor)\n\t} else {\n\t\textDesc = extObj.(*Descriptor)\n\t}\n\textendedType := \"*\" + g.TypeName(extObj) // always use the original\n\tfield := ext.FieldDescriptorProto\n\tfieldType, wireType := g.GoType(ext.parent, field)\n\ttag := g.goTag(extDesc, field, wireType)\n\tg.RecordTypeUse(*ext.Extendee)\n\tif n := ext.FieldDescriptorProto.TypeName; n != nil {\n\t\t// foreign extension type\n\t\tg.RecordTypeUse(*n)\n\t}\n\n\ttypeName := ext.TypeName()\n\n\t// Special case for proto2 message sets: If this extension is extending\n\t// proto2_bridge.MessageSet, and its final name component is \"message_set_extension\",\n\t// then drop that last component.\n\tmset := false\n\tif extendedType == \"*proto2_bridge.MessageSet\" && typeName[len(typeName)-1] == \"message_set_extension\" {\n\t\ttypeName = typeName[:len(typeName)-1]\n\t\tmset = true\n\t}\n\n\t// For text formatting, the package must be exactly what the .proto file declares,\n\t// ignoring overrides such as the go_package option, and with no dot/underscore mapping.\n\textName := strings.Join(typeName, \".\")\n\tif g.file.Package != nil {\n\t\textName = *g.file.Package + \".\" + extName\n\t}\n\n\tg.P(\"var \", ccTypeName, \" = &\", g.Pkg[\"proto\"], \".ExtensionDesc{\")\n\tg.In()\n\tg.P(\"ExtendedType: (\", extendedType, \")(nil),\")\n\tg.P(\"ExtensionType: (\", fieldType, \")(nil),\")\n\tg.P(\"Field: \", field.Number, \",\")\n\tg.P(`Name: \"`, extName, `\",`)\n\tg.P(\"Tag: \", tag, \",\")\n\tg.P(`Filename: \"`, g.file.GetName(), `\",`)\n\n\tg.Out()\n\tg.P(\"}\")\n\tg.P()\n\n\tif mset {\n\t\t// Generate a bit more code to register with message_set.go.\n\t\tg.addInitf(\"%s.RegisterMessageSetType((%s)(nil), %d, %q)\", g.Pkg[\"proto\"], fieldType, *field.Number, extName)\n\t}\n\n\tg.file.addExport(ext, constOrVarSymbol{ccTypeName, \"var\", \"\"})\n}\n\nfunc (g *Generator) generateInitFunction() {\n\tfor _, enum := range g.file.enum {\n\t\tg.generateEnumRegistration(enum)\n\t}\n\tfor _, d := range g.file.desc {\n\t\tfor _, ext := range d.ext {\n\t\t\tg.generateExtensionRegistration(ext)\n\t\t}\n\t}\n\tfor _, ext := range g.file.ext {\n\t\tg.generateExtensionRegistration(ext)\n\t}\n\tif len(g.init) == 0 {\n\t\treturn\n\t}\n\tg.P(\"func init() {\")\n\tg.In()\n\tfor _, l := range g.init {\n\t\tg.P(l)\n\t}\n\tg.Out()\n\tg.P(\"}\")\n\tg.init = nil\n}\n\nfunc (g *Generator) generateFileDescriptor(file *FileDescriptor) {\n\t// Make a copy and trim source_code_info data.\n\t// TODO: Trim this more when we know exactly what we need.\n\tpb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto)\n\tpb.SourceCodeInfo = nil\n\n\tb, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tg.Fail(err.Error())\n\t}\n\n\tvar buf bytes.Buffer\n\tw, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression)\n\tw.Write(b)\n\tw.Close()\n\tb = buf.Bytes()\n\n\tv := file.VarName()\n\tg.P()\n\tg.P(\"func init() { \", g.Pkg[\"proto\"], \".RegisterFile(\", strconv.Quote(*file.Name), \", \", v, \") }\")\n\tg.P(\"var \", v, \" = []byte{\")\n\tg.In()\n\tg.P(\"// \", len(b), \" bytes of a gzipped FileDescriptorProto\")\n\tfor len(b) > 0 {\n\t\tn := 16\n\t\tif n > len(b) {\n\t\t\tn = len(b)\n\t\t}\n\n\t\ts := \"\"\n\t\tfor _, c := range b[:n] {\n\t\t\ts += fmt.Sprintf(\"0x%02x,\", c)\n\t\t}\n\t\tg.P(s)\n\n\t\tb = b[n:]\n\t}\n\tg.Out()\n\tg.P(\"}\")\n}\n\nfunc (g *Generator) generateEnumRegistration(enum *EnumDescriptor) {\n\t// // We always print the full (proto-world) package name here.\n\tpkg := enum.File().GetPackage()\n\tif pkg != \"\" {\n\t\tpkg += \".\"\n\t}\n\t// The full type name\n\ttypeName := enum.TypeName()\n\t// The full type name, CamelCased.\n\tccTypeName := CamelCaseSlice(typeName)\n\tg.addInitf(\"%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)\", g.Pkg[\"proto\"], pkg+ccTypeName, ccTypeName)\n}\n\nfunc (g *Generator) generateExtensionRegistration(ext *ExtensionDescriptor) {\n\tg.addInitf(\"%s.RegisterExtension(%s)\", g.Pkg[\"proto\"], ext.DescName())\n}\n\n// And now lots of helper functions.\n\n// Is c an ASCII lower-case letter?\nfunc isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}\n\n// Is c an ASCII digit?\nfunc isASCIIDigit(c byte) bool {\n\treturn '0' <= c && c <= '9'\n}\n\n// CamelCase returns the CamelCased name.\n// If there is an interior underscore followed by a lower case letter,\n// drop the underscore and convert the letter to upper case.\n// There is a remote possibility of this rewrite causing a name collision,\n// but it's so remote we're prepared to pretend it's nonexistent - since the\n// C++ generator lowercases names, it's extremely unlikely to have two fields\n// with different capitalizations.\n// In short, _my_field_name_2 becomes XMyFieldName_2.\nfunc CamelCase(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tt := make([]byte, 0, 32)\n\ti := 0\n\tif s[0] == '_' {\n\t\t// Need a capital letter; drop the '_'.\n\t\tt = append(t, 'X')\n\t\ti++\n\t}\n\t// Invariant: if the next letter is lower case, it must be converted\n\t// to upper case.\n\t// That is, we process a word at a time, where words are marked by _ or\n\t// upper case letter. Digits are treated as words.\n\tfor ; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) {\n\t\t\tcontinue // Skip the underscore in s.\n\t\t}\n\t\tif isASCIIDigit(c) {\n\t\t\tt = append(t, c)\n\t\t\tcontinue\n\t\t}\n\t\t// Assume we have a letter now - if not, it's a bogus identifier.\n\t\t// The next word is a sequence of characters that must start upper case.\n\t\tif isASCIILower(c) {\n\t\t\tc ^= ' ' // Make it a capital letter.\n\t\t}\n\t\tt = append(t, c) // Guaranteed not lower case.\n\t\t// Accept lower case sequence that follows.\n\t\tfor i+1 < len(s) && isASCIILower(s[i+1]) {\n\t\t\ti++\n\t\t\tt = append(t, s[i])\n\t\t}\n\t}\n\treturn string(t)\n}\n\n// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to\n// be joined with \"_\".\nfunc CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, \"_\")) }\n\n// dottedSlice turns a sliced name into a dotted name.\nfunc dottedSlice(elem []string) string { return strings.Join(elem, \".\") }\n\n// Is this field optional?\nfunc isOptional(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL\n}\n\n// Is this field required?\nfunc isRequired(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED\n}\n\n// Is this field repeated?\nfunc isRepeated(field *descriptor.FieldDescriptorProto) bool {\n\treturn field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED\n}\n\n// Is this field a scalar numeric type?\nfunc isScalar(field *descriptor.FieldDescriptorProto) bool {\n\tif field.Type == nil {\n\t\treturn false\n\t}\n\tswitch *field.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FLOAT,\n\t\tdescriptor.FieldDescriptorProto_TYPE_INT64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_INT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FIXED64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_FIXED32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_BOOL,\n\t\tdescriptor.FieldDescriptorProto_TYPE_UINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_ENUM,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SFIXED64,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SINT32,\n\t\tdescriptor.FieldDescriptorProto_TYPE_SINT64:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// badToUnderscore is the mapping function used to generate Go names from package names,\n// which can be dotted in the input .proto file.  It replaces non-identifier characters such as\n// dot or dash with underscore.\nfunc badToUnderscore(r rune) rune {\n\tif unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {\n\t\treturn r\n\t}\n\treturn '_'\n}\n\n// baseName returns the last path element of the name, with the last dotted suffix removed.\nfunc baseName(name string) string {\n\t// First, find the last element\n\tif i := strings.LastIndex(name, \"/\"); i >= 0 {\n\t\tname = name[i+1:]\n\t}\n\t// Now drop the suffix\n\tif i := strings.LastIndex(name, \".\"); i >= 0 {\n\t\tname = name[0:i]\n\t}\n\treturn name\n}\n\n// The SourceCodeInfo message describes the location of elements of a parsed\n// .proto file by way of a \"path\", which is a sequence of integers that\n// describe the route from a FileDescriptorProto to the relevant submessage.\n// The path alternates between a field number of a repeated field, and an index\n// into that repeated field. The constants below define the field numbers that\n// are used.\n//\n// See descriptor.proto for more information about this.\nconst (\n\t// tag numbers in FileDescriptorProto\n\tpackagePath = 2 // package\n\tmessagePath = 4 // message_type\n\tenumPath    = 5 // enum_type\n\t// tag numbers in DescriptorProto\n\tmessageFieldPath   = 2 // field\n\tmessageMessagePath = 3 // nested_type\n\tmessageEnumPath    = 4 // enum_type\n\tmessageOneofPath   = 8 // oneof_decl\n\t// tag numbers in EnumDescriptorProto\n\tenumValuePath = 2 // value\n)\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/generator/name_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2013 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage generator\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n)\n\nfunc TestCamelCase(t *testing.T) {\n\ttests := []struct {\n\t\tin, want string\n\t}{\n\t\t{\"one\", \"One\"},\n\t\t{\"one_two\", \"OneTwo\"},\n\t\t{\"_my_field_name_2\", \"XMyFieldName_2\"},\n\t\t{\"Something_Capped\", \"Something_Capped\"},\n\t\t{\"my_Name\", \"My_Name\"},\n\t\t{\"OneTwo\", \"OneTwo\"},\n\t\t{\"_\", \"X\"},\n\t\t{\"_a_\", \"XA_\"},\n\t}\n\tfor _, tc := range tests {\n\t\tif got := CamelCase(tc.in); got != tc.want {\n\t\t\tt.Errorf(\"CamelCase(%q) = %q, want %q\", tc.in, got, tc.want)\n\t\t}\n\t}\n}\n\nfunc TestGoPackageOption(t *testing.T) {\n\ttests := []struct {\n\t\tin           string\n\t\timpPath, pkg string\n\t\tok           bool\n\t}{\n\t\t{\"\", \"\", \"\", false},\n\t\t{\"foo\", \"\", \"foo\", true},\n\t\t{\"github.com/golang/bar\", \"github.com/golang/bar\", \"bar\", true},\n\t\t{\"github.com/golang/bar;baz\", \"github.com/golang/bar\", \"baz\", true},\n\t}\n\tfor _, tc := range tests {\n\t\td := &FileDescriptor{\n\t\t\tFileDescriptorProto: &descriptor.FileDescriptorProto{\n\t\t\t\tOptions: &descriptor.FileOptions{\n\t\t\t\t\tGoPackage: &tc.in,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\timpPath, pkg, ok := d.goPackageOption()\n\t\tif impPath != tc.impPath || pkg != tc.pkg || ok != tc.ok {\n\t\t\tt.Errorf(\"go_package = %q => (%q, %q, %t), want (%q, %q, %t)\", tc.in,\n\t\t\t\timpPath, pkg, ok, tc.impPath, tc.pkg, tc.ok)\n\t\t}\n\t}\n}\n\nfunc TestUnescape(t *testing.T) {\n\ttests := []struct {\n\t\tin   string\n\t\tout  string\n\t}{\n\t\t// successful cases, including all kinds of escapes\n\t\t{\"\", \"\"},\n\t\t{\"foo bar baz frob nitz\", \"foo bar baz frob nitz\"},\n\t\t{`\\000\\001\\002\\003\\004\\005\\006\\007`, string([]byte{0, 1, 2, 3, 4, 5, 6, 7})},\n\t\t{`\\a\\b\\f\\n\\r\\t\\v\\\\\\?\\'\\\"`, string([]byte{'\\a', '\\b', '\\f', '\\n', '\\r', '\\t', '\\v', '\\\\', '?', '\\'', '\"'})},\n\t\t{`\\x10\\x20\\x30\\x40\\x50\\x60\\x70\\x80`, string([]byte{16, 32, 48, 64, 80, 96, 112, 128})},\n\t\t// variable length octal escapes\n\t\t{`\\0\\018\\222\\377\\3\\04\\005\\6\\07`, string([]byte{0, 1, '8', 0222, 255, 3, 4, 5, 6, 7})},\n\t\t// malformed escape sequences left as is\n\t\t{\"foo \\\\g bar\", \"foo \\\\g bar\"},\n\t\t{\"foo \\\\xg0 bar\", \"foo \\\\xg0 bar\"},\n\t\t{\"\\\\\", \"\\\\\"},\n\t\t{\"\\\\x\", \"\\\\x\"},\n\t\t{\"\\\\xf\", \"\\\\xf\"},\n\t\t{\"\\\\777\", \"\\\\777\"}, // overflows byte\n\t}\n\tfor _, tc := range tests {\n\t\ts := unescape(tc.in)\n\t\tif s != tc.out {\n\t\t\tt.Errorf(\"doUnescape(%q) = %q; should have been %q\", tc.in, s, tc.out)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Package grpc outputs gRPC service descriptions in Go code.\n// It runs as a plugin for the Go protocol buffer compiler plugin.\n// It is linked in to protoc-gen-go.\npackage grpc\n\nimport (\n\t\"fmt\"\n\t\"path\"\n\t\"strconv\"\n\t\"strings\"\n\n\tpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\t\"github.com/golang/protobuf/protoc-gen-go/generator\"\n)\n\n// generatedCodeVersion indicates a version of the generated code.\n// It is incremented whenever an incompatibility between the generated code and\n// the grpc package is introduced; the generated code references\n// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion).\nconst generatedCodeVersion = 4\n\n// Paths for packages used by code generated in this file,\n// relative to the import_prefix of the generator.Generator.\nconst (\n\tcontextPkgPath = \"golang.org/x/net/context\"\n\tgrpcPkgPath    = \"google.golang.org/grpc\"\n)\n\nfunc init() {\n\tgenerator.RegisterPlugin(new(grpc))\n}\n\n// grpc is an implementation of the Go protocol buffer compiler's\n// plugin architecture.  It generates bindings for gRPC support.\ntype grpc struct {\n\tgen *generator.Generator\n}\n\n// Name returns the name of this plugin, \"grpc\".\nfunc (g *grpc) Name() string {\n\treturn \"grpc\"\n}\n\n// The names for packages imported in the generated code.\n// They may vary from the final path component of the import path\n// if the name is used by other packages.\nvar (\n\tcontextPkg string\n\tgrpcPkg    string\n)\n\n// Init initializes the plugin.\nfunc (g *grpc) Init(gen *generator.Generator) {\n\tg.gen = gen\n\tcontextPkg = generator.RegisterUniquePackageName(\"context\", nil)\n\tgrpcPkg = generator.RegisterUniquePackageName(\"grpc\", nil)\n}\n\n// Given a type name defined in a .proto, return its object.\n// Also record that we're using it, to guarantee the associated import.\nfunc (g *grpc) objectNamed(name string) generator.Object {\n\tg.gen.RecordTypeUse(name)\n\treturn g.gen.ObjectNamed(name)\n}\n\n// Given a type name defined in a .proto, return its name as we will print it.\nfunc (g *grpc) typeName(str string) string {\n\treturn g.gen.TypeName(g.objectNamed(str))\n}\n\n// P forwards to g.gen.P.\nfunc (g *grpc) P(args ...interface{}) { g.gen.P(args...) }\n\n// Generate generates code for the services in the given file.\nfunc (g *grpc) Generate(file *generator.FileDescriptor) {\n\tif len(file.FileDescriptorProto.Service) == 0 {\n\t\treturn\n\t}\n\n\tg.P(\"// Reference imports to suppress errors if they are not otherwise used.\")\n\tg.P(\"var _ \", contextPkg, \".Context\")\n\tg.P(\"var _ \", grpcPkg, \".ClientConn\")\n\tg.P()\n\n\t// Assert version compatibility.\n\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\tg.P(\"// is compatible with the grpc package it is being compiled against.\")\n\tg.P(\"const _ = \", grpcPkg, \".SupportPackageIsVersion\", generatedCodeVersion)\n\tg.P()\n\n\tfor i, service := range file.FileDescriptorProto.Service {\n\t\tg.generateService(file, service, i)\n\t}\n}\n\n// GenerateImports generates the import declaration for this file.\nfunc (g *grpc) GenerateImports(file *generator.FileDescriptor) {\n\tif len(file.FileDescriptorProto.Service) == 0 {\n\t\treturn\n\t}\n\tg.P(\"import (\")\n\tg.P(contextPkg, \" \", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath)))\n\tg.P(grpcPkg, \" \", strconv.Quote(path.Join(g.gen.ImportPrefix, grpcPkgPath)))\n\tg.P(\")\")\n\tg.P()\n}\n\n// reservedClientName records whether a client name is reserved on the client side.\nvar reservedClientName = map[string]bool{\n// TODO: do we need any in gRPC?\n}\n\nfunc unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] }\n\n// generateService generates all the code for the named service.\nfunc (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) {\n\tpath := fmt.Sprintf(\"6,%d\", index) // 6 means service.\n\n\torigServName := service.GetName()\n\tfullServName := origServName\n\tif pkg := file.GetPackage(); pkg != \"\" {\n\t\tfullServName = pkg + \".\" + fullServName\n\t}\n\tservName := generator.CamelCase(origServName)\n\n\tg.P()\n\tg.P(\"// Client API for \", servName, \" service\")\n\tg.P()\n\n\t// Client interface.\n\tg.P(\"type \", servName, \"Client interface {\")\n\tfor i, method := range service.Method {\n\t\tg.gen.PrintComments(fmt.Sprintf(\"%s,2,%d\", path, i)) // 2 means method in a service.\n\t\tg.P(g.generateClientSignature(servName, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Client structure.\n\tg.P(\"type \", unexport(servName), \"Client struct {\")\n\tg.P(\"cc *\", grpcPkg, \".ClientConn\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// NewClient factory.\n\tg.P(\"func New\", servName, \"Client (cc *\", grpcPkg, \".ClientConn) \", servName, \"Client {\")\n\tg.P(\"return &\", unexport(servName), \"Client{cc}\")\n\tg.P(\"}\")\n\tg.P()\n\n\tvar methodIndex, streamIndex int\n\tserviceDescVar := \"_\" + servName + \"_serviceDesc\"\n\t// Client method implementations.\n\tfor _, method := range service.Method {\n\t\tvar descExpr string\n\t\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\t\t// Unary RPC method\n\t\t\tdescExpr = fmt.Sprintf(\"&%s.Methods[%d]\", serviceDescVar, methodIndex)\n\t\t\tmethodIndex++\n\t\t} else {\n\t\t\t// Streaming RPC method\n\t\t\tdescExpr = fmt.Sprintf(\"&%s.Streams[%d]\", serviceDescVar, streamIndex)\n\t\t\tstreamIndex++\n\t\t}\n\t\tg.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr)\n\t}\n\n\tg.P(\"// Server API for \", servName, \" service\")\n\tg.P()\n\n\t// Server interface.\n\tserverType := servName + \"Server\"\n\tg.P(\"type \", serverType, \" interface {\")\n\tfor i, method := range service.Method {\n\t\tg.gen.PrintComments(fmt.Sprintf(\"%s,2,%d\", path, i)) // 2 means method in a service.\n\t\tg.P(g.generateServerSignature(servName, method))\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server registration.\n\tg.P(\"func Register\", servName, \"Server(s *\", grpcPkg, \".Server, srv \", serverType, \") {\")\n\tg.P(\"s.RegisterService(&\", serviceDescVar, `, srv)`)\n\tg.P(\"}\")\n\tg.P()\n\n\t// Server handler implementations.\n\tvar handlerNames []string\n\tfor _, method := range service.Method {\n\t\thname := g.generateServerMethod(servName, fullServName, method)\n\t\thandlerNames = append(handlerNames, hname)\n\t}\n\n\t// Service descriptor.\n\tg.P(\"var \", serviceDescVar, \" = \", grpcPkg, \".ServiceDesc {\")\n\tg.P(\"ServiceName: \", strconv.Quote(fullServName), \",\")\n\tg.P(\"HandlerType: (*\", serverType, \")(nil),\")\n\tg.P(\"Methods: []\", grpcPkg, \".MethodDesc{\")\n\tfor i, method := range service.Method {\n\t\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"MethodName: \", strconv.Quote(method.GetName()), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Streams: []\", grpcPkg, \".StreamDesc{\")\n\tfor i, method := range service.Method {\n\t\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(\"{\")\n\t\tg.P(\"StreamName: \", strconv.Quote(method.GetName()), \",\")\n\t\tg.P(\"Handler: \", handlerNames[i], \",\")\n\t\tif method.GetServerStreaming() {\n\t\t\tg.P(\"ServerStreams: true,\")\n\t\t}\n\t\tif method.GetClientStreaming() {\n\t\t\tg.P(\"ClientStreams: true,\")\n\t\t}\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"},\")\n\tg.P(\"Metadata: \\\"\", file.GetName(), \"\\\",\")\n\tg.P(\"}\")\n\tg.P()\n}\n\n// generateClientSignature returns the client-side signature for a method.\nfunc (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string {\n\torigMethName := method.GetName()\n\tmethName := generator.CamelCase(origMethName)\n\tif reservedClientName[methName] {\n\t\tmethName += \"_\"\n\t}\n\treqArg := \", in *\" + g.typeName(method.GetInputType())\n\tif method.GetClientStreaming() {\n\t\treqArg = \"\"\n\t}\n\trespName := \"*\" + g.typeName(method.GetOutputType())\n\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\trespName = servName + \"_\" + generator.CamelCase(origMethName) + \"Client\"\n\t}\n\treturn fmt.Sprintf(\"%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)\", methName, contextPkg, reqArg, grpcPkg, respName)\n}\n\nfunc (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) {\n\tsname := fmt.Sprintf(\"/%s/%s\", fullServName, method.GetName())\n\tmethName := generator.CamelCase(method.GetName())\n\tinType := g.typeName(method.GetInputType())\n\toutType := g.typeName(method.GetOutputType())\n\n\tg.P(\"func (c *\", unexport(servName), \"Client) \", g.generateClientSignature(servName, method), \"{\")\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\tg.P(\"out := new(\", outType, \")\")\n\t\t// TODO: Pass descExpr to Invoke.\n\t\tg.P(\"err := \", grpcPkg, `.Invoke(ctx, \"`, sname, `\", in, out, c.cc, opts...)`)\n\t\tg.P(\"if err != nil { return nil, err }\")\n\t\tg.P(\"return out, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn\n\t}\n\tstreamType := unexport(servName) + methName + \"Client\"\n\tg.P(\"stream, err := \", grpcPkg, \".NewClientStream(ctx, \", descExpr, `, c.cc, \"`, sname, `\", opts...)`)\n\tg.P(\"if err != nil { return nil, err }\")\n\tg.P(\"x := &\", streamType, \"{stream}\")\n\tif !method.GetClientStreaming() {\n\t\tg.P(\"if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t}\n\tg.P(\"return x, nil\")\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.GetClientStreaming()\n\tgenRecv := method.GetServerStreaming()\n\tgenCloseAndRecv := !method.GetServerStreaming()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", servName, \"_\", methName, \"Client interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", inType, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", outType, \", error)\")\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"CloseAndRecv() (*\", outType, \", error)\")\n\t}\n\tg.P(grpcPkg, \".ClientStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPkg, \".ClientStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", inType, \") error {\")\n\t\tg.P(\"return x.ClientStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", outType, \", error) {\")\n\t\tg.P(\"m := new(\", outType, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genCloseAndRecv {\n\t\tg.P(\"func (x *\", streamType, \") CloseAndRecv() (*\", outType, \", error) {\")\n\t\tg.P(\"if err := x.ClientStream.CloseSend(); err != nil { return nil, err }\")\n\t\tg.P(\"m := new(\", outType, \")\")\n\t\tg.P(\"if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\n// generateServerSignature returns the server-side signature for a method.\nfunc (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string {\n\torigMethName := method.GetName()\n\tmethName := generator.CamelCase(origMethName)\n\tif reservedClientName[methName] {\n\t\tmethName += \"_\"\n\t}\n\n\tvar reqArgs []string\n\tret := \"error\"\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, contextPkg+\".Context\")\n\t\tret = \"(*\" + g.typeName(method.GetOutputType()) + \", error)\"\n\t}\n\tif !method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, \"*\"+g.typeName(method.GetInputType()))\n\t}\n\tif method.GetServerStreaming() || method.GetClientStreaming() {\n\t\treqArgs = append(reqArgs, servName+\"_\"+generator.CamelCase(origMethName)+\"Server\")\n\t}\n\n\treturn methName + \"(\" + strings.Join(reqArgs, \", \") + \") \" + ret\n}\n\nfunc (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string {\n\tmethName := generator.CamelCase(method.GetName())\n\thname := fmt.Sprintf(\"_%s_%s_Handler\", servName, methName)\n\tinType := g.typeName(method.GetInputType())\n\toutType := g.typeName(method.GetOutputType())\n\n\tif !method.GetServerStreaming() && !method.GetClientStreaming() {\n\t\tg.P(\"func \", hname, \"(srv interface{}, ctx \", contextPkg, \".Context, dec func(interface{}) error, interceptor \", grpcPkg, \".UnaryServerInterceptor) (interface{}, error) {\")\n\t\tg.P(\"in := new(\", inType, \")\")\n\t\tg.P(\"if err := dec(in); err != nil { return nil, err }\")\n\t\tg.P(\"if interceptor == nil { return srv.(\", servName, \"Server).\", methName, \"(ctx, in) }\")\n\t\tg.P(\"info := &\", grpcPkg, \".UnaryServerInfo{\")\n\t\tg.P(\"Server: srv,\")\n\t\tg.P(\"FullMethod: \", strconv.Quote(fmt.Sprintf(\"/%s/%s\", fullServName, methName)), \",\")\n\t\tg.P(\"}\")\n\t\tg.P(\"handler := func(ctx \", contextPkg, \".Context, req interface{}) (interface{}, error) {\")\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(ctx, req.(*\", inType, \"))\")\n\t\tg.P(\"}\")\n\t\tg.P(\"return interceptor(ctx, in, info, handler)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\treturn hname\n\t}\n\tstreamType := unexport(servName) + methName + \"Server\"\n\tg.P(\"func \", hname, \"(srv interface{}, stream \", grpcPkg, \".ServerStream) error {\")\n\tif !method.GetClientStreaming() {\n\t\tg.P(\"m := new(\", inType, \")\")\n\t\tg.P(\"if err := stream.RecvMsg(m); err != nil { return err }\")\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(m, &\", streamType, \"{stream})\")\n\t} else {\n\t\tg.P(\"return srv.(\", servName, \"Server).\", methName, \"(&\", streamType, \"{stream})\")\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\tgenSend := method.GetServerStreaming()\n\tgenSendAndClose := !method.GetServerStreaming()\n\tgenRecv := method.GetClientStreaming()\n\n\t// Stream auxiliary types and methods.\n\tg.P(\"type \", servName, \"_\", methName, \"Server interface {\")\n\tif genSend {\n\t\tg.P(\"Send(*\", outType, \") error\")\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"SendAndClose(*\", outType, \") error\")\n\t}\n\tif genRecv {\n\t\tg.P(\"Recv() (*\", inType, \", error)\")\n\t}\n\tg.P(grpcPkg, \".ServerStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tg.P(\"type \", streamType, \" struct {\")\n\tg.P(grpcPkg, \".ServerStream\")\n\tg.P(\"}\")\n\tg.P()\n\n\tif genSend {\n\t\tg.P(\"func (x *\", streamType, \") Send(m *\", outType, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genSendAndClose {\n\t\tg.P(\"func (x *\", streamType, \") SendAndClose(m *\", outType, \") error {\")\n\t\tg.P(\"return x.ServerStream.SendMsg(m)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\tif genRecv {\n\t\tg.P(\"func (x *\", streamType, \") Recv() (*\", inType, \", error) {\")\n\t\tg.P(\"m := new(\", inType, \")\")\n\t\tg.P(\"if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }\")\n\t\tg.P(\"return m, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\treturn hname\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/link_grpc.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage main\n\nimport _ \"github.com/golang/protobuf/protoc-gen-go/grpc\"\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/main.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate\n// Go code.  Run it by building this program and putting it in your path with\n// the name\n// \tprotoc-gen-go\n// That word 'go' at the end becomes part of the option string set for the\n// protocol compiler, so once the protocol compiler (protoc) is installed\n// you can run\n// \tprotoc --go_out=output_directory input_directory/file.proto\n// to generate Go bindings for the protocol defined by file.proto.\n// With that input, the output will be written to\n// \toutput_directory/file.pb.go\n//\n// The generated code is documented in the package comment for\n// the library.\n//\n// See the README and documentation for protocol buffers to learn more:\n// \thttps://developers.google.com/protocol-buffers/\npackage main\n\nimport (\n\t\"io/ioutil\"\n\t\"os\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/golang/protobuf/protoc-gen-go/generator\"\n)\n\nfunc main() {\n\t// Begin by allocating a generator. The request and response structures are stored there\n\t// so we can do error handling easily - the response structure contains the field to\n\t// report failure.\n\tg := generator.New()\n\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tg.Error(err, \"reading input\")\n\t}\n\n\tif err := proto.Unmarshal(data, g.Request); err != nil {\n\t\tg.Error(err, \"parsing input proto\")\n\t}\n\n\tif len(g.Request.FileToGenerate) == 0 {\n\t\tg.Fail(\"no files to generate\")\n\t}\n\n\tg.CommandLineParameters(g.Request.GetParameter())\n\n\t// Create a wrapped version of the Descriptors and EnumDescriptors that\n\t// point to the file that defines them.\n\tg.WrapTypes()\n\n\tg.SetPackageNames()\n\tg.BuildTypeNameMap()\n\n\tg.GenerateAllFiles()\n\n\t// Send back the results.\n\tdata, err = proto.Marshal(g.Response)\n\tif err != nil {\n\t\tg.Error(err, \"failed to marshal output proto\")\n\t}\n\t_, err = os.Stdout.Write(data)\n\tif err != nil {\n\t\tg.Error(err, \"failed to write output proto\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/plugin/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n# Not stored here, but plugin.proto is in https://github.com/google/protobuf/\n# at src/google/protobuf/compiler/plugin.proto\n# Also we need to fix an import.\nregenerate:\n\t@echo WARNING! THIS RULE IS PROBABLY NOT RIGHT FOR YOUR INSTALLATION\n\tcp $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto .\n\tprotoc --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor:../../../../.. \\\n\t\t-I$(HOME)/src/protobuf/include $(HOME)/src/protobuf/include/google/protobuf/compiler/plugin.proto\n\nrestore:\n\tcp plugin.pb.golden plugin.pb.go\n\npreserve:\n\tcp plugin.pb.go plugin.pb.golden\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/compiler/plugin.proto\n\n/*\nPackage plugin_go is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/compiler/plugin.proto\n\nIt has these top-level messages:\n\tVersion\n\tCodeGeneratorRequest\n\tCodeGeneratorResponse\n*/\npackage plugin_go\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport google_protobuf \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// The version number of protocol compiler.\ntype Version struct {\n\tMajor *int32 `protobuf:\"varint,1,opt,name=major\" json:\"major,omitempty\"`\n\tMinor *int32 `protobuf:\"varint,2,opt,name=minor\" json:\"minor,omitempty\"`\n\tPatch *int32 `protobuf:\"varint,3,opt,name=patch\" json:\"patch,omitempty\"`\n\t// A suffix for alpha, beta or rc release, e.g., \"alpha-1\", \"rc2\". It should\n\t// be empty for mainline stable releases.\n\tSuffix           *string `protobuf:\"bytes,4,opt,name=suffix\" json:\"suffix,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Version) Reset()                    { *m = Version{} }\nfunc (m *Version) String() string            { return proto.CompactTextString(m) }\nfunc (*Version) ProtoMessage()               {}\nfunc (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\n\nfunc (m *Version) GetMajor() int32 {\n\tif m != nil && m.Major != nil {\n\t\treturn *m.Major\n\t}\n\treturn 0\n}\n\nfunc (m *Version) GetMinor() int32 {\n\tif m != nil && m.Minor != nil {\n\t\treturn *m.Minor\n\t}\n\treturn 0\n}\n\nfunc (m *Version) GetPatch() int32 {\n\tif m != nil && m.Patch != nil {\n\t\treturn *m.Patch\n\t}\n\treturn 0\n}\n\nfunc (m *Version) GetSuffix() string {\n\tif m != nil && m.Suffix != nil {\n\t\treturn *m.Suffix\n\t}\n\treturn \"\"\n}\n\n// An encoded CodeGeneratorRequest is written to the plugin's stdin.\ntype CodeGeneratorRequest struct {\n\t// The .proto files that were explicitly listed on the command-line.  The\n\t// code generator should generate code only for these files.  Each file's\n\t// descriptor will be included in proto_file, below.\n\tFileToGenerate []string `protobuf:\"bytes,1,rep,name=file_to_generate,json=fileToGenerate\" json:\"file_to_generate,omitempty\"`\n\t// The generator parameter passed on the command-line.\n\tParameter *string `protobuf:\"bytes,2,opt,name=parameter\" json:\"parameter,omitempty\"`\n\t// FileDescriptorProtos for all files in files_to_generate and everything\n\t// they import.  The files will appear in topological order, so each file\n\t// appears before any file that imports it.\n\t//\n\t// protoc guarantees that all proto_files will be written after\n\t// the fields above, even though this is not technically guaranteed by the\n\t// protobuf wire format.  This theoretically could allow a plugin to stream\n\t// in the FileDescriptorProtos and handle them one by one rather than read\n\t// the entire set into memory at once.  However, as of this writing, this\n\t// is not similarly optimized on protoc's end -- it will store all fields in\n\t// memory at once before sending them to the plugin.\n\t//\n\t// Type names of fields and extensions in the FileDescriptorProto are always\n\t// fully qualified.\n\tProtoFile []*google_protobuf.FileDescriptorProto `protobuf:\"bytes,15,rep,name=proto_file,json=protoFile\" json:\"proto_file,omitempty\"`\n\t// The version number of protocol compiler.\n\tCompilerVersion  *Version `protobuf:\"bytes,3,opt,name=compiler_version,json=compilerVersion\" json:\"compiler_version,omitempty\"`\n\tXXX_unrecognized []byte   `json:\"-\"`\n}\n\nfunc (m *CodeGeneratorRequest) Reset()                    { *m = CodeGeneratorRequest{} }\nfunc (m *CodeGeneratorRequest) String() string            { return proto.CompactTextString(m) }\nfunc (*CodeGeneratorRequest) ProtoMessage()               {}\nfunc (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\n\nfunc (m *CodeGeneratorRequest) GetFileToGenerate() []string {\n\tif m != nil {\n\t\treturn m.FileToGenerate\n\t}\n\treturn nil\n}\n\nfunc (m *CodeGeneratorRequest) GetParameter() string {\n\tif m != nil && m.Parameter != nil {\n\t\treturn *m.Parameter\n\t}\n\treturn \"\"\n}\n\nfunc (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto {\n\tif m != nil {\n\t\treturn m.ProtoFile\n\t}\n\treturn nil\n}\n\nfunc (m *CodeGeneratorRequest) GetCompilerVersion() *Version {\n\tif m != nil {\n\t\treturn m.CompilerVersion\n\t}\n\treturn nil\n}\n\n// The plugin writes an encoded CodeGeneratorResponse to stdout.\ntype CodeGeneratorResponse struct {\n\t// Error message.  If non-empty, code generation failed.  The plugin process\n\t// should exit with status code zero even if it reports an error in this way.\n\t//\n\t// This should be used to indicate errors in .proto files which prevent the\n\t// code generator from generating correct code.  Errors which indicate a\n\t// problem in protoc itself -- such as the input CodeGeneratorRequest being\n\t// unparseable -- should be reported by writing a message to stderr and\n\t// exiting with a non-zero status code.\n\tError            *string                       `protobuf:\"bytes,1,opt,name=error\" json:\"error,omitempty\"`\n\tFile             []*CodeGeneratorResponse_File `protobuf:\"bytes,15,rep,name=file\" json:\"file,omitempty\"`\n\tXXX_unrecognized []byte                        `json:\"-\"`\n}\n\nfunc (m *CodeGeneratorResponse) Reset()                    { *m = CodeGeneratorResponse{} }\nfunc (m *CodeGeneratorResponse) String() string            { return proto.CompactTextString(m) }\nfunc (*CodeGeneratorResponse) ProtoMessage()               {}\nfunc (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\n\nfunc (m *CodeGeneratorResponse) GetError() string {\n\tif m != nil && m.Error != nil {\n\t\treturn *m.Error\n\t}\n\treturn \"\"\n}\n\nfunc (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {\n\tif m != nil {\n\t\treturn m.File\n\t}\n\treturn nil\n}\n\n// Represents a single generated file.\ntype CodeGeneratorResponse_File struct {\n\t// The file name, relative to the output directory.  The name must not\n\t// contain \".\" or \"..\" components and must be relative, not be absolute (so,\n\t// the file cannot lie outside the output directory).  \"/\" must be used as\n\t// the path separator, not \"\\\".\n\t//\n\t// If the name is omitted, the content will be appended to the previous\n\t// file.  This allows the generator to break large files into small chunks,\n\t// and allows the generated text to be streamed back to protoc so that large\n\t// files need not reside completely in memory at one time.  Note that as of\n\t// this writing protoc does not optimize for this -- it will read the entire\n\t// CodeGeneratorResponse before writing files to disk.\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// If non-empty, indicates that the named file should already exist, and the\n\t// content here is to be inserted into that file at a defined insertion\n\t// point.  This feature allows a code generator to extend the output\n\t// produced by another code generator.  The original generator may provide\n\t// insertion points by placing special annotations in the file that look\n\t// like:\n\t//   @@protoc_insertion_point(NAME)\n\t// The annotation can have arbitrary text before and after it on the line,\n\t// which allows it to be placed in a comment.  NAME should be replaced with\n\t// an identifier naming the point -- this is what other generators will use\n\t// as the insertion_point.  Code inserted at this point will be placed\n\t// immediately above the line containing the insertion point (thus multiple\n\t// insertions to the same point will come out in the order they were added).\n\t// The double-@ is intended to make it unlikely that the generated code\n\t// could contain things that look like insertion points by accident.\n\t//\n\t// For example, the C++ code generator places the following line in the\n\t// .pb.h files that it generates:\n\t//   // @@protoc_insertion_point(namespace_scope)\n\t// This line appears within the scope of the file's package namespace, but\n\t// outside of any particular class.  Another plugin can then specify the\n\t// insertion_point \"namespace_scope\" to generate additional classes or\n\t// other declarations that should be placed in this scope.\n\t//\n\t// Note that if the line containing the insertion point begins with\n\t// whitespace, the same whitespace will be added to every line of the\n\t// inserted text.  This is useful for languages like Python, where\n\t// indentation matters.  In these languages, the insertion point comment\n\t// should be indented the same amount as any inserted code will need to be\n\t// in order to work correctly in that context.\n\t//\n\t// The code generator that generates the initial file and the one which\n\t// inserts into it must both run as part of a single invocation of protoc.\n\t// Code generators are executed in the order in which they appear on the\n\t// command line.\n\t//\n\t// If |insertion_point| is present, |name| must also be present.\n\tInsertionPoint *string `protobuf:\"bytes,2,opt,name=insertion_point,json=insertionPoint\" json:\"insertion_point,omitempty\"`\n\t// The file contents.\n\tContent          *string `protobuf:\"bytes,15,opt,name=content\" json:\"content,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *CodeGeneratorResponse_File) Reset()                    { *m = CodeGeneratorResponse_File{} }\nfunc (m *CodeGeneratorResponse_File) String() string            { return proto.CompactTextString(m) }\nfunc (*CodeGeneratorResponse_File) ProtoMessage()               {}\nfunc (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }\n\nfunc (m *CodeGeneratorResponse_File) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *CodeGeneratorResponse_File) GetInsertionPoint() string {\n\tif m != nil && m.InsertionPoint != nil {\n\t\treturn *m.InsertionPoint\n\t}\n\treturn \"\"\n}\n\nfunc (m *CodeGeneratorResponse_File) GetContent() string {\n\tif m != nil && m.Content != nil {\n\t\treturn *m.Content\n\t}\n\treturn \"\"\n}\n\nfunc init() {\n\tproto.RegisterType((*Version)(nil), \"google.protobuf.compiler.Version\")\n\tproto.RegisterType((*CodeGeneratorRequest)(nil), \"google.protobuf.compiler.CodeGeneratorRequest\")\n\tproto.RegisterType((*CodeGeneratorResponse)(nil), \"google.protobuf.compiler.CodeGeneratorResponse\")\n\tproto.RegisterType((*CodeGeneratorResponse_File)(nil), \"google.protobuf.compiler.CodeGeneratorResponse.File\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/compiler/plugin.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 417 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x6a, 0x14, 0x41,\n\t0x10, 0xc6, 0x19, 0x77, 0x63, 0x98, 0x8a, 0x64, 0x43, 0x13, 0xa5, 0x09, 0x39, 0x8c, 0x8b, 0xe2,\n\t0x5c, 0x32, 0x0b, 0xc1, 0x8b, 0x78, 0x4b, 0x44, 0x3d, 0x78, 0x58, 0x1a, 0xf1, 0x20, 0xc8, 0x30,\n\t0x99, 0xd4, 0x74, 0x5a, 0x66, 0xba, 0xc6, 0xee, 0x1e, 0xf1, 0x49, 0x7d, 0x0f, 0xdf, 0x40, 0xfa,\n\t0xcf, 0x24, 0xb2, 0xb8, 0xa7, 0xee, 0xef, 0x57, 0xd5, 0xd5, 0x55, 0x1f, 0x05, 0x2f, 0x25, 0x91,\n\t0xec, 0x71, 0x33, 0x1a, 0x72, 0x74, 0x33, 0x75, 0x9b, 0x96, 0x86, 0x51, 0xf5, 0x68, 0x36, 0x63,\n\t0x3f, 0x49, 0xa5, 0xab, 0x10, 0x60, 0x3c, 0xa6, 0x55, 0x73, 0x5a, 0x35, 0xa7, 0x9d, 0x15, 0xbb,\n\t0x05, 0x6e, 0xd1, 0xb6, 0x46, 0x8d, 0x8e, 0x4c, 0xcc, 0x5e, 0xb7, 0x70, 0xf8, 0x05, 0x8d, 0x55,\n\t0xa4, 0xd9, 0x29, 0x1c, 0x0c, 0xcd, 0x77, 0x32, 0x3c, 0x2b, 0xb2, 0xf2, 0x40, 0x44, 0x11, 0xa8,\n\t0xd2, 0x64, 0xf8, 0xa3, 0x44, 0xbd, 0xf0, 0x74, 0x6c, 0x5c, 0x7b, 0xc7, 0x17, 0x91, 0x06, 0xc1,\n\t0x9e, 0xc1, 0x63, 0x3b, 0x75, 0x9d, 0xfa, 0xc5, 0x97, 0x45, 0x56, 0xe6, 0x22, 0xa9, 0xf5, 0x9f,\n\t0x0c, 0x4e, 0xaf, 0xe9, 0x16, 0x3f, 0xa0, 0x46, 0xd3, 0x38, 0x32, 0x02, 0x7f, 0x4c, 0x68, 0x1d,\n\t0x2b, 0xe1, 0xa4, 0x53, 0x3d, 0xd6, 0x8e, 0x6a, 0x19, 0x63, 0xc8, 0xb3, 0x62, 0x51, 0xe6, 0xe2,\n\t0xd8, 0xf3, 0xcf, 0x94, 0x5e, 0x20, 0x3b, 0x87, 0x7c, 0x6c, 0x4c, 0x33, 0xa0, 0xc3, 0xd8, 0x4a,\n\t0x2e, 0x1e, 0x00, 0xbb, 0x06, 0x08, 0xe3, 0xd4, 0xfe, 0x15, 0x5f, 0x15, 0x8b, 0xf2, 0xe8, 0xf2,\n\t0x45, 0xb5, 0x6b, 0xcb, 0x7b, 0xd5, 0xe3, 0xbb, 0x7b, 0x03, 0xb6, 0x1e, 0x8b, 0x3c, 0x44, 0x7d,\n\t0x84, 0x7d, 0x82, 0x93, 0xd9, 0xb8, 0xfa, 0x67, 0xf4, 0x24, 0x8c, 0x77, 0x74, 0xf9, 0xbc, 0xda,\n\t0xe7, 0x70, 0x95, 0xcc, 0x13, 0xab, 0x99, 0x24, 0xb0, 0xfe, 0x9d, 0xc1, 0xd3, 0x9d, 0x99, 0xed,\n\t0x48, 0xda, 0xa2, 0xf7, 0x0e, 0x8d, 0x49, 0x3e, 0xe7, 0x22, 0x0a, 0xf6, 0x11, 0x96, 0xff, 0x34,\n\t0xff, 0x7a, 0xff, 0x8f, 0xff, 0x2d, 0x1a, 0x66, 0x13, 0xa1, 0xc2, 0xd9, 0x37, 0x58, 0x86, 0x79,\n\t0x18, 0x2c, 0x75, 0x33, 0x60, 0xfa, 0x26, 0xdc, 0xd9, 0x2b, 0x58, 0x29, 0x6d, 0xd1, 0x38, 0x45,\n\t0xba, 0x1e, 0x49, 0x69, 0x97, 0xcc, 0x3c, 0xbe, 0xc7, 0x5b, 0x4f, 0x19, 0x87, 0xc3, 0x96, 0xb4,\n\t0x43, 0xed, 0xf8, 0x2a, 0x24, 0xcc, 0xf2, 0x4a, 0xc2, 0x79, 0x4b, 0xc3, 0xde, 0xfe, 0xae, 0x9e,\n\t0x6c, 0xc3, 0x6e, 0x06, 0x7b, 0xed, 0xd7, 0x37, 0x52, 0xb9, 0xbb, 0xe9, 0xc6, 0x87, 0x37, 0x92,\n\t0xfa, 0x46, 0xcb, 0x87, 0x65, 0x0c, 0x97, 0xf6, 0x42, 0xa2, 0xbe, 0x90, 0x94, 0x56, 0xfa, 0x6d,\n\t0x3c, 0x6a, 0x49, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x15, 0x40, 0xc5, 0xfe, 0x02, 0x00,\n\t0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden",
    "content": "// Code generated by protoc-gen-go.\n// source: google/protobuf/compiler/plugin.proto\n// DO NOT EDIT!\n\npackage google_protobuf_compiler\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport \"math\"\nimport google_protobuf \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\n// Reference proto and math imports to suppress error if they are not otherwise used.\nvar _ = proto.GetString\nvar _ = math.Inf\n\ntype CodeGeneratorRequest struct {\n\tFileToGenerate   []string                               `protobuf:\"bytes,1,rep,name=file_to_generate\" json:\"file_to_generate,omitempty\"`\n\tParameter        *string                                `protobuf:\"bytes,2,opt,name=parameter\" json:\"parameter,omitempty\"`\n\tProtoFile        []*google_protobuf.FileDescriptorProto `protobuf:\"bytes,15,rep,name=proto_file\" json:\"proto_file,omitempty\"`\n\tXXX_unrecognized []byte                                 `json:\"-\"`\n}\n\nfunc (this *CodeGeneratorRequest) Reset()         { *this = CodeGeneratorRequest{} }\nfunc (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }\nfunc (*CodeGeneratorRequest) ProtoMessage()       {}\n\nfunc (this *CodeGeneratorRequest) GetParameter() string {\n\tif this != nil && this.Parameter != nil {\n\t\treturn *this.Parameter\n\t}\n\treturn \"\"\n}\n\ntype CodeGeneratorResponse struct {\n\tError            *string                       `protobuf:\"bytes,1,opt,name=error\" json:\"error,omitempty\"`\n\tFile             []*CodeGeneratorResponse_File `protobuf:\"bytes,15,rep,name=file\" json:\"file,omitempty\"`\n\tXXX_unrecognized []byte                        `json:\"-\"`\n}\n\nfunc (this *CodeGeneratorResponse) Reset()         { *this = CodeGeneratorResponse{} }\nfunc (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }\nfunc (*CodeGeneratorResponse) ProtoMessage()       {}\n\nfunc (this *CodeGeneratorResponse) GetError() string {\n\tif this != nil && this.Error != nil {\n\t\treturn *this.Error\n\t}\n\treturn \"\"\n}\n\ntype CodeGeneratorResponse_File struct {\n\tName             *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tInsertionPoint   *string `protobuf:\"bytes,2,opt,name=insertion_point\" json:\"insertion_point,omitempty\"`\n\tContent          *string `protobuf:\"bytes,15,opt,name=content\" json:\"content,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (this *CodeGeneratorResponse_File) Reset()         { *this = CodeGeneratorResponse_File{} }\nfunc (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }\nfunc (*CodeGeneratorResponse_File) ProtoMessage()       {}\n\nfunc (this *CodeGeneratorResponse_File) GetName() string {\n\tif this != nil && this.Name != nil {\n\t\treturn *this.Name\n\t}\n\treturn \"\"\n}\n\nfunc (this *CodeGeneratorResponse_File) GetInsertionPoint() string {\n\tif this != nil && this.InsertionPoint != nil {\n\t\treturn *this.InsertionPoint\n\t}\n\treturn \"\"\n}\n\nfunc (this *CodeGeneratorResponse_File) GetContent() string {\n\tif this != nil && this.Content != nil {\n\t\treturn *this.Content\n\t}\n\treturn \"\"\n}\n\nfunc init() {\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//\n// WARNING:  The plugin interface is currently EXPERIMENTAL and is subject to\n//   change.\n//\n// protoc (aka the Protocol Compiler) can be extended via plugins.  A plugin is\n// just a program that reads a CodeGeneratorRequest from stdin and writes a\n// CodeGeneratorResponse to stdout.\n//\n// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead\n// of dealing with the raw protocol defined here.\n//\n// A plugin executable needs only to be placed somewhere in the path.  The\n// plugin should be named \"protoc-gen-$NAME\", and will then be used when the\n// flag \"--${NAME}_out\" is passed to protoc.\n\nsyntax = \"proto2\";\npackage google.protobuf.compiler;\noption java_package = \"com.google.protobuf.compiler\";\noption java_outer_classname = \"PluginProtos\";\n\noption go_package = \"github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go\";\n\nimport \"google/protobuf/descriptor.proto\";\n\n// The version number of protocol compiler.\nmessage Version {\n  optional int32 major = 1;\n  optional int32 minor = 2;\n  optional int32 patch = 3;\n  // A suffix for alpha, beta or rc release, e.g., \"alpha-1\", \"rc2\". It should\n  // be empty for mainline stable releases.\n  optional string suffix = 4;\n}\n\n// An encoded CodeGeneratorRequest is written to the plugin's stdin.\nmessage CodeGeneratorRequest {\n  // The .proto files that were explicitly listed on the command-line.  The\n  // code generator should generate code only for these files.  Each file's\n  // descriptor will be included in proto_file, below.\n  repeated string file_to_generate = 1;\n\n  // The generator parameter passed on the command-line.\n  optional string parameter = 2;\n\n  // FileDescriptorProtos for all files in files_to_generate and everything\n  // they import.  The files will appear in topological order, so each file\n  // appears before any file that imports it.\n  //\n  // protoc guarantees that all proto_files will be written after\n  // the fields above, even though this is not technically guaranteed by the\n  // protobuf wire format.  This theoretically could allow a plugin to stream\n  // in the FileDescriptorProtos and handle them one by one rather than read\n  // the entire set into memory at once.  However, as of this writing, this\n  // is not similarly optimized on protoc's end -- it will store all fields in\n  // memory at once before sending them to the plugin.\n  //\n  // Type names of fields and extensions in the FileDescriptorProto are always\n  // fully qualified.\n  repeated FileDescriptorProto proto_file = 15;\n\n  // The version number of protocol compiler.\n  optional Version compiler_version = 3;\n\n}\n\n// The plugin writes an encoded CodeGeneratorResponse to stdout.\nmessage CodeGeneratorResponse {\n  // Error message.  If non-empty, code generation failed.  The plugin process\n  // should exit with status code zero even if it reports an error in this way.\n  //\n  // This should be used to indicate errors in .proto files which prevent the\n  // code generator from generating correct code.  Errors which indicate a\n  // problem in protoc itself -- such as the input CodeGeneratorRequest being\n  // unparseable -- should be reported by writing a message to stderr and\n  // exiting with a non-zero status code.\n  optional string error = 1;\n\n  // Represents a single generated file.\n  message File {\n    // The file name, relative to the output directory.  The name must not\n    // contain \".\" or \"..\" components and must be relative, not be absolute (so,\n    // the file cannot lie outside the output directory).  \"/\" must be used as\n    // the path separator, not \"\\\".\n    //\n    // If the name is omitted, the content will be appended to the previous\n    // file.  This allows the generator to break large files into small chunks,\n    // and allows the generated text to be streamed back to protoc so that large\n    // files need not reside completely in memory at one time.  Note that as of\n    // this writing protoc does not optimize for this -- it will read the entire\n    // CodeGeneratorResponse before writing files to disk.\n    optional string name = 1;\n\n    // If non-empty, indicates that the named file should already exist, and the\n    // content here is to be inserted into that file at a defined insertion\n    // point.  This feature allows a code generator to extend the output\n    // produced by another code generator.  The original generator may provide\n    // insertion points by placing special annotations in the file that look\n    // like:\n    //   @@protoc_insertion_point(NAME)\n    // The annotation can have arbitrary text before and after it on the line,\n    // which allows it to be placed in a comment.  NAME should be replaced with\n    // an identifier naming the point -- this is what other generators will use\n    // as the insertion_point.  Code inserted at this point will be placed\n    // immediately above the line containing the insertion point (thus multiple\n    // insertions to the same point will come out in the order they were added).\n    // The double-@ is intended to make it unlikely that the generated code\n    // could contain things that look like insertion points by accident.\n    //\n    // For example, the C++ code generator places the following line in the\n    // .pb.h files that it generates:\n    //   // @@protoc_insertion_point(namespace_scope)\n    // This line appears within the scope of the file's package namespace, but\n    // outside of any particular class.  Another plugin can then specify the\n    // insertion_point \"namespace_scope\" to generate additional classes or\n    // other declarations that should be placed in this scope.\n    //\n    // Note that if the line containing the insertion point begins with\n    // whitespace, the same whitespace will be added to every line of the\n    // inserted text.  This is useful for languages like Python, where\n    // indentation matters.  In these languages, the insertion point comment\n    // should be indented the same amount as any inserted code will need to be\n    // in order to work correctly in that context.\n    //\n    // The code generator that generates the initial file and the one which\n    // inserts into it must both run as part of a single invocation of protoc.\n    // Code generators are executed in the order in which they appear on the\n    // command line.\n    //\n    // If |insertion_point| is present, |name| must also be present.\n    optional string insertion_point = 2;\n\n    // The file contents.\n    optional string content = 15;\n  }\n  repeated File file = 15;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/Makefile",
    "content": "# Go support for Protocol Buffers - Google's data interchange format\n#\n# Copyright 2010 The Go Authors.  All rights reserved.\n# https://github.com/golang/protobuf\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#     * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n#     * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nall:\n\t@echo run make test\n\ninclude ../../Make.protobuf\n\ntest:\tgolden testbuild\n\n#test:\tgolden testbuild extension_test\n#\t./extension_test\n#\t@echo PASS\n\nmy_test/test.pb.go: my_test/test.proto\n\tprotoc --go_out=Mmulti/multi1.proto=github.com/golang/protobuf/protoc-gen-go/testdata/multi:. $<\n\ngolden:\n\tmake -B my_test/test.pb.go\n\tsed -i -e '/return.*fileDescriptor/d' my_test/test.pb.go\n\tsed -i -e '/^var fileDescriptor/,/^}/d' my_test/test.pb.go\n\tsed -i -e '/proto.RegisterFile.*fileDescriptor/d' my_test/test.pb.go\n\tgofmt -w my_test/test.pb.go\n\tdiff -w my_test/test.pb.go my_test/test.pb.go.golden\n\nnuke:\tclean\n\ntestbuild:\tregenerate\n\tgo test\n\nregenerate:\n\t# Invoke protoc once to generate three independent .pb.go files in the same package.\n\tprotoc --go_out=. multi/multi1.proto multi/multi2.proto multi/multi3.proto\n\n#extension_test:\textension_test.$O\n#\t$(LD) -L. -o $@ $<\n\n#multi.a: multi3.pb.$O multi2.pb.$O multi1.pb.$O\n#\trm -f multi.a\n#\t$(QUOTED_GOBIN)/gopack grc $@ $<\n\n#test.pb.go:\timp.pb.go\n#multi1.pb.go:\tmulti2.pb.go multi3.pb.go\n#main.$O: imp.pb.$O test.pb.$O multi.a\n#extension_test.$O: extension_base.pb.$O extension_extra.pb.$O extension_user.pb.$O\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/extension_base.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage extension_base;\n\nmessage BaseMessage {\n  optional int32 height = 1;\n  extensions 4 to 9;\n  extensions 16 to max;\n}\n\n// Another message that may be extended, using message_set_wire_format.\nmessage OldStyleMessage {\n  option message_set_wire_format = true;\n  extensions 100 to max;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/extension_extra.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage extension_extra;\n\nmessage ExtraMessage {\n  optional int32 width = 1;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/extension_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Test that we can use protocol buffers that use extensions.\n\npackage testdata\n\n/*\n\nimport (\n\t\"bytes\"\n\t\"regexp\"\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tbase \"extension_base.pb\"\n\tuser \"extension_user.pb\"\n)\n\nfunc TestSingleFieldExtension(t *testing.T) {\n\tbm := &base.BaseMessage{\n\t\tHeight: proto.Int32(178),\n\t}\n\n\t// Use extension within scope of another type.\n\tvol := proto.Uint32(11)\n\terr := proto.SetExtension(bm, user.E_LoudMessage_Volume, vol)\n\tif err != nil {\n\t\tt.Fatal(\"Failed setting extension:\", err)\n\t}\n\tbuf, err := proto.Marshal(bm)\n\tif err != nil {\n\t\tt.Fatal(\"Failed encoding message with extension:\", err)\n\t}\n\tbm_new := new(base.BaseMessage)\n\tif err := proto.Unmarshal(buf, bm_new); err != nil {\n\t\tt.Fatal(\"Failed decoding message with extension:\", err)\n\t}\n\tif !proto.HasExtension(bm_new, user.E_LoudMessage_Volume) {\n\t\tt.Fatal(\"Decoded message didn't contain extension.\")\n\t}\n\tvol_out, err := proto.GetExtension(bm_new, user.E_LoudMessage_Volume)\n\tif err != nil {\n\t\tt.Fatal(\"Failed getting extension:\", err)\n\t}\n\tif v := vol_out.(*uint32); *v != *vol {\n\t\tt.Errorf(\"vol_out = %v, expected %v\", *v, *vol)\n\t}\n\tproto.ClearExtension(bm_new, user.E_LoudMessage_Volume)\n\tif proto.HasExtension(bm_new, user.E_LoudMessage_Volume) {\n\t\tt.Fatal(\"Failed clearing extension.\")\n\t}\n}\n\nfunc TestMessageExtension(t *testing.T) {\n\tbm := &base.BaseMessage{\n\t\tHeight: proto.Int32(179),\n\t}\n\n\t// Use extension that is itself a message.\n\tum := &user.UserMessage{\n\t\tName: proto.String(\"Dave\"),\n\t\tRank: proto.String(\"Major\"),\n\t}\n\terr := proto.SetExtension(bm, user.E_LoginMessage_UserMessage, um)\n\tif err != nil {\n\t\tt.Fatal(\"Failed setting extension:\", err)\n\t}\n\tbuf, err := proto.Marshal(bm)\n\tif err != nil {\n\t\tt.Fatal(\"Failed encoding message with extension:\", err)\n\t}\n\tbm_new := new(base.BaseMessage)\n\tif err := proto.Unmarshal(buf, bm_new); err != nil {\n\t\tt.Fatal(\"Failed decoding message with extension:\", err)\n\t}\n\tif !proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) {\n\t\tt.Fatal(\"Decoded message didn't contain extension.\")\n\t}\n\tum_out, err := proto.GetExtension(bm_new, user.E_LoginMessage_UserMessage)\n\tif err != nil {\n\t\tt.Fatal(\"Failed getting extension:\", err)\n\t}\n\tif n := um_out.(*user.UserMessage).Name; *n != *um.Name {\n\t\tt.Errorf(\"um_out.Name = %q, expected %q\", *n, *um.Name)\n\t}\n\tif r := um_out.(*user.UserMessage).Rank; *r != *um.Rank {\n\t\tt.Errorf(\"um_out.Rank = %q, expected %q\", *r, *um.Rank)\n\t}\n\tproto.ClearExtension(bm_new, user.E_LoginMessage_UserMessage)\n\tif proto.HasExtension(bm_new, user.E_LoginMessage_UserMessage) {\n\t\tt.Fatal(\"Failed clearing extension.\")\n\t}\n}\n\nfunc TestTopLevelExtension(t *testing.T) {\n\tbm := &base.BaseMessage{\n\t\tHeight: proto.Int32(179),\n\t}\n\n\twidth := proto.Int32(17)\n\terr := proto.SetExtension(bm, user.E_Width, width)\n\tif err != nil {\n\t\tt.Fatal(\"Failed setting extension:\", err)\n\t}\n\tbuf, err := proto.Marshal(bm)\n\tif err != nil {\n\t\tt.Fatal(\"Failed encoding message with extension:\", err)\n\t}\n\tbm_new := new(base.BaseMessage)\n\tif err := proto.Unmarshal(buf, bm_new); err != nil {\n\t\tt.Fatal(\"Failed decoding message with extension:\", err)\n\t}\n\tif !proto.HasExtension(bm_new, user.E_Width) {\n\t\tt.Fatal(\"Decoded message didn't contain extension.\")\n\t}\n\twidth_out, err := proto.GetExtension(bm_new, user.E_Width)\n\tif err != nil {\n\t\tt.Fatal(\"Failed getting extension:\", err)\n\t}\n\tif w := width_out.(*int32); *w != *width {\n\t\tt.Errorf(\"width_out = %v, expected %v\", *w, *width)\n\t}\n\tproto.ClearExtension(bm_new, user.E_Width)\n\tif proto.HasExtension(bm_new, user.E_Width) {\n\t\tt.Fatal(\"Failed clearing extension.\")\n\t}\n}\n\nfunc TestMessageSetWireFormat(t *testing.T) {\n\tosm := new(base.OldStyleMessage)\n\tosp := &user.OldStyleParcel{\n\t\tName:   proto.String(\"Dave\"),\n\t\tHeight: proto.Int32(178),\n\t}\n\n\terr := proto.SetExtension(osm, user.E_OldStyleParcel_MessageSetExtension, osp)\n\tif err != nil {\n\t\tt.Fatal(\"Failed setting extension:\", err)\n\t}\n\n\tbuf, err := proto.Marshal(osm)\n\tif err != nil {\n\t\tt.Fatal(\"Failed encoding message:\", err)\n\t}\n\n\t// Data generated from Python implementation.\n\texpected := []byte{\n\t\t11, 16, 209, 15, 26, 9, 10, 4, 68, 97, 118, 101, 16, 178, 1, 12,\n\t}\n\n\tif !bytes.Equal(expected, buf) {\n\t\tt.Errorf(\"Encoding mismatch.\\nwant %+v\\n got %+v\", expected, buf)\n\t}\n\n\t// Check that it is restored correctly.\n\tosm = new(base.OldStyleMessage)\n\tif err := proto.Unmarshal(buf, osm); err != nil {\n\t\tt.Fatal(\"Failed decoding message:\", err)\n\t}\n\tosp_out, err := proto.GetExtension(osm, user.E_OldStyleParcel_MessageSetExtension)\n\tif err != nil {\n\t\tt.Fatal(\"Failed getting extension:\", err)\n\t}\n\tosp = osp_out.(*user.OldStyleParcel)\n\tif *osp.Name != \"Dave\" || *osp.Height != 178 {\n\t\tt.Errorf(\"Retrieved extension from decoded message is not correct: %+v\", osp)\n\t}\n}\n\nfunc main() {\n\t// simpler than rigging up gotest\n\ttesting.Main(regexp.MatchString, []testing.InternalTest{\n\t\t{\"TestSingleFieldExtension\", TestSingleFieldExtension},\n\t\t{\"TestMessageExtension\", TestMessageExtension},\n\t\t{\"TestTopLevelExtension\", TestTopLevelExtension},\n\t},\n\t\t[]testing.InternalBenchmark{},\n\t\t[]testing.InternalExample{})\n}\n\n*/\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/extension_user.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\nimport \"extension_base.proto\";\nimport \"extension_extra.proto\";\n\npackage extension_user;\n\nmessage UserMessage {\n  optional string name = 1;\n  optional string rank = 2;\n}\n\n// Extend with a message\nextend extension_base.BaseMessage {\n  optional UserMessage user_message = 5;\n}\n\n// Extend with a foreign message\nextend extension_base.BaseMessage {\n  optional extension_extra.ExtraMessage extra_message = 9;\n}\n\n// Extend with some primitive types\nextend extension_base.BaseMessage {\n  optional int32 width = 6;\n  optional int64 area = 7;\n}\n\n// Extend inside the scope of another type\nmessage LoudMessage {\n  extend extension_base.BaseMessage {\n    optional uint32 volume = 8;\n  }\n  extensions 100 to max;\n}\n\n// Extend inside the scope of another type, using a message.\nmessage LoginMessage {\n  extend extension_base.BaseMessage {\n    optional UserMessage user_message = 16;\n  }\n}\n\n// Extend with a repeated field\nextend extension_base.BaseMessage {\n  repeated Detail detail = 17;\n}\n\nmessage Detail {\n  optional string color = 1;\n}\n\n// An extension of an extension\nmessage Announcement {\n  optional string words = 1;\n  extend LoudMessage {\n    optional Announcement loud_ext = 100;\n  }\n}\n\n// Something that can be put in a message set.\nmessage OldStyleParcel {\n  extend extension_base.OldStyleMessage {\n    optional OldStyleParcel message_set_extension = 2001;\n  }\n\n  required string name = 1;\n  optional int32 height = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/grpc.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2015 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage grpc.testing;\n\nmessage SimpleRequest {\n}\n\nmessage SimpleResponse {\n}\n\nmessage StreamMsg {\n}\n\nmessage StreamMsg2 {\n}\n\nservice Test {\n  rpc UnaryCall(SimpleRequest) returns (SimpleResponse);\n\n  // This RPC streams from the server only.\n  rpc Downstream(SimpleRequest) returns (stream StreamMsg);\n\n  // This RPC streams from the client.\n  rpc Upstream(stream StreamMsg) returns (SimpleResponse);\n\n  // This one streams in both directions.\n  rpc Bidi(stream StreamMsg) returns (stream StreamMsg2);\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/imp.pb.go.golden",
    "content": "// Code generated by protoc-gen-go.\n// source: imp.proto\n// DO NOT EDIT!\n\npackage imp\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport \"math\"\nimport \"os\"\nimport imp1 \"imp2.pb\"\n\n// Reference proto & math imports to suppress error if they are not otherwise used.\nvar _ = proto.GetString\nvar _ = math.Inf\n\n// Types from public import imp2.proto\ntype PubliclyImportedMessage imp1.PubliclyImportedMessage\n\nfunc (this *PubliclyImportedMessage) Reset() { (*imp1.PubliclyImportedMessage)(this).Reset() }\nfunc (this *PubliclyImportedMessage) String() string {\n\treturn (*imp1.PubliclyImportedMessage)(this).String()\n}\n\n// PubliclyImportedMessage from public import imp.proto\n\ntype ImportedMessage_Owner int32\n\nconst (\n\tImportedMessage_DAVE ImportedMessage_Owner = 1\n\tImportedMessage_MIKE ImportedMessage_Owner = 2\n)\n\nvar ImportedMessage_Owner_name = map[int32]string{\n\t1: \"DAVE\",\n\t2: \"MIKE\",\n}\nvar ImportedMessage_Owner_value = map[string]int32{\n\t\"DAVE\": 1,\n\t\"MIKE\": 2,\n}\n\n// NewImportedMessage_Owner is deprecated. Use x.Enum() instead.\nfunc NewImportedMessage_Owner(x ImportedMessage_Owner) *ImportedMessage_Owner {\n\te := ImportedMessage_Owner(x)\n\treturn &e\n}\nfunc (x ImportedMessage_Owner) Enum() *ImportedMessage_Owner {\n\tp := new(ImportedMessage_Owner)\n\t*p = x\n\treturn p\n}\nfunc (x ImportedMessage_Owner) String() string {\n\treturn proto.EnumName(ImportedMessage_Owner_name, int32(x))\n}\n\ntype ImportedMessage struct {\n\tField            *int64           `protobuf:\"varint,1,req,name=field\" json:\"field,omitempty\"`\n\tXXX_extensions   map[int32][]byte `json:\",omitempty\"`\n\tXXX_unrecognized []byte           `json:\",omitempty\"`\n}\n\nfunc (this *ImportedMessage) Reset()         { *this = ImportedMessage{} }\nfunc (this *ImportedMessage) String() string { return proto.CompactTextString(this) }\n\nvar extRange_ImportedMessage = []proto.ExtensionRange{\n\tproto.ExtensionRange{90, 100},\n}\n\nfunc (*ImportedMessage) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_ImportedMessage\n}\nfunc (this *ImportedMessage) ExtensionMap() map[int32][]byte {\n\tif this.XXX_extensions == nil {\n\t\tthis.XXX_extensions = make(map[int32][]byte)\n\t}\n\treturn this.XXX_extensions\n}\n\ntype ImportedExtendable struct {\n\tXXX_extensions   map[int32][]byte `json:\",omitempty\"`\n\tXXX_unrecognized []byte           `json:\",omitempty\"`\n}\n\nfunc (this *ImportedExtendable) Reset()         { *this = ImportedExtendable{} }\nfunc (this *ImportedExtendable) String() string { return proto.CompactTextString(this) }\n\nfunc (this *ImportedExtendable) Marshal() ([]byte, error) {\n\treturn proto.MarshalMessageSet(this.ExtensionMap())\n}\nfunc (this *ImportedExtendable) Unmarshal(buf []byte) error {\n\treturn proto.UnmarshalMessageSet(buf, this.ExtensionMap())\n}\n// ensure ImportedExtendable satisfies proto.Marshaler and proto.Unmarshaler\nvar _ proto.Marshaler = (*ImportedExtendable)(nil)\nvar _ proto.Unmarshaler = (*ImportedExtendable)(nil)\n\nvar extRange_ImportedExtendable = []proto.ExtensionRange{\n\tproto.ExtensionRange{100, 536870911},\n}\n\nfunc (*ImportedExtendable) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_ImportedExtendable\n}\nfunc (this *ImportedExtendable) ExtensionMap() map[int32][]byte {\n\tif this.XXX_extensions == nil {\n\t\tthis.XXX_extensions = make(map[int32][]byte)\n\t}\n\treturn this.XXX_extensions\n}\n\nfunc init() {\n\tproto.RegisterEnum(\"imp.ImportedMessage_Owner\", ImportedMessage_Owner_name, ImportedMessage_Owner_value)\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/imp.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage imp;\n\nimport \"imp2.proto\";\nimport \"imp3.proto\";\n\nmessage ImportedMessage {\n  required int64 field = 1;\n\n  // The forwarded getters for these fields are fiddly to get right.\n  optional ImportedMessage2 local_msg = 2;\n  optional ForeignImportedMessage foreign_msg = 3;  // in imp3.proto\n  optional Owner enum_field = 4;\n  oneof union {\n    int32 state = 9;\n  }\n\n  repeated string name = 5;\n  repeated Owner boss = 6;\n  repeated ImportedMessage2 memo = 7;\n\n  map<string, ImportedMessage2> msg_map = 8;\n\n  enum Owner {\n    DAVE = 1;\n    MIKE = 2;\n  }\n\n  extensions 90 to 100;\n}\n\nmessage ImportedMessage2 {\n}\n\nmessage ImportedExtendable {\n  option message_set_wire_format = true;\n  extensions 100 to max;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/imp2.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2011 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage imp;\n\nmessage PubliclyImportedMessage {\n  optional int64 field = 1;\n}\n\nenum PubliclyImportedEnum {\n  GLASSES = 1;\n  HAIR = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/imp3.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2012 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage imp;\n\nmessage ForeignImportedMessage {\n  optional string tuber = 1;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/main_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// A simple binary to link together the protocol buffers in this test.\n\npackage testdata\n\nimport (\n\t\"testing\"\n\n\tmytestpb \"./my_test\"\n\tmultipb \"github.com/golang/protobuf/protoc-gen-go/testdata/multi\"\n)\n\nfunc TestLink(t *testing.T) {\n\t_ = &multipb.Multi1{}\n\t_ = &mytestpb.Request{}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi1.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\nimport \"multi/multi2.proto\";\nimport \"multi/multi3.proto\";\n\npackage multitest;\n\nmessage Multi1 {\n  required Multi2 multi2 = 1;\n  optional Multi2.Color color = 2;\n  optional Multi3.HatType hat_type = 3;\n}\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi2.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage multitest;\n\nmessage Multi2 {\n  required int32 required_value = 1;\n\n  enum Color {\n    BLUE = 1;\n    GREEN = 2;\n    RED = 3;\n  };\n  optional Color color = 2;\n}\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/multi/multi3.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\npackage multitest;\n\nmessage Multi3 {\n  enum HatType {\n    FEDORA = 1;\n    FEZ = 2;\n  };\n  optional HatType hat_type = 1;\n}\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: my_test/test.proto\n\n/*\nPackage my_test is a generated protocol buffer package.\n\nThis package holds interesting messages.\n\nIt is generated from these files:\n\tmy_test/test.proto\n\nIt has these top-level messages:\n\tRequest\n\tReply\n\tOtherBase\n\tReplyExtensions\n\tOtherReplyExtensions\n\tOldReply\n\tCommunique\n*/\npackage my_test\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport _ \"github.com/golang/protobuf/protoc-gen-go/testdata/multi\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype HatType int32\n\nconst (\n\t// deliberately skipping 0\n\tHatType_FEDORA HatType = 1\n\tHatType_FEZ    HatType = 2\n)\n\nvar HatType_name = map[int32]string{\n\t1: \"FEDORA\",\n\t2: \"FEZ\",\n}\nvar HatType_value = map[string]int32{\n\t\"FEDORA\": 1,\n\t\"FEZ\":    2,\n}\n\nfunc (x HatType) Enum() *HatType {\n\tp := new(HatType)\n\t*p = x\n\treturn p\n}\nfunc (x HatType) String() string {\n\treturn proto.EnumName(HatType_name, int32(x))\n}\nfunc (x *HatType) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(HatType_value, data, \"HatType\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = HatType(value)\n\treturn nil\n}\n\n// This enum represents days of the week.\ntype Days int32\n\nconst (\n\tDays_MONDAY  Days = 1\n\tDays_TUESDAY Days = 2\n\tDays_LUNDI   Days = 1\n)\n\nvar Days_name = map[int32]string{\n\t1: \"MONDAY\",\n\t2: \"TUESDAY\",\n\t// Duplicate value: 1: \"LUNDI\",\n}\nvar Days_value = map[string]int32{\n\t\"MONDAY\":  1,\n\t\"TUESDAY\": 2,\n\t\"LUNDI\":   1,\n}\n\nfunc (x Days) Enum() *Days {\n\tp := new(Days)\n\t*p = x\n\treturn p\n}\nfunc (x Days) String() string {\n\treturn proto.EnumName(Days_name, int32(x))\n}\nfunc (x *Days) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Days_value, data, \"Days\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Days(value)\n\treturn nil\n}\n\ntype Request_Color int32\n\nconst (\n\tRequest_RED   Request_Color = 0\n\tRequest_GREEN Request_Color = 1\n\tRequest_BLUE  Request_Color = 2\n)\n\nvar Request_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\nvar Request_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Request_Color) Enum() *Request_Color {\n\tp := new(Request_Color)\n\t*p = x\n\treturn p\n}\nfunc (x Request_Color) String() string {\n\treturn proto.EnumName(Request_Color_name, int32(x))\n}\nfunc (x *Request_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Request_Color_value, data, \"Request_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Request_Color(value)\n\treturn nil\n}\n\ntype Reply_Entry_Game int32\n\nconst (\n\tReply_Entry_FOOTBALL Reply_Entry_Game = 1\n\tReply_Entry_TENNIS   Reply_Entry_Game = 2\n)\n\nvar Reply_Entry_Game_name = map[int32]string{\n\t1: \"FOOTBALL\",\n\t2: \"TENNIS\",\n}\nvar Reply_Entry_Game_value = map[string]int32{\n\t\"FOOTBALL\": 1,\n\t\"TENNIS\":   2,\n}\n\nfunc (x Reply_Entry_Game) Enum() *Reply_Entry_Game {\n\tp := new(Reply_Entry_Game)\n\t*p = x\n\treturn p\n}\nfunc (x Reply_Entry_Game) String() string {\n\treturn proto.EnumName(Reply_Entry_Game_name, int32(x))\n}\nfunc (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, \"Reply_Entry_Game\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Reply_Entry_Game(value)\n\treturn nil\n}\n\n// This is a message that might be sent somewhere.\ntype Request struct {\n\tKey []int64 `protobuf:\"varint,1,rep,name=key\" json:\"key,omitempty\"`\n\t//  optional imp.ImportedMessage imported_message = 2;\n\tHue *Request_Color `protobuf:\"varint,3,opt,name=hue,enum=my.test.Request_Color\" json:\"hue,omitempty\"`\n\tHat *HatType       `protobuf:\"varint,4,opt,name=hat,enum=my.test.HatType,def=1\" json:\"hat,omitempty\"`\n\t//  optional imp.ImportedMessage.Owner owner = 6;\n\tDeadline  *float32           `protobuf:\"fixed32,7,opt,name=deadline,def=inf\" json:\"deadline,omitempty\"`\n\tSomegroup *Request_SomeGroup `protobuf:\"group,8,opt,name=SomeGroup,json=somegroup\" json:\"somegroup,omitempty\"`\n\t// This is a map field. It will generate map[int32]string.\n\tNameMapping map[int32]string `protobuf:\"bytes,14,rep,name=name_mapping,json=nameMapping\" json:\"name_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\t// This is a map field whose value type is a message.\n\tMsgMapping map[int64]*Reply `protobuf:\"bytes,15,rep,name=msg_mapping,json=msgMapping\" json:\"msg_mapping,omitempty\" protobuf_key:\"zigzag64,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tReset_     *int32           `protobuf:\"varint,12,opt,name=reset\" json:\"reset,omitempty\"`\n\t// This field should not conflict with any getters.\n\tGetKey_          *string `protobuf:\"bytes,16,opt,name=get_key,json=getKey\" json:\"get_key,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Request) Reset()         { *m = Request{} }\nfunc (m *Request) String() string { return proto.CompactTextString(m) }\nfunc (*Request) ProtoMessage()    {}\n\nconst Default_Request_Hat HatType = HatType_FEDORA\n\nvar Default_Request_Deadline float32 = float32(math.Inf(1))\n\nfunc (m *Request) GetKey() []int64 {\n\tif m != nil {\n\t\treturn m.Key\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetHue() Request_Color {\n\tif m != nil && m.Hue != nil {\n\t\treturn *m.Hue\n\t}\n\treturn Request_RED\n}\n\nfunc (m *Request) GetHat() HatType {\n\tif m != nil && m.Hat != nil {\n\t\treturn *m.Hat\n\t}\n\treturn Default_Request_Hat\n}\n\nfunc (m *Request) GetDeadline() float32 {\n\tif m != nil && m.Deadline != nil {\n\t\treturn *m.Deadline\n\t}\n\treturn Default_Request_Deadline\n}\n\nfunc (m *Request) GetSomegroup() *Request_SomeGroup {\n\tif m != nil {\n\t\treturn m.Somegroup\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetNameMapping() map[int32]string {\n\tif m != nil {\n\t\treturn m.NameMapping\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetMsgMapping() map[int64]*Reply {\n\tif m != nil {\n\t\treturn m.MsgMapping\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetReset_() int32 {\n\tif m != nil && m.Reset_ != nil {\n\t\treturn *m.Reset_\n\t}\n\treturn 0\n}\n\nfunc (m *Request) GetGetKey_() string {\n\tif m != nil && m.GetKey_ != nil {\n\t\treturn *m.GetKey_\n\t}\n\treturn \"\"\n}\n\ntype Request_SomeGroup struct {\n\tGroupField       *int32 `protobuf:\"varint,9,opt,name=group_field,json=groupField\" json:\"group_field,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Request_SomeGroup) Reset()         { *m = Request_SomeGroup{} }\nfunc (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }\nfunc (*Request_SomeGroup) ProtoMessage()    {}\n\nfunc (m *Request_SomeGroup) GetGroupField() int32 {\n\tif m != nil && m.GroupField != nil {\n\t\treturn *m.GroupField\n\t}\n\treturn 0\n}\n\ntype Reply struct {\n\tFound                        []*Reply_Entry `protobuf:\"bytes,1,rep,name=found\" json:\"found,omitempty\"`\n\tCompactKeys                  []int32        `protobuf:\"varint,2,rep,packed,name=compact_keys,json=compactKeys\" json:\"compact_keys,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *Reply) Reset()         { *m = Reply{} }\nfunc (m *Reply) String() string { return proto.CompactTextString(m) }\nfunc (*Reply) ProtoMessage()    {}\n\nvar extRange_Reply = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*Reply) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Reply\n}\n\nfunc (m *Reply) GetFound() []*Reply_Entry {\n\tif m != nil {\n\t\treturn m.Found\n\t}\n\treturn nil\n}\n\nfunc (m *Reply) GetCompactKeys() []int32 {\n\tif m != nil {\n\t\treturn m.CompactKeys\n\t}\n\treturn nil\n}\n\ntype Reply_Entry struct {\n\tKeyThatNeeds_1234Camel_CasIng *int64 `protobuf:\"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng\" json:\"key_that_needs_1234camel_CasIng,omitempty\"`\n\tValue                         *int64 `protobuf:\"varint,2,opt,name=value,def=7\" json:\"value,omitempty\"`\n\tXMyFieldName_2                *int64 `protobuf:\"varint,3,opt,name=_my_field_name_2,json=MyFieldName2\" json:\"_my_field_name_2,omitempty\"`\n\tXXX_unrecognized              []byte `json:\"-\"`\n}\n\nfunc (m *Reply_Entry) Reset()         { *m = Reply_Entry{} }\nfunc (m *Reply_Entry) String() string { return proto.CompactTextString(m) }\nfunc (*Reply_Entry) ProtoMessage()    {}\n\nconst Default_Reply_Entry_Value int64 = 7\n\nfunc (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {\n\tif m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {\n\t\treturn *m.KeyThatNeeds_1234Camel_CasIng\n\t}\n\treturn 0\n}\n\nfunc (m *Reply_Entry) GetValue() int64 {\n\tif m != nil && m.Value != nil {\n\t\treturn *m.Value\n\t}\n\treturn Default_Reply_Entry_Value\n}\n\nfunc (m *Reply_Entry) GetXMyFieldName_2() int64 {\n\tif m != nil && m.XMyFieldName_2 != nil {\n\t\treturn *m.XMyFieldName_2\n\t}\n\treturn 0\n}\n\ntype OtherBase struct {\n\tName                         *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OtherBase) Reset()         { *m = OtherBase{} }\nfunc (m *OtherBase) String() string { return proto.CompactTextString(m) }\nfunc (*OtherBase) ProtoMessage()    {}\n\nvar extRange_OtherBase = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OtherBase\n}\n\nfunc (m *OtherBase) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\ntype ReplyExtensions struct {\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *ReplyExtensions) Reset()         { *m = ReplyExtensions{} }\nfunc (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }\nfunc (*ReplyExtensions) ProtoMessage()    {}\n\nvar E_ReplyExtensions_Time = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         101,\n\tName:          \"my.test.ReplyExtensions.time\",\n\tTag:           \"fixed64,101,opt,name=time\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_ReplyExtensions_Carrot = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*ReplyExtensions)(nil),\n\tField:         105,\n\tName:          \"my.test.ReplyExtensions.carrot\",\n\tTag:           \"bytes,105,opt,name=carrot\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_ReplyExtensions_Donut = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherBase)(nil),\n\tExtensionType: (*ReplyExtensions)(nil),\n\tField:         101,\n\tName:          \"my.test.ReplyExtensions.donut\",\n\tTag:           \"bytes,101,opt,name=donut\",\n\tFilename:      \"my_test/test.proto\",\n}\n\ntype OtherReplyExtensions struct {\n\tKey              *int32 `protobuf:\"varint,1,opt,name=key\" json:\"key,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *OtherReplyExtensions) Reset()         { *m = OtherReplyExtensions{} }\nfunc (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }\nfunc (*OtherReplyExtensions) ProtoMessage()    {}\n\nfunc (m *OtherReplyExtensions) GetKey() int32 {\n\tif m != nil && m.Key != nil {\n\t\treturn *m.Key\n\t}\n\treturn 0\n}\n\ntype OldReply struct {\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OldReply) Reset()         { *m = OldReply{} }\nfunc (m *OldReply) String() string { return proto.CompactTextString(m) }\nfunc (*OldReply) ProtoMessage()    {}\n\nfunc (m *OldReply) Marshal() ([]byte, error) {\n\treturn proto.MarshalMessageSet(&m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) Unmarshal(buf []byte) error {\n\treturn proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) MarshalJSON() ([]byte, error) {\n\treturn proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) UnmarshalJSON(buf []byte) error {\n\treturn proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)\n}\n\n// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler\nvar _ proto.Marshaler = (*OldReply)(nil)\nvar _ proto.Unmarshaler = (*OldReply)(nil)\n\nvar extRange_OldReply = []proto.ExtensionRange{\n\t{100, 2147483646},\n}\n\nfunc (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OldReply\n}\n\ntype Communique struct {\n\tMakeMeCry *bool `protobuf:\"varint,1,opt,name=make_me_cry,json=makeMeCry\" json:\"make_me_cry,omitempty\"`\n\t// This is a oneof, called \"union\".\n\t//\n\t// Types that are valid to be assigned to Union:\n\t//\t*Communique_Number\n\t//\t*Communique_Name\n\t//\t*Communique_Data\n\t//\t*Communique_TempC\n\t//\t*Communique_Height\n\t//\t*Communique_Today\n\t//\t*Communique_Maybe\n\t//\t*Communique_Delta_\n\t//\t*Communique_Msg\n\t//\t*Communique_Somegroup\n\tUnion            isCommunique_Union `protobuf_oneof:\"union\"`\n\tXXX_unrecognized []byte             `json:\"-\"`\n}\n\nfunc (m *Communique) Reset()         { *m = Communique{} }\nfunc (m *Communique) String() string { return proto.CompactTextString(m) }\nfunc (*Communique) ProtoMessage()    {}\n\ntype isCommunique_Union interface {\n\tisCommunique_Union()\n}\n\ntype Communique_Number struct {\n\tNumber int32 `protobuf:\"varint,5,opt,name=number,oneof\"`\n}\ntype Communique_Name struct {\n\tName string `protobuf:\"bytes,6,opt,name=name,oneof\"`\n}\ntype Communique_Data struct {\n\tData []byte `protobuf:\"bytes,7,opt,name=data,oneof\"`\n}\ntype Communique_TempC struct {\n\tTempC float64 `protobuf:\"fixed64,8,opt,name=temp_c,json=tempC,oneof\"`\n}\ntype Communique_Height struct {\n\tHeight float32 `protobuf:\"fixed32,9,opt,name=height,oneof\"`\n}\ntype Communique_Today struct {\n\tToday Days `protobuf:\"varint,10,opt,name=today,enum=my.test.Days,oneof\"`\n}\ntype Communique_Maybe struct {\n\tMaybe bool `protobuf:\"varint,11,opt,name=maybe,oneof\"`\n}\ntype Communique_Delta_ struct {\n\tDelta int32 `protobuf:\"zigzag32,12,opt,name=delta,oneof\"`\n}\ntype Communique_Msg struct {\n\tMsg *Reply `protobuf:\"bytes,13,opt,name=msg,oneof\"`\n}\ntype Communique_Somegroup struct {\n\tSomegroup *Communique_SomeGroup `protobuf:\"group,14,opt,name=SomeGroup,json=somegroup,oneof\"`\n}\n\nfunc (*Communique_Number) isCommunique_Union()    {}\nfunc (*Communique_Name) isCommunique_Union()      {}\nfunc (*Communique_Data) isCommunique_Union()      {}\nfunc (*Communique_TempC) isCommunique_Union()     {}\nfunc (*Communique_Height) isCommunique_Union()    {}\nfunc (*Communique_Today) isCommunique_Union()     {}\nfunc (*Communique_Maybe) isCommunique_Union()     {}\nfunc (*Communique_Delta_) isCommunique_Union()    {}\nfunc (*Communique_Msg) isCommunique_Union()       {}\nfunc (*Communique_Somegroup) isCommunique_Union() {}\n\nfunc (m *Communique) GetUnion() isCommunique_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetMakeMeCry() bool {\n\tif m != nil && m.MakeMeCry != nil {\n\t\treturn *m.MakeMeCry\n\t}\n\treturn false\n}\n\nfunc (m *Communique) GetNumber() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Number); ok {\n\t\treturn x.Number\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetName() string {\n\tif x, ok := m.GetUnion().(*Communique_Name); ok {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Communique) GetData() []byte {\n\tif x, ok := m.GetUnion().(*Communique_Data); ok {\n\t\treturn x.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetTempC() float64 {\n\tif x, ok := m.GetUnion().(*Communique_TempC); ok {\n\t\treturn x.TempC\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetHeight() float32 {\n\tif x, ok := m.GetUnion().(*Communique_Height); ok {\n\t\treturn x.Height\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetToday() Days {\n\tif x, ok := m.GetUnion().(*Communique_Today); ok {\n\t\treturn x.Today\n\t}\n\treturn Days_MONDAY\n}\n\nfunc (m *Communique) GetMaybe() bool {\n\tif x, ok := m.GetUnion().(*Communique_Maybe); ok {\n\t\treturn x.Maybe\n\t}\n\treturn false\n}\n\nfunc (m *Communique) GetDelta() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Delta_); ok {\n\t\treturn x.Delta\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetMsg() *Reply {\n\tif x, ok := m.GetUnion().(*Communique_Msg); ok {\n\t\treturn x.Msg\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetSomegroup() *Communique_SomeGroup {\n\tif x, ok := m.GetUnion().(*Communique_Somegroup); ok {\n\t\treturn x.Somegroup\n\t}\n\treturn nil\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{\n\t\t(*Communique_Number)(nil),\n\t\t(*Communique_Name)(nil),\n\t\t(*Communique_Data)(nil),\n\t\t(*Communique_TempC)(nil),\n\t\t(*Communique_Height)(nil),\n\t\t(*Communique_Today)(nil),\n\t\t(*Communique_Maybe)(nil),\n\t\t(*Communique_Delta_)(nil),\n\t\t(*Communique_Msg)(nil),\n\t\t(*Communique_Somegroup)(nil),\n\t}\n}\n\nfunc _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tb.EncodeVarint(5<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tb.EncodeVarint(6<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Name)\n\tcase *Communique_Data:\n\t\tb.EncodeVarint(7<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.Data)\n\tcase *Communique_TempC:\n\t\tb.EncodeVarint(8<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.TempC))\n\tcase *Communique_Height:\n\t\tb.EncodeVarint(9<<3 | proto.WireFixed32)\n\t\tb.EncodeFixed32(uint64(math.Float32bits(x.Height)))\n\tcase *Communique_Today:\n\t\tb.EncodeVarint(10<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Today))\n\tcase *Communique_Maybe:\n\t\tt := uint64(0)\n\t\tif x.Maybe {\n\t\t\tt = 1\n\t\t}\n\t\tb.EncodeVarint(11<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(t)\n\tcase *Communique_Delta_:\n\t\tb.EncodeVarint(12<<3 | proto.WireVarint)\n\t\tb.EncodeZigzag32(uint64(x.Delta))\n\tcase *Communique_Msg:\n\t\tb.EncodeVarint(13<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.Msg); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *Communique_Somegroup:\n\t\tb.EncodeVarint(14<<3 | proto.WireStartGroup)\n\t\tif err := b.Marshal(x.Somegroup); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.EncodeVarint(14<<3 | proto.WireEndGroup)\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Communique.Union has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*Communique)\n\tswitch tag {\n\tcase 5: // union.number\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Number{int32(x)}\n\t\treturn true, err\n\tcase 6: // union.name\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &Communique_Name{x}\n\t\treturn true, err\n\tcase 7: // union.data\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Union = &Communique_Data{x}\n\t\treturn true, err\n\tcase 8: // union.temp_c\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Union = &Communique_TempC{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 9: // union.height\n\t\tif wire != proto.WireFixed32 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed32()\n\t\tm.Union = &Communique_Height{math.Float32frombits(uint32(x))}\n\t\treturn true, err\n\tcase 10: // union.today\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Today{Days(x)}\n\t\treturn true, err\n\tcase 11: // union.maybe\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Maybe{x != 0}\n\t\treturn true, err\n\tcase 12: // union.delta\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeZigzag32()\n\t\tm.Union = &Communique_Delta_{int32(x)}\n\t\treturn true, err\n\tcase 13: // union.msg\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Reply)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Union = &Communique_Msg{msg}\n\t\treturn true, err\n\tcase 14: // union.somegroup\n\t\tif wire != proto.WireStartGroup {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Communique_SomeGroup)\n\t\terr := b.DecodeGroup(msg)\n\t\tm.Union = &Communique_Somegroup{msg}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _Communique_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tn += proto.SizeVarint(5<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tn += proto.SizeVarint(6<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Name)))\n\t\tn += len(x.Name)\n\tcase *Communique_Data:\n\t\tn += proto.SizeVarint(7<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Data)))\n\t\tn += len(x.Data)\n\tcase *Communique_TempC:\n\t\tn += proto.SizeVarint(8<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Communique_Height:\n\t\tn += proto.SizeVarint(9<<3 | proto.WireFixed32)\n\t\tn += 4\n\tcase *Communique_Today:\n\t\tn += proto.SizeVarint(10<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Today))\n\tcase *Communique_Maybe:\n\t\tn += proto.SizeVarint(11<<3 | proto.WireVarint)\n\t\tn += 1\n\tcase *Communique_Delta_:\n\t\tn += proto.SizeVarint(12<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31))))\n\tcase *Communique_Msg:\n\t\ts := proto.Size(x.Msg)\n\t\tn += proto.SizeVarint(13<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase *Communique_Somegroup:\n\t\tn += proto.SizeVarint(14<<3 | proto.WireStartGroup)\n\t\tn += proto.Size(x.Somegroup)\n\t\tn += proto.SizeVarint(14<<3 | proto.WireEndGroup)\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\ntype Communique_SomeGroup struct {\n\tMember           *string `protobuf:\"bytes,15,opt,name=member\" json:\"member,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Communique_SomeGroup) Reset()         { *m = Communique_SomeGroup{} }\nfunc (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }\nfunc (*Communique_SomeGroup) ProtoMessage()    {}\n\nfunc (m *Communique_SomeGroup) GetMember() string {\n\tif m != nil && m.Member != nil {\n\t\treturn *m.Member\n\t}\n\treturn \"\"\n}\n\ntype Communique_Delta struct {\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Communique_Delta) Reset()         { *m = Communique_Delta{} }\nfunc (m *Communique_Delta) String() string { return proto.CompactTextString(m) }\nfunc (*Communique_Delta) ProtoMessage()    {}\n\nvar E_Tag = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         103,\n\tName:          \"my.test.tag\",\n\tTag:           \"bytes,103,opt,name=tag\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_Donut = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*OtherReplyExtensions)(nil),\n\tField:         106,\n\tName:          \"my.test.donut\",\n\tTag:           \"bytes,106,opt,name=donut\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nfunc init() {\n\tproto.RegisterType((*Request)(nil), \"my.test.Request\")\n\tproto.RegisterType((*Request_SomeGroup)(nil), \"my.test.Request.SomeGroup\")\n\tproto.RegisterType((*Reply)(nil), \"my.test.Reply\")\n\tproto.RegisterType((*Reply_Entry)(nil), \"my.test.Reply.Entry\")\n\tproto.RegisterType((*OtherBase)(nil), \"my.test.OtherBase\")\n\tproto.RegisterType((*ReplyExtensions)(nil), \"my.test.ReplyExtensions\")\n\tproto.RegisterType((*OtherReplyExtensions)(nil), \"my.test.OtherReplyExtensions\")\n\tproto.RegisterType((*OldReply)(nil), \"my.test.OldReply\")\n\tproto.RegisterType((*Communique)(nil), \"my.test.Communique\")\n\tproto.RegisterType((*Communique_SomeGroup)(nil), \"my.test.Communique.SomeGroup\")\n\tproto.RegisterType((*Communique_Delta)(nil), \"my.test.Communique.Delta\")\n\tproto.RegisterEnum(\"my.test.HatType\", HatType_name, HatType_value)\n\tproto.RegisterEnum(\"my.test.Days\", Days_name, Days_value)\n\tproto.RegisterEnum(\"my.test.Request_Color\", Request_Color_name, Request_Color_value)\n\tproto.RegisterEnum(\"my.test.Reply_Entry_Game\", Reply_Entry_Game_name, Reply_Entry_Game_value)\n\tproto.RegisterExtension(E_ReplyExtensions_Time)\n\tproto.RegisterExtension(E_ReplyExtensions_Carrot)\n\tproto.RegisterExtension(E_ReplyExtensions_Donut)\n\tproto.RegisterExtension(E_Tag)\n\tproto.RegisterExtension(E_Donut)\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go.golden",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: my_test/test.proto\n\n/*\nPackage my_test is a generated protocol buffer package.\n\nThis package holds interesting messages.\n\nIt is generated from these files:\n\tmy_test/test.proto\n\nIt has these top-level messages:\n\tRequest\n\tReply\n\tOtherBase\n\tReplyExtensions\n\tOtherReplyExtensions\n\tOldReply\n\tCommunique\n*/\npackage my_test\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\nimport _ \"github.com/golang/protobuf/protoc-gen-go/testdata/multi\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\ntype HatType int32\n\nconst (\n\t// deliberately skipping 0\n\tHatType_FEDORA HatType = 1\n\tHatType_FEZ    HatType = 2\n)\n\nvar HatType_name = map[int32]string{\n\t1: \"FEDORA\",\n\t2: \"FEZ\",\n}\nvar HatType_value = map[string]int32{\n\t\"FEDORA\": 1,\n\t\"FEZ\":    2,\n}\n\nfunc (x HatType) Enum() *HatType {\n\tp := new(HatType)\n\t*p = x\n\treturn p\n}\nfunc (x HatType) String() string {\n\treturn proto.EnumName(HatType_name, int32(x))\n}\nfunc (x *HatType) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(HatType_value, data, \"HatType\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = HatType(value)\n\treturn nil\n}\n\n// This enum represents days of the week.\ntype Days int32\n\nconst (\n\tDays_MONDAY  Days = 1\n\tDays_TUESDAY Days = 2\n\tDays_LUNDI   Days = 1\n)\n\nvar Days_name = map[int32]string{\n\t1: \"MONDAY\",\n\t2: \"TUESDAY\",\n\t// Duplicate value: 1: \"LUNDI\",\n}\nvar Days_value = map[string]int32{\n\t\"MONDAY\":  1,\n\t\"TUESDAY\": 2,\n\t\"LUNDI\":   1,\n}\n\nfunc (x Days) Enum() *Days {\n\tp := new(Days)\n\t*p = x\n\treturn p\n}\nfunc (x Days) String() string {\n\treturn proto.EnumName(Days_name, int32(x))\n}\nfunc (x *Days) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Days_value, data, \"Days\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Days(value)\n\treturn nil\n}\n\ntype Request_Color int32\n\nconst (\n\tRequest_RED   Request_Color = 0\n\tRequest_GREEN Request_Color = 1\n\tRequest_BLUE  Request_Color = 2\n)\n\nvar Request_Color_name = map[int32]string{\n\t0: \"RED\",\n\t1: \"GREEN\",\n\t2: \"BLUE\",\n}\nvar Request_Color_value = map[string]int32{\n\t\"RED\":   0,\n\t\"GREEN\": 1,\n\t\"BLUE\":  2,\n}\n\nfunc (x Request_Color) Enum() *Request_Color {\n\tp := new(Request_Color)\n\t*p = x\n\treturn p\n}\nfunc (x Request_Color) String() string {\n\treturn proto.EnumName(Request_Color_name, int32(x))\n}\nfunc (x *Request_Color) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Request_Color_value, data, \"Request_Color\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Request_Color(value)\n\treturn nil\n}\n\ntype Reply_Entry_Game int32\n\nconst (\n\tReply_Entry_FOOTBALL Reply_Entry_Game = 1\n\tReply_Entry_TENNIS   Reply_Entry_Game = 2\n)\n\nvar Reply_Entry_Game_name = map[int32]string{\n\t1: \"FOOTBALL\",\n\t2: \"TENNIS\",\n}\nvar Reply_Entry_Game_value = map[string]int32{\n\t\"FOOTBALL\": 1,\n\t\"TENNIS\":   2,\n}\n\nfunc (x Reply_Entry_Game) Enum() *Reply_Entry_Game {\n\tp := new(Reply_Entry_Game)\n\t*p = x\n\treturn p\n}\nfunc (x Reply_Entry_Game) String() string {\n\treturn proto.EnumName(Reply_Entry_Game_name, int32(x))\n}\nfunc (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error {\n\tvalue, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, \"Reply_Entry_Game\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = Reply_Entry_Game(value)\n\treturn nil\n}\n\n// This is a message that might be sent somewhere.\ntype Request struct {\n\tKey []int64 `protobuf:\"varint,1,rep,name=key\" json:\"key,omitempty\"`\n\t//  optional imp.ImportedMessage imported_message = 2;\n\tHue *Request_Color `protobuf:\"varint,3,opt,name=hue,enum=my.test.Request_Color\" json:\"hue,omitempty\"`\n\tHat *HatType       `protobuf:\"varint,4,opt,name=hat,enum=my.test.HatType,def=1\" json:\"hat,omitempty\"`\n\t//  optional imp.ImportedMessage.Owner owner = 6;\n\tDeadline  *float32           `protobuf:\"fixed32,7,opt,name=deadline,def=inf\" json:\"deadline,omitempty\"`\n\tSomegroup *Request_SomeGroup `protobuf:\"group,8,opt,name=SomeGroup,json=somegroup\" json:\"somegroup,omitempty\"`\n\t// This is a map field. It will generate map[int32]string.\n\tNameMapping map[int32]string `protobuf:\"bytes,14,rep,name=name_mapping,json=nameMapping\" json:\"name_mapping,omitempty\" protobuf_key:\"varint,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\t// This is a map field whose value type is a message.\n\tMsgMapping map[int64]*Reply `protobuf:\"bytes,15,rep,name=msg_mapping,json=msgMapping\" json:\"msg_mapping,omitempty\" protobuf_key:\"zigzag64,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n\tReset_     *int32           `protobuf:\"varint,12,opt,name=reset\" json:\"reset,omitempty\"`\n\t// This field should not conflict with any getters.\n\tGetKey_          *string `protobuf:\"bytes,16,opt,name=get_key,json=getKey\" json:\"get_key,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Request) Reset()         { *m = Request{} }\nfunc (m *Request) String() string { return proto.CompactTextString(m) }\nfunc (*Request) ProtoMessage()    {}\n\nconst Default_Request_Hat HatType = HatType_FEDORA\n\nvar Default_Request_Deadline float32 = float32(math.Inf(1))\n\nfunc (m *Request) GetKey() []int64 {\n\tif m != nil {\n\t\treturn m.Key\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetHue() Request_Color {\n\tif m != nil && m.Hue != nil {\n\t\treturn *m.Hue\n\t}\n\treturn Request_RED\n}\n\nfunc (m *Request) GetHat() HatType {\n\tif m != nil && m.Hat != nil {\n\t\treturn *m.Hat\n\t}\n\treturn Default_Request_Hat\n}\n\nfunc (m *Request) GetDeadline() float32 {\n\tif m != nil && m.Deadline != nil {\n\t\treturn *m.Deadline\n\t}\n\treturn Default_Request_Deadline\n}\n\nfunc (m *Request) GetSomegroup() *Request_SomeGroup {\n\tif m != nil {\n\t\treturn m.Somegroup\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetNameMapping() map[int32]string {\n\tif m != nil {\n\t\treturn m.NameMapping\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetMsgMapping() map[int64]*Reply {\n\tif m != nil {\n\t\treturn m.MsgMapping\n\t}\n\treturn nil\n}\n\nfunc (m *Request) GetReset_() int32 {\n\tif m != nil && m.Reset_ != nil {\n\t\treturn *m.Reset_\n\t}\n\treturn 0\n}\n\nfunc (m *Request) GetGetKey_() string {\n\tif m != nil && m.GetKey_ != nil {\n\t\treturn *m.GetKey_\n\t}\n\treturn \"\"\n}\n\ntype Request_SomeGroup struct {\n\tGroupField       *int32 `protobuf:\"varint,9,opt,name=group_field,json=groupField\" json:\"group_field,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Request_SomeGroup) Reset()         { *m = Request_SomeGroup{} }\nfunc (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }\nfunc (*Request_SomeGroup) ProtoMessage()    {}\n\nfunc (m *Request_SomeGroup) GetGroupField() int32 {\n\tif m != nil && m.GroupField != nil {\n\t\treturn *m.GroupField\n\t}\n\treturn 0\n}\n\ntype Reply struct {\n\tFound                        []*Reply_Entry `protobuf:\"bytes,1,rep,name=found\" json:\"found,omitempty\"`\n\tCompactKeys                  []int32        `protobuf:\"varint,2,rep,packed,name=compact_keys,json=compactKeys\" json:\"compact_keys,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *Reply) Reset()         { *m = Reply{} }\nfunc (m *Reply) String() string { return proto.CompactTextString(m) }\nfunc (*Reply) ProtoMessage()    {}\n\nvar extRange_Reply = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*Reply) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_Reply\n}\n\nfunc (m *Reply) GetFound() []*Reply_Entry {\n\tif m != nil {\n\t\treturn m.Found\n\t}\n\treturn nil\n}\n\nfunc (m *Reply) GetCompactKeys() []int32 {\n\tif m != nil {\n\t\treturn m.CompactKeys\n\t}\n\treturn nil\n}\n\ntype Reply_Entry struct {\n\tKeyThatNeeds_1234Camel_CasIng *int64 `protobuf:\"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng\" json:\"key_that_needs_1234camel_CasIng,omitempty\"`\n\tValue                         *int64 `protobuf:\"varint,2,opt,name=value,def=7\" json:\"value,omitempty\"`\n\tXMyFieldName_2                *int64 `protobuf:\"varint,3,opt,name=_my_field_name_2,json=MyFieldName2\" json:\"_my_field_name_2,omitempty\"`\n\tXXX_unrecognized              []byte `json:\"-\"`\n}\n\nfunc (m *Reply_Entry) Reset()         { *m = Reply_Entry{} }\nfunc (m *Reply_Entry) String() string { return proto.CompactTextString(m) }\nfunc (*Reply_Entry) ProtoMessage()    {}\n\nconst Default_Reply_Entry_Value int64 = 7\n\nfunc (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {\n\tif m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {\n\t\treturn *m.KeyThatNeeds_1234Camel_CasIng\n\t}\n\treturn 0\n}\n\nfunc (m *Reply_Entry) GetValue() int64 {\n\tif m != nil && m.Value != nil {\n\t\treturn *m.Value\n\t}\n\treturn Default_Reply_Entry_Value\n}\n\nfunc (m *Reply_Entry) GetXMyFieldName_2() int64 {\n\tif m != nil && m.XMyFieldName_2 != nil {\n\t\treturn *m.XMyFieldName_2\n\t}\n\treturn 0\n}\n\ntype OtherBase struct {\n\tName                         *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OtherBase) Reset()         { *m = OtherBase{} }\nfunc (m *OtherBase) String() string { return proto.CompactTextString(m) }\nfunc (*OtherBase) ProtoMessage()    {}\n\nvar extRange_OtherBase = []proto.ExtensionRange{\n\t{100, 536870911},\n}\n\nfunc (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OtherBase\n}\n\nfunc (m *OtherBase) GetName() string {\n\tif m != nil && m.Name != nil {\n\t\treturn *m.Name\n\t}\n\treturn \"\"\n}\n\ntype ReplyExtensions struct {\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *ReplyExtensions) Reset()         { *m = ReplyExtensions{} }\nfunc (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }\nfunc (*ReplyExtensions) ProtoMessage()    {}\n\nvar E_ReplyExtensions_Time = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*float64)(nil),\n\tField:         101,\n\tName:          \"my.test.ReplyExtensions.time\",\n\tTag:           \"fixed64,101,opt,name=time\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_ReplyExtensions_Carrot = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*ReplyExtensions)(nil),\n\tField:         105,\n\tName:          \"my.test.ReplyExtensions.carrot\",\n\tTag:           \"bytes,105,opt,name=carrot\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_ReplyExtensions_Donut = &proto.ExtensionDesc{\n\tExtendedType:  (*OtherBase)(nil),\n\tExtensionType: (*ReplyExtensions)(nil),\n\tField:         101,\n\tName:          \"my.test.ReplyExtensions.donut\",\n\tTag:           \"bytes,101,opt,name=donut\",\n\tFilename:      \"my_test/test.proto\",\n}\n\ntype OtherReplyExtensions struct {\n\tKey              *int32 `protobuf:\"varint,1,opt,name=key\" json:\"key,omitempty\"`\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *OtherReplyExtensions) Reset()         { *m = OtherReplyExtensions{} }\nfunc (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }\nfunc (*OtherReplyExtensions) ProtoMessage()    {}\n\nfunc (m *OtherReplyExtensions) GetKey() int32 {\n\tif m != nil && m.Key != nil {\n\t\treturn *m.Key\n\t}\n\treturn 0\n}\n\ntype OldReply struct {\n\tproto.XXX_InternalExtensions `json:\"-\"`\n\tXXX_unrecognized             []byte `json:\"-\"`\n}\n\nfunc (m *OldReply) Reset()         { *m = OldReply{} }\nfunc (m *OldReply) String() string { return proto.CompactTextString(m) }\nfunc (*OldReply) ProtoMessage()    {}\n\nfunc (m *OldReply) Marshal() ([]byte, error) {\n\treturn proto.MarshalMessageSet(&m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) Unmarshal(buf []byte) error {\n\treturn proto.UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) MarshalJSON() ([]byte, error) {\n\treturn proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)\n}\nfunc (m *OldReply) UnmarshalJSON(buf []byte) error {\n\treturn proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)\n}\n\n// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler\nvar _ proto.Marshaler = (*OldReply)(nil)\nvar _ proto.Unmarshaler = (*OldReply)(nil)\n\nvar extRange_OldReply = []proto.ExtensionRange{\n\t{100, 2147483646},\n}\n\nfunc (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {\n\treturn extRange_OldReply\n}\n\ntype Communique struct {\n\tMakeMeCry *bool `protobuf:\"varint,1,opt,name=make_me_cry,json=makeMeCry\" json:\"make_me_cry,omitempty\"`\n\t// This is a oneof, called \"union\".\n\t//\n\t// Types that are valid to be assigned to Union:\n\t//\t*Communique_Number\n\t//\t*Communique_Name\n\t//\t*Communique_Data\n\t//\t*Communique_TempC\n\t//\t*Communique_Height\n\t//\t*Communique_Today\n\t//\t*Communique_Maybe\n\t//\t*Communique_Delta_\n\t//\t*Communique_Msg\n\t//\t*Communique_Somegroup\n\tUnion            isCommunique_Union `protobuf_oneof:\"union\"`\n\tXXX_unrecognized []byte             `json:\"-\"`\n}\n\nfunc (m *Communique) Reset()         { *m = Communique{} }\nfunc (m *Communique) String() string { return proto.CompactTextString(m) }\nfunc (*Communique) ProtoMessage()    {}\n\ntype isCommunique_Union interface {\n\tisCommunique_Union()\n}\n\ntype Communique_Number struct {\n\tNumber int32 `protobuf:\"varint,5,opt,name=number,oneof\"`\n}\ntype Communique_Name struct {\n\tName string `protobuf:\"bytes,6,opt,name=name,oneof\"`\n}\ntype Communique_Data struct {\n\tData []byte `protobuf:\"bytes,7,opt,name=data,oneof\"`\n}\ntype Communique_TempC struct {\n\tTempC float64 `protobuf:\"fixed64,8,opt,name=temp_c,json=tempC,oneof\"`\n}\ntype Communique_Height struct {\n\tHeight float32 `protobuf:\"fixed32,9,opt,name=height,oneof\"`\n}\ntype Communique_Today struct {\n\tToday Days `protobuf:\"varint,10,opt,name=today,enum=my.test.Days,oneof\"`\n}\ntype Communique_Maybe struct {\n\tMaybe bool `protobuf:\"varint,11,opt,name=maybe,oneof\"`\n}\ntype Communique_Delta_ struct {\n\tDelta int32 `protobuf:\"zigzag32,12,opt,name=delta,oneof\"`\n}\ntype Communique_Msg struct {\n\tMsg *Reply `protobuf:\"bytes,13,opt,name=msg,oneof\"`\n}\ntype Communique_Somegroup struct {\n\tSomegroup *Communique_SomeGroup `protobuf:\"group,14,opt,name=SomeGroup,json=somegroup,oneof\"`\n}\n\nfunc (*Communique_Number) isCommunique_Union()    {}\nfunc (*Communique_Name) isCommunique_Union()      {}\nfunc (*Communique_Data) isCommunique_Union()      {}\nfunc (*Communique_TempC) isCommunique_Union()     {}\nfunc (*Communique_Height) isCommunique_Union()    {}\nfunc (*Communique_Today) isCommunique_Union()     {}\nfunc (*Communique_Maybe) isCommunique_Union()     {}\nfunc (*Communique_Delta_) isCommunique_Union()    {}\nfunc (*Communique_Msg) isCommunique_Union()       {}\nfunc (*Communique_Somegroup) isCommunique_Union() {}\n\nfunc (m *Communique) GetUnion() isCommunique_Union {\n\tif m != nil {\n\t\treturn m.Union\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetMakeMeCry() bool {\n\tif m != nil && m.MakeMeCry != nil {\n\t\treturn *m.MakeMeCry\n\t}\n\treturn false\n}\n\nfunc (m *Communique) GetNumber() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Number); ok {\n\t\treturn x.Number\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetName() string {\n\tif x, ok := m.GetUnion().(*Communique_Name); ok {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (m *Communique) GetData() []byte {\n\tif x, ok := m.GetUnion().(*Communique_Data); ok {\n\t\treturn x.Data\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetTempC() float64 {\n\tif x, ok := m.GetUnion().(*Communique_TempC); ok {\n\t\treturn x.TempC\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetHeight() float32 {\n\tif x, ok := m.GetUnion().(*Communique_Height); ok {\n\t\treturn x.Height\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetToday() Days {\n\tif x, ok := m.GetUnion().(*Communique_Today); ok {\n\t\treturn x.Today\n\t}\n\treturn Days_MONDAY\n}\n\nfunc (m *Communique) GetMaybe() bool {\n\tif x, ok := m.GetUnion().(*Communique_Maybe); ok {\n\t\treturn x.Maybe\n\t}\n\treturn false\n}\n\nfunc (m *Communique) GetDelta() int32 {\n\tif x, ok := m.GetUnion().(*Communique_Delta_); ok {\n\t\treturn x.Delta\n\t}\n\treturn 0\n}\n\nfunc (m *Communique) GetMsg() *Reply {\n\tif x, ok := m.GetUnion().(*Communique_Msg); ok {\n\t\treturn x.Msg\n\t}\n\treturn nil\n}\n\nfunc (m *Communique) GetSomegroup() *Communique_SomeGroup {\n\tif x, ok := m.GetUnion().(*Communique_Somegroup); ok {\n\t\treturn x.Somegroup\n\t}\n\treturn nil\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{\n\t\t(*Communique_Number)(nil),\n\t\t(*Communique_Name)(nil),\n\t\t(*Communique_Data)(nil),\n\t\t(*Communique_TempC)(nil),\n\t\t(*Communique_Height)(nil),\n\t\t(*Communique_Today)(nil),\n\t\t(*Communique_Maybe)(nil),\n\t\t(*Communique_Delta_)(nil),\n\t\t(*Communique_Msg)(nil),\n\t\t(*Communique_Somegroup)(nil),\n\t}\n}\n\nfunc _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tb.EncodeVarint(5<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tb.EncodeVarint(6<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.Name)\n\tcase *Communique_Data:\n\t\tb.EncodeVarint(7<<3 | proto.WireBytes)\n\t\tb.EncodeRawBytes(x.Data)\n\tcase *Communique_TempC:\n\t\tb.EncodeVarint(8<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.TempC))\n\tcase *Communique_Height:\n\t\tb.EncodeVarint(9<<3 | proto.WireFixed32)\n\t\tb.EncodeFixed32(uint64(math.Float32bits(x.Height)))\n\tcase *Communique_Today:\n\t\tb.EncodeVarint(10<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.Today))\n\tcase *Communique_Maybe:\n\t\tt := uint64(0)\n\t\tif x.Maybe {\n\t\t\tt = 1\n\t\t}\n\t\tb.EncodeVarint(11<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(t)\n\tcase *Communique_Delta_:\n\t\tb.EncodeVarint(12<<3 | proto.WireVarint)\n\t\tb.EncodeZigzag32(uint64(x.Delta))\n\tcase *Communique_Msg:\n\t\tb.EncodeVarint(13<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.Msg); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *Communique_Somegroup:\n\t\tb.EncodeVarint(14<<3 | proto.WireStartGroup)\n\t\tif err := b.Marshal(x.Somegroup); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb.EncodeVarint(14<<3 | proto.WireEndGroup)\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Communique.Union has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*Communique)\n\tswitch tag {\n\tcase 5: // union.number\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Number{int32(x)}\n\t\treturn true, err\n\tcase 6: // union.name\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Union = &Communique_Name{x}\n\t\treturn true, err\n\tcase 7: // union.data\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeRawBytes(true)\n\t\tm.Union = &Communique_Data{x}\n\t\treturn true, err\n\tcase 8: // union.temp_c\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Union = &Communique_TempC{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 9: // union.height\n\t\tif wire != proto.WireFixed32 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed32()\n\t\tm.Union = &Communique_Height{math.Float32frombits(uint32(x))}\n\t\treturn true, err\n\tcase 10: // union.today\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Today{Days(x)}\n\t\treturn true, err\n\tcase 11: // union.maybe\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Union = &Communique_Maybe{x != 0}\n\t\treturn true, err\n\tcase 12: // union.delta\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeZigzag32()\n\t\tm.Union = &Communique_Delta_{int32(x)}\n\t\treturn true, err\n\tcase 13: // union.msg\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Reply)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Union = &Communique_Msg{msg}\n\t\treturn true, err\n\tcase 14: // union.somegroup\n\t\tif wire != proto.WireStartGroup {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Communique_SomeGroup)\n\t\terr := b.DecodeGroup(msg)\n\t\tm.Union = &Communique_Somegroup{msg}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _Communique_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*Communique)\n\t// union\n\tswitch x := m.Union.(type) {\n\tcase *Communique_Number:\n\t\tn += proto.SizeVarint(5<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Number))\n\tcase *Communique_Name:\n\t\tn += proto.SizeVarint(6<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Name)))\n\t\tn += len(x.Name)\n\tcase *Communique_Data:\n\t\tn += proto.SizeVarint(7<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.Data)))\n\t\tn += len(x.Data)\n\tcase *Communique_TempC:\n\t\tn += proto.SizeVarint(8<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Communique_Height:\n\t\tn += proto.SizeVarint(9<<3 | proto.WireFixed32)\n\t\tn += 4\n\tcase *Communique_Today:\n\t\tn += proto.SizeVarint(10<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.Today))\n\tcase *Communique_Maybe:\n\t\tn += proto.SizeVarint(11<<3 | proto.WireVarint)\n\t\tn += 1\n\tcase *Communique_Delta_:\n\t\tn += proto.SizeVarint(12<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31))))\n\tcase *Communique_Msg:\n\t\ts := proto.Size(x.Msg)\n\t\tn += proto.SizeVarint(13<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase *Communique_Somegroup:\n\t\tn += proto.SizeVarint(14<<3 | proto.WireStartGroup)\n\t\tn += proto.Size(x.Somegroup)\n\t\tn += proto.SizeVarint(14<<3 | proto.WireEndGroup)\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\ntype Communique_SomeGroup struct {\n\tMember           *string `protobuf:\"bytes,15,opt,name=member\" json:\"member,omitempty\"`\n\tXXX_unrecognized []byte  `json:\"-\"`\n}\n\nfunc (m *Communique_SomeGroup) Reset()         { *m = Communique_SomeGroup{} }\nfunc (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }\nfunc (*Communique_SomeGroup) ProtoMessage()    {}\n\nfunc (m *Communique_SomeGroup) GetMember() string {\n\tif m != nil && m.Member != nil {\n\t\treturn *m.Member\n\t}\n\treturn \"\"\n}\n\ntype Communique_Delta struct {\n\tXXX_unrecognized []byte `json:\"-\"`\n}\n\nfunc (m *Communique_Delta) Reset()         { *m = Communique_Delta{} }\nfunc (m *Communique_Delta) String() string { return proto.CompactTextString(m) }\nfunc (*Communique_Delta) ProtoMessage()    {}\n\nvar E_Tag = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*string)(nil),\n\tField:         103,\n\tName:          \"my.test.tag\",\n\tTag:           \"bytes,103,opt,name=tag\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nvar E_Donut = &proto.ExtensionDesc{\n\tExtendedType:  (*Reply)(nil),\n\tExtensionType: (*OtherReplyExtensions)(nil),\n\tField:         106,\n\tName:          \"my.test.donut\",\n\tTag:           \"bytes,106,opt,name=donut\",\n\tFilename:      \"my_test/test.proto\",\n}\n\nfunc init() {\n\tproto.RegisterType((*Request)(nil), \"my.test.Request\")\n\tproto.RegisterType((*Request_SomeGroup)(nil), \"my.test.Request.SomeGroup\")\n\tproto.RegisterType((*Reply)(nil), \"my.test.Reply\")\n\tproto.RegisterType((*Reply_Entry)(nil), \"my.test.Reply.Entry\")\n\tproto.RegisterType((*OtherBase)(nil), \"my.test.OtherBase\")\n\tproto.RegisterType((*ReplyExtensions)(nil), \"my.test.ReplyExtensions\")\n\tproto.RegisterType((*OtherReplyExtensions)(nil), \"my.test.OtherReplyExtensions\")\n\tproto.RegisterType((*OldReply)(nil), \"my.test.OldReply\")\n\tproto.RegisterType((*Communique)(nil), \"my.test.Communique\")\n\tproto.RegisterType((*Communique_SomeGroup)(nil), \"my.test.Communique.SomeGroup\")\n\tproto.RegisterType((*Communique_Delta)(nil), \"my.test.Communique.Delta\")\n\tproto.RegisterEnum(\"my.test.HatType\", HatType_name, HatType_value)\n\tproto.RegisterEnum(\"my.test.Days\", Days_name, Days_value)\n\tproto.RegisterEnum(\"my.test.Request_Color\", Request_Color_name, Request_Color_value)\n\tproto.RegisterEnum(\"my.test.Reply_Entry_Game\", Reply_Entry_Game_name, Reply_Entry_Game_value)\n\tproto.RegisterExtension(E_ReplyExtensions_Time)\n\tproto.RegisterExtension(E_ReplyExtensions_Carrot)\n\tproto.RegisterExtension(E_ReplyExtensions_Donut)\n\tproto.RegisterExtension(E_Tag)\n\tproto.RegisterExtension(E_Donut)\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto2\";\n\n// This package holds interesting messages.\npackage my.test;  // dotted package name\n\n//import \"imp.proto\";\nimport \"multi/multi1.proto\";  // unused import\n\nenum HatType {\n  // deliberately skipping 0\n  FEDORA = 1;\n  FEZ = 2;\n}\n\n// This enum represents days of the week.\nenum Days {\n  option allow_alias = true;\n\n  MONDAY = 1;\n  TUESDAY = 2;\n  LUNDI = 1;  // same value as MONDAY\n}\n\n// This is a message that might be sent somewhere.\nmessage Request {\n  enum Color {\n    RED = 0;\n    GREEN = 1;\n    BLUE = 2;\n  }\n  repeated int64 key = 1;\n//  optional imp.ImportedMessage imported_message = 2;\n  optional Color hue = 3; // no default\n  optional HatType hat = 4 [default=FEDORA];\n//  optional imp.ImportedMessage.Owner owner = 6;\n  optional float deadline = 7 [default=inf];\n  optional group SomeGroup = 8 {\n    optional int32 group_field = 9;\n  }\n\n  // These foreign types are in imp2.proto,\n  // which is publicly imported by imp.proto.\n//  optional imp.PubliclyImportedMessage pub = 10;\n//  optional imp.PubliclyImportedEnum pub_enum = 13 [default=HAIR];\n\n\n  // This is a map field. It will generate map[int32]string.\n  map<int32, string> name_mapping = 14;\n  // This is a map field whose value type is a message.\n  map<sint64, Reply> msg_mapping = 15;\n\n  optional int32 reset = 12;\n  // This field should not conflict with any getters.\n  optional string get_key = 16;\n}\n\nmessage Reply {\n  message Entry {\n    required int64 key_that_needs_1234camel_CasIng = 1;\n    optional int64 value = 2 [default=7];\n    optional int64 _my_field_name_2 = 3;\n    enum Game {\n      FOOTBALL = 1;\n      TENNIS = 2;\n    }\n  }\n  repeated Entry found = 1;\n  repeated int32 compact_keys = 2 [packed=true];\n  extensions 100 to max;\n}\n\nmessage OtherBase {\n  optional string name = 1;\n  extensions 100 to max;\n}\n\nmessage ReplyExtensions {\n  extend Reply {\n    optional double time = 101;\n    optional ReplyExtensions carrot = 105;\n  }\n  extend OtherBase {\n    optional ReplyExtensions donut = 101;\n  }\n}\n\nmessage OtherReplyExtensions {\n  optional int32 key = 1;\n}\n\n// top-level extension\nextend Reply {\n  optional string tag = 103;\n  optional OtherReplyExtensions donut = 106;\n//  optional imp.ImportedMessage elephant = 107;  // extend with message from another file.\n}\n\nmessage OldReply {\n  // Extensions will be encoded in MessageSet wire format.\n  option message_set_wire_format = true;\n  extensions 100 to max;\n}\n\nmessage Communique {\n  optional bool make_me_cry = 1;\n\n  // This is a oneof, called \"union\".\n  oneof union {\n    int32 number = 5;\n    string name = 6;\n    bytes data = 7;\n    double temp_c = 8;\n    float height = 9;\n    Days today = 10;\n    bool maybe = 11;\n    sint32 delta = 12;  // name will conflict with Delta below\n    Reply msg = 13;\n    group SomeGroup = 14 {\n      optional string member = 15;\n    }\n  }\n\n  message Delta {}\n}\n\n"
  },
  {
    "path": "src/github.com/golang/protobuf/protoc-gen-go/testdata/proto3.proto",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2014 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage proto3;\n\nmessage Request {\n  enum Flavour {\n    SWEET = 0;\n    SOUR = 1;\n    UMAMI = 2;\n    GOPHERLICIOUS = 3;\n  }\n  string name = 1;\n  repeated int64 key = 2;\n  Flavour taste = 3;\n  Book book = 4;\n  repeated int64 unpacked = 5 [packed=false];\n}\n\nmessage Book {\n  string title = 1;\n  bytes raw_data = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/any/any.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/any.proto\n\n/*\nPackage any is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/any.proto\n\nIt has these top-level messages:\n\tAny\n*/\npackage any\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// `Any` contains an arbitrary serialized protocol buffer message along with a\n// URL that describes the type of the serialized message.\n//\n// Protobuf library provides support to pack/unpack Any values in the form\n// of utility functions or additional generated methods of the Any type.\n//\n// Example 1: Pack and unpack a message in C++.\n//\n//     Foo foo = ...;\n//     Any any;\n//     any.PackFrom(foo);\n//     ...\n//     if (any.UnpackTo(&foo)) {\n//       ...\n//     }\n//\n// Example 2: Pack and unpack a message in Java.\n//\n//     Foo foo = ...;\n//     Any any = Any.pack(foo);\n//     ...\n//     if (any.is(Foo.class)) {\n//       foo = any.unpack(Foo.class);\n//     }\n//\n// Example 3: Pack and unpack a message in Python.\n//\n//     foo = Foo(...)\n//     any = Any()\n//     any.Pack(foo)\n//     ...\n//     if any.Is(Foo.DESCRIPTOR):\n//       any.Unpack(foo)\n//       ...\n//\n// Example 4: Pack and unpack a message in Go\n//\n//      foo := &pb.Foo{...}\n//      any, err := ptypes.MarshalAny(foo)\n//      ...\n//      foo := &pb.Foo{}\n//      if err := ptypes.UnmarshalAny(any, foo); err != nil {\n//        ...\n//      }\n//\n// The pack methods provided by protobuf library will by default use\n// 'type.googleapis.com/full.type.name' as the type URL and the unpack\n// methods only use the fully qualified type name after the last '/'\n// in the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n// name \"y.z\".\n//\n//\n// JSON\n//\n// The JSON representation of an `Any` value uses the regular\n// representation of the deserialized, embedded message, with an\n// additional field `@type` which contains the type URL. Example:\n//\n//     package google.profile;\n//     message Person {\n//       string first_name = 1;\n//       string last_name = 2;\n//     }\n//\n//     {\n//       \"@type\": \"type.googleapis.com/google.profile.Person\",\n//       \"firstName\": <string>,\n//       \"lastName\": <string>\n//     }\n//\n// If the embedded message type is well-known and has a custom JSON\n// representation, that representation will be embedded adding a field\n// `value` which holds the custom JSON in addition to the `@type`\n// field. Example (for message [google.protobuf.Duration][]):\n//\n//     {\n//       \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n//       \"value\": \"1.212s\"\n//     }\n//\ntype Any struct {\n\t// A URL/resource name whose content describes the type of the\n\t// serialized protocol buffer message.\n\t//\n\t// For URLs which use the scheme `http`, `https`, or no scheme, the\n\t// following restrictions and interpretations apply:\n\t//\n\t// * If no scheme is provided, `https` is assumed.\n\t// * The last segment of the URL's path must represent the fully\n\t//   qualified name of the type (as in `path/google.protobuf.Duration`).\n\t//   The name should be in a canonical form (e.g., leading \".\" is\n\t//   not accepted).\n\t// * An HTTP GET on the URL must yield a [google.protobuf.Type][]\n\t//   value in binary format, or produce an error.\n\t// * Applications are allowed to cache lookup results based on the\n\t//   URL, or have them precompiled into a binary to avoid any\n\t//   lookup. Therefore, binary compatibility needs to be preserved\n\t//   on changes to types. (Use versioned type names to manage\n\t//   breaking changes.)\n\t//\n\t// Schemes other than `http`, `https` (or the empty scheme) might be\n\t// used with implementation specific semantics.\n\t//\n\tTypeUrl string `protobuf:\"bytes,1,opt,name=type_url,json=typeUrl\" json:\"type_url,omitempty\"`\n\t// Must be a valid serialized protocol buffer of the above specified type.\n\tValue []byte `protobuf:\"bytes,2,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\nfunc (m *Any) Reset()                    { *m = Any{} }\nfunc (m *Any) String() string            { return proto.CompactTextString(m) }\nfunc (*Any) ProtoMessage()               {}\nfunc (*Any) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*Any) XXX_WellKnownType() string   { return \"Any\" }\n\nfunc (m *Any) GetTypeUrl() string {\n\tif m != nil {\n\t\treturn m.TypeUrl\n\t}\n\treturn \"\"\n}\n\nfunc (m *Any) GetValue() []byte {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterType((*Any)(nil), \"google.protobuf.Any\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/any.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 185 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,\n\t0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,\n\t0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a,\n\t0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46,\n\t0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7,\n\t0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xca, 0xe7, 0x12, 0x4e, 0xce,\n\t0xcf, 0xd5, 0x43, 0x33, 0xce, 0x89, 0xc3, 0x31, 0xaf, 0x32, 0x00, 0xc4, 0x09, 0x60, 0x8c, 0x52,\n\t0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc,\n\t0x4b, 0x47, 0xb8, 0xa8, 0x00, 0x64, 0x7a, 0x31, 0xc8, 0x61, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c,\n\t0x56, 0x31, 0xc9, 0xb9, 0x43, 0x8c, 0x0a, 0x80, 0x2a, 0xd1, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce,\n\t0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0x29, 0x4d, 0x62, 0x03, 0xeb, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff,\n\t0xff, 0x13, 0xf8, 0xe8, 0x42, 0xdd, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/any/any.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption go_package = \"github.com/golang/protobuf/ptypes/any\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"AnyProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\n\n// `Any` contains an arbitrary serialized protocol buffer message along with a\n// URL that describes the type of the serialized message.\n//\n// Protobuf library provides support to pack/unpack Any values in the form\n// of utility functions or additional generated methods of the Any type.\n//\n// Example 1: Pack and unpack a message in C++.\n//\n//     Foo foo = ...;\n//     Any any;\n//     any.PackFrom(foo);\n//     ...\n//     if (any.UnpackTo(&foo)) {\n//       ...\n//     }\n//\n// Example 2: Pack and unpack a message in Java.\n//\n//     Foo foo = ...;\n//     Any any = Any.pack(foo);\n//     ...\n//     if (any.is(Foo.class)) {\n//       foo = any.unpack(Foo.class);\n//     }\n//\n// Example 3: Pack and unpack a message in Python.\n//\n//     foo = Foo(...)\n//     any = Any()\n//     any.Pack(foo)\n//     ...\n//     if any.Is(Foo.DESCRIPTOR):\n//       any.Unpack(foo)\n//       ...\n//\n// Example 4: Pack and unpack a message in Go\n//\n//      foo := &pb.Foo{...}\n//      any, err := ptypes.MarshalAny(foo)\n//      ...\n//      foo := &pb.Foo{}\n//      if err := ptypes.UnmarshalAny(any, foo); err != nil {\n//        ...\n//      }\n//\n// The pack methods provided by protobuf library will by default use\n// 'type.googleapis.com/full.type.name' as the type URL and the unpack\n// methods only use the fully qualified type name after the last '/'\n// in the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n// name \"y.z\".\n//\n//\n// JSON\n//\n// The JSON representation of an `Any` value uses the regular\n// representation of the deserialized, embedded message, with an\n// additional field `@type` which contains the type URL. Example:\n//\n//     package google.profile;\n//     message Person {\n//       string first_name = 1;\n//       string last_name = 2;\n//     }\n//\n//     {\n//       \"@type\": \"type.googleapis.com/google.profile.Person\",\n//       \"firstName\": <string>,\n//       \"lastName\": <string>\n//     }\n//\n// If the embedded message type is well-known and has a custom JSON\n// representation, that representation will be embedded adding a field\n// `value` which holds the custom JSON in addition to the `@type`\n// field. Example (for message [google.protobuf.Duration][]):\n//\n//     {\n//       \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n//       \"value\": \"1.212s\"\n//     }\n//\nmessage Any {\n  // A URL/resource name whose content describes the type of the\n  // serialized protocol buffer message.\n  //\n  // For URLs which use the scheme `http`, `https`, or no scheme, the\n  // following restrictions and interpretations apply:\n  //\n  // * If no scheme is provided, `https` is assumed.\n  // * The last segment of the URL's path must represent the fully\n  //   qualified name of the type (as in `path/google.protobuf.Duration`).\n  //   The name should be in a canonical form (e.g., leading \".\" is\n  //   not accepted).\n  // * An HTTP GET on the URL must yield a [google.protobuf.Type][]\n  //   value in binary format, or produce an error.\n  // * Applications are allowed to cache lookup results based on the\n  //   URL, or have them precompiled into a binary to avoid any\n  //   lookup. Therefore, binary compatibility needs to be preserved\n  //   on changes to types. (Use versioned type names to manage\n  //   breaking changes.)\n  //\n  // Schemes other than `http`, `https` (or the empty scheme) might be\n  // used with implementation specific semantics.\n  //\n  string type_url = 1;\n\n  // Must be a valid serialized protocol buffer of the above specified type.\n  bytes value = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/any.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\n// This file implements functions to marshal proto.Message to/from\n// google.protobuf.Any message.\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/golang/protobuf/ptypes/any\"\n)\n\nconst googleApis = \"type.googleapis.com/\"\n\n// AnyMessageName returns the name of the message contained in a google.protobuf.Any message.\n//\n// Note that regular type assertions should be done using the Is\n// function. AnyMessageName is provided for less common use cases like filtering a\n// sequence of Any messages based on a set of allowed message type names.\nfunc AnyMessageName(any *any.Any) (string, error) {\n\tif any == nil {\n\t\treturn \"\", fmt.Errorf(\"message is nil\")\n\t}\n\tslash := strings.LastIndex(any.TypeUrl, \"/\")\n\tif slash < 0 {\n\t\treturn \"\", fmt.Errorf(\"message type url %q is invalid\", any.TypeUrl)\n\t}\n\treturn any.TypeUrl[slash+1:], nil\n}\n\n// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any.\nfunc MarshalAny(pb proto.Message) (*any.Any, error) {\n\tvalue, err := proto.Marshal(pb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &any.Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil\n}\n\n// DynamicAny is a value that can be passed to UnmarshalAny to automatically\n// allocate a proto.Message for the type specified in a google.protobuf.Any\n// message. The allocated message is stored in the embedded proto.Message.\n//\n// Example:\n//\n//   var x ptypes.DynamicAny\n//   if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }\n//   fmt.Printf(\"unmarshaled message: %v\", x.Message)\ntype DynamicAny struct {\n\tproto.Message\n}\n\n// Empty returns a new proto.Message of the type specified in a\n// google.protobuf.Any message. It returns an error if corresponding message\n// type isn't linked in.\nfunc Empty(any *any.Any) (proto.Message, error) {\n\taname, err := AnyMessageName(any)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := proto.MessageType(aname)\n\tif t == nil {\n\t\treturn nil, fmt.Errorf(\"any: message type %q isn't linked in\", aname)\n\t}\n\treturn reflect.New(t.Elem()).Interface().(proto.Message), nil\n}\n\n// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any\n// message and places the decoded result in pb. It returns an error if type of\n// contents of Any message does not match type of pb message.\n//\n// pb can be a proto.Message, or a *DynamicAny.\nfunc UnmarshalAny(any *any.Any, pb proto.Message) error {\n\tif d, ok := pb.(*DynamicAny); ok {\n\t\tif d.Message == nil {\n\t\t\tvar err error\n\t\t\td.Message, err = Empty(any)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn UnmarshalAny(any, d.Message)\n\t}\n\n\taname, err := AnyMessageName(any)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmname := proto.MessageName(pb)\n\tif aname != mname {\n\t\treturn fmt.Errorf(\"mismatched message type: got %q want %q\", aname, mname)\n\t}\n\treturn proto.Unmarshal(any.Value, pb)\n}\n\n// Is returns true if any value contains a given message type.\nfunc Is(any *any.Any, pb proto.Message) bool {\n\taname, err := AnyMessageName(any)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn aname == proto.MessageName(pb)\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/any_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\nimport (\n\t\"testing\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tpb \"github.com/golang/protobuf/protoc-gen-go/descriptor\"\n\t\"github.com/golang/protobuf/ptypes/any\"\n)\n\nfunc TestMarshalUnmarshal(t *testing.T) {\n\torig := &any.Any{Value: []byte(\"test\")}\n\n\tpacked, err := MarshalAny(orig)\n\tif err != nil {\n\t\tt.Errorf(\"MarshalAny(%+v): got: _, %v exp: _, nil\", orig, err)\n\t}\n\n\tunpacked := &any.Any{}\n\terr = UnmarshalAny(packed, unpacked)\n\tif err != nil || !proto.Equal(unpacked, orig) {\n\t\tt.Errorf(\"got: %v, %+v; want nil, %+v\", err, unpacked, orig)\n\t}\n}\n\nfunc TestIs(t *testing.T) {\n\ta, err := MarshalAny(&pb.FileDescriptorProto{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif Is(a, &pb.DescriptorProto{}) {\n\t\tt.Error(\"FileDescriptorProto is not a DescriptorProto, but Is says it is\")\n\t}\n\tif !Is(a, &pb.FileDescriptorProto{}) {\n\t\tt.Error(\"FileDescriptorProto is indeed a FileDescriptorProto, but Is says it is not\")\n\t}\n}\n\nfunc TestIsDifferentUrlPrefixes(t *testing.T) {\n\tm := &pb.FileDescriptorProto{}\n\ta := &any.Any{TypeUrl: \"foo/bar/\" + proto.MessageName(m)}\n\tif !Is(a, m) {\n\t\tt.Errorf(\"message with type url %q didn't satisfy Is for type %q\", a.TypeUrl, proto.MessageName(m))\n\t}\n}\n\nfunc TestUnmarshalDynamic(t *testing.T) {\n\twant := &pb.FileDescriptorProto{Name: proto.String(\"foo\")}\n\ta, err := MarshalAny(want)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvar got DynamicAny\n\tif err := UnmarshalAny(a, &got); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(got.Message, want) {\n\t\tt.Errorf(\"invalid result from UnmarshalAny, got %q want %q\", got.Message, want)\n\t}\n}\n\nfunc TestEmpty(t *testing.T) {\n\twant := &pb.FileDescriptorProto{}\n\ta, err := MarshalAny(want)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tgot, err := Empty(a)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !proto.Equal(got, want) {\n\t\tt.Errorf(\"unequal empty message, got %q, want %q\", got, want)\n\t}\n\n\t// that's a valid type_url for a message which shouldn't be linked into this\n\t// test binary. We want an error.\n\ta.TypeUrl = \"type.googleapis.com/google.protobuf.FieldMask\"\n\tif _, err := Empty(a); err == nil {\n\t\tt.Errorf(\"got no error for an attempt to create a message of type %q, which shouldn't be linked in\", a.TypeUrl)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/doc.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/*\nPackage ptypes contains code for interacting with well-known types.\n*/\npackage ptypes\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/duration/duration.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/duration.proto\n\n/*\nPackage duration is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/duration.proto\n\nIt has these top-level messages:\n\tDuration\n*/\npackage duration\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// A Duration represents a signed, fixed-length span of time represented\n// as a count of seconds and fractions of seconds at nanosecond\n// resolution. It is independent of any calendar and concepts like \"day\"\n// or \"month\". It is related to Timestamp in that the difference between\n// two Timestamp values is a Duration and it can be added or subtracted\n// from a Timestamp. Range is approximately +-10,000 years.\n//\n// # Examples\n//\n// Example 1: Compute Duration from two Timestamps in pseudo code.\n//\n//     Timestamp start = ...;\n//     Timestamp end = ...;\n//     Duration duration = ...;\n//\n//     duration.seconds = end.seconds - start.seconds;\n//     duration.nanos = end.nanos - start.nanos;\n//\n//     if (duration.seconds < 0 && duration.nanos > 0) {\n//       duration.seconds += 1;\n//       duration.nanos -= 1000000000;\n//     } else if (durations.seconds > 0 && duration.nanos < 0) {\n//       duration.seconds -= 1;\n//       duration.nanos += 1000000000;\n//     }\n//\n// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n//\n//     Timestamp start = ...;\n//     Duration duration = ...;\n//     Timestamp end = ...;\n//\n//     end.seconds = start.seconds + duration.seconds;\n//     end.nanos = start.nanos + duration.nanos;\n//\n//     if (end.nanos < 0) {\n//       end.seconds -= 1;\n//       end.nanos += 1000000000;\n//     } else if (end.nanos >= 1000000000) {\n//       end.seconds += 1;\n//       end.nanos -= 1000000000;\n//     }\n//\n// Example 3: Compute Duration from datetime.timedelta in Python.\n//\n//     td = datetime.timedelta(days=3, minutes=10)\n//     duration = Duration()\n//     duration.FromTimedelta(td)\n//\n// # JSON Mapping\n//\n// In JSON format, the Duration type is encoded as a string rather than an\n// object, where the string ends in the suffix \"s\" (indicating seconds) and\n// is preceded by the number of seconds, with nanoseconds expressed as\n// fractional seconds. For example, 3 seconds with 0 nanoseconds should be\n// encoded in JSON format as \"3s\", while 3 seconds and 1 nanosecond should\n// be expressed in JSON format as \"3.000000001s\", and 3 seconds and 1\n// microsecond should be expressed in JSON format as \"3.000001s\".\n//\n//\ntype Duration struct {\n\t// Signed seconds of the span of time. Must be from -315,576,000,000\n\t// to +315,576,000,000 inclusive. Note: these bounds are computed from:\n\t// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n\tSeconds int64 `protobuf:\"varint,1,opt,name=seconds\" json:\"seconds,omitempty\"`\n\t// Signed fractions of a second at nanosecond resolution of the span\n\t// of time. Durations less than one second are represented with a 0\n\t// `seconds` field and a positive or negative `nanos` field. For durations\n\t// of one second or more, a non-zero value for the `nanos` field must be\n\t// of the same sign as the `seconds` field. Must be from -999,999,999\n\t// to +999,999,999 inclusive.\n\tNanos int32 `protobuf:\"varint,2,opt,name=nanos\" json:\"nanos,omitempty\"`\n}\n\nfunc (m *Duration) Reset()                    { *m = Duration{} }\nfunc (m *Duration) String() string            { return proto.CompactTextString(m) }\nfunc (*Duration) ProtoMessage()               {}\nfunc (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*Duration) XXX_WellKnownType() string   { return \"Duration\" }\n\nfunc (m *Duration) GetSeconds() int64 {\n\tif m != nil {\n\t\treturn m.Seconds\n\t}\n\treturn 0\n}\n\nfunc (m *Duration) GetNanos() int32 {\n\tif m != nil {\n\t\treturn m.Nanos\n\t}\n\treturn 0\n}\n\nfunc init() {\n\tproto.RegisterType((*Duration)(nil), \"google.protobuf.Duration\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/duration.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 190 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,\n\t0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,\n\t0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56,\n\t0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5,\n\t0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e,\n\t0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0xc3, 0x25, 0x9c, 0x9c,\n\t0x9f, 0xab, 0x87, 0x66, 0xa4, 0x13, 0x2f, 0xcc, 0xc0, 0x00, 0x90, 0x48, 0x00, 0x63, 0x94, 0x56,\n\t0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e,\n\t0x3a, 0xc2, 0x7d, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x70, 0x67, 0xfe, 0x60, 0x64, 0x5c, 0xc4,\n\t0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, 0x00, 0x54, 0xa9, 0x5e, 0x78,\n\t0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, 0x12, 0x1b, 0xd8, 0x0c, 0x63,\n\t0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x30, 0xff, 0xf3, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/duration/duration.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption cc_enable_arenas = true;\noption go_package = \"github.com/golang/protobuf/ptypes/duration\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"DurationProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\n\n// A Duration represents a signed, fixed-length span of time represented\n// as a count of seconds and fractions of seconds at nanosecond\n// resolution. It is independent of any calendar and concepts like \"day\"\n// or \"month\". It is related to Timestamp in that the difference between\n// two Timestamp values is a Duration and it can be added or subtracted\n// from a Timestamp. Range is approximately +-10,000 years.\n//\n// # Examples\n//\n// Example 1: Compute Duration from two Timestamps in pseudo code.\n//\n//     Timestamp start = ...;\n//     Timestamp end = ...;\n//     Duration duration = ...;\n//\n//     duration.seconds = end.seconds - start.seconds;\n//     duration.nanos = end.nanos - start.nanos;\n//\n//     if (duration.seconds < 0 && duration.nanos > 0) {\n//       duration.seconds += 1;\n//       duration.nanos -= 1000000000;\n//     } else if (durations.seconds > 0 && duration.nanos < 0) {\n//       duration.seconds -= 1;\n//       duration.nanos += 1000000000;\n//     }\n//\n// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n//\n//     Timestamp start = ...;\n//     Duration duration = ...;\n//     Timestamp end = ...;\n//\n//     end.seconds = start.seconds + duration.seconds;\n//     end.nanos = start.nanos + duration.nanos;\n//\n//     if (end.nanos < 0) {\n//       end.seconds -= 1;\n//       end.nanos += 1000000000;\n//     } else if (end.nanos >= 1000000000) {\n//       end.seconds += 1;\n//       end.nanos -= 1000000000;\n//     }\n//\n// Example 3: Compute Duration from datetime.timedelta in Python.\n//\n//     td = datetime.timedelta(days=3, minutes=10)\n//     duration = Duration()\n//     duration.FromTimedelta(td)\n//\n// # JSON Mapping\n//\n// In JSON format, the Duration type is encoded as a string rather than an\n// object, where the string ends in the suffix \"s\" (indicating seconds) and\n// is preceded by the number of seconds, with nanoseconds expressed as\n// fractional seconds. For example, 3 seconds with 0 nanoseconds should be\n// encoded in JSON format as \"3s\", while 3 seconds and 1 nanosecond should\n// be expressed in JSON format as \"3.000000001s\", and 3 seconds and 1\n// microsecond should be expressed in JSON format as \"3.000001s\".\n//\n//\nmessage Duration {\n\n  // Signed seconds of the span of time. Must be from -315,576,000,000\n  // to +315,576,000,000 inclusive. Note: these bounds are computed from:\n  // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n  int64 seconds = 1;\n\n  // Signed fractions of a second at nanosecond resolution of the span\n  // of time. Durations less than one second are represented with a 0\n  // `seconds` field and a positive or negative `nanos` field. For durations\n  // of one second or more, a non-zero value for the `nanos` field must be\n  // of the same sign as the `seconds` field. Must be from -999,999,999\n  // to +999,999,999 inclusive.\n  int32 nanos = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/duration.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\n// This file implements conversions between google.protobuf.Duration\n// and time.Duration.\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\tdurpb \"github.com/golang/protobuf/ptypes/duration\"\n)\n\nconst (\n\t// Range of a durpb.Duration in seconds, as specified in\n\t// google/protobuf/duration.proto. This is about 10,000 years in seconds.\n\tmaxSeconds = int64(10000 * 365.25 * 24 * 60 * 60)\n\tminSeconds = -maxSeconds\n)\n\n// validateDuration determines whether the durpb.Duration is valid according to the\n// definition in google/protobuf/duration.proto. A valid durpb.Duration\n// may still be too large to fit into a time.Duration (the range of durpb.Duration\n// is about 10,000 years, and the range of time.Duration is about 290).\nfunc validateDuration(d *durpb.Duration) error {\n\tif d == nil {\n\t\treturn errors.New(\"duration: nil Duration\")\n\t}\n\tif d.Seconds < minSeconds || d.Seconds > maxSeconds {\n\t\treturn fmt.Errorf(\"duration: %v: seconds out of range\", d)\n\t}\n\tif d.Nanos <= -1e9 || d.Nanos >= 1e9 {\n\t\treturn fmt.Errorf(\"duration: %v: nanos out of range\", d)\n\t}\n\t// Seconds and Nanos must have the same sign, unless d.Nanos is zero.\n\tif (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) {\n\t\treturn fmt.Errorf(\"duration: %v: seconds and nanos have different signs\", d)\n\t}\n\treturn nil\n}\n\n// Duration converts a durpb.Duration to a time.Duration. Duration\n// returns an error if the durpb.Duration is invalid or is too large to be\n// represented in a time.Duration.\nfunc Duration(p *durpb.Duration) (time.Duration, error) {\n\tif err := validateDuration(p); err != nil {\n\t\treturn 0, err\n\t}\n\td := time.Duration(p.Seconds) * time.Second\n\tif int64(d/time.Second) != p.Seconds {\n\t\treturn 0, fmt.Errorf(\"duration: %v is out of range for time.Duration\", p)\n\t}\n\tif p.Nanos != 0 {\n\t\td += time.Duration(p.Nanos)\n\t\tif (d < 0) != (p.Nanos < 0) {\n\t\t\treturn 0, fmt.Errorf(\"duration: %v is out of range for time.Duration\", p)\n\t\t}\n\t}\n\treturn d, nil\n}\n\n// DurationProto converts a time.Duration to a durpb.Duration.\nfunc DurationProto(d time.Duration) *durpb.Duration {\n\tnanos := d.Nanoseconds()\n\tsecs := nanos / 1e9\n\tnanos -= secs * 1e9\n\treturn &durpb.Duration{\n\t\tSeconds: secs,\n\t\tNanos:   int32(nanos),\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/duration_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\nimport (\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\tdurpb \"github.com/golang/protobuf/ptypes/duration\"\n)\n\nconst (\n\tminGoSeconds = math.MinInt64 / int64(1e9)\n\tmaxGoSeconds = math.MaxInt64 / int64(1e9)\n)\n\nvar durationTests = []struct {\n\tproto   *durpb.Duration\n\tisValid bool\n\tinRange bool\n\tdur     time.Duration\n}{\n\t// The zero duration.\n\t{&durpb.Duration{Seconds: 0, Nanos: 0}, true, true, 0},\n\t// Some ordinary non-zero durations.\n\t{&durpb.Duration{Seconds: 100, Nanos: 0}, true, true, 100 * time.Second},\n\t{&durpb.Duration{Seconds: -100, Nanos: 0}, true, true, -100 * time.Second},\n\t{&durpb.Duration{Seconds: 100, Nanos: 987}, true, true, 100*time.Second + 987},\n\t{&durpb.Duration{Seconds: -100, Nanos: -987}, true, true, -(100*time.Second + 987)},\n\t// The largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},\n\t// The smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},\n\t{nil, false, false, 0},\n\t{&durpb.Duration{Seconds: -100, Nanos: 987}, false, false, 0},\n\t{&durpb.Duration{Seconds: 100, Nanos: -987}, false, false, 0},\n\t{&durpb.Duration{Seconds: math.MinInt64, Nanos: 0}, false, false, 0},\n\t{&durpb.Duration{Seconds: math.MaxInt64, Nanos: 0}, false, false, 0},\n\t// The largest valid duration.\n\t{&durpb.Duration{Seconds: maxSeconds, Nanos: 1e9 - 1}, true, false, 0},\n\t// The smallest valid duration.\n\t{&durpb.Duration{Seconds: minSeconds, Nanos: -(1e9 - 1)}, true, false, 0},\n\t// The smallest invalid duration above the valid range.\n\t{&durpb.Duration{Seconds: maxSeconds + 1, Nanos: 0}, false, false, 0},\n\t// The largest invalid duration below the valid range.\n\t{&durpb.Duration{Seconds: minSeconds - 1, Nanos: -(1e9 - 1)}, false, false, 0},\n\t// One nanosecond past the largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},\n\t// One nanosecond past the smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},\n\t// One second past the largest duration representable in Go.\n\t{&durpb.Duration{Seconds: maxGoSeconds + 1, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},\n\t// One second past the smallest duration representable in Go.\n\t{&durpb.Duration{Seconds: minGoSeconds - 1, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},\n}\n\nfunc TestValidateDuration(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\terr := validateDuration(test.proto)\n\t\tgotValid := (err == nil)\n\t\tif gotValid != test.isValid {\n\t\t\tt.Errorf(\"validateDuration(%v) = %t, want %t\", test.proto, gotValid, test.isValid)\n\t\t}\n\t}\n}\n\nfunc TestDuration(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\tgot, err := Duration(test.proto)\n\t\tgotOK := (err == nil)\n\t\twantOK := test.isValid && test.inRange\n\t\tif gotOK != wantOK {\n\t\t\tt.Errorf(\"Duration(%v) ok = %t, want %t\", test.proto, gotOK, wantOK)\n\t\t}\n\t\tif err == nil && got != test.dur {\n\t\t\tt.Errorf(\"Duration(%v) = %v, want %v\", test.proto, got, test.dur)\n\t\t}\n\t}\n}\n\nfunc TestDurationProto(t *testing.T) {\n\tfor _, test := range durationTests {\n\t\tif test.isValid && test.inRange {\n\t\t\tgot := DurationProto(test.dur)\n\t\t\tif !proto.Equal(got, test.proto) {\n\t\t\t\tt.Errorf(\"DurationProto(%v) = %v, want %v\", test.dur, got, test.proto)\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/empty/empty.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/empty.proto\n\n/*\nPackage empty is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/empty.proto\n\nIt has these top-level messages:\n\tEmpty\n*/\npackage empty\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// A generic empty message that you can re-use to avoid defining duplicated\n// empty messages in your APIs. A typical example is to use it as the request\n// or the response type of an API method. For instance:\n//\n//     service Foo {\n//       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n//     }\n//\n// The JSON representation for `Empty` is empty JSON object `{}`.\ntype Empty struct {\n}\n\nfunc (m *Empty) Reset()                    { *m = Empty{} }\nfunc (m *Empty) String() string            { return proto.CompactTextString(m) }\nfunc (*Empty) ProtoMessage()               {}\nfunc (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*Empty) XXX_WellKnownType() string   { return \"Empty\" }\n\nfunc init() {\n\tproto.RegisterType((*Empty)(nil), \"google.protobuf.Empty\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/empty.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 148 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f,\n\t0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28,\n\t0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57,\n\t0x90, 0xbc, 0x53, 0x19, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36,\n\t0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf,\n\t0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0x47, 0x58, 0x53, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x0c,\n\t0xb1, 0xed, 0x07, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10,\n\t0x13, 0x03, 0xa0, 0xea, 0xf4, 0xc2, 0x53, 0x73, 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40,\n\t0xea, 0x93, 0xd8, 0xc0, 0x06, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x64, 0xd4, 0xb3, 0xa6,\n\t0xb7, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/empty/empty.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption go_package = \"github.com/golang/protobuf/ptypes/empty\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"EmptyProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\noption cc_enable_arenas = true;\n\n// A generic empty message that you can re-use to avoid defining duplicated\n// empty messages in your APIs. A typical example is to use it as the request\n// or the response type of an API method. For instance:\n//\n//     service Foo {\n//       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n//     }\n//\n// The JSON representation for `Empty` is empty JSON object `{}`.\nmessage Empty {}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/regen.sh",
    "content": "#!/bin/bash -e\n#\n# This script fetches and rebuilds the \"well-known types\" protocol buffers.\n# To run this you will need protoc and goprotobuf installed;\n# see https://github.com/golang/protobuf for instructions.\n# You also need Go and Git installed.\n\nPKG=github.com/golang/protobuf/ptypes\nUPSTREAM=https://github.com/google/protobuf\nUPSTREAM_SUBDIR=src/google/protobuf\nPROTO_FILES=(any duration empty struct timestamp wrappers)\n\nfunction die() {\n  echo 1>&2 $*\n  exit 1\n}\n\n# Sanity check that the right tools are accessible.\nfor tool in go git protoc protoc-gen-go; do\n  q=$(which $tool) || die \"didn't find $tool\"\n  echo 1>&2 \"$tool: $q\"\ndone\n\ntmpdir=$(mktemp -d -t regen-wkt.XXXXXX)\ntrap 'rm -rf $tmpdir' EXIT\n\necho -n 1>&2 \"finding package dir... \"\npkgdir=$(go list -f '{{.Dir}}' $PKG)\necho 1>&2 $pkgdir\nbase=$(echo $pkgdir | sed \"s,/$PKG\\$,,\")\necho 1>&2 \"base: $base\"\ncd \"$base\"\n\necho 1>&2 \"fetching latest protos... \"\ngit clone -q $UPSTREAM $tmpdir\n\nfor file in ${PROTO_FILES[@]}; do\n  echo 1>&2 \"* $file\"\n  protoc --go_out=. -I$tmpdir/src $tmpdir/src/google/protobuf/$file.proto || die\n  cp $tmpdir/src/google/protobuf/$file.proto $PKG/$file\ndone\n\necho 1>&2 \"All OK\"\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/struct/struct.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/struct.proto\n\n/*\nPackage structpb is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/struct.proto\n\nIt has these top-level messages:\n\tStruct\n\tValue\n\tListValue\n*/\npackage structpb\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// `NullValue` is a singleton enumeration to represent the null value for the\n// `Value` type union.\n//\n//  The JSON representation for `NullValue` is JSON `null`.\ntype NullValue int32\n\nconst (\n\t// Null value.\n\tNullValue_NULL_VALUE NullValue = 0\n)\n\nvar NullValue_name = map[int32]string{\n\t0: \"NULL_VALUE\",\n}\nvar NullValue_value = map[string]int32{\n\t\"NULL_VALUE\": 0,\n}\n\nfunc (x NullValue) String() string {\n\treturn proto.EnumName(NullValue_name, int32(x))\n}\nfunc (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (NullValue) XXX_WellKnownType() string       { return \"NullValue\" }\n\n// `Struct` represents a structured data value, consisting of fields\n// which map to dynamically typed values. In some languages, `Struct`\n// might be supported by a native representation. For example, in\n// scripting languages like JS a struct is represented as an\n// object. The details of that representation are described together\n// with the proto support for the language.\n//\n// The JSON representation for `Struct` is JSON object.\ntype Struct struct {\n\t// Unordered map of dynamically typed values.\n\tFields map[string]*Value `protobuf:\"bytes,1,rep,name=fields\" json:\"fields,omitempty\" protobuf_key:\"bytes,1,opt,name=key\" protobuf_val:\"bytes,2,opt,name=value\"`\n}\n\nfunc (m *Struct) Reset()                    { *m = Struct{} }\nfunc (m *Struct) String() string            { return proto.CompactTextString(m) }\nfunc (*Struct) ProtoMessage()               {}\nfunc (*Struct) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*Struct) XXX_WellKnownType() string   { return \"Struct\" }\n\nfunc (m *Struct) GetFields() map[string]*Value {\n\tif m != nil {\n\t\treturn m.Fields\n\t}\n\treturn nil\n}\n\n// `Value` represents a dynamically typed value which can be either\n// null, a number, a string, a boolean, a recursive struct value, or a\n// list of values. A producer of value is expected to set one of that\n// variants, absence of any variant indicates an error.\n//\n// The JSON representation for `Value` is JSON value.\ntype Value struct {\n\t// The kind of value.\n\t//\n\t// Types that are valid to be assigned to Kind:\n\t//\t*Value_NullValue\n\t//\t*Value_NumberValue\n\t//\t*Value_StringValue\n\t//\t*Value_BoolValue\n\t//\t*Value_StructValue\n\t//\t*Value_ListValue\n\tKind isValue_Kind `protobuf_oneof:\"kind\"`\n}\n\nfunc (m *Value) Reset()                    { *m = Value{} }\nfunc (m *Value) String() string            { return proto.CompactTextString(m) }\nfunc (*Value) ProtoMessage()               {}\nfunc (*Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\nfunc (*Value) XXX_WellKnownType() string   { return \"Value\" }\n\ntype isValue_Kind interface {\n\tisValue_Kind()\n}\n\ntype Value_NullValue struct {\n\tNullValue NullValue `protobuf:\"varint,1,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof\"`\n}\ntype Value_NumberValue struct {\n\tNumberValue float64 `protobuf:\"fixed64,2,opt,name=number_value,json=numberValue,oneof\"`\n}\ntype Value_StringValue struct {\n\tStringValue string `protobuf:\"bytes,3,opt,name=string_value,json=stringValue,oneof\"`\n}\ntype Value_BoolValue struct {\n\tBoolValue bool `protobuf:\"varint,4,opt,name=bool_value,json=boolValue,oneof\"`\n}\ntype Value_StructValue struct {\n\tStructValue *Struct `protobuf:\"bytes,5,opt,name=struct_value,json=structValue,oneof\"`\n}\ntype Value_ListValue struct {\n\tListValue *ListValue `protobuf:\"bytes,6,opt,name=list_value,json=listValue,oneof\"`\n}\n\nfunc (*Value_NullValue) isValue_Kind()   {}\nfunc (*Value_NumberValue) isValue_Kind() {}\nfunc (*Value_StringValue) isValue_Kind() {}\nfunc (*Value_BoolValue) isValue_Kind()   {}\nfunc (*Value_StructValue) isValue_Kind() {}\nfunc (*Value_ListValue) isValue_Kind()   {}\n\nfunc (m *Value) GetKind() isValue_Kind {\n\tif m != nil {\n\t\treturn m.Kind\n\t}\n\treturn nil\n}\n\nfunc (m *Value) GetNullValue() NullValue {\n\tif x, ok := m.GetKind().(*Value_NullValue); ok {\n\t\treturn x.NullValue\n\t}\n\treturn NullValue_NULL_VALUE\n}\n\nfunc (m *Value) GetNumberValue() float64 {\n\tif x, ok := m.GetKind().(*Value_NumberValue); ok {\n\t\treturn x.NumberValue\n\t}\n\treturn 0\n}\n\nfunc (m *Value) GetStringValue() string {\n\tif x, ok := m.GetKind().(*Value_StringValue); ok {\n\t\treturn x.StringValue\n\t}\n\treturn \"\"\n}\n\nfunc (m *Value) GetBoolValue() bool {\n\tif x, ok := m.GetKind().(*Value_BoolValue); ok {\n\t\treturn x.BoolValue\n\t}\n\treturn false\n}\n\nfunc (m *Value) GetStructValue() *Struct {\n\tif x, ok := m.GetKind().(*Value_StructValue); ok {\n\t\treturn x.StructValue\n\t}\n\treturn nil\n}\n\nfunc (m *Value) GetListValue() *ListValue {\n\tif x, ok := m.GetKind().(*Value_ListValue); ok {\n\t\treturn x.ListValue\n\t}\n\treturn nil\n}\n\n// XXX_OneofFuncs is for the internal use of the proto package.\nfunc (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{\n\t\t(*Value_NullValue)(nil),\n\t\t(*Value_NumberValue)(nil),\n\t\t(*Value_StringValue)(nil),\n\t\t(*Value_BoolValue)(nil),\n\t\t(*Value_StructValue)(nil),\n\t\t(*Value_ListValue)(nil),\n\t}\n}\n\nfunc _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {\n\tm := msg.(*Value)\n\t// kind\n\tswitch x := m.Kind.(type) {\n\tcase *Value_NullValue:\n\t\tb.EncodeVarint(1<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(uint64(x.NullValue))\n\tcase *Value_NumberValue:\n\t\tb.EncodeVarint(2<<3 | proto.WireFixed64)\n\t\tb.EncodeFixed64(math.Float64bits(x.NumberValue))\n\tcase *Value_StringValue:\n\t\tb.EncodeVarint(3<<3 | proto.WireBytes)\n\t\tb.EncodeStringBytes(x.StringValue)\n\tcase *Value_BoolValue:\n\t\tt := uint64(0)\n\t\tif x.BoolValue {\n\t\t\tt = 1\n\t\t}\n\t\tb.EncodeVarint(4<<3 | proto.WireVarint)\n\t\tb.EncodeVarint(t)\n\tcase *Value_StructValue:\n\t\tb.EncodeVarint(5<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.StructValue); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *Value_ListValue:\n\t\tb.EncodeVarint(6<<3 | proto.WireBytes)\n\t\tif err := b.EncodeMessage(x.ListValue); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase nil:\n\tdefault:\n\t\treturn fmt.Errorf(\"Value.Kind has unexpected type %T\", x)\n\t}\n\treturn nil\n}\n\nfunc _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {\n\tm := msg.(*Value)\n\tswitch tag {\n\tcase 1: // kind.null_value\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Kind = &Value_NullValue{NullValue(x)}\n\t\treturn true, err\n\tcase 2: // kind.number_value\n\t\tif wire != proto.WireFixed64 {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeFixed64()\n\t\tm.Kind = &Value_NumberValue{math.Float64frombits(x)}\n\t\treturn true, err\n\tcase 3: // kind.string_value\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeStringBytes()\n\t\tm.Kind = &Value_StringValue{x}\n\t\treturn true, err\n\tcase 4: // kind.bool_value\n\t\tif wire != proto.WireVarint {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tx, err := b.DecodeVarint()\n\t\tm.Kind = &Value_BoolValue{x != 0}\n\t\treturn true, err\n\tcase 5: // kind.struct_value\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(Struct)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Kind = &Value_StructValue{msg}\n\t\treturn true, err\n\tcase 6: // kind.list_value\n\t\tif wire != proto.WireBytes {\n\t\t\treturn true, proto.ErrInternalBadWireType\n\t\t}\n\t\tmsg := new(ListValue)\n\t\terr := b.DecodeMessage(msg)\n\t\tm.Kind = &Value_ListValue{msg}\n\t\treturn true, err\n\tdefault:\n\t\treturn false, nil\n\t}\n}\n\nfunc _Value_OneofSizer(msg proto.Message) (n int) {\n\tm := msg.(*Value)\n\t// kind\n\tswitch x := m.Kind.(type) {\n\tcase *Value_NullValue:\n\t\tn += proto.SizeVarint(1<<3 | proto.WireVarint)\n\t\tn += proto.SizeVarint(uint64(x.NullValue))\n\tcase *Value_NumberValue:\n\t\tn += proto.SizeVarint(2<<3 | proto.WireFixed64)\n\t\tn += 8\n\tcase *Value_StringValue:\n\t\tn += proto.SizeVarint(3<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(len(x.StringValue)))\n\t\tn += len(x.StringValue)\n\tcase *Value_BoolValue:\n\t\tn += proto.SizeVarint(4<<3 | proto.WireVarint)\n\t\tn += 1\n\tcase *Value_StructValue:\n\t\ts := proto.Size(x.StructValue)\n\t\tn += proto.SizeVarint(5<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase *Value_ListValue:\n\t\ts := proto.Size(x.ListValue)\n\t\tn += proto.SizeVarint(6<<3 | proto.WireBytes)\n\t\tn += proto.SizeVarint(uint64(s))\n\t\tn += s\n\tcase nil:\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"proto: unexpected type %T in oneof\", x))\n\t}\n\treturn n\n}\n\n// `ListValue` is a wrapper around a repeated field of values.\n//\n// The JSON representation for `ListValue` is JSON array.\ntype ListValue struct {\n\t// Repeated field of dynamically typed values.\n\tValues []*Value `protobuf:\"bytes,1,rep,name=values\" json:\"values,omitempty\"`\n}\n\nfunc (m *ListValue) Reset()                    { *m = ListValue{} }\nfunc (m *ListValue) String() string            { return proto.CompactTextString(m) }\nfunc (*ListValue) ProtoMessage()               {}\nfunc (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\nfunc (*ListValue) XXX_WellKnownType() string   { return \"ListValue\" }\n\nfunc (m *ListValue) GetValues() []*Value {\n\tif m != nil {\n\t\treturn m.Values\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterType((*Struct)(nil), \"google.protobuf.Struct\")\n\tproto.RegisterType((*Value)(nil), \"google.protobuf.Value\")\n\tproto.RegisterType((*ListValue)(nil), \"google.protobuf.ListValue\")\n\tproto.RegisterEnum(\"google.protobuf.NullValue\", NullValue_name, NullValue_value)\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/struct.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 417 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40,\n\t0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09,\n\t0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94,\n\t0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa,\n\t0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff,\n\t0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc,\n\t0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15,\n\t0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d,\n\t0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce,\n\t0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39,\n\t0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab,\n\t0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84,\n\t0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48,\n\t0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f,\n\t0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59,\n\t0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a,\n\t0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64,\n\t0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92,\n\t0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25,\n\t0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37,\n\t0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6,\n\t0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4,\n\t0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda,\n\t0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9,\n\t0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53,\n\t0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 0x02, 0x00,\n\t0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/struct/struct.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption cc_enable_arenas = true;\noption go_package = \"github.com/golang/protobuf/ptypes/struct;structpb\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"StructProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\n\n\n// `Struct` represents a structured data value, consisting of fields\n// which map to dynamically typed values. In some languages, `Struct`\n// might be supported by a native representation. For example, in\n// scripting languages like JS a struct is represented as an\n// object. The details of that representation are described together\n// with the proto support for the language.\n//\n// The JSON representation for `Struct` is JSON object.\nmessage Struct {\n  // Unordered map of dynamically typed values.\n  map<string, Value> fields = 1;\n}\n\n// `Value` represents a dynamically typed value which can be either\n// null, a number, a string, a boolean, a recursive struct value, or a\n// list of values. A producer of value is expected to set one of that\n// variants, absence of any variant indicates an error.\n//\n// The JSON representation for `Value` is JSON value.\nmessage Value {\n  // The kind of value.\n  oneof kind {\n    // Represents a null value.\n    NullValue null_value = 1;\n    // Represents a double value.\n    double number_value = 2;\n    // Represents a string value.\n    string string_value = 3;\n    // Represents a boolean value.\n    bool bool_value = 4;\n    // Represents a structured value.\n    Struct struct_value = 5;\n    // Represents a repeated `Value`.\n    ListValue list_value = 6;\n  }\n}\n\n// `NullValue` is a singleton enumeration to represent the null value for the\n// `Value` type union.\n//\n//  The JSON representation for `NullValue` is JSON `null`.\nenum NullValue {\n  // Null value.\n  NULL_VALUE = 0;\n}\n\n// `ListValue` is a wrapper around a repeated field of values.\n//\n// The JSON representation for `ListValue` is JSON array.\nmessage ListValue {\n  // Repeated field of dynamically typed values.\n  repeated Value values = 1;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/timestamp.proto\n\n/*\nPackage timestamp is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/timestamp.proto\n\nIt has these top-level messages:\n\tTimestamp\n*/\npackage timestamp\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// A Timestamp represents a point in time independent of any time zone\n// or calendar, represented as seconds and fractions of seconds at\n// nanosecond resolution in UTC Epoch time. It is encoded using the\n// Proleptic Gregorian Calendar which extends the Gregorian calendar\n// backwards to year one. It is encoded assuming all minutes are 60\n// seconds long, i.e. leap seconds are \"smeared\" so that no leap second\n// table is needed for interpretation. Range is from\n// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.\n// By restricting to that range, we ensure that we can convert to\n// and from  RFC 3339 date strings.\n// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).\n//\n// # Examples\n//\n// Example 1: Compute Timestamp from POSIX `time()`.\n//\n//     Timestamp timestamp;\n//     timestamp.set_seconds(time(NULL));\n//     timestamp.set_nanos(0);\n//\n// Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n//\n//     struct timeval tv;\n//     gettimeofday(&tv, NULL);\n//\n//     Timestamp timestamp;\n//     timestamp.set_seconds(tv.tv_sec);\n//     timestamp.set_nanos(tv.tv_usec * 1000);\n//\n// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n//\n//     FILETIME ft;\n//     GetSystemTimeAsFileTime(&ft);\n//     UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n//\n//     // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n//     // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n//     Timestamp timestamp;\n//     timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n//     timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n//\n// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n//\n//     long millis = System.currentTimeMillis();\n//\n//     Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n//         .setNanos((int) ((millis % 1000) * 1000000)).build();\n//\n//\n// Example 5: Compute Timestamp from current time in Python.\n//\n//     timestamp = Timestamp()\n//     timestamp.GetCurrentTime()\n//\n// # JSON Mapping\n//\n// In JSON format, the Timestamp type is encoded as a string in the\n// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n// format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n// where {year} is always expressed using four digits while {month}, {day},\n// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n// are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n// is required, though only UTC (as indicated by \"Z\") is presently supported.\n//\n// For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n// 01:30 UTC on January 15, 2017.\n//\n// In JavaScript, one can convert a Date object to this format using the\n// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]\n// method. In Python, a standard `datetime.datetime` object can be converted\n// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)\n// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one\n// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](\n// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())\n// to obtain a formatter capable of generating timestamps in this format.\n//\n//\ntype Timestamp struct {\n\t// Represents seconds of UTC time since Unix epoch\n\t// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n\t// 9999-12-31T23:59:59Z inclusive.\n\tSeconds int64 `protobuf:\"varint,1,opt,name=seconds\" json:\"seconds,omitempty\"`\n\t// Non-negative fractions of a second at nanosecond resolution. Negative\n\t// second values with fractions must still have non-negative nanos values\n\t// that count forward in time. Must be from 0 to 999,999,999\n\t// inclusive.\n\tNanos int32 `protobuf:\"varint,2,opt,name=nanos\" json:\"nanos,omitempty\"`\n}\n\nfunc (m *Timestamp) Reset()                    { *m = Timestamp{} }\nfunc (m *Timestamp) String() string            { return proto.CompactTextString(m) }\nfunc (*Timestamp) ProtoMessage()               {}\nfunc (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*Timestamp) XXX_WellKnownType() string   { return \"Timestamp\" }\n\nfunc (m *Timestamp) GetSeconds() int64 {\n\tif m != nil {\n\t\treturn m.Seconds\n\t}\n\treturn 0\n}\n\nfunc (m *Timestamp) GetNanos() int32 {\n\tif m != nil {\n\t\treturn m.Nanos\n\t}\n\treturn 0\n}\n\nfunc init() {\n\tproto.RegisterType((*Timestamp)(nil), \"google.protobuf.Timestamp\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/timestamp.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 191 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,\n\t0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,\n\t0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28,\n\t0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5,\n\t0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89,\n\t0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70,\n\t0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51,\n\t0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89,\n\t0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71,\n\t0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a,\n\t0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43,\n\t0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption cc_enable_arenas = true;\noption go_package = \"github.com/golang/protobuf/ptypes/timestamp\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"TimestampProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\n\n// A Timestamp represents a point in time independent of any time zone\n// or calendar, represented as seconds and fractions of seconds at\n// nanosecond resolution in UTC Epoch time. It is encoded using the\n// Proleptic Gregorian Calendar which extends the Gregorian calendar\n// backwards to year one. It is encoded assuming all minutes are 60\n// seconds long, i.e. leap seconds are \"smeared\" so that no leap second\n// table is needed for interpretation. Range is from\n// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.\n// By restricting to that range, we ensure that we can convert to\n// and from  RFC 3339 date strings.\n// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).\n//\n// # Examples\n//\n// Example 1: Compute Timestamp from POSIX `time()`.\n//\n//     Timestamp timestamp;\n//     timestamp.set_seconds(time(NULL));\n//     timestamp.set_nanos(0);\n//\n// Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n//\n//     struct timeval tv;\n//     gettimeofday(&tv, NULL);\n//\n//     Timestamp timestamp;\n//     timestamp.set_seconds(tv.tv_sec);\n//     timestamp.set_nanos(tv.tv_usec * 1000);\n//\n// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n//\n//     FILETIME ft;\n//     GetSystemTimeAsFileTime(&ft);\n//     UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n//\n//     // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n//     // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n//     Timestamp timestamp;\n//     timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n//     timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n//\n// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n//\n//     long millis = System.currentTimeMillis();\n//\n//     Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n//         .setNanos((int) ((millis % 1000) * 1000000)).build();\n//\n//\n// Example 5: Compute Timestamp from current time in Python.\n//\n//     timestamp = Timestamp()\n//     timestamp.GetCurrentTime()\n//\n// # JSON Mapping\n//\n// In JSON format, the Timestamp type is encoded as a string in the\n// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n// format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n// where {year} is always expressed using four digits while {month}, {day},\n// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n// are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n// is required, though only UTC (as indicated by \"Z\") is presently supported.\n//\n// For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n// 01:30 UTC on January 15, 2017.\n//\n// In JavaScript, one can convert a Date object to this format using the\n// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]\n// method. In Python, a standard `datetime.datetime` object can be converted\n// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)\n// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one\n// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](\n// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime())\n// to obtain a formatter capable of generating timestamps in this format.\n//\n//\nmessage Timestamp {\n\n  // Represents seconds of UTC time since Unix epoch\n  // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n  // 9999-12-31T23:59:59Z inclusive.\n  int64 seconds = 1;\n\n  // Non-negative fractions of a second at nanosecond resolution. Negative\n  // second values with fractions must still have non-negative nanos values\n  // that count forward in time. Must be from 0 to 999,999,999\n  // inclusive.\n  int32 nanos = 2;\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/timestamp.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\n// This file implements operations on google.protobuf.Timestamp.\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n)\n\nconst (\n\t// Seconds field of the earliest valid Timestamp.\n\t// This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix().\n\tminValidSeconds = -62135596800\n\t// Seconds field just after the latest valid Timestamp.\n\t// This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().\n\tmaxValidSeconds = 253402300800\n)\n\n// validateTimestamp determines whether a Timestamp is valid.\n// A valid timestamp represents a time in the range\n// [0001-01-01, 10000-01-01) and has a Nanos field\n// in the range [0, 1e9).\n//\n// If the Timestamp is valid, validateTimestamp returns nil.\n// Otherwise, it returns an error that describes\n// the problem.\n//\n// Every valid Timestamp can be represented by a time.Time, but the converse is not true.\nfunc validateTimestamp(ts *tspb.Timestamp) error {\n\tif ts == nil {\n\t\treturn errors.New(\"timestamp: nil Timestamp\")\n\t}\n\tif ts.Seconds < minValidSeconds {\n\t\treturn fmt.Errorf(\"timestamp: %v before 0001-01-01\", ts)\n\t}\n\tif ts.Seconds >= maxValidSeconds {\n\t\treturn fmt.Errorf(\"timestamp: %v after 10000-01-01\", ts)\n\t}\n\tif ts.Nanos < 0 || ts.Nanos >= 1e9 {\n\t\treturn fmt.Errorf(\"timestamp: %v: nanos not in range [0, 1e9)\", ts)\n\t}\n\treturn nil\n}\n\n// Timestamp converts a google.protobuf.Timestamp proto to a time.Time.\n// It returns an error if the argument is invalid.\n//\n// Unlike most Go functions, if Timestamp returns an error, the first return value\n// is not the zero time.Time. Instead, it is the value obtained from the\n// time.Unix function when passed the contents of the Timestamp, in the UTC\n// locale. This may or may not be a meaningful time; many invalid Timestamps\n// do map to valid time.Times.\n//\n// A nil Timestamp returns an error. The first return value in that case is\n// undefined.\nfunc Timestamp(ts *tspb.Timestamp) (time.Time, error) {\n\t// Don't return the zero value on error, because corresponds to a valid\n\t// timestamp. Instead return whatever time.Unix gives us.\n\tvar t time.Time\n\tif ts == nil {\n\t\tt = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp\n\t} else {\n\t\tt = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC()\n\t}\n\treturn t, validateTimestamp(ts)\n}\n\n// TimestampNow returns a google.protobuf.Timestamp for the current time.\nfunc TimestampNow() *tspb.Timestamp {\n\tts, err := TimestampProto(time.Now())\n\tif err != nil {\n\t\tpanic(\"ptypes: time.Now() out of Timestamp range\")\n\t}\n\treturn ts\n}\n\n// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.\n// It returns an error if the resulting Timestamp is invalid.\nfunc TimestampProto(t time.Time) (*tspb.Timestamp, error) {\n\tseconds := t.Unix()\n\tnanos := int32(t.Sub(time.Unix(seconds, 0)))\n\tts := &tspb.Timestamp{\n\t\tSeconds: seconds,\n\t\tNanos:   nanos,\n\t}\n\tif err := validateTimestamp(ts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ts, nil\n}\n\n// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid\n// Timestamps, it returns an error message in parentheses.\nfunc TimestampString(ts *tspb.Timestamp) string {\n\tt, err := Timestamp(ts)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"(%v)\", err)\n\t}\n\treturn t.Format(time.RFC3339Nano)\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/timestamp_test.go",
    "content": "// Go support for Protocol Buffers - Google's data interchange format\n//\n// Copyright 2016 The Go Authors.  All rights reserved.\n// https://github.com/golang/protobuf\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage ptypes\n\nimport (\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/protobuf/proto\"\n\ttspb \"github.com/golang/protobuf/ptypes/timestamp\"\n)\n\nvar tests = []struct {\n\tts    *tspb.Timestamp\n\tvalid bool\n\tt     time.Time\n}{\n\t// The timestamp representing the Unix epoch date.\n\t{&tspb.Timestamp{Seconds: 0, Nanos: 0}, true, utcDate(1970, 1, 1)},\n\t// The smallest representable timestamp.\n\t{&tspb.Timestamp{Seconds: math.MinInt64, Nanos: math.MinInt32}, false,\n\t\ttime.Unix(math.MinInt64, math.MinInt32).UTC()},\n\t// The smallest representable timestamp with non-negative nanos.\n\t{&tspb.Timestamp{Seconds: math.MinInt64, Nanos: 0}, false, time.Unix(math.MinInt64, 0).UTC()},\n\t// The earliest valid timestamp.\n\t{&tspb.Timestamp{Seconds: minValidSeconds, Nanos: 0}, true, utcDate(1, 1, 1)},\n\t//\"0001-01-01T00:00:00Z\"},\n\t// The largest representable timestamp.\n\t{&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: math.MaxInt32}, false,\n\t\ttime.Unix(math.MaxInt64, math.MaxInt32).UTC()},\n\t// The largest representable timestamp with nanos in range.\n\t{&tspb.Timestamp{Seconds: math.MaxInt64, Nanos: 1e9 - 1}, false,\n\t\ttime.Unix(math.MaxInt64, 1e9-1).UTC()},\n\t// The largest valid timestamp.\n\t{&tspb.Timestamp{Seconds: maxValidSeconds - 1, Nanos: 1e9 - 1}, true,\n\t\ttime.Date(9999, 12, 31, 23, 59, 59, 1e9-1, time.UTC)},\n\t// The smallest invalid timestamp that is larger than the valid range.\n\t{&tspb.Timestamp{Seconds: maxValidSeconds, Nanos: 0}, false, time.Unix(maxValidSeconds, 0).UTC()},\n\t// A date before the epoch.\n\t{&tspb.Timestamp{Seconds: -281836800, Nanos: 0}, true, utcDate(1961, 1, 26)},\n\t// A date after the epoch.\n\t{&tspb.Timestamp{Seconds: 1296000000, Nanos: 0}, true, utcDate(2011, 1, 26)},\n\t// A date after the epoch, in the middle of the day.\n\t{&tspb.Timestamp{Seconds: 1296012345, Nanos: 940483}, true,\n\t\ttime.Date(2011, 1, 26, 3, 25, 45, 940483, time.UTC)},\n}\n\nfunc TestValidateTimestamp(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot := validateTimestamp(s.ts)\n\t\tif (got == nil) != s.valid {\n\t\t\tt.Errorf(\"validateTimestamp(%v) = %v, want %v\", s.ts, got, s.valid)\n\t\t}\n\t}\n}\n\nfunc TestTimestamp(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot, err := Timestamp(s.ts)\n\t\tif (err == nil) != s.valid {\n\t\t\tt.Errorf(\"Timestamp(%v) error = %v, but valid = %t\", s.ts, err, s.valid)\n\t\t} else if s.valid && got != s.t {\n\t\t\tt.Errorf(\"Timestamp(%v) = %v, want %v\", s.ts, got, s.t)\n\t\t}\n\t}\n\t// Special case: a nil Timestamp is an error, but returns the 0 Unix time.\n\tgot, err := Timestamp(nil)\n\twant := time.Unix(0, 0).UTC()\n\tif got != want {\n\t\tt.Errorf(\"Timestamp(nil) = %v, want %v\", got, want)\n\t}\n\tif err == nil {\n\t\tt.Errorf(\"Timestamp(nil) error = nil, expected error\")\n\t}\n}\n\nfunc TestTimestampProto(t *testing.T) {\n\tfor _, s := range tests {\n\t\tgot, err := TimestampProto(s.t)\n\t\tif (err == nil) != s.valid {\n\t\t\tt.Errorf(\"TimestampProto(%v) error = %v, but valid = %t\", s.t, err, s.valid)\n\t\t} else if s.valid && !proto.Equal(got, s.ts) {\n\t\t\tt.Errorf(\"TimestampProto(%v) = %v, want %v\", s.t, got, s.ts)\n\t\t}\n\t}\n\t// No corresponding special case here: no time.Time results in a nil Timestamp.\n}\n\nfunc TestTimestampString(t *testing.T) {\n\tfor _, test := range []struct {\n\t\tts   *tspb.Timestamp\n\t\twant string\n\t}{\n\t\t// Not much testing needed because presumably time.Format is\n\t\t// well-tested.\n\t\t{&tspb.Timestamp{Seconds: 0, Nanos: 0}, \"1970-01-01T00:00:00Z\"},\n\t\t{&tspb.Timestamp{Seconds: minValidSeconds - 1, Nanos: 0}, \"(timestamp: seconds:-62135596801  before 0001-01-01)\"},\n\t} {\n\t\tgot := TimestampString(test.ts)\n\t\tif got != test.want {\n\t\t\tt.Errorf(\"TimestampString(%v) = %q, want %q\", test.ts, got, test.want)\n\t\t}\n\t}\n}\n\nfunc utcDate(year, month, day int) time.Time {\n\treturn time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)\n}\n\nfunc TestTimestampNow(t *testing.T) {\n\t// Bracket the expected time.\n\tbefore := time.Now()\n\tts := TimestampNow()\n\tafter := time.Now()\n\n\ttm, err := Timestamp(ts)\n\tif err != nil {\n\t\tt.Errorf(\"between %v and %v\\nTimestampNow() = %v\\nwhich is invalid (%v)\", before, after, ts, err)\n\t}\n\tif tm.Before(before) || tm.After(after) {\n\t\tt.Errorf(\"between %v and %v\\nTimestamp(TimestampNow()) = %v\", before, after, tm)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/wrappers.proto\n\n/*\nPackage wrappers is a generated protocol buffer package.\n\nIt is generated from these files:\n\tgoogle/protobuf/wrappers.proto\n\nIt has these top-level messages:\n\tDoubleValue\n\tFloatValue\n\tInt64Value\n\tUInt64Value\n\tInt32Value\n\tUInt32Value\n\tBoolValue\n\tStringValue\n\tBytesValue\n*/\npackage wrappers\n\nimport proto \"github.com/golang/protobuf/proto\"\nimport fmt \"fmt\"\nimport math \"math\"\n\n// Reference imports to suppress errors if they are not otherwise used.\nvar _ = proto.Marshal\nvar _ = fmt.Errorf\nvar _ = math.Inf\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the proto package it is being compiled against.\n// A compilation error at this line likely means your copy of the\n// proto package needs to be updated.\nconst _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package\n\n// Wrapper message for `double`.\n//\n// The JSON representation for `DoubleValue` is JSON number.\ntype DoubleValue struct {\n\t// The double value.\n\tValue float64 `protobuf:\"fixed64,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *DoubleValue) Reset()                    { *m = DoubleValue{} }\nfunc (m *DoubleValue) String() string            { return proto.CompactTextString(m) }\nfunc (*DoubleValue) ProtoMessage()               {}\nfunc (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }\nfunc (*DoubleValue) XXX_WellKnownType() string   { return \"DoubleValue\" }\n\nfunc (m *DoubleValue) GetValue() float64 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `float`.\n//\n// The JSON representation for `FloatValue` is JSON number.\ntype FloatValue struct {\n\t// The float value.\n\tValue float32 `protobuf:\"fixed32,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *FloatValue) Reset()                    { *m = FloatValue{} }\nfunc (m *FloatValue) String() string            { return proto.CompactTextString(m) }\nfunc (*FloatValue) ProtoMessage()               {}\nfunc (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }\nfunc (*FloatValue) XXX_WellKnownType() string   { return \"FloatValue\" }\n\nfunc (m *FloatValue) GetValue() float32 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `int64`.\n//\n// The JSON representation for `Int64Value` is JSON string.\ntype Int64Value struct {\n\t// The int64 value.\n\tValue int64 `protobuf:\"varint,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *Int64Value) Reset()                    { *m = Int64Value{} }\nfunc (m *Int64Value) String() string            { return proto.CompactTextString(m) }\nfunc (*Int64Value) ProtoMessage()               {}\nfunc (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }\nfunc (*Int64Value) XXX_WellKnownType() string   { return \"Int64Value\" }\n\nfunc (m *Int64Value) GetValue() int64 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `uint64`.\n//\n// The JSON representation for `UInt64Value` is JSON string.\ntype UInt64Value struct {\n\t// The uint64 value.\n\tValue uint64 `protobuf:\"varint,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *UInt64Value) Reset()                    { *m = UInt64Value{} }\nfunc (m *UInt64Value) String() string            { return proto.CompactTextString(m) }\nfunc (*UInt64Value) ProtoMessage()               {}\nfunc (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }\nfunc (*UInt64Value) XXX_WellKnownType() string   { return \"UInt64Value\" }\n\nfunc (m *UInt64Value) GetValue() uint64 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `int32`.\n//\n// The JSON representation for `Int32Value` is JSON number.\ntype Int32Value struct {\n\t// The int32 value.\n\tValue int32 `protobuf:\"varint,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *Int32Value) Reset()                    { *m = Int32Value{} }\nfunc (m *Int32Value) String() string            { return proto.CompactTextString(m) }\nfunc (*Int32Value) ProtoMessage()               {}\nfunc (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }\nfunc (*Int32Value) XXX_WellKnownType() string   { return \"Int32Value\" }\n\nfunc (m *Int32Value) GetValue() int32 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `uint32`.\n//\n// The JSON representation for `UInt32Value` is JSON number.\ntype UInt32Value struct {\n\t// The uint32 value.\n\tValue uint32 `protobuf:\"varint,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *UInt32Value) Reset()                    { *m = UInt32Value{} }\nfunc (m *UInt32Value) String() string            { return proto.CompactTextString(m) }\nfunc (*UInt32Value) ProtoMessage()               {}\nfunc (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }\nfunc (*UInt32Value) XXX_WellKnownType() string   { return \"UInt32Value\" }\n\nfunc (m *UInt32Value) GetValue() uint32 {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `bool`.\n//\n// The JSON representation for `BoolValue` is JSON `true` and `false`.\ntype BoolValue struct {\n\t// The bool value.\n\tValue bool `protobuf:\"varint,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *BoolValue) Reset()                    { *m = BoolValue{} }\nfunc (m *BoolValue) String() string            { return proto.CompactTextString(m) }\nfunc (*BoolValue) ProtoMessage()               {}\nfunc (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }\nfunc (*BoolValue) XXX_WellKnownType() string   { return \"BoolValue\" }\n\nfunc (m *BoolValue) GetValue() bool {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn false\n}\n\n// Wrapper message for `string`.\n//\n// The JSON representation for `StringValue` is JSON string.\ntype StringValue struct {\n\t// The string value.\n\tValue string `protobuf:\"bytes,1,opt,name=value\" json:\"value,omitempty\"`\n}\n\nfunc (m *StringValue) Reset()                    { *m = StringValue{} }\nfunc (m *StringValue) String() string            { return proto.CompactTextString(m) }\nfunc (*StringValue) ProtoMessage()               {}\nfunc (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }\nfunc (*StringValue) XXX_WellKnownType() string   { return \"StringValue\" }\n\nfunc (m *StringValue) GetValue() string {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn \"\"\n}\n\n// Wrapper message for `bytes`.\n//\n// The JSON representation for `BytesValue` is JSON string.\ntype BytesValue struct {\n\t// The bytes value.\n\tValue []byte `protobuf:\"bytes,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\nfunc (m *BytesValue) Reset()                    { *m = BytesValue{} }\nfunc (m *BytesValue) String() string            { return proto.CompactTextString(m) }\nfunc (*BytesValue) ProtoMessage()               {}\nfunc (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }\nfunc (*BytesValue) XXX_WellKnownType() string   { return \"BytesValue\" }\n\nfunc (m *BytesValue) GetValue() []byte {\n\tif m != nil {\n\t\treturn m.Value\n\t}\n\treturn nil\n}\n\nfunc init() {\n\tproto.RegisterType((*DoubleValue)(nil), \"google.protobuf.DoubleValue\")\n\tproto.RegisterType((*FloatValue)(nil), \"google.protobuf.FloatValue\")\n\tproto.RegisterType((*Int64Value)(nil), \"google.protobuf.Int64Value\")\n\tproto.RegisterType((*UInt64Value)(nil), \"google.protobuf.UInt64Value\")\n\tproto.RegisterType((*Int32Value)(nil), \"google.protobuf.Int32Value\")\n\tproto.RegisterType((*UInt32Value)(nil), \"google.protobuf.UInt32Value\")\n\tproto.RegisterType((*BoolValue)(nil), \"google.protobuf.BoolValue\")\n\tproto.RegisterType((*StringValue)(nil), \"google.protobuf.StringValue\")\n\tproto.RegisterType((*BytesValue)(nil), \"google.protobuf.BytesValue\")\n}\n\nfunc init() { proto.RegisterFile(\"google/protobuf/wrappers.proto\", fileDescriptor0) }\n\nvar fileDescriptor0 = []byte{\n\t// 259 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,\n\t0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c,\n\t0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca,\n\t0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c,\n\t0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5,\n\t0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13,\n\t0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8,\n\t0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca,\n\t0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a,\n\t0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x0d,\n\t0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x5a, 0xe8, 0x3a, 0xf1, 0x86, 0x43, 0x83, 0x3f, 0x00, 0x24,\n\t0x12, 0xc0, 0x18, 0xa5, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f,\n\t0x9e, 0x9f, 0x93, 0x98, 0x97, 0x8e, 0x88, 0xaa, 0x82, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x78, 0x8c,\n\t0xfd, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e,\n\t0x00, 0x54, 0xa9, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b,\n\t0x12, 0x1b, 0xd8, 0x0c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x6c, 0xb9, 0xb8, 0xfe,\n\t0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "src/github.com/golang/protobuf/ptypes/wrappers/wrappers.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Wrappers for primitive (non-message) types. These types are useful\n// for embedding primitives in the `google.protobuf.Any` type and for places\n// where we need to distinguish between the absence of a primitive\n// typed field and its default value.\n\nsyntax = \"proto3\";\n\npackage google.protobuf;\n\noption csharp_namespace = \"Google.Protobuf.WellKnownTypes\";\noption cc_enable_arenas = true;\noption go_package = \"github.com/golang/protobuf/ptypes/wrappers\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"WrappersProto\";\noption java_multiple_files = true;\noption objc_class_prefix = \"GPB\";\n\n// Wrapper message for `double`.\n//\n// The JSON representation for `DoubleValue` is JSON number.\nmessage DoubleValue {\n  // The double value.\n  double value = 1;\n}\n\n// Wrapper message for `float`.\n//\n// The JSON representation for `FloatValue` is JSON number.\nmessage FloatValue {\n  // The float value.\n  float value = 1;\n}\n\n// Wrapper message for `int64`.\n//\n// The JSON representation for `Int64Value` is JSON string.\nmessage Int64Value {\n  // The int64 value.\n  int64 value = 1;\n}\n\n// Wrapper message for `uint64`.\n//\n// The JSON representation for `UInt64Value` is JSON string.\nmessage UInt64Value {\n  // The uint64 value.\n  uint64 value = 1;\n}\n\n// Wrapper message for `int32`.\n//\n// The JSON representation for `Int32Value` is JSON number.\nmessage Int32Value {\n  // The int32 value.\n  int32 value = 1;\n}\n\n// Wrapper message for `uint32`.\n//\n// The JSON representation for `UInt32Value` is JSON number.\nmessage UInt32Value {\n  // The uint32 value.\n  uint32 value = 1;\n}\n\n// Wrapper message for `bool`.\n//\n// The JSON representation for `BoolValue` is JSON `true` and `false`.\nmessage BoolValue {\n  // The bool value.\n  bool value = 1;\n}\n\n// Wrapper message for `string`.\n//\n// The JSON representation for `StringValue` is JSON string.\nmessage StringValue {\n  // The string value.\n  string value = 1;\n}\n\n// Wrapper message for `bytes`.\n//\n// The JSON representation for `BytesValue` is JSON string.\nmessage BytesValue {\n  // The bytes value.\n  bytes value = 1;\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/.gitignore",
    "content": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture specific extensions/prefixes\n*.[568vq]\n[568vq].out\n\n*.cgo1.go\n*.cgo2.c\n_cgo_defun.c\n_cgo_gotypes.go\n_cgo_export.*\n\n_testmain.go\n\n*.exe\n\n.idea/\n*.iml\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/.travis.yml",
    "content": "language: go\nsudo: false\n\nmatrix:\n  include:\n    - go: 1.4\n    - go: 1.5.x\n    - go: 1.6.x\n    - go: 1.7.x\n    - go: 1.8.x\n    - go: 1.9.x\n    - go: 1.10.x\n    - go: tip\n  allow_failures:\n    - go: tip\n\nscript:\n  - go get -t -v ./...\n  - diff -u <(echo -n) <(gofmt -d .)\n  - go vet $(go list ./... | grep -v /vendor/)\n  - go test -v -race ./...\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/AUTHORS",
    "content": "# This is the official list of Gorilla WebSocket authors for copyright\n# purposes.\n#\n# Please keep the list sorted.\n\nGary Burd <gary@beagledreams.com>\nJoachim Bauch <mail@joachim-bauch.de>\n\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/LICENSE",
    "content": "Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n  Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n  Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/README.md",
    "content": "# Gorilla WebSocket\n\nGorilla WebSocket is a [Go](http://golang.org/) implementation of the\n[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.\n\n[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket)\n[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket)\n\n### Documentation\n\n* [API Reference](http://godoc.org/github.com/gorilla/websocket)\n* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat)\n* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command)\n* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo)\n* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch)\n\n### Status\n\nThe Gorilla WebSocket package provides a complete and tested implementation of\nthe [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The\npackage API is stable.\n\n### Installation\n\n    go get github.com/gorilla/websocket\n\n### Protocol Compliance\n\nThe Gorilla WebSocket package passes the server tests in the [Autobahn Test\nSuite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn\nsubdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).\n\n### Gorilla WebSocket compared with other packages\n\n<table>\n<tr>\n<th></th>\n<th><a href=\"http://godoc.org/github.com/gorilla/websocket\">github.com/gorilla</a></th>\n<th><a href=\"http://godoc.org/golang.org/x/net/websocket\">golang.org/x/net</a></th>\n</tr>\n<tr>\n<tr><td colspan=\"3\"><a href=\"http://tools.ietf.org/html/rfc6455\">RFC 6455</a> Features</td></tr>\n<tr><td>Passes <a href=\"http://autobahn.ws/testsuite/\">Autobahn Test Suite</a></td><td><a href=\"https://github.com/gorilla/websocket/tree/master/examples/autobahn\">Yes</a></td><td>No</td></tr>\n<tr><td>Receive <a href=\"https://tools.ietf.org/html/rfc6455#section-5.4\">fragmented</a> message<td>Yes</td><td><a href=\"https://code.google.com/p/go/issues/detail?id=7632\">No</a>, see note 1</td></tr>\n<tr><td>Send <a href=\"https://tools.ietf.org/html/rfc6455#section-5.5.1\">close</a> message</td><td><a href=\"http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages\">Yes</a></td><td><a href=\"https://code.google.com/p/go/issues/detail?id=4588\">No</a></td></tr>\n<tr><td>Send <a href=\"https://tools.ietf.org/html/rfc6455#section-5.5.2\">pings</a> and receive <a href=\"https://tools.ietf.org/html/rfc6455#section-5.5.3\">pongs</a></td><td><a href=\"http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages\">Yes</a></td><td>No</td></tr>\n<tr><td>Get the <a href=\"https://tools.ietf.org/html/rfc6455#section-5.6\">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr>\n<tr><td colspan=\"3\">Other Features</tr></td>\n<tr><td><a href=\"https://tools.ietf.org/html/rfc7692\">Compression Extensions</a></td><td>Experimental</td><td>No</td></tr>\n<tr><td>Read message using io.Reader</td><td><a href=\"http://godoc.org/github.com/gorilla/websocket#Conn.NextReader\">Yes</a></td><td>No, see note 3</td></tr>\n<tr><td>Write message using io.WriteCloser</td><td><a href=\"http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter\">Yes</a></td><td>No, see note 3</td></tr>\n</table>\n\nNotes:\n\n1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).\n2. The application can get the type of a received data message by implementing\n   a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal)\n   function.\n3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries.\n  Read returns when the input buffer is full or a frame boundary is\n  encountered. Each call to Write sends a single frame message. The Gorilla\n  io.Reader and io.WriteCloser operate on a single WebSocket message.\n\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/client.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bytes\"\n\t\"crypto/tls\"\n\t\"errors\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n\t\"time\"\n)\n\n// ErrBadHandshake is returned when the server response to opening handshake is\n// invalid.\nvar ErrBadHandshake = errors.New(\"websocket: bad handshake\")\n\nvar errInvalidCompression = errors.New(\"websocket: invalid compression negotiation\")\n\n// NewClient creates a new client connection using the given net connection.\n// The URL u specifies the host and request URI. Use requestHeader to specify\n// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies\n// (Cookie). Use the response.Header to get the selected subprotocol\n// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).\n//\n// If the WebSocket handshake fails, ErrBadHandshake is returned along with a\n// non-nil *http.Response so that callers can handle redirects, authentication,\n// etc.\n//\n// Deprecated: Use Dialer instead.\nfunc NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) {\n\td := Dialer{\n\t\tReadBufferSize:  readBufSize,\n\t\tWriteBufferSize: writeBufSize,\n\t\tNetDial: func(net, addr string) (net.Conn, error) {\n\t\t\treturn netConn, nil\n\t\t},\n\t}\n\treturn d.Dial(u.String(), requestHeader)\n}\n\n// A Dialer contains options for connecting to WebSocket server.\ntype Dialer struct {\n\t// NetDial specifies the dial function for creating TCP connections. If\n\t// NetDial is nil, net.Dial is used.\n\tNetDial func(network, addr string) (net.Conn, error)\n\n\t// Proxy specifies a function to return a proxy for a given\n\t// Request. If the function returns a non-nil error, the\n\t// request is aborted with the provided error.\n\t// If Proxy is nil or returns a nil *URL, no proxy is used.\n\tProxy func(*http.Request) (*url.URL, error)\n\n\t// TLSClientConfig specifies the TLS configuration to use with tls.Client.\n\t// If nil, the default configuration is used.\n\tTLSClientConfig *tls.Config\n\n\t// HandshakeTimeout specifies the duration for the handshake to complete.\n\tHandshakeTimeout time.Duration\n\n\t// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer\n\t// size is zero, then a useful default size is used. The I/O buffer sizes\n\t// do not limit the size of the messages that can be sent or received.\n\tReadBufferSize, WriteBufferSize int\n\n\t// Subprotocols specifies the client's requested subprotocols.\n\tSubprotocols []string\n\n\t// EnableCompression specifies if the client should attempt to negotiate\n\t// per message compression (RFC 7692). Setting this value to true does not\n\t// guarantee that compression will be supported. Currently only \"no context\n\t// takeover\" modes are supported.\n\tEnableCompression bool\n\n\t// Jar specifies the cookie jar.\n\t// If Jar is nil, cookies are not sent in requests and ignored\n\t// in responses.\n\tJar http.CookieJar\n}\n\nvar errMalformedURL = errors.New(\"malformed ws or wss URL\")\n\nfunc hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) {\n\thostPort = u.Host\n\thostNoPort = u.Host\n\tif i := strings.LastIndex(u.Host, \":\"); i > strings.LastIndex(u.Host, \"]\") {\n\t\thostNoPort = hostNoPort[:i]\n\t} else {\n\t\tswitch u.Scheme {\n\t\tcase \"wss\":\n\t\t\thostPort += \":443\"\n\t\tcase \"https\":\n\t\t\thostPort += \":443\"\n\t\tdefault:\n\t\t\thostPort += \":80\"\n\t\t}\n\t}\n\treturn hostPort, hostNoPort\n}\n\n// DefaultDialer is a dialer with all fields set to the default values.\nvar DefaultDialer = &Dialer{\n\tProxy:            http.ProxyFromEnvironment,\n\tHandshakeTimeout: 45 * time.Second,\n}\n\n// nilDialer is dialer to use when receiver is nil.\nvar nilDialer Dialer = *DefaultDialer\n\n// Dial creates a new client connection. Use requestHeader to specify the\n// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie).\n// Use the response.Header to get the selected subprotocol\n// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).\n//\n// If the WebSocket handshake fails, ErrBadHandshake is returned along with a\n// non-nil *http.Response so that callers can handle redirects, authentication,\n// etcetera. The response body may not contain the entire response and does not\n// need to be closed by the application.\nfunc (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {\n\n\tif d == nil {\n\t\td = &nilDialer\n\t}\n\n\tchallengeKey, err := generateChallengeKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tu, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tswitch u.Scheme {\n\tcase \"ws\":\n\t\tu.Scheme = \"http\"\n\tcase \"wss\":\n\t\tu.Scheme = \"https\"\n\tdefault:\n\t\treturn nil, nil, errMalformedURL\n\t}\n\n\tif u.User != nil {\n\t\t// User name and password are not allowed in websocket URIs.\n\t\treturn nil, nil, errMalformedURL\n\t}\n\n\treq := &http.Request{\n\t\tMethod:     \"GET\",\n\t\tURL:        u,\n\t\tProto:      \"HTTP/1.1\",\n\t\tProtoMajor: 1,\n\t\tProtoMinor: 1,\n\t\tHeader:     make(http.Header),\n\t\tHost:       u.Host,\n\t}\n\n\t// Set the cookies present in the cookie jar of the dialer\n\tif d.Jar != nil {\n\t\tfor _, cookie := range d.Jar.Cookies(u) {\n\t\t\treq.AddCookie(cookie)\n\t\t}\n\t}\n\n\t// Set the request headers using the capitalization for names and values in\n\t// RFC examples. Although the capitalization shouldn't matter, there are\n\t// servers that depend on it. The Header.Set method is not used because the\n\t// method canonicalizes the header names.\n\treq.Header[\"Upgrade\"] = []string{\"websocket\"}\n\treq.Header[\"Connection\"] = []string{\"Upgrade\"}\n\treq.Header[\"Sec-WebSocket-Key\"] = []string{challengeKey}\n\treq.Header[\"Sec-WebSocket-Version\"] = []string{\"13\"}\n\tif len(d.Subprotocols) > 0 {\n\t\treq.Header[\"Sec-WebSocket-Protocol\"] = []string{strings.Join(d.Subprotocols, \", \")}\n\t}\n\tfor k, vs := range requestHeader {\n\t\tswitch {\n\t\tcase k == \"Host\":\n\t\t\tif len(vs) > 0 {\n\t\t\t\treq.Host = vs[0]\n\t\t\t}\n\t\tcase k == \"Upgrade\" ||\n\t\t\tk == \"Connection\" ||\n\t\t\tk == \"Sec-Websocket-Key\" ||\n\t\t\tk == \"Sec-Websocket-Version\" ||\n\t\t\tk == \"Sec-Websocket-Extensions\" ||\n\t\t\t(k == \"Sec-Websocket-Protocol\" && len(d.Subprotocols) > 0):\n\t\t\treturn nil, nil, errors.New(\"websocket: duplicate header not allowed: \" + k)\n\t\tcase k == \"Sec-Websocket-Protocol\":\n\t\t\treq.Header[\"Sec-WebSocket-Protocol\"] = vs\n\t\tdefault:\n\t\t\treq.Header[k] = vs\n\t\t}\n\t}\n\n\tif d.EnableCompression {\n\t\treq.Header.Set(\"Sec-Websocket-Extensions\", \"permessage-deflate; server_no_context_takeover; client_no_context_takeover\")\n\t}\n\n\tvar deadline time.Time\n\tif d.HandshakeTimeout != 0 {\n\t\tdeadline = time.Now().Add(d.HandshakeTimeout)\n\t}\n\n\t// Get network dial function.\n\tnetDial := d.NetDial\n\tif netDial == nil {\n\t\tnetDialer := &net.Dialer{Deadline: deadline}\n\t\tnetDial = netDialer.Dial\n\t}\n\n\t// If needed, wrap the dial function to set the connection deadline.\n\tif !deadline.Equal(time.Time{}) {\n\t\tforwardDial := netDial\n\t\tnetDial = func(network, addr string) (net.Conn, error) {\n\t\t\tc, err := forwardDial(network, addr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\terr = c.SetDeadline(deadline)\n\t\t\tif err != nil {\n\t\t\t\tc.Close()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, nil\n\t\t}\n\t}\n\n\t// If needed, wrap the dial function to connect through a proxy.\n\tif d.Proxy != nil {\n\t\tproxyURL, err := d.Proxy(req)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tif proxyURL != nil {\n\t\t\tdialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tnetDial = dialer.Dial\n\t\t}\n\t}\n\n\thostPort, hostNoPort := hostPortNoPort(u)\n\tnetConn, err := netDial(\"tcp\", hostPort)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdefer func() {\n\t\tif netConn != nil {\n\t\t\tnetConn.Close()\n\t\t}\n\t}()\n\n\tif u.Scheme == \"https\" {\n\t\tcfg := cloneTLSConfig(d.TLSClientConfig)\n\t\tif cfg.ServerName == \"\" {\n\t\t\tcfg.ServerName = hostNoPort\n\t\t}\n\t\ttlsConn := tls.Client(netConn, cfg)\n\t\tnetConn = tlsConn\n\t\tif err := tlsConn.Handshake(); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tif !cfg.InsecureSkipVerify {\n\t\t\tif err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tconn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize)\n\n\tif err := req.Write(netConn); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresp, err := http.ReadResponse(conn.br, req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif d.Jar != nil {\n\t\tif rc := resp.Cookies(); len(rc) > 0 {\n\t\t\td.Jar.SetCookies(u, rc)\n\t\t}\n\t}\n\n\tif resp.StatusCode != 101 ||\n\t\t!strings.EqualFold(resp.Header.Get(\"Upgrade\"), \"websocket\") ||\n\t\t!strings.EqualFold(resp.Header.Get(\"Connection\"), \"upgrade\") ||\n\t\tresp.Header.Get(\"Sec-Websocket-Accept\") != computeAcceptKey(challengeKey) {\n\t\t// Before closing the network connection on return from this\n\t\t// function, slurp up some of the response to aid application\n\t\t// debugging.\n\t\tbuf := make([]byte, 1024)\n\t\tn, _ := io.ReadFull(resp.Body, buf)\n\t\tresp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))\n\t\treturn nil, resp, ErrBadHandshake\n\t}\n\n\tfor _, ext := range parseExtensions(resp.Header) {\n\t\tif ext[\"\"] != \"permessage-deflate\" {\n\t\t\tcontinue\n\t\t}\n\t\t_, snct := ext[\"server_no_context_takeover\"]\n\t\t_, cnct := ext[\"client_no_context_takeover\"]\n\t\tif !snct || !cnct {\n\t\t\treturn nil, resp, errInvalidCompression\n\t\t}\n\t\tconn.newCompressionWriter = compressNoContextTakeover\n\t\tconn.newDecompressionReader = decompressNoContextTakeover\n\t\tbreak\n\t}\n\n\tresp.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))\n\tconn.subprotocol = resp.Header.Get(\"Sec-Websocket-Protocol\")\n\n\tnetConn.SetDeadline(time.Time{})\n\tnetConn = nil // to avoid close in defer.\n\treturn conn, resp, nil\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/client_clone.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build go1.8\n\npackage websocket\n\nimport \"crypto/tls\"\n\nfunc cloneTLSConfig(cfg *tls.Config) *tls.Config {\n\tif cfg == nil {\n\t\treturn &tls.Config{}\n\t}\n\treturn cfg.Clone()\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/client_clone_legacy.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build !go1.8\n\npackage websocket\n\nimport \"crypto/tls\"\n\n// cloneTLSConfig clones all public fields except the fields\n// SessionTicketsDisabled and SessionTicketKey. This avoids copying the\n// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a\n// config in active use.\nfunc cloneTLSConfig(cfg *tls.Config) *tls.Config {\n\tif cfg == nil {\n\t\treturn &tls.Config{}\n\t}\n\treturn &tls.Config{\n\t\tRand:                     cfg.Rand,\n\t\tTime:                     cfg.Time,\n\t\tCertificates:             cfg.Certificates,\n\t\tNameToCertificate:        cfg.NameToCertificate,\n\t\tGetCertificate:           cfg.GetCertificate,\n\t\tRootCAs:                  cfg.RootCAs,\n\t\tNextProtos:               cfg.NextProtos,\n\t\tServerName:               cfg.ServerName,\n\t\tClientAuth:               cfg.ClientAuth,\n\t\tClientCAs:                cfg.ClientCAs,\n\t\tInsecureSkipVerify:       cfg.InsecureSkipVerify,\n\t\tCipherSuites:             cfg.CipherSuites,\n\t\tPreferServerCipherSuites: cfg.PreferServerCipherSuites,\n\t\tClientSessionCache:       cfg.ClientSessionCache,\n\t\tMinVersion:               cfg.MinVersion,\n\t\tMaxVersion:               cfg.MaxVersion,\n\t\tCurvePreferences:         cfg.CurvePreferences,\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/client_server_test.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bytes\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"encoding/base64\"\n\t\"encoding/binary\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/http/cookiejar\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n)\n\nvar cstUpgrader = Upgrader{\n\tSubprotocols:      []string{\"p0\", \"p1\"},\n\tReadBufferSize:    1024,\n\tWriteBufferSize:   1024,\n\tEnableCompression: true,\n\tError: func(w http.ResponseWriter, r *http.Request, status int, reason error) {\n\t\thttp.Error(w, reason.Error(), status)\n\t},\n}\n\nvar cstDialer = Dialer{\n\tSubprotocols:     []string{\"p1\", \"p2\"},\n\tReadBufferSize:   1024,\n\tWriteBufferSize:  1024,\n\tHandshakeTimeout: 30 * time.Second,\n}\n\ntype cstHandler struct{ *testing.T }\n\ntype cstServer struct {\n\t*httptest.Server\n\tURL string\n}\n\nconst (\n\tcstPath       = \"/a/b\"\n\tcstRawQuery   = \"x=y\"\n\tcstRequestURI = cstPath + \"?\" + cstRawQuery\n)\n\nfunc newServer(t *testing.T) *cstServer {\n\tvar s cstServer\n\ts.Server = httptest.NewServer(cstHandler{t})\n\ts.Server.URL += cstRequestURI\n\ts.URL = makeWsProto(s.Server.URL)\n\treturn &s\n}\n\nfunc newTLSServer(t *testing.T) *cstServer {\n\tvar s cstServer\n\ts.Server = httptest.NewTLSServer(cstHandler{t})\n\ts.Server.URL += cstRequestURI\n\ts.URL = makeWsProto(s.Server.URL)\n\treturn &s\n}\n\nfunc (t cstHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != cstPath {\n\t\tt.Logf(\"path=%v, want %v\", r.URL.Path, cstPath)\n\t\thttp.Error(w, \"bad path\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif r.URL.RawQuery != cstRawQuery {\n\t\tt.Logf(\"query=%v, want %v\", r.URL.RawQuery, cstRawQuery)\n\t\thttp.Error(w, \"bad path\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tsubprotos := Subprotocols(r)\n\tif !reflect.DeepEqual(subprotos, cstDialer.Subprotocols) {\n\t\tt.Logf(\"subprotols=%v, want %v\", subprotos, cstDialer.Subprotocols)\n\t\thttp.Error(w, \"bad protocol\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tws, err := cstUpgrader.Upgrade(w, r, http.Header{\"Set-Cookie\": {\"sessionID=1234\"}})\n\tif err != nil {\n\t\tt.Logf(\"Upgrade: %v\", err)\n\t\treturn\n\t}\n\tdefer ws.Close()\n\n\tif ws.Subprotocol() != \"p1\" {\n\t\tt.Logf(\"Subprotocol() = %s, want p1\", ws.Subprotocol())\n\t\tws.Close()\n\t\treturn\n\t}\n\top, rd, err := ws.NextReader()\n\tif err != nil {\n\t\tt.Logf(\"NextReader: %v\", err)\n\t\treturn\n\t}\n\twr, err := ws.NextWriter(op)\n\tif err != nil {\n\t\tt.Logf(\"NextWriter: %v\", err)\n\t\treturn\n\t}\n\tif _, err = io.Copy(wr, rd); err != nil {\n\t\tt.Logf(\"NextWriter: %v\", err)\n\t\treturn\n\t}\n\tif err := wr.Close(); err != nil {\n\t\tt.Logf(\"Close: %v\", err)\n\t\treturn\n\t}\n}\n\nfunc makeWsProto(s string) string {\n\treturn \"ws\" + strings.TrimPrefix(s, \"http\")\n}\n\nfunc sendRecv(t *testing.T, ws *Conn) {\n\tconst message = \"Hello World!\"\n\tif err := ws.SetWriteDeadline(time.Now().Add(time.Second)); err != nil {\n\t\tt.Fatalf(\"SetWriteDeadline: %v\", err)\n\t}\n\tif err := ws.WriteMessage(TextMessage, []byte(message)); err != nil {\n\t\tt.Fatalf(\"WriteMessage: %v\", err)\n\t}\n\tif err := ws.SetReadDeadline(time.Now().Add(time.Second)); err != nil {\n\t\tt.Fatalf(\"SetReadDeadline: %v\", err)\n\t}\n\t_, p, err := ws.ReadMessage()\n\tif err != nil {\n\t\tt.Fatalf(\"ReadMessage: %v\", err)\n\t}\n\tif string(p) != message {\n\t\tt.Fatalf(\"message=%s, want %s\", p, message)\n\t}\n}\n\nfunc TestProxyDial(t *testing.T) {\n\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tsurl, _ := url.Parse(s.Server.URL)\n\n\tcstDialer := cstDialer // make local copy for modification on next line.\n\tcstDialer.Proxy = http.ProxyURL(surl)\n\n\tconnect := false\n\torigHandler := s.Server.Config.Handler\n\n\t// Capture the request Host header.\n\ts.Server.Config.Handler = http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tif r.Method == \"CONNECT\" {\n\t\t\t\tconnect = true\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !connect {\n\t\t\t\tt.Log(\"connect not received\")\n\t\t\t\thttp.Error(w, \"connect not received\", http.StatusMethodNotAllowed)\n\t\t\t\treturn\n\t\t\t}\n\t\t\torigHandler.ServeHTTP(w, r)\n\t\t})\n\n\tws, _, err := cstDialer.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc TestProxyAuthorizationDial(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tsurl, _ := url.Parse(s.Server.URL)\n\tsurl.User = url.UserPassword(\"username\", \"password\")\n\n\tcstDialer := cstDialer // make local copy for modification on next line.\n\tcstDialer.Proxy = http.ProxyURL(surl)\n\n\tconnect := false\n\torigHandler := s.Server.Config.Handler\n\n\t// Capture the request Host header.\n\ts.Server.Config.Handler = http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tproxyAuth := r.Header.Get(\"Proxy-Authorization\")\n\t\t\texpectedProxyAuth := \"Basic \" + base64.StdEncoding.EncodeToString([]byte(\"username:password\"))\n\t\t\tif r.Method == \"CONNECT\" && proxyAuth == expectedProxyAuth {\n\t\t\t\tconnect = true\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !connect {\n\t\t\t\tt.Log(\"connect with proxy authorization not received\")\n\t\t\t\thttp.Error(w, \"connect with proxy authorization not received\", http.StatusMethodNotAllowed)\n\t\t\t\treturn\n\t\t\t}\n\t\t\torigHandler.ServeHTTP(w, r)\n\t\t})\n\n\tws, _, err := cstDialer.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc TestDial(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tws, _, err := cstDialer.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc TestDialCookieJar(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tjar, _ := cookiejar.New(nil)\n\td := cstDialer\n\td.Jar = jar\n\n\tu, _ := url.Parse(s.URL)\n\n\tswitch u.Scheme {\n\tcase \"ws\":\n\t\tu.Scheme = \"http\"\n\tcase \"wss\":\n\t\tu.Scheme = \"https\"\n\t}\n\n\tcookies := []*http.Cookie{{Name: \"gorilla\", Value: \"ws\", Path: \"/\"}}\n\td.Jar.SetCookies(u, cookies)\n\n\tws, _, err := d.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\n\tvar gorilla string\n\tvar sessionID string\n\tfor _, c := range d.Jar.Cookies(u) {\n\t\tif c.Name == \"gorilla\" {\n\t\t\tgorilla = c.Value\n\t\t}\n\n\t\tif c.Name == \"sessionID\" {\n\t\t\tsessionID = c.Value\n\t\t}\n\t}\n\tif gorilla != \"ws\" {\n\t\tt.Error(\"Cookie not present in jar.\")\n\t}\n\n\tif sessionID != \"1234\" {\n\t\tt.Error(\"Set-Cookie not received from the server.\")\n\t}\n\n\tsendRecv(t, ws)\n}\n\nfunc TestDialTLS(t *testing.T) {\n\ts := newTLSServer(t)\n\tdefer s.Close()\n\n\tcerts := x509.NewCertPool()\n\tfor _, c := range s.TLS.Certificates {\n\t\troots, err := x509.ParseCertificates(c.Certificate[len(c.Certificate)-1])\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"error parsing server's root cert: %v\", err)\n\t\t}\n\t\tfor _, root := range roots {\n\t\t\tcerts.AddCert(root)\n\t\t}\n\t}\n\n\td := cstDialer\n\td.TLSClientConfig = &tls.Config{RootCAs: certs}\n\tws, _, err := d.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc xTestDialTLSBadCert(t *testing.T) {\n\t// This test is deactivated because of noisy logging from the net/http package.\n\ts := newTLSServer(t)\n\tdefer s.Close()\n\n\tws, _, err := cstDialer.Dial(s.URL, nil)\n\tif err == nil {\n\t\tws.Close()\n\t\tt.Fatalf(\"Dial: nil\")\n\t}\n}\n\nfunc TestDialTLSNoVerify(t *testing.T) {\n\ts := newTLSServer(t)\n\tdefer s.Close()\n\n\td := cstDialer\n\td.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\tws, _, err := d.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc TestDialTimeout(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\td := cstDialer\n\td.HandshakeTimeout = -1\n\tws, _, err := d.Dial(s.URL, nil)\n\tif err == nil {\n\t\tws.Close()\n\t\tt.Fatalf(\"Dial: nil\")\n\t}\n}\n\nfunc TestDialBadScheme(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tws, _, err := cstDialer.Dial(s.Server.URL, nil)\n\tif err == nil {\n\t\tws.Close()\n\t\tt.Fatalf(\"Dial: nil\")\n\t}\n}\n\nfunc TestDialBadOrigin(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tws, resp, err := cstDialer.Dial(s.URL, http.Header{\"Origin\": {\"bad\"}})\n\tif err == nil {\n\t\tws.Close()\n\t\tt.Fatalf(\"Dial: nil\")\n\t}\n\tif resp == nil {\n\t\tt.Fatalf(\"resp=nil, err=%v\", err)\n\t}\n\tif resp.StatusCode != http.StatusForbidden {\n\t\tt.Fatalf(\"status=%d, want %d\", resp.StatusCode, http.StatusForbidden)\n\t}\n}\n\nfunc TestDialBadHeader(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tfor _, k := range []string{\"Upgrade\",\n\t\t\"Connection\",\n\t\t\"Sec-Websocket-Key\",\n\t\t\"Sec-Websocket-Version\",\n\t\t\"Sec-Websocket-Protocol\"} {\n\t\th := http.Header{}\n\t\th.Set(k, \"bad\")\n\t\tws, _, err := cstDialer.Dial(s.URL, http.Header{\"Origin\": {\"bad\"}})\n\t\tif err == nil {\n\t\t\tws.Close()\n\t\t\tt.Errorf(\"Dial with header %s returned nil\", k)\n\t\t}\n\t}\n}\n\nfunc TestBadMethod(t *testing.T) {\n\ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tws, err := cstUpgrader.Upgrade(w, r, nil)\n\t\tif err == nil {\n\t\t\tt.Errorf(\"handshake succeeded, expect fail\")\n\t\t\tws.Close()\n\t\t}\n\t}))\n\tdefer s.Close()\n\n\treq, err := http.NewRequest(\"POST\", s.URL, strings.NewReader(\"\"))\n\tif err != nil {\n\t\tt.Fatalf(\"NewRequest returned error %v\", err)\n\t}\n\treq.Header.Set(\"Connection\", \"upgrade\")\n\treq.Header.Set(\"Upgrade\", \"websocket\")\n\treq.Header.Set(\"Sec-Websocket-Version\", \"13\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"Do returned error %v\", err)\n\t}\n\tresp.Body.Close()\n\tif resp.StatusCode != http.StatusMethodNotAllowed {\n\t\tt.Errorf(\"Status = %d, want %d\", resp.StatusCode, http.StatusMethodNotAllowed)\n\t}\n}\n\nfunc TestHandshake(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tws, resp, err := cstDialer.Dial(s.URL, http.Header{\"Origin\": {s.URL}})\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\n\tvar sessionID string\n\tfor _, c := range resp.Cookies() {\n\t\tif c.Name == \"sessionID\" {\n\t\t\tsessionID = c.Value\n\t\t}\n\t}\n\tif sessionID != \"1234\" {\n\t\tt.Error(\"Set-Cookie not received from the server.\")\n\t}\n\n\tif ws.Subprotocol() != \"p1\" {\n\t\tt.Errorf(\"ws.Subprotocol() = %s, want p1\", ws.Subprotocol())\n\t}\n\tsendRecv(t, ws)\n}\n\nfunc TestRespOnBadHandshake(t *testing.T) {\n\tconst expectedStatus = http.StatusGone\n\tconst expectedBody = \"This is the response body.\"\n\n\ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(expectedStatus)\n\t\tio.WriteString(w, expectedBody)\n\t}))\n\tdefer s.Close()\n\n\tws, resp, err := cstDialer.Dial(makeWsProto(s.URL), nil)\n\tif err == nil {\n\t\tws.Close()\n\t\tt.Fatalf(\"Dial: nil\")\n\t}\n\n\tif resp == nil {\n\t\tt.Fatalf(\"resp=nil, err=%v\", err)\n\t}\n\n\tif resp.StatusCode != expectedStatus {\n\t\tt.Errorf(\"resp.StatusCode=%d, want %d\", resp.StatusCode, expectedStatus)\n\t}\n\n\tp, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"ReadFull(resp.Body) returned error %v\", err)\n\t}\n\n\tif string(p) != expectedBody {\n\t\tt.Errorf(\"resp.Body=%s, want %s\", p, expectedBody)\n\t}\n}\n\n// TestHostHeader confirms that the host header provided in the call to Dial is\n// sent to the server.\nfunc TestHostHeader(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tspecifiedHost := make(chan string, 1)\n\torigHandler := s.Server.Config.Handler\n\n\t// Capture the request Host header.\n\ts.Server.Config.Handler = http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tspecifiedHost <- r.Host\n\t\t\torigHandler.ServeHTTP(w, r)\n\t\t})\n\n\tws, _, err := cstDialer.Dial(s.URL, http.Header{\"Host\": {\"testhost\"}})\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\n\tif gotHost := <-specifiedHost; gotHost != \"testhost\" {\n\t\tt.Fatalf(\"gotHost = %q, want \\\"testhost\\\"\", gotHost)\n\t}\n\n\tsendRecv(t, ws)\n}\n\nfunc TestDialCompression(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tdialer := cstDialer\n\tdialer.EnableCompression = true\n\tws, _, err := dialer.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n\nfunc TestSocksProxyDial(t *testing.T) {\n\ts := newServer(t)\n\tdefer s.Close()\n\n\tproxyListener, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\tif err != nil {\n\t\tt.Fatalf(\"listen failed: %v\", err)\n\t}\n\tdefer proxyListener.Close()\n\tgo func() {\n\t\tc1, err := proxyListener.Accept()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"proxy accept failed: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer c1.Close()\n\n\t\tc1.SetDeadline(time.Now().Add(30 * time.Second))\n\n\t\tbuf := make([]byte, 32)\n\t\tif _, err := io.ReadFull(c1, buf[:3]); err != nil {\n\t\t\tt.Errorf(\"read failed: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif want := []byte{5, 1, 0}; !bytes.Equal(want, buf[:len(want)]) {\n\t\t\tt.Errorf(\"read %x, want %x\", buf[:len(want)], want)\n\t\t}\n\t\tif _, err := c1.Write([]byte{5, 0}); err != nil {\n\t\t\tt.Errorf(\"write failed: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif _, err := io.ReadFull(c1, buf[:10]); err != nil {\n\t\t\tt.Errorf(\"read failed: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tif want := []byte{5, 1, 0, 1}; !bytes.Equal(want, buf[:len(want)]) {\n\t\t\tt.Errorf(\"read %x, want %x\", buf[:len(want)], want)\n\t\t\treturn\n\t\t}\n\t\tbuf[1] = 0\n\t\tif _, err := c1.Write(buf[:10]); err != nil {\n\t\t\tt.Errorf(\"write failed: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tip := net.IP(buf[4:8])\n\t\tport := binary.BigEndian.Uint16(buf[8:10])\n\n\t\tc2, err := net.DialTCP(\"tcp\", nil, &net.TCPAddr{IP: ip, Port: int(port)})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"dial failed; %v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer c2.Close()\n\t\tdone := make(chan struct{})\n\t\tgo func() {\n\t\t\tio.Copy(c1, c2)\n\t\t\tclose(done)\n\t\t}()\n\t\tio.Copy(c2, c1)\n\t\t<-done\n\t}()\n\n\tpurl, err := url.Parse(\"socks5://\" + proxyListener.Addr().String())\n\tif err != nil {\n\t\tt.Fatalf(\"parse failed: %v\", err)\n\t}\n\n\tcstDialer := cstDialer // make local copy for modification on next line.\n\tcstDialer.Proxy = http.ProxyURL(purl)\n\n\tws, _, err := cstDialer.Dial(s.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"Dial: %v\", err)\n\t}\n\tdefer ws.Close()\n\tsendRecv(t, ws)\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/client_test.go",
    "content": "// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"net/url\"\n\t\"testing\"\n)\n\nvar hostPortNoPortTests = []struct {\n\tu                    *url.URL\n\thostPort, hostNoPort string\n}{\n\t{&url.URL{Scheme: \"ws\", Host: \"example.com\"}, \"example.com:80\", \"example.com\"},\n\t{&url.URL{Scheme: \"wss\", Host: \"example.com\"}, \"example.com:443\", \"example.com\"},\n\t{&url.URL{Scheme: \"ws\", Host: \"example.com:7777\"}, \"example.com:7777\", \"example.com\"},\n\t{&url.URL{Scheme: \"wss\", Host: \"example.com:7777\"}, \"example.com:7777\", \"example.com\"},\n}\n\nfunc TestHostPortNoPort(t *testing.T) {\n\tfor _, tt := range hostPortNoPortTests {\n\t\thostPort, hostNoPort := hostPortNoPort(tt.u)\n\t\tif hostPort != tt.hostPort {\n\t\t\tt.Errorf(\"hostPortNoPort(%v) returned hostPort %q, want %q\", tt.u, hostPort, tt.hostPort)\n\t\t}\n\t\tif hostNoPort != tt.hostNoPort {\n\t\t\tt.Errorf(\"hostPortNoPort(%v) returned hostNoPort %q, want %q\", tt.u, hostNoPort, tt.hostNoPort)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/compression.go",
    "content": "// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"compress/flate\"\n\t\"errors\"\n\t\"io\"\n\t\"strings\"\n\t\"sync\"\n)\n\nconst (\n\tminCompressionLevel     = -2 // flate.HuffmanOnly not defined in Go < 1.6\n\tmaxCompressionLevel     = flate.BestCompression\n\tdefaultCompressionLevel = 1\n)\n\nvar (\n\tflateWriterPools [maxCompressionLevel - minCompressionLevel + 1]sync.Pool\n\tflateReaderPool  = sync.Pool{New: func() interface{} {\n\t\treturn flate.NewReader(nil)\n\t}}\n)\n\nfunc decompressNoContextTakeover(r io.Reader) io.ReadCloser {\n\tconst tail =\n\t// Add four bytes as specified in RFC\n\t\"\\x00\\x00\\xff\\xff\" +\n\t\t// Add final block to squelch unexpected EOF error from flate reader.\n\t\t\"\\x01\\x00\\x00\\xff\\xff\"\n\n\tfr, _ := flateReaderPool.Get().(io.ReadCloser)\n\tfr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil)\n\treturn &flateReadWrapper{fr}\n}\n\nfunc isValidCompressionLevel(level int) bool {\n\treturn minCompressionLevel <= level && level <= maxCompressionLevel\n}\n\nfunc compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser {\n\tp := &flateWriterPools[level-minCompressionLevel]\n\ttw := &truncWriter{w: w}\n\tfw, _ := p.Get().(*flate.Writer)\n\tif fw == nil {\n\t\tfw, _ = flate.NewWriter(tw, level)\n\t} else {\n\t\tfw.Reset(tw)\n\t}\n\treturn &flateWriteWrapper{fw: fw, tw: tw, p: p}\n}\n\n// truncWriter is an io.Writer that writes all but the last four bytes of the\n// stream to another io.Writer.\ntype truncWriter struct {\n\tw io.WriteCloser\n\tn int\n\tp [4]byte\n}\n\nfunc (w *truncWriter) Write(p []byte) (int, error) {\n\tn := 0\n\n\t// fill buffer first for simplicity.\n\tif w.n < len(w.p) {\n\t\tn = copy(w.p[w.n:], p)\n\t\tp = p[n:]\n\t\tw.n += n\n\t\tif len(p) == 0 {\n\t\t\treturn n, nil\n\t\t}\n\t}\n\n\tm := len(p)\n\tif m > len(w.p) {\n\t\tm = len(w.p)\n\t}\n\n\tif nn, err := w.w.Write(w.p[:m]); err != nil {\n\t\treturn n + nn, err\n\t}\n\n\tcopy(w.p[:], w.p[m:])\n\tcopy(w.p[len(w.p)-m:], p[len(p)-m:])\n\tnn, err := w.w.Write(p[:len(p)-m])\n\treturn n + nn, err\n}\n\ntype flateWriteWrapper struct {\n\tfw *flate.Writer\n\ttw *truncWriter\n\tp  *sync.Pool\n}\n\nfunc (w *flateWriteWrapper) Write(p []byte) (int, error) {\n\tif w.fw == nil {\n\t\treturn 0, errWriteClosed\n\t}\n\treturn w.fw.Write(p)\n}\n\nfunc (w *flateWriteWrapper) Close() error {\n\tif w.fw == nil {\n\t\treturn errWriteClosed\n\t}\n\terr1 := w.fw.Flush()\n\tw.p.Put(w.fw)\n\tw.fw = nil\n\tif w.tw.p != [4]byte{0, 0, 0xff, 0xff} {\n\t\treturn errors.New(\"websocket: internal error, unexpected bytes at end of flate stream\")\n\t}\n\terr2 := w.tw.w.Close()\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\treturn err2\n}\n\ntype flateReadWrapper struct {\n\tfr io.ReadCloser\n}\n\nfunc (r *flateReadWrapper) Read(p []byte) (int, error) {\n\tif r.fr == nil {\n\t\treturn 0, io.ErrClosedPipe\n\t}\n\tn, err := r.fr.Read(p)\n\tif err == io.EOF {\n\t\t// Preemptively place the reader back in the pool. This helps with\n\t\t// scenarios where the application does not call NextReader() soon after\n\t\t// this final read.\n\t\tr.Close()\n\t}\n\treturn n, err\n}\n\nfunc (r *flateReadWrapper) Close() error {\n\tif r.fr == nil {\n\t\treturn io.ErrClosedPipe\n\t}\n\terr := r.fr.Close()\n\tflateReaderPool.Put(r.fr)\n\tr.fr = nil\n\treturn err\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/compression_test.go",
    "content": "package websocket\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"testing\"\n)\n\ntype nopCloser struct{ io.Writer }\n\nfunc (nopCloser) Close() error { return nil }\n\nfunc TestTruncWriter(t *testing.T) {\n\tconst data = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlkmnopqrstuvwxyz987654321\"\n\tfor n := 1; n <= 10; n++ {\n\t\tvar b bytes.Buffer\n\t\tw := &truncWriter{w: nopCloser{&b}}\n\t\tp := []byte(data)\n\t\tfor len(p) > 0 {\n\t\t\tm := len(p)\n\t\t\tif m > n {\n\t\t\t\tm = n\n\t\t\t}\n\t\t\tw.Write(p[:m])\n\t\t\tp = p[m:]\n\t\t}\n\t\tif b.String() != data[:len(data)-len(w.p)] {\n\t\t\tt.Errorf(\"%d: %q\", n, b.String())\n\t\t}\n\t}\n}\n\nfunc textMessages(num int) [][]byte {\n\tmessages := make([][]byte, num)\n\tfor i := 0; i < num; i++ {\n\t\tmsg := fmt.Sprintf(\"planet: %d, country: %d, city: %d, street: %d\", i, i, i, i)\n\t\tmessages[i] = []byte(msg)\n\t}\n\treturn messages\n}\n\nfunc BenchmarkWriteNoCompression(b *testing.B) {\n\tw := ioutil.Discard\n\tc := newConn(fakeNetConn{Reader: nil, Writer: w}, false, 1024, 1024)\n\tmessages := textMessages(100)\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tc.WriteMessage(TextMessage, messages[i%len(messages)])\n\t}\n\tb.ReportAllocs()\n}\n\nfunc BenchmarkWriteWithCompression(b *testing.B) {\n\tw := ioutil.Discard\n\tc := newConn(fakeNetConn{Reader: nil, Writer: w}, false, 1024, 1024)\n\tmessages := textMessages(100)\n\tc.enableWriteCompression = true\n\tc.newCompressionWriter = compressNoContextTakeover\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tc.WriteMessage(TextMessage, messages[i%len(messages)])\n\t}\n\tb.ReportAllocs()\n}\n\nfunc TestValidCompressionLevel(t *testing.T) {\n\tc := newConn(fakeNetConn{}, false, 1024, 1024)\n\tfor _, level := range []int{minCompressionLevel - 1, maxCompressionLevel + 1} {\n\t\tif err := c.SetCompressionLevel(level); err == nil {\n\t\t\tt.Errorf(\"no error for level %d\", level)\n\t\t}\n\t}\n\tfor _, level := range []int{minCompressionLevel, maxCompressionLevel} {\n\t\tif err := c.SetCompressionLevel(level); err != nil {\n\t\t\tt.Errorf(\"error for level %d\", level)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bufio\"\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"math/rand\"\n\t\"net\"\n\t\"strconv\"\n\t\"sync\"\n\t\"time\"\n\t\"unicode/utf8\"\n)\n\nconst (\n\t// Frame header byte 0 bits from Section 5.2 of RFC 6455\n\tfinalBit = 1 << 7\n\trsv1Bit  = 1 << 6\n\trsv2Bit  = 1 << 5\n\trsv3Bit  = 1 << 4\n\n\t// Frame header byte 1 bits from Section 5.2 of RFC 6455\n\tmaskBit = 1 << 7\n\n\tmaxFrameHeaderSize         = 2 + 8 + 4 // Fixed header + length + mask\n\tmaxControlFramePayloadSize = 125\n\n\twriteWait = time.Second\n\n\tdefaultReadBufferSize  = 4096\n\tdefaultWriteBufferSize = 4096\n\n\tcontinuationFrame = 0\n\tnoFrame           = -1\n)\n\n// Close codes defined in RFC 6455, section 11.7.\nconst (\n\tCloseNormalClosure           = 1000\n\tCloseGoingAway               = 1001\n\tCloseProtocolError           = 1002\n\tCloseUnsupportedData         = 1003\n\tCloseNoStatusReceived        = 1005\n\tCloseAbnormalClosure         = 1006\n\tCloseInvalidFramePayloadData = 1007\n\tClosePolicyViolation         = 1008\n\tCloseMessageTooBig           = 1009\n\tCloseMandatoryExtension      = 1010\n\tCloseInternalServerErr       = 1011\n\tCloseServiceRestart          = 1012\n\tCloseTryAgainLater           = 1013\n\tCloseTLSHandshake            = 1015\n)\n\n// The message types are defined in RFC 6455, section 11.8.\nconst (\n\t// TextMessage denotes a text data message. The text message payload is\n\t// interpreted as UTF-8 encoded text data.\n\tTextMessage = 1\n\n\t// BinaryMessage denotes a binary data message.\n\tBinaryMessage = 2\n\n\t// CloseMessage denotes a close control message. The optional message\n\t// payload contains a numeric code and text. Use the FormatCloseMessage\n\t// function to format a close message payload.\n\tCloseMessage = 8\n\n\t// PingMessage denotes a ping control message. The optional message payload\n\t// is UTF-8 encoded text.\n\tPingMessage = 9\n\n\t// PongMessage denotes a pong control message. The optional message payload\n\t// is UTF-8 encoded text.\n\tPongMessage = 10\n)\n\n// ErrCloseSent is returned when the application writes a message to the\n// connection after sending a close message.\nvar ErrCloseSent = errors.New(\"websocket: close sent\")\n\n// ErrReadLimit is returned when reading a message that is larger than the\n// read limit set for the connection.\nvar ErrReadLimit = errors.New(\"websocket: read limit exceeded\")\n\n// netError satisfies the net Error interface.\ntype netError struct {\n\tmsg       string\n\ttemporary bool\n\ttimeout   bool\n}\n\nfunc (e *netError) Error() string   { return e.msg }\nfunc (e *netError) Temporary() bool { return e.temporary }\nfunc (e *netError) Timeout() bool   { return e.timeout }\n\n// CloseError represents a close message.\ntype CloseError struct {\n\t// Code is defined in RFC 6455, section 11.7.\n\tCode int\n\n\t// Text is the optional text payload.\n\tText string\n}\n\nfunc (e *CloseError) Error() string {\n\ts := []byte(\"websocket: close \")\n\ts = strconv.AppendInt(s, int64(e.Code), 10)\n\tswitch e.Code {\n\tcase CloseNormalClosure:\n\t\ts = append(s, \" (normal)\"...)\n\tcase CloseGoingAway:\n\t\ts = append(s, \" (going away)\"...)\n\tcase CloseProtocolError:\n\t\ts = append(s, \" (protocol error)\"...)\n\tcase CloseUnsupportedData:\n\t\ts = append(s, \" (unsupported data)\"...)\n\tcase CloseNoStatusReceived:\n\t\ts = append(s, \" (no status)\"...)\n\tcase CloseAbnormalClosure:\n\t\ts = append(s, \" (abnormal closure)\"...)\n\tcase CloseInvalidFramePayloadData:\n\t\ts = append(s, \" (invalid payload data)\"...)\n\tcase ClosePolicyViolation:\n\t\ts = append(s, \" (policy violation)\"...)\n\tcase CloseMessageTooBig:\n\t\ts = append(s, \" (message too big)\"...)\n\tcase CloseMandatoryExtension:\n\t\ts = append(s, \" (mandatory extension missing)\"...)\n\tcase CloseInternalServerErr:\n\t\ts = append(s, \" (internal server error)\"...)\n\tcase CloseTLSHandshake:\n\t\ts = append(s, \" (TLS handshake error)\"...)\n\t}\n\tif e.Text != \"\" {\n\t\ts = append(s, \": \"...)\n\t\ts = append(s, e.Text...)\n\t}\n\treturn string(s)\n}\n\n// IsCloseError returns boolean indicating whether the error is a *CloseError\n// with one of the specified codes.\nfunc IsCloseError(err error, codes ...int) bool {\n\tif e, ok := err.(*CloseError); ok {\n\t\tfor _, code := range codes {\n\t\t\tif e.Code == code {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}\n\n// IsUnexpectedCloseError returns boolean indicating whether the error is a\n// *CloseError with a code not in the list of expected codes.\nfunc IsUnexpectedCloseError(err error, expectedCodes ...int) bool {\n\tif e, ok := err.(*CloseError); ok {\n\t\tfor _, code := range expectedCodes {\n\t\t\tif e.Code == code {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n\nvar (\n\terrWriteTimeout        = &netError{msg: \"websocket: write timeout\", timeout: true, temporary: true}\n\terrUnexpectedEOF       = &CloseError{Code: CloseAbnormalClosure, Text: io.ErrUnexpectedEOF.Error()}\n\terrBadWriteOpCode      = errors.New(\"websocket: bad write message type\")\n\terrWriteClosed         = errors.New(\"websocket: write closed\")\n\terrInvalidControlFrame = errors.New(\"websocket: invalid control frame\")\n)\n\nfunc newMaskKey() [4]byte {\n\tn := rand.Uint32()\n\treturn [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}\n}\n\nfunc hideTempErr(err error) error {\n\tif e, ok := err.(net.Error); ok && e.Temporary() {\n\t\terr = &netError{msg: e.Error(), timeout: e.Timeout()}\n\t}\n\treturn err\n}\n\nfunc isControl(frameType int) bool {\n\treturn frameType == CloseMessage || frameType == PingMessage || frameType == PongMessage\n}\n\nfunc isData(frameType int) bool {\n\treturn frameType == TextMessage || frameType == BinaryMessage\n}\n\nvar validReceivedCloseCodes = map[int]bool{\n\t// see http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number\n\n\tCloseNormalClosure:           true,\n\tCloseGoingAway:               true,\n\tCloseProtocolError:           true,\n\tCloseUnsupportedData:         true,\n\tCloseNoStatusReceived:        false,\n\tCloseAbnormalClosure:         false,\n\tCloseInvalidFramePayloadData: true,\n\tClosePolicyViolation:         true,\n\tCloseMessageTooBig:           true,\n\tCloseMandatoryExtension:      true,\n\tCloseInternalServerErr:       true,\n\tCloseServiceRestart:          true,\n\tCloseTryAgainLater:           true,\n\tCloseTLSHandshake:            false,\n}\n\nfunc isValidReceivedCloseCode(code int) bool {\n\treturn validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999)\n}\n\n// The Conn type represents a WebSocket connection.\ntype Conn struct {\n\tconn        net.Conn\n\tisServer    bool\n\tsubprotocol string\n\n\t// Write fields\n\tmu            chan bool // used as mutex to protect write to conn\n\twriteBuf      []byte    // frame is constructed in this buffer.\n\twriteDeadline time.Time\n\twriter        io.WriteCloser // the current writer returned to the application\n\tisWriting     bool           // for best-effort concurrent write detection\n\n\twriteErrMu sync.Mutex\n\twriteErr   error\n\n\tenableWriteCompression bool\n\tcompressionLevel       int\n\tnewCompressionWriter   func(io.WriteCloser, int) io.WriteCloser\n\n\t// Read fields\n\treader        io.ReadCloser // the current reader returned to the application\n\treadErr       error\n\tbr            *bufio.Reader\n\treadRemaining int64 // bytes remaining in current frame.\n\treadFinal     bool  // true the current message has more frames.\n\treadLength    int64 // Message size.\n\treadLimit     int64 // Maximum message size.\n\treadMaskPos   int\n\treadMaskKey   [4]byte\n\thandlePong    func(string) error\n\thandlePing    func(string) error\n\thandleClose   func(int, string) error\n\treadErrCount  int\n\tmessageReader *messageReader // the current low-level reader\n\n\treadDecompress         bool // whether last read frame had RSV1 set\n\tnewDecompressionReader func(io.Reader) io.ReadCloser\n}\n\nfunc newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int) *Conn {\n\treturn newConnBRW(conn, isServer, readBufferSize, writeBufferSize, nil)\n}\n\ntype writeHook struct {\n\tp []byte\n}\n\nfunc (wh *writeHook) Write(p []byte) (int, error) {\n\twh.p = p\n\treturn len(p), nil\n}\n\nfunc newConnBRW(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, brw *bufio.ReadWriter) *Conn {\n\tmu := make(chan bool, 1)\n\tmu <- true\n\n\tvar br *bufio.Reader\n\tif readBufferSize == 0 && brw != nil && brw.Reader != nil {\n\t\t// Reuse the supplied bufio.Reader if the buffer has a useful size.\n\t\t// This code assumes that peek on a reader returns\n\t\t// bufio.Reader.buf[:0].\n\t\tbrw.Reader.Reset(conn)\n\t\tif p, err := brw.Reader.Peek(0); err == nil && cap(p) >= 256 {\n\t\t\tbr = brw.Reader\n\t\t}\n\t}\n\tif br == nil {\n\t\tif readBufferSize == 0 {\n\t\t\treadBufferSize = defaultReadBufferSize\n\t\t}\n\t\tif readBufferSize < maxControlFramePayloadSize {\n\t\t\treadBufferSize = maxControlFramePayloadSize\n\t\t}\n\t\tbr = bufio.NewReaderSize(conn, readBufferSize)\n\t}\n\n\tvar writeBuf []byte\n\tif writeBufferSize == 0 && brw != nil && brw.Writer != nil {\n\t\t// Use the bufio.Writer's buffer if the buffer has a useful size. This\n\t\t// code assumes that bufio.Writer.buf[:1] is passed to the\n\t\t// bufio.Writer's underlying writer.\n\t\tvar wh writeHook\n\t\tbrw.Writer.Reset(&wh)\n\t\tbrw.Writer.WriteByte(0)\n\t\tbrw.Flush()\n\t\tif cap(wh.p) >= maxFrameHeaderSize+256 {\n\t\t\twriteBuf = wh.p[:cap(wh.p)]\n\t\t}\n\t}\n\n\tif writeBuf == nil {\n\t\tif writeBufferSize == 0 {\n\t\t\twriteBufferSize = defaultWriteBufferSize\n\t\t}\n\t\twriteBuf = make([]byte, writeBufferSize+maxFrameHeaderSize)\n\t}\n\n\tc := &Conn{\n\t\tisServer:               isServer,\n\t\tbr:                     br,\n\t\tconn:                   conn,\n\t\tmu:                     mu,\n\t\treadFinal:              true,\n\t\twriteBuf:               writeBuf,\n\t\tenableWriteCompression: true,\n\t\tcompressionLevel:       defaultCompressionLevel,\n\t}\n\tc.SetCloseHandler(nil)\n\tc.SetPingHandler(nil)\n\tc.SetPongHandler(nil)\n\treturn c\n}\n\n// Subprotocol returns the negotiated protocol for the connection.\nfunc (c *Conn) Subprotocol() string {\n\treturn c.subprotocol\n}\n\n// Close closes the underlying network connection without sending or waiting\n// for a close message.\nfunc (c *Conn) Close() error {\n\treturn c.conn.Close()\n}\n\n// LocalAddr returns the local network address.\nfunc (c *Conn) LocalAddr() net.Addr {\n\treturn c.conn.LocalAddr()\n}\n\n// RemoteAddr returns the remote network address.\nfunc (c *Conn) RemoteAddr() net.Addr {\n\treturn c.conn.RemoteAddr()\n}\n\n// Write methods\n\nfunc (c *Conn) writeFatal(err error) error {\n\terr = hideTempErr(err)\n\tc.writeErrMu.Lock()\n\tif c.writeErr == nil {\n\t\tc.writeErr = err\n\t}\n\tc.writeErrMu.Unlock()\n\treturn err\n}\n\nfunc (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error {\n\t<-c.mu\n\tdefer func() { c.mu <- true }()\n\n\tc.writeErrMu.Lock()\n\terr := c.writeErr\n\tc.writeErrMu.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.conn.SetWriteDeadline(deadline)\n\tif len(buf1) == 0 {\n\t\t_, err = c.conn.Write(buf0)\n\t} else {\n\t\terr = c.writeBufs(buf0, buf1)\n\t}\n\tif err != nil {\n\t\treturn c.writeFatal(err)\n\t}\n\tif frameType == CloseMessage {\n\t\tc.writeFatal(ErrCloseSent)\n\t}\n\treturn nil\n}\n\n// WriteControl writes a control message with the given deadline. The allowed\n// message types are CloseMessage, PingMessage and PongMessage.\nfunc (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error {\n\tif !isControl(messageType) {\n\t\treturn errBadWriteOpCode\n\t}\n\tif len(data) > maxControlFramePayloadSize {\n\t\treturn errInvalidControlFrame\n\t}\n\n\tb0 := byte(messageType) | finalBit\n\tb1 := byte(len(data))\n\tif !c.isServer {\n\t\tb1 |= maskBit\n\t}\n\n\tbuf := make([]byte, 0, maxFrameHeaderSize+maxControlFramePayloadSize)\n\tbuf = append(buf, b0, b1)\n\n\tif c.isServer {\n\t\tbuf = append(buf, data...)\n\t} else {\n\t\tkey := newMaskKey()\n\t\tbuf = append(buf, key[:]...)\n\t\tbuf = append(buf, data...)\n\t\tmaskBytes(key, 0, buf[6:])\n\t}\n\n\td := time.Hour * 1000\n\tif !deadline.IsZero() {\n\t\td = deadline.Sub(time.Now())\n\t\tif d < 0 {\n\t\t\treturn errWriteTimeout\n\t\t}\n\t}\n\n\ttimer := time.NewTimer(d)\n\tselect {\n\tcase <-c.mu:\n\t\ttimer.Stop()\n\tcase <-timer.C:\n\t\treturn errWriteTimeout\n\t}\n\tdefer func() { c.mu <- true }()\n\n\tc.writeErrMu.Lock()\n\terr := c.writeErr\n\tc.writeErrMu.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.conn.SetWriteDeadline(deadline)\n\t_, err = c.conn.Write(buf)\n\tif err != nil {\n\t\treturn c.writeFatal(err)\n\t}\n\tif messageType == CloseMessage {\n\t\tc.writeFatal(ErrCloseSent)\n\t}\n\treturn err\n}\n\nfunc (c *Conn) prepWrite(messageType int) error {\n\t// Close previous writer if not already closed by the application. It's\n\t// probably better to return an error in this situation, but we cannot\n\t// change this without breaking existing applications.\n\tif c.writer != nil {\n\t\tc.writer.Close()\n\t\tc.writer = nil\n\t}\n\n\tif !isControl(messageType) && !isData(messageType) {\n\t\treturn errBadWriteOpCode\n\t}\n\n\tc.writeErrMu.Lock()\n\terr := c.writeErr\n\tc.writeErrMu.Unlock()\n\treturn err\n}\n\n// NextWriter returns a writer for the next message to send. The writer's Close\n// method flushes the complete message to the network.\n//\n// There can be at most one open writer on a connection. NextWriter closes the\n// previous writer if the application has not already done so.\n//\n// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and\n// PongMessage) are supported.\nfunc (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {\n\tif err := c.prepWrite(messageType); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmw := &messageWriter{\n\t\tc:         c,\n\t\tframeType: messageType,\n\t\tpos:       maxFrameHeaderSize,\n\t}\n\tc.writer = mw\n\tif c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {\n\t\tw := c.newCompressionWriter(c.writer, c.compressionLevel)\n\t\tmw.compress = true\n\t\tc.writer = w\n\t}\n\treturn c.writer, nil\n}\n\ntype messageWriter struct {\n\tc         *Conn\n\tcompress  bool // whether next call to flushFrame should set RSV1\n\tpos       int  // end of data in writeBuf.\n\tframeType int  // type of the current frame.\n\terr       error\n}\n\nfunc (w *messageWriter) fatal(err error) error {\n\tif w.err != nil {\n\t\tw.err = err\n\t\tw.c.writer = nil\n\t}\n\treturn err\n}\n\n// flushFrame writes buffered data and extra as a frame to the network. The\n// final argument indicates that this is the last frame in the message.\nfunc (w *messageWriter) flushFrame(final bool, extra []byte) error {\n\tc := w.c\n\tlength := w.pos - maxFrameHeaderSize + len(extra)\n\n\t// Check for invalid control frames.\n\tif isControl(w.frameType) &&\n\t\t(!final || length > maxControlFramePayloadSize) {\n\t\treturn w.fatal(errInvalidControlFrame)\n\t}\n\n\tb0 := byte(w.frameType)\n\tif final {\n\t\tb0 |= finalBit\n\t}\n\tif w.compress {\n\t\tb0 |= rsv1Bit\n\t}\n\tw.compress = false\n\n\tb1 := byte(0)\n\tif !c.isServer {\n\t\tb1 |= maskBit\n\t}\n\n\t// Assume that the frame starts at beginning of c.writeBuf.\n\tframePos := 0\n\tif c.isServer {\n\t\t// Adjust up if mask not included in the header.\n\t\tframePos = 4\n\t}\n\n\tswitch {\n\tcase length >= 65536:\n\t\tc.writeBuf[framePos] = b0\n\t\tc.writeBuf[framePos+1] = b1 | 127\n\t\tbinary.BigEndian.PutUint64(c.writeBuf[framePos+2:], uint64(length))\n\tcase length > 125:\n\t\tframePos += 6\n\t\tc.writeBuf[framePos] = b0\n\t\tc.writeBuf[framePos+1] = b1 | 126\n\t\tbinary.BigEndian.PutUint16(c.writeBuf[framePos+2:], uint16(length))\n\tdefault:\n\t\tframePos += 8\n\t\tc.writeBuf[framePos] = b0\n\t\tc.writeBuf[framePos+1] = b1 | byte(length)\n\t}\n\n\tif !c.isServer {\n\t\tkey := newMaskKey()\n\t\tcopy(c.writeBuf[maxFrameHeaderSize-4:], key[:])\n\t\tmaskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos])\n\t\tif len(extra) > 0 {\n\t\t\treturn c.writeFatal(errors.New(\"websocket: internal error, extra used in client mode\"))\n\t\t}\n\t}\n\n\t// Write the buffers to the connection with best-effort detection of\n\t// concurrent writes. See the concurrency section in the package\n\t// documentation for more info.\n\n\tif c.isWriting {\n\t\tpanic(\"concurrent write to websocket connection\")\n\t}\n\tc.isWriting = true\n\n\terr := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra)\n\n\tif !c.isWriting {\n\t\tpanic(\"concurrent write to websocket connection\")\n\t}\n\tc.isWriting = false\n\n\tif err != nil {\n\t\treturn w.fatal(err)\n\t}\n\n\tif final {\n\t\tc.writer = nil\n\t\treturn nil\n\t}\n\n\t// Setup for next frame.\n\tw.pos = maxFrameHeaderSize\n\tw.frameType = continuationFrame\n\treturn nil\n}\n\nfunc (w *messageWriter) ncopy(max int) (int, error) {\n\tn := len(w.c.writeBuf) - w.pos\n\tif n <= 0 {\n\t\tif err := w.flushFrame(false, nil); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tn = len(w.c.writeBuf) - w.pos\n\t}\n\tif n > max {\n\t\tn = max\n\t}\n\treturn n, nil\n}\n\nfunc (w *messageWriter) Write(p []byte) (int, error) {\n\tif w.err != nil {\n\t\treturn 0, w.err\n\t}\n\n\tif len(p) > 2*len(w.c.writeBuf) && w.c.isServer {\n\t\t// Don't buffer large messages.\n\t\terr := w.flushFrame(false, p)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn len(p), nil\n\t}\n\n\tnn := len(p)\n\tfor len(p) > 0 {\n\t\tn, err := w.ncopy(len(p))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tcopy(w.c.writeBuf[w.pos:], p[:n])\n\t\tw.pos += n\n\t\tp = p[n:]\n\t}\n\treturn nn, nil\n}\n\nfunc (w *messageWriter) WriteString(p string) (int, error) {\n\tif w.err != nil {\n\t\treturn 0, w.err\n\t}\n\n\tnn := len(p)\n\tfor len(p) > 0 {\n\t\tn, err := w.ncopy(len(p))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tcopy(w.c.writeBuf[w.pos:], p[:n])\n\t\tw.pos += n\n\t\tp = p[n:]\n\t}\n\treturn nn, nil\n}\n\nfunc (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) {\n\tif w.err != nil {\n\t\treturn 0, w.err\n\t}\n\tfor {\n\t\tif w.pos == len(w.c.writeBuf) {\n\t\t\terr = w.flushFrame(false, nil)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tvar n int\n\t\tn, err = r.Read(w.c.writeBuf[w.pos:])\n\t\tw.pos += n\n\t\tnn += int64(n)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nn, err\n}\n\nfunc (w *messageWriter) Close() error {\n\tif w.err != nil {\n\t\treturn w.err\n\t}\n\tif err := w.flushFrame(true, nil); err != nil {\n\t\treturn err\n\t}\n\tw.err = errWriteClosed\n\treturn nil\n}\n\n// WritePreparedMessage writes prepared message into connection.\nfunc (c *Conn) WritePreparedMessage(pm *PreparedMessage) error {\n\tframeType, frameData, err := pm.frame(prepareKey{\n\t\tisServer:         c.isServer,\n\t\tcompress:         c.newCompressionWriter != nil && c.enableWriteCompression && isData(pm.messageType),\n\t\tcompressionLevel: c.compressionLevel,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.isWriting {\n\t\tpanic(\"concurrent write to websocket connection\")\n\t}\n\tc.isWriting = true\n\terr = c.write(frameType, c.writeDeadline, frameData, nil)\n\tif !c.isWriting {\n\t\tpanic(\"concurrent write to websocket connection\")\n\t}\n\tc.isWriting = false\n\treturn err\n}\n\n// WriteMessage is a helper method for getting a writer using NextWriter,\n// writing the message and closing the writer.\nfunc (c *Conn) WriteMessage(messageType int, data []byte) error {\n\n\tif c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {\n\t\t// Fast path with no allocations and single frame.\n\n\t\tif err := c.prepWrite(messageType); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmw := messageWriter{c: c, frameType: messageType, pos: maxFrameHeaderSize}\n\t\tn := copy(c.writeBuf[mw.pos:], data)\n\t\tmw.pos += n\n\t\tdata = data[n:]\n\t\treturn mw.flushFrame(true, data)\n\t}\n\n\tw, err := c.NextWriter(messageType)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = w.Write(data); err != nil {\n\t\treturn err\n\t}\n\treturn w.Close()\n}\n\n// SetWriteDeadline sets the write deadline on the underlying network\n// connection. After a write has timed out, the websocket state is corrupt and\n// all future writes will return an error. A zero value for t means writes will\n// not time out.\nfunc (c *Conn) SetWriteDeadline(t time.Time) error {\n\tc.writeDeadline = t\n\treturn nil\n}\n\n// Read methods\n\nfunc (c *Conn) advanceFrame() (int, error) {\n\t// 1. Skip remainder of previous frame.\n\n\tif c.readRemaining > 0 {\n\t\tif _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t}\n\n\t// 2. Read and parse first two bytes of frame header.\n\n\tp, err := c.read(2)\n\tif err != nil {\n\t\treturn noFrame, err\n\t}\n\n\tfinal := p[0]&finalBit != 0\n\tframeType := int(p[0] & 0xf)\n\tmask := p[1]&maskBit != 0\n\tc.readRemaining = int64(p[1] & 0x7f)\n\n\tc.readDecompress = false\n\tif c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 {\n\t\tc.readDecompress = true\n\t\tp[0] &^= rsv1Bit\n\t}\n\n\tif rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 {\n\t\treturn noFrame, c.handleProtocolError(\"unexpected reserved bits 0x\" + strconv.FormatInt(int64(rsv), 16))\n\t}\n\n\tswitch frameType {\n\tcase CloseMessage, PingMessage, PongMessage:\n\t\tif c.readRemaining > maxControlFramePayloadSize {\n\t\t\treturn noFrame, c.handleProtocolError(\"control frame length > 125\")\n\t\t}\n\t\tif !final {\n\t\t\treturn noFrame, c.handleProtocolError(\"control frame not final\")\n\t\t}\n\tcase TextMessage, BinaryMessage:\n\t\tif !c.readFinal {\n\t\t\treturn noFrame, c.handleProtocolError(\"message start before final message frame\")\n\t\t}\n\t\tc.readFinal = final\n\tcase continuationFrame:\n\t\tif c.readFinal {\n\t\t\treturn noFrame, c.handleProtocolError(\"continuation after final message frame\")\n\t\t}\n\t\tc.readFinal = final\n\tdefault:\n\t\treturn noFrame, c.handleProtocolError(\"unknown opcode \" + strconv.Itoa(frameType))\n\t}\n\n\t// 3. Read and parse frame length.\n\n\tswitch c.readRemaining {\n\tcase 126:\n\t\tp, err := c.read(2)\n\t\tif err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t\tc.readRemaining = int64(binary.BigEndian.Uint16(p))\n\tcase 127:\n\t\tp, err := c.read(8)\n\t\tif err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t\tc.readRemaining = int64(binary.BigEndian.Uint64(p))\n\t}\n\n\t// 4. Handle frame masking.\n\n\tif mask != c.isServer {\n\t\treturn noFrame, c.handleProtocolError(\"incorrect mask flag\")\n\t}\n\n\tif mask {\n\t\tc.readMaskPos = 0\n\t\tp, err := c.read(len(c.readMaskKey))\n\t\tif err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t\tcopy(c.readMaskKey[:], p)\n\t}\n\n\t// 5. For text and binary messages, enforce read limit and return.\n\n\tif frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage {\n\n\t\tc.readLength += c.readRemaining\n\t\tif c.readLimit > 0 && c.readLength > c.readLimit {\n\t\t\tc.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, \"\"), time.Now().Add(writeWait))\n\t\t\treturn noFrame, ErrReadLimit\n\t\t}\n\n\t\treturn frameType, nil\n\t}\n\n\t// 6. Read control frame payload.\n\n\tvar payload []byte\n\tif c.readRemaining > 0 {\n\t\tpayload, err = c.read(int(c.readRemaining))\n\t\tc.readRemaining = 0\n\t\tif err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t\tif c.isServer {\n\t\t\tmaskBytes(c.readMaskKey, 0, payload)\n\t\t}\n\t}\n\n\t// 7. Process control frame payload.\n\n\tswitch frameType {\n\tcase PongMessage:\n\t\tif err := c.handlePong(string(payload)); err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\tcase PingMessage:\n\t\tif err := c.handlePing(string(payload)); err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\tcase CloseMessage:\n\t\tcloseCode := CloseNoStatusReceived\n\t\tcloseText := \"\"\n\t\tif len(payload) >= 2 {\n\t\t\tcloseCode = int(binary.BigEndian.Uint16(payload))\n\t\t\tif !isValidReceivedCloseCode(closeCode) {\n\t\t\t\treturn noFrame, c.handleProtocolError(\"invalid close code\")\n\t\t\t}\n\t\t\tcloseText = string(payload[2:])\n\t\t\tif !utf8.ValidString(closeText) {\n\t\t\t\treturn noFrame, c.handleProtocolError(\"invalid utf8 payload in close frame\")\n\t\t\t}\n\t\t}\n\t\tif err := c.handleClose(closeCode, closeText); err != nil {\n\t\t\treturn noFrame, err\n\t\t}\n\t\treturn noFrame, &CloseError{Code: closeCode, Text: closeText}\n\t}\n\n\treturn frameType, nil\n}\n\nfunc (c *Conn) handleProtocolError(message string) error {\n\tc.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait))\n\treturn errors.New(\"websocket: \" + message)\n}\n\n// NextReader returns the next data message received from the peer. The\n// returned messageType is either TextMessage or BinaryMessage.\n//\n// There can be at most one open reader on a connection. NextReader discards\n// the previous message if the application has not already consumed it.\n//\n// Applications must break out of the application's read loop when this method\n// returns a non-nil error value. Errors returned from this method are\n// permanent. Once this method returns a non-nil error, all subsequent calls to\n// this method return the same error.\nfunc (c *Conn) NextReader() (messageType int, r io.Reader, err error) {\n\t// Close previous reader, only relevant for decompression.\n\tif c.reader != nil {\n\t\tc.reader.Close()\n\t\tc.reader = nil\n\t}\n\n\tc.messageReader = nil\n\tc.readLength = 0\n\n\tfor c.readErr == nil {\n\t\tframeType, err := c.advanceFrame()\n\t\tif err != nil {\n\t\t\tc.readErr = hideTempErr(err)\n\t\t\tbreak\n\t\t}\n\t\tif frameType == TextMessage || frameType == BinaryMessage {\n\t\t\tc.messageReader = &messageReader{c}\n\t\t\tc.reader = c.messageReader\n\t\t\tif c.readDecompress {\n\t\t\t\tc.reader = c.newDecompressionReader(c.reader)\n\t\t\t}\n\t\t\treturn frameType, c.reader, nil\n\t\t}\n\t}\n\n\t// Applications that do handle the error returned from this method spin in\n\t// tight loop on connection failure. To help application developers detect\n\t// this error, panic on repeated reads to the failed connection.\n\tc.readErrCount++\n\tif c.readErrCount >= 1000 {\n\t\tpanic(\"repeated read on failed websocket connection\")\n\t}\n\n\treturn noFrame, nil, c.readErr\n}\n\ntype messageReader struct{ c *Conn }\n\nfunc (r *messageReader) Read(b []byte) (int, error) {\n\tc := r.c\n\tif c.messageReader != r {\n\t\treturn 0, io.EOF\n\t}\n\n\tfor c.readErr == nil {\n\n\t\tif c.readRemaining > 0 {\n\t\t\tif int64(len(b)) > c.readRemaining {\n\t\t\t\tb = b[:c.readRemaining]\n\t\t\t}\n\t\t\tn, err := c.br.Read(b)\n\t\t\tc.readErr = hideTempErr(err)\n\t\t\tif c.isServer {\n\t\t\t\tc.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n])\n\t\t\t}\n\t\t\tc.readRemaining -= int64(n)\n\t\t\tif c.readRemaining > 0 && c.readErr == io.EOF {\n\t\t\t\tc.readErr = errUnexpectedEOF\n\t\t\t}\n\t\t\treturn n, c.readErr\n\t\t}\n\n\t\tif c.readFinal {\n\t\t\tc.messageReader = nil\n\t\t\treturn 0, io.EOF\n\t\t}\n\n\t\tframeType, err := c.advanceFrame()\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\tc.readErr = hideTempErr(err)\n\t\tcase frameType == TextMessage || frameType == BinaryMessage:\n\t\t\tc.readErr = errors.New(\"websocket: internal error, unexpected text or binary in Reader\")\n\t\t}\n\t}\n\n\terr := c.readErr\n\tif err == io.EOF && c.messageReader == r {\n\t\terr = errUnexpectedEOF\n\t}\n\treturn 0, err\n}\n\nfunc (r *messageReader) Close() error {\n\treturn nil\n}\n\n// ReadMessage is a helper method for getting a reader using NextReader and\n// reading from that reader to a buffer.\nfunc (c *Conn) ReadMessage() (messageType int, p []byte, err error) {\n\tvar r io.Reader\n\tmessageType, r, err = c.NextReader()\n\tif err != nil {\n\t\treturn messageType, nil, err\n\t}\n\tp, err = ioutil.ReadAll(r)\n\treturn messageType, p, err\n}\n\n// SetReadDeadline sets the read deadline on the underlying network connection.\n// After a read has timed out, the websocket connection state is corrupt and\n// all future reads will return an error. A zero value for t means reads will\n// not time out.\nfunc (c *Conn) SetReadDeadline(t time.Time) error {\n\treturn c.conn.SetReadDeadline(t)\n}\n\n// SetReadLimit sets the maximum size for a message read from the peer. If a\n// message exceeds the limit, the connection sends a close message to the peer\n// and returns ErrReadLimit to the application.\nfunc (c *Conn) SetReadLimit(limit int64) {\n\tc.readLimit = limit\n}\n\n// CloseHandler returns the current close handler\nfunc (c *Conn) CloseHandler() func(code int, text string) error {\n\treturn c.handleClose\n}\n\n// SetCloseHandler sets the handler for close messages received from the peer.\n// The code argument to h is the received close code or CloseNoStatusReceived\n// if the close message is empty. The default close handler sends a close\n// message back to the peer.\n//\n// The handler function is called from the NextReader, ReadMessage and message\n// reader Read methods. The application must read the connection to process\n// close messages as described in the section on Control Messages above.\n//\n// The connection read methods return a CloseError when a close message is\n// received. Most applications should handle close messages as part of their\n// normal error handling. Applications should only set a close handler when the\n// application must perform some action before sending a close message back to\n// the peer.\nfunc (c *Conn) SetCloseHandler(h func(code int, text string) error) {\n\tif h == nil {\n\t\th = func(code int, text string) error {\n\t\t\tmessage := FormatCloseMessage(code, \"\")\n\t\t\tc.WriteControl(CloseMessage, message, time.Now().Add(writeWait))\n\t\t\treturn nil\n\t\t}\n\t}\n\tc.handleClose = h\n}\n\n// PingHandler returns the current ping handler\nfunc (c *Conn) PingHandler() func(appData string) error {\n\treturn c.handlePing\n}\n\n// SetPingHandler sets the handler for ping messages received from the peer.\n// The appData argument to h is the PING message application data. The default\n// ping handler sends a pong to the peer.\n//\n// The handler function is called from the NextReader, ReadMessage and message\n// reader Read methods. The application must read the connection to process\n// ping messages as described in the section on Control Messages above.\nfunc (c *Conn) SetPingHandler(h func(appData string) error) {\n\tif h == nil {\n\t\th = func(message string) error {\n\t\t\terr := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))\n\t\t\tif err == ErrCloseSent {\n\t\t\t\treturn nil\n\t\t\t} else if e, ok := err.(net.Error); ok && e.Temporary() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\tc.handlePing = h\n}\n\n// PongHandler returns the current pong handler\nfunc (c *Conn) PongHandler() func(appData string) error {\n\treturn c.handlePong\n}\n\n// SetPongHandler sets the handler for pong messages received from the peer.\n// The appData argument to h is the PONG message application data. The default\n// pong handler does nothing.\n//\n// The handler function is called from the NextReader, ReadMessage and message\n// reader Read methods. The application must read the connection to process\n// pong messages as described in the section on Control Messages above.\nfunc (c *Conn) SetPongHandler(h func(appData string) error) {\n\tif h == nil {\n\t\th = func(string) error { return nil }\n\t}\n\tc.handlePong = h\n}\n\n// UnderlyingConn returns the internal net.Conn. This can be used to further\n// modifications to connection specific flags.\nfunc (c *Conn) UnderlyingConn() net.Conn {\n\treturn c.conn\n}\n\n// EnableWriteCompression enables and disables write compression of\n// subsequent text and binary messages. This function is a noop if\n// compression was not negotiated with the peer.\nfunc (c *Conn) EnableWriteCompression(enable bool) {\n\tc.enableWriteCompression = enable\n}\n\n// SetCompressionLevel sets the flate compression level for subsequent text and\n// binary messages. This function is a noop if compression was not negotiated\n// with the peer. See the compress/flate package for a description of\n// compression levels.\nfunc (c *Conn) SetCompressionLevel(level int) error {\n\tif !isValidCompressionLevel(level) {\n\t\treturn errors.New(\"websocket: invalid compression level\")\n\t}\n\tc.compressionLevel = level\n\treturn nil\n}\n\n// FormatCloseMessage formats closeCode and text as a WebSocket close message.\n// An empty message is returned for code CloseNoStatusReceived.\nfunc FormatCloseMessage(closeCode int, text string) []byte {\n\tif closeCode == CloseNoStatusReceived {\n\t\t// Return empty message because it's illegal to send\n\t\t// CloseNoStatusReceived. Return non-nil value in case application\n\t\t// checks for nil.\n\t\treturn []byte{}\n\t}\n\tbuf := make([]byte, 2+len(text))\n\tbinary.BigEndian.PutUint16(buf, uint16(closeCode))\n\tcopy(buf[2:], text)\n\treturn buf\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_broadcast_test.go",
    "content": "// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build go1.7\n\npackage websocket\n\nimport (\n\t\"io\"\n\t\"io/ioutil\"\n\t\"sync/atomic\"\n\t\"testing\"\n)\n\n// broadcastBench allows to run broadcast benchmarks.\n// In every broadcast benchmark we create many connections, then send the same\n// message into every connection and wait for all writes complete. This emulates\n// an application where many connections listen to the same data - i.e. PUB/SUB\n// scenarios with many subscribers in one channel.\ntype broadcastBench struct {\n\tw           io.Writer\n\tmessage     *broadcastMessage\n\tcloseCh     chan struct{}\n\tdoneCh      chan struct{}\n\tcount       int32\n\tconns       []*broadcastConn\n\tcompression bool\n\tusePrepared bool\n}\n\ntype broadcastMessage struct {\n\tpayload  []byte\n\tprepared *PreparedMessage\n}\n\ntype broadcastConn struct {\n\tconn  *Conn\n\tmsgCh chan *broadcastMessage\n}\n\nfunc newBroadcastConn(c *Conn) *broadcastConn {\n\treturn &broadcastConn{\n\t\tconn:  c,\n\t\tmsgCh: make(chan *broadcastMessage, 1),\n\t}\n}\n\nfunc newBroadcastBench(usePrepared, compression bool) *broadcastBench {\n\tbench := &broadcastBench{\n\t\tw:           ioutil.Discard,\n\t\tdoneCh:      make(chan struct{}),\n\t\tcloseCh:     make(chan struct{}),\n\t\tusePrepared: usePrepared,\n\t\tcompression: compression,\n\t}\n\tmsg := &broadcastMessage{\n\t\tpayload: textMessages(1)[0],\n\t}\n\tif usePrepared {\n\t\tpm, _ := NewPreparedMessage(TextMessage, msg.payload)\n\t\tmsg.prepared = pm\n\t}\n\tbench.message = msg\n\tbench.makeConns(10000)\n\treturn bench\n}\n\nfunc (b *broadcastBench) makeConns(numConns int) {\n\tconns := make([]*broadcastConn, numConns)\n\n\tfor i := 0; i < numConns; i++ {\n\t\tc := newConn(fakeNetConn{Reader: nil, Writer: b.w}, true, 1024, 1024)\n\t\tif b.compression {\n\t\t\tc.enableWriteCompression = true\n\t\t\tc.newCompressionWriter = compressNoContextTakeover\n\t\t}\n\t\tconns[i] = newBroadcastConn(c)\n\t\tgo func(c *broadcastConn) {\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase msg := <-c.msgCh:\n\t\t\t\t\tif b.usePrepared {\n\t\t\t\t\t\tc.conn.WritePreparedMessage(msg.prepared)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.conn.WriteMessage(TextMessage, msg.payload)\n\t\t\t\t\t}\n\t\t\t\t\tval := atomic.AddInt32(&b.count, 1)\n\t\t\t\t\tif val%int32(numConns) == 0 {\n\t\t\t\t\t\tb.doneCh <- struct{}{}\n\t\t\t\t\t}\n\t\t\t\tcase <-b.closeCh:\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}(conns[i])\n\t}\n\tb.conns = conns\n}\n\nfunc (b *broadcastBench) close() {\n\tclose(b.closeCh)\n}\n\nfunc (b *broadcastBench) runOnce() {\n\tfor _, c := range b.conns {\n\t\tc.msgCh <- b.message\n\t}\n\t<-b.doneCh\n}\n\nfunc BenchmarkBroadcast(b *testing.B) {\n\tbenchmarks := []struct {\n\t\tname        string\n\t\tusePrepared bool\n\t\tcompression bool\n\t}{\n\t\t{\"NoCompression\", false, false},\n\t\t{\"WithCompression\", false, true},\n\t\t{\"NoCompressionPrepared\", true, false},\n\t\t{\"WithCompressionPrepared\", true, true},\n\t}\n\tfor _, bm := range benchmarks {\n\t\tb.Run(bm.name, func(b *testing.B) {\n\t\t\tbench := newBroadcastBench(bm.usePrepared, bm.compression)\n\t\t\tdefer bench.close()\n\t\t\tb.ResetTimer()\n\t\t\tfor i := 0; i < b.N; i++ {\n\t\t\t\tbench.runOnce()\n\t\t\t}\n\t\t\tb.ReportAllocs()\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_read.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build go1.5\n\npackage websocket\n\nimport \"io\"\n\nfunc (c *Conn) read(n int) ([]byte, error) {\n\tp, err := c.br.Peek(n)\n\tif err == io.EOF {\n\t\terr = errUnexpectedEOF\n\t}\n\tc.br.Discard(len(p))\n\treturn p, err\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_read_legacy.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build !go1.5\n\npackage websocket\n\nimport \"io\"\n\nfunc (c *Conn) read(n int) ([]byte, error) {\n\tp, err := c.br.Peek(n)\n\tif err == io.EOF {\n\t\terr = errUnexpectedEOF\n\t}\n\tif len(p) > 0 {\n\t\t// advance over the bytes just read\n\t\tio.ReadFull(c.br, p)\n\t}\n\treturn p, err\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_test.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"reflect\"\n\t\"testing\"\n\t\"testing/iotest\"\n\t\"time\"\n)\n\nvar _ net.Error = errWriteTimeout\n\ntype fakeNetConn struct {\n\tio.Reader\n\tio.Writer\n}\n\nfunc (c fakeNetConn) Close() error                       { return nil }\nfunc (c fakeNetConn) LocalAddr() net.Addr                { return localAddr }\nfunc (c fakeNetConn) RemoteAddr() net.Addr               { return remoteAddr }\nfunc (c fakeNetConn) SetDeadline(t time.Time) error      { return nil }\nfunc (c fakeNetConn) SetReadDeadline(t time.Time) error  { return nil }\nfunc (c fakeNetConn) SetWriteDeadline(t time.Time) error { return nil }\n\ntype fakeAddr int\n\nvar (\n\tlocalAddr  = fakeAddr(1)\n\tremoteAddr = fakeAddr(2)\n)\n\nfunc (a fakeAddr) Network() string {\n\treturn \"net\"\n}\n\nfunc (a fakeAddr) String() string {\n\treturn \"str\"\n}\n\nfunc TestFraming(t *testing.T) {\n\tframeSizes := []int{0, 1, 2, 124, 125, 126, 127, 128, 129, 65534, 65535, 65536, 65537}\n\tvar readChunkers = []struct {\n\t\tname string\n\t\tf    func(io.Reader) io.Reader\n\t}{\n\t\t{\"half\", iotest.HalfReader},\n\t\t{\"one\", iotest.OneByteReader},\n\t\t{\"asis\", func(r io.Reader) io.Reader { return r }},\n\t}\n\twriteBuf := make([]byte, 65537)\n\tfor i := range writeBuf {\n\t\twriteBuf[i] = byte(i)\n\t}\n\tvar writers = []struct {\n\t\tname string\n\t\tf    func(w io.Writer, n int) (int, error)\n\t}{\n\t\t{\"iocopy\", func(w io.Writer, n int) (int, error) {\n\t\t\tnn, err := io.Copy(w, bytes.NewReader(writeBuf[:n]))\n\t\t\treturn int(nn), err\n\t\t}},\n\t\t{\"write\", func(w io.Writer, n int) (int, error) {\n\t\t\treturn w.Write(writeBuf[:n])\n\t\t}},\n\t\t{\"string\", func(w io.Writer, n int) (int, error) {\n\t\t\treturn io.WriteString(w, string(writeBuf[:n]))\n\t\t}},\n\t}\n\n\tfor _, compress := range []bool{false, true} {\n\t\tfor _, isServer := range []bool{true, false} {\n\t\t\tfor _, chunker := range readChunkers {\n\n\t\t\t\tvar connBuf bytes.Buffer\n\t\t\t\twc := newConn(fakeNetConn{Reader: nil, Writer: &connBuf}, isServer, 1024, 1024)\n\t\t\t\trc := newConn(fakeNetConn{Reader: chunker.f(&connBuf), Writer: nil}, !isServer, 1024, 1024)\n\t\t\t\tif compress {\n\t\t\t\t\twc.newCompressionWriter = compressNoContextTakeover\n\t\t\t\t\trc.newDecompressionReader = decompressNoContextTakeover\n\t\t\t\t}\n\t\t\t\tfor _, n := range frameSizes {\n\t\t\t\t\tfor _, writer := range writers {\n\t\t\t\t\t\tname := fmt.Sprintf(\"z:%v, s:%v, r:%s, n:%d w:%s\", compress, isServer, chunker.name, n, writer.name)\n\n\t\t\t\t\t\tw, err := wc.NextWriter(TextMessage)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tt.Errorf(\"%s: wc.NextWriter() returned %v\", name, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnn, err := writer.f(w, n)\n\t\t\t\t\t\tif err != nil || nn != n {\n\t\t\t\t\t\t\tt.Errorf(\"%s: w.Write(writeBuf[:n]) returned %d, %v\", name, nn, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\terr = w.Close()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tt.Errorf(\"%s: w.Close() returned %v\", name, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topCode, r, err := rc.NextReader()\n\t\t\t\t\t\tif err != nil || opCode != TextMessage {\n\t\t\t\t\t\t\tt.Errorf(\"%s: NextReader() returned %d, r, %v\", name, opCode, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\trbuf, err := ioutil.ReadAll(r)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tt.Errorf(\"%s: ReadFull() returned rbuf, %v\", name, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif len(rbuf) != n {\n\t\t\t\t\t\t\tt.Errorf(\"%s: len(rbuf) is %d, want %d\", name, len(rbuf), n)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor i, b := range rbuf {\n\t\t\t\t\t\t\tif byte(i) != b {\n\t\t\t\t\t\t\t\tt.Errorf(\"%s: bad byte at offset %d\", name, i)\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc TestControl(t *testing.T) {\n\tconst message = \"this is a ping/pong messsage\"\n\tfor _, isServer := range []bool{true, false} {\n\t\tfor _, isWriteControl := range []bool{true, false} {\n\t\t\tname := fmt.Sprintf(\"s:%v, wc:%v\", isServer, isWriteControl)\n\t\t\tvar connBuf bytes.Buffer\n\t\t\twc := newConn(fakeNetConn{Reader: nil, Writer: &connBuf}, isServer, 1024, 1024)\n\t\t\trc := newConn(fakeNetConn{Reader: &connBuf, Writer: nil}, !isServer, 1024, 1024)\n\t\t\tif isWriteControl {\n\t\t\t\twc.WriteControl(PongMessage, []byte(message), time.Now().Add(time.Second))\n\t\t\t} else {\n\t\t\t\tw, err := wc.NextWriter(PongMessage)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"%s: wc.NextWriter() returned %v\", name, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif _, err := w.Write([]byte(message)); err != nil {\n\t\t\t\t\tt.Errorf(\"%s: w.Write() returned %v\", name, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err := w.Close(); err != nil {\n\t\t\t\t\tt.Errorf(\"%s: w.Close() returned %v\", name, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvar actualMessage string\n\t\t\t\trc.SetPongHandler(func(s string) error { actualMessage = s; return nil })\n\t\t\t\trc.NextReader()\n\t\t\t\tif actualMessage != message {\n\t\t\t\t\tt.Errorf(\"%s: pong=%q, want %q\", name, actualMessage, message)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc TestCloseFrameBeforeFinalMessageFrame(t *testing.T) {\n\tconst bufSize = 512\n\n\texpectedErr := &CloseError{Code: CloseNormalClosure, Text: \"hello\"}\n\n\tvar b1, b2 bytes.Buffer\n\twc := newConn(fakeNetConn{Reader: nil, Writer: &b1}, false, 1024, bufSize)\n\trc := newConn(fakeNetConn{Reader: &b1, Writer: &b2}, true, 1024, 1024)\n\n\tw, _ := wc.NextWriter(BinaryMessage)\n\tw.Write(make([]byte, bufSize+bufSize/2))\n\twc.WriteControl(CloseMessage, FormatCloseMessage(expectedErr.Code, expectedErr.Text), time.Now().Add(10*time.Second))\n\tw.Close()\n\n\top, r, err := rc.NextReader()\n\tif op != BinaryMessage || err != nil {\n\t\tt.Fatalf(\"NextReader() returned %d, %v\", op, err)\n\t}\n\t_, err = io.Copy(ioutil.Discard, r)\n\tif !reflect.DeepEqual(err, expectedErr) {\n\t\tt.Fatalf(\"io.Copy() returned %v, want %v\", err, expectedErr)\n\t}\n\t_, _, err = rc.NextReader()\n\tif !reflect.DeepEqual(err, expectedErr) {\n\t\tt.Fatalf(\"NextReader() returned %v, want %v\", err, expectedErr)\n\t}\n}\n\nfunc TestEOFWithinFrame(t *testing.T) {\n\tconst bufSize = 64\n\n\tfor n := 0; ; n++ {\n\t\tvar b bytes.Buffer\n\t\twc := newConn(fakeNetConn{Reader: nil, Writer: &b}, false, 1024, 1024)\n\t\trc := newConn(fakeNetConn{Reader: &b, Writer: nil}, true, 1024, 1024)\n\n\t\tw, _ := wc.NextWriter(BinaryMessage)\n\t\tw.Write(make([]byte, bufSize))\n\t\tw.Close()\n\n\t\tif n >= b.Len() {\n\t\t\tbreak\n\t\t}\n\t\tb.Truncate(n)\n\n\t\top, r, err := rc.NextReader()\n\t\tif err == errUnexpectedEOF {\n\t\t\tcontinue\n\t\t}\n\t\tif op != BinaryMessage || err != nil {\n\t\t\tt.Fatalf(\"%d: NextReader() returned %d, %v\", n, op, err)\n\t\t}\n\t\t_, err = io.Copy(ioutil.Discard, r)\n\t\tif err != errUnexpectedEOF {\n\t\t\tt.Fatalf(\"%d: io.Copy() returned %v, want %v\", n, err, errUnexpectedEOF)\n\t\t}\n\t\t_, _, err = rc.NextReader()\n\t\tif err != errUnexpectedEOF {\n\t\t\tt.Fatalf(\"%d: NextReader() returned %v, want %v\", n, err, errUnexpectedEOF)\n\t\t}\n\t}\n}\n\nfunc TestEOFBeforeFinalFrame(t *testing.T) {\n\tconst bufSize = 512\n\n\tvar b1, b2 bytes.Buffer\n\twc := newConn(fakeNetConn{Reader: nil, Writer: &b1}, false, 1024, bufSize)\n\trc := newConn(fakeNetConn{Reader: &b1, Writer: &b2}, true, 1024, 1024)\n\n\tw, _ := wc.NextWriter(BinaryMessage)\n\tw.Write(make([]byte, bufSize+bufSize/2))\n\n\top, r, err := rc.NextReader()\n\tif op != BinaryMessage || err != nil {\n\t\tt.Fatalf(\"NextReader() returned %d, %v\", op, err)\n\t}\n\t_, err = io.Copy(ioutil.Discard, r)\n\tif err != errUnexpectedEOF {\n\t\tt.Fatalf(\"io.Copy() returned %v, want %v\", err, errUnexpectedEOF)\n\t}\n\t_, _, err = rc.NextReader()\n\tif err != errUnexpectedEOF {\n\t\tt.Fatalf(\"NextReader() returned %v, want %v\", err, errUnexpectedEOF)\n\t}\n}\n\nfunc TestWriteAfterMessageWriterClose(t *testing.T) {\n\twc := newConn(fakeNetConn{Reader: nil, Writer: &bytes.Buffer{}}, false, 1024, 1024)\n\tw, _ := wc.NextWriter(BinaryMessage)\n\tio.WriteString(w, \"hello\")\n\tif err := w.Close(); err != nil {\n\t\tt.Fatalf(\"unxpected error closing message writer, %v\", err)\n\t}\n\n\tif _, err := io.WriteString(w, \"world\"); err == nil {\n\t\tt.Fatalf(\"no error writing after close\")\n\t}\n\n\tw, _ = wc.NextWriter(BinaryMessage)\n\tio.WriteString(w, \"hello\")\n\n\t// close w by getting next writer\n\t_, err := wc.NextWriter(BinaryMessage)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error getting next writer, %v\", err)\n\t}\n\n\tif _, err := io.WriteString(w, \"world\"); err == nil {\n\t\tt.Fatalf(\"no error writing after close\")\n\t}\n}\n\nfunc TestReadLimit(t *testing.T) {\n\n\tconst readLimit = 512\n\tmessage := make([]byte, readLimit+1)\n\n\tvar b1, b2 bytes.Buffer\n\twc := newConn(fakeNetConn{Reader: nil, Writer: &b1}, false, 1024, readLimit-2)\n\trc := newConn(fakeNetConn{Reader: &b1, Writer: &b2}, true, 1024, 1024)\n\trc.SetReadLimit(readLimit)\n\n\t// Send message at the limit with interleaved pong.\n\tw, _ := wc.NextWriter(BinaryMessage)\n\tw.Write(message[:readLimit-1])\n\twc.WriteControl(PongMessage, []byte(\"this is a pong\"), time.Now().Add(10*time.Second))\n\tw.Write(message[:1])\n\tw.Close()\n\n\t// Send message larger than the limit.\n\twc.WriteMessage(BinaryMessage, message[:readLimit+1])\n\n\top, _, err := rc.NextReader()\n\tif op != BinaryMessage || err != nil {\n\t\tt.Fatalf(\"1: NextReader() returned %d, %v\", op, err)\n\t}\n\top, r, err := rc.NextReader()\n\tif op != BinaryMessage || err != nil {\n\t\tt.Fatalf(\"2: NextReader() returned %d, %v\", op, err)\n\t}\n\t_, err = io.Copy(ioutil.Discard, r)\n\tif err != ErrReadLimit {\n\t\tt.Fatalf(\"io.Copy() returned %v\", err)\n\t}\n}\n\nfunc TestAddrs(t *testing.T) {\n\tc := newConn(&fakeNetConn{}, true, 1024, 1024)\n\tif c.LocalAddr() != localAddr {\n\t\tt.Errorf(\"LocalAddr = %v, want %v\", c.LocalAddr(), localAddr)\n\t}\n\tif c.RemoteAddr() != remoteAddr {\n\t\tt.Errorf(\"RemoteAddr = %v, want %v\", c.RemoteAddr(), remoteAddr)\n\t}\n}\n\nfunc TestUnderlyingConn(t *testing.T) {\n\tvar b1, b2 bytes.Buffer\n\tfc := fakeNetConn{Reader: &b1, Writer: &b2}\n\tc := newConn(fc, true, 1024, 1024)\n\tul := c.UnderlyingConn()\n\tif ul != fc {\n\t\tt.Fatalf(\"Underlying conn is not what it should be.\")\n\t}\n}\n\nfunc TestBufioReadBytes(t *testing.T) {\n\t// Test calling bufio.ReadBytes for value longer than read buffer size.\n\n\tm := make([]byte, 512)\n\tm[len(m)-1] = '\\n'\n\n\tvar b1, b2 bytes.Buffer\n\twc := newConn(fakeNetConn{Reader: nil, Writer: &b1}, false, len(m)+64, len(m)+64)\n\trc := newConn(fakeNetConn{Reader: &b1, Writer: &b2}, true, len(m)-64, len(m)-64)\n\n\tw, _ := wc.NextWriter(BinaryMessage)\n\tw.Write(m)\n\tw.Close()\n\n\top, r, err := rc.NextReader()\n\tif op != BinaryMessage || err != nil {\n\t\tt.Fatalf(\"NextReader() returned %d, %v\", op, err)\n\t}\n\n\tbr := bufio.NewReader(r)\n\tp, err := br.ReadBytes('\\n')\n\tif err != nil {\n\t\tt.Fatalf(\"ReadBytes() returned %v\", err)\n\t}\n\tif len(p) != len(m) {\n\t\tt.Fatalf(\"read returned %d bytes, want %d bytes\", len(p), len(m))\n\t}\n}\n\nvar closeErrorTests = []struct {\n\terr   error\n\tcodes []int\n\tok    bool\n}{\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNormalClosure}, true},\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNoStatusReceived}, false},\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNoStatusReceived, CloseNormalClosure}, true},\n\t{errors.New(\"hello\"), []int{CloseNormalClosure}, false},\n}\n\nfunc TestCloseError(t *testing.T) {\n\tfor _, tt := range closeErrorTests {\n\t\tok := IsCloseError(tt.err, tt.codes...)\n\t\tif ok != tt.ok {\n\t\t\tt.Errorf(\"IsCloseError(%#v, %#v) returned %v, want %v\", tt.err, tt.codes, ok, tt.ok)\n\t\t}\n\t}\n}\n\nvar unexpectedCloseErrorTests = []struct {\n\terr   error\n\tcodes []int\n\tok    bool\n}{\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNormalClosure}, false},\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNoStatusReceived}, true},\n\t{&CloseError{Code: CloseNormalClosure}, []int{CloseNoStatusReceived, CloseNormalClosure}, false},\n\t{errors.New(\"hello\"), []int{CloseNormalClosure}, false},\n}\n\nfunc TestUnexpectedCloseErrors(t *testing.T) {\n\tfor _, tt := range unexpectedCloseErrorTests {\n\t\tok := IsUnexpectedCloseError(tt.err, tt.codes...)\n\t\tif ok != tt.ok {\n\t\t\tt.Errorf(\"IsUnexpectedCloseError(%#v, %#v) returned %v, want %v\", tt.err, tt.codes, ok, tt.ok)\n\t\t}\n\t}\n}\n\ntype blockingWriter struct {\n\tc1, c2 chan struct{}\n}\n\nfunc (w blockingWriter) Write(p []byte) (int, error) {\n\t// Allow main to continue\n\tclose(w.c1)\n\t// Wait for panic in main\n\t<-w.c2\n\treturn len(p), nil\n}\n\nfunc TestConcurrentWritePanic(t *testing.T) {\n\tw := blockingWriter{make(chan struct{}), make(chan struct{})}\n\tc := newConn(fakeNetConn{Reader: nil, Writer: w}, false, 1024, 1024)\n\tgo func() {\n\t\tc.WriteMessage(TextMessage, []byte{})\n\t}()\n\n\t// wait for goroutine to block in write.\n\t<-w.c1\n\n\tdefer func() {\n\t\tclose(w.c2)\n\t\tif v := recover(); v != nil {\n\t\t\treturn\n\t\t}\n\t}()\n\n\tc.WriteMessage(TextMessage, []byte{})\n\tt.Fatal(\"should not get here\")\n}\n\ntype failingReader struct{}\n\nfunc (r failingReader) Read(p []byte) (int, error) {\n\treturn 0, io.EOF\n}\n\nfunc TestFailedConnectionReadPanic(t *testing.T) {\n\tc := newConn(fakeNetConn{Reader: failingReader{}, Writer: nil}, false, 1024, 1024)\n\n\tdefer func() {\n\t\tif v := recover(); v != nil {\n\t\t\treturn\n\t\t}\n\t}()\n\n\tfor i := 0; i < 20000; i++ {\n\t\tc.ReadMessage()\n\t}\n\tt.Fatal(\"should not get here\")\n}\n\nfunc TestBufioReuse(t *testing.T) {\n\tbrw := bufio.NewReadWriter(bufio.NewReader(nil), bufio.NewWriter(nil))\n\tc := newConnBRW(nil, false, 0, 0, brw)\n\n\tif c.br != brw.Reader {\n\t\tt.Error(\"connection did not reuse bufio.Reader\")\n\t}\n\n\tvar wh writeHook\n\tbrw.Writer.Reset(&wh)\n\tbrw.WriteByte(0)\n\tbrw.Flush()\n\tif &c.writeBuf[0] != &wh.p[0] {\n\t\tt.Error(\"connection did not reuse bufio.Writer\")\n\t}\n\n\tbrw = bufio.NewReadWriter(bufio.NewReaderSize(nil, 0), bufio.NewWriterSize(nil, 0))\n\tc = newConnBRW(nil, false, 0, 0, brw)\n\n\tif c.br == brw.Reader {\n\t\tt.Error(\"connection used bufio.Reader with small size\")\n\t}\n\n\tbrw.Writer.Reset(&wh)\n\tbrw.WriteByte(0)\n\tbrw.Flush()\n\tif &c.writeBuf[0] != &wh.p[0] {\n\t\tt.Error(\"connection used bufio.Writer with small size\")\n\t}\n\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_write.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build go1.8\n\npackage websocket\n\nimport \"net\"\n\nfunc (c *Conn) writeBufs(bufs ...[]byte) error {\n\tb := net.Buffers(bufs)\n\t_, err := b.WriteTo(c.conn)\n\treturn err\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/conn_write_legacy.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build !go1.8\n\npackage websocket\n\nfunc (c *Conn) writeBufs(bufs ...[]byte) error {\n\tfor _, buf := range bufs {\n\t\tif len(buf) > 0 {\n\t\t\tif _, err := c.conn.Write(buf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/doc.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package websocket implements the WebSocket protocol defined in RFC 6455.\n//\n// Overview\n//\n// The Conn type represents a WebSocket connection. A server application calls\n// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn:\n//\n//  var upgrader = websocket.Upgrader{\n//      ReadBufferSize:  1024,\n//      WriteBufferSize: 1024,\n//  }\n//\n//  func handler(w http.ResponseWriter, r *http.Request) {\n//      conn, err := upgrader.Upgrade(w, r, nil)\n//      if err != nil {\n//          glog.Println(err)\n//          return\n//      }\n//      ... Use conn to send and receive messages.\n//  }\n//\n// Call the connection's WriteMessage and ReadMessage methods to send and\n// receive messages as a slice of bytes. This snippet of code shows how to echo\n// messages using these methods:\n//\n//  for {\n//      messageType, p, err := conn.ReadMessage()\n//      if err != nil {\n//          glog.Println(err)\n//          return\n//      }\n//      if err := conn.WriteMessage(messageType, p); err != nil {\n//          glog.Println(err)\n//          return\n//      }\n//  }\n//\n// In above snippet of code, p is a []byte and messageType is an int with value\n// websocket.BinaryMessage or websocket.TextMessage.\n//\n// An application can also send and receive messages using the io.WriteCloser\n// and io.Reader interfaces. To send a message, call the connection NextWriter\n// method to get an io.WriteCloser, write the message to the writer and close\n// the writer when done. To receive a message, call the connection NextReader\n// method to get an io.Reader and read until io.EOF is returned. This snippet\n// shows how to echo messages using the NextWriter and NextReader methods:\n//\n//  for {\n//      messageType, r, err := conn.NextReader()\n//      if err != nil {\n//          return\n//      }\n//      w, err := conn.NextWriter(messageType)\n//      if err != nil {\n//          return err\n//      }\n//      if _, err := io.Copy(w, r); err != nil {\n//          return err\n//      }\n//      if err := w.Close(); err != nil {\n//          return err\n//      }\n//  }\n//\n// Data Messages\n//\n// The WebSocket protocol distinguishes between text and binary data messages.\n// Text messages are interpreted as UTF-8 encoded text. The interpretation of\n// binary messages is left to the application.\n//\n// This package uses the TextMessage and BinaryMessage integer constants to\n// identify the two data message types. The ReadMessage and NextReader methods\n// return the type of the received message. The messageType argument to the\n// WriteMessage and NextWriter methods specifies the type of a sent message.\n//\n// It is the application's responsibility to ensure that text messages are\n// valid UTF-8 encoded text.\n//\n// Control Messages\n//\n// The WebSocket protocol defines three types of control messages: close, ping\n// and pong. Call the connection WriteControl, WriteMessage or NextWriter\n// methods to send a control message to the peer.\n//\n// Connections handle received close messages by calling the handler function\n// set with the SetCloseHandler method and by returning a *CloseError from the\n// NextReader, ReadMessage or the message Read method. The default close\n// handler sends a close message to the peer.\n//\n// Connections handle received ping messages by calling the handler function\n// set with the SetPingHandler method. The default ping handler sends a pong\n// message to the peer.\n//\n// Connections handle received pong messages by calling the handler function\n// set with the SetPongHandler method. The default pong handler does nothing.\n// If an application sends ping messages, then the application should set a\n// pong handler to receive the corresponding pong.\n//\n// The control message handler functions are called from the NextReader,\n// ReadMessage and message reader Read methods. The default close and ping\n// handlers can block these methods for a short time when the handler writes to\n// the connection.\n//\n// The application must read the connection to process close, ping and pong\n// messages sent from the peer. If the application is not otherwise interested\n// in messages from the peer, then the application should start a goroutine to\n// read and discard messages from the peer. A simple example is:\n//\n//  func readLoop(c *websocket.Conn) {\n//      for {\n//          if _, _, err := c.NextReader(); err != nil {\n//              c.Close()\n//              break\n//          }\n//      }\n//  }\n//\n// Concurrency\n//\n// Connections support one concurrent reader and one concurrent writer.\n//\n// Applications are responsible for ensuring that no more than one goroutine\n// calls the write methods (NextWriter, SetWriteDeadline, WriteMessage,\n// WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and\n// that no more than one goroutine calls the read methods (NextReader,\n// SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler)\n// concurrently.\n//\n// The Close and WriteControl methods can be called concurrently with all other\n// methods.\n//\n// Origin Considerations\n//\n// Web browsers allow Javascript applications to open a WebSocket connection to\n// any host. It's up to the server to enforce an origin policy using the Origin\n// request header sent by the browser.\n//\n// The Upgrader calls the function specified in the CheckOrigin field to check\n// the origin. If the CheckOrigin function returns false, then the Upgrade\n// method fails the WebSocket handshake with HTTP status 403.\n//\n// If the CheckOrigin field is nil, then the Upgrader uses a safe default: fail\n// the handshake if the Origin request header is present and the Origin host is\n// not equal to the Host request header.\n//\n// The deprecated package-level Upgrade function does not perform origin\n// checking. The application is responsible for checking the Origin header\n// before calling the Upgrade function.\n//\n// Compression EXPERIMENTAL\n//\n// Per message compression extensions (RFC 7692) are experimentally supported\n// by this package in a limited capacity. Setting the EnableCompression option\n// to true in Dialer or Upgrader will attempt to negotiate per message deflate\n// support.\n//\n//  var upgrader = websocket.Upgrader{\n//      EnableCompression: true,\n//  }\n//\n// If compression was successfully negotiated with the connection's peer, any\n// message received in compressed form will be automatically decompressed.\n// All Read methods will return uncompressed bytes.\n//\n// Per message compression of messages written to a connection can be enabled\n// or disabled by calling the corresponding Conn method:\n//\n//  conn.EnableWriteCompression(false)\n//\n// Currently this package does not support compression with \"context takeover\".\n// This means that messages must be compressed and decompressed in isolation,\n// without retaining sliding window or dictionary state across messages. For\n// more details refer to RFC 7692.\n//\n// Use of compression is experimental and may result in decreased performance.\npackage websocket\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/example_test.go",
    "content": "// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket_test\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"testing\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nvar (\n\tc   *websocket.Conn\n\treq *http.Request\n)\n\n// The websocket.IsUnexpectedCloseError function is useful for identifying\n// application and protocol errors.\n//\n// This server application works with a client application running in the\n// browser. The client application does not explicitly close the websocket. The\n// only expected close message from the client has the code\n// websocket.CloseGoingAway. All other other close messages are likely the\n// result of an application or protocol error and are logged to aid debugging.\nfunc ExampleIsUnexpectedCloseError() {\n\n\tfor {\n\t\tmessageType, p, err := c.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\tlog.Printf(\"error: %v, user-agent: %v\", err, req.Header.Get(\"User-Agent\"))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tprocessMesage(messageType, p)\n\t}\n}\n\nfunc processMesage(mt int, p []byte) {}\n\n// TestX prevents godoc from showing this entire file in the example. Remove\n// this function when a second example is added.\nfunc TestX(t *testing.T) {}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/autobahn/README.md",
    "content": "# Test Server\n\nThis package contains a server for the [Autobahn WebSockets Test Suite](http://autobahn.ws/testsuite).\n\nTo test the server, run\n\n    go run server.go\n\nand start the client test driver\n\n    wstest -m fuzzingclient -s fuzzingclient.json\n\nWhen the client completes, it writes a report to reports/clients/index.html.\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/autobahn/fuzzingclient.json",
    "content": "\n{\n   \"options\": {\"failByDrop\": false},\n   \"outdir\": \"./reports/clients\",\n   \"servers\": [\n        {\"agent\": \"ReadAllWriteMessage\", \"url\": \"ws://localhost:9000/m\", \"options\": {\"version\": 18}},\n        {\"agent\": \"ReadAllWritePreparedMessage\", \"url\": \"ws://localhost:9000/p\", \"options\": {\"version\": 18}},\n        {\"agent\": \"ReadAllWrite\", \"url\": \"ws://localhost:9000/r\", \"options\": {\"version\": 18}},\n        {\"agent\": \"CopyFull\", \"url\": \"ws://localhost:9000/f\", \"options\": {\"version\": 18}},\n        {\"agent\": \"CopyWriterOnly\", \"url\": \"ws://localhost:9000/c\", \"options\": {\"version\": 18}}\n    ],\n   \"cases\": [\"*\"],\n   \"exclude-cases\": [],\n   \"exclude-agent-cases\": {}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/autobahn/server.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Command server is a test server for the Autobahn WebSockets Test Suite.\npackage main\n\nimport (\n\t\"errors\"\n\t\"flag\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"time\"\n\t\"unicode/utf8\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nvar upgrader = websocket.Upgrader{\n\tReadBufferSize:    4096,\n\tWriteBufferSize:   4096,\n\tEnableCompression: true,\n\tCheckOrigin: func(r *http.Request) bool {\n\t\treturn true\n\t},\n}\n\n// echoCopy echoes messages from the client using io.Copy.\nfunc echoCopy(w http.ResponseWriter, r *http.Request, writerOnly bool) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Upgrade:\", err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tfor {\n\t\tmt, r, err := conn.NextReader()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Println(\"NextReader:\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif mt == websocket.TextMessage {\n\t\t\tr = &validator{r: r}\n\t\t}\n\t\tw, err := conn.NextWriter(mt)\n\t\tif err != nil {\n\t\t\tlog.Println(\"NextWriter:\", err)\n\t\t\treturn\n\t\t}\n\t\tif mt == websocket.TextMessage {\n\t\t\tr = &validator{r: r}\n\t\t}\n\t\tif writerOnly {\n\t\t\t_, err = io.Copy(struct{ io.Writer }{w}, r)\n\t\t} else {\n\t\t\t_, err = io.Copy(w, r)\n\t\t}\n\t\tif err != nil {\n\t\t\tif err == errInvalidUTF8 {\n\t\t\t\tconn.WriteControl(websocket.CloseMessage,\n\t\t\t\t\twebsocket.FormatCloseMessage(websocket.CloseInvalidFramePayloadData, \"\"),\n\t\t\t\t\ttime.Time{})\n\t\t\t}\n\t\t\tlog.Println(\"Copy:\", err)\n\t\t\treturn\n\t\t}\n\t\terr = w.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(\"Close:\", err)\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc echoCopyWriterOnly(w http.ResponseWriter, r *http.Request) {\n\techoCopy(w, r, true)\n}\n\nfunc echoCopyFull(w http.ResponseWriter, r *http.Request) {\n\techoCopy(w, r, false)\n}\n\n// echoReadAll echoes messages from the client by reading the entire message\n// with ioutil.ReadAll.\nfunc echoReadAll(w http.ResponseWriter, r *http.Request, writeMessage, writePrepared bool) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"Upgrade:\", err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tfor {\n\t\tmt, b, err := conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Println(\"NextReader:\", err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif mt == websocket.TextMessage {\n\t\t\tif !utf8.Valid(b) {\n\t\t\t\tconn.WriteControl(websocket.CloseMessage,\n\t\t\t\t\twebsocket.FormatCloseMessage(websocket.CloseInvalidFramePayloadData, \"\"),\n\t\t\t\t\ttime.Time{})\n\t\t\t\tlog.Println(\"ReadAll: invalid utf8\")\n\t\t\t}\n\t\t}\n\t\tif writeMessage {\n\t\t\tif !writePrepared {\n\t\t\t\terr = conn.WriteMessage(mt, b)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"WriteMessage:\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpm, err := websocket.NewPreparedMessage(mt, b)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"NewPreparedMessage:\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terr = conn.WritePreparedMessage(pm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"WritePreparedMessage:\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tw, err := conn.NextWriter(mt)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"NextWriter:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif _, err := w.Write(b); err != nil {\n\t\t\t\tlog.Println(\"Writer:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\tlog.Println(\"Close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc echoReadAllWriter(w http.ResponseWriter, r *http.Request) {\n\techoReadAll(w, r, false, false)\n}\n\nfunc echoReadAllWriteMessage(w http.ResponseWriter, r *http.Request) {\n\techoReadAll(w, r, true, false)\n}\n\nfunc echoReadAllWritePreparedMessage(w http.ResponseWriter, r *http.Request) {\n\techoReadAll(w, r, true, true)\n}\n\nfunc serveHome(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.Error(w, \"Not found.\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tio.WriteString(w, \"<html><body>Echo Server</body></html>\")\n}\n\nvar addr = flag.String(\"addr\", \":9000\", \"http service address\")\n\nfunc main() {\n\tflag.Parse()\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/c\", echoCopyWriterOnly)\n\thttp.HandleFunc(\"/f\", echoCopyFull)\n\thttp.HandleFunc(\"/r\", echoReadAllWriter)\n\thttp.HandleFunc(\"/m\", echoReadAllWriteMessage)\n\thttp.HandleFunc(\"/p\", echoReadAllWritePreparedMessage)\n\terr := http.ListenAndServe(*addr, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n\ntype validator struct {\n\tstate int\n\tx     rune\n\tr     io.Reader\n}\n\nvar errInvalidUTF8 = errors.New(\"invalid utf8\")\n\nfunc (r *validator) Read(p []byte) (int, error) {\n\tn, err := r.r.Read(p)\n\tstate := r.state\n\tx := r.x\n\tfor _, b := range p[:n] {\n\t\tstate, x = decode(state, x, b)\n\t\tif state == utf8Reject {\n\t\t\tbreak\n\t\t}\n\t}\n\tr.state = state\n\tr.x = x\n\tif state == utf8Reject || (err == io.EOF && state != utf8Accept) {\n\t\treturn n, errInvalidUTF8\n\t}\n\treturn n, err\n}\n\n// UTF-8 decoder from http://bjoern.hoehrmann.de/utf-8/decoder/dfa/\n//\n// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\nvar utf8d = [...]byte{\n\t0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1f\n\t0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3f\n\t0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5f\n\t0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7f\n\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9f\n\t7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // a0..bf\n\t8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // c0..df\n\t0xa, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // e0..ef\n\t0xb, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // f0..ff\n\t0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0\n\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2\n\t1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4\n\t1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6\n\t1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // s7..s8\n}\n\nconst (\n\tutf8Accept = 0\n\tutf8Reject = 1\n)\n\nfunc decode(state int, x rune, b byte) (int, rune) {\n\tt := utf8d[b]\n\tif state != utf8Accept {\n\t\tx = rune(b&0x3f) | (x << 6)\n\t} else {\n\t\tx = rune((0xff >> t) & b)\n\t}\n\tstate = int(utf8d[256+state*16+int(t)])\n\treturn state, x\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/chat/README.md",
    "content": "# Chat Example\n\nThis application shows how to use the\n[websocket](https://github.com/gorilla/websocket) package to implement a simple\nweb chat application.\n\n## Running the example\n\nThe example requires a working Go development environment. The [Getting\nStarted](http://golang.org/doc/install) page describes how to install the\ndevelopment environment.\n\nOnce you have Go up and running, you can download, build and run the example\nusing the following commands.\n\n    $ go get github.com/gorilla/websocket\n    $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/chat`\n    $ go run *.go\n\nTo use the chat example, open http://localhost:8080/ in your browser.\n\n## Server\n\nThe server application defines two types, `Client` and `Hub`. The server\ncreates an instance of the `Client` type for each websocket connection. A\n`Client` acts as an intermediary between the websocket connection and a single\ninstance of the `Hub` type. The `Hub` maintains a set of registered clients and\nbroadcasts messages to the clients.\n\nThe application runs one goroutine for the `Hub` and two goroutines for each\n`Client`. The goroutines communicate with each other using channels. The `Hub`\nhas channels for registering clients, unregistering clients and broadcasting\nmessages. A `Client` has a buffered channel of outbound messages. One of the\nclient's goroutines reads messages from this channel and writes the messages to\nthe websocket. The other client goroutine reads messages from the websocket and\nsends them to the hub.\n\n### Hub \n\nThe code for the `Hub` type is in\n[hub.go](https://github.com/gorilla/websocket/blob/master/examples/chat/hub.go). \nThe application's `main` function starts the hub's `run` method as a goroutine.\nClients send requests to the hub using the `register`, `unregister` and\n`broadcast` channels.\n\nThe hub registers clients by adding the client pointer as a key in the\n`clients` map. The map value is always true.\n\nThe unregister code is a little more complicated. In addition to deleting the\nclient pointer from the `clients` map, the hub closes the clients's `send`\nchannel to signal the client that no more messages will be sent to the client.\n\nThe hub handles messages by looping over the registered clients and sending the\nmessage to the client's `send` channel. If the client's `send` buffer is full,\nthen the hub assumes that the client is dead or stuck. In this case, the hub\nunregisters the client and closes the websocket.\n\n### Client\n\nThe code for the `Client` type is in [client.go](https://github.com/gorilla/websocket/blob/master/examples/chat/client.go).\n\nThe `serveWs` function is registered by the application's `main` function as\nan HTTP handler. The handler upgrades the HTTP connection to the WebSocket\nprotocol, creates a client, registers the client with the hub and schedules the\nclient to be unregistered using a defer statement.\n\nNext, the HTTP handler starts the client's `writePump` method as a goroutine.\nThis method transfers messages from the client's send channel to the websocket\nconnection. The writer method exits when the channel is closed by the hub or\nthere's an error writing to the websocket connection.\n\nFinally, the HTTP handler calls the client's `readPump` method. This method\ntransfers inbound messages from the websocket to the hub.\n\nWebSocket connections [support one concurrent reader and one concurrent\nwriter](https://godoc.org/github.com/gorilla/websocket#hdr-Concurrency). The\napplication ensures that these concurrency requirements are met by executing\nall reads from the `readPump` goroutine and all writes from the `writePump`\ngoroutine.\n\nTo improve efficiency under high load, the `writePump` function coalesces\npending chat messages in the `send` channel to a single WebSocket message. This\nreduces the number of system calls and the amount of data sent over the\nnetwork.\n\n## Frontend\n\nThe frontend code is in [home.html](https://github.com/gorilla/websocket/blob/master/examples/chat/home.html).\n\nOn document load, the script checks for websocket functionality in the browser.\nIf websocket functionality is available, then the script opens a connection to\nthe server and registers a callback to handle messages from the server. The\ncallback appends the message to the chat log using the appendLog function.\n\nTo allow the user to manually scroll through the chat log without interruption\nfrom new messages, the `appendLog` function checks the scroll position before\nadding new content. If the chat log is scrolled to the bottom, then the\nfunction scrolls new content into view after adding the content. Otherwise, the\nscroll position is not changed.\n\nThe form handler writes the user input to the websocket and clears the input\nfield.\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/chat/client.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nconst (\n\t// Time allowed to write a message to the peer.\n\twriteWait = 10 * time.Second\n\n\t// Time allowed to read the next pong message from the peer.\n\tpongWait = 60 * time.Second\n\n\t// Send pings to peer with this period. Must be less than pongWait.\n\tpingPeriod = (pongWait * 9) / 10\n\n\t// Maximum message size allowed from peer.\n\tmaxMessageSize = 512\n)\n\nvar (\n\tnewline = []byte{'\\n'}\n\tspace   = []byte{' '}\n)\n\nvar upgrader = websocket.Upgrader{\n\tReadBufferSize:  1024,\n\tWriteBufferSize: 1024,\n}\n\n// Client is a middleman between the websocket connection and the hub.\ntype Client struct {\n\thub *Hub\n\n\t// The websocket connection.\n\tconn *websocket.Conn\n\n\t// Buffered channel of outbound messages.\n\tsend chan []byte\n}\n\n// readPump pumps messages from the websocket connection to the hub.\n//\n// The application runs readPump in a per-connection goroutine. The application\n// ensures that there is at most one reader on a connection by executing all\n// reads from this goroutine.\nfunc (c *Client) readPump() {\n\tdefer func() {\n\t\tc.hub.unregister <- c\n\t\tc.conn.Close()\n\t}()\n\tc.conn.SetReadLimit(maxMessageSize)\n\tc.conn.SetReadDeadline(time.Now().Add(pongWait))\n\tc.conn.SetPongHandler(func(string) error { c.conn.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tmessage = bytes.TrimSpace(bytes.Replace(message, newline, space, -1))\n\t\tc.hub.broadcast <- message\n\t}\n}\n\n// writePump pumps messages from the hub to the websocket connection.\n//\n// A goroutine running writePump is started for each connection. The\n// application ensures that there is at most one writer to a connection by\n// executing all writes from this goroutine.\nfunc (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// serveWs handles websocket requests from the peer.\nfunc serveWs(hub *Hub, w http.ResponseWriter, r *http.Request) {\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tclient := &Client{hub: hub, conn: conn, send: make(chan []byte, 256)}\n\tclient.hub.register <- client\n\n\t// Allow collection of memory referenced by the caller by doing all work in\n\t// new goroutines.\n\tgo client.writePump()\n\tgo client.readPump()\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/chat/home.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<title>Chat Example</title>\n<script type=\"text/javascript\">\nwindow.onload = function () {\n    var conn;\n    var msg = document.getElementById(\"msg\");\n    var log = document.getElementById(\"log\");\n\n    function appendLog(item) {\n        var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;\n        log.appendChild(item);\n        if (doScroll) {\n            log.scrollTop = log.scrollHeight - log.clientHeight;\n        }\n    }\n\n    document.getElementById(\"form\").onsubmit = function () {\n        if (!conn) {\n            return false;\n        }\n        if (!msg.value) {\n            return false;\n        }\n        conn.send(msg.value);\n        msg.value = \"\";\n        return false;\n    };\n\n    if (window[\"WebSocket\"]) {\n        conn = new WebSocket(\"ws://\" + document.location.host + \"/ws\");\n        conn.onclose = function (evt) {\n            var item = document.createElement(\"div\");\n            item.innerHTML = \"<b>Connection closed.</b>\";\n            appendLog(item);\n        };\n        conn.onmessage = function (evt) {\n            var messages = evt.data.split('\\n');\n            for (var i = 0; i < messages.length; i++) {\n                var item = document.createElement(\"div\");\n                item.innerText = messages[i];\n                appendLog(item);\n            }\n        };\n    } else {\n        var item = document.createElement(\"div\");\n        item.innerHTML = \"<b>Your browser does not support WebSockets.</b>\";\n        appendLog(item);\n    }\n};\n</script>\n<style type=\"text/css\">\nhtml {\n    overflow: hidden;\n}\n\nbody {\n    overflow: hidden;\n    padding: 0;\n    margin: 0;\n    width: 100%;\n    height: 100%;\n    background: gray;\n}\n\n#log {\n    background: white;\n    margin: 0;\n    padding: 0.5em 0.5em 0.5em 0.5em;\n    position: absolute;\n    top: 0.5em;\n    left: 0.5em;\n    right: 0.5em;\n    bottom: 3em;\n    overflow: auto;\n}\n\n#form {\n    padding: 0 0.5em 0 0.5em;\n    margin: 0;\n    position: absolute;\n    bottom: 1em;\n    left: 0px;\n    width: 100%;\n    overflow: hidden;\n}\n\n</style>\n</head>\n<body>\n<div id=\"log\"></div>\n<form id=\"form\">\n    <input type=\"submit\" value=\"Send\" />\n    <input type=\"text\" id=\"msg\" size=\"64\"/>\n</form>\n</body>\n</html>\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/chat/hub.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\n// hub maintains the set of active clients and broadcasts messages to the\n// clients.\ntype Hub struct {\n\t// Registered clients.\n\tclients map[*Client]bool\n\n\t// Inbound messages from the clients.\n\tbroadcast chan []byte\n\n\t// Register requests from the clients.\n\tregister chan *Client\n\n\t// Unregister requests from clients.\n\tunregister chan *Client\n}\n\nfunc newHub() *Hub {\n\treturn &Hub{\n\t\tbroadcast:  make(chan []byte),\n\t\tregister:   make(chan *Client),\n\t\tunregister: make(chan *Client),\n\t\tclients:    make(map[*Client]bool),\n\t}\n}\n\nfunc (h *Hub) run() {\n\tfor {\n\t\tselect {\n\t\tcase client := <-h.register:\n\t\t\th.clients[client] = true\n\t\tcase client := <-h.unregister:\n\t\t\tif _, ok := h.clients[client]; ok {\n\t\t\t\tdelete(h.clients, client)\n\t\t\t\tclose(client.send)\n\t\t\t}\n\t\tcase message := <-h.broadcast:\n\t\t\tfor client := range h.clients {\n\t\t\t\tselect {\n\t\t\t\tcase client.send <- message:\n\t\t\t\tdefault:\n\t\t\t\t\tclose(client.send)\n\t\t\t\t\tdelete(h.clients, client)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/chat/main.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"log\"\n\t\"net/http\"\n)\n\nvar addr = flag.String(\"addr\", \":8080\", \"http service address\")\n\nfunc serveHome(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(r.URL)\n\tif r.URL.Path != \"/\" {\n\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\thttp.ServeFile(w, r, \"home.html\")\n}\n\nfunc main() {\n\tflag.Parse()\n\thub := newHub()\n\tgo hub.run()\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n\t\tserveWs(hub, w, r)\n\t})\n\terr := http.ListenAndServe(*addr, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/command/README.md",
    "content": "# Command example\n\nThis example connects a websocket connection to stdin and stdout of a command.\nReceived messages are written to stdin followed by a `\\n`. Each line read from\nstandard out is sent as a message to the client.\n\n    $ go get github.com/gorilla/websocket\n    $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/command`\n    $ go run main.go <command and arguments to run>\n    # Open http://localhost:8080/ .\n\nTry the following commands.\n\n    # Echo sent messages to the output area.\n    $ go run main.go cat\n\n    # Run a shell.Try sending \"ls\" and \"cat main.go\".\n    $ go run main.go sh\n\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/command/home.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<title>Command Example</title>\n<script type=\"text/javascript\">\nwindow.onload = function () {\n    var conn;\n    var msg = document.getElementById(\"msg\");\n    var log = document.getElementById(\"log\");\n\n    function appendLog(item) {\n        var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;\n        log.appendChild(item);\n        if (doScroll) {\n            log.scrollTop = log.scrollHeight - log.clientHeight;\n        }\n    }\n\n    document.getElementById(\"form\").onsubmit = function () {\n        if (!conn) {\n            return false;\n        }\n        if (!msg.value) {\n            return false;\n        }\n        conn.send(msg.value);\n        msg.value = \"\";\n        return false;\n    };\n\n    if (window[\"WebSocket\"]) {\n        conn = new WebSocket(\"ws://\" + document.location.host + \"/ws\");\n        conn.onclose = function (evt) {\n            var item = document.createElement(\"div\");\n            item.innerHTML = \"<b>Connection closed.</b>\";\n            appendLog(item);\n        };\n        conn.onmessage = function (evt) {\n            var messages = evt.data.split('\\n');\n            for (var i = 0; i < messages.length; i++) {\n                var item = document.createElement(\"div\");\n                item.innerText = messages[i];\n                appendLog(item);\n            }\n        };\n    } else {\n        var item = document.createElement(\"div\");\n        item.innerHTML = \"<b>Your browser does not support WebSockets.</b>\";\n        appendLog(item);\n    }\n};\n</script>\n<style type=\"text/css\">\nhtml {\n    overflow: hidden;\n}\n\nbody {\n    overflow: hidden;\n    padding: 0;\n    margin: 0;\n    width: 100%;\n    height: 100%;\n    background: gray;\n}\n\n#log {\n    background: white;\n    margin: 0;\n    padding: 0.5em 0.5em 0.5em 0.5em;\n    position: absolute;\n    top: 0.5em;\n    left: 0.5em;\n    right: 0.5em;\n    bottom: 3em;\n    overflow: auto;\n}\n\n#log pre {\n  margin: 0;\n}\n\n#form {\n    padding: 0 0.5em 0 0.5em;\n    margin: 0;\n    position: absolute;\n    bottom: 1em;\n    left: 0px;\n    width: 100%;\n    overflow: hidden;\n}\n\n</style>\n</head>\n<body>\n<div id=\"log\"></div>\n<form id=\"form\">\n    <input type=\"submit\" value=\"Send\" />\n    <input type=\"text\" id=\"msg\" size=\"64\"/>\n</form>\n</body>\n</html>\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/command/main.go",
    "content": "// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"flag\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"time\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nvar (\n\taddr    = flag.String(\"addr\", \"127.0.0.1:8080\", \"http service address\")\n\tcmdPath string\n)\n\nconst (\n\t// Time allowed to write a message to the peer.\n\twriteWait = 10 * time.Second\n\n\t// Maximum message size allowed from peer.\n\tmaxMessageSize = 8192\n\n\t// Time allowed to read the next pong message from the peer.\n\tpongWait = 60 * time.Second\n\n\t// Send pings to peer with this period. Must be less than pongWait.\n\tpingPeriod = (pongWait * 9) / 10\n\n\t// Time to wait before force close on connection.\n\tcloseGracePeriod = 10 * time.Second\n)\n\nfunc pumpStdin(ws *websocket.Conn, w io.Writer) {\n\tdefer ws.Close()\n\tws.SetReadLimit(maxMessageSize)\n\tws.SetReadDeadline(time.Now().Add(pongWait))\n\tws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, message, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tmessage = append(message, '\\n')\n\t\tif _, err := w.Write(message); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc pumpStdout(ws *websocket.Conn, r io.Reader, done chan struct{}) {\n\tdefer func() {\n\t}()\n\ts := bufio.NewScanner(r)\n\tfor s.Scan() {\n\t\tws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\tif err := ws.WriteMessage(websocket.TextMessage, s.Bytes()); err != nil {\n\t\t\tws.Close()\n\t\t\tbreak\n\t\t}\n\t}\n\tif s.Err() != nil {\n\t\tlog.Println(\"scan:\", s.Err())\n\t}\n\tclose(done)\n\n\tws.SetWriteDeadline(time.Now().Add(writeWait))\n\tws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\ttime.Sleep(closeGracePeriod)\n\tws.Close()\n}\n\nfunc ping(ws *websocket.Conn, done chan struct{}) {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tif err := ws.WriteControl(websocket.PingMessage, []byte{}, time.Now().Add(writeWait)); err != nil {\n\t\t\t\tlog.Println(\"ping:\", err)\n\t\t\t}\n\t\tcase <-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc internalError(ws *websocket.Conn, msg string, err error) {\n\tlog.Println(msg, err)\n\tws.WriteMessage(websocket.TextMessage, []byte(\"Internal server error.\"))\n}\n\nvar upgrader = websocket.Upgrader{}\n\nfunc serveWs(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Println(\"upgrade:\", err)\n\t\treturn\n\t}\n\n\tdefer ws.Close()\n\n\toutr, outw, err := os.Pipe()\n\tif err != nil {\n\t\tinternalError(ws, \"stdout:\", err)\n\t\treturn\n\t}\n\tdefer outr.Close()\n\tdefer outw.Close()\n\n\tinr, inw, err := os.Pipe()\n\tif err != nil {\n\t\tinternalError(ws, \"stdin:\", err)\n\t\treturn\n\t}\n\tdefer inr.Close()\n\tdefer inw.Close()\n\n\tproc, err := os.StartProcess(cmdPath, flag.Args(), &os.ProcAttr{\n\t\tFiles: []*os.File{inr, outw, outw},\n\t})\n\tif err != nil {\n\t\tinternalError(ws, \"start:\", err)\n\t\treturn\n\t}\n\n\tinr.Close()\n\toutw.Close()\n\n\tstdoutDone := make(chan struct{})\n\tgo pumpStdout(ws, outr, stdoutDone)\n\tgo ping(ws, stdoutDone)\n\n\tpumpStdin(ws, inw)\n\n\t// Some commands will exit when stdin is closed.\n\tinw.Close()\n\n\t// Other commands need a bonk on the head.\n\tif err := proc.Signal(os.Interrupt); err != nil {\n\t\tlog.Println(\"inter:\", err)\n\t}\n\n\tselect {\n\tcase <-stdoutDone:\n\tcase <-time.After(time.Second):\n\t\t// A bigger bonk on the head.\n\t\tif err := proc.Signal(os.Kill); err != nil {\n\t\t\tlog.Println(\"term:\", err)\n\t\t}\n\t\t<-stdoutDone\n\t}\n\n\tif _, err := proc.Wait(); err != nil {\n\t\tlog.Println(\"wait:\", err)\n\t}\n}\n\nfunc serveHome(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\thttp.ServeFile(w, r, \"home.html\")\n}\n\nfunc main() {\n\tflag.Parse()\n\tif len(flag.Args()) < 1 {\n\t\tlog.Fatal(\"must specify at least one argument\")\n\t}\n\tvar err error\n\tcmdPath, err = exec.LookPath(flag.Args()[0])\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/ws\", serveWs)\n\tlog.Fatal(http.ListenAndServe(*addr, nil))\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/echo/README.md",
    "content": "# Client and server example\n\nThis example shows a simple client and server.\n\nThe server echoes messages sent to it. The client sends a message every second\nand prints all messages received.\n\nTo run the example, start the server:\n\n    $ go run server.go\n\nNext, start the client:\n\n    $ go run client.go\n\nThe server includes a simple web client. To use the client, open\nhttp://127.0.0.1:8080 in the browser and follow the instructions on the page.\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/echo/client.go",
    "content": "// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build ignore\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"log\"\n\t\"net/url\"\n\t\"os\"\n\t\"os/signal\"\n\t\"time\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nvar addr = flag.String(\"addr\", \"localhost:8080\", \"http service address\")\n\nfunc main() {\n\tflag.Parse()\n\tlog.SetFlags(0)\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\tu := url.URL{Scheme: \"ws\", Host: *addr, Path: \"/echo\"}\n\tlog.Printf(\"connecting to %s\", u.String())\n\n\tc, _, err := websocket.DefaultDialer.Dial(u.String(), nil)\n\tif err != nil {\n\t\tlog.Fatal(\"dial:\", err)\n\t}\n\tdefer c.Close()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor {\n\t\t\t_, message, err := c.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"recv: %s\", message)\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\treturn\n\t\tcase t := <-ticker.C:\n\t\t\terr := c.WriteMessage(websocket.TextMessage, []byte(t.String()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-interrupt:\n\t\t\tlog.Println(\"interrupt\")\n\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\terr := c.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\tcase <-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/echo/server.go",
    "content": "// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build ignore\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"html/template\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nvar addr = flag.String(\"addr\", \"localhost:8080\", \"http service address\")\n\nvar upgrader = websocket.Upgrader{} // use default options\n\nfunc echo(w http.ResponseWriter, r *http.Request) {\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.Print(\"upgrade:\", err)\n\t\treturn\n\t}\n\tdefer c.Close()\n\tfor {\n\t\tmt, message, err := c.ReadMessage()\n\t\tif err != nil {\n\t\t\tlog.Println(\"read:\", err)\n\t\t\tbreak\n\t\t}\n\t\tlog.Printf(\"recv: %s\", message)\n\t\terr = c.WriteMessage(mt, message)\n\t\tif err != nil {\n\t\t\tlog.Println(\"write:\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc home(w http.ResponseWriter, r *http.Request) {\n\thomeTemplate.Execute(w, \"ws://\"+r.Host+\"/echo\")\n}\n\nfunc main() {\n\tflag.Parse()\n\tlog.SetFlags(0)\n\thttp.HandleFunc(\"/echo\", echo)\n\thttp.HandleFunc(\"/\", home)\n\tlog.Fatal(http.ListenAndServe(*addr, nil))\n}\n\nvar homeTemplate = template.Must(template.New(\"\").Parse(`\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<script>  \nwindow.addEventListener(\"load\", function(evt) {\n\n    var output = document.getElementById(\"output\");\n    var input = document.getElementById(\"input\");\n    var ws;\n\n    var print = function(message) {\n        var d = document.createElement(\"div\");\n        d.innerHTML = message;\n        output.appendChild(d);\n    };\n\n    document.getElementById(\"open\").onclick = function(evt) {\n        if (ws) {\n            return false;\n        }\n        ws = new WebSocket(\"{{.}}\");\n        ws.onopen = function(evt) {\n            print(\"OPEN\");\n        }\n        ws.onclose = function(evt) {\n            print(\"CLOSE\");\n            ws = null;\n        }\n        ws.onmessage = function(evt) {\n            print(\"RESPONSE: \" + evt.data);\n        }\n        ws.onerror = function(evt) {\n            print(\"ERROR: \" + evt.data);\n        }\n        return false;\n    };\n\n    document.getElementById(\"send\").onclick = function(evt) {\n        if (!ws) {\n            return false;\n        }\n        print(\"SEND: \" + input.value);\n        ws.send(input.value);\n        return false;\n    };\n\n    document.getElementById(\"close\").onclick = function(evt) {\n        if (!ws) {\n            return false;\n        }\n        ws.close();\n        return false;\n    };\n\n});\n</script>\n</head>\n<body>\n<table>\n<tr><td valign=\"top\" width=\"50%\">\n<p>Click \"Open\" to create a connection to the server, \n\"Send\" to send a message to the server and \"Close\" to close the connection. \nYou can change the message and send multiple times.\n<p>\n<form>\n<button id=\"open\">Open</button>\n<button id=\"close\">Close</button>\n<p><input id=\"input\" type=\"text\" value=\"Hello world!\">\n<button id=\"send\">Send</button>\n</form>\n</td><td valign=\"top\" width=\"50%\">\n<div id=\"output\"></div>\n</td></tr></table>\n</body>\n</html>\n`))\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/filewatch/README.md",
    "content": "# File Watch example.\n\nThis example sends a file to the browser client for display whenever the file is modified.\n\n    $ go get github.com/gorilla/websocket\n    $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/filewatch`\n    $ go run main.go <name of file to watch>\n    # Open http://localhost:8080/ .\n    # Modify the file to see it update in the browser.\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/examples/filewatch/main.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"html/template\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/gorilla/websocket\"\n)\n\nconst (\n\t// Time allowed to write the file to the client.\n\twriteWait = 10 * time.Second\n\n\t// Time allowed to read the next pong message from the client.\n\tpongWait = 60 * time.Second\n\n\t// Send pings to client with this period. Must be less than pongWait.\n\tpingPeriod = (pongWait * 9) / 10\n\n\t// Poll file for changes with this period.\n\tfilePeriod = 10 * time.Second\n)\n\nvar (\n\taddr      = flag.String(\"addr\", \":8080\", \"http service address\")\n\thomeTempl = template.Must(template.New(\"\").Parse(homeHTML))\n\tfilename  string\n\tupgrader  = websocket.Upgrader{\n\t\tReadBufferSize:  1024,\n\t\tWriteBufferSize: 1024,\n\t}\n)\n\nfunc readFileIfModified(lastMod time.Time) ([]byte, time.Time, error) {\n\tfi, err := os.Stat(filename)\n\tif err != nil {\n\t\treturn nil, lastMod, err\n\t}\n\tif !fi.ModTime().After(lastMod) {\n\t\treturn nil, lastMod, nil\n\t}\n\tp, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fi.ModTime(), err\n\t}\n\treturn p, fi.ModTime(), nil\n}\n\nfunc reader(ws *websocket.Conn) {\n\tdefer ws.Close()\n\tws.SetReadLimit(512)\n\tws.SetReadDeadline(time.Now().Add(pongWait))\n\tws.SetPongHandler(func(string) error { ws.SetReadDeadline(time.Now().Add(pongWait)); return nil })\n\tfor {\n\t\t_, _, err := ws.ReadMessage()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc writer(ws *websocket.Conn, lastMod time.Time) {\n\tlastError := \"\"\n\tpingTicker := time.NewTicker(pingPeriod)\n\tfileTicker := time.NewTicker(filePeriod)\n\tdefer func() {\n\t\tpingTicker.Stop()\n\t\tfileTicker.Stop()\n\t\tws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-fileTicker.C:\n\t\t\tvar p []byte\n\t\t\tvar err error\n\n\t\t\tp, lastMod, err = readFileIfModified(lastMod)\n\n\t\t\tif err != nil {\n\t\t\t\tif s := err.Error(); s != lastError {\n\t\t\t\t\tlastError = s\n\t\t\t\t\tp = []byte(lastError)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlastError = \"\"\n\t\t\t}\n\n\t\t\tif p != nil {\n\t\t\t\tws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\t\tif err := ws.WriteMessage(websocket.TextMessage, p); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-pingTicker.C:\n\t\t\tws.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := ws.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc serveWs(w http.ResponseWriter, r *http.Request) {\n\tws, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tif _, ok := err.(websocket.HandshakeError); !ok {\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\n\tvar lastMod time.Time\n\tif n, err := strconv.ParseInt(r.FormValue(\"lastMod\"), 16, 64); err == nil {\n\t\tlastMod = time.Unix(0, n)\n\t}\n\n\tgo writer(ws, lastMod)\n\treader(ws)\n}\n\nfunc serveHome(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tp, lastMod, err := readFileIfModified(time.Time{})\n\tif err != nil {\n\t\tp = []byte(err.Error())\n\t\tlastMod = time.Unix(0, 0)\n\t}\n\tvar v = struct {\n\t\tHost    string\n\t\tData    string\n\t\tLastMod string\n\t}{\n\t\tr.Host,\n\t\tstring(p),\n\t\tstrconv.FormatInt(lastMod.UnixNano(), 16),\n\t}\n\thomeTempl.Execute(w, &v)\n}\n\nfunc main() {\n\tflag.Parse()\n\tif flag.NArg() != 1 {\n\t\tlog.Fatal(\"filename not specified\")\n\t}\n\tfilename = flag.Args()[0]\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/ws\", serveWs)\n\tif err := http.ListenAndServe(*addr, nil); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\nconst homeHTML = `<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <title>WebSocket Example</title>\n    </head>\n    <body>\n        <pre id=\"fileData\">{{.Data}}</pre>\n        <script type=\"text/javascript\">\n            (function() {\n                var data = document.getElementById(\"fileData\");\n                var conn = new WebSocket(\"ws://{{.Host}}/ws?lastMod={{.LastMod}}\");\n                conn.onclose = function(evt) {\n                    data.textContent = 'Connection closed';\n                }\n                conn.onmessage = function(evt) {\n                    console.glog('file updated');\n                    data.textContent = evt.data;\n                }\n            })();\n        </script>\n    </body>\n</html>\n`\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/json.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"encoding/json\"\n\t\"io\"\n)\n\n// WriteJSON writes the JSON encoding of v as a message.\n//\n// Deprecated: Use c.WriteJSON instead.\nfunc WriteJSON(c *Conn, v interface{}) error {\n\treturn c.WriteJSON(v)\n}\n\n// WriteJSON writes the JSON encoding of v as a message.\n//\n// See the documentation for encoding/json Marshal for details about the\n// conversion of Go values to JSON.\nfunc (c *Conn) WriteJSON(v interface{}) error {\n\tw, err := c.NextWriter(TextMessage)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr1 := json.NewEncoder(w).Encode(v)\n\terr2 := w.Close()\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\treturn err2\n}\n\n// ReadJSON reads the next JSON-encoded message from the connection and stores\n// it in the value pointed to by v.\n//\n// Deprecated: Use c.ReadJSON instead.\nfunc ReadJSON(c *Conn, v interface{}) error {\n\treturn c.ReadJSON(v)\n}\n\n// ReadJSON reads the next JSON-encoded message from the connection and stores\n// it in the value pointed to by v.\n//\n// See the documentation for the encoding/json Unmarshal function for details\n// about the conversion of JSON to a Go value.\nfunc (c *Conn) ReadJSON(v interface{}) error {\n\t_, r, err := c.NextReader()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.NewDecoder(r).Decode(v)\n\tif err == io.EOF {\n\t\t// One value is expected in the message.\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\treturn err\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/json_test.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"io\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestJSON(t *testing.T) {\n\tvar buf bytes.Buffer\n\tc := fakeNetConn{&buf, &buf}\n\twc := newConn(c, true, 1024, 1024)\n\trc := newConn(c, false, 1024, 1024)\n\n\tvar actual, expect struct {\n\t\tA int\n\t\tB string\n\t}\n\texpect.A = 1\n\texpect.B = \"hello\"\n\n\tif err := wc.WriteJSON(&expect); err != nil {\n\t\tt.Fatal(\"write\", err)\n\t}\n\n\tif err := rc.ReadJSON(&actual); err != nil {\n\t\tt.Fatal(\"read\", err)\n\t}\n\n\tif !reflect.DeepEqual(&actual, &expect) {\n\t\tt.Fatal(\"equal\", actual, expect)\n\t}\n}\n\nfunc TestPartialJSONRead(t *testing.T) {\n\tvar buf bytes.Buffer\n\tc := fakeNetConn{&buf, &buf}\n\twc := newConn(c, true, 1024, 1024)\n\trc := newConn(c, false, 1024, 1024)\n\n\tvar v struct {\n\t\tA int\n\t\tB string\n\t}\n\tv.A = 1\n\tv.B = \"hello\"\n\n\tmessageCount := 0\n\n\t// Partial JSON values.\n\n\tdata, err := json.Marshal(v)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfor i := len(data) - 1; i >= 0; i-- {\n\t\tif err := wc.WriteMessage(TextMessage, data[:i]); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tmessageCount++\n\t}\n\n\t// Whitespace.\n\n\tif err := wc.WriteMessage(TextMessage, []byte(\" \")); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tmessageCount++\n\n\t// Close.\n\n\tif err := wc.WriteMessage(CloseMessage, FormatCloseMessage(CloseNormalClosure, \"\")); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor i := 0; i < messageCount; i++ {\n\t\terr := rc.ReadJSON(&v)\n\t\tif err != io.ErrUnexpectedEOF {\n\t\t\tt.Error(\"read\", i, err)\n\t\t}\n\t}\n\n\terr = rc.ReadJSON(&v)\n\tif _, ok := err.(*CloseError); !ok {\n\t\tt.Error(\"final\", err)\n\t}\n}\n\nfunc TestDeprecatedJSON(t *testing.T) {\n\tvar buf bytes.Buffer\n\tc := fakeNetConn{&buf, &buf}\n\twc := newConn(c, true, 1024, 1024)\n\trc := newConn(c, false, 1024, 1024)\n\n\tvar actual, expect struct {\n\t\tA int\n\t\tB string\n\t}\n\texpect.A = 1\n\texpect.B = \"hello\"\n\n\tif err := WriteJSON(wc, &expect); err != nil {\n\t\tt.Fatal(\"write\", err)\n\t}\n\n\tif err := ReadJSON(rc, &actual); err != nil {\n\t\tt.Fatal(\"read\", err)\n\t}\n\n\tif !reflect.DeepEqual(&actual, &expect) {\n\t\tt.Fatal(\"equal\", actual, expect)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/mask.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.  Use of\n// this source code is governed by a BSD-style license that can be found in the\n// LICENSE file.\n\n// +build !appengine\n\npackage websocket\n\nimport \"unsafe\"\n\nconst wordSize = int(unsafe.Sizeof(uintptr(0)))\n\nfunc maskBytes(key [4]byte, pos int, b []byte) int {\n\t// Mask one byte at a time for small buffers.\n\tif len(b) < 2*wordSize {\n\t\tfor i := range b {\n\t\t\tb[i] ^= key[pos&3]\n\t\t\tpos++\n\t\t}\n\t\treturn pos & 3\n\t}\n\n\t// Mask one byte at a time to word boundary.\n\tif n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {\n\t\tn = wordSize - n\n\t\tfor i := range b[:n] {\n\t\t\tb[i] ^= key[pos&3]\n\t\t\tpos++\n\t\t}\n\t\tb = b[n:]\n\t}\n\n\t// Create aligned word size key.\n\tvar k [wordSize]byte\n\tfor i := range k {\n\t\tk[i] = key[(pos+i)&3]\n\t}\n\tkw := *(*uintptr)(unsafe.Pointer(&k))\n\n\t// Mask one word at a time.\n\tn := (len(b) / wordSize) * wordSize\n\tfor i := 0; i < n; i += wordSize {\n\t\t*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw\n\t}\n\n\t// Mask one byte at a time for remaining bytes.\n\tb = b[n:]\n\tfor i := range b {\n\t\tb[i] ^= key[pos&3]\n\t\tpos++\n\t}\n\n\treturn pos & 3\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/mask_safe.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.  Use of\n// this source code is governed by a BSD-style license that can be found in the\n// LICENSE file.\n\n// +build appengine\n\npackage websocket\n\nfunc maskBytes(key [4]byte, pos int, b []byte) int {\n\tfor i := range b {\n\t\tb[i] ^= key[pos&3]\n\t\tpos++\n\t}\n\treturn pos & 3\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/mask_test.go",
    "content": "// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.  Use of\n// this source code is governed by a BSD-style license that can be found in the\n// LICENSE file.\n\n// Require 1.7 for sub-bencmarks\n// +build go1.7,!appengine\n\npackage websocket\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n)\n\nfunc maskBytesByByte(key [4]byte, pos int, b []byte) int {\n\tfor i := range b {\n\t\tb[i] ^= key[pos&3]\n\t\tpos++\n\t}\n\treturn pos & 3\n}\n\nfunc notzero(b []byte) int {\n\tfor i := range b {\n\t\tif b[i] != 0 {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}\n\nfunc TestMaskBytes(t *testing.T) {\n\tkey := [4]byte{1, 2, 3, 4}\n\tfor size := 1; size <= 1024; size++ {\n\t\tfor align := 0; align < wordSize; align++ {\n\t\t\tfor pos := 0; pos < 4; pos++ {\n\t\t\t\tb := make([]byte, size+align)[align:]\n\t\t\t\tmaskBytes(key, pos, b)\n\t\t\t\tmaskBytesByByte(key, pos, b)\n\t\t\t\tif i := notzero(b); i >= 0 {\n\t\t\t\t\tt.Errorf(\"size:%d, align:%d, pos:%d, offset:%d\", size, align, pos, i)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc BenchmarkMaskBytes(b *testing.B) {\n\tfor _, size := range []int{2, 4, 8, 16, 32, 512, 1024} {\n\t\tb.Run(fmt.Sprintf(\"size-%d\", size), func(b *testing.B) {\n\t\t\tfor _, align := range []int{wordSize / 2} {\n\t\t\t\tb.Run(fmt.Sprintf(\"align-%d\", align), func(b *testing.B) {\n\t\t\t\t\tfor _, fn := range []struct {\n\t\t\t\t\t\tname string\n\t\t\t\t\t\tfn   func(key [4]byte, pos int, b []byte) int\n\t\t\t\t\t}{\n\t\t\t\t\t\t{\"byte\", maskBytesByByte},\n\t\t\t\t\t\t{\"word\", maskBytes},\n\t\t\t\t\t} {\n\t\t\t\t\t\tb.Run(fn.name, func(b *testing.B) {\n\t\t\t\t\t\t\tkey := newMaskKey()\n\t\t\t\t\t\t\tdata := make([]byte, size+align)[align:]\n\t\t\t\t\t\t\tfor i := 0; i < b.N; i++ {\n\t\t\t\t\t\t\t\tfn.fn(key, 0, data)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb.SetBytes(int64(len(data)))\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/prepared.go",
    "content": "// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bytes\"\n\t\"net\"\n\t\"sync\"\n\t\"time\"\n)\n\n// PreparedMessage caches on the wire representations of a message payload.\n// Use PreparedMessage to efficiently send a message payload to multiple\n// connections. PreparedMessage is especially useful when compression is used\n// because the CPU and memory expensive compression operation can be executed\n// once for a given set of compression options.\ntype PreparedMessage struct {\n\tmessageType int\n\tdata        []byte\n\terr         error\n\tmu          sync.Mutex\n\tframes      map[prepareKey]*preparedFrame\n}\n\n// prepareKey defines a unique set of options to cache prepared frames in PreparedMessage.\ntype prepareKey struct {\n\tisServer         bool\n\tcompress         bool\n\tcompressionLevel int\n}\n\n// preparedFrame contains data in wire representation.\ntype preparedFrame struct {\n\tonce sync.Once\n\tdata []byte\n}\n\n// NewPreparedMessage returns an initialized PreparedMessage. You can then send\n// it to connection using WritePreparedMessage method. Valid wire\n// representation will be calculated lazily only once for a set of current\n// connection options.\nfunc NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) {\n\tpm := &PreparedMessage{\n\t\tmessageType: messageType,\n\t\tframes:      make(map[prepareKey]*preparedFrame),\n\t\tdata:        data,\n\t}\n\n\t// Prepare a plain server frame.\n\t_, frameData, err := pm.frame(prepareKey{isServer: true, compress: false})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// To protect against caller modifying the data argument, remember the data\n\t// copied to the plain server frame.\n\tpm.data = frameData[len(frameData)-len(data):]\n\treturn pm, nil\n}\n\nfunc (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) {\n\tpm.mu.Lock()\n\tframe, ok := pm.frames[key]\n\tif !ok {\n\t\tframe = &preparedFrame{}\n\t\tpm.frames[key] = frame\n\t}\n\tpm.mu.Unlock()\n\n\tvar err error\n\tframe.once.Do(func() {\n\t\t// Prepare a frame using a 'fake' connection.\n\t\t// TODO: Refactor code in conn.go to allow more direct construction of\n\t\t// the frame.\n\t\tmu := make(chan bool, 1)\n\t\tmu <- true\n\t\tvar nc prepareConn\n\t\tc := &Conn{\n\t\t\tconn:                   &nc,\n\t\t\tmu:                     mu,\n\t\t\tisServer:               key.isServer,\n\t\t\tcompressionLevel:       key.compressionLevel,\n\t\t\tenableWriteCompression: true,\n\t\t\twriteBuf:               make([]byte, defaultWriteBufferSize+maxFrameHeaderSize),\n\t\t}\n\t\tif key.compress {\n\t\t\tc.newCompressionWriter = compressNoContextTakeover\n\t\t}\n\t\terr = c.WriteMessage(pm.messageType, pm.data)\n\t\tframe.data = nc.buf.Bytes()\n\t})\n\treturn pm.messageType, frame.data, err\n}\n\ntype prepareConn struct {\n\tbuf bytes.Buffer\n\tnet.Conn\n}\n\nfunc (pc *prepareConn) Write(p []byte) (int, error)        { return pc.buf.Write(p) }\nfunc (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil }\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/prepared_test.go",
    "content": "// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bytes\"\n\t\"compress/flate\"\n\t\"math/rand\"\n\t\"testing\"\n)\n\nvar preparedMessageTests = []struct {\n\tmessageType            int\n\tisServer               bool\n\tenableWriteCompression bool\n\tcompressionLevel       int\n}{\n\t// Server\n\t{TextMessage, true, false, flate.BestSpeed},\n\t{TextMessage, true, true, flate.BestSpeed},\n\t{TextMessage, true, true, flate.BestCompression},\n\t{PingMessage, true, false, flate.BestSpeed},\n\t{PingMessage, true, true, flate.BestSpeed},\n\n\t// Client\n\t{TextMessage, false, false, flate.BestSpeed},\n\t{TextMessage, false, true, flate.BestSpeed},\n\t{TextMessage, false, true, flate.BestCompression},\n\t{PingMessage, false, false, flate.BestSpeed},\n\t{PingMessage, false, true, flate.BestSpeed},\n}\n\nfunc TestPreparedMessage(t *testing.T) {\n\tfor _, tt := range preparedMessageTests {\n\t\tvar data = []byte(\"this is a test\")\n\t\tvar buf bytes.Buffer\n\t\tc := newConn(fakeNetConn{Reader: nil, Writer: &buf}, tt.isServer, 1024, 1024)\n\t\tif tt.enableWriteCompression {\n\t\t\tc.newCompressionWriter = compressNoContextTakeover\n\t\t}\n\t\tc.SetCompressionLevel(tt.compressionLevel)\n\n\t\t// Seed random number generator for consistent frame mask.\n\t\trand.Seed(1234)\n\n\t\tif err := c.WriteMessage(tt.messageType, data); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\twant := buf.String()\n\n\t\tpm, err := NewPreparedMessage(tt.messageType, data)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// Scribble on data to ensure that NewPreparedMessage takes a snapshot.\n\t\tcopy(data, \"hello world\")\n\n\t\t// Seed random number generator for consistent frame mask.\n\t\trand.Seed(1234)\n\n\t\tbuf.Reset()\n\t\tif err := c.WritePreparedMessage(pm); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tgot := buf.String()\n\n\t\tif got != want {\n\t\t\tt.Errorf(\"write message != prepared message for %+v\", tt)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/proxy.go",
    "content": "// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bufio\"\n\t\"encoding/base64\"\n\t\"errors\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n)\n\ntype netDialerFunc func(netowrk, addr string) (net.Conn, error)\n\nfunc (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) {\n\treturn fn(network, addr)\n}\n\nfunc init() {\n\tproxy_RegisterDialerType(\"http\", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {\n\t\treturn &httpProxyDialer{proxyURL: proxyURL, fowardDial: forwardDialer.Dial}, nil\n\t})\n}\n\ntype httpProxyDialer struct {\n\tproxyURL   *url.URL\n\tfowardDial func(network, addr string) (net.Conn, error)\n}\n\nfunc (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) {\n\thostPort, _ := hostPortNoPort(hpd.proxyURL)\n\tconn, err := hpd.fowardDial(network, hostPort)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconnectHeader := make(http.Header)\n\tif user := hpd.proxyURL.User; user != nil {\n\t\tproxyUser := user.Username()\n\t\tif proxyPassword, passwordSet := user.Password(); passwordSet {\n\t\t\tcredential := base64.StdEncoding.EncodeToString([]byte(proxyUser + \":\" + proxyPassword))\n\t\t\tconnectHeader.Set(\"Proxy-Authorization\", \"Basic \"+credential)\n\t\t}\n\t}\n\n\tconnectReq := &http.Request{\n\t\tMethod: \"CONNECT\",\n\t\tURL:    &url.URL{Opaque: addr},\n\t\tHost:   addr,\n\t\tHeader: connectHeader,\n\t}\n\n\tif err := connectReq.Write(conn); err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\t// Read response. It's OK to use and discard buffered reader here becaue\n\t// the remote server does not speak until spoken to.\n\tbr := bufio.NewReader(conn)\n\tresp, err := http.ReadResponse(br, connectReq)\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tconn.Close()\n\t\tf := strings.SplitN(resp.Status, \" \", 2)\n\t\treturn nil, errors.New(f[1])\n\t}\n\treturn conn, nil\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/server.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"bufio\"\n\t\"errors\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n\t\"time\"\n)\n\n// HandshakeError describes an error with the handshake from the peer.\ntype HandshakeError struct {\n\tmessage string\n}\n\nfunc (e HandshakeError) Error() string { return e.message }\n\n// Upgrader specifies parameters for upgrading an HTTP connection to a\n// WebSocket connection.\ntype Upgrader struct {\n\t// HandshakeTimeout specifies the duration for the handshake to complete.\n\tHandshakeTimeout time.Duration\n\n\t// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer\n\t// size is zero, then buffers allocated by the HTTP server are used. The\n\t// I/O buffer sizes do not limit the size of the messages that can be sent\n\t// or received.\n\tReadBufferSize, WriteBufferSize int\n\n\t// Subprotocols specifies the server's supported protocols in order of\n\t// preference. If this field is set, then the Upgrade method negotiates a\n\t// subprotocol by selecting the first match in this list with a protocol\n\t// requested by the client.\n\tSubprotocols []string\n\n\t// Error specifies the function for generating HTTP error responses. If Error\n\t// is nil, then http.Error is used to generate the HTTP response.\n\tError func(w http.ResponseWriter, r *http.Request, status int, reason error)\n\n\t// CheckOrigin returns true if the request Origin header is acceptable. If\n\t// CheckOrigin is nil, then a safe default is used: return false if the\n\t// Origin request header is present and the origin host is not equal to\n\t// request Host header.\n\t//\n\t// A CheckOrigin function should carefully validate the request origin to\n\t// prevent cross-site request forgery.\n\tCheckOrigin func(r *http.Request) bool\n\n\t// EnableCompression specify if the server should attempt to negotiate per\n\t// message compression (RFC 7692). Setting this value to true does not\n\t// guarantee that compression will be supported. Currently only \"no context\n\t// takeover\" modes are supported.\n\tEnableCompression bool\n}\n\nfunc (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) {\n\terr := HandshakeError{reason}\n\tif u.Error != nil {\n\t\tu.Error(w, r, status, err)\n\t} else {\n\t\tw.Header().Set(\"Sec-Websocket-Version\", \"13\")\n\t\thttp.Error(w, http.StatusText(status), status)\n\t}\n\treturn nil, err\n}\n\n// checkSameOrigin returns true if the origin is not set or is equal to the request host.\nfunc checkSameOrigin(r *http.Request) bool {\n\torigin := r.Header[\"Origin\"]\n\tif len(origin) == 0 {\n\t\treturn true\n\t}\n\tu, err := url.Parse(origin[0])\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn equalASCIIFold(u.Host, r.Host)\n}\n\nfunc (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string {\n\tif u.Subprotocols != nil {\n\t\tclientProtocols := Subprotocols(r)\n\t\tfor _, serverProtocol := range u.Subprotocols {\n\t\t\tfor _, clientProtocol := range clientProtocols {\n\t\t\t\tif clientProtocol == serverProtocol {\n\t\t\t\t\treturn clientProtocol\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if responseHeader != nil {\n\t\treturn responseHeader.Get(\"Sec-Websocket-Protocol\")\n\t}\n\treturn \"\"\n}\n\n// Upgrade upgrades the HTTP server connection to the WebSocket protocol.\n//\n// The responseHeader is included in the response to the client's upgrade\n// request. Use the responseHeader to specify cookies (Set-Cookie) and the\n// application negotiated subprotocol (Sec-Websocket-Protocol).\n//\n// If the upgrade fails, then Upgrade replies to the client with an HTTP error\n// response.\nfunc (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) {\n\tconst badHandshake = \"websocket: the client is not using the websocket protocol: \"\n\n\tif !tokenListContainsValue(r.Header, \"Connection\", \"upgrade\") {\n\t\treturn u.returnError(w, r, http.StatusBadRequest, badHandshake+\"'upgrade' token not found in 'Connection' header\")\n\t}\n\n\tif !tokenListContainsValue(r.Header, \"Upgrade\", \"websocket\") {\n\t\treturn u.returnError(w, r, http.StatusBadRequest, badHandshake+\"'websocket' token not found in 'Upgrade' header\")\n\t}\n\n\tif r.Method != \"GET\" {\n\t\treturn u.returnError(w, r, http.StatusMethodNotAllowed, badHandshake+\"request method is not GET\")\n\t}\n\n\tif !tokenListContainsValue(r.Header, \"Sec-Websocket-Version\", \"13\") {\n\t\treturn u.returnError(w, r, http.StatusBadRequest, \"websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header\")\n\t}\n\n\tif _, ok := responseHeader[\"Sec-Websocket-Extensions\"]; ok {\n\t\treturn u.returnError(w, r, http.StatusInternalServerError, \"websocket: application specific 'Sec-Websocket-Extensions' headers are unsupported\")\n\t}\n\n\tcheckOrigin := u.CheckOrigin\n\tif checkOrigin == nil {\n\t\tcheckOrigin = checkSameOrigin\n\t}\n\tif !checkOrigin(r) {\n\t\treturn u.returnError(w, r, http.StatusForbidden, \"websocket: request origin not allowed by Upgrader.CheckOrigin\")\n\t}\n\n\tchallengeKey := r.Header.Get(\"Sec-Websocket-Key\")\n\tif challengeKey == \"\" {\n\t\treturn u.returnError(w, r, http.StatusBadRequest, \"websocket: not a websocket handshake: `Sec-Websocket-Key' header is missing or blank\")\n\t}\n\n\tsubprotocol := u.selectSubprotocol(r, responseHeader)\n\n\t// Negotiate PMCE\n\tvar compress bool\n\tif u.EnableCompression {\n\t\tfor _, ext := range parseExtensions(r.Header) {\n\t\t\tif ext[\"\"] != \"permessage-deflate\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcompress = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar (\n\t\tnetConn net.Conn\n\t\terr     error\n\t)\n\n\th, ok := w.(http.Hijacker)\n\tif !ok {\n\t\treturn u.returnError(w, r, http.StatusInternalServerError, \"websocket: response does not implement http.Hijacker\")\n\t}\n\tvar brw *bufio.ReadWriter\n\tnetConn, brw, err = h.Hijack()\n\tif err != nil {\n\t\treturn u.returnError(w, r, http.StatusInternalServerError, err.Error())\n\t}\n\n\tif brw.Reader.Buffered() > 0 {\n\t\tnetConn.Close()\n\t\treturn nil, errors.New(\"websocket: client sent data before handshake is complete\")\n\t}\n\n\tc := newConnBRW(netConn, true, u.ReadBufferSize, u.WriteBufferSize, brw)\n\tc.subprotocol = subprotocol\n\n\tif compress {\n\t\tc.newCompressionWriter = compressNoContextTakeover\n\t\tc.newDecompressionReader = decompressNoContextTakeover\n\t}\n\n\tp := c.writeBuf[:0]\n\tp = append(p, \"HTTP/1.1 101 Switching Protocols\\r\\nUpgrade: websocket\\r\\nConnection: Upgrade\\r\\nSec-WebSocket-Accept: \"...)\n\tp = append(p, computeAcceptKey(challengeKey)...)\n\tp = append(p, \"\\r\\n\"...)\n\tif c.subprotocol != \"\" {\n\t\tp = append(p, \"Sec-Websocket-Protocol: \"...)\n\t\tp = append(p, c.subprotocol...)\n\t\tp = append(p, \"\\r\\n\"...)\n\t}\n\tif compress {\n\t\tp = append(p, \"Sec-Websocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\\r\\n\"...)\n\t}\n\tfor k, vs := range responseHeader {\n\t\tif k == \"Sec-Websocket-Protocol\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, v := range vs {\n\t\t\tp = append(p, k...)\n\t\t\tp = append(p, \": \"...)\n\t\t\tfor i := 0; i < len(v); i++ {\n\t\t\t\tb := v[i]\n\t\t\t\tif b <= 31 {\n\t\t\t\t\t// prevent response splitting.\n\t\t\t\t\tb = ' '\n\t\t\t\t}\n\t\t\t\tp = append(p, b)\n\t\t\t}\n\t\t\tp = append(p, \"\\r\\n\"...)\n\t\t}\n\t}\n\tp = append(p, \"\\r\\n\"...)\n\n\t// Clear deadlines set by HTTP server.\n\tnetConn.SetDeadline(time.Time{})\n\n\tif u.HandshakeTimeout > 0 {\n\t\tnetConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout))\n\t}\n\tif _, err = netConn.Write(p); err != nil {\n\t\tnetConn.Close()\n\t\treturn nil, err\n\t}\n\tif u.HandshakeTimeout > 0 {\n\t\tnetConn.SetWriteDeadline(time.Time{})\n\t}\n\n\treturn c, nil\n}\n\n// Upgrade upgrades the HTTP server connection to the WebSocket protocol.\n//\n// Deprecated: Use websocket.Upgrader instead.\n//\n// Upgrade does not perform origin checking. The application is responsible for\n// checking the Origin header before calling Upgrade. An example implementation\n// of the same origin policy check is:\n//\n//\tif req.Header.Get(\"Origin\") != \"http://\"+req.Host {\n//\t\thttp.Error(w, \"Origin not allowed\", http.StatusForbidden)\n//\t\treturn\n//\t}\n//\n// If the endpoint supports subprotocols, then the application is responsible\n// for negotiating the protocol used on the connection. Use the Subprotocols()\n// function to get the subprotocols requested by the client. Use the\n// Sec-Websocket-Protocol response header to specify the subprotocol selected\n// by the application.\n//\n// The responseHeader is included in the response to the client's upgrade\n// request. Use the responseHeader to specify cookies (Set-Cookie) and the\n// negotiated subprotocol (Sec-Websocket-Protocol).\n//\n// The connection buffers IO to the underlying network connection. The\n// readBufSize and writeBufSize parameters specify the size of the buffers to\n// use. Messages can be larger than the buffers.\n//\n// If the request is not a valid WebSocket handshake, then Upgrade returns an\n// error of type HandshakeError. Applications should handle this error by\n// replying to the client with an HTTP error response.\nfunc Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) {\n\tu := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize}\n\tu.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) {\n\t\t// don't return errors to maintain backwards compatibility\n\t}\n\tu.CheckOrigin = func(r *http.Request) bool {\n\t\t// allow all connections by default\n\t\treturn true\n\t}\n\treturn u.Upgrade(w, r, responseHeader)\n}\n\n// Subprotocols returns the subprotocols requested by the client in the\n// Sec-Websocket-Protocol header.\nfunc Subprotocols(r *http.Request) []string {\n\th := strings.TrimSpace(r.Header.Get(\"Sec-Websocket-Protocol\"))\n\tif h == \"\" {\n\t\treturn nil\n\t}\n\tprotocols := strings.Split(h, \",\")\n\tfor i := range protocols {\n\t\tprotocols[i] = strings.TrimSpace(protocols[i])\n\t}\n\treturn protocols\n}\n\n// IsWebSocketUpgrade returns true if the client requested upgrade to the\n// WebSocket protocol.\nfunc IsWebSocketUpgrade(r *http.Request) bool {\n\treturn tokenListContainsValue(r.Header, \"Connection\", \"upgrade\") &&\n\t\ttokenListContainsValue(r.Header, \"Upgrade\", \"websocket\")\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/server_test.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"net/http\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nvar subprotocolTests = []struct {\n\th         string\n\tprotocols []string\n}{\n\t{\"\", nil},\n\t{\"foo\", []string{\"foo\"}},\n\t{\"foo,bar\", []string{\"foo\", \"bar\"}},\n\t{\"foo, bar\", []string{\"foo\", \"bar\"}},\n\t{\" foo, bar\", []string{\"foo\", \"bar\"}},\n\t{\" foo, bar \", []string{\"foo\", \"bar\"}},\n}\n\nfunc TestSubprotocols(t *testing.T) {\n\tfor _, st := range subprotocolTests {\n\t\tr := http.Request{Header: http.Header{\"Sec-Websocket-Protocol\": {st.h}}}\n\t\tprotocols := Subprotocols(&r)\n\t\tif !reflect.DeepEqual(st.protocols, protocols) {\n\t\t\tt.Errorf(\"SubProtocols(%q) returned %#v, want %#v\", st.h, protocols, st.protocols)\n\t\t}\n\t}\n}\n\nvar isWebSocketUpgradeTests = []struct {\n\tok bool\n\th  http.Header\n}{\n\t{false, http.Header{\"Upgrade\": {\"websocket\"}}},\n\t{false, http.Header{\"Connection\": {\"upgrade\"}}},\n\t{true, http.Header{\"Connection\": {\"upgRade\"}, \"Upgrade\": {\"WebSocket\"}}},\n}\n\nfunc TestIsWebSocketUpgrade(t *testing.T) {\n\tfor _, tt := range isWebSocketUpgradeTests {\n\t\tok := IsWebSocketUpgrade(&http.Request{Header: tt.h})\n\t\tif tt.ok != ok {\n\t\t\tt.Errorf(\"IsWebSocketUpgrade(%v) returned %v, want %v\", tt.h, ok, tt.ok)\n\t\t}\n\t}\n}\n\nvar checkSameOriginTests = []struct {\n\tok bool\n\tr  *http.Request\n}{\n\t{false, &http.Request{Host: \"example.org\", Header: map[string][]string{\"Origin\": []string{\"https://other.org\"}}}},\n\t{true, &http.Request{Host: \"example.org\", Header: map[string][]string{\"Origin\": []string{\"https://example.org\"}}}},\n\t{true, &http.Request{Host: \"Example.org\", Header: map[string][]string{\"Origin\": []string{\"https://example.org\"}}}},\n}\n\nfunc TestCheckSameOrigin(t *testing.T) {\n\tfor _, tt := range checkSameOriginTests {\n\t\tok := checkSameOrigin(tt.r)\n\t\tif tt.ok != ok {\n\t\t\tt.Errorf(\"checkSameOrigin(%+v) returned %v, want %v\", tt.r, ok, tt.ok)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/util.go",
    "content": "// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"crypto/rand\"\n\t\"crypto/sha1\"\n\t\"encoding/base64\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"unicode/utf8\"\n)\n\nvar keyGUID = []byte(\"258EAFA5-E914-47DA-95CA-C5AB0DC85B11\")\n\nfunc computeAcceptKey(challengeKey string) string {\n\th := sha1.New()\n\th.Write([]byte(challengeKey))\n\th.Write(keyGUID)\n\treturn base64.StdEncoding.EncodeToString(h.Sum(nil))\n}\n\nfunc generateChallengeKey() (string, error) {\n\tp := make([]byte, 16)\n\tif _, err := io.ReadFull(rand.Reader, p); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn base64.StdEncoding.EncodeToString(p), nil\n}\n\n// Octet types from RFC 2616.\nvar octetTypes [256]byte\n\nconst (\n\tisTokenOctet = 1 << iota\n\tisSpaceOctet\n)\n\nfunc init() {\n\t// From RFC 2616\n\t//\n\t// OCTET      = <any 8-bit sequence of data>\n\t// CHAR       = <any US-ASCII character (octets 0 - 127)>\n\t// CTL        = <any US-ASCII control character (octets 0 - 31) and DEL (127)>\n\t// CR         = <US-ASCII CR, carriage return (13)>\n\t// LF         = <US-ASCII LF, linefeed (10)>\n\t// SP         = <US-ASCII SP, space (32)>\n\t// HT         = <US-ASCII HT, horizontal-tab (9)>\n\t// <\">        = <US-ASCII double-quote mark (34)>\n\t// CRLF       = CR LF\n\t// LWS        = [CRLF] 1*( SP | HT )\n\t// TEXT       = <any OCTET except CTLs, but including LWS>\n\t// separators = \"(\" | \")\" | \"<\" | \">\" | \"@\" | \",\" | \";\" | \":\" | \"\\\" | <\">\n\t//              | \"/\" | \"[\" | \"]\" | \"?\" | \"=\" | \"{\" | \"}\" | SP | HT\n\t// token      = 1*<any CHAR except CTLs or separators>\n\t// qdtext     = <any TEXT except <\">>\n\n\tfor c := 0; c < 256; c++ {\n\t\tvar t byte\n\t\tisCtl := c <= 31 || c == 127\n\t\tisChar := 0 <= c && c <= 127\n\t\tisSeparator := strings.IndexRune(\" \\t\\\"(),/:;<=>?@[]\\\\{}\", rune(c)) >= 0\n\t\tif strings.IndexRune(\" \\t\\r\\n\", rune(c)) >= 0 {\n\t\t\tt |= isSpaceOctet\n\t\t}\n\t\tif isChar && !isCtl && !isSeparator {\n\t\t\tt |= isTokenOctet\n\t\t}\n\t\toctetTypes[c] = t\n\t}\n}\n\nfunc skipSpace(s string) (rest string) {\n\ti := 0\n\tfor ; i < len(s); i++ {\n\t\tif octetTypes[s[i]]&isSpaceOctet == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn s[i:]\n}\n\nfunc nextToken(s string) (token, rest string) {\n\ti := 0\n\tfor ; i < len(s); i++ {\n\t\tif octetTypes[s[i]]&isTokenOctet == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn s[:i], s[i:]\n}\n\nfunc nextTokenOrQuoted(s string) (value string, rest string) {\n\tif !strings.HasPrefix(s, \"\\\"\") {\n\t\treturn nextToken(s)\n\t}\n\ts = s[1:]\n\tfor i := 0; i < len(s); i++ {\n\t\tswitch s[i] {\n\t\tcase '\"':\n\t\t\treturn s[:i], s[i+1:]\n\t\tcase '\\\\':\n\t\t\tp := make([]byte, len(s)-1)\n\t\t\tj := copy(p, s[:i])\n\t\t\tescape := true\n\t\t\tfor i = i + 1; i < len(s); i++ {\n\t\t\t\tb := s[i]\n\t\t\t\tswitch {\n\t\t\t\tcase escape:\n\t\t\t\t\tescape = false\n\t\t\t\t\tp[j] = b\n\t\t\t\t\tj++\n\t\t\t\tcase b == '\\\\':\n\t\t\t\t\tescape = true\n\t\t\t\tcase b == '\"':\n\t\t\t\t\treturn string(p[:j]), s[i+1:]\n\t\t\t\tdefault:\n\t\t\t\t\tp[j] = b\n\t\t\t\t\tj++\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn \"\", \"\"\n\t\t}\n\t}\n\treturn \"\", \"\"\n}\n\n// equalASCIIFold returns true if s is equal to t with ASCII case folding.\nfunc equalASCIIFold(s, t string) bool {\n\tfor s != \"\" && t != \"\" {\n\t\tsr, size := utf8.DecodeRuneInString(s)\n\t\ts = s[size:]\n\t\ttr, size := utf8.DecodeRuneInString(t)\n\t\tt = t[size:]\n\t\tif sr == tr {\n\t\t\tcontinue\n\t\t}\n\t\tif 'A' <= sr && sr <= 'Z' {\n\t\t\tsr = sr + 'a' - 'A'\n\t\t}\n\t\tif 'A' <= tr && tr <= 'Z' {\n\t\t\ttr = tr + 'a' - 'A'\n\t\t}\n\t\tif sr != tr {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn s == t\n}\n\n// tokenListContainsValue returns true if the 1#token header with the given\n// name contains a token equal to value with ASCII case folding.\nfunc tokenListContainsValue(header http.Header, name string, value string) bool {\nheaders:\n\tfor _, s := range header[name] {\n\t\tfor {\n\t\t\tvar t string\n\t\t\tt, s = nextToken(skipSpace(s))\n\t\t\tif t == \"\" {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\ts = skipSpace(s)\n\t\t\tif s != \"\" && s[0] != ',' {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\tif equalASCIIFold(t, value) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif s == \"\" {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\treturn false\n}\n\n// parseExtensiosn parses WebSocket extensions from a header.\nfunc parseExtensions(header http.Header) []map[string]string {\n\t// From RFC 6455:\n\t//\n\t//  Sec-WebSocket-Extensions = extension-list\n\t//  extension-list = 1#extension\n\t//  extension = extension-token *( \";\" extension-param )\n\t//  extension-token = registered-token\n\t//  registered-token = token\n\t//  extension-param = token [ \"=\" (token | quoted-string) ]\n\t//     ;When using the quoted-string syntax variant, the value\n\t//     ;after quoted-string unescaping MUST conform to the\n\t//     ;'token' ABNF.\n\n\tvar result []map[string]string\nheaders:\n\tfor _, s := range header[\"Sec-Websocket-Extensions\"] {\n\t\tfor {\n\t\t\tvar t string\n\t\t\tt, s = nextToken(skipSpace(s))\n\t\t\tif t == \"\" {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\text := map[string]string{\"\": t}\n\t\t\tfor {\n\t\t\t\ts = skipSpace(s)\n\t\t\t\tif !strings.HasPrefix(s, \";\") {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tvar k string\n\t\t\t\tk, s = nextToken(skipSpace(s[1:]))\n\t\t\t\tif k == \"\" {\n\t\t\t\t\tcontinue headers\n\t\t\t\t}\n\t\t\t\ts = skipSpace(s)\n\t\t\t\tvar v string\n\t\t\t\tif strings.HasPrefix(s, \"=\") {\n\t\t\t\t\tv, s = nextTokenOrQuoted(skipSpace(s[1:]))\n\t\t\t\t\ts = skipSpace(s)\n\t\t\t\t}\n\t\t\t\tif s != \"\" && s[0] != ',' && s[0] != ';' {\n\t\t\t\t\tcontinue headers\n\t\t\t\t}\n\t\t\t\text[k] = v\n\t\t\t}\n\t\t\tif s != \"\" && s[0] != ',' {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\tresult = append(result, ext)\n\t\t\tif s == \"\" {\n\t\t\t\tcontinue headers\n\t\t\t}\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\treturn result\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/util_test.go",
    "content": "// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage websocket\n\nimport (\n\t\"net/http\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nvar equalASCIIFoldTests = []struct {\n\tt, s string\n\teq   bool\n}{\n\t{\"WebSocket\", \"websocket\", true},\n\t{\"websocket\", \"WebSocket\", true},\n\t{\"Öyster\", \"öyster\", false},\n}\n\nfunc TestEqualASCIIFold(t *testing.T) {\n\tfor _, tt := range equalASCIIFoldTests {\n\t\teq := equalASCIIFold(tt.s, tt.t)\n\t\tif eq != tt.eq {\n\t\t\tt.Errorf(\"equalASCIIFold(%q, %q) = %v, want %v\", tt.s, tt.t, eq, tt.eq)\n\t\t}\n\t}\n}\n\nvar tokenListContainsValueTests = []struct {\n\tvalue string\n\tok    bool\n}{\n\t{\"WebSocket\", true},\n\t{\"WEBSOCKET\", true},\n\t{\"websocket\", true},\n\t{\"websockets\", false},\n\t{\"x websocket\", false},\n\t{\"websocket x\", false},\n\t{\"other,websocket,more\", true},\n\t{\"other, websocket, more\", true},\n}\n\nfunc TestTokenListContainsValue(t *testing.T) {\n\tfor _, tt := range tokenListContainsValueTests {\n\t\th := http.Header{\"Upgrade\": {tt.value}}\n\t\tok := tokenListContainsValue(h, \"Upgrade\", \"websocket\")\n\t\tif ok != tt.ok {\n\t\t\tt.Errorf(\"tokenListContainsValue(h, n, %q) = %v, want %v\", tt.value, ok, tt.ok)\n\t\t}\n\t}\n}\n\nvar parseExtensionTests = []struct {\n\tvalue      string\n\textensions []map[string]string\n}{\n\t{`foo`, []map[string]string{{\"\": \"foo\"}}},\n\t{`foo, bar; baz=2`, []map[string]string{\n\t\t{\"\": \"foo\"},\n\t\t{\"\": \"bar\", \"baz\": \"2\"}}},\n\t{`foo; bar=\"b,a;z\"`, []map[string]string{\n\t\t{\"\": \"foo\", \"bar\": \"b,a;z\"}}},\n\t{`foo , bar; baz = 2`, []map[string]string{\n\t\t{\"\": \"foo\"},\n\t\t{\"\": \"bar\", \"baz\": \"2\"}}},\n\t{`foo, bar; baz=2 junk`, []map[string]string{\n\t\t{\"\": \"foo\"}}},\n\t{`foo junk, bar; baz=2 junk`, nil},\n\t{`mux; max-channels=4; flow-control, deflate-stream`, []map[string]string{\n\t\t{\"\": \"mux\", \"max-channels\": \"4\", \"flow-control\": \"\"},\n\t\t{\"\": \"deflate-stream\"}}},\n\t{`permessage-foo; x=\"10\"`, []map[string]string{\n\t\t{\"\": \"permessage-foo\", \"x\": \"10\"}}},\n\t{`permessage-foo; use_y, permessage-foo`, []map[string]string{\n\t\t{\"\": \"permessage-foo\", \"use_y\": \"\"},\n\t\t{\"\": \"permessage-foo\"}}},\n\t{`permessage-deflate; client_max_window_bits; server_max_window_bits=10 , permessage-deflate; client_max_window_bits`, []map[string]string{\n\t\t{\"\": \"permessage-deflate\", \"client_max_window_bits\": \"\", \"server_max_window_bits\": \"10\"},\n\t\t{\"\": \"permessage-deflate\", \"client_max_window_bits\": \"\"}}},\n\t{\"permessage-deflate; server_no_context_takeover; client_max_window_bits=15\", []map[string]string{\n\t\t{\"\": \"permessage-deflate\", \"server_no_context_takeover\": \"\", \"client_max_window_bits\": \"15\"},\n\t}},\n}\n\nfunc TestParseExtensions(t *testing.T) {\n\tfor _, tt := range parseExtensionTests {\n\t\th := http.Header{http.CanonicalHeaderKey(\"Sec-WebSocket-Extensions\"): {tt.value}}\n\t\textensions := parseExtensions(h)\n\t\tif !reflect.DeepEqual(extensions, tt.extensions) {\n\t\t\tt.Errorf(\"parseExtensions(%q)\\n    = %v,\\nwant %v\", tt.value, extensions, tt.extensions)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/gorilla/websocket/x_net_proxy.go",
    "content": "// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.\n//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy\n\n// Package proxy provides support for a variety of protocols to proxy network\n// data.\n//\n\npackage websocket\n\nimport (\n\t\"errors\"\n\t\"io\"\n\t\"net\"\n\t\"net/url\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n)\n\ntype proxy_direct struct{}\n\n// Direct is a direct proxy: one that makes network connections directly.\nvar proxy_Direct = proxy_direct{}\n\nfunc (proxy_direct) Dial(network, addr string) (net.Conn, error) {\n\treturn net.Dial(network, addr)\n}\n\n// A PerHost directs connections to a default Dialer unless the host name\n// requested matches one of a number of exceptions.\ntype proxy_PerHost struct {\n\tdef, bypass proxy_Dialer\n\n\tbypassNetworks []*net.IPNet\n\tbypassIPs      []net.IP\n\tbypassZones    []string\n\tbypassHosts    []string\n}\n\n// NewPerHost returns a PerHost Dialer that directs connections to either\n// defaultDialer or bypass, depending on whether the connection matches one of\n// the configured rules.\nfunc proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost {\n\treturn &proxy_PerHost{\n\t\tdef:    defaultDialer,\n\t\tbypass: bypass,\n\t}\n}\n\n// Dial connects to the address addr on the given network through either\n// defaultDialer or bypass.\nfunc (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) {\n\thost, _, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p.dialerForRequest(host).Dial(network, addr)\n}\n\nfunc (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer {\n\tif ip := net.ParseIP(host); ip != nil {\n\t\tfor _, net := range p.bypassNetworks {\n\t\t\tif net.Contains(ip) {\n\t\t\t\treturn p.bypass\n\t\t\t}\n\t\t}\n\t\tfor _, bypassIP := range p.bypassIPs {\n\t\t\tif bypassIP.Equal(ip) {\n\t\t\t\treturn p.bypass\n\t\t\t}\n\t\t}\n\t\treturn p.def\n\t}\n\n\tfor _, zone := range p.bypassZones {\n\t\tif strings.HasSuffix(host, zone) {\n\t\t\treturn p.bypass\n\t\t}\n\t\tif host == zone[1:] {\n\t\t\t// For a zone \".example.com\", we match \"example.com\"\n\t\t\t// too.\n\t\t\treturn p.bypass\n\t\t}\n\t}\n\tfor _, bypassHost := range p.bypassHosts {\n\t\tif bypassHost == host {\n\t\t\treturn p.bypass\n\t\t}\n\t}\n\treturn p.def\n}\n\n// AddFromString parses a string that contains comma-separated values\n// specifying hosts that should use the bypass proxy. Each value is either an\n// IP address, a CIDR range, a zone (*.example.com) or a host name\n// (localhost). A best effort is made to parse the string and errors are\n// ignored.\nfunc (p *proxy_PerHost) AddFromString(s string) {\n\thosts := strings.Split(s, \",\")\n\tfor _, host := range hosts {\n\t\thost = strings.TrimSpace(host)\n\t\tif len(host) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(host, \"/\") {\n\t\t\t// We assume that it's a CIDR address like 127.0.0.0/8\n\t\t\tif _, net, err := net.ParseCIDR(host); err == nil {\n\t\t\t\tp.AddNetwork(net)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif ip := net.ParseIP(host); ip != nil {\n\t\t\tp.AddIP(ip)\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(host, \"*.\") {\n\t\t\tp.AddZone(host[1:])\n\t\t\tcontinue\n\t\t}\n\t\tp.AddHost(host)\n\t}\n}\n\n// AddIP specifies an IP address that will use the bypass proxy. Note that\n// this will only take effect if a literal IP address is dialed. A connection\n// to a named host will never match an IP.\nfunc (p *proxy_PerHost) AddIP(ip net.IP) {\n\tp.bypassIPs = append(p.bypassIPs, ip)\n}\n\n// AddNetwork specifies an IP range that will use the bypass proxy. Note that\n// this will only take effect if a literal IP address is dialed. A connection\n// to a named host will never match.\nfunc (p *proxy_PerHost) AddNetwork(net *net.IPNet) {\n\tp.bypassNetworks = append(p.bypassNetworks, net)\n}\n\n// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of\n// \"example.com\" matches \"example.com\" and all of its subdomains.\nfunc (p *proxy_PerHost) AddZone(zone string) {\n\tif strings.HasSuffix(zone, \".\") {\n\t\tzone = zone[:len(zone)-1]\n\t}\n\tif !strings.HasPrefix(zone, \".\") {\n\t\tzone = \".\" + zone\n\t}\n\tp.bypassZones = append(p.bypassZones, zone)\n}\n\n// AddHost specifies a host name that will use the bypass proxy.\nfunc (p *proxy_PerHost) AddHost(host string) {\n\tif strings.HasSuffix(host, \".\") {\n\t\thost = host[:len(host)-1]\n\t}\n\tp.bypassHosts = append(p.bypassHosts, host)\n}\n\n// A Dialer is a means to establish a connection.\ntype proxy_Dialer interface {\n\t// Dial connects to the given address via the proxy.\n\tDial(network, addr string) (c net.Conn, err error)\n}\n\n// Auth contains authentication parameters that specific Dialers may require.\ntype proxy_Auth struct {\n\tUser, Password string\n}\n\n// FromEnvironment returns the dialer specified by the proxy related variables in\n// the environment.\nfunc proxy_FromEnvironment() proxy_Dialer {\n\tallProxy := proxy_allProxyEnv.Get()\n\tif len(allProxy) == 0 {\n\t\treturn proxy_Direct\n\t}\n\n\tproxyURL, err := url.Parse(allProxy)\n\tif err != nil {\n\t\treturn proxy_Direct\n\t}\n\tproxy, err := proxy_FromURL(proxyURL, proxy_Direct)\n\tif err != nil {\n\t\treturn proxy_Direct\n\t}\n\n\tnoProxy := proxy_noProxyEnv.Get()\n\tif len(noProxy) == 0 {\n\t\treturn proxy\n\t}\n\n\tperHost := proxy_NewPerHost(proxy, proxy_Direct)\n\tperHost.AddFromString(noProxy)\n\treturn perHost\n}\n\n// proxySchemes is a map from URL schemes to a function that creates a Dialer\n// from a URL with such a scheme.\nvar proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)\n\n// RegisterDialerType takes a URL scheme and a function to generate Dialers from\n// a URL with that scheme and a forwarding Dialer. Registered schemes are used\n// by FromURL.\nfunc proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) {\n\tif proxy_proxySchemes == nil {\n\t\tproxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error))\n\t}\n\tproxy_proxySchemes[scheme] = f\n}\n\n// FromURL returns a Dialer given a URL specification and an underlying\n// Dialer for it to make network requests.\nfunc proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) {\n\tvar auth *proxy_Auth\n\tif u.User != nil {\n\t\tauth = new(proxy_Auth)\n\t\tauth.User = u.User.Username()\n\t\tif p, ok := u.User.Password(); ok {\n\t\t\tauth.Password = p\n\t\t}\n\t}\n\n\tswitch u.Scheme {\n\tcase \"socks5\":\n\t\treturn proxy_SOCKS5(\"tcp\", u.Host, auth, forward)\n\t}\n\n\t// If the scheme doesn't match any of the built-in schemes, see if it\n\t// was registered by another package.\n\tif proxy_proxySchemes != nil {\n\t\tif f, ok := proxy_proxySchemes[u.Scheme]; ok {\n\t\t\treturn f(u, forward)\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"proxy: unknown scheme: \" + u.Scheme)\n}\n\nvar (\n\tproxy_allProxyEnv = &proxy_envOnce{\n\t\tnames: []string{\"ALL_PROXY\", \"all_proxy\"},\n\t}\n\tproxy_noProxyEnv = &proxy_envOnce{\n\t\tnames: []string{\"NO_PROXY\", \"no_proxy\"},\n\t}\n)\n\n// envOnce looks up an environment variable (optionally by multiple\n// names) once. It mitigates expensive lookups on some platforms\n// (e.g. Windows).\n// (Borrowed from net/http/transport.go)\ntype proxy_envOnce struct {\n\tnames []string\n\tonce  sync.Once\n\tval   string\n}\n\nfunc (e *proxy_envOnce) Get() string {\n\te.once.Do(e.init)\n\treturn e.val\n}\n\nfunc (e *proxy_envOnce) init() {\n\tfor _, n := range e.names {\n\t\te.val = os.Getenv(n)\n\t\tif e.val != \"\" {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address\n// with an optional username and password. See RFC 1928 and RFC 1929.\nfunc proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) {\n\ts := &proxy_socks5{\n\t\tnetwork: network,\n\t\taddr:    addr,\n\t\tforward: forward,\n\t}\n\tif auth != nil {\n\t\ts.user = auth.User\n\t\ts.password = auth.Password\n\t}\n\n\treturn s, nil\n}\n\ntype proxy_socks5 struct {\n\tuser, password string\n\tnetwork, addr  string\n\tforward        proxy_Dialer\n}\n\nconst proxy_socks5Version = 5\n\nconst (\n\tproxy_socks5AuthNone     = 0\n\tproxy_socks5AuthPassword = 2\n)\n\nconst proxy_socks5Connect = 1\n\nconst (\n\tproxy_socks5IP4    = 1\n\tproxy_socks5Domain = 3\n\tproxy_socks5IP6    = 4\n)\n\nvar proxy_socks5Errors = []string{\n\t\"\",\n\t\"general failure\",\n\t\"connection forbidden\",\n\t\"network unreachable\",\n\t\"host unreachable\",\n\t\"connection refused\",\n\t\"TTL expired\",\n\t\"command not supported\",\n\t\"address type not supported\",\n}\n\n// Dial connects to the address addr on the given network via the SOCKS5 proxy.\nfunc (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) {\n\tswitch network {\n\tcase \"tcp\", \"tcp6\", \"tcp4\":\n\tdefault:\n\t\treturn nil, errors.New(\"proxy: no support for SOCKS5 proxy connections of type \" + network)\n\t}\n\n\tconn, err := s.forward.Dial(s.network, s.addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.connect(conn, addr); err != nil {\n\t\tconn.Close()\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}\n\n// connect takes an existing connection to a socks5 proxy server,\n// and commands the server to extend that connection to target,\n// which must be a canonical address with a host and port.\nfunc (s *proxy_socks5) connect(conn net.Conn, target string) error {\n\thost, portStr, err := net.SplitHostPort(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tport, err := strconv.Atoi(portStr)\n\tif err != nil {\n\t\treturn errors.New(\"proxy: failed to parse port number: \" + portStr)\n\t}\n\tif port < 1 || port > 0xffff {\n\t\treturn errors.New(\"proxy: port number out of range: \" + portStr)\n\t}\n\n\t// the size here is just an estimate\n\tbuf := make([]byte, 0, 6+len(host))\n\n\tbuf = append(buf, proxy_socks5Version)\n\tif len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 {\n\t\tbuf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword)\n\t} else {\n\t\tbuf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone)\n\t}\n\n\tif _, err := conn.Write(buf); err != nil {\n\t\treturn errors.New(\"proxy: failed to write greeting to SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\n\tif _, err := io.ReadFull(conn, buf[:2]); err != nil {\n\t\treturn errors.New(\"proxy: failed to read greeting from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\tif buf[0] != 5 {\n\t\treturn errors.New(\"proxy: SOCKS5 proxy at \" + s.addr + \" has unexpected version \" + strconv.Itoa(int(buf[0])))\n\t}\n\tif buf[1] == 0xff {\n\t\treturn errors.New(\"proxy: SOCKS5 proxy at \" + s.addr + \" requires authentication\")\n\t}\n\n\t// See RFC 1929\n\tif buf[1] == proxy_socks5AuthPassword {\n\t\tbuf = buf[:0]\n\t\tbuf = append(buf, 1 /* password protocol version */)\n\t\tbuf = append(buf, uint8(len(s.user)))\n\t\tbuf = append(buf, s.user...)\n\t\tbuf = append(buf, uint8(len(s.password)))\n\t\tbuf = append(buf, s.password...)\n\n\t\tif _, err := conn.Write(buf); err != nil {\n\t\t\treturn errors.New(\"proxy: failed to write authentication request to SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t\t}\n\n\t\tif _, err := io.ReadFull(conn, buf[:2]); err != nil {\n\t\t\treturn errors.New(\"proxy: failed to read authentication reply from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t\t}\n\n\t\tif buf[1] != 0 {\n\t\t\treturn errors.New(\"proxy: SOCKS5 proxy at \" + s.addr + \" rejected username/password\")\n\t\t}\n\t}\n\n\tbuf = buf[:0]\n\tbuf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */)\n\n\tif ip := net.ParseIP(host); ip != nil {\n\t\tif ip4 := ip.To4(); ip4 != nil {\n\t\t\tbuf = append(buf, proxy_socks5IP4)\n\t\t\tip = ip4\n\t\t} else {\n\t\t\tbuf = append(buf, proxy_socks5IP6)\n\t\t}\n\t\tbuf = append(buf, ip...)\n\t} else {\n\t\tif len(host) > 255 {\n\t\t\treturn errors.New(\"proxy: destination host name too long: \" + host)\n\t\t}\n\t\tbuf = append(buf, proxy_socks5Domain)\n\t\tbuf = append(buf, byte(len(host)))\n\t\tbuf = append(buf, host...)\n\t}\n\tbuf = append(buf, byte(port>>8), byte(port))\n\n\tif _, err := conn.Write(buf); err != nil {\n\t\treturn errors.New(\"proxy: failed to write connect request to SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\n\tif _, err := io.ReadFull(conn, buf[:4]); err != nil {\n\t\treturn errors.New(\"proxy: failed to read connect reply from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\n\tfailure := \"unknown error\"\n\tif int(buf[1]) < len(proxy_socks5Errors) {\n\t\tfailure = proxy_socks5Errors[buf[1]]\n\t}\n\n\tif len(failure) > 0 {\n\t\treturn errors.New(\"proxy: SOCKS5 proxy at \" + s.addr + \" failed to connect: \" + failure)\n\t}\n\n\tbytesToDiscard := 0\n\tswitch buf[3] {\n\tcase proxy_socks5IP4:\n\t\tbytesToDiscard = net.IPv4len\n\tcase proxy_socks5IP6:\n\t\tbytesToDiscard = net.IPv6len\n\tcase proxy_socks5Domain:\n\t\t_, err := io.ReadFull(conn, buf[:1])\n\t\tif err != nil {\n\t\t\treturn errors.New(\"proxy: failed to read domain length from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t\t}\n\t\tbytesToDiscard = int(buf[0])\n\tdefault:\n\t\treturn errors.New(\"proxy: got unknown address type \" + strconv.Itoa(int(buf[3])) + \" from SOCKS5 proxy at \" + s.addr)\n\t}\n\n\tif cap(buf) < bytesToDiscard {\n\t\tbuf = make([]byte, bytesToDiscard)\n\t} else {\n\t\tbuf = buf[:bytesToDiscard]\n\t}\n\tif _, err := io.ReadFull(conn, buf); err != nil {\n\t\treturn errors.New(\"proxy: failed to read address from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\n\t// Also need to discard the port number\n\tif _, err := io.ReadFull(conn, buf[:2]); err != nil {\n\t\treturn errors.New(\"proxy: failed to read port from SOCKS5 proxy at \" + s.addr + \": \" + err.Error())\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/bytes/README.md",
    "content": "# Bytes\n\n- Format bytes integer to human readable bytes string.\n- Parse human readable bytes string to bytes integer.\n\n## Installation\n\n```go\ngo get github.com/labstack/gommon/bytes\n```\n\n## [Usage](https://github.com/labstack/gommon/blob/master/bytes/bytes_test.go)\n\n### Format\n\n```go\nprintln(bytes.Format(13231323))\n```\n\n`12.62MB`\n\n### Parse\n\n```go\nb, _ = Parse(\"2M\")\nprintln(b)\n```\n\n`2097152`\n"
  },
  {
    "path": "src/github.com/labstack/gommon/bytes/bytes.go",
    "content": "package bytes\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n\t\"strconv\"\n)\n\ntype (\n\tBytes struct {\n\t}\n)\n\nconst (\n\tB = 1 << (10 * iota)\n\tKB\n\tMB\n\tGB\n\tTB\n\tPB\n\tEB\n)\n\nvar (\n\tpattern = regexp.MustCompile(`(?i)^(-?\\d+)([KMGTP]B?|B)$`)\n\tglobal  = New()\n)\n\n// New creates a Bytes instance.\nfunc New() *Bytes {\n\treturn &Bytes{}\n}\n\n// Format formats bytes integer to human readable string.\n// For example, 31323 bytes will return 30.59KB.\nfunc (*Bytes) Format(b int64) string {\n\tmultiple := \"\"\n\tvalue := float64(b)\n\n\tswitch {\n\tcase b < KB:\n\t\treturn strconv.FormatInt(b, 10) + \"B\"\n\tcase b < MB:\n\t\tvalue /= KB\n\t\tmultiple = \"KB\"\n\tcase b < MB:\n\t\tvalue /= KB\n\t\tmultiple = \"KB\"\n\tcase b < GB:\n\t\tvalue /= MB\n\t\tmultiple = \"MB\"\n\tcase b < TB:\n\t\tvalue /= GB\n\t\tmultiple = \"GB\"\n\tcase b < PB:\n\t\tvalue /= TB\n\t\tmultiple = \"TB\"\n\tcase b < EB:\n\t\tvalue /= PB\n\t\tmultiple = \"PB\"\n\t}\n\n\treturn fmt.Sprintf(\"%.02f%s\", value, multiple)\n}\n\n// Parse parses human readable bytes string to bytes integer.\n// For example, 6GB (6G is also valid) will return 6442450944.\nfunc (*Bytes) Parse(value string) (i int64, err error) {\n\tparts := pattern.FindStringSubmatch(value)\n\tif len(parts) < 3 {\n\t\treturn 0, fmt.Errorf(\"error parsing value=%s\", value)\n\t}\n\tbytesString := parts[1]\n\tmultiple := parts[2]\n\tbytes, err := strconv.ParseInt(bytesString, 10, 64)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch multiple {\n\tcase \"B\":\n\t\treturn bytes * B, nil\n\tcase \"K\", \"KB\":\n\t\treturn bytes * KB, nil\n\tcase \"M\", \"MB\":\n\t\treturn bytes * MB, nil\n\tcase \"G\", \"GB\":\n\t\treturn bytes * GB, nil\n\tcase \"T\", \"TB\":\n\t\treturn bytes * TB, nil\n\tcase \"P\", \"PB\":\n\t\treturn bytes * PB, nil\n\t}\n\n\treturn\n}\n\n// Format wraps global Bytes's Format function.\nfunc Format(b int64) string {\n\treturn global.Format(b)\n}\n\n// Parse wraps global Bytes's Parse function.\nfunc Parse(val string) (int64, error) {\n\treturn global.Parse(val)\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/bytes/bytes_test.go",
    "content": "package bytes\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestBytesFormat(t *testing.T) {\n\t// B\n\tb := Format(515)\n\tassert.Equal(t, \"515B\", b)\n\n\t// KB\n\tb = Format(31323)\n\tassert.Equal(t, \"30.59KB\", b)\n\n\t// MB\n\tb = Format(13231323)\n\tassert.Equal(t, \"12.62MB\", b)\n\n\t// GB\n\tb = Format(7323232398)\n\tassert.Equal(t, \"6.82GB\", b)\n\n\t// TB\n\tb = Format(7323232398434)\n\tassert.Equal(t, \"6.66TB\", b)\n\n\t// PB\n\tb = Format(9923232398434432)\n\tassert.Equal(t, \"8.81PB\", b)\n}\n\nfunc TestBytesParse(t *testing.T) {\n\t// B\n\tb, err := Parse(\"515B\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(515), b)\n\t}\n\n\t// KB\n\tb, err = Parse(\"12KB\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(12288), b)\n\t}\n\tb, err = Parse(\"12K\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(12288), b)\n\t}\n\n\t// MB\n\tb, err = Parse(\"2MB\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(2097152), b)\n\t}\n\tb, err = Parse(\"2M\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(2097152), b)\n\t}\n\n\t// GB\n\tb, err = Parse(\"6GB\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(6442450944), b)\n\t}\n\tb, err = Parse(\"6G\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(6442450944), b)\n\t}\n\n\t// TB\n\tb, err = Parse(\"5TB\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(5497558138880), b)\n\t}\n\tb, err = Parse(\"5T\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(5497558138880), b)\n\t}\n\n\t// PB\n\tb, err = Parse(\"9PB\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(10133099161583616), b)\n\t}\n\tb, err = Parse(\"9P\")\n\tif assert.NoError(t, err) {\n\t\tassert.Equal(t, int64(10133099161583616), b)\n\t}\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/color/README.md",
    "content": "# Color\n\nStyle terminal text.\n\n## Installation\n\n```sh\ngo get github.com/labstack/gommon/color\n```\n\n## Windows?\n\nTry [cmder](http://bliker.github.io/cmder) or https://github.com/mattn/go-colorable\n\n## [Usage](https://github.com/labstack/gommon/blob/master/color/color_test.go)\n\n```sh\nimport github.com/labstack/gommon/color\n```\n\n### Colored text\n\n```go\ncolor.Println(color.Black(\"black\"))\ncolor.Println(color.Red(\"red\"))\ncolor.Println(color.Green(\"green\"))\ncolor.Println(color.Yellow(\"yellow\"))\ncolor.Println(color.Blue(\"blue\"))\ncolor.Println(color.Magenta(\"magenta\"))\ncolor.Println(color.Cyan(\"cyan\"))\ncolor.Println(color.White(\"white\"))\ncolor.Println(color.Grey(\"grey\"))\n```\n![Colored Text](http://i.imgur.com/8RtY1QR.png)\n\n### Colored background\n\n```go\ncolor.Println(color.BlackBg(\"black background\", color.Wht))\ncolor.Println(color.RedBg(\"red background\"))\ncolor.Println(color.GreenBg(\"green background\"))\ncolor.Println(color.YellowBg(\"yellow background\"))\ncolor.Println(color.BlueBg(\"blue background\"))\ncolor.Println(color.MagentaBg(\"magenta background\"))\ncolor.Println(color.CyanBg(\"cyan background\"))\ncolor.Println(color.WhiteBg(\"white background\"))\n```\n![Colored Background](http://i.imgur.com/SrrS6lw.png)\n\n### Emphasis\n\n```go\ncolor.Println(color.Bold(\"bold\"))\ncolor.Println(color.Dim(\"dim\"))\ncolor.Println(color.Italic(\"italic\"))\ncolor.Println(color.Underline(\"underline\"))\ncolor.Println(color.Inverse(\"inverse\"))\ncolor.Println(color.Hidden(\"hidden\"))\ncolor.Println(color.Strikeout(\"strikeout\"))\n```\n![Emphasis](http://i.imgur.com/3RSJBbc.png)\n\n### Mix and match\n\n```go\ncolor.Println(color.Green(\"bold green with white background\", color.B, color.WhtBg))\ncolor.Println(color.Red(\"underline red\", color.U))\ncolor.Println(color.Yellow(\"dim yellow\", color.D))\ncolor.Println(color.Cyan(\"inverse cyan\", color.In))\ncolor.Println(color.Blue(\"bold underline dim blue\", color.B, color.U, color.D))\n```\n![Mix and match](http://i.imgur.com/jWGq9Ca.png)\n\n### Enable/Disable the package\n\n```go\ncolor.Disable()\ncolor.Enable()\n```\n\n### New instance\n\n```go\nc := New()\nc.Green(\"green\")\n```\n"
  },
  {
    "path": "src/github.com/labstack/gommon/color/color.go",
    "content": "package color\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\n\t\"github.com/mattn/go-colorable\"\n\t\"github.com/mattn/go-isatty\"\n)\n\ntype (\n\tinner func(interface{}, []string, *Color) string\n)\n\n// Color styles\nconst (\n\t// Blk Black text style\n\tBlk = \"30\"\n\t// Rd red text style\n\tRd = \"31\"\n\t// Grn green text style\n\tGrn = \"32\"\n\t// Yel yellow text style\n\tYel = \"33\"\n\t// Blu blue text style\n\tBlu = \"34\"\n\t// Mgn magenta text style\n\tMgn = \"35\"\n\t// Cyn cyan text style\n\tCyn = \"36\"\n\t// Wht white text style\n\tWht = \"37\"\n\t// Gry grey text style\n\tGry = \"90\"\n\n\t// BlkBg black background style\n\tBlkBg = \"40\"\n\t// RdBg red background style\n\tRdBg = \"41\"\n\t// GrnBg green background style\n\tGrnBg = \"42\"\n\t// YelBg yellow background style\n\tYelBg = \"43\"\n\t// BluBg blue background style\n\tBluBg = \"44\"\n\t// MgnBg magenta background style\n\tMgnBg = \"45\"\n\t// CynBg cyan background style\n\tCynBg = \"46\"\n\t// WhtBg white background style\n\tWhtBg = \"47\"\n\n\t// R reset emphasis style\n\tR = \"0\"\n\t// B bold emphasis style\n\tB = \"1\"\n\t// D dim emphasis style\n\tD = \"2\"\n\t// I italic emphasis style\n\tI = \"3\"\n\t// U underline emphasis style\n\tU = \"4\"\n\t// In inverse emphasis style\n\tIn = \"7\"\n\t// H hidden emphasis style\n\tH = \"8\"\n\t// S strikeout emphasis style\n\tS = \"9\"\n)\n\nvar (\n\tblack   = outer(Blk)\n\tred     = outer(Rd)\n\tgreen   = outer(Grn)\n\tyellow  = outer(Yel)\n\tblue    = outer(Blu)\n\tmagenta = outer(Mgn)\n\tcyan    = outer(Cyn)\n\twhite   = outer(Wht)\n\tgrey    = outer(Gry)\n\n\tblackBg   = outer(BlkBg)\n\tredBg     = outer(RdBg)\n\tgreenBg   = outer(GrnBg)\n\tyellowBg  = outer(YelBg)\n\tblueBg    = outer(BluBg)\n\tmagentaBg = outer(MgnBg)\n\tcyanBg    = outer(CynBg)\n\twhiteBg   = outer(WhtBg)\n\n\treset     = outer(R)\n\tbold      = outer(B)\n\tdim       = outer(D)\n\titalic    = outer(I)\n\tunderline = outer(U)\n\tinverse   = outer(In)\n\thidden    = outer(H)\n\tstrikeout = outer(S)\n\n\tglobal = New()\n)\n\nfunc outer(n string) inner {\n\treturn func(msg interface{}, styles []string, c *Color) string {\n\t\t// TODO: Drop fmt to boost performance?\n\t\tif c.disabled {\n\t\t\treturn fmt.Sprintf(\"%v\", msg)\n\t\t}\n\n\t\tb := new(bytes.Buffer)\n\t\tb.WriteString(\"\\x1b[\")\n\t\tb.WriteString(n)\n\t\tfor _, s := range styles {\n\t\t\tb.WriteString(\";\")\n\t\t\tb.WriteString(s)\n\t\t}\n\t\tb.WriteString(\"m\")\n\t\treturn fmt.Sprintf(\"%s%v\\x1b[0m\", b.String(), msg)\n\t}\n}\n\ntype (\n\tColor struct {\n\t\toutput   io.Writer\n\t\tdisabled bool\n\t}\n)\n\n// New creates a Color instance.\nfunc New() (c *Color) {\n\tc = new(Color)\n\tc.SetOutput(colorable.NewColorableStdout())\n\treturn\n}\n\n// Output returns the output.\nfunc (c *Color) Output() io.Writer {\n\treturn c.output\n}\n\n// SetOutput sets the output.\nfunc (c *Color) SetOutput(w io.Writer) {\n\tc.output = w\n\tif w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {\n\t\tc.disabled = true\n\t}\n}\n\n// Disable disables the colors and styles.\nfunc (c *Color) Disable() {\n\tc.disabled = true\n}\n\n// Enable enables the colors and styles.\nfunc (c *Color) Enable() {\n\tc.disabled = false\n}\n\n// Print is analogous to `fmt.Print` with termial detection.\nfunc (c *Color) Print(args ...interface{}) {\n\tfmt.Fprint(c.output, args...)\n}\n\n// Println is analogous to `fmt.Println` with termial detection.\nfunc (c *Color) Println(args ...interface{}) {\n\tfmt.Fprintln(c.output, args...)\n}\n\n// Printf is analogous to `fmt.Printf` with termial detection.\nfunc (c *Color) Printf(format string, args ...interface{}) {\n\tfmt.Fprintf(c.output, format, args...)\n}\n\nfunc (c *Color) Black(msg interface{}, styles ...string) string {\n\treturn black(msg, styles, c)\n}\n\nfunc (c *Color) Red(msg interface{}, styles ...string) string {\n\treturn red(msg, styles, c)\n}\n\nfunc (c *Color) Green(msg interface{}, styles ...string) string {\n\treturn green(msg, styles, c)\n}\n\nfunc (c *Color) Yellow(msg interface{}, styles ...string) string {\n\treturn yellow(msg, styles, c)\n}\n\nfunc (c *Color) Blue(msg interface{}, styles ...string) string {\n\treturn blue(msg, styles, c)\n}\n\nfunc (c *Color) Magenta(msg interface{}, styles ...string) string {\n\treturn magenta(msg, styles, c)\n}\n\nfunc (c *Color) Cyan(msg interface{}, styles ...string) string {\n\treturn cyan(msg, styles, c)\n}\n\nfunc (c *Color) White(msg interface{}, styles ...string) string {\n\treturn white(msg, styles, c)\n}\n\nfunc (c *Color) Grey(msg interface{}, styles ...string) string {\n\treturn grey(msg, styles, c)\n}\n\nfunc (c *Color) BlackBg(msg interface{}, styles ...string) string {\n\treturn blackBg(msg, styles, c)\n}\n\nfunc (c *Color) RedBg(msg interface{}, styles ...string) string {\n\treturn redBg(msg, styles, c)\n}\n\nfunc (c *Color) GreenBg(msg interface{}, styles ...string) string {\n\treturn greenBg(msg, styles, c)\n}\n\nfunc (c *Color) YellowBg(msg interface{}, styles ...string) string {\n\treturn yellowBg(msg, styles, c)\n}\n\nfunc (c *Color) BlueBg(msg interface{}, styles ...string) string {\n\treturn blueBg(msg, styles, c)\n}\n\nfunc (c *Color) MagentaBg(msg interface{}, styles ...string) string {\n\treturn magentaBg(msg, styles, c)\n}\n\nfunc (c *Color) CyanBg(msg interface{}, styles ...string) string {\n\treturn cyanBg(msg, styles, c)\n}\n\nfunc (c *Color) WhiteBg(msg interface{}, styles ...string) string {\n\treturn whiteBg(msg, styles, c)\n}\n\nfunc (c *Color) Reset(msg interface{}, styles ...string) string {\n\treturn reset(msg, styles, c)\n}\n\nfunc (c *Color) Bold(msg interface{}, styles ...string) string {\n\treturn bold(msg, styles, c)\n}\n\nfunc (c *Color) Dim(msg interface{}, styles ...string) string {\n\treturn dim(msg, styles, c)\n}\n\nfunc (c *Color) Italic(msg interface{}, styles ...string) string {\n\treturn italic(msg, styles, c)\n}\n\nfunc (c *Color) Underline(msg interface{}, styles ...string) string {\n\treturn underline(msg, styles, c)\n}\n\nfunc (c *Color) Inverse(msg interface{}, styles ...string) string {\n\treturn inverse(msg, styles, c)\n}\n\nfunc (c *Color) Hidden(msg interface{}, styles ...string) string {\n\treturn hidden(msg, styles, c)\n}\n\nfunc (c *Color) Strikeout(msg interface{}, styles ...string) string {\n\treturn strikeout(msg, styles, c)\n}\n\n// Output returns the output.\nfunc Output() io.Writer {\n\treturn global.output\n}\n\n// SetOutput sets the output.\nfunc SetOutput(w io.Writer) {\n\tglobal.SetOutput(w)\n}\n\nfunc Disable() {\n\tglobal.Disable()\n}\n\nfunc Enable() {\n\tglobal.Enable()\n}\n\n// Print is analogous to `fmt.Print` with termial detection.\nfunc Print(args ...interface{}) {\n\tglobal.Print(args...)\n}\n\n// Println is analogous to `fmt.Println` with termial detection.\nfunc Println(args ...interface{}) {\n\tglobal.Println(args...)\n}\n\n// Printf is analogous to `fmt.Printf` with termial detection.\nfunc Printf(format string, args ...interface{}) {\n\tglobal.Printf(format, args...)\n}\n\nfunc Black(msg interface{}, styles ...string) string {\n\treturn global.Black(msg, styles...)\n}\n\nfunc Red(msg interface{}, styles ...string) string {\n\treturn global.Red(msg, styles...)\n}\n\nfunc Green(msg interface{}, styles ...string) string {\n\treturn global.Green(msg, styles...)\n}\n\nfunc Yellow(msg interface{}, styles ...string) string {\n\treturn global.Yellow(msg, styles...)\n}\n\nfunc Blue(msg interface{}, styles ...string) string {\n\treturn global.Blue(msg, styles...)\n}\n\nfunc Magenta(msg interface{}, styles ...string) string {\n\treturn global.Magenta(msg, styles...)\n}\n\nfunc Cyan(msg interface{}, styles ...string) string {\n\treturn global.Cyan(msg, styles...)\n}\n\nfunc White(msg interface{}, styles ...string) string {\n\treturn global.White(msg, styles...)\n}\n\nfunc Grey(msg interface{}, styles ...string) string {\n\treturn global.Grey(msg, styles...)\n}\n\nfunc BlackBg(msg interface{}, styles ...string) string {\n\treturn global.BlackBg(msg, styles...)\n}\n\nfunc RedBg(msg interface{}, styles ...string) string {\n\treturn global.RedBg(msg, styles...)\n}\n\nfunc GreenBg(msg interface{}, styles ...string) string {\n\treturn global.GreenBg(msg, styles...)\n}\n\nfunc YellowBg(msg interface{}, styles ...string) string {\n\treturn global.YellowBg(msg, styles...)\n}\n\nfunc BlueBg(msg interface{}, styles ...string) string {\n\treturn global.BlueBg(msg, styles...)\n}\n\nfunc MagentaBg(msg interface{}, styles ...string) string {\n\treturn global.MagentaBg(msg, styles...)\n}\n\nfunc CyanBg(msg interface{}, styles ...string) string {\n\treturn global.CyanBg(msg, styles...)\n}\n\nfunc WhiteBg(msg interface{}, styles ...string) string {\n\treturn global.WhiteBg(msg, styles...)\n}\n\nfunc Reset(msg interface{}, styles ...string) string {\n\treturn global.Reset(msg, styles...)\n}\n\nfunc Bold(msg interface{}, styles ...string) string {\n\treturn global.Bold(msg, styles...)\n}\n\nfunc Dim(msg interface{}, styles ...string) string {\n\treturn global.Dim(msg, styles...)\n}\n\nfunc Italic(msg interface{}, styles ...string) string {\n\treturn global.Italic(msg, styles...)\n}\n\nfunc Underline(msg interface{}, styles ...string) string {\n\treturn global.Underline(msg, styles...)\n}\n\nfunc Inverse(msg interface{}, styles ...string) string {\n\treturn global.Inverse(msg, styles...)\n}\n\nfunc Hidden(msg interface{}, styles ...string) string {\n\treturn global.Hidden(msg, styles...)\n}\n\nfunc Strikeout(msg interface{}, styles ...string) string {\n\treturn global.Strikeout(msg, styles...)\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/color/color_test.go",
    "content": "package color\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestText(t *testing.T) {\n\tPrintln(\"*** colored text ***\")\n\tPrintln(Black(\"black\"))\n\tPrintln(Red(\"red\"))\n\tPrintln(Green(\"green\"))\n\tPrintln(Yellow(\"yellow\"))\n\tPrintln(Blue(\"blue\"))\n\tPrintln(Magenta(\"magenta\"))\n\tPrintln(Cyan(\"cyan\"))\n\tPrintln(White(\"white\"))\n\tPrintln(Grey(\"grey\"))\n}\n\nfunc TestBackground(t *testing.T) {\n\tPrintln(\"*** colored background ***\")\n\tPrintln(BlackBg(\"black background\", Wht))\n\tPrintln(RedBg(\"red background\"))\n\tPrintln(GreenBg(\"green background\"))\n\tPrintln(YellowBg(\"yellow background\"))\n\tPrintln(BlueBg(\"blue background\"))\n\tPrintln(MagentaBg(\"magenta background\"))\n\tPrintln(CyanBg(\"cyan background\"))\n\tPrintln(WhiteBg(\"white background\"))\n}\n\nfunc TestEmphasis(t *testing.T) {\n\tPrintln(\"*** emphasis ***\")\n\tPrintln(Reset(\"reset\"))\n\tPrintln(Bold(\"bold\"))\n\tPrintln(Dim(\"dim\"))\n\tPrintln(Italic(\"italic\"))\n\tPrintln(Underline(\"underline\"))\n\tPrintln(Inverse(\"inverse\"))\n\tPrintln(Hidden(\"hidden\"))\n\tPrintln(Strikeout(\"strikeout\"))\n}\n\nfunc TestMixMatch(t *testing.T) {\n\tPrintln(\"*** mix and match ***\")\n\tPrintln(Green(\"bold green with white background\", B, WhtBg))\n\tPrintln(Red(\"underline red\", U))\n\tPrintln(Yellow(\"dim yellow\", D))\n\tPrintln(Cyan(\"inverse cyan\", In))\n\tPrintln(Blue(\"bold underline dim blue\", B, U, D))\n}\n\nfunc TestEnableDisable(t *testing.T) {\n\tDisable()\n\tassert.Equal(t, \"red\", Red(\"red\"))\n\tEnable()\n\tassert.NotEqual(t, \"green\", Green(\"green\"))\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/gommon.go",
    "content": "package gommon\n"
  },
  {
    "path": "src/github.com/labstack/gommon/log/README.md",
    "content": "## WORK IN PROGRESS\n\n### Usage\n\n[log_test.go](log_test.go)\n"
  },
  {
    "path": "src/github.com/labstack/gommon/log/color.go",
    "content": "// +build !appengine\n\npackage log\n\nimport (\n\t\"io\"\n\n\t\"github.com/mattn/go-colorable\"\n)\n\nfunc output() io.Writer {\n\treturn colorable.NewColorableStdout()\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/log/log.go",
    "content": "package log\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path\"\n\t\"runtime\"\n\t\"sync\"\n\t\"time\"\n\n\t\"strconv\"\n\n\t\"github.com/mattn/go-isatty\"\n\t\"github.com/valyala/fasttemplate\"\n\n\t\"github.com/labstack/gommon/color\"\n)\n\ntype (\n\tLogger struct {\n\t\tprefix     string\n\t\tlevel      Lvl\n\t\toutput     io.Writer\n\t\ttemplate   *fasttemplate.Template\n\t\tlevels     []string\n\t\tcolor      *color.Color\n\t\tbufferPool sync.Pool\n\t\tmutex      sync.Mutex\n\t}\n\n\tLvl uint8\n\n\tJSON map[string]interface{}\n)\n\nconst (\n\tDEBUG Lvl = iota + 1\n\tINFO\n\tWARN\n\tERROR\n\tOFF\n)\n\nvar (\n\tglobal        = New(\"-\")\n\tdefaultHeader = `{\"time\":\"${time_rfc3339}\",\"level\":\"${level}\",\"prefix\":\"${prefix}\",` +\n\t\t`\"file\":\"${short_file}\",\"line\":\"${line}\"}`\n)\n\nfunc New(prefix string) (l *Logger) {\n\tl = &Logger{\n\t\tlevel:    INFO,\n\t\tprefix:   prefix,\n\t\ttemplate: l.newTemplate(defaultHeader),\n\t\tcolor:    color.New(),\n\t\tbufferPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn bytes.NewBuffer(make([]byte, 256))\n\t\t\t},\n\t\t},\n\t}\n\tl.initLevels()\n\tl.SetOutput(output())\n\treturn\n}\n\nfunc (l *Logger) initLevels() {\n\tl.levels = []string{\n\t\t\"-\",\n\t\tl.color.Blue(\"DEBUG\"),\n\t\tl.color.Green(\"INFO\"),\n\t\tl.color.Yellow(\"WARN\"),\n\t\tl.color.Red(\"ERROR\"),\n\t}\n}\n\nfunc (l *Logger) newTemplate(format string) *fasttemplate.Template {\n\treturn fasttemplate.New(format, \"${\", \"}\")\n}\n\nfunc (l *Logger) DisableColor() {\n\tl.color.Disable()\n\tl.initLevels()\n}\n\nfunc (l *Logger) EnableColor() {\n\tl.color.Enable()\n\tl.initLevels()\n}\n\nfunc (l *Logger) Prefix() string {\n\treturn l.prefix\n}\n\nfunc (l *Logger) SetPrefix(p string) {\n\tl.prefix = p\n}\n\nfunc (l *Logger) Level() Lvl {\n\treturn l.level\n}\n\nfunc (l *Logger) SetLevel(v Lvl) {\n\tl.level = v\n}\n\nfunc (l *Logger) Output() io.Writer {\n\treturn l.output\n}\n\nfunc (l *Logger) SetOutput(w io.Writer) {\n\tl.output = w\n\tif w, ok := w.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {\n\t\tl.DisableColor()\n\t}\n}\n\nfunc (l *Logger) Color() *color.Color {\n\treturn l.color\n}\n\nfunc (l *Logger) SetHeader(h string) {\n\tl.template = l.newTemplate(h)\n}\n\nfunc (l *Logger) Print(i ...interface{}) {\n\tl.log(0, \"\", i...)\n\t// fmt.Fprintln(l.output, i...)\n}\n\nfunc (l *Logger) Printf(format string, args ...interface{}) {\n\tl.log(0, format, args...)\n}\n\nfunc (l *Logger) Printj(j JSON) {\n\tl.log(0, \"json\", j)\n}\n\nfunc (l *Logger) Debug(i ...interface{}) {\n\tl.log(DEBUG, \"\", i...)\n}\n\nfunc (l *Logger) Debugf(format string, args ...interface{}) {\n\tl.log(DEBUG, format, args...)\n}\n\nfunc (l *Logger) Debugj(j JSON) {\n\tl.log(DEBUG, \"json\", j)\n}\n\nfunc (l *Logger) Info(i ...interface{}) {\n\tl.log(INFO, \"\", i...)\n}\n\nfunc (l *Logger) Infof(format string, args ...interface{}) {\n\tl.log(INFO, format, args...)\n}\n\nfunc (l *Logger) Infoj(j JSON) {\n\tl.log(INFO, \"json\", j)\n}\n\nfunc (l *Logger) Warn(i ...interface{}) {\n\tl.log(WARN, \"\", i...)\n}\n\nfunc (l *Logger) Warnf(format string, args ...interface{}) {\n\tl.log(WARN, format, args...)\n}\n\nfunc (l *Logger) Warnj(j JSON) {\n\tl.log(WARN, \"json\", j)\n}\n\nfunc (l *Logger) Error(i ...interface{}) {\n\tl.log(ERROR, \"\", i...)\n}\n\nfunc (l *Logger) Errorf(format string, args ...interface{}) {\n\tl.log(ERROR, format, args...)\n}\n\nfunc (l *Logger) Errorj(j JSON) {\n\tl.log(ERROR, \"json\", j)\n}\n\nfunc (l *Logger) Fatal(i ...interface{}) {\n\tl.Print(i...)\n\tos.Exit(1)\n}\n\nfunc (l *Logger) Fatalf(format string, args ...interface{}) {\n\tl.Printf(format, args...)\n\tos.Exit(1)\n}\n\nfunc (l *Logger) Fatalj(j JSON) {\n\tl.Printj(j)\n\tos.Exit(1)\n}\n\nfunc (l *Logger) Panic(i ...interface{}) {\n\tl.Print(i...)\n\tpanic(fmt.Sprint(i...))\n}\n\nfunc (l *Logger) Panicf(format string, args ...interface{}) {\n\tl.Printf(format, args...)\n\tpanic(fmt.Sprintf(format, args))\n}\n\nfunc (l *Logger) Panicj(j JSON) {\n\tl.Printj(j)\n\tpanic(j)\n}\n\nfunc DisableColor() {\n\tglobal.DisableColor()\n}\n\nfunc EnableColor() {\n\tglobal.EnableColor()\n}\n\nfunc Prefix() string {\n\treturn global.Prefix()\n}\n\nfunc SetPrefix(p string) {\n\tglobal.SetPrefix(p)\n}\n\nfunc Level() Lvl {\n\treturn global.Level()\n}\n\nfunc SetLevel(v Lvl) {\n\tglobal.SetLevel(v)\n}\n\nfunc Output() io.Writer {\n\treturn global.Output()\n}\n\nfunc SetOutput(w io.Writer) {\n\tglobal.SetOutput(w)\n}\n\nfunc SetHeader(h string) {\n\tglobal.SetHeader(h)\n}\n\nfunc Print(i ...interface{}) {\n\tglobal.Print(i...)\n}\n\nfunc Printf(format string, args ...interface{}) {\n\tglobal.Printf(format, args...)\n}\n\nfunc Printj(j JSON) {\n\tglobal.Printj(j)\n}\n\nfunc Debug(i ...interface{}) {\n\tglobal.Debug(i...)\n}\n\nfunc Debugf(format string, args ...interface{}) {\n\tglobal.Debugf(format, args...)\n}\n\nfunc Debugj(j JSON) {\n\tglobal.Debugj(j)\n}\n\nfunc Info(i ...interface{}) {\n\tglobal.Info(i...)\n}\n\nfunc Infof(format string, args ...interface{}) {\n\tglobal.Infof(format, args...)\n}\n\nfunc Infoj(j JSON) {\n\tglobal.Infoj(j)\n}\n\nfunc Warn(i ...interface{}) {\n\tglobal.Warn(i...)\n}\n\nfunc Warnf(format string, args ...interface{}) {\n\tglobal.Warnf(format, args...)\n}\n\nfunc Warnj(j JSON) {\n\tglobal.Warnj(j)\n}\n\nfunc Error(i ...interface{}) {\n\tglobal.Error(i...)\n}\n\nfunc Errorf(format string, args ...interface{}) {\n\tglobal.Errorf(format, args...)\n}\n\nfunc Errorj(j JSON) {\n\tglobal.Errorj(j)\n}\n\nfunc Fatal(i ...interface{}) {\n\tglobal.Fatal(i...)\n}\n\nfunc Fatalf(format string, args ...interface{}) {\n\tglobal.Fatalf(format, args...)\n}\n\nfunc Fatalj(j JSON) {\n\tglobal.Fatalj(j)\n}\n\nfunc Panic(i ...interface{}) {\n\tglobal.Panic(i...)\n}\n\nfunc Panicf(format string, args ...interface{}) {\n\tglobal.Panicf(format, args...)\n}\n\nfunc Panicj(j JSON) {\n\tglobal.Panicj(j)\n}\n\nfunc (l *Logger) log(v Lvl, format string, args ...interface{}) {\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\tbuf := l.bufferPool.Get().(*bytes.Buffer)\n\tbuf.Reset()\n\tdefer l.bufferPool.Put(buf)\n\t_, file, line, _ := runtime.Caller(3)\n\n\tif v >= l.level || v == 0 {\n\t\tmessage := \"\"\n\t\tif format == \"\" {\n\t\t\tmessage = fmt.Sprint(args...)\n\t\t} else if format == \"json\" {\n\t\t\tb, err := json.Marshal(args[0])\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tmessage = string(b)\n\t\t} else {\n\t\t\tmessage = fmt.Sprintf(format, args...)\n\t\t}\n\n\t\t_, err := l.template.ExecuteFunc(buf, func(w io.Writer, tag string) (int, error) {\n\t\t\tswitch tag {\n\t\t\tcase \"time_rfc3339\":\n\t\t\t\treturn w.Write([]byte(time.Now().Format(time.RFC3339)))\n\t\t\tcase \"level\":\n\t\t\t\treturn w.Write([]byte(l.levels[v]))\n\t\t\tcase \"prefix\":\n\t\t\t\treturn w.Write([]byte(l.prefix))\n\t\t\tcase \"long_file\":\n\t\t\t\treturn w.Write([]byte(file))\n\t\t\tcase \"short_file\":\n\t\t\t\treturn w.Write([]byte(path.Base(file)))\n\t\t\tcase \"line\":\n\t\t\t\treturn w.Write([]byte(strconv.Itoa(line)))\n\t\t\t}\n\t\t\treturn 0, nil\n\t\t})\n\n\t\tif err == nil {\n\t\t\ts := buf.String()\n\t\t\ti := buf.Len() - 1\n\t\t\tif s[i] == '}' {\n\t\t\t\t// JSON header\n\t\t\t\tbuf.Truncate(i)\n\t\t\t\tbuf.WriteByte(',')\n\t\t\t\tif format == \"json\" {\n\t\t\t\t\tbuf.WriteString(message[1:])\n\t\t\t\t} else {\n\t\t\t\t\tbuf.WriteString(`\"message\":\"`)\n\t\t\t\t\tbuf.WriteString(message)\n\t\t\t\t\tbuf.WriteString(`\"}`)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Text header\n\t\t\t\tbuf.WriteByte(' ')\n\t\t\t\tbuf.WriteString(message)\n\t\t\t}\n\t\t\tbuf.WriteByte('\\n')\n\t\t\tl.output.Write(buf.Bytes())\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/log/log_test.go",
    "content": "package log\n\nimport (\n\t\"bytes\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sync\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc test(l *Logger, t *testing.T) {\n\tb := new(bytes.Buffer)\n\tl.SetOutput(b)\n\tl.DisableColor()\n\tl.SetLevel(WARN)\n\n\tl.Print(\"print\")\n\tl.Printf(\"print%s\", \"f\")\n\tl.Debug(\"debug\")\n\tl.Debugf(\"debug%s\", \"f\")\n\tl.Info(\"info\")\n\tl.Infof(\"info%s\", \"f\")\n\tl.Warn(\"warn\")\n\tl.Warnf(\"warn%s\", \"f\")\n\tl.Error(\"error\")\n\tl.Errorf(\"error%s\", \"f\")\n\n\tassert.Contains(t, b.String(), \"print\")\n\tassert.Contains(t, b.String(), \"printf\")\n\tassert.NotContains(t, b.String(), \"debug\")\n\tassert.NotContains(t, b.String(), \"debugf\")\n\tassert.NotContains(t, b.String(), \"info\")\n\tassert.NotContains(t, b.String(), \"infof\")\n\tassert.Contains(t, b.String(), `\"level\":\"WARN\",\"prefix\":\"`+l.prefix+`\"`)\n\tassert.Contains(t, b.String(), `\"message\":\"warn\"`)\n\tassert.Contains(t, b.String(), `\"level\":\"ERROR\",\"prefix\":\"`+l.prefix+`\"`)\n\tassert.Contains(t, b.String(), `\"message\":\"errorf\"`)\n}\n\nfunc TestLog(t *testing.T) {\n\tl := New(\"test\")\n\ttest(l, t)\n}\n\nfunc TestGlobal(t *testing.T) {\n\ttest(global, t)\n}\n\nfunc TestLogConcurrent(t *testing.T) {\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < 2; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tTestLog(t)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\twg.Wait()\n}\n\nfunc TestFatal(t *testing.T) {\n\tl := New(\"test\")\n\tswitch os.Getenv(\"TEST_LOGGER_FATAL\") {\n\tcase \"fatal\":\n\t\tl.Fatal(\"fatal\")\n\t\treturn\n\tcase \"fatalf\":\n\t\tl.Fatalf(\"fatal-%s\", \"f\")\n\t\treturn\n\t}\n\n\tloggerFatalTest(t, \"fatal\", \"fatal\")\n\tloggerFatalTest(t, \"fatalf\", \"fatal-f\")\n}\n\nfunc loggerFatalTest(t *testing.T, env string, contains string) {\n\tbuf := new(bytes.Buffer)\n\tcmd := exec.Command(os.Args[0], \"-test.run=TestFatal\")\n\tcmd.Env = append(os.Environ(), \"TEST_LOGGER_FATAL=\"+env)\n\tcmd.Stdout = buf\n\tcmd.Stderr = buf\n\terr := cmd.Run()\n\tif e, ok := err.(*exec.ExitError); ok && !e.Success() {\n\t\tassert.Contains(t, buf.String(), contains)\n\t\treturn\n\t}\n\tt.Fatalf(\"process ran with err %v, want exit status 1\", err)\n}\n\nfunc TestNoFormat(t *testing.T) {\n}\n\nfunc TestFormat(t *testing.T) {\n\tl := New(\"test\")\n\tl.SetHeader(\"${level} | ${prefix}\")\n\tb := new(bytes.Buffer)\n\tl.SetOutput(b)\n\tl.Info(\"info\")\n\tassert.Equal(t, \"INFO | test info\\n\", b.String())\n}\n\nfunc TestJSON(t *testing.T) {\n\tl := New(\"test\")\n\tb := new(bytes.Buffer)\n\tl.SetOutput(b)\n\tl.SetLevel(DEBUG)\n\tl.Debugj(JSON{\"name\": \"value\"})\n\tassert.Contains(t, b.String(), `\"name\":\"value\"`)\n}\n\nfunc BenchmarkLog(b *testing.B) {\n\tl := New(\"test\")\n\tl.SetOutput(new(bytes.Buffer))\n\tfor i := 0; i < b.N; i++ {\n\t\tl.Infof(\"Info=%s, Debug=%s\", \"info\", \"debug\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/log/white.go",
    "content": "// +build appengine\n\npackage log\n\nimport (\n\t\"io\"\n\t\"os\"\n)\n\nfunc output() io.Writer {\n\treturn os.Stdout\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/random/random.go",
    "content": "package random\n\nimport (\n\t\"math/rand\"\n\t\"time\"\n)\n\ntype (\n\tRandom struct {\n\t\tcharset Charset\n\t}\n\n\tCharset string\n)\n\nconst (\n\tAlphanumeric Charset = Alphabetic + Numeric\n\tAlphabetic   Charset = \"abcdefghijklmnopqrstuvwxyz\" + \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\tNumeric      Charset = \"0123456789\"\n\tHex          Charset = Numeric + \"abcdef\"\n)\n\nvar (\n\tglobal = New()\n)\n\nfunc New() *Random {\n\trand.Seed(time.Now().UnixNano())\n\treturn &Random{\n\t\tcharset: Alphanumeric,\n\t}\n}\n\nfunc (r *Random) SetCharset(c Charset) {\n\tr.charset = c\n}\n\nfunc (r *Random) String(length uint8) string {\n\tb := make([]byte, length)\n\tfor i := range b {\n\t\tb[i] = r.charset[rand.Int63()%int64(len(r.charset))]\n\t}\n\treturn string(b)\n}\n\nfunc SetCharset(c Charset) {\n\tglobal.SetCharset(c)\n}\n\nfunc String(length uint8) string {\n\treturn global.String(length)\n}\n"
  },
  {
    "path": "src/github.com/labstack/gommon/random/random_test.go",
    "content": "package random\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc Test(t *testing.T) {\n\tassert.Len(t, String(32), 32)\n\tr := New()\n\tr.SetCharset(Numeric)\n\tassert.Len(t, r.String(8), 8)\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/CONTRIBUTING.md",
    "content": "## Contributing to pq\n\n`pq` has a backlog of pull requests, but contributions are still very\nmuch welcome. You can help with patch review, submitting bug reports,\nor adding new functionality. There is no formal style guide, but\nplease conform to the style of existing code and general Go formatting\nconventions when submitting patches.\n\n### Patch review\n\nHelp review existing open pull requests by commenting on the code or\nproposed functionality.\n\n### Bug reports\n\nWe appreciate any bug reports, but especially ones with self-contained\n(doesn't depend on code outside of pq), minimal (can't be simplified\nfurther) test cases. It's especially helpful if you can submit a pull\nrequest with just the failing test case (you'll probably want to\npattern it after the tests in\n[conn_test.go](https://github.com/lib/pq/blob/master/conn_test.go).\n\n### New functionality\n\nThere are a number of pending patches for new functionality, so\nadditional feature patches will take a while to merge. Still, patches\nare generally reviewed based on usefulness and complexity in addition\nto time-in-queue, so if you have a knockout idea, take a shot. Feel\nfree to open an issue discussion your proposed patch beforehand.\n"
  },
  {
    "path": "src/github.com/lib/pq/LICENSE.md",
    "content": "Copyright (c) 2011-2013, 'pq' Contributors\nPortions Copyright (C) 2011 Blake Mizerany\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "src/github.com/lib/pq/README.md",
    "content": "# pq - A pure Go postgres driver for Go's database/sql package\n\n[![Build Status](https://travis-ci.org/lib/pq.png?branch=master)](https://travis-ci.org/lib/pq)\n\n## Install\n\n\tgo get github.com/lib/pq\n\n## Docs\n\nFor detailed documentation and basic usage examples, please see the package\ndocumentation at <http://godoc.org/github.com/lib/pq>.\n\n## Tests\n\n`go test` is used for testing.  A running PostgreSQL server is\nrequired, with the ability to log in.  The default database to connect\nto test with is \"pqgotest,\" but it can be overridden using environment\nvariables.\n\nExample:\n\n\tPGHOST=/var/run/postgresql go test github.com/lib/pq\n\nOptionally, a benchmark suite can be run as part of the tests:\n\n\tPGHOST=/var/run/postgresql go test -bench .\n\n## Features\n\n* SSL\n* Handles bad connections for `database/sql`\n* Scan `time.Time` correctly (i.e. `timestamp[tz]`, `time[tz]`, `date`)\n* Scan binary blobs correctly (i.e. `bytea`)\n* Package for `hstore` support\n* COPY FROM support\n* pq.ParseURL for converting urls to connection strings for sql.Open.\n* Many libpq compatible environment variables\n* Unix socket support\n* Notifications: `LISTEN`/`NOTIFY`\n\n## Future / Things you can help with\n\n* Better COPY FROM / COPY TO (see discussion in #181)\n\n## Thank you (alphabetical)\n\nSome of these contributors are from the original library `bmizerany/pq.go` whose\ncode still exists in here.\n\n* Andy Balholm (andybalholm)\n* Ben Berkert (benburkert)\n* Benjamin Heatwole (bheatwole)\n* Bill Mill (llimllib)\n* Bjørn Madsen (aeons)\n* Blake Gentry (bgentry)\n* Brad Fitzpatrick (bradfitz)\n* Charlie Melbye (cmelbye)\n* Chris Bandy (cbandy)\n* Chris Gilling (cgilling)\n* Chris Walsh (cwds)\n* Dan Sosedoff (sosedoff)\n* Daniel Farina (fdr)\n* Eric Chlebek (echlebek)\n* Eric Garrido (minusnine)\n* Eric Urban (hydrogen18)\n* Everyone at The Go Team\n* Evan Shaw (edsrzf)\n* Ewan Chou (coocood)\n* Federico Romero (federomero)\n* Fumin (fumin)\n* Gary Burd (garyburd)\n* Heroku (heroku)\n* James Pozdena (jpoz)\n* Jason McVetta (jmcvetta)\n* Jeremy Jay (pbnjay)\n* Joakim Sernbrant (serbaut)\n* John Gallagher (jgallagher)\n* Jonathan Rudenberg (titanous)\n* Joël Stemmer (jstemmer)\n* Kamil Kisiel (kisielk)\n* Kelly Dunn (kellydunn)\n* Keith Rarick (kr)\n* Kir Shatrov (kirs)\n* Lann Martin (lann)\n* Maciek Sakrejda (deafbybeheading)\n* Marc Brinkmann (mbr)\n* Marko Tiikkaja (johto)\n* Matt Newberry (MattNewberry)\n* Matt Robenolt (mattrobenolt)\n* Martin Olsen (martinolsen)\n* Mike Lewis (mikelikespie)\n* Nicolas Patry (Narsil)\n* Oliver Tonnhofer (olt)\n* Patrick Hayes (phayes)\n* Paul Hammond (paulhammond)\n* Ryan Smith (ryandotsmith)\n* Samuel Stauffer (samuel)\n* Timothée Peignier (cyberdelia)\n* Travis Cline (tmc)\n* TruongSinh Tran-Nguyen (truongsinh)\n* Yaismel Miranda (ympons)\n* notedit (notedit)\n"
  },
  {
    "path": "src/github.com/lib/pq/buf.go",
    "content": "package pq\n\nimport (\n\t\"bytes\"\n\t\"encoding/binary\"\n\n\t\"github.com/lib/pq/oid\"\n)\n\ntype readBuf []byte\n\nfunc (b *readBuf) int32() (n int) {\n\tn = int(int32(binary.BigEndian.Uint32(*b)))\n\t*b = (*b)[4:]\n\treturn\n}\n\nfunc (b *readBuf) oid() (n oid.Oid) {\n\tn = oid.Oid(binary.BigEndian.Uint32(*b))\n\t*b = (*b)[4:]\n\treturn\n}\n\n// N.B: this is actually an unsigned 16-bit integer, unlike int32\nfunc (b *readBuf) int16() (n int) {\n\tn = int(binary.BigEndian.Uint16(*b))\n\t*b = (*b)[2:]\n\treturn\n}\n\nfunc (b *readBuf) string() string {\n\ti := bytes.IndexByte(*b, 0)\n\tif i < 0 {\n\t\terrorf(\"invalid message format; expected string terminator\")\n\t}\n\ts := (*b)[:i]\n\t*b = (*b)[i+1:]\n\treturn string(s)\n}\n\nfunc (b *readBuf) next(n int) (v []byte) {\n\tv = (*b)[:n]\n\t*b = (*b)[n:]\n\treturn\n}\n\nfunc (b *readBuf) byte() byte {\n\treturn b.next(1)[0]\n}\n\ntype writeBuf struct {\n\tbuf []byte\n\tpos int\n}\n\nfunc (b *writeBuf) int32(n int) {\n\tx := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(x, uint32(n))\n\tb.buf = append(b.buf, x...)\n}\n\nfunc (b *writeBuf) int16(n int) {\n\tx := make([]byte, 2)\n\tbinary.BigEndian.PutUint16(x, uint16(n))\n\tb.buf = append(b.buf, x...)\n}\n\nfunc (b *writeBuf) string(s string) {\n\tb.buf = append(b.buf, (s + \"\\000\")...)\n}\n\nfunc (b *writeBuf) byte(c byte) {\n\tb.buf = append(b.buf, c)\n}\n\nfunc (b *writeBuf) bytes(v []byte) {\n\tb.buf = append(b.buf, v...)\n}\n\nfunc (b *writeBuf) wrap() []byte {\n\tp := b.buf[b.pos:]\n\tbinary.BigEndian.PutUint32(p, uint32(len(p)))\n\treturn b.buf\n}\n\nfunc (b *writeBuf) next(c byte) {\n\tp := b.buf[b.pos:]\n\tbinary.BigEndian.PutUint32(p, uint32(len(p)))\n\tb.pos = len(b.buf) + 1\n\tb.buf = append(b.buf, c, 0, 0, 0, 0)\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/conn.go",
    "content": "package pq\n\nimport (\n\t\"bufio\"\n\t\"crypto/md5\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"database/sql\"\n\t\"database/sql/driver\"\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"net\"\n\t\"os\"\n\t\"os/user\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode\"\n\n\t\"github.com/lib/pq/oid\"\n)\n\n// Common error types\nvar (\n\tErrNotSupported              = errors.New(\"pq: Unsupported command\")\n\tErrInFailedTransaction       = errors.New(\"pq: Could not complete operation in a failed transaction\")\n\tErrSSLNotSupported           = errors.New(\"pq: SSL is not enabled on the server\")\n\tErrSSLKeyHasWorldPermissions = errors.New(\"pq: Private key file has group or world access. Permissions should be u=rw (0600) or less.\")\n\tErrCouldNotDetectUsername    = errors.New(\"pq: Could not detect default username. Please provide one explicitly.\")\n)\n\ntype drv struct{}\n\nfunc (d *drv) Open(name string) (driver.Conn, error) {\n\treturn Open(name)\n}\n\nfunc init() {\n\tsql.Register(\"postgres\", &drv{})\n}\n\ntype parameterStatus struct {\n\t// server version in the same format as server_version_num, or 0 if\n\t// unavailable\n\tserverVersion int\n\n\t// the current location based on the TimeZone value of the session, if\n\t// available\n\tcurrentLocation *time.Location\n}\n\ntype transactionStatus byte\n\nconst (\n\ttxnStatusIdle                transactionStatus = 'I'\n\ttxnStatusIdleInTransaction   transactionStatus = 'T'\n\ttxnStatusInFailedTransaction transactionStatus = 'E'\n)\n\nfunc (s transactionStatus) String() string {\n\tswitch s {\n\tcase txnStatusIdle:\n\t\treturn \"idle\"\n\tcase txnStatusIdleInTransaction:\n\t\treturn \"idle in transaction\"\n\tcase txnStatusInFailedTransaction:\n\t\treturn \"in a failed transaction\"\n\tdefault:\n\t\terrorf(\"unknown transactionStatus %d\", s)\n\t}\n\n\tpanic(\"not reached\")\n}\n\ntype Dialer interface {\n\tDial(network, address string) (net.Conn, error)\n\tDialTimeout(network, address string, timeout time.Duration) (net.Conn, error)\n}\n\ntype defaultDialer struct{}\n\nfunc (d defaultDialer) Dial(ntw, addr string) (net.Conn, error) {\n\treturn net.Dial(ntw, addr)\n}\nfunc (d defaultDialer) DialTimeout(ntw, addr string, timeout time.Duration) (net.Conn, error) {\n\treturn net.DialTimeout(ntw, addr, timeout)\n}\n\ntype conn struct {\n\tc         net.Conn\n\tbuf       *bufio.Reader\n\tnamei     int\n\tscratch   [512]byte\n\ttxnStatus transactionStatus\n\n\tparameterStatus parameterStatus\n\n\tsaveMessageType   byte\n\tsaveMessageBuffer []byte\n\n\t// If true, this connection is bad and all public-facing functions should\n\t// return ErrBadConn.\n\tbad bool\n\n\t// If set, this connection should never use the binary format when\n\t// receiving query results from prepared statements.  Only provided for\n\t// debugging.\n\tdisablePreparedBinaryResult bool\n\n\t// Whether to always send []byte parameters over as binary.  Enables single\n\t// round-trip mode for non-prepared Query calls.\n\tbinaryParameters bool\n}\n\n// Handle driver-side settings in parsed connection string.\nfunc (c *conn) handleDriverSettings(o values) (err error) {\n\tboolSetting := func(key string, val *bool) error {\n\t\tif value := o.Get(key); value != \"\" {\n\t\t\tif value == \"yes\" {\n\t\t\t\t*val = true\n\t\t\t} else if value == \"no\" {\n\t\t\t\t*val = false\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"unrecognized value %q for %s\", value, key)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\terr = boolSetting(\"disable_prepared_binary_result\", &c.disablePreparedBinaryResult)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = boolSetting(\"binary_parameters\", &c.binaryParameters)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (c *conn) writeBuf(b byte) *writeBuf {\n\tc.scratch[0] = b\n\treturn &writeBuf{\n\t\tbuf: c.scratch[:5],\n\t\tpos: 1,\n\t}\n}\n\nfunc Open(name string) (_ driver.Conn, err error) {\n\treturn DialOpen(defaultDialer{}, name)\n}\n\nfunc DialOpen(d Dialer, name string) (_ driver.Conn, err error) {\n\t// Handle any panics during connection initialization.  Note that we\n\t// specifically do *not* want to use errRecover(), as that would turn any\n\t// connection errors into ErrBadConns, hiding the real error message from\n\t// the user.\n\tdefer errRecoverNoErrBadConn(&err)\n\n\to := make(values)\n\n\t// A number of defaults are applied here, in this order:\n\t//\n\t// * Very low precedence defaults applied in every situation\n\t// * Environment variables\n\t// * Explicitly passed connection information\n\to.Set(\"host\", \"localhost\")\n\to.Set(\"port\", \"5432\")\n\t// N.B.: Extra float digits should be set to 3, but that breaks\n\t// Postgres 8.4 and older, where the max is 2.\n\to.Set(\"extra_float_digits\", \"2\")\n\tfor k, v := range parseEnviron(os.Environ()) {\n\t\to.Set(k, v)\n\t}\n\n\tif strings.HasPrefix(name, \"postgres://\") || strings.HasPrefix(name, \"postgresql://\") {\n\t\tname, err = ParseURL(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := parseOpts(name, o); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Use the \"fallback\" application name if necessary\n\tif fallback := o.Get(\"fallback_application_name\"); fallback != \"\" {\n\t\tif !o.Isset(\"application_name\") {\n\t\t\to.Set(\"application_name\", fallback)\n\t\t}\n\t}\n\n\t// We can't work with any client_encoding other than UTF-8 currently.\n\t// However, we have historically allowed the user to set it to UTF-8\n\t// explicitly, and there's no reason to break such programs, so allow that.\n\t// Note that the \"options\" setting could also set client_encoding, but\n\t// parsing its value is not worth it.  Instead, we always explicitly send\n\t// client_encoding as a separate run-time parameter, which should override\n\t// anything set in options.\n\tif enc := o.Get(\"client_encoding\"); enc != \"\" && !isUTF8(enc) {\n\t\treturn nil, errors.New(\"client_encoding must be absent or 'UTF8'\")\n\t}\n\to.Set(\"client_encoding\", \"UTF8\")\n\t// DateStyle needs a similar treatment.\n\tif datestyle := o.Get(\"datestyle\"); datestyle != \"\" {\n\t\tif datestyle != \"ISO, MDY\" {\n\t\t\tpanic(fmt.Sprintf(\"setting datestyle must be absent or %v; got %v\",\n\t\t\t\t\"ISO, MDY\", datestyle))\n\t\t}\n\t} else {\n\t\to.Set(\"datestyle\", \"ISO, MDY\")\n\t}\n\n\t// If a user is not provided by any other means, the last\n\t// resort is to use the current operating system provided user\n\t// name.\n\tif o.Get(\"user\") == \"\" {\n\t\tu, err := userCurrent()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\to.Set(\"user\", u)\n\t\t}\n\t}\n\n\tcn := &conn{}\n\terr = cn.handleDriverSettings(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcn.c, err = dial(d, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcn.ssl(o)\n\tcn.buf = bufio.NewReader(cn.c)\n\tcn.startup(o)\n\n\t// reset the deadline, in case one was set (see dial)\n\tif timeout := o.Get(\"connect_timeout\"); timeout != \"\" && timeout != \"0\" {\n\t\terr = cn.c.SetDeadline(time.Time{})\n\t}\n\treturn cn, err\n}\n\nfunc dial(d Dialer, o values) (net.Conn, error) {\n\tntw, addr := network(o)\n\t// SSL is not necessary or supported over UNIX domain sockets\n\tif ntw == \"unix\" {\n\t\to[\"sslmode\"] = \"disable\"\n\t}\n\n\t// Zero or not specified means wait indefinitely.\n\tif timeout := o.Get(\"connect_timeout\"); timeout != \"\" && timeout != \"0\" {\n\t\tseconds, err := strconv.ParseInt(timeout, 10, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for parameter connect_timeout: %s\", err)\n\t\t}\n\t\tduration := time.Duration(seconds) * time.Second\n\t\t// connect_timeout should apply to the entire connection establishment\n\t\t// procedure, so we both use a timeout for the TCP connection\n\t\t// establishment and set a deadline for doing the initial handshake.\n\t\t// The deadline is then reset after startup() is done.\n\t\tdeadline := time.Now().Add(duration)\n\t\tconn, err := d.DialTimeout(ntw, addr, duration)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = conn.SetDeadline(deadline)\n\t\treturn conn, err\n\t}\n\treturn d.Dial(ntw, addr)\n}\n\nfunc network(o values) (string, string) {\n\thost := o.Get(\"host\")\n\n\tif strings.HasPrefix(host, \"/\") {\n\t\tsockPath := path.Join(host, \".s.PGSQL.\"+o.Get(\"port\"))\n\t\treturn \"unix\", sockPath\n\t}\n\n\treturn \"tcp\", host + \":\" + o.Get(\"port\")\n}\n\ntype values map[string]string\n\nfunc (vs values) Set(k, v string) {\n\tvs[k] = v\n}\n\nfunc (vs values) Get(k string) (v string) {\n\treturn vs[k]\n}\n\nfunc (vs values) Isset(k string) bool {\n\t_, ok := vs[k]\n\treturn ok\n}\n\n// scanner implements a tokenizer for libpq-style option strings.\ntype scanner struct {\n\ts []rune\n\ti int\n}\n\n// newScanner returns a new scanner initialized with the option string s.\nfunc newScanner(s string) *scanner {\n\treturn &scanner{[]rune(s), 0}\n}\n\n// Next returns the next rune.\n// It returns 0, false if the end of the text has been reached.\nfunc (s *scanner) Next() (rune, bool) {\n\tif s.i >= len(s.s) {\n\t\treturn 0, false\n\t}\n\tr := s.s[s.i]\n\ts.i++\n\treturn r, true\n}\n\n// SkipSpaces returns the next non-whitespace rune.\n// It returns 0, false if the end of the text has been reached.\nfunc (s *scanner) SkipSpaces() (rune, bool) {\n\tr, ok := s.Next()\n\tfor unicode.IsSpace(r) && ok {\n\t\tr, ok = s.Next()\n\t}\n\treturn r, ok\n}\n\n// parseOpts parses the options from name and adds them to the values.\n//\n// The parsing code is based on conninfo_parse from libpq's fe-connect.c\nfunc parseOpts(name string, o values) error {\n\ts := newScanner(name)\n\n\tfor {\n\t\tvar (\n\t\t\tkeyRunes, valRunes []rune\n\t\t\tr                  rune\n\t\t\tok                 bool\n\t\t)\n\n\t\tif r, ok = s.SkipSpaces(); !ok {\n\t\t\tbreak\n\t\t}\n\n\t\t// Scan the key\n\t\tfor !unicode.IsSpace(r) && r != '=' {\n\t\t\tkeyRunes = append(keyRunes, r)\n\t\t\tif r, ok = s.Next(); !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Skip any whitespace if we're not at the = yet\n\t\tif r != '=' {\n\t\t\tr, ok = s.SkipSpaces()\n\t\t}\n\n\t\t// The current character should be =\n\t\tif r != '=' || !ok {\n\t\t\treturn fmt.Errorf(`missing \"=\" after %q in connection info string\"`, string(keyRunes))\n\t\t}\n\n\t\t// Skip any whitespace after the =\n\t\tif r, ok = s.SkipSpaces(); !ok {\n\t\t\t// If we reach the end here, the last value is just an empty string as per libpq.\n\t\t\to.Set(string(keyRunes), \"\")\n\t\t\tbreak\n\t\t}\n\n\t\tif r != '\\'' {\n\t\t\tfor !unicode.IsSpace(r) {\n\t\t\t\tif r == '\\\\' {\n\t\t\t\t\tif r, ok = s.Next(); !ok {\n\t\t\t\t\t\treturn fmt.Errorf(`missing character after backslash`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalRunes = append(valRunes, r)\n\n\t\t\t\tif r, ok = s.Next(); !ok {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\tquote:\n\t\t\tfor {\n\t\t\t\tif r, ok = s.Next(); !ok {\n\t\t\t\t\treturn fmt.Errorf(`unterminated quoted string literal in connection string`)\n\t\t\t\t}\n\t\t\t\tswitch r {\n\t\t\t\tcase '\\'':\n\t\t\t\t\tbreak quote\n\t\t\t\tcase '\\\\':\n\t\t\t\t\tr, _ = s.Next()\n\t\t\t\t\tfallthrough\n\t\t\t\tdefault:\n\t\t\t\t\tvalRunes = append(valRunes, r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\to.Set(string(keyRunes), string(valRunes))\n\t}\n\n\treturn nil\n}\n\nfunc (cn *conn) isInTransaction() bool {\n\treturn cn.txnStatus == txnStatusIdleInTransaction ||\n\t\tcn.txnStatus == txnStatusInFailedTransaction\n}\n\nfunc (cn *conn) checkIsInTransaction(intxn bool) {\n\tif cn.isInTransaction() != intxn {\n\t\tcn.bad = true\n\t\terrorf(\"unexpected transaction status %v\", cn.txnStatus)\n\t}\n}\n\nfunc (cn *conn) Begin() (_ driver.Tx, err error) {\n\tif cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\tcn.checkIsInTransaction(false)\n\t_, commandTag, err := cn.simpleExec(\"BEGIN\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif commandTag != \"BEGIN\" {\n\t\tcn.bad = true\n\t\treturn nil, fmt.Errorf(\"unexpected command tag %s\", commandTag)\n\t}\n\tif cn.txnStatus != txnStatusIdleInTransaction {\n\t\tcn.bad = true\n\t\treturn nil, fmt.Errorf(\"unexpected transaction status %v\", cn.txnStatus)\n\t}\n\treturn cn, nil\n}\n\nfunc (cn *conn) Commit() (err error) {\n\tif cn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\tcn.checkIsInTransaction(true)\n\t// We don't want the client to think that everything is okay if it tries\n\t// to commit a failed transaction.  However, no matter what we return,\n\t// database/sql will release this connection back into the free connection\n\t// pool so we have to abort the current transaction here.  Note that you\n\t// would get the same behaviour if you issued a COMMIT in a failed\n\t// transaction, so it's also the least surprising thing to do here.\n\tif cn.txnStatus == txnStatusInFailedTransaction {\n\t\tif err := cn.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ErrInFailedTransaction\n\t}\n\n\t_, commandTag, err := cn.simpleExec(\"COMMIT\")\n\tif err != nil {\n\t\tif cn.isInTransaction() {\n\t\t\tcn.bad = true\n\t\t}\n\t\treturn err\n\t}\n\tif commandTag != \"COMMIT\" {\n\t\tcn.bad = true\n\t\treturn fmt.Errorf(\"unexpected command tag %s\", commandTag)\n\t}\n\tcn.checkIsInTransaction(false)\n\treturn nil\n}\n\nfunc (cn *conn) Rollback() (err error) {\n\tif cn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\tcn.checkIsInTransaction(true)\n\t_, commandTag, err := cn.simpleExec(\"ROLLBACK\")\n\tif err != nil {\n\t\tif cn.isInTransaction() {\n\t\t\tcn.bad = true\n\t\t}\n\t\treturn err\n\t}\n\tif commandTag != \"ROLLBACK\" {\n\t\treturn fmt.Errorf(\"unexpected command tag %s\", commandTag)\n\t}\n\tcn.checkIsInTransaction(false)\n\treturn nil\n}\n\nfunc (cn *conn) gname() string {\n\tcn.namei++\n\treturn strconv.FormatInt(int64(cn.namei), 10)\n}\n\nfunc (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, err error) {\n\tb := cn.writeBuf('Q')\n\tb.string(q)\n\tcn.send(b)\n\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'C':\n\t\t\tres, commandTag = cn.parseComplete(r.string())\n\t\tcase 'Z':\n\t\t\tcn.processReadyForQuery(r)\n\t\t\t// done\n\t\t\treturn\n\t\tcase 'E':\n\t\t\terr = parseError(r)\n\t\tcase 'T', 'D', 'I':\n\t\t\t// ignore any results\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unknown response for simple query: %q\", t)\n\t\t}\n\t}\n}\n\nfunc (cn *conn) simpleQuery(q string) (res *rows, err error) {\n\tdefer cn.errRecover(&err)\n\n\tst := &stmt{cn: cn, name: \"\"}\n\n\tb := cn.writeBuf('Q')\n\tb.string(q)\n\tcn.send(b)\n\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'C', 'I':\n\t\t\t// We allow queries which don't return any results through Query as\n\t\t\t// well as Exec.  We still have to give database/sql a rows object\n\t\t\t// the user can close, though, to avoid connections from being\n\t\t\t// leaked.  A \"rows\" with done=true works fine for that purpose.\n\t\t\tif err != nil {\n\t\t\t\tcn.bad = true\n\t\t\t\terrorf(\"unexpected message %q in simple query execution\", t)\n\t\t\t}\n\t\t\tres = &rows{\n\t\t\t\tcn:       cn,\n\t\t\t\tcolNames: st.colNames,\n\t\t\t\tcolTyps:  st.colTyps,\n\t\t\t\tcolFmts:  st.colFmts,\n\t\t\t\tdone:     true,\n\t\t\t}\n\t\tcase 'Z':\n\t\t\tcn.processReadyForQuery(r)\n\t\t\t// done\n\t\t\treturn\n\t\tcase 'E':\n\t\t\tres = nil\n\t\t\terr = parseError(r)\n\t\tcase 'D':\n\t\t\tif res == nil {\n\t\t\t\tcn.bad = true\n\t\t\t\terrorf(\"unexpected DataRow in simple query execution\")\n\t\t\t}\n\t\t\t// the query didn't fail; kick off to Next\n\t\t\tcn.saveMessage(t, r)\n\t\t\treturn\n\t\tcase 'T':\n\t\t\t// res might be non-nil here if we received a previous\n\t\t\t// CommandComplete, but that's fine; just overwrite it\n\t\t\tres = &rows{cn: cn}\n\t\t\tres.colNames, res.colFmts, res.colTyps = parsePortalRowDescribe(r)\n\n\t\t\t// To work around a bug in QueryRow in Go 1.2 and earlier, wait\n\t\t\t// until the first DataRow has been received.\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unknown response for simple query: %q\", t)\n\t\t}\n\t}\n}\n\n// Decides which column formats to use for a prepared statement.  The input is\n// an array of type oids, one element per result column.\nfunc decideColumnFormats(colTyps []oid.Oid, forceText bool) (colFmts []format, colFmtData []byte) {\n\tif len(colTyps) == 0 {\n\t\treturn nil, colFmtDataAllText\n\t}\n\n\tcolFmts = make([]format, len(colTyps))\n\tif forceText {\n\t\treturn colFmts, colFmtDataAllText\n\t}\n\n\tallBinary := true\n\tallText := true\n\tfor i, o := range colTyps {\n\t\tswitch o {\n\t\t// This is the list of types to use binary mode for when receiving them\n\t\t// through a prepared statement.  If a type appears in this list, it\n\t\t// must also be implemented in binaryDecode in encode.go.\n\t\tcase oid.T_bytea:\n\t\t\tfallthrough\n\t\tcase oid.T_int8:\n\t\t\tfallthrough\n\t\tcase oid.T_int4:\n\t\t\tfallthrough\n\t\tcase oid.T_int2:\n\t\t\tcolFmts[i] = formatBinary\n\t\t\tallText = false\n\n\t\tdefault:\n\t\t\tallBinary = false\n\t\t}\n\t}\n\n\tif allBinary {\n\t\treturn colFmts, colFmtDataAllBinary\n\t} else if allText {\n\t\treturn colFmts, colFmtDataAllText\n\t} else {\n\t\tcolFmtData = make([]byte, 2+len(colFmts)*2)\n\t\tbinary.BigEndian.PutUint16(colFmtData, uint16(len(colFmts)))\n\t\tfor i, v := range colFmts {\n\t\t\tbinary.BigEndian.PutUint16(colFmtData[2+i*2:], uint16(v))\n\t\t}\n\t\treturn colFmts, colFmtData\n\t}\n}\n\nfunc (cn *conn) prepareTo(q, stmtName string) *stmt {\n\tst := &stmt{cn: cn, name: stmtName}\n\n\tb := cn.writeBuf('P')\n\tb.string(st.name)\n\tb.string(q)\n\tb.int16(0)\n\n\tb.next('D')\n\tb.byte('S')\n\tb.string(st.name)\n\n\tb.next('S')\n\tcn.send(b)\n\n\tcn.readParseResponse()\n\tst.paramTyps, st.colNames, st.colTyps = cn.readStatementDescribeResponse()\n\tst.colFmts, st.colFmtData = decideColumnFormats(st.colTyps, cn.disablePreparedBinaryResult)\n\tcn.readReadyForQuery()\n\treturn st\n}\n\nfunc (cn *conn) Prepare(q string) (_ driver.Stmt, err error) {\n\tif cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\tif len(q) >= 4 && strings.EqualFold(q[:4], \"COPY\") {\n\t\treturn cn.prepareCopyIn(q)\n\t}\n\treturn cn.prepareTo(q, cn.gname()), nil\n}\n\nfunc (cn *conn) Close() (err error) {\n\tif cn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\t// Don't go through send(); ListenerConn relies on us not scribbling on the\n\t// scratch buffer of this connection.\n\terr = cn.sendSimpleMessage('X')\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cn.c.Close()\n}\n\n// Implement the \"Queryer\" interface\nfunc (cn *conn) Query(query string, args []driver.Value) (_ driver.Rows, err error) {\n\tif cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\t// Check to see if we can use the \"simpleQuery\" interface, which is\n\t// *much* faster than going through prepare/exec\n\tif len(args) == 0 {\n\t\treturn cn.simpleQuery(query)\n\t}\n\n\tif cn.binaryParameters {\n\t\tcn.sendBinaryModeQuery(query, args)\n\n\t\tcn.readParseResponse()\n\t\tcn.readBindResponse()\n\t\trows := &rows{cn: cn}\n\t\trows.colNames, rows.colFmts, rows.colTyps = cn.readPortalDescribeResponse()\n\t\tcn.postExecuteWorkaround()\n\t\treturn rows, nil\n\t} else {\n\t\tst := cn.prepareTo(query, \"\")\n\t\tst.exec(args)\n\t\treturn &rows{\n\t\t\tcn:       cn,\n\t\t\tcolNames: st.colNames,\n\t\t\tcolTyps:  st.colTyps,\n\t\t\tcolFmts:  st.colFmts,\n\t\t}, nil\n\t}\n}\n\n// Implement the optional \"Execer\" interface for one-shot queries\nfunc (cn *conn) Exec(query string, args []driver.Value) (res driver.Result, err error) {\n\tif cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer cn.errRecover(&err)\n\n\t// Check to see if we can use the \"simpleExec\" interface, which is\n\t// *much* faster than going through prepare/exec\n\tif len(args) == 0 {\n\t\t// ignore commandTag, our caller doesn't care\n\t\tr, _, err := cn.simpleExec(query)\n\t\treturn r, err\n\t}\n\n\tif cn.binaryParameters {\n\t\tcn.sendBinaryModeQuery(query, args)\n\n\t\tcn.readParseResponse()\n\t\tcn.readBindResponse()\n\t\tcn.readPortalDescribeResponse()\n\t\tcn.postExecuteWorkaround()\n\t\tres, _, err = cn.readExecuteResponse(\"Execute\")\n\t\treturn res, err\n\t} else {\n\t\t// Use the unnamed statement to defer planning until bind\n\t\t// time, or else value-based selectivity estimates cannot be\n\t\t// used.\n\t\tst := cn.prepareTo(query, \"\")\n\t\tr, err := st.Exec(args)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn r, err\n\t}\n}\n\nfunc (cn *conn) send(m *writeBuf) {\n\t_, err := cn.c.Write(m.wrap())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n\nfunc (cn *conn) sendStartupPacket(m *writeBuf) {\n\t// sanity check\n\tif m.buf[0] != 0 {\n\t\tpanic(\"oops\")\n\t}\n\n\t_, err := cn.c.Write((m.wrap())[1:])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n\n// Send a message of type typ to the server on the other end of cn.  The\n// message should have no payload.  This method does not use the scratch\n// buffer.\nfunc (cn *conn) sendSimpleMessage(typ byte) (err error) {\n\t_, err = cn.c.Write([]byte{typ, '\\x00', '\\x00', '\\x00', '\\x04'})\n\treturn err\n}\n\n// saveMessage memorizes a message and its buffer in the conn struct.\n// recvMessage will then return these values on the next call to it.  This\n// method is useful in cases where you have to see what the next message is\n// going to be (e.g. to see whether it's an error or not) but you can't handle\n// the message yourself.\nfunc (cn *conn) saveMessage(typ byte, buf *readBuf) {\n\tif cn.saveMessageType != 0 {\n\t\tcn.bad = true\n\t\terrorf(\"unexpected saveMessageType %d\", cn.saveMessageType)\n\t}\n\tcn.saveMessageType = typ\n\tcn.saveMessageBuffer = *buf\n}\n\n// recvMessage receives any message from the backend, or returns an error if\n// a problem occurred while reading the message.\nfunc (cn *conn) recvMessage(r *readBuf) (byte, error) {\n\t// workaround for a QueryRow bug, see exec\n\tif cn.saveMessageType != 0 {\n\t\tt := cn.saveMessageType\n\t\t*r = cn.saveMessageBuffer\n\t\tcn.saveMessageType = 0\n\t\tcn.saveMessageBuffer = nil\n\t\treturn t, nil\n\t}\n\n\tx := cn.scratch[:5]\n\t_, err := io.ReadFull(cn.buf, x)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// read the type and length of the message that follows\n\tt := x[0]\n\tn := int(binary.BigEndian.Uint32(x[1:])) - 4\n\tvar y []byte\n\tif n <= len(cn.scratch) {\n\t\ty = cn.scratch[:n]\n\t} else {\n\t\ty = make([]byte, n)\n\t}\n\t_, err = io.ReadFull(cn.buf, y)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t*r = y\n\treturn t, nil\n}\n\n// recv receives a message from the backend, but if an error happened while\n// reading the message or the received message was an ErrorResponse, it panics.\n// NoticeResponses are ignored.  This function should generally be used only\n// during the startup sequence.\nfunc (cn *conn) recv() (t byte, r *readBuf) {\n\tfor {\n\t\tvar err error\n\t\tr = &readBuf{}\n\t\tt, err = cn.recvMessage(r)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tswitch t {\n\t\tcase 'E':\n\t\t\tpanic(parseError(r))\n\t\tcase 'N':\n\t\t\t// ignore\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// recv1Buf is exactly equivalent to recv1, except it uses a buffer supplied by\n// the caller to avoid an allocation.\nfunc (cn *conn) recv1Buf(r *readBuf) byte {\n\tfor {\n\t\tt, err := cn.recvMessage(r)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tswitch t {\n\t\tcase 'A', 'N':\n\t\t\t// ignore\n\t\tcase 'S':\n\t\t\tcn.processParameterStatus(r)\n\t\tdefault:\n\t\t\treturn t\n\t\t}\n\t}\n}\n\n// recv1 receives a message from the backend, panicking if an error occurs\n// while attempting to read it.  All asynchronous messages are ignored, with\n// the exception of ErrorResponse.\nfunc (cn *conn) recv1() (t byte, r *readBuf) {\n\tr = &readBuf{}\n\tt = cn.recv1Buf(r)\n\treturn t, r\n}\n\nfunc (cn *conn) ssl(o values) {\n\tverifyCaOnly := false\n\ttlsConf := tls.Config{}\n\tswitch mode := o.Get(\"sslmode\"); mode {\n\tcase \"require\", \"\":\n\t\ttlsConf.InsecureSkipVerify = true\n\tcase \"verify-ca\":\n\t\t// We must skip TLS's own verification since it requires full\n\t\t// verification since Go 1.3.\n\t\ttlsConf.InsecureSkipVerify = true\n\t\tverifyCaOnly = true\n\tcase \"verify-full\":\n\t\ttlsConf.ServerName = o.Get(\"host\")\n\tcase \"disable\":\n\t\treturn\n\tdefault:\n\t\terrorf(`unsupported sslmode %q; only \"require\" (default), \"verify-full\", and \"disable\" supported`, mode)\n\t}\n\n\tcn.setupSSLClientCertificates(&tlsConf, o)\n\tcn.setupSSLCA(&tlsConf, o)\n\n\tw := cn.writeBuf(0)\n\tw.int32(80877103)\n\tcn.sendStartupPacket(w)\n\n\tb := cn.scratch[:1]\n\t_, err := io.ReadFull(cn.c, b)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif b[0] != 'S' {\n\t\tpanic(ErrSSLNotSupported)\n\t}\n\n\tclient := tls.Client(cn.c, &tlsConf)\n\tif verifyCaOnly {\n\t\tcn.verifyCA(client, &tlsConf)\n\t}\n\tcn.c = client\n}\n\n// verifyCA carries out a TLS handshake to the server and verifies the\n// presented certificate against the effective CA, i.e. the one specified in\n// sslrootcert or the system CA if sslrootcert was not specified.\nfunc (cn *conn) verifyCA(client *tls.Conn, tlsConf *tls.Config) {\n\terr := client.Handshake()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcerts := client.ConnectionState().PeerCertificates\n\topts := x509.VerifyOptions{\n\t\tDNSName:       client.ConnectionState().ServerName,\n\t\tIntermediates: x509.NewCertPool(),\n\t\tRoots:         tlsConf.RootCAs,\n\t}\n\tfor i, cert := range certs {\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\t\topts.Intermediates.AddCert(cert)\n\t}\n\t_, err = certs[0].Verify(opts)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n\n// This function sets up SSL client certificates based on either the \"sslkey\"\n// and \"sslcert\" settings (possibly set via the environment variables PGSSLKEY\n// and PGSSLCERT, respectively), or if they aren't set, from the .postgresql\n// directory in the user's home directory.  If the file paths are set\n// explicitly, the files must exist.  The key file must also not be\n// world-readable, or this function will panic with\n// ErrSSLKeyHasWorldPermissions.\nfunc (cn *conn) setupSSLClientCertificates(tlsConf *tls.Config, o values) {\n\tvar missingOk bool\n\n\tsslkey := o.Get(\"sslkey\")\n\tsslcert := o.Get(\"sslcert\")\n\tif sslkey != \"\" && sslcert != \"\" {\n\t\t// If the user has set an sslkey and sslcert, they *must* exist.\n\t\tmissingOk = false\n\t} else {\n\t\t// Automatically load certificates from ~/.postgresql.\n\t\tuser, err := user.Current()\n\t\tif err != nil {\n\t\t\t// user.Current() might fail when cross-compiling.  We have to\n\t\t\t// ignore the error and continue without client certificates, since\n\t\t\t// we wouldn't know where to load them from.\n\t\t\treturn\n\t\t}\n\n\t\tsslkey = filepath.Join(user.HomeDir, \".postgresql\", \"postgresql.key\")\n\t\tsslcert = filepath.Join(user.HomeDir, \".postgresql\", \"postgresql.crt\")\n\t\tmissingOk = true\n\t}\n\n\t// Check that both files exist, and report the error or stop, depending on\n\t// which behaviour we want.  Note that we don't do any more extensive\n\t// checks than this (such as checking that the paths aren't directories);\n\t// LoadX509KeyPair() will take care of the rest.\n\tkeyfinfo, err := os.Stat(sslkey)\n\tif err != nil && missingOk {\n\t\treturn\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = os.Stat(sslcert)\n\tif err != nil && missingOk {\n\t\treturn\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\n\t// If we got this far, the key file must also have the correct permissions\n\tkmode := keyfinfo.Mode()\n\tif kmode != kmode&0600 {\n\t\tpanic(ErrSSLKeyHasWorldPermissions)\n\t}\n\n\tcert, err := tls.LoadX509KeyPair(sslcert, sslkey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttlsConf.Certificates = []tls.Certificate{cert}\n}\n\n// Sets up RootCAs in the TLS configuration if sslrootcert is set.\nfunc (cn *conn) setupSSLCA(tlsConf *tls.Config, o values) {\n\tif sslrootcert := o.Get(\"sslrootcert\"); sslrootcert != \"\" {\n\t\ttlsConf.RootCAs = x509.NewCertPool()\n\n\t\tcert, err := ioutil.ReadFile(sslrootcert)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tok := tlsConf.RootCAs.AppendCertsFromPEM(cert)\n\t\tif !ok {\n\t\t\terrorf(\"couldn't parse pem in sslrootcert\")\n\t\t}\n\t}\n}\n\n// isDriverSetting returns true iff a setting is purely for configuring the\n// driver's options and should not be sent to the server in the connection\n// startup packet.\nfunc isDriverSetting(key string) bool {\n\tswitch key {\n\tcase \"host\", \"port\":\n\t\treturn true\n\tcase \"password\":\n\t\treturn true\n\tcase \"sslmode\", \"sslcert\", \"sslkey\", \"sslrootcert\":\n\t\treturn true\n\tcase \"fallback_application_name\":\n\t\treturn true\n\tcase \"connect_timeout\":\n\t\treturn true\n\tcase \"disable_prepared_binary_result\":\n\t\treturn true\n\tcase \"binary_parameters\":\n\t\treturn true\n\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc (cn *conn) startup(o values) {\n\tw := cn.writeBuf(0)\n\tw.int32(196608)\n\t// Send the backend the name of the database we want to connect to, and the\n\t// user we want to connect as.  Additionally, we send over any run-time\n\t// parameters potentially included in the connection string.  If the server\n\t// doesn't recognize any of them, it will reply with an error.\n\tfor k, v := range o {\n\t\tif isDriverSetting(k) {\n\t\t\t// skip options which can't be run-time parameters\n\t\t\tcontinue\n\t\t}\n\t\t// The protocol requires us to supply the database name as \"database\"\n\t\t// instead of \"dbname\".\n\t\tif k == \"dbname\" {\n\t\t\tk = \"database\"\n\t\t}\n\t\tw.string(k)\n\t\tw.string(v)\n\t}\n\tw.string(\"\")\n\tcn.sendStartupPacket(w)\n\n\tfor {\n\t\tt, r := cn.recv()\n\t\tswitch t {\n\t\tcase 'K':\n\t\tcase 'S':\n\t\t\tcn.processParameterStatus(r)\n\t\tcase 'R':\n\t\t\tcn.auth(r, o)\n\t\tcase 'Z':\n\t\t\tcn.processReadyForQuery(r)\n\t\t\treturn\n\t\tdefault:\n\t\t\terrorf(\"unknown response for startup: %q\", t)\n\t\t}\n\t}\n}\n\nfunc (cn *conn) auth(r *readBuf, o values) {\n\tswitch code := r.int32(); code {\n\tcase 0:\n\t\t// OK\n\tcase 3:\n\t\tw := cn.writeBuf('p')\n\t\tw.string(o.Get(\"password\"))\n\t\tcn.send(w)\n\n\t\tt, r := cn.recv()\n\t\tif t != 'R' {\n\t\t\terrorf(\"unexpected password response: %q\", t)\n\t\t}\n\n\t\tif r.int32() != 0 {\n\t\t\terrorf(\"unexpected authentication response: %q\", t)\n\t\t}\n\tcase 5:\n\t\ts := string(r.next(4))\n\t\tw := cn.writeBuf('p')\n\t\tw.string(\"md5\" + md5s(md5s(o.Get(\"password\")+o.Get(\"user\"))+s))\n\t\tcn.send(w)\n\n\t\tt, r := cn.recv()\n\t\tif t != 'R' {\n\t\t\terrorf(\"unexpected password response: %q\", t)\n\t\t}\n\n\t\tif r.int32() != 0 {\n\t\t\terrorf(\"unexpected authentication response: %q\", t)\n\t\t}\n\tdefault:\n\t\terrorf(\"unknown authentication response: %d\", code)\n\t}\n}\n\ntype format int\n\nconst formatText format = 0\nconst formatBinary format = 1\n\n// One result-column format code with the value 1 (i.e. all binary).\nvar colFmtDataAllBinary []byte = []byte{0, 1, 0, 1}\n\n// No result-column format codes (i.e. all text).\nvar colFmtDataAllText []byte = []byte{0, 0}\n\ntype stmt struct {\n\tcn         *conn\n\tname       string\n\tcolNames   []string\n\tcolFmts    []format\n\tcolFmtData []byte\n\tcolTyps    []oid.Oid\n\tparamTyps  []oid.Oid\n\tclosed     bool\n}\n\nfunc (st *stmt) Close() (err error) {\n\tif st.closed {\n\t\treturn nil\n\t}\n\tif st.cn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer st.cn.errRecover(&err)\n\n\tw := st.cn.writeBuf('C')\n\tw.byte('S')\n\tw.string(st.name)\n\tst.cn.send(w)\n\n\tst.cn.send(st.cn.writeBuf('S'))\n\n\tt, _ := st.cn.recv1()\n\tif t != '3' {\n\t\tst.cn.bad = true\n\t\terrorf(\"unexpected close response: %q\", t)\n\t}\n\tst.closed = true\n\n\tt, r := st.cn.recv1()\n\tif t != 'Z' {\n\t\tst.cn.bad = true\n\t\terrorf(\"expected ready for query, but got: %q\", t)\n\t}\n\tst.cn.processReadyForQuery(r)\n\n\treturn nil\n}\n\nfunc (st *stmt) Query(v []driver.Value) (r driver.Rows, err error) {\n\tif st.cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer st.cn.errRecover(&err)\n\n\tst.exec(v)\n\treturn &rows{\n\t\tcn:       st.cn,\n\t\tcolNames: st.colNames,\n\t\tcolTyps:  st.colTyps,\n\t\tcolFmts:  st.colFmts,\n\t}, nil\n}\n\nfunc (st *stmt) Exec(v []driver.Value) (res driver.Result, err error) {\n\tif st.cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer st.cn.errRecover(&err)\n\n\tst.exec(v)\n\tres, _, err = st.cn.readExecuteResponse(\"simple query\")\n\treturn res, err\n}\n\nfunc (st *stmt) exec(v []driver.Value) {\n\tif len(v) >= 65536 {\n\t\terrorf(\"got %d parameters but PostgreSQL only supports 65535 parameters\", len(v))\n\t}\n\tif len(v) != len(st.paramTyps) {\n\t\terrorf(\"got %d parameters but the statement requires %d\", len(v), len(st.paramTyps))\n\t}\n\n\tcn := st.cn\n\tw := cn.writeBuf('B')\n\tw.byte(0) // unnamed portal\n\tw.string(st.name)\n\n\tif cn.binaryParameters {\n\t\tcn.sendBinaryParameters(w, v)\n\t} else {\n\t\tw.int16(0)\n\t\tw.int16(len(v))\n\t\tfor i, x := range v {\n\t\t\tif x == nil {\n\t\t\t\tw.int32(-1)\n\t\t\t} else {\n\t\t\t\tb := encode(&cn.parameterStatus, x, st.paramTyps[i])\n\t\t\t\tw.int32(len(b))\n\t\t\t\tw.bytes(b)\n\t\t\t}\n\t\t}\n\t}\n\tw.bytes(st.colFmtData)\n\n\tw.next('E')\n\tw.byte(0)\n\tw.int32(0)\n\n\tw.next('S')\n\tcn.send(w)\n\n\tcn.readBindResponse()\n\tcn.postExecuteWorkaround()\n\n}\n\nfunc (st *stmt) NumInput() int {\n\treturn len(st.paramTyps)\n}\n\n// parseComplete parses the \"command tag\" from a CommandComplete message, and\n// returns the number of rows affected (if applicable) and a string\n// identifying only the command that was executed, e.g. \"ALTER TABLE\".  If the\n// command tag could not be parsed, parseComplete panics.\nfunc (cn *conn) parseComplete(commandTag string) (driver.Result, string) {\n\tcommandsWithAffectedRows := []string{\n\t\t\"SELECT \",\n\t\t// INSERT is handled below\n\t\t\"UPDATE \",\n\t\t\"DELETE \",\n\t\t\"FETCH \",\n\t\t\"MOVE \",\n\t\t\"COPY \",\n\t}\n\n\tvar affectedRows *string\n\tfor _, tag := range commandsWithAffectedRows {\n\t\tif strings.HasPrefix(commandTag, tag) {\n\t\t\tt := commandTag[len(tag):]\n\t\t\taffectedRows = &t\n\t\t\tcommandTag = tag[:len(tag)-1]\n\t\t\tbreak\n\t\t}\n\t}\n\t// INSERT also includes the oid of the inserted row in its command tag.\n\t// Oids in user tables are deprecated, and the oid is only returned when\n\t// exactly one row is inserted, so it's unlikely to be of value to any\n\t// real-world application and we can ignore it.\n\tif affectedRows == nil && strings.HasPrefix(commandTag, \"INSERT \") {\n\t\tparts := strings.Split(commandTag, \" \")\n\t\tif len(parts) != 3 {\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unexpected INSERT command tag %s\", commandTag)\n\t\t}\n\t\taffectedRows = &parts[len(parts)-1]\n\t\tcommandTag = \"INSERT\"\n\t}\n\t// There should be no affected rows attached to the tag, just return it\n\tif affectedRows == nil {\n\t\treturn driver.RowsAffected(0), commandTag\n\t}\n\tn, err := strconv.ParseInt(*affectedRows, 10, 64)\n\tif err != nil {\n\t\tcn.bad = true\n\t\terrorf(\"could not parse commandTag: %s\", err)\n\t}\n\treturn driver.RowsAffected(n), commandTag\n}\n\ntype rows struct {\n\tcn       *conn\n\tcolNames []string\n\tcolTyps  []oid.Oid\n\tcolFmts  []format\n\tdone     bool\n\trb       readBuf\n}\n\nfunc (rs *rows) Close() error {\n\t// no need to look at cn.bad as Next() will\n\tfor {\n\t\terr := rs.Next(nil)\n\t\tswitch err {\n\t\tcase nil:\n\t\tcase io.EOF:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n}\n\nfunc (rs *rows) Columns() []string {\n\treturn rs.colNames\n}\n\nfunc (rs *rows) Next(dest []driver.Value) (err error) {\n\tif rs.done {\n\t\treturn io.EOF\n\t}\n\n\tconn := rs.cn\n\tif conn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer conn.errRecover(&err)\n\n\tfor {\n\t\tt := conn.recv1Buf(&rs.rb)\n\t\tswitch t {\n\t\tcase 'E':\n\t\t\terr = parseError(&rs.rb)\n\t\tcase 'C', 'I':\n\t\t\tcontinue\n\t\tcase 'Z':\n\t\t\tconn.processReadyForQuery(&rs.rb)\n\t\t\trs.done = true\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn io.EOF\n\t\tcase 'D':\n\t\t\tn := rs.rb.int16()\n\t\t\tif err != nil {\n\t\t\t\tconn.bad = true\n\t\t\t\terrorf(\"unexpected DataRow after error %s\", err)\n\t\t\t}\n\t\t\tif n < len(dest) {\n\t\t\t\tdest = dest[:n]\n\t\t\t}\n\t\t\tfor i := range dest {\n\t\t\t\tl := rs.rb.int32()\n\t\t\t\tif l == -1 {\n\t\t\t\t\tdest[i] = nil\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdest[i] = decode(&conn.parameterStatus, rs.rb.next(l), rs.colTyps[i], rs.colFmts[i])\n\t\t\t}\n\t\t\treturn\n\t\tdefault:\n\t\t\terrorf(\"unexpected message after execute: %q\", t)\n\t\t}\n\t}\n}\n\n// QuoteIdentifier quotes an \"identifier\" (e.g. a table or a column name) to be\n// used as part of an SQL statement.  For example:\n//\n//    tblname := \"my_table\"\n//    data := \"my_data\"\n//    err = db.Exec(fmt.Sprintf(\"INSERT INTO %s VALUES ($1)\", pq.QuoteIdentifier(tblname)), data)\n//\n// Any double quotes in name will be escaped.  The quoted identifier will be\n// case sensitive when used in a query.  If the input string contains a zero\n// byte, the result will be truncated immediately before it.\nfunc QuoteIdentifier(name string) string {\n\tend := strings.IndexRune(name, 0)\n\tif end > -1 {\n\t\tname = name[:end]\n\t}\n\treturn `\"` + strings.Replace(name, `\"`, `\"\"`, -1) + `\"`\n}\n\nfunc md5s(s string) string {\n\th := md5.New()\n\th.Write([]byte(s))\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}\n\nfunc (cn *conn) sendBinaryParameters(b *writeBuf, args []driver.Value) {\n\t// Do one pass over the parameters to see if we're going to send any of\n\t// them over in binary.  If we are, create a paramFormats array at the\n\t// same time.\n\tvar paramFormats []int\n\tfor i, x := range args {\n\t\t_, ok := x.([]byte)\n\t\tif ok {\n\t\t\tif paramFormats == nil {\n\t\t\t\tparamFormats = make([]int, len(args))\n\t\t\t}\n\t\t\tparamFormats[i] = 1\n\t\t}\n\t}\n\tif paramFormats == nil {\n\t\tb.int16(0)\n\t} else {\n\t\tb.int16(len(paramFormats))\n\t\tfor _, x := range paramFormats {\n\t\t\tb.int16(x)\n\t\t}\n\t}\n\n\tb.int16(len(args))\n\tfor _, x := range args {\n\t\tif x == nil {\n\t\t\tb.int32(-1)\n\t\t} else {\n\t\t\tdatum := binaryEncode(&cn.parameterStatus, x)\n\t\t\tb.int32(len(datum))\n\t\t\tb.bytes(datum)\n\t\t}\n\t}\n}\n\nfunc (cn *conn) sendBinaryModeQuery(query string, args []driver.Value) {\n\tif len(args) >= 65536 {\n\t\terrorf(\"got %d parameters but PostgreSQL only supports 65535 parameters\", len(args))\n\t}\n\n\tb := cn.writeBuf('P')\n\tb.byte(0) // unnamed statement\n\tb.string(query)\n\tb.int16(0)\n\n\tb.next('B')\n\tb.int16(0) // unnamed portal and statement\n\tcn.sendBinaryParameters(b, args)\n\tb.bytes(colFmtDataAllText)\n\n\tb.next('D')\n\tb.byte('P')\n\tb.byte(0) // unnamed portal\n\n\tb.next('E')\n\tb.byte(0)\n\tb.int32(0)\n\n\tb.next('S')\n\tcn.send(b)\n}\n\nfunc (c *conn) processParameterStatus(r *readBuf) {\n\tvar err error\n\n\tparam := r.string()\n\tswitch param {\n\tcase \"server_version\":\n\t\tvar major1 int\n\t\tvar major2 int\n\t\tvar minor int\n\t\t_, err = fmt.Sscanf(r.string(), \"%d.%d.%d\", &major1, &major2, &minor)\n\t\tif err == nil {\n\t\t\tc.parameterStatus.serverVersion = major1*10000 + major2*100 + minor\n\t\t}\n\n\tcase \"TimeZone\":\n\t\tc.parameterStatus.currentLocation, err = time.LoadLocation(r.string())\n\t\tif err != nil {\n\t\t\tc.parameterStatus.currentLocation = nil\n\t\t}\n\n\tdefault:\n\t\t// ignore\n\t}\n}\n\nfunc (c *conn) processReadyForQuery(r *readBuf) {\n\tc.txnStatus = transactionStatus(r.byte())\n}\n\nfunc (cn *conn) readReadyForQuery() {\n\tt, r := cn.recv1()\n\tswitch t {\n\tcase 'Z':\n\t\tcn.processReadyForQuery(r)\n\t\treturn\n\tdefault:\n\t\tcn.bad = true\n\t\terrorf(\"unexpected message %q; expected ReadyForQuery\", t)\n\t}\n}\n\nfunc (cn *conn) readParseResponse() {\n\tt, r := cn.recv1()\n\tswitch t {\n\tcase '1':\n\t\treturn\n\tcase 'E':\n\t\terr := parseError(r)\n\t\tcn.readReadyForQuery()\n\t\tpanic(err)\n\tdefault:\n\t\tcn.bad = true\n\t\terrorf(\"unexpected Parse response %q\", t)\n\t}\n}\n\nfunc (cn *conn) readStatementDescribeResponse() (paramTyps []oid.Oid, colNames []string, colTyps []oid.Oid) {\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 't':\n\t\t\tnparams := r.int16()\n\t\t\tparamTyps = make([]oid.Oid, nparams)\n\t\t\tfor i := range paramTyps {\n\t\t\t\tparamTyps[i] = r.oid()\n\t\t\t}\n\t\tcase 'n':\n\t\t\treturn paramTyps, nil, nil\n\t\tcase 'T':\n\t\t\tcolNames, colTyps = parseStatementRowDescribe(r)\n\t\t\treturn paramTyps, colNames, colTyps\n\t\tcase 'E':\n\t\t\terr := parseError(r)\n\t\t\tcn.readReadyForQuery()\n\t\t\tpanic(err)\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unexpected Describe statement response %q\", t)\n\t\t}\n\t}\n}\n\nfunc (cn *conn) readPortalDescribeResponse() (colNames []string, colFmts []format, colTyps []oid.Oid) {\n\tt, r := cn.recv1()\n\tswitch t {\n\tcase 'T':\n\t\treturn parsePortalRowDescribe(r)\n\tcase 'n':\n\t\treturn nil, nil, nil\n\tcase 'E':\n\t\terr := parseError(r)\n\t\tcn.readReadyForQuery()\n\t\tpanic(err)\n\tdefault:\n\t\tcn.bad = true\n\t\terrorf(\"unexpected Describe response %q\", t)\n\t}\n\tpanic(\"not reached\")\n}\n\nfunc (cn *conn) readBindResponse() {\n\tt, r := cn.recv1()\n\tswitch t {\n\tcase '2':\n\t\treturn\n\tcase 'E':\n\t\terr := parseError(r)\n\t\tcn.readReadyForQuery()\n\t\tpanic(err)\n\tdefault:\n\t\tcn.bad = true\n\t\terrorf(\"unexpected Bind response %q\", t)\n\t}\n}\n\nfunc (cn *conn) postExecuteWorkaround() {\n\t// Work around a bug in sql.DB.QueryRow: in Go 1.2 and earlier it ignores\n\t// any errors from rows.Next, which masks errors that happened during the\n\t// execution of the query.  To avoid the problem in common cases, we wait\n\t// here for one more message from the database.  If it's not an error the\n\t// query will likely succeed (or perhaps has already, if it's a\n\t// CommandComplete), so we push the message into the conn struct; recv1\n\t// will return it as the next message for rows.Next or rows.Close.\n\t// However, if it's an error, we wait until ReadyForQuery and then return\n\t// the error to our caller.\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'E':\n\t\t\terr := parseError(r)\n\t\t\tcn.readReadyForQuery()\n\t\t\tpanic(err)\n\t\tcase 'C', 'D', 'I':\n\t\t\t// the query didn't fail, but we can't process this message\n\t\t\tcn.saveMessage(t, r)\n\t\t\treturn\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unexpected message during extended query execution: %q\", t)\n\t\t}\n\t}\n}\n\n// Only for Exec(), since we ignore the returned data\nfunc (cn *conn) readExecuteResponse(protocolState string) (res driver.Result, commandTag string, err error) {\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'C':\n\t\t\tres, commandTag = cn.parseComplete(r.string())\n\t\tcase 'Z':\n\t\t\tcn.processReadyForQuery(r)\n\t\t\treturn res, commandTag, err\n\t\tcase 'E':\n\t\t\terr = parseError(r)\n\t\tcase 'T', 'D', 'I':\n\t\t\t// ignore any results\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unknown %s response: %q\", protocolState, t)\n\t\t}\n\t}\n}\n\nfunc parseStatementRowDescribe(r *readBuf) (colNames []string, colTyps []oid.Oid) {\n\tn := r.int16()\n\tcolNames = make([]string, n)\n\tcolTyps = make([]oid.Oid, n)\n\tfor i := range colNames {\n\t\tcolNames[i] = r.string()\n\t\tr.next(6)\n\t\tcolTyps[i] = r.oid()\n\t\tr.next(6)\n\t\t// format code not known when describing a statement; always 0\n\t\tr.next(2)\n\t}\n\treturn\n}\n\nfunc parsePortalRowDescribe(r *readBuf) (colNames []string, colFmts []format, colTyps []oid.Oid) {\n\tn := r.int16()\n\tcolNames = make([]string, n)\n\tcolFmts = make([]format, n)\n\tcolTyps = make([]oid.Oid, n)\n\tfor i := range colNames {\n\t\tcolNames[i] = r.string()\n\t\tr.next(6)\n\t\tcolTyps[i] = r.oid()\n\t\tr.next(6)\n\t\tcolFmts[i] = format(r.int16())\n\t}\n\treturn\n}\n\n// parseEnviron tries to mimic some of libpq's environment handling\n//\n// To ease testing, it does not directly reference os.Environ, but is\n// designed to accept its output.\n//\n// Environment-set connection information is intended to have a higher\n// precedence than a library default but lower than any explicitly\n// passed information (such as in the URL or connection string).\nfunc parseEnviron(env []string) (out map[string]string) {\n\tout = make(map[string]string)\n\n\tfor _, v := range env {\n\t\tparts := strings.SplitN(v, \"=\", 2)\n\n\t\taccrue := func(keyname string) {\n\t\t\tout[keyname] = parts[1]\n\t\t}\n\t\tunsupported := func() {\n\t\t\tpanic(fmt.Sprintf(\"setting %v not supported\", parts[0]))\n\t\t}\n\n\t\t// The order of these is the same as is seen in the\n\t\t// PostgreSQL 9.1 manual. Unsupported but well-defined\n\t\t// keys cause a panic; these should be unset prior to\n\t\t// execution. Options which pq expects to be set to a\n\t\t// certain value are allowed, but must be set to that\n\t\t// value if present (they can, of course, be absent).\n\t\tswitch parts[0] {\n\t\tcase \"PGHOST\":\n\t\t\taccrue(\"host\")\n\t\tcase \"PGHOSTADDR\":\n\t\t\tunsupported()\n\t\tcase \"PGPORT\":\n\t\t\taccrue(\"port\")\n\t\tcase \"PGDATABASE\":\n\t\t\taccrue(\"dbname\")\n\t\tcase \"PGUSER\":\n\t\t\taccrue(\"user\")\n\t\tcase \"PGPASSWORD\":\n\t\t\taccrue(\"password\")\n\t\tcase \"PGPASSFILE\", \"PGSERVICE\", \"PGSERVICEFILE\", \"PGREALM\":\n\t\t\tunsupported()\n\t\tcase \"PGOPTIONS\":\n\t\t\taccrue(\"options\")\n\t\tcase \"PGAPPNAME\":\n\t\t\taccrue(\"application_name\")\n\t\tcase \"PGSSLMODE\":\n\t\t\taccrue(\"sslmode\")\n\t\tcase \"PGSSLCERT\":\n\t\t\taccrue(\"sslcert\")\n\t\tcase \"PGSSLKEY\":\n\t\t\taccrue(\"sslkey\")\n\t\tcase \"PGSSLROOTCERT\":\n\t\t\taccrue(\"sslrootcert\")\n\t\tcase \"PGREQUIRESSL\", \"PGSSLCRL\":\n\t\t\tunsupported()\n\t\tcase \"PGREQUIREPEER\":\n\t\t\tunsupported()\n\t\tcase \"PGKRBSRVNAME\", \"PGGSSLIB\":\n\t\t\tunsupported()\n\t\tcase \"PGCONNECT_TIMEOUT\":\n\t\t\taccrue(\"connect_timeout\")\n\t\tcase \"PGCLIENTENCODING\":\n\t\t\taccrue(\"client_encoding\")\n\t\tcase \"PGDATESTYLE\":\n\t\t\taccrue(\"datestyle\")\n\t\tcase \"PGTZ\":\n\t\t\taccrue(\"timezone\")\n\t\tcase \"PGGEQO\":\n\t\t\taccrue(\"geqo\")\n\t\tcase \"PGSYSCONFDIR\", \"PGLOCALEDIR\":\n\t\t\tunsupported()\n\t\t}\n\t}\n\n\treturn out\n}\n\n// isUTF8 returns whether name is a fuzzy variation of the string \"UTF-8\".\nfunc isUTF8(name string) bool {\n\t// Recognize all sorts of silly things as \"UTF-8\", like Postgres does\n\ts := strings.Map(alnumLowerASCII, name)\n\treturn s == \"utf8\" || s == \"unicode\"\n}\n\nfunc alnumLowerASCII(ch rune) rune {\n\tif 'A' <= ch && ch <= 'Z' {\n\t\treturn ch + ('a' - 'A')\n\t}\n\tif 'a' <= ch && ch <= 'z' || '0' <= ch && ch <= '9' {\n\t\treturn ch\n\t}\n\treturn -1 // discard\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/copy.go",
    "content": "package pq\n\nimport (\n\t\"database/sql/driver\"\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sync\"\n)\n\nvar (\n\terrCopyInClosed               = errors.New(\"pq: copyin statement has already been closed\")\n\terrBinaryCopyNotSupported     = errors.New(\"pq: only text format supported for COPY\")\n\terrCopyToNotSupported         = errors.New(\"pq: COPY TO is not supported\")\n\terrCopyNotSupportedOutsideTxn = errors.New(\"pq: COPY is only allowed inside a transaction\")\n)\n\n// CopyIn creates a COPY FROM statement which can be prepared with\n// Tx.Prepare().  The target table should be visible in search_path.\nfunc CopyIn(table string, columns ...string) string {\n\tstmt := \"COPY \" + QuoteIdentifier(table) + \" (\"\n\tfor i, col := range columns {\n\t\tif i != 0 {\n\t\t\tstmt += \", \"\n\t\t}\n\t\tstmt += QuoteIdentifier(col)\n\t}\n\tstmt += \") FROM STDIN\"\n\treturn stmt\n}\n\n// CopyInSchema creates a COPY FROM statement which can be prepared with\n// Tx.Prepare().\nfunc CopyInSchema(schema, table string, columns ...string) string {\n\tstmt := \"COPY \" + QuoteIdentifier(schema) + \".\" + QuoteIdentifier(table) + \" (\"\n\tfor i, col := range columns {\n\t\tif i != 0 {\n\t\t\tstmt += \", \"\n\t\t}\n\t\tstmt += QuoteIdentifier(col)\n\t}\n\tstmt += \") FROM STDIN\"\n\treturn stmt\n}\n\ntype copyin struct {\n\tcn      *conn\n\tbuffer  []byte\n\trowData chan []byte\n\tdone    chan bool\n\n\tclosed bool\n\n\tsync.Mutex // guards err\n\terr        error\n}\n\nconst ciBufferSize = 64 * 1024\n\n// flush buffer before the buffer is filled up and needs reallocation\nconst ciBufferFlushSize = 63 * 1024\n\nfunc (cn *conn) prepareCopyIn(q string) (_ driver.Stmt, err error) {\n\tif !cn.isInTransaction() {\n\t\treturn nil, errCopyNotSupportedOutsideTxn\n\t}\n\n\tci := &copyin{\n\t\tcn:      cn,\n\t\tbuffer:  make([]byte, 0, ciBufferSize),\n\t\trowData: make(chan []byte),\n\t\tdone:    make(chan bool, 1),\n\t}\n\t// add CopyData identifier + 4 bytes for message length\n\tci.buffer = append(ci.buffer, 'd', 0, 0, 0, 0)\n\n\tb := cn.writeBuf('Q')\n\tb.string(q)\n\tcn.send(b)\n\nawaitCopyInResponse:\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'G':\n\t\t\tif r.byte() != 0 {\n\t\t\t\terr = errBinaryCopyNotSupported\n\t\t\t\tbreak awaitCopyInResponse\n\t\t\t}\n\t\t\tgo ci.resploop()\n\t\t\treturn ci, nil\n\t\tcase 'H':\n\t\t\terr = errCopyToNotSupported\n\t\t\tbreak awaitCopyInResponse\n\t\tcase 'E':\n\t\t\terr = parseError(r)\n\t\tcase 'Z':\n\t\t\tif err == nil {\n\t\t\t\tcn.bad = true\n\t\t\t\terrorf(\"unexpected ReadyForQuery in response to COPY\")\n\t\t\t}\n\t\t\tcn.processReadyForQuery(r)\n\t\t\treturn nil, err\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unknown response for copy query: %q\", t)\n\t\t}\n\t}\n\n\t// something went wrong, abort COPY before we return\n\tb = cn.writeBuf('f')\n\tb.string(err.Error())\n\tcn.send(b)\n\n\tfor {\n\t\tt, r := cn.recv1()\n\t\tswitch t {\n\t\tcase 'c', 'C', 'E':\n\t\tcase 'Z':\n\t\t\t// correctly aborted, we're done\n\t\t\tcn.processReadyForQuery(r)\n\t\t\treturn nil, err\n\t\tdefault:\n\t\t\tcn.bad = true\n\t\t\terrorf(\"unknown response for CopyFail: %q\", t)\n\t\t}\n\t}\n}\n\nfunc (ci *copyin) flush(buf []byte) {\n\t// set message length (without message identifier)\n\tbinary.BigEndian.PutUint32(buf[1:], uint32(len(buf)-1))\n\n\t_, err := ci.cn.c.Write(buf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n\nfunc (ci *copyin) resploop() {\n\tfor {\n\t\tvar r readBuf\n\t\tt, err := ci.cn.recvMessage(&r)\n\t\tif err != nil {\n\t\t\tci.cn.bad = true\n\t\t\tci.setError(err)\n\t\t\tci.done <- true\n\t\t\treturn\n\t\t}\n\t\tswitch t {\n\t\tcase 'C':\n\t\t\t// complete\n\t\tcase 'N':\n\t\t\t// NoticeResponse\n\t\tcase 'Z':\n\t\t\tci.cn.processReadyForQuery(&r)\n\t\t\tci.done <- true\n\t\t\treturn\n\t\tcase 'E':\n\t\t\terr := parseError(&r)\n\t\t\tci.setError(err)\n\t\tdefault:\n\t\t\tci.cn.bad = true\n\t\t\tci.setError(fmt.Errorf(\"unknown response during CopyIn: %q\", t))\n\t\t\tci.done <- true\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc (ci *copyin) isErrorSet() bool {\n\tci.Lock()\n\tisSet := (ci.err != nil)\n\tci.Unlock()\n\treturn isSet\n}\n\n// setError() sets ci.err if one has not been set already.  Caller must not be\n// holding ci.Mutex.\nfunc (ci *copyin) setError(err error) {\n\tci.Lock()\n\tif ci.err == nil {\n\t\tci.err = err\n\t}\n\tci.Unlock()\n}\n\nfunc (ci *copyin) NumInput() int {\n\treturn -1\n}\n\nfunc (ci *copyin) Query(v []driver.Value) (r driver.Rows, err error) {\n\treturn nil, ErrNotSupported\n}\n\n// Exec inserts values into the COPY stream. The insert is asynchronous\n// and Exec can return errors from previous Exec calls to the same\n// COPY stmt.\n//\n// You need to call Exec(nil) to sync the COPY stream and to get any\n// errors from pending data, since Stmt.Close() doesn't return errors\n// to the user.\nfunc (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {\n\tif ci.closed {\n\t\treturn nil, errCopyInClosed\n\t}\n\n\tif ci.cn.bad {\n\t\treturn nil, driver.ErrBadConn\n\t}\n\tdefer ci.cn.errRecover(&err)\n\n\tif ci.isErrorSet() {\n\t\treturn nil, ci.err\n\t}\n\n\tif len(v) == 0 {\n\t\terr = ci.Close()\n\t\tci.closed = true\n\t\treturn nil, err\n\t}\n\n\tnumValues := len(v)\n\tfor i, value := range v {\n\t\tci.buffer = appendEncodedText(&ci.cn.parameterStatus, ci.buffer, value)\n\t\tif i < numValues-1 {\n\t\t\tci.buffer = append(ci.buffer, '\\t')\n\t\t}\n\t}\n\n\tci.buffer = append(ci.buffer, '\\n')\n\n\tif len(ci.buffer) > ciBufferFlushSize {\n\t\tci.flush(ci.buffer)\n\t\t// reset buffer, keep bytes for message identifier and length\n\t\tci.buffer = ci.buffer[:5]\n\t}\n\n\treturn driver.RowsAffected(0), nil\n}\n\nfunc (ci *copyin) Close() (err error) {\n\tif ci.closed {\n\t\treturn errCopyInClosed\n\t}\n\n\tif ci.cn.bad {\n\t\treturn driver.ErrBadConn\n\t}\n\tdefer ci.cn.errRecover(&err)\n\n\tif len(ci.buffer) > 0 {\n\t\tci.flush(ci.buffer)\n\t}\n\t// Avoid touching the scratch buffer as resploop could be using it.\n\terr = ci.cn.sendSimpleMessage('c')\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t<-ci.done\n\n\tif ci.isErrorSet() {\n\t\terr = ci.err\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/doc.go",
    "content": "/*\nPackage pq is a pure Go Postgres driver for the database/sql package.\n\nIn most cases clients will use the database/sql package instead of\nusing this package directly. For example:\n\n\timport (\n\t\t\"database/sql\"\n\n\t\t_ \"github.com/lib/pq\"\n\t)\n\n\tfunc main() {\n\t\tdb, err := sql.Open(\"postgres\", \"user=pqgotest dbname=pqgotest sslmode=verify-full\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tage := 21\n\t\trows, err := db.Query(\"SELECT name FROM users WHERE age = $1\", age)\n\t\t…\n\t}\n\nYou can also connect to a database using a URL. For example:\n\n\tdb, err := sql.Open(\"postgres\", \"postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full\")\n\n\nConnection String Parameters\n\n\nSimilarly to libpq, when establishing a connection using pq you are expected to\nsupply a connection string containing zero or more parameters.\nA subset of the connection parameters supported by libpq are also supported by pq.\nAdditionally, pq also lets you specify run-time parameters (such as search_path or work_mem)\ndirectly in the connection string.  This is different from libpq, which does not allow\nrun-time parameters in the connection string, instead requiring you to supply\nthem in the options parameter.\n\nFor compatibility with libpq, the following special connection parameters are\nsupported:\n\n\t* dbname - The name of the database to connect to\n\t* user - The user to sign in as\n\t* password - The user's password\n\t* host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)\n\t* port - The port to bind to. (default is 5432)\n\t* sslmode - Whether or not to use SSL (default is require, this is not the default for libpq)\n\t* fallback_application_name - An application_name to fall back to if one isn't provided.\n\t* connect_timeout - Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.\n\t* sslcert - Cert file location. The file must contain PEM encoded data.\n\t* sslkey - Key file location. The file must contain PEM encoded data.\n\t* sslrootcert - The location of the root certificate file. The file must contain PEM encoded data.\n\nValid values for sslmode are:\n\n\t* disable - No SSL\n\t* require - Always SSL (skip verification)\n\t* verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)\n\t* verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)\n\nSee http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING\nfor more information about connection string parameters.\n\nUse single quotes for values that contain whitespace:\n\n    \"user=pqgotest password='with spaces'\"\n\nA backslash will escape the next character in values:\n\n    \"user=space\\ man password='it\\'s valid'\n\nNote that the connection parameter client_encoding (which sets the\ntext encoding for the connection) may be set but must be \"UTF8\",\nmatching with the same rules as Postgres. It is an error to provide\nany other value.\n\nIn addition to the parameters listed above, any run-time parameter that can be\nset at backend start time can be set in the connection string.  For more\ninformation, see\nhttp://www.postgresql.org/docs/current/static/runtime-config.html.\n\nMost environment variables as specified at http://www.postgresql.org/docs/current/static/libpq-envars.html\nsupported by libpq are also supported by pq.  If any of the environment\nvariables not supported by pq are set, pq will panic during connection\nestablishment.  Environment variables have a lower precedence than explicitly\nprovided connection parameters.\n\n\nQueries\n\ndatabase/sql does not dictate any specific format for parameter\nmarkers in query strings, and pq uses the Postgres-native ordinal markers,\nas shown above. The same marker can be reused for the same parameter:\n\n\trows, err := db.Query(`SELECT name FROM users WHERE favorite_fruit = $1\n\t\tOR age BETWEEN $2 AND $2 + 3`, \"orange\", 64)\n\npq does not support the LastInsertId() method of the Result type in database/sql.\nTo return the identifier of an INSERT (or UPDATE or DELETE), use the Postgres\nRETURNING clause with a standard Query or QueryRow call:\n\n\tvar userid int\n\terr := db.QueryRow(`INSERT INTO users(name, favorite_fruit, age)\n\t\tVALUES('beatrice', 'starfruit', 93) RETURNING id`).Scan(&userid)\n\nFor more details on RETURNING, see the Postgres documentation:\n\n\thttp://www.postgresql.org/docs/current/static/sql-insert.html\n\thttp://www.postgresql.org/docs/current/static/sql-update.html\n\thttp://www.postgresql.org/docs/current/static/sql-delete.html\n\nFor additional instructions on querying see the documentation for the database/sql package.\n\nErrors\n\npq may return errors of type *pq.Error which can be interrogated for error details:\n\n        if err, ok := err.(*pq.Error); ok {\n            fmt.Println(\"pq error:\", err.Code.Name())\n        }\n\nSee the pq.Error type for details.\n\n\nBulk imports\n\nYou can perform bulk imports by preparing a statement returned by pq.CopyIn (or\npq.CopyInSchema) in an explicit transaction (sql.Tx). The returned statement\nhandle can then be repeatedly \"executed\" to copy data into the target table.\nAfter all data has been processed you should call Exec() once with no arguments\nto flush all buffered data. Any call to Exec() might return an error which\nshould be handled appropriately, but because of the internal buffering an error\nreturned by Exec() might not be related to the data passed in the call that\nfailed.\n\nCopyIn uses COPY FROM internally. It is not possible to COPY outside of an\nexplicit transaction in pq.\n\nUsage example:\n\n\ttxn, err := db.Begin()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tstmt, err := txn.Prepare(pq.CopyIn(\"users\", \"name\", \"age\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, user := range users {\n\t\t_, err = stmt.Exec(user.Name, int64(user.Age))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t_, err = stmt.Exec()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = stmt.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = txn.Commit()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\nNotifications\n\n\nPostgreSQL supports a simple publish/subscribe model over database\nconnections.  See http://www.postgresql.org/docs/current/static/sql-notify.html\nfor more information about the general mechanism.\n\nTo start listening for notifications, you first have to open a new connection\nto the database by calling NewListener.  This connection can not be used for\nanything other than LISTEN / NOTIFY.  Calling Listen will open a \"notification\nchannel\"; once a notification channel is open, a notification generated on that\nchannel will effect a send on the Listener.Notify channel.  A notification\nchannel will remain open until Unlisten is called, though connection loss might\nresult in some notifications being lost.  To solve this problem, Listener sends\na nil pointer over the Notify channel any time the connection is re-established\nfollowing a connection loss.  The application can get information about the\nstate of the underlying connection by setting an event callback in the call to\nNewListener.\n\nA single Listener can safely be used from concurrent goroutines, which means\nthat there is often no need to create more than one Listener in your\napplication.  However, a Listener is always connected to a single database, so\nyou will need to create a new Listener instance for every database you want to\nreceive notifications in.\n\nThe channel name in both Listen and Unlisten is case sensitive, and can contain\nany characters legal in an identifier (see\nhttp://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS\nfor more information).  Note that the channel name will be truncated to 63\nbytes by the PostgreSQL server.\n\nYou can find a complete, working example of Listener usage at\nhttp://godoc.org/github.com/lib/pq/listen_example.\n\n*/\npackage pq\n"
  },
  {
    "path": "src/github.com/lib/pq/encode.go",
    "content": "package pq\n\nimport (\n\t\"bytes\"\n\t\"database/sql/driver\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/lib/pq/oid\"\n)\n\nfunc binaryEncode(parameterStatus *parameterStatus, x interface{}) []byte {\n\tswitch v := x.(type) {\n\tcase []byte:\n\t\treturn v\n\tdefault:\n\t\treturn encode(parameterStatus, x, oid.T_unknown)\n\t}\n\tpanic(\"not reached\")\n}\n\nfunc encode(parameterStatus *parameterStatus, x interface{}, pgtypOid oid.Oid) []byte {\n\tswitch v := x.(type) {\n\tcase int64:\n\t\treturn strconv.AppendInt(nil, v, 10)\n\tcase float64:\n\t\treturn strconv.AppendFloat(nil, v, 'f', -1, 64)\n\tcase []byte:\n\t\tif pgtypOid == oid.T_bytea {\n\t\t\treturn encodeBytea(parameterStatus.serverVersion, v)\n\t\t}\n\n\t\treturn v\n\tcase string:\n\t\tif pgtypOid == oid.T_bytea {\n\t\t\treturn encodeBytea(parameterStatus.serverVersion, []byte(v))\n\t\t}\n\n\t\treturn []byte(v)\n\tcase bool:\n\t\treturn strconv.AppendBool(nil, v)\n\tcase time.Time:\n\t\treturn formatTs(v)\n\n\tdefault:\n\t\terrorf(\"encode: unknown type for %T\", v)\n\t}\n\n\tpanic(\"not reached\")\n}\n\nfunc decode(parameterStatus *parameterStatus, s []byte, typ oid.Oid, f format) interface{} {\n\tif f == formatBinary {\n\t\treturn binaryDecode(parameterStatus, s, typ)\n\t} else {\n\t\treturn textDecode(parameterStatus, s, typ)\n\t}\n}\n\nfunc binaryDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interface{} {\n\tswitch typ {\n\tcase oid.T_bytea:\n\t\treturn s\n\tcase oid.T_int8:\n\t\treturn int64(binary.BigEndian.Uint64(s))\n\tcase oid.T_int4:\n\t\treturn int64(int32(binary.BigEndian.Uint32(s)))\n\tcase oid.T_int2:\n\t\treturn int64(int16(binary.BigEndian.Uint16(s)))\n\n\tdefault:\n\t\terrorf(\"don't know how to decode binary parameter of type %u\", uint32(typ))\n\t}\n\n\tpanic(\"not reached\")\n}\n\nfunc textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interface{} {\n\tswitch typ {\n\tcase oid.T_bytea:\n\t\treturn parseBytea(s)\n\tcase oid.T_timestamptz:\n\t\treturn parseTs(parameterStatus.currentLocation, string(s))\n\tcase oid.T_timestamp, oid.T_date:\n\t\treturn parseTs(nil, string(s))\n\tcase oid.T_time:\n\t\treturn mustParse(\"15:04:05\", typ, s)\n\tcase oid.T_timetz:\n\t\treturn mustParse(\"15:04:05-07\", typ, s)\n\tcase oid.T_bool:\n\t\treturn s[0] == 't'\n\tcase oid.T_int8, oid.T_int4, oid.T_int2:\n\t\ti, err := strconv.ParseInt(string(s), 10, 64)\n\t\tif err != nil {\n\t\t\terrorf(\"%s\", err)\n\t\t}\n\t\treturn i\n\tcase oid.T_float4, oid.T_float8:\n\t\tbits := 64\n\t\tif typ == oid.T_float4 {\n\t\t\tbits = 32\n\t\t}\n\t\tf, err := strconv.ParseFloat(string(s), bits)\n\t\tif err != nil {\n\t\t\terrorf(\"%s\", err)\n\t\t}\n\t\treturn f\n\t}\n\n\treturn s\n}\n\n// appendEncodedText encodes item in text format as required by COPY\n// and appends to buf\nfunc appendEncodedText(parameterStatus *parameterStatus, buf []byte, x interface{}) []byte {\n\tswitch v := x.(type) {\n\tcase int64:\n\t\treturn strconv.AppendInt(buf, v, 10)\n\tcase float64:\n\t\treturn strconv.AppendFloat(buf, v, 'f', -1, 64)\n\tcase []byte:\n\t\tencodedBytea := encodeBytea(parameterStatus.serverVersion, v)\n\t\treturn appendEscapedText(buf, string(encodedBytea))\n\tcase string:\n\t\treturn appendEscapedText(buf, v)\n\tcase bool:\n\t\treturn strconv.AppendBool(buf, v)\n\tcase time.Time:\n\t\treturn append(buf, formatTs(v)...)\n\tcase nil:\n\t\treturn append(buf, \"\\\\N\"...)\n\tdefault:\n\t\terrorf(\"encode: unknown type for %T\", v)\n\t}\n\n\tpanic(\"not reached\")\n}\n\nfunc appendEscapedText(buf []byte, text string) []byte {\n\tescapeNeeded := false\n\tstartPos := 0\n\tvar c byte\n\n\t// check if we need to escape\n\tfor i := 0; i < len(text); i++ {\n\t\tc = text[i]\n\t\tif c == '\\\\' || c == '\\n' || c == '\\r' || c == '\\t' {\n\t\t\tescapeNeeded = true\n\t\t\tstartPos = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif !escapeNeeded {\n\t\treturn append(buf, text...)\n\t}\n\n\t// copy till first char to escape, iterate the rest\n\tresult := append(buf, text[:startPos]...)\n\tfor i := startPos; i < len(text); i++ {\n\t\tc = text[i]\n\t\tswitch c {\n\t\tcase '\\\\':\n\t\t\tresult = append(result, '\\\\', '\\\\')\n\t\tcase '\\n':\n\t\t\tresult = append(result, '\\\\', 'n')\n\t\tcase '\\r':\n\t\t\tresult = append(result, '\\\\', 'r')\n\t\tcase '\\t':\n\t\t\tresult = append(result, '\\\\', 't')\n\t\tdefault:\n\t\t\tresult = append(result, c)\n\t\t}\n\t}\n\treturn result\n}\n\nfunc mustParse(f string, typ oid.Oid, s []byte) time.Time {\n\tstr := string(s)\n\n\t// check for a 30-minute-offset timezone\n\tif (typ == oid.T_timestamptz || typ == oid.T_timetz) &&\n\t\tstr[len(str)-3] == ':' {\n\t\tf += \":00\"\n\t}\n\tt, err := time.Parse(f, str)\n\tif err != nil {\n\t\terrorf(\"decode: %s\", err)\n\t}\n\treturn t\n}\n\nfunc expect(str, char string, pos int) {\n\tif c := str[pos : pos+1]; c != char {\n\t\terrorf(\"expected '%v' at position %v; got '%v'\", char, pos, c)\n\t}\n}\n\nfunc mustAtoi(str string) int {\n\tresult, err := strconv.Atoi(str)\n\tif err != nil {\n\t\terrorf(\"expected number; got '%v'\", str)\n\t}\n\treturn result\n}\n\n// The location cache caches the time zones typically used by the client.\ntype locationCache struct {\n\tcache map[int]*time.Location\n\tlock  sync.Mutex\n}\n\n// All connections share the same list of timezones. Benchmarking shows that\n// about 5% speed could be gained by putting the cache in the connection and\n// losing the mutex, at the cost of a small amount of memory and a somewhat\n// significant increase in code complexity.\nvar globalLocationCache *locationCache = newLocationCache()\n\nfunc newLocationCache() *locationCache {\n\treturn &locationCache{cache: make(map[int]*time.Location)}\n}\n\n// Returns the cached timezone for the specified offset, creating and caching\n// it if necessary.\nfunc (c *locationCache) getLocation(offset int) *time.Location {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tlocation, ok := c.cache[offset]\n\tif !ok {\n\t\tlocation = time.FixedZone(\"\", offset)\n\t\tc.cache[offset] = location\n\t}\n\n\treturn location\n}\n\nvar infinityTsEnabled = false\nvar infinityTsNegative time.Time\nvar infinityTsPositive time.Time\n\nconst (\n\tinfinityTsEnabledAlready        = \"pq: infinity timestamp enabled already\"\n\tinfinityTsNegativeMustBeSmaller = \"pq: infinity timestamp: negative value must be smaller (before) than positive\"\n)\n\n/*\n * If EnableInfinityTs is not called, \"-infinity\" and \"infinity\" will return\n * []byte(\"-infinity\") and []byte(\"infinity\") respectively, and potentially\n * cause error \"sql: Scan error on column index 0: unsupported driver -> Scan pair: []uint8 -> *time.Time\",\n * when scanning into a time.Time value.\n *\n * Once EnableInfinityTs has been called, all connections created using this\n * driver will decode Postgres' \"-infinity\" and \"infinity\" for \"timestamp\",\n * \"timestamp with time zone\" and \"date\" types to the predefined minimum and\n * maximum times, respectively.  When encoding time.Time values, any time which\n * equals or preceeds the predefined minimum time will be encoded to\n * \"-infinity\".  Any values at or past the maximum time will similarly be\n * encoded to \"infinity\".\n *\n *\n * If EnableInfinityTs is called with negative >= positive, it will panic.\n * Calling EnableInfinityTs after a connection has been established results in\n * undefined behavior.  If EnableInfinityTs is called more than once, it will\n * panic.\n */\nfunc EnableInfinityTs(negative time.Time, positive time.Time) {\n\tif infinityTsEnabled {\n\t\tpanic(infinityTsEnabledAlready)\n\t}\n\tif !negative.Before(positive) {\n\t\tpanic(infinityTsNegativeMustBeSmaller)\n\t}\n\tinfinityTsEnabled = true\n\tinfinityTsNegative = negative\n\tinfinityTsPositive = positive\n}\n\n/*\n * Testing might want to toggle infinityTsEnabled\n */\nfunc disableInfinityTs() {\n\tinfinityTsEnabled = false\n}\n\n// This is a time function specific to the Postgres default DateStyle\n// setting (\"ISO, MDY\"), the only one we currently support. This\n// accounts for the discrepancies between the parsing available with\n// time.Parse and the Postgres date formatting quirks.\nfunc parseTs(currentLocation *time.Location, str string) interface{} {\n\tswitch str {\n\tcase \"-infinity\":\n\t\tif infinityTsEnabled {\n\t\t\treturn infinityTsNegative\n\t\t}\n\t\treturn []byte(str)\n\tcase \"infinity\":\n\t\tif infinityTsEnabled {\n\t\t\treturn infinityTsPositive\n\t\t}\n\t\treturn []byte(str)\n\t}\n\n\tmonSep := strings.IndexRune(str, '-')\n\t// this is Gregorian year, not ISO Year\n\t// In Gregorian system, the year 1 BC is followed by AD 1\n\tyear := mustAtoi(str[:monSep])\n\tdaySep := monSep + 3\n\tmonth := mustAtoi(str[monSep+1 : daySep])\n\texpect(str, \"-\", daySep)\n\ttimeSep := daySep + 3\n\tday := mustAtoi(str[daySep+1 : timeSep])\n\n\tvar hour, minute, second int\n\tif len(str) > monSep+len(\"01-01\")+1 {\n\t\texpect(str, \" \", timeSep)\n\t\tminSep := timeSep + 3\n\t\texpect(str, \":\", minSep)\n\t\thour = mustAtoi(str[timeSep+1 : minSep])\n\t\tsecSep := minSep + 3\n\t\texpect(str, \":\", secSep)\n\t\tminute = mustAtoi(str[minSep+1 : secSep])\n\t\tsecEnd := secSep + 3\n\t\tsecond = mustAtoi(str[secSep+1 : secEnd])\n\t}\n\tremainderIdx := monSep + len(\"01-01 00:00:00\") + 1\n\t// Three optional (but ordered) sections follow: the\n\t// fractional seconds, the time zone offset, and the BC\n\t// designation. We set them up here and adjust the other\n\t// offsets if the preceding sections exist.\n\n\tnanoSec := 0\n\ttzOff := 0\n\n\tif remainderIdx < len(str) && str[remainderIdx:remainderIdx+1] == \".\" {\n\t\tfracStart := remainderIdx + 1\n\t\tfracOff := strings.IndexAny(str[fracStart:], \"-+ \")\n\t\tif fracOff < 0 {\n\t\t\tfracOff = len(str) - fracStart\n\t\t}\n\t\tfracSec := mustAtoi(str[fracStart : fracStart+fracOff])\n\t\tnanoSec = fracSec * (1000000000 / int(math.Pow(10, float64(fracOff))))\n\n\t\tremainderIdx += fracOff + 1\n\t}\n\tif tzStart := remainderIdx; tzStart < len(str) && (str[tzStart:tzStart+1] == \"-\" || str[tzStart:tzStart+1] == \"+\") {\n\t\t// time zone separator is always '-' or '+' (UTC is +00)\n\t\tvar tzSign int\n\t\tif c := str[tzStart : tzStart+1]; c == \"-\" {\n\t\t\ttzSign = -1\n\t\t} else if c == \"+\" {\n\t\t\ttzSign = +1\n\t\t} else {\n\t\t\terrorf(\"expected '-' or '+' at position %v; got %v\", tzStart, c)\n\t\t}\n\t\ttzHours := mustAtoi(str[tzStart+1 : tzStart+3])\n\t\tremainderIdx += 3\n\t\tvar tzMin, tzSec int\n\t\tif tzStart+3 < len(str) && str[tzStart+3:tzStart+4] == \":\" {\n\t\t\ttzMin = mustAtoi(str[tzStart+4 : tzStart+6])\n\t\t\tremainderIdx += 3\n\t\t}\n\t\tif tzStart+6 < len(str) && str[tzStart+6:tzStart+7] == \":\" {\n\t\t\ttzSec = mustAtoi(str[tzStart+7 : tzStart+9])\n\t\t\tremainderIdx += 3\n\t\t}\n\t\ttzOff = tzSign * ((tzHours * 60 * 60) + (tzMin * 60) + tzSec)\n\t}\n\tvar isoYear int\n\tif remainderIdx < len(str) && str[remainderIdx:remainderIdx+3] == \" BC\" {\n\t\tisoYear = 1 - year\n\t\tremainderIdx += 3\n\t} else {\n\t\tisoYear = year\n\t}\n\tif remainderIdx < len(str) {\n\t\terrorf(\"expected end of input, got %v\", str[remainderIdx:])\n\t}\n\tt := time.Date(isoYear, time.Month(month), day,\n\t\thour, minute, second, nanoSec,\n\t\tglobalLocationCache.getLocation(tzOff))\n\n\tif currentLocation != nil {\n\t\t// Set the location of the returned Time based on the session's\n\t\t// TimeZone value, but only if the local time zone database agrees with\n\t\t// the remote database on the offset.\n\t\tlt := t.In(currentLocation)\n\t\t_, newOff := lt.Zone()\n\t\tif newOff == tzOff {\n\t\t\tt = lt\n\t\t}\n\t}\n\n\treturn t\n}\n\n// formatTs formats t into a format postgres understands.\nfunc formatTs(t time.Time) (b []byte) {\n\tif infinityTsEnabled {\n\t\t// t <= -infinity : ! (t > -infinity)\n\t\tif !t.After(infinityTsNegative) {\n\t\t\treturn []byte(\"-infinity\")\n\t\t}\n\t\t// t >= infinity : ! (!t < infinity)\n\t\tif !t.Before(infinityTsPositive) {\n\t\t\treturn []byte(\"infinity\")\n\t\t}\n\t}\n\t// Need to send dates before 0001 A.D. with \" BC\" suffix, instead of the\n\t// minus sign preferred by Go.\n\t// Beware, \"0000\" in ISO is \"1 BC\", \"-0001\" is \"2 BC\" and so on\n\tbc := false\n\tif t.Year() <= 0 {\n\t\t// flip year sign, and add 1, e.g: \"0\" will be \"1\", and \"-10\" will be \"11\"\n\t\tt = t.AddDate((-t.Year())*2+1, 0, 0)\n\t\tbc = true\n\t}\n\tb = []byte(t.Format(time.RFC3339Nano))\n\n\t_, offset := t.Zone()\n\toffset = offset % 60\n\tif offset != 0 {\n\t\t// RFC3339Nano already printed the minus sign\n\t\tif offset < 0 {\n\t\t\toffset = -offset\n\t\t}\n\n\t\tb = append(b, ':')\n\t\tif offset < 10 {\n\t\t\tb = append(b, '0')\n\t\t}\n\t\tb = strconv.AppendInt(b, int64(offset), 10)\n\t}\n\n\tif bc {\n\t\tb = append(b, \" BC\"...)\n\t}\n\treturn b\n}\n\n// Parse a bytea value received from the server.  Both \"hex\" and the legacy\n// \"escape\" format are supported.\nfunc parseBytea(s []byte) (result []byte) {\n\tif len(s) >= 2 && bytes.Equal(s[:2], []byte(\"\\\\x\")) {\n\t\t// bytea_output = hex\n\t\ts = s[2:] // trim off leading \"\\\\x\"\n\t\tresult = make([]byte, hex.DecodedLen(len(s)))\n\t\t_, err := hex.Decode(result, s)\n\t\tif err != nil {\n\t\t\terrorf(\"%s\", err)\n\t\t}\n\t} else {\n\t\t// bytea_output = escape\n\t\tfor len(s) > 0 {\n\t\t\tif s[0] == '\\\\' {\n\t\t\t\t// escaped '\\\\'\n\t\t\t\tif len(s) >= 2 && s[1] == '\\\\' {\n\t\t\t\t\tresult = append(result, '\\\\')\n\t\t\t\t\ts = s[2:]\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// '\\\\' followed by an octal number\n\t\t\t\tif len(s) < 4 {\n\t\t\t\t\terrorf(\"invalid bytea sequence %v\", s)\n\t\t\t\t}\n\t\t\t\tr, err := strconv.ParseInt(string(s[1:4]), 8, 9)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorf(\"could not parse bytea value: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\tresult = append(result, byte(r))\n\t\t\t\ts = s[4:]\n\t\t\t} else {\n\t\t\t\t// We hit an unescaped, raw byte.  Try to read in as many as\n\t\t\t\t// possible in one go.\n\t\t\t\ti := bytes.IndexByte(s, '\\\\')\n\t\t\t\tif i == -1 {\n\t\t\t\t\tresult = append(result, s...)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tresult = append(result, s[:i]...)\n\t\t\t\ts = s[i:]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunc encodeBytea(serverVersion int, v []byte) (result []byte) {\n\tif serverVersion >= 90000 {\n\t\t// Use the hex format if we know that the server supports it\n\t\tresult = make([]byte, 2+hex.EncodedLen(len(v)))\n\t\tresult[0] = '\\\\'\n\t\tresult[1] = 'x'\n\t\thex.Encode(result[2:], v)\n\t} else {\n\t\t// .. or resort to \"escape\"\n\t\tfor _, b := range v {\n\t\t\tif b == '\\\\' {\n\t\t\t\tresult = append(result, '\\\\', '\\\\')\n\t\t\t} else if b < 0x20 || b > 0x7e {\n\t\t\t\tresult = append(result, []byte(fmt.Sprintf(\"\\\\%03o\", b))...)\n\t\t\t} else {\n\t\t\t\tresult = append(result, b)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\n// NullTime represents a time.Time that may be null. NullTime implements the\n// sql.Scanner interface so it can be used as a scan destination, similar to\n// sql.NullString.\ntype NullTime struct {\n\tTime  time.Time\n\tValid bool // Valid is true if Time is not NULL\n}\n\n// Scan implements the Scanner interface.\nfunc (nt *NullTime) Scan(value interface{}) error {\n\tnt.Time, nt.Valid = value.(time.Time)\n\treturn nil\n}\n\n// Value implements the driver Valuer interface.\nfunc (nt NullTime) Value() (driver.Value, error) {\n\tif !nt.Valid {\n\t\treturn nil, nil\n\t}\n\treturn nt.Time, nil\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/error.go",
    "content": "package pq\n\nimport (\n\t\"database/sql/driver\"\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"runtime\"\n)\n\n// Error severities\nconst (\n\tEfatal   = \"FATAL\"\n\tEpanic   = \"PANIC\"\n\tEwarning = \"WARNING\"\n\tEnotice  = \"NOTICE\"\n\tEdebug   = \"DEBUG\"\n\tEinfo    = \"INFO\"\n\tElog     = \"LOG\"\n)\n\n// Error represents an error communicating with the server.\n//\n// See http://www.postgresql.org/docs/current/static/protocol-error-fields.html for details of the fields\ntype Error struct {\n\tSeverity         string\n\tCode             ErrorCode\n\tMessage          string\n\tDetail           string\n\tHint             string\n\tPosition         string\n\tInternalPosition string\n\tInternalQuery    string\n\tWhere            string\n\tSchema           string\n\tTable            string\n\tColumn           string\n\tDataTypeName     string\n\tConstraint       string\n\tFile             string\n\tLine             string\n\tRoutine          string\n}\n\n// ErrorCode is a five-character error code.\ntype ErrorCode string\n\n// Name returns a more human friendly rendering of the error code, namely the\n// \"condition name\".\n//\n// See http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html for\n// details.\nfunc (ec ErrorCode) Name() string {\n\treturn errorCodeNames[ec]\n}\n\n// ErrorClass is only the class part of an error code.\ntype ErrorClass string\n\n// Name returns the condition name of an error class.  It is equivalent to the\n// condition name of the \"standard\" error code (i.e. the one having the last\n// three characters \"000\").\nfunc (ec ErrorClass) Name() string {\n\treturn errorCodeNames[ErrorCode(ec+\"000\")]\n}\n\n// Class returns the error class, e.g. \"28\".\n//\n// See http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html for\n// details.\nfunc (ec ErrorCode) Class() ErrorClass {\n\treturn ErrorClass(ec[0:2])\n}\n\n// errorCodeNames is a mapping between the five-character error codes and the\n// human readable \"condition names\". It is derived from the list at\n// http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html\nvar errorCodeNames = map[ErrorCode]string{\n\t// Class 00 - Successful Completion\n\t\"00000\": \"successful_completion\",\n\t// Class 01 - Warning\n\t\"01000\": \"warning\",\n\t\"0100C\": \"dynamic_result_sets_returned\",\n\t\"01008\": \"implicit_zero_bit_padding\",\n\t\"01003\": \"null_value_eliminated_in_set_function\",\n\t\"01007\": \"privilege_not_granted\",\n\t\"01006\": \"privilege_not_revoked\",\n\t\"01004\": \"string_data_right_truncation\",\n\t\"01P01\": \"deprecated_feature\",\n\t// Class 02 - No Data (this is also a warning class per the SQL standard)\n\t\"02000\": \"no_data\",\n\t\"02001\": \"no_additional_dynamic_result_sets_returned\",\n\t// Class 03 - SQL Statement Not Yet Complete\n\t\"03000\": \"sql_statement_not_yet_complete\",\n\t// Class 08 - Connection Exception\n\t\"08000\": \"connection_exception\",\n\t\"08003\": \"connection_does_not_exist\",\n\t\"08006\": \"connection_failure\",\n\t\"08001\": \"sqlclient_unable_to_establish_sqlconnection\",\n\t\"08004\": \"sqlserver_rejected_establishment_of_sqlconnection\",\n\t\"08007\": \"transaction_resolution_unknown\",\n\t\"08P01\": \"protocol_violation\",\n\t// Class 09 - Triggered Action Exception\n\t\"09000\": \"triggered_action_exception\",\n\t// Class 0A - Feature Not Supported\n\t\"0A000\": \"feature_not_supported\",\n\t// Class 0B - Invalid Transaction Initiation\n\t\"0B000\": \"invalid_transaction_initiation\",\n\t// Class 0F - Locator Exception\n\t\"0F000\": \"locator_exception\",\n\t\"0F001\": \"invalid_locator_specification\",\n\t// Class 0L - Invalid Grantor\n\t\"0L000\": \"invalid_grantor\",\n\t\"0LP01\": \"invalid_grant_operation\",\n\t// Class 0P - Invalid Role Specification\n\t\"0P000\": \"invalid_role_specification\",\n\t// Class 0Z - Diagnostics Exception\n\t\"0Z000\": \"diagnostics_exception\",\n\t\"0Z002\": \"stacked_diagnostics_accessed_without_active_handler\",\n\t// Class 20 - Case Not Found\n\t\"20000\": \"case_not_found\",\n\t// Class 21 - Cardinality Violation\n\t\"21000\": \"cardinality_violation\",\n\t// Class 22 - Data Exception\n\t\"22000\": \"data_exception\",\n\t\"2202E\": \"array_subscript_error\",\n\t\"22021\": \"character_not_in_repertoire\",\n\t\"22008\": \"datetime_field_overflow\",\n\t\"22012\": \"division_by_zero\",\n\t\"22005\": \"error_in_assignment\",\n\t\"2200B\": \"escape_character_conflict\",\n\t\"22022\": \"indicator_overflow\",\n\t\"22015\": \"interval_field_overflow\",\n\t\"2201E\": \"invalid_argument_for_logarithm\",\n\t\"22014\": \"invalid_argument_for_ntile_function\",\n\t\"22016\": \"invalid_argument_for_nth_value_function\",\n\t\"2201F\": \"invalid_argument_for_power_function\",\n\t\"2201G\": \"invalid_argument_for_width_bucket_function\",\n\t\"22018\": \"invalid_character_value_for_cast\",\n\t\"22007\": \"invalid_datetime_format\",\n\t\"22019\": \"invalid_escape_character\",\n\t\"2200D\": \"invalid_escape_octet\",\n\t\"22025\": \"invalid_escape_sequence\",\n\t\"22P06\": \"nonstandard_use_of_escape_character\",\n\t\"22010\": \"invalid_indicator_parameter_value\",\n\t\"22023\": \"invalid_parameter_value\",\n\t\"2201B\": \"invalid_regular_expression\",\n\t\"2201W\": \"invalid_row_count_in_limit_clause\",\n\t\"2201X\": \"invalid_row_count_in_result_offset_clause\",\n\t\"22009\": \"invalid_time_zone_displacement_value\",\n\t\"2200C\": \"invalid_use_of_escape_character\",\n\t\"2200G\": \"most_specific_type_mismatch\",\n\t\"22004\": \"null_value_not_allowed\",\n\t\"22002\": \"null_value_no_indicator_parameter\",\n\t\"22003\": \"numeric_value_out_of_range\",\n\t\"22026\": \"string_data_length_mismatch\",\n\t\"22001\": \"string_data_right_truncation\",\n\t\"22011\": \"substring_error\",\n\t\"22027\": \"trim_error\",\n\t\"22024\": \"unterminated_c_string\",\n\t\"2200F\": \"zero_length_character_string\",\n\t\"22P01\": \"floating_point_exception\",\n\t\"22P02\": \"invalid_text_representation\",\n\t\"22P03\": \"invalid_binary_representation\",\n\t\"22P04\": \"bad_copy_file_format\",\n\t\"22P05\": \"untranslatable_character\",\n\t\"2200L\": \"not_an_xml_document\",\n\t\"2200M\": \"invalid_xml_document\",\n\t\"2200N\": \"invalid_xml_content\",\n\t\"2200S\": \"invalid_xml_comment\",\n\t\"2200T\": \"invalid_xml_processing_instruction\",\n\t// Class 23 - Integrity Constraint Violation\n\t\"23000\": \"integrity_constraint_violation\",\n\t\"23001\": \"restrict_violation\",\n\t\"23502\": \"not_null_violation\",\n\t\"23503\": \"foreign_key_violation\",\n\t\"23505\": \"unique_violation\",\n\t\"23514\": \"check_violation\",\n\t\"23P01\": \"exclusion_violation\",\n\t// Class 24 - Invalid Cursor State\n\t\"24000\": \"invalid_cursor_state\",\n\t// Class 25 - Invalid Transaction State\n\t\"25000\": \"invalid_transaction_state\",\n\t\"25001\": \"active_sql_transaction\",\n\t\"25002\": \"branch_transaction_already_active\",\n\t\"25008\": \"held_cursor_requires_same_isolation_level\",\n\t\"25003\": \"inappropriate_access_mode_for_branch_transaction\",\n\t\"25004\": \"inappropriate_isolation_level_for_branch_transaction\",\n\t\"25005\": \"no_active_sql_transaction_for_branch_transaction\",\n\t\"25006\": \"read_only_sql_transaction\",\n\t\"25007\": \"schema_and_data_statement_mixing_not_supported\",\n\t\"25P01\": \"no_active_sql_transaction\",\n\t\"25P02\": \"in_failed_sql_transaction\",\n\t// Class 26 - Invalid SQL Statement Name\n\t\"26000\": \"invalid_sql_statement_name\",\n\t// Class 27 - Triggered Data Change Violation\n\t\"27000\": \"triggered_data_change_violation\",\n\t// Class 28 - Invalid Authorization Specification\n\t\"28000\": \"invalid_authorization_specification\",\n\t\"28P01\": \"invalid_password\",\n\t// Class 2B - Dependent Privilege Descriptors Still Exist\n\t\"2B000\": \"dependent_privilege_descriptors_still_exist\",\n\t\"2BP01\": \"dependent_objects_still_exist\",\n\t// Class 2D - Invalid Transaction Termination\n\t\"2D000\": \"invalid_transaction_termination\",\n\t// Class 2F - SQL Routine Exception\n\t\"2F000\": \"sql_routine_exception\",\n\t\"2F005\": \"function_executed_no_return_statement\",\n\t\"2F002\": \"modifying_sql_data_not_permitted\",\n\t\"2F003\": \"prohibited_sql_statement_attempted\",\n\t\"2F004\": \"reading_sql_data_not_permitted\",\n\t// Class 34 - Invalid Cursor Name\n\t\"34000\": \"invalid_cursor_name\",\n\t// Class 38 - External Routine Exception\n\t\"38000\": \"external_routine_exception\",\n\t\"38001\": \"containing_sql_not_permitted\",\n\t\"38002\": \"modifying_sql_data_not_permitted\",\n\t\"38003\": \"prohibited_sql_statement_attempted\",\n\t\"38004\": \"reading_sql_data_not_permitted\",\n\t// Class 39 - External Routine Invocation Exception\n\t\"39000\": \"external_routine_invocation_exception\",\n\t\"39001\": \"invalid_sqlstate_returned\",\n\t\"39004\": \"null_value_not_allowed\",\n\t\"39P01\": \"trigger_protocol_violated\",\n\t\"39P02\": \"srf_protocol_violated\",\n\t// Class 3B - Savepoint Exception\n\t\"3B000\": \"savepoint_exception\",\n\t\"3B001\": \"invalid_savepoint_specification\",\n\t// Class 3D - Invalid Catalog Name\n\t\"3D000\": \"invalid_catalog_name\",\n\t// Class 3F - Invalid Schema Name\n\t\"3F000\": \"invalid_schema_name\",\n\t// Class 40 - Transaction Rollback\n\t\"40000\": \"transaction_rollback\",\n\t\"40002\": \"transaction_integrity_constraint_violation\",\n\t\"40001\": \"serialization_failure\",\n\t\"40003\": \"statement_completion_unknown\",\n\t\"40P01\": \"deadlock_detected\",\n\t// Class 42 - Syntax Error or Access Rule Violation\n\t\"42000\": \"syntax_error_or_access_rule_violation\",\n\t\"42601\": \"syntax_error\",\n\t\"42501\": \"insufficient_privilege\",\n\t\"42846\": \"cannot_coerce\",\n\t\"42803\": \"grouping_error\",\n\t\"42P20\": \"windowing_error\",\n\t\"42P19\": \"invalid_recursion\",\n\t\"42830\": \"invalid_foreign_key\",\n\t\"42602\": \"invalid_name\",\n\t\"42622\": \"name_too_long\",\n\t\"42939\": \"reserved_name\",\n\t\"42804\": \"datatype_mismatch\",\n\t\"42P18\": \"indeterminate_datatype\",\n\t\"42P21\": \"collation_mismatch\",\n\t\"42P22\": \"indeterminate_collation\",\n\t\"42809\": \"wrong_object_type\",\n\t\"42703\": \"undefined_column\",\n\t\"42883\": \"undefined_function\",\n\t\"42P01\": \"undefined_table\",\n\t\"42P02\": \"undefined_parameter\",\n\t\"42704\": \"undefined_object\",\n\t\"42701\": \"duplicate_column\",\n\t\"42P03\": \"duplicate_cursor\",\n\t\"42P04\": \"duplicate_database\",\n\t\"42723\": \"duplicate_function\",\n\t\"42P05\": \"duplicate_prepared_statement\",\n\t\"42P06\": \"duplicate_schema\",\n\t\"42P07\": \"duplicate_table\",\n\t\"42712\": \"duplicate_alias\",\n\t\"42710\": \"duplicate_object\",\n\t\"42702\": \"ambiguous_column\",\n\t\"42725\": \"ambiguous_function\",\n\t\"42P08\": \"ambiguous_parameter\",\n\t\"42P09\": \"ambiguous_alias\",\n\t\"42P10\": \"invalid_column_reference\",\n\t\"42611\": \"invalid_column_definition\",\n\t\"42P11\": \"invalid_cursor_definition\",\n\t\"42P12\": \"invalid_database_definition\",\n\t\"42P13\": \"invalid_function_definition\",\n\t\"42P14\": \"invalid_prepared_statement_definition\",\n\t\"42P15\": \"invalid_schema_definition\",\n\t\"42P16\": \"invalid_table_definition\",\n\t\"42P17\": \"invalid_object_definition\",\n\t// Class 44 - WITH CHECK OPTION Violation\n\t\"44000\": \"with_check_option_violation\",\n\t// Class 53 - Insufficient Resources\n\t\"53000\": \"insufficient_resources\",\n\t\"53100\": \"disk_full\",\n\t\"53200\": \"out_of_memory\",\n\t\"53300\": \"too_many_connections\",\n\t\"53400\": \"configuration_limit_exceeded\",\n\t// Class 54 - Program Limit Exceeded\n\t\"54000\": \"program_limit_exceeded\",\n\t\"54001\": \"statement_too_complex\",\n\t\"54011\": \"too_many_columns\",\n\t\"54023\": \"too_many_arguments\",\n\t// Class 55 - Object Not In Prerequisite State\n\t\"55000\": \"object_not_in_prerequisite_state\",\n\t\"55006\": \"object_in_use\",\n\t\"55P02\": \"cant_change_runtime_param\",\n\t\"55P03\": \"lock_not_available\",\n\t// Class 57 - Operator Intervention\n\t\"57000\": \"operator_intervention\",\n\t\"57014\": \"query_canceled\",\n\t\"57P01\": \"admin_shutdown\",\n\t\"57P02\": \"crash_shutdown\",\n\t\"57P03\": \"cannot_connect_now\",\n\t\"57P04\": \"database_dropped\",\n\t// Class 58 - System Error (errors external to PostgreSQL itself)\n\t\"58000\": \"system_error\",\n\t\"58030\": \"io_error\",\n\t\"58P01\": \"undefined_file\",\n\t\"58P02\": \"duplicate_file\",\n\t// Class F0 - Configuration File Error\n\t\"F0000\": \"config_file_error\",\n\t\"F0001\": \"lock_file_exists\",\n\t// Class HV - Foreign Data Wrapper Error (SQL/MED)\n\t\"HV000\": \"fdw_error\",\n\t\"HV005\": \"fdw_column_name_not_found\",\n\t\"HV002\": \"fdw_dynamic_parameter_value_needed\",\n\t\"HV010\": \"fdw_function_sequence_error\",\n\t\"HV021\": \"fdw_inconsistent_descriptor_information\",\n\t\"HV024\": \"fdw_invalid_attribute_value\",\n\t\"HV007\": \"fdw_invalid_column_name\",\n\t\"HV008\": \"fdw_invalid_column_number\",\n\t\"HV004\": \"fdw_invalid_data_type\",\n\t\"HV006\": \"fdw_invalid_data_type_descriptors\",\n\t\"HV091\": \"fdw_invalid_descriptor_field_identifier\",\n\t\"HV00B\": \"fdw_invalid_handle\",\n\t\"HV00C\": \"fdw_invalid_option_index\",\n\t\"HV00D\": \"fdw_invalid_option_name\",\n\t\"HV090\": \"fdw_invalid_string_length_or_buffer_length\",\n\t\"HV00A\": \"fdw_invalid_string_format\",\n\t\"HV009\": \"fdw_invalid_use_of_null_pointer\",\n\t\"HV014\": \"fdw_too_many_handles\",\n\t\"HV001\": \"fdw_out_of_memory\",\n\t\"HV00P\": \"fdw_no_schemas\",\n\t\"HV00J\": \"fdw_option_name_not_found\",\n\t\"HV00K\": \"fdw_reply_handle\",\n\t\"HV00Q\": \"fdw_schema_not_found\",\n\t\"HV00R\": \"fdw_table_not_found\",\n\t\"HV00L\": \"fdw_unable_to_create_execution\",\n\t\"HV00M\": \"fdw_unable_to_create_reply\",\n\t\"HV00N\": \"fdw_unable_to_establish_connection\",\n\t// Class P0 - PL/pgSQL Error\n\t\"P0000\": \"plpgsql_error\",\n\t\"P0001\": \"raise_exception\",\n\t\"P0002\": \"no_data_found\",\n\t\"P0003\": \"too_many_rows\",\n\t// Class XX - Internal Error\n\t\"XX000\": \"internal_error\",\n\t\"XX001\": \"data_corrupted\",\n\t\"XX002\": \"index_corrupted\",\n}\n\nfunc parseError(r *readBuf) *Error {\n\terr := new(Error)\n\tfor t := r.byte(); t != 0; t = r.byte() {\n\t\tmsg := r.string()\n\t\tswitch t {\n\t\tcase 'S':\n\t\t\terr.Severity = msg\n\t\tcase 'C':\n\t\t\terr.Code = ErrorCode(msg)\n\t\tcase 'M':\n\t\t\terr.Message = msg\n\t\tcase 'D':\n\t\t\terr.Detail = msg\n\t\tcase 'H':\n\t\t\terr.Hint = msg\n\t\tcase 'P':\n\t\t\terr.Position = msg\n\t\tcase 'p':\n\t\t\terr.InternalPosition = msg\n\t\tcase 'q':\n\t\t\terr.InternalQuery = msg\n\t\tcase 'W':\n\t\t\terr.Where = msg\n\t\tcase 's':\n\t\t\terr.Schema = msg\n\t\tcase 't':\n\t\t\terr.Table = msg\n\t\tcase 'c':\n\t\t\terr.Column = msg\n\t\tcase 'd':\n\t\t\terr.DataTypeName = msg\n\t\tcase 'n':\n\t\t\terr.Constraint = msg\n\t\tcase 'F':\n\t\t\terr.File = msg\n\t\tcase 'L':\n\t\t\terr.Line = msg\n\t\tcase 'R':\n\t\t\terr.Routine = msg\n\t\t}\n\t}\n\treturn err\n}\n\n// Fatal returns true if the Error Severity is fatal.\nfunc (err *Error) Fatal() bool {\n\treturn err.Severity == Efatal\n}\n\n// Get implements the legacy PGError interface. New code should use the fields\n// of the Error struct directly.\nfunc (err *Error) Get(k byte) (v string) {\n\tswitch k {\n\tcase 'S':\n\t\treturn err.Severity\n\tcase 'C':\n\t\treturn string(err.Code)\n\tcase 'M':\n\t\treturn err.Message\n\tcase 'D':\n\t\treturn err.Detail\n\tcase 'H':\n\t\treturn err.Hint\n\tcase 'P':\n\t\treturn err.Position\n\tcase 'p':\n\t\treturn err.InternalPosition\n\tcase 'q':\n\t\treturn err.InternalQuery\n\tcase 'W':\n\t\treturn err.Where\n\tcase 's':\n\t\treturn err.Schema\n\tcase 't':\n\t\treturn err.Table\n\tcase 'c':\n\t\treturn err.Column\n\tcase 'd':\n\t\treturn err.DataTypeName\n\tcase 'n':\n\t\treturn err.Constraint\n\tcase 'F':\n\t\treturn err.File\n\tcase 'L':\n\t\treturn err.Line\n\tcase 'R':\n\t\treturn err.Routine\n\t}\n\treturn \"\"\n}\n\nfunc (err Error) Error() string {\n\treturn \"pq: \" + err.Message\n}\n\n// PGError is an interface used by previous versions of pq. It is provided\n// only to support legacy code. New code should use the Error type.\ntype PGError interface {\n\tError() string\n\tFatal() bool\n\tGet(k byte) (v string)\n}\n\nfunc errorf(s string, args ...interface{}) {\n\tpanic(fmt.Errorf(\"pq: %s\", fmt.Sprintf(s, args...)))\n}\n\nfunc errRecoverNoErrBadConn(err *error) {\n\te := recover()\n\tif e == nil {\n\t\t// Do nothing\n\t\treturn\n\t}\n\tvar ok bool\n\t*err, ok = e.(error)\n\tif !ok {\n\t\t*err = fmt.Errorf(\"pq: unexpected error: %#v\", e)\n\t}\n}\n\nfunc (c *conn) errRecover(err *error) {\n\te := recover()\n\tswitch v := e.(type) {\n\tcase nil:\n\t\t// Do nothing\n\tcase runtime.Error:\n\t\tc.bad = true\n\t\tpanic(v)\n\tcase *Error:\n\t\tif v.Fatal() {\n\t\t\t*err = driver.ErrBadConn\n\t\t} else {\n\t\t\t*err = v\n\t\t}\n\tcase *net.OpError:\n\t\t*err = driver.ErrBadConn\n\tcase error:\n\t\tif v == io.EOF || v.(error).Error() == \"remote error: handshake failure\" {\n\t\t\t*err = driver.ErrBadConn\n\t\t} else {\n\t\t\t*err = v\n\t\t}\n\n\tdefault:\n\t\tc.bad = true\n\t\tpanic(fmt.Sprintf(\"unknown error: %#v\", e))\n\t}\n\n\t// Any time we return ErrBadConn, we need to remember it since *Tx doesn't\n\t// mark the connection bad in database/sql.\n\tif *err == driver.ErrBadConn {\n\t\tc.bad = true\n\t}\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/notify.go",
    "content": "package pq\n\n// Package pq is a pure Go Postgres driver for the database/sql package.\n// This module contains support for Postgres LISTEN/NOTIFY.\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"sync\"\n\t\"sync/atomic\"\n\t\"time\"\n)\n\n// Notification represents a single notification from the database.\ntype Notification struct {\n\t// Process ID (PID) of the notifying postgres backend.\n\tBePid int\n\t// Name of the channel the notification was sent on.\n\tChannel string\n\t// Payload, or the empty string if unspecified.\n\tExtra string\n}\n\nfunc recvNotification(r *readBuf) *Notification {\n\tbePid := r.int32()\n\tchannel := r.string()\n\textra := r.string()\n\n\treturn &Notification{bePid, channel, extra}\n}\n\nconst (\n\tconnStateIdle int32 = iota\n\tconnStateExpectResponse\n\tconnStateExpectReadyForQuery\n)\n\ntype message struct {\n\ttyp byte\n\terr error\n}\n\nvar errListenerConnClosed = errors.New(\"pq: ListenerConn has been closed\")\n\n// ListenerConn is a low-level interface for waiting for notifications.  You\n// should use Listener instead.\ntype ListenerConn struct {\n\t// guards cn and err\n\tconnectionLock sync.Mutex\n\tcn             *conn\n\terr            error\n\n\tconnState int32\n\n\t// the sending goroutine will be holding this lock\n\tsenderLock sync.Mutex\n\n\tnotificationChan chan<- *Notification\n\n\treplyChan chan message\n}\n\n// Creates a new ListenerConn.  Use NewListener instead.\nfunc NewListenerConn(name string, notificationChan chan<- *Notification) (*ListenerConn, error) {\n\tcn, err := Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl := &ListenerConn{\n\t\tcn:               cn.(*conn),\n\t\tnotificationChan: notificationChan,\n\t\tconnState:        connStateIdle,\n\t\treplyChan:        make(chan message, 2),\n\t}\n\n\tgo l.listenerConnMain()\n\n\treturn l, nil\n}\n\n// We can only allow one goroutine at a time to be running a query on the\n// connection for various reasons, so the goroutine sending on the connection\n// must be holding senderLock.\n//\n// Returns an error if an unrecoverable error has occurred and the ListenerConn\n// should be abandoned.\nfunc (l *ListenerConn) acquireSenderLock() error {\n\t// we must acquire senderLock first to avoid deadlocks; see ExecSimpleQuery\n\tl.senderLock.Lock()\n\n\tl.connectionLock.Lock()\n\terr := l.err\n\tl.connectionLock.Unlock()\n\tif err != nil {\n\t\tl.senderLock.Unlock()\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (l *ListenerConn) releaseSenderLock() {\n\tl.senderLock.Unlock()\n}\n\n// setState advances the protocol state to newState.  Returns false if moving\n// to that state from the current state is not allowed.\nfunc (l *ListenerConn) setState(newState int32) bool {\n\tvar expectedState int32\n\n\tswitch newState {\n\tcase connStateIdle:\n\t\texpectedState = connStateExpectReadyForQuery\n\tcase connStateExpectResponse:\n\t\texpectedState = connStateIdle\n\tcase connStateExpectReadyForQuery:\n\t\texpectedState = connStateExpectResponse\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected listenerConnState %d\", newState))\n\t}\n\n\treturn atomic.CompareAndSwapInt32(&l.connState, expectedState, newState)\n}\n\n// Main logic is here: receive messages from the postgres backend, forward\n// notifications and query replies and keep the internal state in sync with the\n// protocol state.  Returns when the connection has been lost, is about to go\n// away or should be discarded because we couldn't agree on the state with the\n// server backend.\nfunc (l *ListenerConn) listenerConnLoop() (err error) {\n\tdefer errRecoverNoErrBadConn(&err)\n\n\tr := &readBuf{}\n\tfor {\n\t\tt, err := l.cn.recvMessage(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tswitch t {\n\t\tcase 'A':\n\t\t\t// recvNotification copies all the data so we don't need to worry\n\t\t\t// about the scratch buffer being overwritten.\n\t\t\tl.notificationChan <- recvNotification(r)\n\n\t\tcase 'T', 'D':\n\t\t\t// only used by tests; ignore\n\n\t\tcase 'E':\n\t\t\t// We might receive an ErrorResponse even when not in a query; it\n\t\t\t// is expected that the server will close the connection after\n\t\t\t// that, but we should make sure that the error we display is the\n\t\t\t// one from the stray ErrorResponse, not io.ErrUnexpectedEOF.\n\t\t\tif !l.setState(connStateExpectReadyForQuery) {\n\t\t\t\treturn parseError(r)\n\t\t\t}\n\t\t\tl.replyChan <- message{t, parseError(r)}\n\n\t\tcase 'C', 'I':\n\t\t\tif !l.setState(connStateExpectReadyForQuery) {\n\t\t\t\t// protocol out of sync\n\t\t\t\treturn fmt.Errorf(\"unexpected CommandComplete\")\n\t\t\t}\n\t\t\t// ExecSimpleQuery doesn't need to know about this message\n\n\t\tcase 'Z':\n\t\t\tif !l.setState(connStateIdle) {\n\t\t\t\t// protocol out of sync\n\t\t\t\treturn fmt.Errorf(\"unexpected ReadyForQuery\")\n\t\t\t}\n\t\t\tl.replyChan <- message{t, nil}\n\n\t\tcase 'N', 'S':\n\t\t\t// ignore\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected message %q from server in listenerConnLoop\", t)\n\t\t}\n\t}\n}\n\n// This is the main routine for the goroutine receiving on the database\n// connection.  Most of the main logic is in listenerConnLoop.\nfunc (l *ListenerConn) listenerConnMain() {\n\terr := l.listenerConnLoop()\n\n\t// listenerConnLoop terminated; we're done, but we still have to clean up.\n\t// Make sure nobody tries to start any new queries by making sure the err\n\t// pointer is set.  It is important that we do not overwrite its value; a\n\t// connection could be closed by either this goroutine or one sending on\n\t// the connection -- whoever closes the connection is assumed to have the\n\t// more meaningful error message (as the other one will probably get\n\t// net.errClosed), so that goroutine sets the error we expose while the\n\t// other error is discarded.  If the connection is lost while two\n\t// goroutines are operating on the socket, it probably doesn't matter which\n\t// error we expose so we don't try to do anything more complex.\n\tl.connectionLock.Lock()\n\tif l.err == nil {\n\t\tl.err = err\n\t}\n\tl.cn.Close()\n\tl.connectionLock.Unlock()\n\n\t// There might be a query in-flight; make sure nobody's waiting for a\n\t// response to it, since there's not going to be one.\n\tclose(l.replyChan)\n\n\t// let the listener know we're done\n\tclose(l.notificationChan)\n\n\t// this ListenerConn is done\n}\n\n// Send a LISTEN query to the server.  See ExecSimpleQuery.\nfunc (l *ListenerConn) Listen(channel string) (bool, error) {\n\treturn l.ExecSimpleQuery(\"LISTEN \" + QuoteIdentifier(channel))\n}\n\n// Send an UNLISTEN query to the server.  See ExecSimpleQuery.\nfunc (l *ListenerConn) Unlisten(channel string) (bool, error) {\n\treturn l.ExecSimpleQuery(\"UNLISTEN \" + QuoteIdentifier(channel))\n}\n\n// Send `UNLISTEN *` to the server.  See ExecSimpleQuery.\nfunc (l *ListenerConn) UnlistenAll() (bool, error) {\n\treturn l.ExecSimpleQuery(\"UNLISTEN *\")\n}\n\n// Ping the remote server to make sure it's alive.  Non-nil error means the\n// connection has failed and should be abandoned.\nfunc (l *ListenerConn) Ping() error {\n\tsent, err := l.ExecSimpleQuery(\"\")\n\tif !sent {\n\t\treturn err\n\t}\n\tif err != nil {\n\t\t// shouldn't happen\n\t\tpanic(err)\n\t}\n\treturn nil\n}\n\n// Attempt to send a query on the connection.  Returns an error if sending the\n// query failed, and the caller should initiate closure of this connection.\n// The caller must be holding senderLock (see acquireSenderLock and\n// releaseSenderLock).\nfunc (l *ListenerConn) sendSimpleQuery(q string) (err error) {\n\tdefer errRecoverNoErrBadConn(&err)\n\n\t// must set connection state before sending the query\n\tif !l.setState(connStateExpectResponse) {\n\t\tpanic(\"two queries running at the same time\")\n\t}\n\n\t// Can't use l.cn.writeBuf here because it uses the scratch buffer which\n\t// might get overwritten by listenerConnLoop.\n\tb := &writeBuf{\n\t\tbuf: []byte(\"Q\\x00\\x00\\x00\\x00\"),\n\t\tpos: 1,\n\t}\n\tb.string(q)\n\tl.cn.send(b)\n\n\treturn nil\n}\n\n// Execute a \"simple query\" (i.e. one with no bindable parameters) on the\n// connection.  The possible return values are:\n//   1) \"executed\" is true; the query was executed to completion on the\n//      database server.  If the query failed, err will be set to the error\n//      returned by the database, otherwise err will be nil.\n//   2) If \"executed\" is false, the query could not be executed on the remote\n//      server.  err will be non-nil.\n//\n// After a call to ExecSimpleQuery has returned an executed=false value, the\n// connection has either been closed or will be closed shortly thereafter, and\n// all subsequently executed queries will return an error.\nfunc (l *ListenerConn) ExecSimpleQuery(q string) (executed bool, err error) {\n\tif err = l.acquireSenderLock(); err != nil {\n\t\treturn false, err\n\t}\n\tdefer l.releaseSenderLock()\n\n\terr = l.sendSimpleQuery(q)\n\tif err != nil {\n\t\t// We can't know what state the protocol is in, so we need to abandon\n\t\t// this connection.\n\t\tl.connectionLock.Lock()\n\t\t// Set the error pointer if it hasn't been set already; see\n\t\t// listenerConnMain.\n\t\tif l.err == nil {\n\t\t\tl.err = err\n\t\t}\n\t\tl.connectionLock.Unlock()\n\t\tl.cn.c.Close()\n\t\treturn false, err\n\t}\n\n\t// now we just wait for a reply..\n\tfor {\n\t\tm, ok := <-l.replyChan\n\t\tif !ok {\n\t\t\t// We lost the connection to server, don't bother waiting for a\n\t\t\t// a response.  err should have been set already.\n\t\t\tl.connectionLock.Lock()\n\t\t\terr := l.err\n\t\t\tl.connectionLock.Unlock()\n\t\t\treturn false, err\n\t\t}\n\t\tswitch m.typ {\n\t\tcase 'Z':\n\t\t\t// sanity check\n\t\t\tif m.err != nil {\n\t\t\t\tpanic(\"m.err != nil\")\n\t\t\t}\n\t\t\t// done; err might or might not be set\n\t\t\treturn true, err\n\n\t\tcase 'E':\n\t\t\t// sanity check\n\t\t\tif m.err == nil {\n\t\t\t\tpanic(\"m.err == nil\")\n\t\t\t}\n\t\t\t// server responded with an error; ReadyForQuery to follow\n\t\t\terr = m.err\n\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"unknown response for simple query: %q\", m.typ)\n\t\t}\n\t}\n}\n\nfunc (l *ListenerConn) Close() error {\n\tl.connectionLock.Lock()\n\tif l.err != nil {\n\t\tl.connectionLock.Unlock()\n\t\treturn errListenerConnClosed\n\t}\n\tl.err = errListenerConnClosed\n\tl.connectionLock.Unlock()\n\t// We can't send anything on the connection without holding senderLock.\n\t// Simply close the net.Conn to wake up everyone operating on it.\n\treturn l.cn.c.Close()\n}\n\n// Err() returns the reason the connection was closed.  It is not safe to call\n// this function until l.Notify has been closed.\nfunc (l *ListenerConn) Err() error {\n\treturn l.err\n}\n\nvar errListenerClosed = errors.New(\"pq: Listener has been closed\")\n\nvar ErrChannelAlreadyOpen = errors.New(\"pq: channel is already open\")\nvar ErrChannelNotOpen = errors.New(\"pq: channel is not open\")\n\ntype ListenerEventType int\n\nconst (\n\t// Emitted only when the database connection has been initially\n\t// initialized.  err will always be nil.\n\tListenerEventConnected ListenerEventType = iota\n\n\t// Emitted after a database connection has been lost, either because of an\n\t// error or because Close has been called.  err will be set to the reason\n\t// the database connection was lost.\n\tListenerEventDisconnected\n\n\t// Emitted after a database connection has been re-established after\n\t// connection loss.  err will always be nil.  After this event has been\n\t// emitted, a nil pq.Notification is sent on the Listener.Notify channel.\n\tListenerEventReconnected\n\n\t// Emitted after a connection to the database was attempted, but failed.\n\t// err will be set to an error describing why the connection attempt did\n\t// not succeed.\n\tListenerEventConnectionAttemptFailed\n)\n\ntype EventCallbackType func(event ListenerEventType, err error)\n\n// Listener provides an interface for listening to notifications from a\n// PostgreSQL database.  For general usage information, see section\n// \"Notifications\".\n//\n// Listener can safely be used from concurrently running goroutines.\ntype Listener struct {\n\t// Channel for receiving notifications from the database.  In some cases a\n\t// nil value will be sent.  See section \"Notifications\" above.\n\tNotify chan *Notification\n\n\tname                 string\n\tminReconnectInterval time.Duration\n\tmaxReconnectInterval time.Duration\n\teventCallback        EventCallbackType\n\n\tlock                 sync.Mutex\n\tisClosed             bool\n\treconnectCond        *sync.Cond\n\tcn                   *ListenerConn\n\tconnNotificationChan <-chan *Notification\n\tchannels             map[string]struct{}\n}\n\n// NewListener creates a new database connection dedicated to LISTEN / NOTIFY.\n//\n// name should be set to a connection string to be used to establish the\n// database connection (see section \"Connection String Parameters\" above).\n//\n// minReconnectInterval controls the duration to wait before trying to\n// re-establish the database connection after connection loss.  After each\n// consecutive failure this interval is doubled, until maxReconnectInterval is\n// reached.  Successfully completing the connection establishment procedure\n// resets the interval back to minReconnectInterval.\n//\n// The last parameter eventCallback can be set to a function which will be\n// called by the Listener when the state of the underlying database connection\n// changes.  This callback will be called by the goroutine which dispatches the\n// notifications over the Notify channel, so you should try to avoid doing\n// potentially time-consuming operations from the callback.\nfunc NewListener(name string,\n\tminReconnectInterval time.Duration,\n\tmaxReconnectInterval time.Duration,\n\teventCallback EventCallbackType) *Listener {\n\tl := &Listener{\n\t\tname:                 name,\n\t\tminReconnectInterval: minReconnectInterval,\n\t\tmaxReconnectInterval: maxReconnectInterval,\n\t\teventCallback:        eventCallback,\n\n\t\tchannels: make(map[string]struct{}),\n\n\t\tNotify: make(chan *Notification, 32),\n\t}\n\tl.reconnectCond = sync.NewCond(&l.lock)\n\n\tgo l.listenerMain()\n\n\treturn l\n}\n\n// Returns the notification channel for this listener.  This is the same\n// channel as Notify, and will not be recreated during the life time of the\n// Listener.\nfunc (l *Listener) NotificationChannel() <-chan *Notification {\n\treturn l.Notify\n}\n\n// Listen starts listening for notifications on a channel.  Calls to this\n// function will block until an acknowledgement has been received from the\n// server.  Note that Listener automatically re-establishes the connection\n// after connection loss, so this function may block indefinitely if the\n// connection can not be re-established.\n//\n// Listen will only fail in three conditions:\n//   1) The channel is already open.  The returned error will be\n//      ErrChannelAlreadyOpen.\n//   2) The query was executed on the remote server, but PostgreSQL returned an\n//      error message in response to the query.  The returned error will be a\n//      pq.Error containing the information the server supplied.\n//   3) Close is called on the Listener before the request could be completed.\n//\n// The channel name is case-sensitive.\nfunc (l *Listener) Listen(channel string) error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\tif l.isClosed {\n\t\treturn errListenerClosed\n\t}\n\n\t// The server allows you to issue a LISTEN on a channel which is already\n\t// open, but it seems useful to be able to detect this case to spot for\n\t// mistakes in application logic.  If the application genuinely does't\n\t// care, it can check the exported error and ignore it.\n\t_, exists := l.channels[channel]\n\tif exists {\n\t\treturn ErrChannelAlreadyOpen\n\t}\n\n\tif l.cn != nil {\n\t\t// If gotResponse is true but error is set, the query was executed on\n\t\t// the remote server, but resulted in an error.  This should be\n\t\t// relatively rare, so it's fine if we just pass the error to our\n\t\t// caller.  However, if gotResponse is false, we could not complete the\n\t\t// query on the remote server and our underlying connection is about\n\t\t// to go away, so we only add relname to l.channels, and wait for\n\t\t// resync() to take care of the rest.\n\t\tgotResponse, err := l.cn.Listen(channel)\n\t\tif gotResponse && err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tl.channels[channel] = struct{}{}\n\tfor l.cn == nil {\n\t\tl.reconnectCond.Wait()\n\t\t// we let go of the mutex for a while\n\t\tif l.isClosed {\n\t\t\treturn errListenerClosed\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// Unlisten removes a channel from the Listener's channel list.  Returns\n// ErrChannelNotOpen if the Listener is not listening on the specified channel.\n// Returns immediately with no error if there is no connection.  Note that you\n// might still get notifications for this channel even after Unlisten has\n// returned.\n//\n// The channel name is case-sensitive.\nfunc (l *Listener) Unlisten(channel string) error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\tif l.isClosed {\n\t\treturn errListenerClosed\n\t}\n\n\t// Similarly to LISTEN, this is not an error in Postgres, but it seems\n\t// useful to distinguish from the normal conditions.\n\t_, exists := l.channels[channel]\n\tif !exists {\n\t\treturn ErrChannelNotOpen\n\t}\n\n\tif l.cn != nil {\n\t\t// Similarly to Listen (see comment in that function), the caller\n\t\t// should only be bothered with an error if it came from the backend as\n\t\t// a response to our query.\n\t\tgotResponse, err := l.cn.Unlisten(channel)\n\t\tif gotResponse && err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Don't bother waiting for resync if there's no connection.\n\tdelete(l.channels, channel)\n\treturn nil\n}\n\n// UnlistenAll removes all channels from the Listener's channel list.  Returns\n// immediately with no error if there is no connection.  Note that you might\n// still get notifications for any of the deleted channels even after\n// UnlistenAll has returned.\nfunc (l *Listener) UnlistenAll() error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\tif l.isClosed {\n\t\treturn errListenerClosed\n\t}\n\n\tif l.cn != nil {\n\t\t// Similarly to Listen (see comment in that function), the caller\n\t\t// should only be bothered with an error if it came from the backend as\n\t\t// a response to our query.\n\t\tgotResponse, err := l.cn.UnlistenAll()\n\t\tif gotResponse && err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Don't bother waiting for resync if there's no connection.\n\tl.channels = make(map[string]struct{})\n\treturn nil\n}\n\n// Ping the remote server to make sure it's alive.  Non-nil return value means\n// that there is no active connection.\nfunc (l *Listener) Ping() error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\tif l.isClosed {\n\t\treturn errListenerClosed\n\t}\n\tif l.cn == nil {\n\t\treturn errors.New(\"no connection\")\n\t}\n\n\treturn l.cn.Ping()\n}\n\n// Clean up after losing the server connection.  Returns l.cn.Err(), which\n// should have the reason the connection was lost.\nfunc (l *Listener) disconnectCleanup() error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\t// sanity check; can't look at Err() until the channel has been closed\n\tselect {\n\tcase _, ok := <-l.connNotificationChan:\n\t\tif ok {\n\t\t\tpanic(\"connNotificationChan not closed\")\n\t\t}\n\tdefault:\n\t\tpanic(\"connNotificationChan not closed\")\n\t}\n\n\terr := l.cn.Err()\n\tl.cn.Close()\n\tl.cn = nil\n\treturn err\n}\n\n// Synchronize the list of channels we want to be listening on with the server\n// after the connection has been established.\nfunc (l *Listener) resync(cn *ListenerConn, notificationChan <-chan *Notification) error {\n\tdoneChan := make(chan error)\n\tgo func() {\n\t\tfor channel := range l.channels {\n\t\t\t// If we got a response, return that error to our caller as it's\n\t\t\t// going to be more descriptive than cn.Err().\n\t\t\tgotResponse, err := cn.Listen(channel)\n\t\t\tif gotResponse && err != nil {\n\t\t\t\tdoneChan <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If we couldn't reach the server, wait for notificationChan to\n\t\t\t// close and then return the error message from the connection, as\n\t\t\t// per ListenerConn's interface.\n\t\t\tif err != nil {\n\t\t\t\tfor _ = range notificationChan {\n\t\t\t\t}\n\t\t\t\tdoneChan <- cn.Err()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tdoneChan <- nil\n\t}()\n\n\t// Ignore notifications while synchronization is going on to avoid\n\t// deadlocks.  We have to send a nil notification over Notify anyway as\n\t// we can't possibly know which notifications (if any) were lost while\n\t// the connection was down, so there's no reason to try and process\n\t// these messages at all.\n\tfor {\n\t\tselect {\n\t\tcase _, ok := <-notificationChan:\n\t\t\tif !ok {\n\t\t\t\tnotificationChan = nil\n\t\t\t}\n\n\t\tcase err := <-doneChan:\n\t\t\treturn err\n\t\t}\n\t}\n}\n\n// caller should NOT be holding l.lock\nfunc (l *Listener) closed() bool {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\treturn l.isClosed\n}\n\nfunc (l *Listener) connect() error {\n\tnotificationChan := make(chan *Notification, 32)\n\tcn, err := NewListenerConn(l.name, notificationChan)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\terr = l.resync(cn, notificationChan)\n\tif err != nil {\n\t\tcn.Close()\n\t\treturn err\n\t}\n\n\tl.cn = cn\n\tl.connNotificationChan = notificationChan\n\tl.reconnectCond.Broadcast()\n\n\treturn nil\n}\n\n// Close disconnects the Listener from the database and shuts it down.\n// Subsequent calls to its methods will return an error.  Close returns an\n// error if the connection has already been closed.\nfunc (l *Listener) Close() error {\n\tl.lock.Lock()\n\tdefer l.lock.Unlock()\n\n\tif l.isClosed {\n\t\treturn errListenerClosed\n\t}\n\n\tif l.cn != nil {\n\t\tl.cn.Close()\n\t}\n\tl.isClosed = true\n\n\treturn nil\n}\n\nfunc (l *Listener) emitEvent(event ListenerEventType, err error) {\n\tif l.eventCallback != nil {\n\t\tl.eventCallback(event, err)\n\t}\n}\n\n// Main logic here: maintain a connection to the server when possible, wait\n// for notifications and emit events.\nfunc (l *Listener) listenerConnLoop() {\n\tvar nextReconnect time.Time\n\n\treconnectInterval := l.minReconnectInterval\n\tfor {\n\t\tfor {\n\t\t\terr := l.connect()\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif l.closed() {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tl.emitEvent(ListenerEventConnectionAttemptFailed, err)\n\n\t\t\ttime.Sleep(reconnectInterval)\n\t\t\treconnectInterval *= 2\n\t\t\tif reconnectInterval > l.maxReconnectInterval {\n\t\t\t\treconnectInterval = l.maxReconnectInterval\n\t\t\t}\n\t\t}\n\n\t\tif nextReconnect.IsZero() {\n\t\t\tl.emitEvent(ListenerEventConnected, nil)\n\t\t} else {\n\t\t\tl.emitEvent(ListenerEventReconnected, nil)\n\t\t\tl.Notify <- nil\n\t\t}\n\n\t\treconnectInterval = l.minReconnectInterval\n\t\tnextReconnect = time.Now().Add(reconnectInterval)\n\n\t\tfor {\n\t\t\tnotification, ok := <-l.connNotificationChan\n\t\t\tif !ok {\n\t\t\t\t// lost connection, loop again\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tl.Notify <- notification\n\t\t}\n\n\t\terr := l.disconnectCleanup()\n\t\tif l.closed() {\n\t\t\treturn\n\t\t}\n\t\tl.emitEvent(ListenerEventDisconnected, err)\n\n\t\ttime.Sleep(nextReconnect.Sub(time.Now()))\n\t}\n}\n\nfunc (l *Listener) listenerMain() {\n\tl.listenerConnLoop()\n\tclose(l.Notify)\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/oid/doc.go",
    "content": "// Package oid contains OID constants\n// as defined by the Postgres server.\npackage oid\n\n// Oid is a Postgres Object ID.\ntype Oid uint32\n"
  },
  {
    "path": "src/github.com/lib/pq/oid/gen.go",
    "content": "// +build ignore\n\n// Generate the table of OID values\n// Run with 'go run gen.go'.\npackage main\n\nimport (\n\t\"database/sql\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\n\t_ \"github.com/lib/pq\"\n)\n\nfunc main() {\n\tdatname := os.Getenv(\"PGDATABASE\")\n\tsslmode := os.Getenv(\"PGSSLMODE\")\n\n\tif datname == \"\" {\n\t\tos.Setenv(\"PGDATABASE\", \"pqgotest\")\n\t}\n\n\tif sslmode == \"\" {\n\t\tos.Setenv(\"PGSSLMODE\", \"disable\")\n\t}\n\n\tdb, err := sql.Open(\"postgres\", \"\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcmd := exec.Command(\"gofmt\")\n\tcmd.Stderr = os.Stderr\n\tw, err := cmd.StdinPipe()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tf, err := os.Create(\"types.go\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcmd.Stdout = f\n\terr = cmd.Start()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Fprintln(w, \"// generated by 'go run gen.go'; do not edit\")\n\tfmt.Fprintln(w, \"\\npackage oid\")\n\tfmt.Fprintln(w, \"const (\")\n\trows, err := db.Query(`\n\t\tSELECT typname, oid\n\t\tFROM pg_type WHERE oid < 10000\n\t\tORDER BY oid;\n\t`)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar name string\n\tvar oid int\n\tfor rows.Next() {\n\t\terr = rows.Scan(&name, &oid)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Fprintf(w, \"T_%s Oid = %d\\n\", name, oid)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Fprintln(w, \")\")\n\tw.Close()\n\tcmd.Wait()\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/oid/types.go",
    "content": "// generated by 'go run gen.go'; do not edit\n\npackage oid\n\nconst (\n\tT_bool             Oid = 16\n\tT_bytea            Oid = 17\n\tT_char             Oid = 18\n\tT_name             Oid = 19\n\tT_int8             Oid = 20\n\tT_int2             Oid = 21\n\tT_int2vector       Oid = 22\n\tT_int4             Oid = 23\n\tT_regproc          Oid = 24\n\tT_text             Oid = 25\n\tT_oid              Oid = 26\n\tT_tid              Oid = 27\n\tT_xid              Oid = 28\n\tT_cid              Oid = 29\n\tT_oidvector        Oid = 30\n\tT_pg_type          Oid = 71\n\tT_pg_attribute     Oid = 75\n\tT_pg_proc          Oid = 81\n\tT_pg_class         Oid = 83\n\tT_json             Oid = 114\n\tT_xml              Oid = 142\n\tT__xml             Oid = 143\n\tT_pg_node_tree     Oid = 194\n\tT__json            Oid = 199\n\tT_smgr             Oid = 210\n\tT_point            Oid = 600\n\tT_lseg             Oid = 601\n\tT_path             Oid = 602\n\tT_box              Oid = 603\n\tT_polygon          Oid = 604\n\tT_line             Oid = 628\n\tT__line            Oid = 629\n\tT_cidr             Oid = 650\n\tT__cidr            Oid = 651\n\tT_float4           Oid = 700\n\tT_float8           Oid = 701\n\tT_abstime          Oid = 702\n\tT_reltime          Oid = 703\n\tT_tinterval        Oid = 704\n\tT_unknown          Oid = 705\n\tT_circle           Oid = 718\n\tT__circle          Oid = 719\n\tT_money            Oid = 790\n\tT__money           Oid = 791\n\tT_macaddr          Oid = 829\n\tT_inet             Oid = 869\n\tT__bool            Oid = 1000\n\tT__bytea           Oid = 1001\n\tT__char            Oid = 1002\n\tT__name            Oid = 1003\n\tT__int2            Oid = 1005\n\tT__int2vector      Oid = 1006\n\tT__int4            Oid = 1007\n\tT__regproc         Oid = 1008\n\tT__text            Oid = 1009\n\tT__tid             Oid = 1010\n\tT__xid             Oid = 1011\n\tT__cid             Oid = 1012\n\tT__oidvector       Oid = 1013\n\tT__bpchar          Oid = 1014\n\tT__varchar         Oid = 1015\n\tT__int8            Oid = 1016\n\tT__point           Oid = 1017\n\tT__lseg            Oid = 1018\n\tT__path            Oid = 1019\n\tT__box             Oid = 1020\n\tT__float4          Oid = 1021\n\tT__float8          Oid = 1022\n\tT__abstime         Oid = 1023\n\tT__reltime         Oid = 1024\n\tT__tinterval       Oid = 1025\n\tT__polygon         Oid = 1027\n\tT__oid             Oid = 1028\n\tT_aclitem          Oid = 1033\n\tT__aclitem         Oid = 1034\n\tT__macaddr         Oid = 1040\n\tT__inet            Oid = 1041\n\tT_bpchar           Oid = 1042\n\tT_varchar          Oid = 1043\n\tT_date             Oid = 1082\n\tT_time             Oid = 1083\n\tT_timestamp        Oid = 1114\n\tT__timestamp       Oid = 1115\n\tT__date            Oid = 1182\n\tT__time            Oid = 1183\n\tT_timestamptz      Oid = 1184\n\tT__timestamptz     Oid = 1185\n\tT_interval         Oid = 1186\n\tT__interval        Oid = 1187\n\tT__numeric         Oid = 1231\n\tT_pg_database      Oid = 1248\n\tT__cstring         Oid = 1263\n\tT_timetz           Oid = 1266\n\tT__timetz          Oid = 1270\n\tT_bit              Oid = 1560\n\tT__bit             Oid = 1561\n\tT_varbit           Oid = 1562\n\tT__varbit          Oid = 1563\n\tT_numeric          Oid = 1700\n\tT_refcursor        Oid = 1790\n\tT__refcursor       Oid = 2201\n\tT_regprocedure     Oid = 2202\n\tT_regoper          Oid = 2203\n\tT_regoperator      Oid = 2204\n\tT_regclass         Oid = 2205\n\tT_regtype          Oid = 2206\n\tT__regprocedure    Oid = 2207\n\tT__regoper         Oid = 2208\n\tT__regoperator     Oid = 2209\n\tT__regclass        Oid = 2210\n\tT__regtype         Oid = 2211\n\tT_record           Oid = 2249\n\tT_cstring          Oid = 2275\n\tT_any              Oid = 2276\n\tT_anyarray         Oid = 2277\n\tT_void             Oid = 2278\n\tT_trigger          Oid = 2279\n\tT_language_handler Oid = 2280\n\tT_internal         Oid = 2281\n\tT_opaque           Oid = 2282\n\tT_anyelement       Oid = 2283\n\tT__record          Oid = 2287\n\tT_anynonarray      Oid = 2776\n\tT_pg_authid        Oid = 2842\n\tT_pg_auth_members  Oid = 2843\n\tT__txid_snapshot   Oid = 2949\n\tT_uuid             Oid = 2950\n\tT__uuid            Oid = 2951\n\tT_txid_snapshot    Oid = 2970\n\tT_fdw_handler      Oid = 3115\n\tT_anyenum          Oid = 3500\n\tT_tsvector         Oid = 3614\n\tT_tsquery          Oid = 3615\n\tT_gtsvector        Oid = 3642\n\tT__tsvector        Oid = 3643\n\tT__gtsvector       Oid = 3644\n\tT__tsquery         Oid = 3645\n\tT_regconfig        Oid = 3734\n\tT__regconfig       Oid = 3735\n\tT_regdictionary    Oid = 3769\n\tT__regdictionary   Oid = 3770\n\tT_anyrange         Oid = 3831\n\tT_event_trigger    Oid = 3838\n\tT_int4range        Oid = 3904\n\tT__int4range       Oid = 3905\n\tT_numrange         Oid = 3906\n\tT__numrange        Oid = 3907\n\tT_tsrange          Oid = 3908\n\tT__tsrange         Oid = 3909\n\tT_tstzrange        Oid = 3910\n\tT__tstzrange       Oid = 3911\n\tT_daterange        Oid = 3912\n\tT__daterange       Oid = 3913\n\tT_int8range        Oid = 3926\n\tT__int8range       Oid = 3927\n)\n"
  },
  {
    "path": "src/github.com/lib/pq/url.go",
    "content": "package pq\n\nimport (\n\t\"fmt\"\n\tnurl \"net/url\"\n\t\"sort\"\n\t\"strings\"\n)\n\n// ParseURL no longer needs to be used by clients of this library since supplying a URL as a\n// connection string to sql.Open() is now supported:\n//\n//\tsql.Open(\"postgres\", \"postgres://bob:secret@1.2.3.4:5432/mydb?sslmode=verify-full\")\n//\n// It remains exported here for backwards-compatibility.\n//\n// ParseURL converts a url to a connection string for driver.Open.\n// Example:\n//\n//\t\"postgres://bob:secret@1.2.3.4:5432/mydb?sslmode=verify-full\"\n//\n// converts to:\n//\n//\t\"user=bob password=secret host=1.2.3.4 port=5432 dbname=mydb sslmode=verify-full\"\n//\n// A minimal example:\n//\n//\t\"postgres://\"\n//\n// This will be blank, causing driver.Open to use all of the defaults\nfunc ParseURL(url string) (string, error) {\n\tu, err := nurl.Parse(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif u.Scheme != \"postgres\" && u.Scheme != \"postgresql\" {\n\t\treturn \"\", fmt.Errorf(\"invalid connection protocol: %s\", u.Scheme)\n\t}\n\n\tvar kvs []string\n\tescaper := strings.NewReplacer(` `, `\\ `, `'`, `\\'`, `\\`, `\\\\`)\n\taccrue := func(k, v string) {\n\t\tif v != \"\" {\n\t\t\tkvs = append(kvs, k+\"=\"+escaper.Replace(v))\n\t\t}\n\t}\n\n\tif u.User != nil {\n\t\tv := u.User.Username()\n\t\taccrue(\"user\", v)\n\n\t\tv, _ = u.User.Password()\n\t\taccrue(\"password\", v)\n\t}\n\n\ti := strings.Index(u.Host, \":\")\n\tif i < 0 {\n\t\taccrue(\"host\", u.Host)\n\t} else {\n\t\taccrue(\"host\", u.Host[:i])\n\t\taccrue(\"port\", u.Host[i+1:])\n\t}\n\n\tif u.Path != \"\" {\n\t\taccrue(\"dbname\", u.Path[1:])\n\t}\n\n\tq := u.Query()\n\tfor k := range q {\n\t\taccrue(k, q.Get(k))\n\t}\n\n\tsort.Strings(kvs) // Makes testing easier (not a performance concern)\n\treturn strings.Join(kvs, \" \"), nil\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/user_posix.go",
    "content": "// Package pq is a pure Go Postgres driver for the database/sql package.\n\n// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris\n\npackage pq\n\nimport (\n\t\"os\"\n\t\"os/user\"\n)\n\nfunc userCurrent() (string, error) {\n\tu, err := user.Current()\n\tif err == nil {\n\t\treturn u.Username, nil\n\t}\n\n\tname := os.Getenv(\"USER\")\n\tif name != \"\" {\n\t\treturn name, nil\n\t}\n\n\treturn \"\", ErrCouldNotDetectUsername\n}\n"
  },
  {
    "path": "src/github.com/lib/pq/user_windows.go",
    "content": "// Package pq is a pure Go Postgres driver for the database/sql package.\npackage pq\n\nimport (\n\t\"path/filepath\"\n\t\"syscall\"\n)\n\n// Perform Windows user name lookup identically to libpq.\n//\n// The PostgreSQL code makes use of the legacy Win32 function\n// GetUserName, and that function has not been imported into stock Go.\n// GetUserNameEx is available though, the difference being that a\n// wider range of names are available.  To get the output to be the\n// same as GetUserName, only the base (or last) component of the\n// result is returned.\nfunc userCurrent() (string, error) {\n\tpw_name := make([]uint16, 128)\n\tpwname_size := uint32(len(pw_name)) - 1\n\terr := syscall.GetUserNameEx(syscall.NameSamCompatible, &pw_name[0], &pwname_size)\n\tif err != nil {\n\t\treturn \"\", ErrCouldNotDetectUsername\n\t}\n\ts := syscall.UTF16ToString(pw_name)\n\tu := filepath.Base(s)\n\treturn u, nil\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/Gopkg.toml",
    "content": "[prune]\n  unused-packages = true\n  non-go = true\n  go-tests = true\n\n[[constraint]]\n  name = \"github.com/davecgh/go-spew\"\n  version = \"~1.1.0\"\n\n[[constraint]]\n  name = \"github.com/pmezard/go-difflib\"\n  version = \"~1.0.0\"\n\n[[constraint]]\n  name = \"github.com/stretchr/objx\"\n  version = \"~0.1.0\"\n"
  },
  {
    "path": "src/github.com/stretchr/testify/LICENSE",
    "content": "Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell\n\nPlease consider promoting this project if you find it useful.\n\nPermission is hereby granted, free of charge, to any person \nobtaining a copy of this software and associated documentation \nfiles (the \"Software\"), to deal in the Software without restriction, \nincluding without limitation the rights to use, copy, modify, merge, \npublish, distribute, sublicense, and/or sell copies of the Software, \nand to permit persons to whom the Software is furnished to do so, \nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, \nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, \nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT \nOR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE \nOR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "src/github.com/stretchr/testify/README.md",
    "content": "Testify - Thou Shalt Write Tests\n================================\n\n[![Build Status](https://travis-ci.org/stretchr/testify.svg)](https://travis-ci.org/stretchr/testify) [![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/testify)](https://goreportcard.com/report/github.com/stretchr/testify) [![GoDoc](https://godoc.org/github.com/stretchr/testify?status.svg)](https://godoc.org/github.com/stretchr/testify)\n\nGo code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.\n\nFeatures include:\n\n  * [Easy assertions](#assert-package)\n  * [Mocking](#mock-package)\n  * [Testing suite interfaces and functions](#suite-package)\n\nGet started:\n\n  * Install testify with [one line of code](#installation), or [update it with another](#staying-up-to-date)\n  * For an introduction to writing test code in Go, see http://golang.org/doc/code.html#Testing\n  * Check out the API Documentation http://godoc.org/github.com/stretchr/testify\n  * To make your testing life easier, check out our other project, [gorc](http://github.com/stretchr/gorc)\n  * A little about [Test-Driven Development (TDD)](http://en.wikipedia.org/wiki/Test-driven_development)\n\n\n\n[`assert`](http://godoc.org/github.com/stretchr/testify/assert \"API documentation\") package\n-------------------------------------------------------------------------------------------\n\nThe `assert` package provides some helpful methods that allow you to write better test code in Go.\n\n  * Prints friendly, easy to read failure descriptions\n  * Allows for very readable code\n  * Optionally annotate each assertion with a message\n\nSee it in action:\n\n```go\npackage yours\n\nimport (\n  \"testing\"\n  \"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n\n  // assert equality\n  assert.Equal(t, 123, 123, \"they should be equal\")\n\n  // assert inequality\n  assert.NotEqual(t, 123, 456, \"they should not be equal\")\n\n  // assert for nil (good for errors)\n  assert.Nil(t, object)\n\n  // assert for not nil (good when you expect something)\n  if assert.NotNil(t, object) {\n\n    // now we know that object isn't nil, we are safe to make\n    // further assertions without causing any errors\n    assert.Equal(t, \"Something\", object.Value)\n\n  }\n\n}\n```\n\n  * Every assert func takes the `testing.T` object as the first argument.  This is how it writes the errors out through the normal `go test` capabilities.\n  * Every assert func returns a bool indicating whether the assertion was successful or not, this is useful for if you want to go on making further assertions under certain conditions.\n\nif you assert many times, use the below:\n\n```go\npackage yours\n\nimport (\n  \"testing\"\n  \"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n  assert := assert.New(t)\n\n  // assert equality\n  assert.Equal(123, 123, \"they should be equal\")\n\n  // assert inequality\n  assert.NotEqual(123, 456, \"they should not be equal\")\n\n  // assert for nil (good for errors)\n  assert.Nil(object)\n\n  // assert for not nil (good when you expect something)\n  if assert.NotNil(object) {\n\n    // now we know that object isn't nil, we are safe to make\n    // further assertions without causing any errors\n    assert.Equal(\"Something\", object.Value)\n  }\n}\n```\n\n[`require`](http://godoc.org/github.com/stretchr/testify/require \"API documentation\") package\n---------------------------------------------------------------------------------------------\n\nThe `require` package provides same global functions as the `assert` package, but instead of returning a boolean result they terminate current test.\n\nSee [t.FailNow](http://golang.org/pkg/testing/#T.FailNow) for details.\n\n[`mock`](http://godoc.org/github.com/stretchr/testify/mock \"API documentation\") package\n----------------------------------------------------------------------------------------\n\nThe `mock` package provides a mechanism for easily writing mock objects that can be used in place of real objects when writing test code.\n\nAn example test function that tests a piece of code that relies on an external object `testObj`, can setup expectations (testify) and assert that they indeed happened:\n\n```go\npackage yours\n\nimport (\n  \"testing\"\n  \"github.com/stretchr/testify/mock\"\n)\n\n/*\n  Test objects\n*/\n\n// MyMockedObject is a mocked object that implements an interface\n// that describes an object that the code I am testing relies on.\ntype MyMockedObject struct{\n  mock.Mock\n}\n\n// DoSomething is a method on MyMockedObject that implements some interface\n// and just records the activity, and returns what the Mock object tells it to.\n//\n// In the real object, this method would do something useful, but since this\n// is a mocked object - we're just going to stub it out.\n//\n// NOTE: This method is not being tested here, code that uses this object is.\nfunc (m *MyMockedObject) DoSomething(number int) (bool, error) {\n\n  args := m.Called(number)\n  return args.Bool(0), args.Error(1)\n\n}\n\n/*\n  Actual test functions\n*/\n\n// TestSomething is an example of how to use our test object to\n// make assertions about some target code we are testing.\nfunc TestSomething(t *testing.T) {\n\n  // create an instance of our test object\n  testObj := new(MyMockedObject)\n\n  // setup expectations\n  testObj.On(\"DoSomething\", 123).Return(true, nil)\n\n  // call the code we are testing\n  targetFuncThatDoesSomethingWithObj(testObj)\n\n  // assert that the expectations were met\n  testObj.AssertExpectations(t)\n\n\n}\n\n// TestSomethingElse is a second example of how to use our test object to\n// make assertions about some target code we are testing.\n// This time using a placeholder. Placeholders might be used when the\n// data being passed in is normally dynamically generated and cannot be\n// predicted beforehand (eg. containing hashes that are time sensitive)\nfunc TestSomethingElse(t *testing.T) {\n\n  // create an instance of our test object\n  testObj := new(MyMockedObject)\n\n  // setup expectations with a placeholder in the argument list\n  testObj.On(\"DoSomething\", mock.Anything).Return(true, nil)\n\n  // call the code we are testing\n  targetFuncThatDoesSomethingWithObj(testObj)\n\n  // assert that the expectations were met\n  testObj.AssertExpectations(t)\n\n\n}\n```\n\nFor more information on how to write mock code, check out the [API documentation for the `mock` package](http://godoc.org/github.com/stretchr/testify/mock).\n\nYou can use the [mockery tool](http://github.com/vektra/mockery) to autogenerate the mock code against an interface as well, making using mocks much quicker.\n\n[`suite`](http://godoc.org/github.com/stretchr/testify/suite \"API documentation\") package\n-----------------------------------------------------------------------------------------\n\nThe `suite` package provides functionality that you might be used to from more common object oriented languages.  With it, you can build a testing suite as a struct, build setup/teardown methods and testing methods on your struct, and run them with 'go test' as per normal.\n\nAn example suite is shown below:\n\n```go\n// Basic imports\nimport (\n    \"testing\"\n    \"github.com/stretchr/testify/assert\"\n    \"github.com/stretchr/testify/suite\"\n)\n\n// Define the suite, and absorb the built-in basic suite\n// functionality from testify - including a T() method which\n// returns the current testing context\ntype ExampleTestSuite struct {\n    suite.Suite\n    VariableThatShouldStartAtFive int\n}\n\n// Make sure that VariableThatShouldStartAtFive is set to five\n// before each test\nfunc (suite *ExampleTestSuite) SetupTest() {\n    suite.VariableThatShouldStartAtFive = 5\n}\n\n// All methods that begin with \"Test\" are run as tests within a\n// suite.\nfunc (suite *ExampleTestSuite) TestExample() {\n    assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive)\n}\n\n// In order for 'go test' to run this suite, we need to create\n// a normal test function and pass our suite to suite.Run\nfunc TestExampleTestSuite(t *testing.T) {\n    suite.Run(t, new(ExampleTestSuite))\n}\n```\n\nFor a more complete example, using all of the functionality provided by the suite package, look at our [example testing suite](https://github.com/stretchr/testify/blob/master/suite/suite_test.go)\n\nFor more information on writing suites, check out the [API documentation for the `suite` package](http://godoc.org/github.com/stretchr/testify/suite).\n\n`Suite` object has assertion methods:\n\n```go\n// Basic imports\nimport (\n    \"testing\"\n    \"github.com/stretchr/testify/suite\"\n)\n\n// Define the suite, and absorb the built-in basic suite\n// functionality from testify - including assertion methods.\ntype ExampleTestSuite struct {\n    suite.Suite\n    VariableThatShouldStartAtFive int\n}\n\n// Make sure that VariableThatShouldStartAtFive is set to five\n// before each test\nfunc (suite *ExampleTestSuite) SetupTest() {\n    suite.VariableThatShouldStartAtFive = 5\n}\n\n// All methods that begin with \"Test\" are run as tests within a\n// suite.\nfunc (suite *ExampleTestSuite) TestExample() {\n    suite.Equal(suite.VariableThatShouldStartAtFive, 5)\n}\n\n// In order for 'go test' to run this suite, we need to create\n// a normal test function and pass our suite to suite.Run\nfunc TestExampleTestSuite(t *testing.T) {\n    suite.Run(t, new(ExampleTestSuite))\n}\n```\n\n------\n\nInstallation\n============\n\nTo install Testify, use `go get`:\n\n    go get github.com/stretchr/testify\n\nThis will then make the following packages available to you:\n\n    github.com/stretchr/testify/assert\n    github.com/stretchr/testify/mock\n    github.com/stretchr/testify/http\n\nImport the `testify/assert` package into your code using this template:\n\n```go\npackage yours\n\nimport (\n  \"testing\"\n  \"github.com/stretchr/testify/assert\"\n)\n\nfunc TestSomething(t *testing.T) {\n\n  assert.True(t, true, \"True is true!\")\n\n}\n```\n\n------\n\nStaying up to date\n==================\n\nTo update Testify to the latest version, use `go get -u github.com/stretchr/testify`.\n\n------\n\nSupported go versions\n==================\n\nWe support the three major Go versions, which are 1.8, 1.9 and 1.10 at the moment.\n\n------\n\nContributing\n============\n\nPlease feel free to submit issues, fork the repository and send pull requests!\n\nWhen submitting an issue, we ask that you please include a complete test function that demonstrates the issue.  Extra credit for those using Testify to write the test code that demonstrates it.\n"
  },
  {
    "path": "src/github.com/stretchr/testify/_codegen/main.go",
    "content": "// This program reads all assertion functions from the assert package and\n// automatically generates the corresponding requires and forwarded assertions\n\npackage main\n\nimport (\n\t\"bytes\"\n\t\"flag\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/doc\"\n\t\"go/format\"\n\t\"go/importer\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"go/types\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\t\"path\"\n\t\"regexp\"\n\t\"strings\"\n\t\"text/template\"\n\n\t\"github.com/ernesto-jimenez/gogen/imports\"\n)\n\nvar (\n\tpkg       = flag.String(\"assert-path\", \"github.com/stretchr/testify/assert\", \"Path to the assert package\")\n\tincludeF  = flag.Bool(\"include-format-funcs\", false, \"include format functions such as Errorf and Equalf\")\n\toutputPkg = flag.String(\"output-package\", \"\", \"package for the resulting code\")\n\ttmplFile  = flag.String(\"template\", \"\", \"What file to load the function template from\")\n\tout       = flag.String(\"out\", \"\", \"What file to write the source code to\")\n)\n\nfunc main() {\n\tflag.Parse()\n\n\tscope, docs, err := parsePackageSource(*pkg)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\timporter, funcs, err := analyzeCode(scope, docs)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif err := generateCode(importer, funcs); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\nfunc generateCode(importer imports.Importer, funcs []testFunc) error {\n\tbuff := bytes.NewBuffer(nil)\n\n\ttmplHead, tmplFunc, err := parseTemplates()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Generate header\n\tif err := tmplHead.Execute(buff, struct {\n\t\tName    string\n\t\tImports map[string]string\n\t}{\n\t\t*outputPkg,\n\t\timporter.Imports(),\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\t// Generate funcs\n\tfor _, fn := range funcs {\n\t\tbuff.Write([]byte(\"\\n\\n\"))\n\t\tif err := tmplFunc.Execute(buff, &fn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcode, err := format.Source(buff.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write file\n\toutput, err := outputFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer output.Close()\n\t_, err = io.Copy(output, bytes.NewReader(code))\n\treturn err\n}\n\nfunc parseTemplates() (*template.Template, *template.Template, error) {\n\ttmplHead, err := template.New(\"header\").Parse(headerTemplate)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif *tmplFile != \"\" {\n\t\tf, err := ioutil.ReadFile(*tmplFile)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfuncTemplate = string(f)\n\t}\n\ttmpl, err := template.New(\"function\").Parse(funcTemplate)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn tmplHead, tmpl, nil\n}\n\nfunc outputFile() (*os.File, error) {\n\tfilename := *out\n\tif filename == \"-\" || (filename == \"\" && *tmplFile == \"\") {\n\t\treturn os.Stdout, nil\n\t}\n\tif filename == \"\" {\n\t\tfilename = strings.TrimSuffix(strings.TrimSuffix(*tmplFile, \".tmpl\"), \".go\") + \".go\"\n\t}\n\treturn os.Create(filename)\n}\n\n// analyzeCode takes the types scope and the docs and returns the import\n// information and information about all the assertion functions.\nfunc analyzeCode(scope *types.Scope, docs *doc.Package) (imports.Importer, []testFunc, error) {\n\ttestingT := scope.Lookup(\"TestingT\").Type().Underlying().(*types.Interface)\n\n\timporter := imports.New(*outputPkg)\n\tvar funcs []testFunc\n\t// Go through all the top level functions\n\tfor _, fdocs := range docs.Funcs {\n\t\t// Find the function\n\t\tobj := scope.Lookup(fdocs.Name)\n\n\t\tfn, ok := obj.(*types.Func)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\t// Check function signature has at least two arguments\n\t\tsig := fn.Type().(*types.Signature)\n\t\tif sig.Params().Len() < 2 {\n\t\t\tcontinue\n\t\t}\n\t\t// Check first argument is of type testingT\n\t\tfirst, ok := sig.Params().At(0).Type().(*types.Named)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tfirstType, ok := first.Underlying().(*types.Interface)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif !types.Implements(firstType, testingT) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip functions ending with f\n\t\tif strings.HasSuffix(fdocs.Name, \"f\") && !*includeF {\n\t\t\tcontinue\n\t\t}\n\n\t\tfuncs = append(funcs, testFunc{*outputPkg, fdocs, fn})\n\t\timporter.AddImportsFrom(sig.Params())\n\t}\n\treturn importer, funcs, nil\n}\n\n// parsePackageSource returns the types scope and the package documentation from the package\nfunc parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) {\n\tpd, err := build.Import(pkg, \".\", 0)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfset := token.NewFileSet()\n\tfiles := make(map[string]*ast.File)\n\tfileList := make([]*ast.File, len(pd.GoFiles))\n\tfor i, fname := range pd.GoFiles {\n\t\tsrc, err := ioutil.ReadFile(path.Join(pd.SrcRoot, pd.ImportPath, fname))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tf, err := parser.ParseFile(fset, fname, src, parser.ParseComments|parser.AllErrors)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfiles[fname] = f\n\t\tfileList[i] = f\n\t}\n\n\tcfg := types.Config{\n\t\tImporter: importer.Default(),\n\t}\n\tinfo := types.Info{\n\t\tDefs: make(map[*ast.Ident]types.Object),\n\t}\n\ttp, err := cfg.Check(pkg, fset, fileList, &info)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tscope := tp.Scope()\n\n\tap, _ := ast.NewPackage(fset, files, nil, nil)\n\tdocs := doc.New(ap, pkg, 0)\n\n\treturn scope, docs, nil\n}\n\ntype testFunc struct {\n\tCurrentPkg string\n\tDocInfo    *doc.Func\n\tTypeInfo   *types.Func\n}\n\nfunc (f *testFunc) Qualifier(p *types.Package) string {\n\tif p == nil || p.Name() == f.CurrentPkg {\n\t\treturn \"\"\n\t}\n\treturn p.Name()\n}\n\nfunc (f *testFunc) Params() string {\n\tsig := f.TypeInfo.Type().(*types.Signature)\n\tparams := sig.Params()\n\tp := \"\"\n\tcomma := \"\"\n\tto := params.Len()\n\tvar i int\n\n\tif sig.Variadic() {\n\t\tto--\n\t}\n\tfor i = 1; i < to; i++ {\n\t\tparam := params.At(i)\n\t\tp += fmt.Sprintf(\"%s%s %s\", comma, param.Name(), types.TypeString(param.Type(), f.Qualifier))\n\t\tcomma = \", \"\n\t}\n\tif sig.Variadic() {\n\t\tparam := params.At(params.Len() - 1)\n\t\tp += fmt.Sprintf(\"%s%s ...%s\", comma, param.Name(), types.TypeString(param.Type().(*types.Slice).Elem(), f.Qualifier))\n\t}\n\treturn p\n}\n\nfunc (f *testFunc) ForwardedParams() string {\n\tsig := f.TypeInfo.Type().(*types.Signature)\n\tparams := sig.Params()\n\tp := \"\"\n\tcomma := \"\"\n\tto := params.Len()\n\tvar i int\n\n\tif sig.Variadic() {\n\t\tto--\n\t}\n\tfor i = 1; i < to; i++ {\n\t\tparam := params.At(i)\n\t\tp += fmt.Sprintf(\"%s%s\", comma, param.Name())\n\t\tcomma = \", \"\n\t}\n\tif sig.Variadic() {\n\t\tparam := params.At(params.Len() - 1)\n\t\tp += fmt.Sprintf(\"%s%s...\", comma, param.Name())\n\t}\n\treturn p\n}\n\nfunc (f *testFunc) ParamsFormat() string {\n\treturn strings.Replace(f.Params(), \"msgAndArgs\", \"msg string, args\", 1)\n}\n\nfunc (f *testFunc) ForwardedParamsFormat() string {\n\treturn strings.Replace(f.ForwardedParams(), \"msgAndArgs\", \"append([]interface{}{msg}, args...)\", 1)\n}\n\nfunc (f *testFunc) Comment() string {\n\treturn \"// \" + strings.Replace(strings.TrimSpace(f.DocInfo.Doc), \"\\n\", \"\\n// \", -1)\n}\n\nfunc (f *testFunc) CommentFormat() string {\n\tsearch := fmt.Sprintf(\"%s\", f.DocInfo.Name)\n\treplace := fmt.Sprintf(\"%sf\", f.DocInfo.Name)\n\tcomment := strings.Replace(f.Comment(), search, replace, -1)\n\texp := regexp.MustCompile(replace + `\\(((\\(\\)|[^)])+)\\)`)\n\treturn exp.ReplaceAllString(comment, replace+`($1, \"error message %s\", \"formatted\")`)\n}\n\nfunc (f *testFunc) CommentWithoutT(receiver string) string {\n\tsearch := fmt.Sprintf(\"assert.%s(t, \", f.DocInfo.Name)\n\treplace := fmt.Sprintf(\"%s.%s(\", receiver, f.DocInfo.Name)\n\treturn strings.Replace(f.Comment(), search, replace, -1)\n}\n\nvar headerTemplate = `/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n*/\n\npackage {{.Name}}\n\nimport (\n{{range $path, $name := .Imports}}\n\t{{$name}} \"{{$path}}\"{{end}}\n)\n`\n\nvar funcTemplate = `{{.Comment}}\nfunc (fwd *AssertionsForwarder) {{.DocInfo.Name}}({{.Params}}) bool {\n\treturn assert.{{.DocInfo.Name}}({{.ForwardedParams}})\n}`\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertion_format.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Condition(t, comp, append([]interface{}{msg}, args...)...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Contains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Emptyf(t, obj, \"error message %s\", \"formatted\")\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Empty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    assert.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equal(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValuesf(t, uint32(123, \"error message %s\", \"formatted\"), int32(123))\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Errorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Error(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    assert.Exactlyf(t, int32(123, \"error message %s\", \"formatted\"), int64(123))\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    assert.Falsef(t, myBool, \"error message %s\", \"formatted\")\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn False(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    assert.Implementsf(t, (*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDeltaf(t, math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    assert.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Len(t, object, length, append([]interface{}{msg}, args...)...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    assert.Nilf(t, err, \"error message %s\", \"formatted\")\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoErrorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoError(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmptyf(t, obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmpty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    assert.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    assert.NotNilf(t, err, \"error message %s\", \"formatted\")\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexpf(t, regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubsetf(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZero(t, i, append([]interface{}{msg}, args...)...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  assert.Regexpf(t, regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subsetf(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    assert.Truef(t, myBool, \"error message %s\", \"formatted\")\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn True(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zero(t, i, append([]interface{}{msg}, args...)...)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertion_format.go.tmpl",
    "content": "{{.CommentFormat}}\nfunc {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {\n\tif h, ok := t.(tHelper); ok { h.Helper() }\n\treturn {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}})\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertion_forward.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Condition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Conditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Contains(\"Hello World\", \"World\")\n//    a.Contains([\"Hello\", \"World\"], \"World\")\n//    a.Contains({\"Hello\": \"World\"}, \"Hello\")\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Contains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Containsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn DirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn ElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Empty(obj)\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Empty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Emptyf(obj, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Emptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//    a.Equal(123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equal(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualError(err,  expectedErrorString)\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValues(uint32(123), int32(123))\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValuesf(uint32(123, \"error message %s\", \"formatted\"), int32(123))\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn EqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    a.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Equalf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Error(err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Error(a.t, err, msgAndArgs...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Errorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Errorf(a.t, err, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    a.Exactly(int32(123), int64(123))\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    a.Exactlyf(int32(123, \"error message %s\", \"formatted\"), int64(123))\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Exactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Fail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Failf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//    a.False(myBool)\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn False(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    a.Falsef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Falsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn FileExistsf(a.t, path, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  a.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  a.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn HTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    a.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    a.Implementsf((*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Implementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t a.InDelta(math.Pi, (22 / 7.0), 0.01)\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t a.InDeltaf(math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn InEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn IsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  a.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  a.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn JSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    a.Len(mySlice, 3)\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Len(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    a.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Lenf(a.t, object, length, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    a.Nil(err)\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    a.Nilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Nilf(a.t, object, msg, args...)\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoError(err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoErrorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NoErrorf(a.t, err, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContains(\"Hello World\", \"Earth\")\n//    a.NotContains([\"Hello\", \"World\"], \"Earth\")\n//    a.NotContains({\"Hello\": \"World\"}, \"Earth\")\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmpty(obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmptyf(obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    a.NotEqual(obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    a.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    a.NotNil(err)\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    a.NotNilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanics(func(){ RemainCalm() })\nfunc (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//  a.NotRegexp(\"^start\", \"it's not starting\")\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexpf(regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubset([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubsetf([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn NotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panics(func(){ GoCrazy() })\nfunc (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn PanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Panicsf(a.t, f, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  a.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//  a.Regexp(\"start...$\", \"it's not starting\")\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  a.Regexpf(regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Regexpf(a.t, rx, str, msg, args...)\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subset([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subsetf([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Subsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//    a.True(myBool)\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn True(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    a.Truef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Truef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDuration(time.Now(), time.Now(), 10*time.Second)\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn WithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Zerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertion_forward.go.tmpl",
    "content": "{{.CommentWithoutT \"a\"}}\nfunc (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool {\n\tif h, ok := a.t.(tHelper); ok { h.Helper() }\n\treturn {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertions.go",
    "content": "package assert\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"github.com/pmezard/go-difflib/difflib\"\n)\n\n//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_format.go.tmpl\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n}\n\n// ComparisonAssertionFunc is a common function prototype when comparing two values.  Can be useful\n// for table driven tests.\ntype ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool\n\n// ValueAssertionFunc is a common function prototype when validating a single value.  Can be useful\n// for table driven tests.\ntype ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool\n\n// BoolAssertionFunc is a common function prototype when validating a bool value.  Can be useful\n// for table driven tests.\ntype BoolAssertionFunc func(TestingT, bool, ...interface{}) bool\n\n// ValuesAssertionFunc is a common function prototype when validating an error value.  Can be useful\n// for table driven tests.\ntype ErrorAssertionFunc func(TestingT, error, ...interface{}) bool\n\n// Comparison a custom function that returns true on success and false on failure\ntype Comparison func() (success bool)\n\n/*\n\tHelper functions\n*/\n\n// ObjectsAreEqual determines if two objects are considered equal.\n//\n// This function does no assertion of any kind.\nfunc ObjectsAreEqual(expected, actual interface{}) bool {\n\n\tif expected == nil || actual == nil {\n\t\treturn expected == actual\n\t}\n\tif exp, ok := expected.([]byte); ok {\n\t\tact, ok := actual.([]byte)\n\t\tif !ok {\n\t\t\treturn false\n\t\t} else if exp == nil || act == nil {\n\t\t\treturn exp == nil && act == nil\n\t\t}\n\t\treturn bytes.Equal(exp, act)\n\t}\n\treturn reflect.DeepEqual(expected, actual)\n\n}\n\n// ObjectsAreEqualValues gets whether two objects are equal, or if their\n// values are equal.\nfunc ObjectsAreEqualValues(expected, actual interface{}) bool {\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn true\n\t}\n\n\tactualType := reflect.TypeOf(actual)\n\tif actualType == nil {\n\t\treturn false\n\t}\n\texpectedValue := reflect.ValueOf(expected)\n\tif expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) {\n\t\t// Attempt comparison after type conversion\n\t\treturn reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual)\n\t}\n\n\treturn false\n}\n\n/* CallerInfo is necessary because the assert functions use the testing object\ninternally, causing it to print the file:line of the assert method, rather than where\nthe problem actually occurred in calling code.*/\n\n// CallerInfo returns an array of strings containing the file and line number\n// of each stack frame leading from the current test to the assert call that\n// failed.\nfunc CallerInfo() []string {\n\n\tpc := uintptr(0)\n\tfile := \"\"\n\tline := 0\n\tok := false\n\tname := \"\"\n\n\tcallers := []string{}\n\tfor i := 0; ; i++ {\n\t\tpc, file, line, ok = runtime.Caller(i)\n\t\tif !ok {\n\t\t\t// The breaks below failed to terminate the loop, and we ran off the\n\t\t\t// end of the call stack.\n\t\t\tbreak\n\t\t}\n\n\t\t// This is a huge edge case, but it will panic if this is the case, see #180\n\t\tif file == \"<autogenerated>\" {\n\t\t\tbreak\n\t\t}\n\n\t\tf := runtime.FuncForPC(pc)\n\t\tif f == nil {\n\t\t\tbreak\n\t\t}\n\t\tname = f.Name()\n\n\t\t// testing.tRunner is the standard library function that calls\n\t\t// tests. Subtests are called directly by tRunner, without going through\n\t\t// the Test/Benchmark/Example function that contains the t.Run calls, so\n\t\t// with subtests we should break when we hit tRunner, without adding it\n\t\t// to the list of callers.\n\t\tif name == \"testing.tRunner\" {\n\t\t\tbreak\n\t\t}\n\n\t\tparts := strings.Split(file, \"/\")\n\t\tfile = parts[len(parts)-1]\n\t\tif len(parts) > 1 {\n\t\t\tdir := parts[len(parts)-2]\n\t\t\tif (dir != \"assert\" && dir != \"mock\" && dir != \"require\") || file == \"mock_test.go\" {\n\t\t\t\tcallers = append(callers, fmt.Sprintf(\"%s:%d\", file, line))\n\t\t\t}\n\t\t}\n\n\t\t// Drop the package\n\t\tsegments := strings.Split(name, \".\")\n\t\tname = segments[len(segments)-1]\n\t\tif isTest(name, \"Test\") ||\n\t\t\tisTest(name, \"Benchmark\") ||\n\t\t\tisTest(name, \"Example\") {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn callers\n}\n\n// Stolen from the `go test` tool.\n// isTest tells whether name looks like a test (or benchmark, according to prefix).\n// It is a Test (say) if there is a character after Test that is not a lower-case letter.\n// We don't want TesticularCancer.\nfunc isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\trune, _ := utf8.DecodeRuneInString(name[len(prefix):])\n\treturn !unicode.IsLower(rune)\n}\n\nfunc messageFromMsgAndArgs(msgAndArgs ...interface{}) string {\n\tif len(msgAndArgs) == 0 || msgAndArgs == nil {\n\t\treturn \"\"\n\t}\n\tif len(msgAndArgs) == 1 {\n\t\treturn msgAndArgs[0].(string)\n\t}\n\tif len(msgAndArgs) > 1 {\n\t\treturn fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)\n\t}\n\treturn \"\"\n}\n\n// Aligns the provided message so that all lines after the first line start at the same location as the first line.\n// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab).\n// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the\n// basis on which the alignment occurs).\nfunc indentMessageLines(message string, longestLabelLen int) string {\n\toutBuf := new(bytes.Buffer)\n\n\tfor i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ {\n\t\t// no need to align first line because it starts at the correct location (after the label)\n\t\tif i != 0 {\n\t\t\t// append alignLen+1 spaces to align with \"{{longestLabel}}:\" before adding tab\n\t\t\toutBuf.WriteString(\"\\n\\t\" + strings.Repeat(\" \", longestLabelLen+1) + \"\\t\")\n\t\t}\n\t\toutBuf.WriteString(scanner.Text())\n\t}\n\n\treturn outBuf.String()\n}\n\ntype failNower interface {\n\tFailNow()\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFail(t, failureMessage, msgAndArgs...)\n\n\t// We cannot extend TestingT with FailNow() and\n\t// maintain backwards compatibility, so we fallback\n\t// to panicking when FailNow is not available in\n\t// TestingT.\n\t// See issue #263\n\n\tif t, ok := t.(failNower); ok {\n\t\tt.FailNow()\n\t} else {\n\t\tpanic(\"test failed and t is missing `FailNow()`\")\n\t}\n\treturn false\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcontent := []labeledContent{\n\t\t{\"Error Trace\", strings.Join(CallerInfo(), \"\\n\\t\\t\\t\")},\n\t\t{\"Error\", failureMessage},\n\t}\n\n\t// Add test name if the Go version supports it\n\tif n, ok := t.(interface {\n\t\tName() string\n\t}); ok {\n\t\tcontent = append(content, labeledContent{\"Test\", n.Name()})\n\t}\n\n\tmessage := messageFromMsgAndArgs(msgAndArgs...)\n\tif len(message) > 0 {\n\t\tcontent = append(content, labeledContent{\"Messages\", message})\n\t}\n\n\tt.Errorf(\"\\n%s\", \"\"+labeledOutput(content...))\n\n\treturn false\n}\n\ntype labeledContent struct {\n\tlabel   string\n\tcontent string\n}\n\n// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:\n//\n//   \\t{{label}}:{{align_spaces}}\\t{{content}}\\n\n//\n// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The \"\\t{{label}}:\" is for the label.\n// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this\n// alignment is achieved, \"\\t{{content}}\\n\" is added for the output.\n//\n// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.\nfunc labeledOutput(content ...labeledContent) string {\n\tlongestLabel := 0\n\tfor _, v := range content {\n\t\tif len(v.label) > longestLabel {\n\t\t\tlongestLabel = len(v.label)\n\t\t}\n\t}\n\tvar output string\n\tfor _, v := range content {\n\t\toutput += \"\\t\" + v.label + \":\" + strings.Repeat(\" \", longestLabel-len(v.label)) + \"\\t\" + indentMessageLines(v.content, longestLabel) + \"\\n\"\n\t}\n\treturn output\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    assert.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinterfaceType := reflect.TypeOf(interfaceObject).Elem()\n\n\tif object == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Cannot check if nil implements %v\", interfaceType), msgAndArgs...)\n\t}\n\tif !reflect.TypeOf(object).Implements(interfaceType) {\n\t\treturn Fail(t, fmt.Sprintf(\"%T must implement %v\", object, interfaceType), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {\n\t\treturn Fail(t, fmt.Sprintf(\"Object expected to be of type %v, but was %v\", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Equal asserts that two objects are equal.\n//\n//    assert.Equal(t, 123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v == %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif !ObjectsAreEqual(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// formatUnequalValues takes two values of arbitrary types and returns string\n// representations appropriate to be presented to the user.\n//\n// If the values are not of like type, the returned strings will be prefixed\n// with the type name, and the value will be enclosed in parenthesis similar\n// to a type conversion in the Go grammar.\nfunc formatUnequalValues(expected, actual interface{}) (e string, a string) {\n\tif reflect.TypeOf(expected) != reflect.TypeOf(actual) {\n\t\treturn fmt.Sprintf(\"%T(%#v)\", expected, expected),\n\t\t\tfmt.Sprintf(\"%T(%#v)\", actual, actual)\n\t}\n\n\treturn fmt.Sprintf(\"%#v\", expected),\n\t\tfmt.Sprintf(\"%#v\", actual)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValues(t, uint32(123), int32(123))\nfunc EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif !ObjectsAreEqualValues(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    assert.Exactly(t, int32(123), int64(123))\nfunc Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\taType := reflect.TypeOf(expected)\n\tbType := reflect.TypeOf(actual)\n\n\tif aType != bType {\n\t\treturn Fail(t, fmt.Sprintf(\"Types expected to match exactly\\n\\t%v != %v\", aType, bType), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expected, actual, msgAndArgs...)\n\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    assert.NotNil(t, err)\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !isNil(object) {\n\t\treturn true\n\t}\n\treturn Fail(t, \"Expected value not to be nil.\", msgAndArgs...)\n}\n\n// isNil checks if a specified object is nil or not, without Failing.\nfunc isNil(object interface{}) bool {\n\tif object == nil {\n\t\treturn true\n\t}\n\n\tvalue := reflect.ValueOf(object)\n\tkind := value.Kind()\n\tif kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    assert.Nil(t, err)\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif isNil(object) {\n\t\treturn true\n\t}\n\treturn Fail(t, fmt.Sprintf(\"Expected nil, but got: %#v\", object), msgAndArgs...)\n}\n\n// isEmpty gets whether the specified object is considered empty or not.\nfunc isEmpty(object interface{}) bool {\n\n\t// get nil case out of the way\n\tif object == nil {\n\t\treturn true\n\t}\n\n\tobjValue := reflect.ValueOf(object)\n\n\tswitch objValue.Kind() {\n\t// collection types are empty when they have no element\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\treturn objValue.Len() == 0\n\t// pointers are empty if nil or if the value they point to is empty\n\tcase reflect.Ptr:\n\t\tif objValue.IsNil() {\n\t\t\treturn true\n\t\t}\n\t\tderef := objValue.Elem().Interface()\n\t\treturn isEmpty(deref)\n\t// for all other types, compare against the zero value\n\tdefault:\n\t\tzero := reflect.Zero(objValue.Type())\n\t\treturn reflect.DeepEqual(object, zero.Interface())\n\t}\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Empty(t, obj)\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tpass := isEmpty(object)\n\tif !pass {\n\t\tFail(t, fmt.Sprintf(\"Should be empty, but was %v\", object), msgAndArgs...)\n\t}\n\n\treturn pass\n\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmpty(t, obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tpass := !isEmpty(object)\n\tif !pass {\n\t\tFail(t, fmt.Sprintf(\"Should NOT be empty, but was %v\", object), msgAndArgs...)\n\t}\n\n\treturn pass\n\n}\n\n// getLen try to get length of object.\n// return (false, 0) if impossible.\nfunc getLen(x interface{}) (ok bool, length int) {\n\tv := reflect.ValueOf(x)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\treturn true, v.Len()\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    assert.Len(t, mySlice, 3)\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tok, l := getLen(object)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", object), msgAndArgs...)\n\t}\n\n\tif l != length {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" should have %d item(s), but has %d\", object, length, l), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// True asserts that the specified value is true.\n//\n//    assert.True(t, myBool)\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif h, ok := t.(interface {\n\t\tHelper()\n\t}); ok {\n\t\th.Helper()\n\t}\n\n\tif value != true {\n\t\treturn Fail(t, \"Should be true\", msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// False asserts that the specified value is false.\n//\n//    assert.False(t, myBool)\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif value != false {\n\t\treturn Fail(t, \"Should be false\", msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    assert.NotEqual(t, obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v != %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be: %#v\\n\", actual), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// containsElement try loop over the list check if the list includes the element.\n// return (false, false) if impossible.\n// return (true, false) if element was not found.\n// return (true, true) if element was found.\nfunc includeElement(list interface{}, element interface{}) (ok, found bool) {\n\n\tlistValue := reflect.ValueOf(list)\n\telementValue := reflect.ValueOf(element)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t\tfound = false\n\t\t}\n\t}()\n\n\tif reflect.TypeOf(list).Kind() == reflect.String {\n\t\treturn true, strings.Contains(listValue.String(), elementValue.String())\n\t}\n\n\tif reflect.TypeOf(list).Kind() == reflect.Map {\n\t\tmapKeys := listValue.MapKeys()\n\t\tfor i := 0; i < len(mapKeys); i++ {\n\t\t\tif ObjectsAreEqual(mapKeys[i].Interface(), element) {\n\t\t\t\treturn true, true\n\t\t\t}\n\t\t}\n\t\treturn true, false\n\t}\n\n\tfor i := 0; i < listValue.Len(); i++ {\n\t\tif ObjectsAreEqual(listValue.Index(i).Interface(), element) {\n\t\t\treturn true, true\n\t\t}\n\t}\n\treturn true, false\n\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Contains(t, \"Hello World\", \"World\")\n//    assert.Contains(t, [\"Hello\", \"World\"], \"World\")\n//    assert.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\nfunc Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tok, found := includeElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", s), msgAndArgs...)\n\t}\n\tif !found {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" does not contain \\\"%s\\\"\", s, contains), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContains(t, \"Hello World\", \"Earth\")\n//    assert.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//    assert.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\nfunc NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tok, found := includeElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", s), msgAndArgs...)\n\t}\n\tif found {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" should not contain \\\"%s\\\"\", s, contains), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subset(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\nfunc Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif subset == nil {\n\t\treturn true // we consider nil to be equal to the nil set\n\t}\n\n\tsubsetValue := reflect.ValueOf(subset)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\n\tif listKind != reflect.Array && listKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tfor i := 0; i < subsetValue.Len(); i++ {\n\t\telement := subsetValue.Index(i).Interface()\n\t\tok, found := includeElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" does not contain \\\"%s\\\"\", list, element), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubset(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\nfunc NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif subset == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"nil is the empty set which is a subset of every set\"), msgAndArgs...)\n\t}\n\n\tsubsetValue := reflect.ValueOf(subset)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\n\tif listKind != reflect.Array && listKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tfor i := 0; i < subsetValue.Len(); i++ {\n\t\telement := subsetValue.Index(i).Interface()\n\t\tok, found := includeElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn Fail(t, fmt.Sprintf(\"%q is a subset of %q\", subset, list), msgAndArgs...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])\nfunc ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif isEmpty(listA) && isEmpty(listB) {\n\t\treturn true\n\t}\n\n\taKind := reflect.TypeOf(listA).Kind()\n\tbKind := reflect.TypeOf(listB).Kind()\n\n\tif aKind != reflect.Array && aKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", listA, aKind), msgAndArgs...)\n\t}\n\n\tif bKind != reflect.Array && bKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", listB, bKind), msgAndArgs...)\n\t}\n\n\taValue := reflect.ValueOf(listA)\n\tbValue := reflect.ValueOf(listB)\n\n\taLen := aValue.Len()\n\tbLen := bValue.Len()\n\n\tif aLen != bLen {\n\t\treturn Fail(t, fmt.Sprintf(\"lengths don't match: %d != %d\", aLen, bLen), msgAndArgs...)\n\t}\n\n\t// Mark indexes in bValue that we already used\n\tvisited := make([]bool, bLen)\n\tfor i := 0; i < aLen; i++ {\n\t\telement := aValue.Index(i).Interface()\n\t\tfound := false\n\t\tfor j := 0; j < bLen; j++ {\n\t\t\tif visited[j] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ObjectsAreEqual(bValue.Index(j).Interface(), element) {\n\t\t\t\tvisited[j] = true\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn Fail(t, fmt.Sprintf(\"element %s appears more times in %s than in %s\", element, aValue, bValue), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tresult := comp()\n\tif !result {\n\t\tFail(t, \"Condition failed!\", msgAndArgs...)\n\t}\n\treturn result\n}\n\n// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics\n// methods, and represents a simple func that takes no arguments, and returns nothing.\ntype PanicTestFunc func()\n\n// didPanic returns true if the function passed to it panics. Otherwise, it returns false.\nfunc didPanic(f PanicTestFunc) (bool, interface{}) {\n\n\tdidPanic := false\n\tvar message interface{}\n\tfunc() {\n\n\t\tdefer func() {\n\t\t\tif message = recover(); message != nil {\n\t\t\t\tdidPanic = true\n\t\t\t}\n\t\t}()\n\n\t\t// call the target function\n\t\tf()\n\n\t}()\n\n\treturn didPanic, message\n\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panics(t, func(){ GoCrazy() })\nfunc Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif funcDidPanic, panicValue := didPanic(f); !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tfuncDidPanic, panicValue := didPanic(f)\n\tif !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\tif panicValue != expected {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic with value:\\t%v\\n\\tPanic value:\\t%v\", f, expected, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanics(t, func(){ RemainCalm() })\nfunc NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif funcDidPanic, panicValue := didPanic(f); funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should not panic\\n\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\nfunc WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tdt := expected.Sub(actual)\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\nfunc toFloat(x interface{}) (float64, bool) {\n\tvar xf float64\n\txok := true\n\n\tswitch xn := x.(type) {\n\tcase uint8:\n\t\txf = float64(xn)\n\tcase uint16:\n\t\txf = float64(xn)\n\tcase uint32:\n\t\txf = float64(xn)\n\tcase uint64:\n\t\txf = float64(xn)\n\tcase int:\n\t\txf = float64(xn)\n\tcase int8:\n\t\txf = float64(xn)\n\tcase int16:\n\t\txf = float64(xn)\n\tcase int32:\n\t\txf = float64(xn)\n\tcase int64:\n\t\txf = float64(xn)\n\tcase float32:\n\t\txf = float64(xn)\n\tcase float64:\n\t\txf = float64(xn)\n\tcase time.Duration:\n\t\txf = float64(xn)\n\tdefault:\n\t\txok = false\n\t}\n\n\treturn xf, xok\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)\nfunc InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\taf, aok := toFloat(expected)\n\tbf, bok := toFloat(actual)\n\n\tif !aok || !bok {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be numerical\"), msgAndArgs...)\n\t}\n\n\tif math.IsNaN(af) {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected must not be NaN\"), msgAndArgs...)\n\t}\n\n\tif math.IsNaN(bf) {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected %v with delta %v, but was NaN\", expected, delta), msgAndArgs...)\n\t}\n\n\tdt := af - bf\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Slice ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be slice\"), msgAndArgs...)\n\t}\n\n\tactualSlice := reflect.ValueOf(actual)\n\texpectedSlice := reflect.ValueOf(expected)\n\n\tfor i := 0; i < actualSlice.Len(); i++ {\n\t\tresult := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)\n\t\tif !result {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn true\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Map ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Map {\n\t\treturn Fail(t, \"Arguments must be maps\", msgAndArgs...)\n\t}\n\n\texpectedMap := reflect.ValueOf(expected)\n\tactualMap := reflect.ValueOf(actual)\n\n\tif expectedMap.Len() != actualMap.Len() {\n\t\treturn Fail(t, \"Arguments must have the same number of keys\", msgAndArgs...)\n\t}\n\n\tfor _, k := range expectedMap.MapKeys() {\n\t\tev := expectedMap.MapIndex(k)\n\t\tav := actualMap.MapIndex(k)\n\n\t\tif !ev.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in expected map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !av.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in actual map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !InDelta(\n\t\t\tt,\n\t\t\tev.Interface(),\n\t\t\tav.Interface(),\n\t\t\tdelta,\n\t\t\tmsgAndArgs...,\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nfunc calcRelativeError(expected, actual interface{}) (float64, error) {\n\taf, aok := toFloat(expected)\n\tif !aok {\n\t\treturn 0, fmt.Errorf(\"expected value %q cannot be converted to float\", expected)\n\t}\n\tif af == 0 {\n\t\treturn 0, fmt.Errorf(\"expected value must have a value other than zero to calculate the relative error\")\n\t}\n\tbf, bok := toFloat(actual)\n\tif !bok {\n\t\treturn 0, fmt.Errorf(\"actual value %q cannot be converted to float\", actual)\n\t}\n\n\treturn math.Abs(af-bf) / math.Abs(af), nil\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tactualEpsilon, err := calcRelativeError(expected, actual)\n\tif err != nil {\n\t\treturn Fail(t, err.Error(), msgAndArgs...)\n\t}\n\tif actualEpsilon > epsilon {\n\t\treturn Fail(t, fmt.Sprintf(\"Relative error is too high: %#v (expected)\\n\"+\n\t\t\t\"        < %#v (actual)\", epsilon, actualEpsilon), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Slice ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be slice\"), msgAndArgs...)\n\t}\n\n\tactualSlice := reflect.ValueOf(actual)\n\texpectedSlice := reflect.ValueOf(expected)\n\n\tfor i := 0; i < actualSlice.Len(); i++ {\n\t\tresult := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon)\n\t\tif !result {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn true\n}\n\n/*\n\tErrors\n*/\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoError(t, err) {\n//\t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Received unexpected error:\\n%+v\", err), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Error(t, err) {\n//\t   assert.Equal(t, expectedError, err)\n//   }\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tif err == nil {\n\t\treturn Fail(t, \"An error is expected but got nil.\", msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualError(t, err,  expectedErrorString)\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !Error(t, theError, msgAndArgs...) {\n\t\treturn false\n\t}\n\texpected := errString\n\tactual := theError.Error()\n\t// don't need to use deep equals here, we know they are both strings\n\tif expected != actual {\n\t\treturn Fail(t, fmt.Sprintf(\"Error message not equal:\\n\"+\n\t\t\t\"expected: %q\\n\"+\n\t\t\t\"actual  : %q\", expected, actual), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// matchRegexp return true if a specified regexp matches a string.\nfunc matchRegexp(rx interface{}, str interface{}) bool {\n\n\tvar r *regexp.Regexp\n\tif rr, ok := rx.(*regexp.Regexp); ok {\n\t\tr = rr\n\t} else {\n\t\tr = regexp.MustCompile(fmt.Sprint(rx))\n\t}\n\n\treturn (r.FindStringIndex(fmt.Sprint(str)) != nil)\n\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  assert.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//  assert.Regexp(t, \"start...$\", \"it's not starting\")\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\tmatch := matchRegexp(rx, str)\n\n\tif !match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn match\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//  assert.NotRegexp(t, \"^start\", \"it's not starting\")\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tmatch := matchRegexp(rx, str)\n\n\tif match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to NOT match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn !match\n\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should be zero, but was %v\", i), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be zero, but was %v\", i), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a directory\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif !info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a file\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tvar expectedJSONAsInterface, actualJSONAsInterface interface{}\n\n\tif err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected value ('%s') is not valid json.\\nJSON parsing error: '%s'\", expected, err.Error()), msgAndArgs...)\n\t}\n\n\tif err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Input ('%s') needs to be valid json.\\nJSON parsing error: '%s'\", actual, err.Error()), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)\n}\n\nfunc typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {\n\tt := reflect.TypeOf(v)\n\tk := t.Kind()\n\n\tif k == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tk = t.Kind()\n\t}\n\treturn t, k\n}\n\n// diff returns a diff of both values as long as both are of the same type and\n// are a struct, map, slice or array. Otherwise it returns an empty string.\nfunc diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array {\n\t\treturn \"\"\n\t}\n\n\te := spewConfig.Sdump(expected)\n\ta := spewConfig.Sdump(actual)\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA:        difflib.SplitLines(e),\n\t\tB:        difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile:   \"Actual\",\n\t\tToDate:   \"\",\n\t\tContext:  1,\n\t})\n\n\treturn \"\\n\\nDiff:\\n\" + diff\n}\n\n// validateEqualArgs checks whether provided arguments can be safely used in the\n// Equal/NotEqual functions.\nfunc validateEqualArgs(expected, actual interface{}) error {\n\tif isFunction(expected) || isFunction(actual) {\n\t\treturn errors.New(\"cannot take func type as argument\")\n\t}\n\treturn nil\n}\n\nfunc isFunction(arg interface{}) bool {\n\tif arg == nil {\n\t\treturn false\n\t}\n\treturn reflect.TypeOf(arg).Kind() == reflect.Func\n}\n\nvar spewConfig = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n}\n\ntype tHelper interface {\n\tHelper()\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n)\n\nvar (\n\ti     interface{}\n\tzeros = []interface{}{\n\t\tfalse,\n\t\tbyte(0),\n\t\tcomplex64(0),\n\t\tcomplex128(0),\n\t\tfloat32(0),\n\t\tfloat64(0),\n\t\tint(0),\n\t\tint8(0),\n\t\tint16(0),\n\t\tint32(0),\n\t\tint64(0),\n\t\trune(0),\n\t\tuint(0),\n\t\tuint8(0),\n\t\tuint16(0),\n\t\tuint32(0),\n\t\tuint64(0),\n\t\tuintptr(0),\n\t\t\"\",\n\t\t[0]interface{}{},\n\t\t[]interface{}(nil),\n\t\tstruct{ x int }{},\n\t\t(*interface{})(nil),\n\t\t(func())(nil),\n\t\tnil,\n\t\tinterface{}(nil),\n\t\tmap[interface{}]interface{}(nil),\n\t\t(chan interface{})(nil),\n\t\t(<-chan interface{})(nil),\n\t\t(chan<- interface{})(nil),\n\t}\n\tnonZeros = []interface{}{\n\t\ttrue,\n\t\tbyte(1),\n\t\tcomplex64(1),\n\t\tcomplex128(1),\n\t\tfloat32(1),\n\t\tfloat64(1),\n\t\tint(1),\n\t\tint8(1),\n\t\tint16(1),\n\t\tint32(1),\n\t\tint64(1),\n\t\trune(1),\n\t\tuint(1),\n\t\tuint8(1),\n\t\tuint16(1),\n\t\tuint32(1),\n\t\tuint64(1),\n\t\tuintptr(1),\n\t\t\"s\",\n\t\t[1]interface{}{1},\n\t\t[]interface{}{},\n\t\tstruct{ x int }{1},\n\t\t(*interface{})(&i),\n\t\t(func())(func() {}),\n\t\tinterface{}(1),\n\t\tmap[interface{}]interface{}{},\n\t\t(chan interface{})(make(chan interface{})),\n\t\t(<-chan interface{})(make(chan interface{})),\n\t\t(chan<- interface{})(make(chan interface{})),\n\t}\n)\n\n// AssertionTesterInterface defines an interface to be used for testing assertion methods\ntype AssertionTesterInterface interface {\n\tTestMethod()\n}\n\n// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface\ntype AssertionTesterConformingObject struct {\n}\n\nfunc (a *AssertionTesterConformingObject) TestMethod() {\n}\n\n// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface\ntype AssertionTesterNonConformingObject struct {\n}\n\nfunc TestObjectsAreEqual(t *testing.T) {\n\n\tif !ObjectsAreEqual(\"Hello World\", \"Hello World\") {\n\t\tt.Error(\"objectsAreEqual should return true\")\n\t}\n\tif !ObjectsAreEqual(123, 123) {\n\t\tt.Error(\"objectsAreEqual should return true\")\n\t}\n\tif !ObjectsAreEqual(123.5, 123.5) {\n\t\tt.Error(\"objectsAreEqual should return true\")\n\t}\n\tif !ObjectsAreEqual([]byte(\"Hello World\"), []byte(\"Hello World\")) {\n\t\tt.Error(\"objectsAreEqual should return true\")\n\t}\n\tif !ObjectsAreEqual(nil, nil) {\n\t\tt.Error(\"objectsAreEqual should return true\")\n\t}\n\tif ObjectsAreEqual(map[int]int{5: 10}, map[int]int{10: 20}) {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif ObjectsAreEqual('x', \"x\") {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif ObjectsAreEqual(\"x\", 'x') {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif ObjectsAreEqual(0, 0.1) {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif ObjectsAreEqual(0.1, 0) {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif ObjectsAreEqual(uint32(10), int32(10)) {\n\t\tt.Error(\"objectsAreEqual should return false\")\n\t}\n\tif !ObjectsAreEqualValues(uint32(10), int32(10)) {\n\t\tt.Error(\"ObjectsAreEqualValues should return true\")\n\t}\n\tif ObjectsAreEqualValues(0, nil) {\n\t\tt.Fail()\n\t}\n\tif ObjectsAreEqualValues(nil, 0) {\n\t\tt.Fail()\n\t}\n\n}\n\nfunc TestImplements(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface\")\n\t}\n\tif Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface\")\n\t}\n\tif Implements(mockT, (*AssertionTesterInterface)(nil), nil) {\n\t\tt.Error(\"Implements method should return false: nil does not implement AssertionTesterInterface\")\n\t}\n\n}\n\nfunc TestIsType(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject\")\n\t}\n\tif IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject\")\n\t}\n\n}\n\nfunc TestEqual(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !Equal(mockT, \"Hello World\", \"Hello World\") {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, 123, 123) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, 123.5, 123.5) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, []byte(\"Hello World\"), []byte(\"Hello World\")) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, nil, nil) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, int32(123), int32(123)) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, uint64(123), uint64(123)) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !Equal(mockT, &struct{}{}, &struct{}{}) {\n\t\tt.Error(\"Equal should return true (pointer equality is based on equality of underlying value)\")\n\t}\n\tvar m map[string]interface{}\n\tif Equal(mockT, m[\"bar\"], \"something\") {\n\t\tt.Error(\"Equal should return false\")\n\t}\n}\n\n// bufferT implements TestingT. Its implementation of Errorf writes the output that would be produced by\n// testing.T.Errorf to an internal bytes.Buffer.\ntype bufferT struct {\n\tbuf bytes.Buffer\n}\n\nfunc (t *bufferT) Errorf(format string, args ...interface{}) {\n\t// implementation of decorate is copied from testing.T\n\tdecorate := func(s string) string {\n\t\t_, file, line, ok := runtime.Caller(3) // decorate + glog + public function.\n\t\tif ok {\n\t\t\t// Truncate file name at last file name separator.\n\t\t\tif index := strings.LastIndex(file, \"/\"); index >= 0 {\n\t\t\t\tfile = file[index+1:]\n\t\t\t} else if index = strings.LastIndex(file, \"\\\\\"); index >= 0 {\n\t\t\t\tfile = file[index+1:]\n\t\t\t}\n\t\t} else {\n\t\t\tfile = \"???\"\n\t\t\tline = 1\n\t\t}\n\t\tbuf := new(bytes.Buffer)\n\t\t// Every line is indented at least one tab.\n\t\tbuf.WriteByte('\\t')\n\t\tfmt.Fprintf(buf, \"%s:%d: \", file, line)\n\t\tlines := strings.Split(s, \"\\n\")\n\t\tif l := len(lines); l > 1 && lines[l-1] == \"\" {\n\t\t\tlines = lines[:l-1]\n\t\t}\n\t\tfor i, line := range lines {\n\t\t\tif i > 0 {\n\t\t\t\t// Second and subsequent lines are indented an extra tab.\n\t\t\t\tbuf.WriteString(\"\\n\\t\\t\")\n\t\t\t}\n\t\t\tbuf.WriteString(line)\n\t\t}\n\t\tbuf.WriteByte('\\n')\n\t\treturn buf.String()\n\t}\n\tt.buf.WriteString(decorate(fmt.Sprintf(format, args...)))\n}\n\nfunc TestEqualFormatting(t *testing.T) {\n\tfor i, currCase := range []struct {\n\t\tequalWant  string\n\t\tequalGot   string\n\t\tmsgAndArgs []interface{}\n\t\twant       string\n\t}{\n\t\t{equalWant: \"want\", equalGot: \"got\", want: \"\\tassertions.go:[0-9]+: \\n\\t\\t\\tError Trace:\\t\\n\\t\\t\\tError:      \\tNot equal: \\n\\t\\t\\t            \\texpected: \\\"want\\\"\\n\\t\\t\\t            \\tactual  : \\\"got\\\"\\n\"},\n\t\t{equalWant: \"want\", equalGot: \"got\", msgAndArgs: []interface{}{\"hello, %v!\", \"world\"}, want: \"\\tassertions.go:[0-9]+: \\n\\t\\t\\tError Trace:\\t\\n\\t\\t\\tError:      \\tNot equal: \\n\\t\\t\\t            \\texpected: \\\"want\\\"\\n\\t\\t\\t            \\tactual  : \\\"got\\\"\\n\\t\\t\\tMessages:   \\thello, world!\\n\"},\n\t} {\n\t\tmockT := &bufferT{}\n\t\tEqual(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)\n\t\tRegexp(t, regexp.MustCompile(currCase.want), mockT.buf.String(), \"Case %d\", i)\n\t}\n}\n\nfunc TestFormatUnequalValues(t *testing.T) {\n\texpected, actual := formatUnequalValues(\"foo\", \"bar\")\n\tEqual(t, `\"foo\"`, expected, \"value should not include type\")\n\tEqual(t, `\"bar\"`, actual, \"value should not include type\")\n\n\texpected, actual = formatUnequalValues(123, 123)\n\tEqual(t, `123`, expected, \"value should not include type\")\n\tEqual(t, `123`, actual, \"value should not include type\")\n\n\texpected, actual = formatUnequalValues(int64(123), int32(123))\n\tEqual(t, `int64(123)`, expected, \"value should include type\")\n\tEqual(t, `int32(123)`, actual, \"value should include type\")\n\n\texpected, actual = formatUnequalValues(int64(123), nil)\n\tEqual(t, `int64(123)`, expected, \"value should include type\")\n\tEqual(t, `<nil>(<nil>)`, actual, \"value should include type\")\n\n\ttype testStructType struct {\n\t\tVal string\n\t}\n\n\texpected, actual = formatUnequalValues(&testStructType{Val: \"test\"}, &testStructType{Val: \"test\"})\n\tEqual(t, `&assert.testStructType{Val:\"test\"}`, expected, \"value should not include type annotation\")\n\tEqual(t, `&assert.testStructType{Val:\"test\"}`, actual, \"value should not include type annotation\")\n}\n\nfunc TestNotNil(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !NotNil(mockT, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotNil should return true: object is not nil\")\n\t}\n\tif NotNil(mockT, nil) {\n\t\tt.Error(\"NotNil should return false: object is nil\")\n\t}\n\tif NotNil(mockT, (*struct{})(nil)) {\n\t\tt.Error(\"NotNil should return false: object is (*struct{})(nil)\")\n\t}\n\n}\n\nfunc TestNil(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !Nil(mockT, nil) {\n\t\tt.Error(\"Nil should return true: object is nil\")\n\t}\n\tif !Nil(mockT, (*struct{})(nil)) {\n\t\tt.Error(\"Nil should return true: object is (*struct{})(nil)\")\n\t}\n\tif Nil(mockT, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Nil should return false: object is not nil\")\n\t}\n\n}\n\nfunc TestTrue(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !True(mockT, true) {\n\t\tt.Error(\"True should return true\")\n\t}\n\tif True(mockT, false) {\n\t\tt.Error(\"True should return false\")\n\t}\n\n}\n\nfunc TestFalse(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !False(mockT, false) {\n\t\tt.Error(\"False should return true\")\n\t}\n\tif False(mockT, true) {\n\t\tt.Error(\"False should return false\")\n\t}\n\n}\n\nfunc TestExactly(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\ta := float32(1)\n\tb := float64(1)\n\tc := float32(1)\n\td := float32(2)\n\n\tif Exactly(mockT, a, b) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif Exactly(mockT, a, d) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif !Exactly(mockT, a, c) {\n\t\tt.Error(\"Exactly should return true\")\n\t}\n\n\tif Exactly(mockT, nil, a) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif Exactly(mockT, a, nil) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\n}\n\nfunc TestNotEqual(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !NotEqual(mockT, \"Hello World\", \"Hello World!\") {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !NotEqual(mockT, 123, 1234) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !NotEqual(mockT, 123.5, 123.55) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !NotEqual(mockT, []byte(\"Hello World\"), []byte(\"Hello World!\")) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !NotEqual(mockT, nil, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tfuncA := func() int { return 23 }\n\tfuncB := func() int { return 42 }\n\tif NotEqual(mockT, funcA, funcB) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\n\tif NotEqual(mockT, \"Hello World\", \"Hello World\") {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\tif NotEqual(mockT, 123, 123) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\tif NotEqual(mockT, 123.5, 123.5) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\tif NotEqual(mockT, []byte(\"Hello World\"), []byte(\"Hello World\")) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\tif NotEqual(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n\tif NotEqual(mockT, &struct{}{}, &struct{}{}) {\n\t\tt.Error(\"NotEqual should return false\")\n\t}\n}\n\ntype A struct {\n\tName, Value string\n}\n\nfunc TestContains(t *testing.T) {\n\n\tmockT := new(testing.T)\n\tlist := []string{\"Foo\", \"Bar\"}\n\tcomplexList := []*A{\n\t\t{\"b\", \"c\"},\n\t\t{\"d\", \"e\"},\n\t\t{\"g\", \"h\"},\n\t\t{\"j\", \"k\"},\n\t}\n\tsimpleMap := map[interface{}]interface{}{\"Foo\": \"Bar\"}\n\n\tif !Contains(mockT, \"Hello World\", \"Hello\") {\n\t\tt.Error(\"Contains should return true: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\tif Contains(mockT, \"Hello World\", \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"Hello World\\\" does not contain \\\"Salut\\\"\")\n\t}\n\n\tif !Contains(mockT, list, \"Bar\") {\n\t\tt.Error(\"Contains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Bar\\\"\")\n\t}\n\tif Contains(mockT, list, \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Salut\\\"\")\n\t}\n\tif !Contains(mockT, complexList, &A{\"g\", \"h\"}) {\n\t\tt.Error(\"Contains should return true: complexList contains {\\\"g\\\", \\\"h\\\"}\")\n\t}\n\tif Contains(mockT, complexList, &A{\"g\", \"e\"}) {\n\t\tt.Error(\"Contains should return false: complexList contains {\\\"g\\\", \\\"e\\\"}\")\n\t}\n\tif Contains(mockT, complexList, &A{\"g\", \"e\"}) {\n\t\tt.Error(\"Contains should return false: complexList contains {\\\"g\\\", \\\"e\\\"}\")\n\t}\n\tif !Contains(mockT, simpleMap, \"Foo\") {\n\t\tt.Error(\"Contains should return true: \\\"{\\\"Foo\\\": \\\"Bar\\\"}\\\" contains \\\"Foo\\\"\")\n\t}\n\tif Contains(mockT, simpleMap, \"Bar\") {\n\t\tt.Error(\"Contains should return false: \\\"{\\\"Foo\\\": \\\"Bar\\\"}\\\" does not contains \\\"Bar\\\"\")\n\t}\n}\n\nfunc TestNotContains(t *testing.T) {\n\n\tmockT := new(testing.T)\n\tlist := []string{\"Foo\", \"Bar\"}\n\tsimpleMap := map[interface{}]interface{}{\"Foo\": \"Bar\"}\n\n\tif !NotContains(mockT, \"Hello World\", \"Hello!\") {\n\t\tt.Error(\"NotContains should return true: \\\"Hello World\\\" does not contain \\\"Hello!\\\"\")\n\t}\n\tif NotContains(mockT, \"Hello World\", \"Hello\") {\n\t\tt.Error(\"NotContains should return false: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\n\tif !NotContains(mockT, list, \"Foo!\") {\n\t\tt.Error(\"NotContains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Foo!\\\"\")\n\t}\n\tif NotContains(mockT, list, \"Foo\") {\n\t\tt.Error(\"NotContains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Foo\\\"\")\n\t}\n\tif NotContains(mockT, simpleMap, \"Foo\") {\n\t\tt.Error(\"Contains should return true: \\\"{\\\"Foo\\\": \\\"Bar\\\"}\\\" contains \\\"Foo\\\"\")\n\t}\n\tif !NotContains(mockT, simpleMap, \"Bar\") {\n\t\tt.Error(\"Contains should return false: \\\"{\\\"Foo\\\": \\\"Bar\\\"}\\\" does not contains \\\"Bar\\\"\")\n\t}\n}\n\nfunc TestSubset(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tif !Subset(mockT, []int{1, 2, 3}, nil) {\n\t\tt.Error(\"Subset should return true: given subset is nil\")\n\t}\n\tif !Subset(mockT, []int{1, 2, 3}, []int{}) {\n\t\tt.Error(\"Subset should return true: any set contains the nil set\")\n\t}\n\tif !Subset(mockT, []int{1, 2, 3}, []int{1, 2}) {\n\t\tt.Error(\"Subset should return true: [1, 2, 3] contains [1, 2]\")\n\t}\n\tif !Subset(mockT, []int{1, 2, 3}, []int{1, 2, 3}) {\n\t\tt.Error(\"Subset should return true: [1, 2, 3] contains [1, 2, 3]\")\n\t}\n\tif !Subset(mockT, []string{\"hello\", \"world\"}, []string{\"hello\"}) {\n\t\tt.Error(\"Subset should return true: [\\\"hello\\\", \\\"world\\\"] contains [\\\"hello\\\"]\")\n\t}\n\n\tif Subset(mockT, []string{\"hello\", \"world\"}, []string{\"hello\", \"testify\"}) {\n\t\tt.Error(\"Subset should return false: [\\\"hello\\\", \\\"world\\\"] does not contain [\\\"hello\\\", \\\"testify\\\"]\")\n\t}\n\tif Subset(mockT, []int{1, 2, 3}, []int{4, 5}) {\n\t\tt.Error(\"Subset should return false: [1, 2, 3] does not contain [4, 5]\")\n\t}\n\tif Subset(mockT, []int{1, 2, 3}, []int{1, 5}) {\n\t\tt.Error(\"Subset should return false: [1, 2, 3] does not contain [1, 5]\")\n\t}\n}\n\nfunc TestNotSubset(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tif NotSubset(mockT, []int{1, 2, 3}, nil) {\n\t\tt.Error(\"NotSubset should return false: given subset is nil\")\n\t}\n\tif NotSubset(mockT, []int{1, 2, 3}, []int{}) {\n\t\tt.Error(\"NotSubset should return false: any set contains the nil set\")\n\t}\n\tif NotSubset(mockT, []int{1, 2, 3}, []int{1, 2}) {\n\t\tt.Error(\"NotSubset should return false: [1, 2, 3] contains [1, 2]\")\n\t}\n\tif NotSubset(mockT, []int{1, 2, 3}, []int{1, 2, 3}) {\n\t\tt.Error(\"NotSubset should return false: [1, 2, 3] contains [1, 2, 3]\")\n\t}\n\tif NotSubset(mockT, []string{\"hello\", \"world\"}, []string{\"hello\"}) {\n\t\tt.Error(\"NotSubset should return false: [\\\"hello\\\", \\\"world\\\"] contains [\\\"hello\\\"]\")\n\t}\n\n\tif !NotSubset(mockT, []string{\"hello\", \"world\"}, []string{\"hello\", \"testify\"}) {\n\t\tt.Error(\"NotSubset should return true: [\\\"hello\\\", \\\"world\\\"] does not contain [\\\"hello\\\", \\\"testify\\\"]\")\n\t}\n\tif !NotSubset(mockT, []int{1, 2, 3}, []int{4, 5}) {\n\t\tt.Error(\"NotSubset should return true: [1, 2, 3] does not contain [4, 5]\")\n\t}\n\tif !NotSubset(mockT, []int{1, 2, 3}, []int{1, 5}) {\n\t\tt.Error(\"NotSubset should return true: [1, 2, 3] does not contain [1, 5]\")\n\t}\n}\n\nfunc TestNotSubsetNil(t *testing.T) {\n\tmockT := new(testing.T)\n\tNotSubset(mockT, []string{\"foo\"}, nil)\n\tif !mockT.Failed() {\n\t\tt.Error(\"NotSubset on nil set should have failed the test\")\n\t}\n}\n\nfunc Test_includeElement(t *testing.T) {\n\n\tlist1 := []string{\"Foo\", \"Bar\"}\n\tlist2 := []int{1, 2}\n\tsimpleMap := map[interface{}]interface{}{\"Foo\": \"Bar\"}\n\n\tok, found := includeElement(\"Hello World\", \"World\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(list1, \"Foo\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(list1, \"Bar\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(list2, 1)\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(list2, 2)\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(list1, \"Foo!\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = includeElement(list2, 3)\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = includeElement(list2, \"1\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = includeElement(simpleMap, \"Foo\")\n\tTrue(t, ok)\n\tTrue(t, found)\n\n\tok, found = includeElement(simpleMap, \"Bar\")\n\tTrue(t, ok)\n\tFalse(t, found)\n\n\tok, found = includeElement(1433, \"1\")\n\tFalse(t, ok)\n\tFalse(t, found)\n}\n\nfunc TestElementsMatch(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tif !ElementsMatch(mockT, nil, nil) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{}, []int{}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{1}, []int{1}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{1, 1}, []int{1, 1}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{1, 2}, []int{1, 2}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{1, 2}, []int{2, 1}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, [2]int{1, 2}, [2]int{2, 1}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []string{\"hello\", \"world\"}, []string{\"world\", \"hello\"}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []string{\"hello\", \"hello\"}, []string{\"hello\", \"hello\"}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []string{\"hello\", \"hello\", \"world\"}, []string{\"hello\", \"world\", \"hello\"}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, [3]string{\"hello\", \"hello\", \"world\"}, [3]string{\"hello\", \"world\", \"hello\"}) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\tif !ElementsMatch(mockT, []int{}, nil) {\n\t\tt.Error(\"ElementsMatch should return true\")\n\t}\n\n\tif ElementsMatch(mockT, []int{1}, []int{1, 1}) {\n\t\tt.Error(\"ElementsMatch should return false\")\n\t}\n\tif ElementsMatch(mockT, []int{1, 2}, []int{2, 2}) {\n\t\tt.Error(\"ElementsMatch should return false\")\n\t}\n\tif ElementsMatch(mockT, []string{\"hello\", \"hello\"}, []string{\"hello\"}) {\n\t\tt.Error(\"ElementsMatch should return false\")\n\t}\n}\n\nfunc TestCondition(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tif !Condition(mockT, func() bool { return true }, \"Truth\") {\n\t\tt.Error(\"Condition should return true\")\n\t}\n\n\tif Condition(mockT, func() bool { return false }, \"Lie\") {\n\t\tt.Error(\"Condition should return false\")\n\t}\n\n}\n\nfunc TestDidPanic(t *testing.T) {\n\n\tif funcDidPanic, _ := didPanic(func() {\n\t\tpanic(\"Panic!\")\n\t}); !funcDidPanic {\n\t\tt.Error(\"didPanic should return true\")\n\t}\n\n\tif funcDidPanic, _ := didPanic(func() {\n\t}); funcDidPanic {\n\t\tt.Error(\"didPanic should return false\")\n\t}\n\n}\n\nfunc TestPanics(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !Panics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"Panics should return true\")\n\t}\n\n\tif Panics(mockT, func() {\n\t}) {\n\t\tt.Error(\"Panics should return false\")\n\t}\n\n}\n\nfunc TestPanicsWithValue(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !PanicsWithValue(mockT, \"Panic!\", func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return true\")\n\t}\n\n\tif PanicsWithValue(mockT, \"Panic!\", func() {\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return false\")\n\t}\n\n\tif PanicsWithValue(mockT, \"at the disco\", func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"PanicsWithValue should return false\")\n\t}\n}\n\nfunc TestNotPanics(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\tif !NotPanics(mockT, func() {\n\t}) {\n\t\tt.Error(\"NotPanics should return true\")\n\t}\n\n\tif NotPanics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"NotPanics should return false\")\n\t}\n\n}\n\nfunc TestNoError(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\n\tTrue(t, NoError(mockT, err), \"NoError should return True for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\n\tFalse(t, NoError(mockT, err), \"NoError with error should return False\")\n\n\t// returning an empty error interface\n\terr = func() error {\n\t\tvar err *customError\n\t\tif err != nil {\n\t\t\tt.Fatal(\"err should be nil here\")\n\t\t}\n\t\treturn err\n\t}()\n\n\tif err == nil { // err is not nil here!\n\t\tt.Errorf(\"Error should be nil due to empty interface: %s\", err)\n\t}\n\n\tFalse(t, NoError(mockT, err), \"NoError should fail with empty error interface\")\n}\n\ntype customError struct{}\n\nfunc (*customError) Error() string { return \"fail\" }\n\nfunc TestError(t *testing.T) {\n\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\n\tFalse(t, Error(mockT, err), \"Error should return False for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\n\tTrue(t, Error(mockT, err), \"Error with error should return True\")\n\n\t// go vet check\n\tTrue(t, Errorf(mockT, err, \"example with %s\", \"formatted message\"), \"Errorf with error should rturn True\")\n\n\t// returning an empty error interface\n\terr = func() error {\n\t\tvar err *customError\n\t\tif err != nil {\n\t\t\tt.Fatal(\"err should be nil here\")\n\t\t}\n\t\treturn err\n\t}()\n\n\tif err == nil { // err is not nil here!\n\t\tt.Errorf(\"Error should be nil due to empty interface: %s\", err)\n\t}\n\n\tTrue(t, Error(mockT, err), \"Error should pass with empty error interface\")\n}\n\nfunc TestEqualError(t *testing.T) {\n\tmockT := new(testing.T)\n\n\t// start with a nil error\n\tvar err error\n\tFalse(t, EqualError(mockT, err, \"\"),\n\t\t\"EqualError should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\tFalse(t, EqualError(mockT, err, \"Not some error\"),\n\t\t\"EqualError should return false for different error string\")\n\tTrue(t, EqualError(mockT, err, \"some error\"),\n\t\t\"EqualError should return true\")\n}\n\nfunc Test_isEmpty(t *testing.T) {\n\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\n\tTrue(t, isEmpty(\"\"))\n\tTrue(t, isEmpty(nil))\n\tTrue(t, isEmpty([]string{}))\n\tTrue(t, isEmpty(0))\n\tTrue(t, isEmpty(int32(0)))\n\tTrue(t, isEmpty(int64(0)))\n\tTrue(t, isEmpty(false))\n\tTrue(t, isEmpty(map[string]string{}))\n\tTrue(t, isEmpty(new(time.Time)))\n\tTrue(t, isEmpty(time.Time{}))\n\tTrue(t, isEmpty(make(chan struct{})))\n\tFalse(t, isEmpty(\"something\"))\n\tFalse(t, isEmpty(errors.New(\"something\")))\n\tFalse(t, isEmpty([]string{\"something\"}))\n\tFalse(t, isEmpty(1))\n\tFalse(t, isEmpty(true))\n\tFalse(t, isEmpty(map[string]string{\"Hello\": \"World\"}))\n\tFalse(t, isEmpty(chWithValue))\n\n}\n\nfunc TestEmpty(t *testing.T) {\n\n\tmockT := new(testing.T)\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\tvar tiP *time.Time\n\tvar tiNP time.Time\n\tvar s *string\n\tvar f *os.File\n\tsP := &s\n\tx := 1\n\txP := &x\n\n\ttype TString string\n\ttype TStruct struct {\n\t\tx int\n\t\ts []int\n\t}\n\n\tTrue(t, Empty(mockT, \"\"), \"Empty string is empty\")\n\tTrue(t, Empty(mockT, nil), \"Nil is empty\")\n\tTrue(t, Empty(mockT, []string{}), \"Empty string array is empty\")\n\tTrue(t, Empty(mockT, 0), \"Zero int value is empty\")\n\tTrue(t, Empty(mockT, false), \"False value is empty\")\n\tTrue(t, Empty(mockT, make(chan struct{})), \"Channel without values is empty\")\n\tTrue(t, Empty(mockT, s), \"Nil string pointer is empty\")\n\tTrue(t, Empty(mockT, f), \"Nil os.File pointer is empty\")\n\tTrue(t, Empty(mockT, tiP), \"Nil time.Time pointer is empty\")\n\tTrue(t, Empty(mockT, tiNP), \"time.Time is empty\")\n\tTrue(t, Empty(mockT, TStruct{}), \"struct with zero values is empty\")\n\tTrue(t, Empty(mockT, TString(\"\")), \"empty aliased string is empty\")\n\tTrue(t, Empty(mockT, sP), \"ptr to nil value is empty\")\n\n\tFalse(t, Empty(mockT, \"something\"), \"Non Empty string is not empty\")\n\tFalse(t, Empty(mockT, errors.New(\"something\")), \"Non nil object is not empty\")\n\tFalse(t, Empty(mockT, []string{\"something\"}), \"Non empty string array is not empty\")\n\tFalse(t, Empty(mockT, 1), \"Non-zero int value is not empty\")\n\tFalse(t, Empty(mockT, true), \"True value is not empty\")\n\tFalse(t, Empty(mockT, chWithValue), \"Channel with values is not empty\")\n\tFalse(t, Empty(mockT, TStruct{x: 1}), \"struct with initialized values is empty\")\n\tFalse(t, Empty(mockT, TString(\"abc\")), \"non-empty aliased string is empty\")\n\tFalse(t, Empty(mockT, xP), \"ptr to non-nil value is not empty\")\n}\n\nfunc TestNotEmpty(t *testing.T) {\n\n\tmockT := new(testing.T)\n\tchWithValue := make(chan struct{}, 1)\n\tchWithValue <- struct{}{}\n\n\tFalse(t, NotEmpty(mockT, \"\"), \"Empty string is empty\")\n\tFalse(t, NotEmpty(mockT, nil), \"Nil is empty\")\n\tFalse(t, NotEmpty(mockT, []string{}), \"Empty string array is empty\")\n\tFalse(t, NotEmpty(mockT, 0), \"Zero int value is empty\")\n\tFalse(t, NotEmpty(mockT, false), \"False value is empty\")\n\tFalse(t, NotEmpty(mockT, make(chan struct{})), \"Channel without values is empty\")\n\n\tTrue(t, NotEmpty(mockT, \"something\"), \"Non Empty string is not empty\")\n\tTrue(t, NotEmpty(mockT, errors.New(\"something\")), \"Non nil object is not empty\")\n\tTrue(t, NotEmpty(mockT, []string{\"something\"}), \"Non empty string array is not empty\")\n\tTrue(t, NotEmpty(mockT, 1), \"Non-zero int value is not empty\")\n\tTrue(t, NotEmpty(mockT, true), \"True value is not empty\")\n\tTrue(t, NotEmpty(mockT, chWithValue), \"Channel with values is not empty\")\n}\n\nfunc Test_getLen(t *testing.T) {\n\tfalseCases := []interface{}{\n\t\tnil,\n\t\t0,\n\t\ttrue,\n\t\tfalse,\n\t\t'A',\n\t\tstruct{}{},\n\t}\n\tfor _, v := range falseCases {\n\t\tok, l := getLen(v)\n\t\tFalse(t, ok, \"Expected getLen fail to get length of %#v\", v)\n\t\tEqual(t, 0, l, \"getLen should return 0 for %#v\", v)\n\t}\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\ttrueCases := []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 3},\n\t\t{[...]int{1, 2, 3}, 3},\n\t\t{\"ABC\", 3},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3},\n\t\t{ch, 3},\n\n\t\t{[]int{}, 0},\n\t\t{map[int]int{}, 0},\n\t\t{make(chan int), 0},\n\n\t\t{[]int(nil), 0},\n\t\t{map[int]int(nil), 0},\n\t\t{(chan int)(nil), 0},\n\t}\n\n\tfor _, c := range trueCases {\n\t\tok, l := getLen(c.v)\n\t\tTrue(t, ok, \"Expected getLen success to get length of %#v\", c.v)\n\t\tEqual(t, c.l, l)\n\t}\n}\n\nfunc TestLen(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tFalse(t, Len(mockT, nil, 0), \"nil does not have length\")\n\tFalse(t, Len(mockT, 0, 0), \"int does not have length\")\n\tFalse(t, Len(mockT, true, 0), \"true does not have length\")\n\tFalse(t, Len(mockT, false, 0), \"false does not have length\")\n\tFalse(t, Len(mockT, 'A', 0), \"Rune does not have length\")\n\tFalse(t, Len(mockT, struct{}{}, 0), \"Struct does not have length\")\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\n\tcases := []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 3},\n\t\t{[...]int{1, 2, 3}, 3},\n\t\t{\"ABC\", 3},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3},\n\t\t{ch, 3},\n\n\t\t{[]int{}, 0},\n\t\t{map[int]int{}, 0},\n\t\t{make(chan int), 0},\n\n\t\t{[]int(nil), 0},\n\t\t{map[int]int(nil), 0},\n\t\t{(chan int)(nil), 0},\n\t}\n\n\tfor _, c := range cases {\n\t\tTrue(t, Len(mockT, c.v, c.l), \"%#v have %d items\", c.v, c.l)\n\t}\n\n\tcases = []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 4},\n\t\t{[...]int{1, 2, 3}, 2},\n\t\t{\"ABC\", 2},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 4},\n\t\t{ch, 2},\n\n\t\t{[]int{}, 1},\n\t\t{map[int]int{}, 1},\n\t\t{make(chan int), 1},\n\n\t\t{[]int(nil), 1},\n\t\t{map[int]int(nil), 1},\n\t\t{(chan int)(nil), 1},\n\t}\n\n\tfor _, c := range cases {\n\t\tFalse(t, Len(mockT, c.v, c.l), \"%#v have %d items\", c.v, c.l)\n\t}\n}\n\nfunc TestWithinDuration(t *testing.T) {\n\n\tmockT := new(testing.T)\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tTrue(t, WithinDuration(mockT, a, b, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\tTrue(t, WithinDuration(mockT, b, a, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tFalse(t, WithinDuration(mockT, a, b, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tFalse(t, WithinDuration(mockT, b, a, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n}\n\nfunc TestInDelta(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tTrue(t, InDelta(mockT, 1.001, 1, 0.01), \"|1.001 - 1| <= 0.01\")\n\tTrue(t, InDelta(mockT, 1, 1.001, 0.01), \"|1 - 1.001| <= 0.01\")\n\tTrue(t, InDelta(mockT, 1, 2, 1), \"|1 - 2| <= 1\")\n\tFalse(t, InDelta(mockT, 1, 2, 0.5), \"Expected |1 - 2| <= 0.5 to fail\")\n\tFalse(t, InDelta(mockT, 2, 1, 0.5), \"Expected |2 - 1| <= 0.5 to fail\")\n\tFalse(t, InDelta(mockT, \"\", nil, 1), \"Expected non numerals to fail\")\n\tFalse(t, InDelta(mockT, 42, math.NaN(), 0.01), \"Expected NaN for actual to fail\")\n\tFalse(t, InDelta(mockT, math.NaN(), 42, 0.01), \"Expected NaN for expected to fail\")\n\n\tcases := []struct {\n\t\ta, b  interface{}\n\t\tdelta float64\n\t}{\n\t\t{uint8(2), uint8(1), 1},\n\t\t{uint16(2), uint16(1), 1},\n\t\t{uint32(2), uint32(1), 1},\n\t\t{uint64(2), uint64(1), 1},\n\n\t\t{int(2), int(1), 1},\n\t\t{int8(2), int8(1), 1},\n\t\t{int16(2), int16(1), 1},\n\t\t{int32(2), int32(1), 1},\n\t\t{int64(2), int64(1), 1},\n\n\t\t{float32(2), float32(1), 1},\n\t\t{float64(2), float64(1), 1},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, InDelta(mockT, tc.a, tc.b, tc.delta), \"Expected |%V - %V| <= %v\", tc.a, tc.b, tc.delta)\n\t}\n}\n\nfunc TestInDeltaSlice(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tTrue(t, InDeltaSlice(mockT,\n\t\t[]float64{1.001, 0.999},\n\t\t[]float64{1, 1},\n\t\t0.1), \"{1.001, 0.009} is element-wise close to {1, 1} in delta=0.1\")\n\n\tTrue(t, InDeltaSlice(mockT,\n\t\t[]float64{1, 2},\n\t\t[]float64{0, 3},\n\t\t1), \"{1, 2} is element-wise close to {0, 3} in delta=1\")\n\n\tFalse(t, InDeltaSlice(mockT,\n\t\t[]float64{1, 2},\n\t\t[]float64{0, 3},\n\t\t0.1), \"{1, 2} is not element-wise close to {0, 3} in delta=0.1\")\n\n\tFalse(t, InDeltaSlice(mockT, \"\", nil, 1), \"Expected non numeral slices to fail\")\n}\n\nfunc TestInDeltaMapValues(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tfor _, tc := range []struct {\n\t\ttitle  string\n\t\texpect interface{}\n\t\tactual interface{}\n\t\tf      func(TestingT, bool, ...interface{}) bool\n\t\tdelta  float64\n\t}{\n\t\t{\n\t\t\ttitle: \"Within delta\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"foo\": 1.0,\n\t\t\t\t\"bar\": 2.0,\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"foo\": 1.01,\n\t\t\t\t\"bar\": 1.99,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Within delta\",\n\t\t\texpect: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 2.0,\n\t\t\t},\n\t\t\tactual: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 1.99,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Different number of keys\",\n\t\t\texpect: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t\t2: 2.0,\n\t\t\t},\n\t\t\tactual: map[int]float64{\n\t\t\t\t1: 1.0,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     False,\n\t\t},\n\t\t{\n\t\t\ttitle: \"Within delta with zero value\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"zero\": 0.0,\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"zero\": 0.0,\n\t\t\t},\n\t\t\tdelta: 0.1,\n\t\t\tf:     True,\n\t\t},\n\t\t{\n\t\t\ttitle: \"With missing key with zero value\",\n\t\t\texpect: map[string]float64{\n\t\t\t\t\"zero\": 0.0,\n\t\t\t\t\"foo\":  0.0,\n\t\t\t},\n\t\t\tactual: map[string]float64{\n\t\t\t\t\"zero\": 0.0,\n\t\t\t\t\"bar\":  0.0,\n\t\t\t},\n\t\t\tf: False,\n\t\t},\n\t} {\n\t\ttc.f(t, InDeltaMapValues(mockT, tc.expect, tc.actual, tc.delta), tc.title+\"\\n\"+diff(tc.expect, tc.actual))\n\t}\n}\n\nfunc TestInEpsilon(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), uint16(2), .001},\n\t\t{2.1, 2.2, 0.1},\n\t\t{2.2, 2.1, 0.1},\n\t\t{-2.1, -2.2, 0.1},\n\t\t{-2.2, -2.1, 0.1},\n\t\t{uint64(100), uint8(101), 0.01},\n\t\t{0.1, -0.1, 2},\n\t\t{0.1, 0, 2},\n\t\t{time.Second, time.Second + time.Millisecond, 0.002},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, InEpsilon(t, tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon), \"test: %q\", tc)\n\t}\n\n\tcases = []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), int16(-2), .001},\n\t\t{uint64(100), uint8(102), 0.01},\n\t\t{2.1, 2.2, 0.001},\n\t\t{2.2, 2.1, 0.001},\n\t\t{2.1, -2.2, 1},\n\t\t{2.1, \"bla-bla\", 0},\n\t\t{0.1, -0.1, 1.99},\n\t\t{0, 0.1, 2}, // expected must be different to zero\n\t\t{time.Second, time.Second + 10*time.Millisecond, 0.002},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, InEpsilon(mockT, tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n\n}\n\nfunc TestInEpsilonSlice(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tTrue(t, InEpsilonSlice(mockT,\n\t\t[]float64{2.2, 2.0},\n\t\t[]float64{2.1, 2.1},\n\t\t0.06), \"{2.2, 2.0} is element-wise close to {2.1, 2.1} in espilon=0.06\")\n\n\tFalse(t, InEpsilonSlice(mockT,\n\t\t[]float64{2.2, 2.0},\n\t\t[]float64{2.1, 2.1},\n\t\t0.04), \"{2.2, 2.0} is not element-wise close to {2.1, 2.1} in espilon=0.04\")\n\n\tFalse(t, InEpsilonSlice(mockT, \"\", nil, 1), \"Expected non numeral slices to fail\")\n}\n\nfunc TestRegexp(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tcases := []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^start\", \"start of the line\"},\n\t\t{\"end$\", \"in the end\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, Regexp(mockT, tc.rx, tc.str))\n\t\tTrue(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t\tFalse(t, NotRegexp(mockT, tc.rx, tc.str))\n\t\tFalse(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t}\n\n\tcases = []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^asdfastart\", \"Not the start of the line\"},\n\t\t{\"end$\", \"in the end.\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12a.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, Regexp(mockT, tc.rx, tc.str), \"Expected \\\"%s\\\" to not match \\\"%s\\\"\", tc.rx, tc.str)\n\t\tFalse(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t\tTrue(t, NotRegexp(mockT, tc.rx, tc.str))\n\t\tTrue(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str))\n\t}\n}\n\nfunc testAutogeneratedFunction() {\n\tdefer func() {\n\t\tif err := recover(); err == nil {\n\t\t\tpanic(\"did not panic\")\n\t\t}\n\t\tCallerInfo()\n\t}()\n\tt := struct {\n\t\tio.Closer\n\t}{}\n\tvar c io.Closer\n\tc = t\n\tc.Close()\n}\n\nfunc TestCallerInfoWithAutogeneratedFunctions(t *testing.T) {\n\tNotPanics(t, func() {\n\t\ttestAutogeneratedFunction()\n\t})\n}\n\nfunc TestZero(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tfor _, test := range zeros {\n\t\tTrue(t, Zero(mockT, test, \"%#v is not the %v zero value\", test, reflect.TypeOf(test)))\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tFalse(t, Zero(mockT, test, \"%#v is not the %v zero value\", test, reflect.TypeOf(test)))\n\t}\n}\n\nfunc TestNotZero(t *testing.T) {\n\tmockT := new(testing.T)\n\n\tfor _, test := range zeros {\n\t\tFalse(t, NotZero(mockT, test, \"%#v is not the %v zero value\", test, reflect.TypeOf(test)))\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tTrue(t, NotZero(mockT, test, \"%#v is not the %v zero value\", test, reflect.TypeOf(test)))\n\t}\n}\n\nfunc TestFileExists(t *testing.T) {\n\tmockT := new(testing.T)\n\tTrue(t, FileExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, FileExists(mockT, \"random_file\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, FileExists(mockT, \"../_codegen\"))\n}\n\nfunc TestDirExists(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, DirExists(mockT, \"assertions.go\"))\n\n\tmockT = new(testing.T)\n\tFalse(t, DirExists(mockT, \"random_dir\"))\n\n\tmockT = new(testing.T)\n\tTrue(t, DirExists(mockT, \"../_codegen\"))\n}\n\nfunc TestJSONEq_EqualSONString(t *testing.T) {\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`))\n}\n\nfunc TestJSONEq_EquivalentButNotEqual(t *testing.T) {\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_HashOfArraysAndHashes(t *testing.T) {\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, \"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\"))\n}\n\nfunc TestJSONEq_Array(t *testing.T) {\n\tmockT := new(testing.T)\n\tTrue(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`))\n}\n\nfunc TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`))\n}\n\nfunc TestJSONEq_HashesNotEquivalent(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_ActualIsNotJSON(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `{\"foo\": \"bar\"}`, \"Not JSON\"))\n}\n\nfunc TestJSONEq_ExpectedIsNotJSON(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, \"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`))\n}\n\nfunc TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, \"Not JSON\", \"Not JSON\"))\n}\n\nfunc TestJSONEq_ArraysOfDifferentOrder(t *testing.T) {\n\tmockT := new(testing.T)\n\tFalse(t, JSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`))\n}\n\nfunc TestDiff(t *testing.T) {\n\texpected := `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,3 +1,3 @@\n (struct { foo string }) {\n- foo: (string) (len=5) \"hello\"\n+ foo: (string) (len=3) \"bar\"\n }\n`\n\tactual := diff(\n\t\tstruct{ foo string }{\"hello\"},\n\t\tstruct{ foo string }{\"bar\"},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -2,5 +2,5 @@\n  (int) 1,\n- (int) 2,\n  (int) 3,\n- (int) 4\n+ (int) 5,\n+ (int) 7\n }\n`\n\tactual = diff(\n\t\t[]int{1, 2, 3, 4},\n\t\t[]int{1, 3, 5, 7},\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -2,4 +2,4 @@\n  (int) 1,\n- (int) 2,\n- (int) 3\n+ (int) 3,\n+ (int) 5\n }\n`\n\tactual = diff(\n\t\t[]int{1, 2, 3, 4}[0:3],\n\t\t[]int{1, 3, 5, 7}[0:3],\n\t)\n\tEqual(t, expected, actual)\n\n\texpected = `\n\nDiff:\n--- Expected\n+++ Actual\n@@ -1,6 +1,6 @@\n (map[string]int) (len=4) {\n- (string) (len=4) \"four\": (int) 4,\n+ (string) (len=4) \"five\": (int) 5,\n  (string) (len=3) \"one\": (int) 1,\n- (string) (len=5) \"three\": (int) 3,\n- (string) (len=3) \"two\": (int) 2\n+ (string) (len=5) \"seven\": (int) 7,\n+ (string) (len=5) \"three\": (int) 3\n }\n`\n\n\tactual = diff(\n\t\tmap[string]int{\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4},\n\t\tmap[string]int{\"one\": 1, \"three\": 3, \"five\": 5, \"seven\": 7},\n\t)\n\tEqual(t, expected, actual)\n}\n\nfunc TestDiffEmptyCases(t *testing.T) {\n\tEqual(t, \"\", diff(nil, nil))\n\tEqual(t, \"\", diff(struct{ foo string }{}, nil))\n\tEqual(t, \"\", diff(nil, struct{ foo string }{}))\n\tEqual(t, \"\", diff(1, 2))\n\tEqual(t, \"\", diff(1, 2))\n\tEqual(t, \"\", diff([]int{1}, []bool{true}))\n}\n\n// Ensure there are no data races\nfunc TestDiffRace(t *testing.T) {\n\tt.Parallel()\n\n\texpected := map[string]string{\n\t\t\"a\": \"A\",\n\t\t\"b\": \"B\",\n\t\t\"c\": \"C\",\n\t}\n\n\tactual := map[string]string{\n\t\t\"d\": \"D\",\n\t\t\"e\": \"E\",\n\t\t\"f\": \"F\",\n\t}\n\n\t// run diffs in parallel simulating tests with t.Parallel()\n\tnumRoutines := 10\n\trChans := make([]chan string, numRoutines)\n\tfor idx := range rChans {\n\t\trChans[idx] = make(chan string)\n\t\tgo func(ch chan string) {\n\t\t\tdefer close(ch)\n\t\t\tch <- diff(expected, actual)\n\t\t}(rChans[idx])\n\t}\n\n\tfor _, ch := range rChans {\n\t\tfor msg := range ch {\n\t\t\tNotZero(t, msg) // dummy assert\n\t\t}\n\t}\n}\n\ntype mockTestingT struct {\n}\n\nfunc (m *mockTestingT) Errorf(format string, args ...interface{}) {}\n\nfunc TestFailNowWithPlainTestingT(t *testing.T) {\n\tmockT := &mockTestingT{}\n\n\tPanics(t, func() {\n\t\tFailNow(mockT, \"failed\")\n\t}, \"should panic since mockT is missing FailNow()\")\n}\n\ntype mockFailNowTestingT struct {\n}\n\nfunc (m *mockFailNowTestingT) Errorf(format string, args ...interface{}) {}\n\nfunc (m *mockFailNowTestingT) FailNow() {}\n\nfunc TestFailNowWithFullTestingT(t *testing.T) {\n\tmockT := &mockFailNowTestingT{}\n\n\tNotPanics(t, func() {\n\t\tFailNow(mockT, \"failed\")\n\t}, \"should call mockT.FailNow() rather than panicking\")\n}\n\nfunc TestBytesEqual(t *testing.T) {\n\tvar cases = []struct {\n\t\ta, b []byte\n\t}{\n\t\t{make([]byte, 2), make([]byte, 2)},\n\t\t{make([]byte, 2), make([]byte, 2, 3)},\n\t\t{nil, make([]byte, 0)},\n\t}\n\tfor i, c := range cases {\n\t\tEqual(t, reflect.DeepEqual(c.a, c.b), ObjectsAreEqual(c.a, c.b), \"case %d failed\", i+1)\n\t}\n}\n\nfunc BenchmarkBytesEqual(b *testing.B) {\n\tconst size = 1024 * 8\n\ts := make([]byte, size)\n\tfor i := range s {\n\t\ts[i] = byte(i % 255)\n\t}\n\ts2 := make([]byte, size)\n\tcopy(s2, s)\n\n\tmockT := &mockFailNowTestingT{}\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tEqual(mockT, s, s2)\n\t}\n}\n\nfunc TestEqualArgsValidation(t *testing.T) {\n\terr := validateEqualArgs(time.Now, time.Now)\n\tEqualError(t, err, \"cannot take func type as argument\")\n}\n\nfunc ExampleComparisonAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tadder := func(x, y int) int {\n\t\treturn x + y\n\t}\n\n\ttype args struct {\n\t\tx int\n\t\ty int\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targs      args\n\t\texpect    int\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"2+2=4\", args{2, 2}, 4, Equal},\n\t\t{\"2+2!=5\", args{2, 2}, 5, NotEqual},\n\t\t{\"2+3==5\", args{2, 3}, 5, Exactly},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y))\n\t\t})\n\t}\n}\n\nfunc TestComparisonAssertionFunc(t *testing.T) {\n\ttype iface interface {\n\t\tName() string\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\texpect    interface{}\n\t\tgot       interface{}\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"implements\", (*iface)(nil), t, Implements},\n\t\t{\"isType\", (*testing.T)(nil), t, IsType},\n\t\t{\"equal\", t, t, Equal},\n\t\t{\"equalValues\", t, t, EqualValues},\n\t\t{\"exactly\", t, t, Exactly},\n\t\t{\"notEqual\", t, nil, NotEqual},\n\t\t{\"notContains\", []int{1, 2, 3}, 4, NotContains},\n\t\t{\"subset\", []int{1, 2, 3, 4}, []int{2, 3}, Subset},\n\t\t{\"notSubset\", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset},\n\t\t{\"elementsMatch\", []byte(\"abc\"), []byte(\"bac\"), ElementsMatch},\n\t\t{\"regexp\", \"^t.*y$\", \"testify\", Regexp},\n\t\t{\"notRegexp\", \"^t.*y$\", \"Testify\", NotRegexp},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, tt.got)\n\t\t})\n\t}\n}\n\nfunc ExampleValueAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParse := func(input string) interface{} {\n\t\tvar x interface{}\n\t\tjson.Unmarshal([]byte(input), &x)\n\t\treturn x\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"true is not nil\", \"true\", NotNil},\n\t\t{\"empty string is nil\", \"\", Nil},\n\t\t{\"zero is not nil\", \"0\", NotNil},\n\t\t{\"zero is zero\", \"0\", Zero},\n\t\t{\"false is zero\", \"false\", Zero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, dumbParse(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestValueAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     interface{}\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"notNil\", true, NotNil},\n\t\t{\"nil\", nil, Nil},\n\t\t{\"empty\", []int{}, Empty},\n\t\t{\"notEmpty\", []int{1}, NotEmpty},\n\t\t{\"zero\", false, Zero},\n\t\t{\"notZero\", 42, NotZero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleBoolAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tisOkay := func(x int) bool {\n\t\treturn x >= 42\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       int\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"-1 is bad\", -1, False},\n\t\t{\"42 is good\", 42, True},\n\t\t{\"41 is bad\", 41, False},\n\t\t{\"45 is cool\", 45, True},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, isOkay(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestBoolAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     bool\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"true\", true, True},\n\t\t{\"false\", false, False},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleErrorAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParseNum := func(input string, v interface{}) error {\n\t\treturn json.Unmarshal([]byte(input), v)\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"1.2 is number\", \"1.2\", NoError},\n\t\t{\"1.2.3 not number\", \"1.2.3\", Error},\n\t\t{\"true is not number\", \"true\", Error},\n\t\t{\"3 is number\", \"3\", NoError},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tvar x float64\n\t\t\ttt.assertion(t, dumbParseNum(tt.arg, &x))\n\t\t})\n\t}\n}\n\nfunc TestErrorAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\terr       error\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"noError\", nil, NoError},\n\t\t{\"error\", errors.New(\"whoops\"), Error},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.err)\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/doc.go",
    "content": "// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.\n//\n// Example Usage\n//\n// The following is a complete example using assert in a standard test function:\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/assert\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      assert.Equal(t, a, b, \"The two words should be the same.\")\n//\n//    }\n//\n// if you assert many times, use the format below:\n//\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/assert\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//      assert := assert.New(t)\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      assert.Equal(a, b, \"The two words should be the same.\")\n//    }\n//\n// Assertions\n//\n// Assertions allow you to easily write test code, and are global funcs in the `assert` package.\n// All assertion functions take, as the first argument, the `*testing.T` object provided by the\n// testing framework. This allows the assertion funcs to write the failings and other details to\n// the correct place.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage assert\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/errors.go",
    "content": "package assert\n\nimport (\n\t\"errors\"\n)\n\n// AnError is an error instance useful for testing.  If the code does not care\n// about error specifics, and only needs to return the error for example, this\n// error should be used to make the test code more readable.\nvar AnError = errors.New(\"assert.AnError general error for testing\")\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/forward_assertions.go",
    "content": "package assert\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/forward_assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"errors\"\n\t\"regexp\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestImplementsWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface\")\n\t}\n\tif assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface\")\n\t}\n}\n\nfunc TestIsTypeWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject\")\n\t}\n\tif assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) {\n\t\tt.Error(\"IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject\")\n\t}\n\n}\n\nfunc TestEqualWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.Equal(\"Hello World\", \"Hello World\") {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(123, 123) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(123.5, 123.5) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal([]byte(\"Hello World\"), []byte(\"Hello World\")) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n\tif !assert.Equal(nil, nil) {\n\t\tt.Error(\"Equal should return true\")\n\t}\n}\n\nfunc TestEqualValuesWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.EqualValues(uint32(10), int32(10)) {\n\t\tt.Error(\"EqualValues should return true\")\n\t}\n}\n\nfunc TestNotNilWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.NotNil(new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotNil should return true: object is not nil\")\n\t}\n\tif assert.NotNil(nil) {\n\t\tt.Error(\"NotNil should return false: object is nil\")\n\t}\n\n}\n\nfunc TestNilWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.Nil(nil) {\n\t\tt.Error(\"Nil should return true: object is nil\")\n\t}\n\tif assert.Nil(new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"Nil should return false: object is not nil\")\n\t}\n\n}\n\nfunc TestTrueWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.True(true) {\n\t\tt.Error(\"True should return true\")\n\t}\n\tif assert.True(false) {\n\t\tt.Error(\"True should return false\")\n\t}\n\n}\n\nfunc TestFalseWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tif !assert.False(false) {\n\t\tt.Error(\"False should return true\")\n\t}\n\tif assert.False(true) {\n\t\tt.Error(\"False should return false\")\n\t}\n\n}\n\nfunc TestExactlyWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\ta := float32(1)\n\tb := float64(1)\n\tc := float32(1)\n\td := float32(2)\n\n\tif assert.Exactly(a, b) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif assert.Exactly(a, d) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif !assert.Exactly(a, c) {\n\t\tt.Error(\"Exactly should return true\")\n\t}\n\n\tif assert.Exactly(nil, a) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\tif assert.Exactly(a, nil) {\n\t\tt.Error(\"Exactly should return false\")\n\t}\n\n}\n\nfunc TestNotEqualWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotEqual(\"Hello World\", \"Hello World!\") {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(123, 1234) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(123.5, 123.55) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual([]byte(\"Hello World\"), []byte(\"Hello World!\")) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n\tif !assert.NotEqual(nil, new(AssertionTesterConformingObject)) {\n\t\tt.Error(\"NotEqual should return true\")\n\t}\n}\n\nfunc TestContainsWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\tlist := []string{\"Foo\", \"Bar\"}\n\n\tif !assert.Contains(\"Hello World\", \"Hello\") {\n\t\tt.Error(\"Contains should return true: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\tif assert.Contains(\"Hello World\", \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"Hello World\\\" does not contain \\\"Salut\\\"\")\n\t}\n\n\tif !assert.Contains(list, \"Foo\") {\n\t\tt.Error(\"Contains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Foo\\\"\")\n\t}\n\tif assert.Contains(list, \"Salut\") {\n\t\tt.Error(\"Contains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Salut\\\"\")\n\t}\n\n}\n\nfunc TestNotContainsWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\tlist := []string{\"Foo\", \"Bar\"}\n\n\tif !assert.NotContains(\"Hello World\", \"Hello!\") {\n\t\tt.Error(\"NotContains should return true: \\\"Hello World\\\" does not contain \\\"Hello!\\\"\")\n\t}\n\tif assert.NotContains(\"Hello World\", \"Hello\") {\n\t\tt.Error(\"NotContains should return false: \\\"Hello World\\\" contains \\\"Hello\\\"\")\n\t}\n\n\tif !assert.NotContains(list, \"Foo!\") {\n\t\tt.Error(\"NotContains should return true: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" does not contain \\\"Foo!\\\"\")\n\t}\n\tif assert.NotContains(list, \"Foo\") {\n\t\tt.Error(\"NotContains should return false: \\\"[\\\"Foo\\\", \\\"Bar\\\"]\\\" contains \\\"Foo\\\"\")\n\t}\n\n}\n\nfunc TestConditionWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Condition(func() bool { return true }, \"Truth\") {\n\t\tt.Error(\"Condition should return true\")\n\t}\n\n\tif assert.Condition(func() bool { return false }, \"Lie\") {\n\t\tt.Error(\"Condition should return false\")\n\t}\n\n}\n\nfunc TestDidPanicWrapper(t *testing.T) {\n\n\tif funcDidPanic, _ := didPanic(func() {\n\t\tpanic(\"Panic!\")\n\t}); !funcDidPanic {\n\t\tt.Error(\"didPanic should return true\")\n\t}\n\n\tif funcDidPanic, _ := didPanic(func() {\n\t}); funcDidPanic {\n\t\tt.Error(\"didPanic should return false\")\n\t}\n\n}\n\nfunc TestPanicsWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\n\tif !assert.Panics(func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"Panics should return true\")\n\t}\n\n\tif assert.Panics(func() {\n\t}) {\n\t\tt.Error(\"Panics should return false\")\n\t}\n\n}\n\nfunc TestNotPanicsWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\n\tif !assert.NotPanics(func() {\n\t}) {\n\t\tt.Error(\"NotPanics should return true\")\n\t}\n\n\tif assert.NotPanics(func() {\n\t\tpanic(\"Panic!\")\n\t}) {\n\t\tt.Error(\"NotPanics should return false\")\n\t}\n\n}\n\nfunc TestNoErrorWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\n\tassert.True(mockAssert.NoError(err), \"NoError should return True for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"Some error\")\n\n\tassert.False(mockAssert.NoError(err), \"NoError with error should return False\")\n\n}\n\nfunc TestErrorWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\n\tassert.False(mockAssert.Error(err), \"Error should return False for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"Some error\")\n\n\tassert.True(mockAssert.Error(err), \"Error with error should return True\")\n\n}\n\nfunc TestEqualErrorWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\t// start with a nil error\n\tvar err error\n\tassert.False(mockAssert.EqualError(err, \"\"),\n\t\t\"EqualError should return false for nil arg\")\n\n\t// now set an error\n\terr = errors.New(\"some error\")\n\tassert.False(mockAssert.EqualError(err, \"Not some error\"),\n\t\t\"EqualError should return false for different error string\")\n\tassert.True(mockAssert.EqualError(err, \"some error\"),\n\t\t\"EqualError should return true\")\n}\n\nfunc TestEmptyWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.True(mockAssert.Empty(\"\"), \"Empty string is empty\")\n\tassert.True(mockAssert.Empty(nil), \"Nil is empty\")\n\tassert.True(mockAssert.Empty([]string{}), \"Empty string array is empty\")\n\tassert.True(mockAssert.Empty(0), \"Zero int value is empty\")\n\tassert.True(mockAssert.Empty(false), \"False value is empty\")\n\n\tassert.False(mockAssert.Empty(\"something\"), \"Non Empty string is not empty\")\n\tassert.False(mockAssert.Empty(errors.New(\"something\")), \"Non nil object is not empty\")\n\tassert.False(mockAssert.Empty([]string{\"something\"}), \"Non empty string array is not empty\")\n\tassert.False(mockAssert.Empty(1), \"Non-zero int value is not empty\")\n\tassert.False(mockAssert.Empty(true), \"True value is not empty\")\n\n}\n\nfunc TestNotEmptyWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.False(mockAssert.NotEmpty(\"\"), \"Empty string is empty\")\n\tassert.False(mockAssert.NotEmpty(nil), \"Nil is empty\")\n\tassert.False(mockAssert.NotEmpty([]string{}), \"Empty string array is empty\")\n\tassert.False(mockAssert.NotEmpty(0), \"Zero int value is empty\")\n\tassert.False(mockAssert.NotEmpty(false), \"False value is empty\")\n\n\tassert.True(mockAssert.NotEmpty(\"something\"), \"Non Empty string is not empty\")\n\tassert.True(mockAssert.NotEmpty(errors.New(\"something\")), \"Non nil object is not empty\")\n\tassert.True(mockAssert.NotEmpty([]string{\"something\"}), \"Non empty string array is not empty\")\n\tassert.True(mockAssert.NotEmpty(1), \"Non-zero int value is not empty\")\n\tassert.True(mockAssert.NotEmpty(true), \"True value is not empty\")\n\n}\n\nfunc TestLenWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.False(mockAssert.Len(nil, 0), \"nil does not have length\")\n\tassert.False(mockAssert.Len(0, 0), \"int does not have length\")\n\tassert.False(mockAssert.Len(true, 0), \"true does not have length\")\n\tassert.False(mockAssert.Len(false, 0), \"false does not have length\")\n\tassert.False(mockAssert.Len('A', 0), \"Rune does not have length\")\n\tassert.False(mockAssert.Len(struct{}{}, 0), \"Struct does not have length\")\n\n\tch := make(chan int, 5)\n\tch <- 1\n\tch <- 2\n\tch <- 3\n\n\tcases := []struct {\n\t\tv interface{}\n\t\tl int\n\t}{\n\t\t{[]int{1, 2, 3}, 3},\n\t\t{[...]int{1, 2, 3}, 3},\n\t\t{\"ABC\", 3},\n\t\t{map[int]int{1: 2, 2: 4, 3: 6}, 3},\n\t\t{ch, 3},\n\n\t\t{[]int{}, 0},\n\t\t{map[int]int{}, 0},\n\t\t{make(chan int), 0},\n\n\t\t{[]int(nil), 0},\n\t\t{map[int]int(nil), 0},\n\t\t{(chan int)(nil), 0},\n\t}\n\n\tfor _, c := range cases {\n\t\tassert.True(mockAssert.Len(c.v, c.l), \"%#v have %d items\", c.v, c.l)\n\t}\n}\n\nfunc TestWithinDurationWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tassert.True(mockAssert.WithinDuration(a, b, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\tassert.True(mockAssert.WithinDuration(b, a, 10*time.Second), \"A 10s difference is within a 10s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, 9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, -9*time.Second), \"A 10s difference is not within a 9s time difference\")\n\n\tassert.False(mockAssert.WithinDuration(a, b, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n\tassert.False(mockAssert.WithinDuration(b, a, -11*time.Second), \"A 10s difference is not within a 9s time difference\")\n}\n\nfunc TestInDeltaWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tTrue(t, assert.InDelta(1.001, 1, 0.01), \"|1.001 - 1| <= 0.01\")\n\tTrue(t, assert.InDelta(1, 1.001, 0.01), \"|1 - 1.001| <= 0.01\")\n\tTrue(t, assert.InDelta(1, 2, 1), \"|1 - 2| <= 1\")\n\tFalse(t, assert.InDelta(1, 2, 0.5), \"Expected |1 - 2| <= 0.5 to fail\")\n\tFalse(t, assert.InDelta(2, 1, 0.5), \"Expected |2 - 1| <= 0.5 to fail\")\n\tFalse(t, assert.InDelta(\"\", nil, 1), \"Expected non numerals to fail\")\n\n\tcases := []struct {\n\t\ta, b  interface{}\n\t\tdelta float64\n\t}{\n\t\t{uint8(2), uint8(1), 1},\n\t\t{uint16(2), uint16(1), 1},\n\t\t{uint32(2), uint32(1), 1},\n\t\t{uint64(2), uint64(1), 1},\n\n\t\t{int(2), int(1), 1},\n\t\t{int8(2), int8(1), 1},\n\t\t{int16(2), int16(1), 1},\n\t\t{int32(2), int32(1), 1},\n\t\t{int64(2), int64(1), 1},\n\n\t\t{float32(2), float32(1), 1},\n\t\t{float64(2), float64(1), 1},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.InDelta(tc.a, tc.b, tc.delta), \"Expected |%V - %V| <= %v\", tc.a, tc.b, tc.delta)\n\t}\n}\n\nfunc TestInEpsilonWrapper(t *testing.T) {\n\tassert := New(new(testing.T))\n\n\tcases := []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), uint16(2), .001},\n\t\t{2.1, 2.2, 0.1},\n\t\t{2.2, 2.1, 0.1},\n\t\t{-2.1, -2.2, 0.1},\n\t\t{-2.2, -2.1, 0.1},\n\t\t{uint64(100), uint8(101), 0.01},\n\t\t{0.1, -0.1, 2},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n\n\tcases = []struct {\n\t\ta, b    interface{}\n\t\tepsilon float64\n\t}{\n\t\t{uint8(2), int16(-2), .001},\n\t\t{uint64(100), uint8(102), 0.01},\n\t\t{2.1, 2.2, 0.001},\n\t\t{2.2, 2.1, 0.001},\n\t\t{2.1, -2.2, 1},\n\t\t{2.1, \"bla-bla\", 0},\n\t\t{0.1, -0.1, 1.99},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, \"Expected %V and %V to have a relative difference of %v\", tc.a, tc.b, tc.epsilon))\n\t}\n}\n\nfunc TestRegexpWrapper(t *testing.T) {\n\n\tassert := New(new(testing.T))\n\n\tcases := []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^start\", \"start of the line\"},\n\t\t{\"end$\", \"in the end\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tTrue(t, assert.Regexp(tc.rx, tc.str))\n\t\tTrue(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str))\n\t\tFalse(t, assert.NotRegexp(tc.rx, tc.str))\n\t\tFalse(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str))\n\t}\n\n\tcases = []struct {\n\t\trx, str string\n\t}{\n\t\t{\"^asdfastart\", \"Not the start of the line\"},\n\t\t{\"end$\", \"in the end.\"},\n\t\t{\"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}\", \"My phone number is 650.12a.34\"},\n\t}\n\n\tfor _, tc := range cases {\n\t\tFalse(t, assert.Regexp(tc.rx, tc.str), \"Expected \\\"%s\\\" to not match \\\"%s\\\"\", tc.rx, tc.str)\n\t\tFalse(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str))\n\t\tTrue(t, assert.NotRegexp(tc.rx, tc.str))\n\t\tTrue(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str))\n\t}\n}\n\nfunc TestZeroWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tfor _, test := range zeros {\n\t\tassert.True(mockAssert.Zero(test), \"Zero should return true for %v\", test)\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tassert.False(mockAssert.Zero(test), \"Zero should return false for %v\", test)\n\t}\n}\n\nfunc TestNotZeroWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tfor _, test := range zeros {\n\t\tassert.False(mockAssert.NotZero(test), \"Zero should return true for %v\", test)\n\t}\n\n\tfor _, test := range nonZeros {\n\t\tassert.True(mockAssert.NotZero(test), \"Zero should return false for %v\", test)\n\t}\n}\n\nfunc TestJSONEqWrapper_EqualSONString(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\") {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n}\n\nfunc TestJSONEqWrapper_Array(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif !assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`) {\n\t\tt.Error(\"JSONEq should return true\")\n\t}\n\n}\n\nfunc TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`{\"foo\": \"bar\"}`, \"Not JSON\") {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(\"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(\"Not JSON\", \"Not JSON\") {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tassert := New(new(testing.T))\n\tif assert.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`) {\n\t\tt.Error(\"JSONEq should return false\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/http_assertions.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// httpCode is a helper that returns HTTP code of the response. It returns -1 and\n// an error if building a new request fails.\nfunc httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treq.URL.RawQuery = values.Encode()\n\thandler(w, req)\n\treturn w.Code, nil\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent\n\tif !isSuccessCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP success status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isSuccessCode\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect\n\tif !isRedirectCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP redirect status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isRedirectCode\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisErrorCode := code >= http.StatusBadRequest\n\tif !isErrorCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP error status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isErrorCode\n}\n\n// HTTPBody is a helper that returns HTTP body of the response. It returns\n// empty string if building a new request fails.\nfunc HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(method, url+\"?\"+values.Encode(), nil)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\thandler(w, req)\n\treturn w.Body.String()\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif !contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for \\\"%s\\\" to contain \\\"%s\\\" but found \\\"%s\\\"\", url+\"?\"+values.Encode(), str, body))\n\t}\n\n\treturn contains\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for \\\"%s\\\" to NOT contain \\\"%s\\\" but found \\\"%s\\\"\", url+\"?\"+values.Encode(), str, body))\n\t}\n\n\treturn !contains\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/assert/http_assertions_test.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"testing\"\n)\n\nfunc httpOK(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n}\n\nfunc httpRedirect(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusTemporaryRedirect)\n}\n\nfunc httpError(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusInternalServerError)\n}\n\nfunc TestHTTPSuccess(t *testing.T) {\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT1, httpOK, \"GET\", \"/\", nil), true)\n\tassert.False(mockT1.Failed())\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT2, httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.True(mockT2.Failed())\n\n\tmockT3 := new(testing.T)\n\tassert.Equal(HTTPSuccess(mockT3, httpError, \"GET\", \"/\", nil), false)\n\tassert.True(mockT3.Failed())\n}\n\nfunc TestHTTPRedirect(t *testing.T) {\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT1, httpOK, \"GET\", \"/\", nil), false)\n\tassert.True(mockT1.Failed())\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT2, httpRedirect, \"GET\", \"/\", nil), true)\n\tassert.False(mockT2.Failed())\n\n\tmockT3 := new(testing.T)\n\tassert.Equal(HTTPRedirect(mockT3, httpError, \"GET\", \"/\", nil), false)\n\tassert.True(mockT3.Failed())\n}\n\nfunc TestHTTPError(t *testing.T) {\n\tassert := New(t)\n\n\tmockT1 := new(testing.T)\n\tassert.Equal(HTTPError(mockT1, httpOK, \"GET\", \"/\", nil), false)\n\tassert.True(mockT1.Failed())\n\n\tmockT2 := new(testing.T)\n\tassert.Equal(HTTPError(mockT2, httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.True(mockT2.Failed())\n\n\tmockT3 := new(testing.T)\n\tassert.Equal(HTTPError(mockT3, httpError, \"GET\", \"/\", nil), true)\n\tassert.False(mockT3.Failed())\n}\n\nfunc TestHTTPStatusesWrapper(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.Equal(mockAssert.HTTPSuccess(httpOK, \"GET\", \"/\", nil), true)\n\tassert.Equal(mockAssert.HTTPSuccess(httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPSuccess(httpError, \"GET\", \"/\", nil), false)\n\n\tassert.Equal(mockAssert.HTTPRedirect(httpOK, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPRedirect(httpRedirect, \"GET\", \"/\", nil), true)\n\tassert.Equal(mockAssert.HTTPRedirect(httpError, \"GET\", \"/\", nil), false)\n\n\tassert.Equal(mockAssert.HTTPError(httpOK, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPError(httpRedirect, \"GET\", \"/\", nil), false)\n\tassert.Equal(mockAssert.HTTPError(httpError, \"GET\", \"/\", nil), true)\n}\n\nfunc httpHelloName(w http.ResponseWriter, r *http.Request) {\n\tname := r.FormValue(\"name\")\n\tw.Write([]byte(fmt.Sprintf(\"Hello, %s!\", name)))\n}\n\nfunc TestHTTPRequestWithNoParams(t *testing.T) {\n\tvar got *http.Request\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tgot = r\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\n\tTrue(t, HTTPSuccess(t, handler, \"GET\", \"/url\", nil))\n\n\tEmpty(t, got.URL.Query())\n\tEqual(t, \"/url\", got.URL.RequestURI())\n}\n\nfunc TestHTTPRequestWithParams(t *testing.T) {\n\tvar got *http.Request\n\thandler := func(w http.ResponseWriter, r *http.Request) {\n\t\tgot = r\n\t\tw.WriteHeader(http.StatusOK)\n\t}\n\tparams := url.Values{}\n\tparams.Add(\"id\", \"12345\")\n\n\tTrue(t, HTTPSuccess(t, handler, \"GET\", \"/url\", params))\n\n\tEqual(t, url.Values{\"id\": []string{\"12345\"}}, got.URL.Query())\n\tEqual(t, \"/url?id=12345\", got.URL.String())\n\tEqual(t, \"/url?id=12345\", got.URL.RequestURI())\n}\n\nfunc TestHttpBody(t *testing.T) {\n\tassert := New(t)\n\tmockT := new(testing.T)\n\n\tassert.True(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.True(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.False(HTTPBodyContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\n\tassert.False(HTTPBodyNotContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.False(HTTPBodyNotContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.True(HTTPBodyNotContains(mockT, httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n}\n\nfunc TestHttpBodyWrappers(t *testing.T) {\n\tassert := New(t)\n\tmockAssert := New(new(testing.T))\n\n\tassert.True(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.True(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.False(mockAssert.HTTPBodyContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\n\tassert.False(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"Hello, World!\"))\n\tassert.False(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"World\"))\n\tassert.True(mockAssert.HTTPBodyNotContains(httpHelloName, \"GET\", \"/\", url.Values{\"name\": []string{\"World\"}}, \"world\"))\n\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/doc.go",
    "content": "// Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend.\n//\n// testify contains the following packages:\n//\n// The assert package provides a comprehensive set of assertion functions that tie in to the Go testing system.\n//\n// The http package contains tools to make it easier to test http activity using the Go testing system.\n//\n// The mock package provides a system by which it is possible to mock your objects and verify calls are happening as expected.\n//\n// The suite package provides a basic structure for using structs as testing suites, and methods on those structs as tests.  It includes setup/teardown functionality in the way of interfaces.\npackage testify\n\n// blank imports help docs.\nimport (\n\t// assert package\n\t_ \"github.com/stretchr/testify/assert\"\n\t// http package\n\t_ \"github.com/stretchr/testify/http\"\n\t// mock package\n\t_ \"github.com/stretchr/testify/mock\"\n)\n"
  },
  {
    "path": "src/github.com/stretchr/testify/http/doc.go",
    "content": "// Package http DEPRECATED USE net/http/httptest\npackage http\n"
  },
  {
    "path": "src/github.com/stretchr/testify/http/test_response_writer.go",
    "content": "package http\n\nimport (\n\t\"net/http\"\n)\n\n// TestResponseWriter DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.\ntype TestResponseWriter struct {\n\n\t// StatusCode is the last int written by the call to WriteHeader(int)\n\tStatusCode int\n\n\t// Output is a string containing the written bytes using the Write([]byte) func.\n\tOutput string\n\n\t// header is the internal storage of the http.Header object\n\theader http.Header\n}\n\n// Header DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.\nfunc (rw *TestResponseWriter) Header() http.Header {\n\n\tif rw.header == nil {\n\t\trw.header = make(http.Header)\n\t}\n\n\treturn rw.header\n}\n\n// Write DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.\nfunc (rw *TestResponseWriter) Write(bytes []byte) (int, error) {\n\n\t// assume 200 success if no header has been set\n\tif rw.StatusCode == 0 {\n\t\trw.WriteHeader(200)\n\t}\n\n\t// add these bytes to the output string\n\trw.Output = rw.Output + string(bytes)\n\n\t// return normal values\n\treturn 0, nil\n\n}\n\n// WriteHeader DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.\nfunc (rw *TestResponseWriter) WriteHeader(i int) {\n\trw.StatusCode = i\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/http/test_round_tripper.go",
    "content": "package http\n\nimport (\n\t\"github.com/stretchr/testify/mock\"\n\t\"net/http\"\n)\n\n// TestRoundTripper DEPRECATED USE net/http/httptest\ntype TestRoundTripper struct {\n\tmock.Mock\n}\n\n// RoundTrip DEPRECATED USE net/http/httptest\nfunc (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {\n\targs := t.Called(req)\n\treturn args.Get(0).(*http.Response), args.Error(1)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/mock/doc.go",
    "content": "// Package mock provides a system by which it is possible to mock your objects\n// and verify calls are happening as expected.\n//\n// Example Usage\n//\n// The mock package provides an object, Mock, that tracks activity on another object.  It is usually\n// embedded into a test object as shown below:\n//\n//   type MyTestObject struct {\n//     // add a Mock object instance\n//     mock.Mock\n//\n//     // other fields go here as normal\n//   }\n//\n// When implementing the methods of an interface, you wire your functions up\n// to call the Mock.Called(args...) method, and return the appropriate values.\n//\n// For example, to mock a method that saves the name and age of a person and returns\n// the year of their birth or an error, you might write this:\n//\n//     func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) {\n//       args := o.Called(firstname, lastname, age)\n//       return args.Int(0), args.Error(1)\n//     }\n//\n// The Int, Error and Bool methods are examples of strongly typed getters that take the argument\n// index position. Given this argument list:\n//\n//     (12, true, \"Something\")\n//\n// You could read them out strongly typed like this:\n//\n//     args.Int(0)\n//     args.Bool(1)\n//     args.String(2)\n//\n// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion:\n//\n//     return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine)\n//\n// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those\n// cases you should check for nil first.\npackage mock\n"
  },
  {
    "path": "src/github.com/stretchr/testify/mock/mock.go",
    "content": "package mock\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"github.com/pmezard/go-difflib/difflib\"\n\t\"github.com/stretchr/objx\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tLogf(format string, args ...interface{})\n\tErrorf(format string, args ...interface{})\n\tFailNow()\n}\n\n/*\n\tCall\n*/\n\n// Call represents a method call and is used for setting expectations,\n// as well as recording activity.\ntype Call struct {\n\tParent *Mock\n\n\t// The name of the method that was or will be called.\n\tMethod string\n\n\t// Holds the arguments of the method.\n\tArguments Arguments\n\n\t// Holds the arguments that should be returned when\n\t// this method is called.\n\tReturnArguments Arguments\n\n\t// Holds the caller info for the On() call\n\tcallerInfo []string\n\n\t// The number of times to return the return arguments when setting\n\t// expectations. 0 means to always return the value.\n\tRepeatability int\n\n\t// Amount of times this call has been called\n\ttotalCalls int\n\n\t// Call to this method can be optional\n\toptional bool\n\n\t// Holds a channel that will be used to block the Return until it either\n\t// receives a message or is closed. nil means it returns immediately.\n\tWaitFor <-chan time.Time\n\n\twaitTime time.Duration\n\n\t// Holds a handler used to manipulate arguments content that are passed by\n\t// reference. It's useful when mocking methods such as unmarshalers or\n\t// decoders.\n\tRunFn func(Arguments)\n}\n\nfunc newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call {\n\treturn &Call{\n\t\tParent:          parent,\n\t\tMethod:          methodName,\n\t\tArguments:       methodArguments,\n\t\tReturnArguments: make([]interface{}, 0),\n\t\tcallerInfo:      callerInfo,\n\t\tRepeatability:   0,\n\t\tWaitFor:         nil,\n\t\tRunFn:           nil,\n\t}\n}\n\nfunc (c *Call) lock() {\n\tc.Parent.mutex.Lock()\n}\n\nfunc (c *Call) unlock() {\n\tc.Parent.mutex.Unlock()\n}\n\n// Return specifies the return arguments for the expectation.\n//\n//    Mock.On(\"DoSomething\").Return(errors.New(\"failed\"))\nfunc (c *Call) Return(returnArguments ...interface{}) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\n\tc.ReturnArguments = returnArguments\n\n\treturn c\n}\n\n// Once indicates that that the mock should only return the value once.\n//\n//    Mock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Once()\nfunc (c *Call) Once() *Call {\n\treturn c.Times(1)\n}\n\n// Twice indicates that that the mock should only return the value twice.\n//\n//    Mock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Twice()\nfunc (c *Call) Twice() *Call {\n\treturn c.Times(2)\n}\n\n// Times indicates that that the mock should only return the indicated number\n// of times.\n//\n//    Mock.On(\"MyMethod\", arg1, arg2).Return(returnArg1, returnArg2).Times(5)\nfunc (c *Call) Times(i int) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.Repeatability = i\n\treturn c\n}\n\n// WaitUntil sets the channel that will block the mock's return until its closed\n// or a message is received.\n//\n//    Mock.On(\"MyMethod\", arg1, arg2).WaitUntil(time.After(time.Second))\nfunc (c *Call) WaitUntil(w <-chan time.Time) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.WaitFor = w\n\treturn c\n}\n\n// After sets how long to block until the call returns\n//\n//    Mock.On(\"MyMethod\", arg1, arg2).After(time.Second)\nfunc (c *Call) After(d time.Duration) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.waitTime = d\n\treturn c\n}\n\n// Run sets a handler to be called before returning. It can be used when\n// mocking a method such as unmarshalers that takes a pointer to a struct and\n// sets properties in such struct\n//\n//    Mock.On(\"Unmarshal\", AnythingOfType(\"*map[string]interface{}\").Return().Run(func(args Arguments) {\n//    \targ := args.Get(0).(*map[string]interface{})\n//    \targ[\"foo\"] = \"bar\"\n//    })\nfunc (c *Call) Run(fn func(args Arguments)) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.RunFn = fn\n\treturn c\n}\n\n// Maybe allows the method call to be optional. Not calling an optional method\n// will not cause an error while asserting expectations\nfunc (c *Call) Maybe() *Call {\n\tc.lock()\n\tdefer c.unlock()\n\tc.optional = true\n\treturn c\n}\n\n// On chains a new expectation description onto the mocked interface. This\n// allows syntax like.\n//\n//    Mock.\n//       On(\"MyMethod\", 1).Return(nil).\n//       On(\"MyOtherMethod\", 'a', 'b', 'c').Return(errors.New(\"Some Error\"))\nfunc (c *Call) On(methodName string, arguments ...interface{}) *Call {\n\treturn c.Parent.On(methodName, arguments...)\n}\n\n// Mock is the workhorse used to track activity on another object.\n// For an example of its usage, refer to the \"Example Usage\" section at the top\n// of this document.\ntype Mock struct {\n\t// Represents the calls that are expected of\n\t// an object.\n\tExpectedCalls []*Call\n\n\t// Holds the calls that were made to this mocked object.\n\tCalls []Call\n\n\t// test is An optional variable that holds the test struct, to be used when an\n\t// invalid mock call was made.\n\ttest TestingT\n\n\t// TestData holds any data that might be useful for testing.  Testify ignores\n\t// this data completely allowing you to do whatever you like with it.\n\ttestData objx.Map\n\n\tmutex sync.Mutex\n}\n\n// TestData holds any data that might be useful for testing.  Testify ignores\n// this data completely allowing you to do whatever you like with it.\nfunc (m *Mock) TestData() objx.Map {\n\n\tif m.testData == nil {\n\t\tm.testData = make(objx.Map)\n\t}\n\n\treturn m.testData\n}\n\n/*\n\tSetting expectations\n*/\n\n// Test sets the test struct variable of the mock object\nfunc (m *Mock) Test(t TestingT) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.test = t\n}\n\n// fail fails the current test with the given formatted format and args.\n// In case that a test was defined, it uses the test APIs for failing a test,\n// otherwise it uses panic.\nfunc (m *Mock) fail(format string, args ...interface{}) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif m.test == nil {\n\t\tpanic(fmt.Sprintf(format, args...))\n\t}\n\tm.test.Errorf(format, args...)\n\tm.test.FailNow()\n}\n\n// On starts a description of an expectation of the specified method\n// being called.\n//\n//     Mock.On(\"MyMethod\", arg1, arg2)\nfunc (m *Mock) On(methodName string, arguments ...interface{}) *Call {\n\tfor _, arg := range arguments {\n\t\tif v := reflect.ValueOf(arg); v.Kind() == reflect.Func {\n\t\t\tpanic(fmt.Sprintf(\"cannot use Func in expectations. Use mock.AnythingOfType(\\\"%T\\\")\", arg))\n\t\t}\n\t}\n\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tc := newCall(m, methodName, assert.CallerInfo(), arguments...)\n\tm.ExpectedCalls = append(m.ExpectedCalls, c)\n\treturn c\n}\n\n// /*\n// \tRecording and responding to activity\n// */\n\nfunc (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) {\n\tfor i, call := range m.ExpectedCalls {\n\t\tif call.Method == method && call.Repeatability > -1 {\n\n\t\t\t_, diffCount := call.Arguments.Diff(arguments)\n\t\t\tif diffCount == 0 {\n\t\t\t\treturn i, call\n\t\t\t}\n\n\t\t}\n\t}\n\treturn -1, nil\n}\n\nfunc (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) {\n\tvar diffCount int\n\tvar closestCall *Call\n\tvar err string\n\n\tfor _, call := range m.expectedCalls() {\n\t\tif call.Method == method {\n\n\t\t\terrInfo, tempDiffCount := call.Arguments.Diff(arguments)\n\t\t\tif tempDiffCount < diffCount || diffCount == 0 {\n\t\t\t\tdiffCount = tempDiffCount\n\t\t\t\tclosestCall = call\n\t\t\t\terr = errInfo\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn closestCall, err\n}\n\nfunc callString(method string, arguments Arguments, includeArgumentValues bool) string {\n\n\tvar argValsString string\n\tif includeArgumentValues {\n\t\tvar argVals []string\n\t\tfor argIndex, arg := range arguments {\n\t\t\targVals = append(argVals, fmt.Sprintf(\"%d: %#v\", argIndex, arg))\n\t\t}\n\t\targValsString = fmt.Sprintf(\"\\n\\t\\t%s\", strings.Join(argVals, \"\\n\\t\\t\"))\n\t}\n\n\treturn fmt.Sprintf(\"%s(%s)%s\", method, arguments.String(), argValsString)\n}\n\n// Called tells the mock object that a method has been called, and gets an array\n// of arguments to return.  Panics if the call is unexpected (i.e. not preceded by\n// appropriate .On .Return() calls)\n// If Call.WaitFor is set, blocks until the channel is closed or receives a message.\nfunc (m *Mock) Called(arguments ...interface{}) Arguments {\n\t// get the calling function's name\n\tpc, _, _, ok := runtime.Caller(1)\n\tif !ok {\n\t\tpanic(\"Couldn't get the caller information\")\n\t}\n\tfunctionPath := runtime.FuncForPC(pc).Name()\n\t//Next four lines are required to use GCCGO function naming conventions.\n\t//For Ex:  github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock\n\t//uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree\n\t//With GCCGO we need to remove interface information starting from pN<dd>.\n\tre := regexp.MustCompile(\"\\\\.pN\\\\d+_\")\n\tif re.MatchString(functionPath) {\n\t\tfunctionPath = re.Split(functionPath, -1)[0]\n\t}\n\tparts := strings.Split(functionPath, \".\")\n\tfunctionName := parts[len(parts)-1]\n\treturn m.MethodCalled(functionName, arguments...)\n}\n\n// MethodCalled tells the mock object that the given method has been called, and gets\n// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded\n// by appropriate .On .Return() calls)\n// If Call.WaitFor is set, blocks until the channel is closed or receives a message.\nfunc (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments {\n\tm.mutex.Lock()\n\t//TODO: could combine expected and closes in single loop\n\tfound, call := m.findExpectedCall(methodName, arguments...)\n\n\tif found < 0 {\n\t\t// we have to fail here - because we don't know what to do\n\t\t// as the return arguments.  This is because:\n\t\t//\n\t\t//   a) this is a totally unexpected call to this method,\n\t\t//   b) the arguments are not what was expected, or\n\t\t//   c) the developer has forgotten to add an accompanying On...Return pair.\n\n\t\tclosestCall, mismatch := m.findClosestCall(methodName, arguments...)\n\t\tm.mutex.Unlock()\n\n\t\tif closestCall != nil {\n\t\t\tm.fail(\"\\n\\nmock: Unexpected Method Call\\n-----------------------------\\n\\n%s\\n\\nThe closest call I have is: \\n\\n%s\\n\\n%s\\nDiff: %s\",\n\t\t\t\tcallString(methodName, arguments, true),\n\t\t\t\tcallString(methodName, closestCall.Arguments, true),\n\t\t\t\tdiffArguments(closestCall.Arguments, arguments),\n\t\t\t\tstrings.TrimSpace(mismatch),\n\t\t\t)\n\t\t} else {\n\t\t\tm.fail(\"\\nassert: mock: I don't know what to return because the method call was unexpected.\\n\\tEither do Mock.On(\\\"%s\\\").Return(...) first, or remove the %s() call.\\n\\tThis method was unexpected:\\n\\t\\t%s\\n\\tat: %s\", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo())\n\t\t}\n\t}\n\n\tif call.Repeatability == 1 {\n\t\tcall.Repeatability = -1\n\t} else if call.Repeatability > 1 {\n\t\tcall.Repeatability--\n\t}\n\tcall.totalCalls++\n\n\t// add the call\n\tm.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...))\n\tm.mutex.Unlock()\n\n\t// block if specified\n\tif call.WaitFor != nil {\n\t\t<-call.WaitFor\n\t} else {\n\t\ttime.Sleep(call.waitTime)\n\t}\n\n\tm.mutex.Lock()\n\trunFn := call.RunFn\n\tm.mutex.Unlock()\n\n\tif runFn != nil {\n\t\trunFn(arguments)\n\t}\n\n\tm.mutex.Lock()\n\treturnArgs := call.ReturnArguments\n\tm.mutex.Unlock()\n\n\treturn returnArgs\n}\n\n/*\n\tAssertions\n*/\n\ntype assertExpectationser interface {\n\tAssertExpectations(TestingT) bool\n}\n\n// AssertExpectationsForObjects asserts that everything specified with On and Return\n// of the specified objects was in fact called as expected.\n//\n// Calls may have occurred in any order.\nfunc AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tfor _, obj := range testObjects {\n\t\tif m, ok := obj.(Mock); ok {\n\t\t\tt.Logf(\"Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)\")\n\t\t\tobj = &m\n\t\t}\n\t\tm := obj.(assertExpectationser)\n\t\tif !m.AssertExpectations(t) {\n\t\t\tt.Logf(\"Expectations didn't match for Mock: %+v\", reflect.TypeOf(m))\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// AssertExpectations asserts that everything specified with On and Return was\n// in fact called as expected.  Calls may have occurred in any order.\nfunc (m *Mock) AssertExpectations(t TestingT) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar somethingMissing bool\n\tvar failedExpectations int\n\n\t// iterate through each expectation\n\texpectedCalls := m.expectedCalls()\n\tfor _, expectedCall := range expectedCalls {\n\t\tif !expectedCall.optional && !m.methodWasCalled(expectedCall.Method, expectedCall.Arguments) && expectedCall.totalCalls == 0 {\n\t\t\tsomethingMissing = true\n\t\t\tfailedExpectations++\n\t\t\tt.Logf(\"FAIL:\\t%s(%s)\\n\\t\\tat: %s\", expectedCall.Method, expectedCall.Arguments.String(), expectedCall.callerInfo)\n\t\t} else {\n\t\t\tif expectedCall.Repeatability > 0 {\n\t\t\t\tsomethingMissing = true\n\t\t\t\tfailedExpectations++\n\t\t\t\tt.Logf(\"FAIL:\\t%s(%s)\\n\\t\\tat: %s\", expectedCall.Method, expectedCall.Arguments.String(), expectedCall.callerInfo)\n\t\t\t} else {\n\t\t\t\tt.Logf(\"PASS:\\t%s(%s)\", expectedCall.Method, expectedCall.Arguments.String())\n\t\t\t}\n\t\t}\n\t}\n\n\tif somethingMissing {\n\t\tt.Errorf(\"FAIL: %d out of %d expectation(s) were met.\\n\\tThe code you are testing needs to make %d more call(s).\\n\\tat: %s\", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo())\n\t}\n\n\treturn !somethingMissing\n}\n\n// AssertNumberOfCalls asserts that the method was called expectedCalls times.\nfunc (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tvar actualCalls int\n\tfor _, call := range m.calls() {\n\t\tif call.Method == methodName {\n\t\t\tactualCalls++\n\t\t}\n\t}\n\treturn assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf(\"Expected number of calls (%d) does not match the actual number of calls (%d).\", expectedCalls, actualCalls))\n}\n\n// AssertCalled asserts that the method was called.\n// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.\nfunc (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif !m.methodWasCalled(methodName, arguments) {\n\t\tvar calledWithArgs []string\n\t\tfor _, call := range m.calls() {\n\t\t\tcalledWithArgs = append(calledWithArgs, fmt.Sprintf(\"%v\", call.Arguments))\n\t\t}\n\t\tif len(calledWithArgs) == 0 {\n\t\t\treturn assert.Fail(t, \"Should have called with given arguments\",\n\t\t\t\tfmt.Sprintf(\"Expected %q to have been called with:\\n%v\\nbut no actual calls happened\", methodName, arguments))\n\t\t}\n\t\treturn assert.Fail(t, \"Should have called with given arguments\",\n\t\t\tfmt.Sprintf(\"Expected %q to have been called with:\\n%v\\nbut actual calls were:\\n        %v\", methodName, arguments, strings.Join(calledWithArgs, \"\\n\")))\n\t}\n\treturn true\n}\n\n// AssertNotCalled asserts that the method was not called.\n// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.\nfunc (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tif m.methodWasCalled(methodName, arguments) {\n\t\treturn assert.Fail(t, \"Should not have called with given arguments\",\n\t\t\tfmt.Sprintf(\"Expected %q to not have been called with:\\n%v\\nbut actually it was.\", methodName, arguments))\n\t}\n\treturn true\n}\n\nfunc (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool {\n\tfor _, call := range m.calls() {\n\t\tif call.Method == methodName {\n\n\t\t\t_, differences := Arguments(expected).Diff(call.Arguments)\n\n\t\t\tif differences == 0 {\n\t\t\t\t// found the expected call\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t}\n\t}\n\t// we didn't find the expected call\n\treturn false\n}\n\nfunc (m *Mock) expectedCalls() []*Call {\n\treturn append([]*Call{}, m.ExpectedCalls...)\n}\n\nfunc (m *Mock) calls() []Call {\n\treturn append([]Call{}, m.Calls...)\n}\n\n/*\n\tArguments\n*/\n\n// Arguments holds an array of method arguments or return values.\ntype Arguments []interface{}\n\nconst (\n\t// Anything is used in Diff and Assert when the argument being tested\n\t// shouldn't be taken into consideration.\n\tAnything = \"mock.Anything\"\n)\n\n// AnythingOfTypeArgument is a string that contains the type of an argument\n// for use when type checking.  Used in Diff and Assert.\ntype AnythingOfTypeArgument string\n\n// AnythingOfType returns an AnythingOfTypeArgument object containing the\n// name of the type to check for.  Used in Diff and Assert.\n//\n// For example:\n//\tAssert(t, AnythingOfType(\"string\"), AnythingOfType(\"int\"))\nfunc AnythingOfType(t string) AnythingOfTypeArgument {\n\treturn AnythingOfTypeArgument(t)\n}\n\n// argumentMatcher performs custom argument matching, returning whether or\n// not the argument is matched by the expectation fixture function.\ntype argumentMatcher struct {\n\t// fn is a function which accepts one argument, and returns a bool.\n\tfn reflect.Value\n}\n\nfunc (f argumentMatcher) Matches(argument interface{}) bool {\n\texpectType := f.fn.Type().In(0)\n\texpectTypeNilSupported := false\n\tswitch expectType.Kind() {\n\tcase reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr:\n\t\texpectTypeNilSupported = true\n\t}\n\n\targType := reflect.TypeOf(argument)\n\tvar arg reflect.Value\n\tif argType == nil {\n\t\targ = reflect.New(expectType).Elem()\n\t} else {\n\t\targ = reflect.ValueOf(argument)\n\t}\n\n\tif argType == nil && !expectTypeNilSupported {\n\t\tpanic(errors.New(\"attempting to call matcher with nil for non-nil expected type\"))\n\t}\n\tif argType == nil || argType.AssignableTo(expectType) {\n\t\tresult := f.fn.Call([]reflect.Value{arg})\n\t\treturn result[0].Bool()\n\t}\n\treturn false\n}\n\nfunc (f argumentMatcher) String() string {\n\treturn fmt.Sprintf(\"func(%s) bool\", f.fn.Type().In(0).Name())\n}\n\n// MatchedBy can be used to match a mock call based on only certain properties\n// from a complex struct or some calculation. It takes a function that will be\n// evaluated with the called argument and will return true when there's a match\n// and false otherwise.\n//\n// Example:\n// m.On(\"Do\", MatchedBy(func(req *http.Request) bool { return req.Host == \"example.com\" }))\n//\n// |fn|, must be a function accepting a single argument (of the expected type)\n// which returns a bool. If |fn| doesn't match the required signature,\n// MatchedBy() panics.\nfunc MatchedBy(fn interface{}) argumentMatcher {\n\tfnType := reflect.TypeOf(fn)\n\n\tif fnType.Kind() != reflect.Func {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s is not a func\", fn))\n\t}\n\tif fnType.NumIn() != 1 {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s does not take exactly one argument\", fn))\n\t}\n\tif fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: %s does not return a bool\", fn))\n\t}\n\n\treturn argumentMatcher{fn: reflect.ValueOf(fn)}\n}\n\n// Get Returns the argument at the specified index.\nfunc (args Arguments) Get(index int) interface{} {\n\tif index+1 > len(args) {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Cannot call Get(%d) because there are %d argument(s).\", index, len(args)))\n\t}\n\treturn args[index]\n}\n\n// Is gets whether the objects match the arguments specified.\nfunc (args Arguments) Is(objects ...interface{}) bool {\n\tfor i, obj := range args {\n\t\tif obj != objects[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// Diff gets a string describing the differences between the arguments\n// and the specified objects.\n//\n// Returns the diff string and number of differences found.\nfunc (args Arguments) Diff(objects []interface{}) (string, int) {\n\t//TODO: could return string as error and nil for No difference\n\n\tvar output = \"\\n\"\n\tvar differences int\n\n\tvar maxArgCount = len(args)\n\tif len(objects) > maxArgCount {\n\t\tmaxArgCount = len(objects)\n\t}\n\n\tfor i := 0; i < maxArgCount; i++ {\n\t\tvar actual, expected interface{}\n\n\t\tif len(objects) <= i {\n\t\t\tactual = \"(Missing)\"\n\t\t} else {\n\t\t\tactual = objects[i]\n\t\t}\n\n\t\tif len(args) <= i {\n\t\t\texpected = \"(Missing)\"\n\t\t} else {\n\t\t\texpected = args[i]\n\t\t}\n\n\t\tif matcher, ok := expected.(argumentMatcher); ok {\n\t\t\tif matcher.Matches(actual) {\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s matched by %s\\n\", output, i, actual, matcher)\n\t\t\t} else {\n\t\t\t\tdifferences++\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s not matched by %s\\n\", output, i, actual, matcher)\n\t\t\t}\n\t\t} else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() {\n\n\t\t\t// type checking\n\t\t\tif reflect.TypeOf(actual).Name() != string(expected.(AnythingOfTypeArgument)) && reflect.TypeOf(actual).String() != string(expected.(AnythingOfTypeArgument)) {\n\t\t\t\t// not match\n\t\t\t\tdifferences++\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  type %s != type %s - %s\\n\", output, i, expected, reflect.TypeOf(actual).Name(), actual)\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// normal checking\n\n\t\t\tif assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) {\n\t\t\t\t// match\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: PASS:  %s == %s\\n\", output, i, actual, expected)\n\t\t\t} else {\n\t\t\t\t// not match\n\t\t\t\tdifferences++\n\t\t\t\toutput = fmt.Sprintf(\"%s\\t%d: FAIL:  %s != %s\\n\", output, i, actual, expected)\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif differences == 0 {\n\t\treturn \"No differences.\", differences\n\t}\n\n\treturn output, differences\n\n}\n\n// Assert compares the arguments with the specified objects and fails if\n// they do not exactly match.\nfunc (args Arguments) Assert(t TestingT, objects ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\n\t// get the differences\n\tdiff, diffCount := args.Diff(objects)\n\n\tif diffCount == 0 {\n\t\treturn true\n\t}\n\n\t// there are differences... report them...\n\tt.Logf(diff)\n\tt.Errorf(\"%sArguments do not match.\", assert.CallerInfo())\n\n\treturn false\n\n}\n\n// String gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\n//\n// If no index is provided, String() returns a complete string representation\n// of the arguments.\nfunc (args Arguments) String(indexOrNil ...int) string {\n\n\tif len(indexOrNil) == 0 {\n\t\t// normal String() method - return a string representation of the args\n\t\tvar argsStr []string\n\t\tfor _, arg := range args {\n\t\t\targsStr = append(argsStr, fmt.Sprintf(\"%s\", reflect.TypeOf(arg)))\n\t\t}\n\t\treturn strings.Join(argsStr, \",\")\n\t} else if len(indexOrNil) == 1 {\n\t\t// Index has been specified - get the argument at that index\n\t\tvar index = indexOrNil[0]\n\t\tvar s string\n\t\tvar ok bool\n\t\tif s, ok = args.Get(index).(string); !ok {\n\t\t\tpanic(fmt.Sprintf(\"assert: arguments: String(%d) failed because object wasn't correct type: %s\", index, args.Get(index)))\n\t\t}\n\t\treturn s\n\t}\n\n\tpanic(fmt.Sprintf(\"assert: arguments: Wrong number of arguments passed to String.  Must be 0 or 1, not %d\", len(indexOrNil)))\n\n}\n\n// Int gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Int(index int) int {\n\tvar s int\n\tvar ok bool\n\tif s, ok = args.Get(index).(int); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Int(%d) failed because object wasn't correct type: %v\", index, args.Get(index)))\n\t}\n\treturn s\n}\n\n// Error gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Error(index int) error {\n\tobj := args.Get(index)\n\tvar s error\n\tvar ok bool\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif s, ok = obj.(error); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Error(%d) failed because object wasn't correct type: %v\", index, args.Get(index)))\n\t}\n\treturn s\n}\n\n// Bool gets the argument at the specified index. Panics if there is no argument, or\n// if the argument is of the wrong type.\nfunc (args Arguments) Bool(index int) bool {\n\tvar s bool\n\tvar ok bool\n\tif s, ok = args.Get(index).(bool); !ok {\n\t\tpanic(fmt.Sprintf(\"assert: arguments: Bool(%d) failed because object wasn't correct type: %v\", index, args.Get(index)))\n\t}\n\treturn s\n}\n\nfunc typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {\n\tt := reflect.TypeOf(v)\n\tk := t.Kind()\n\n\tif k == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tk = t.Kind()\n\t}\n\treturn t, k\n}\n\nfunc diffArguments(expected Arguments, actual Arguments) string {\n\tif len(expected) != len(actual) {\n\t\treturn fmt.Sprintf(\"Provided %v arguments, mocked for %v arguments\", len(expected), len(actual))\n\t}\n\n\tfor x := range expected {\n\t\tif diffString := diff(expected[x], actual[x]); diffString != \"\" {\n\t\t\treturn fmt.Sprintf(\"Difference found in argument %v:\\n\\n%s\", x, diffString)\n\t\t}\n\t}\n\n\treturn \"\"\n}\n\n// diff returns a diff of both values as long as both are of the same type and\n// are a struct, map, slice or array. Otherwise it returns an empty string.\nfunc diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array {\n\t\treturn \"\"\n\t}\n\n\te := spewConfig.Sdump(expected)\n\ta := spewConfig.Sdump(actual)\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA:        difflib.SplitLines(e),\n\t\tB:        difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile:   \"Actual\",\n\t\tToDate:   \"\",\n\t\tContext:  1,\n\t})\n\n\treturn diff\n}\n\nvar spewConfig = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n}\n\ntype tHelper interface {\n\tHelper()\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/mock/mock_test.go",
    "content": "package mock\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"sync\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\n/*\n\tTest objects\n*/\n\n// ExampleInterface represents an example interface.\ntype ExampleInterface interface {\n\tTheExampleMethod(a, b, c int) (int, error)\n}\n\n// TestExampleImplementation is a test implementation of ExampleInterface\ntype TestExampleImplementation struct {\n\tMock\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod(a, b, c int) (int, error) {\n\targs := i.Called(a, b, c)\n\treturn args.Int(0), errors.New(\"Whoops\")\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) {\n\ti.Called(yesorno)\n}\n\ntype ExampleType struct {\n\tran bool\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod3(et *ExampleType) error {\n\targs := i.Called(et)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod4(v ExampleInterface) error {\n\targs := i.Called(v)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod5(ch chan struct{}) error {\n\targs := i.Called(ch)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod6(m map[string]bool) error {\n\targs := i.Called(m)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethod7(slice []bool) error {\n\targs := i.Called(slice)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodFunc(fn func(string) error) error {\n\targs := i.Called(fn)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodVariadic(a ...int) error {\n\targs := i.Called(a)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodVariadicInterface(a ...interface{}) error {\n\targs := i.Called(a)\n\treturn args.Error(0)\n}\n\nfunc (i *TestExampleImplementation) TheExampleMethodMixedVariadic(a int, b ...int) error {\n\targs := i.Called(a, b)\n\treturn args.Error(0)\n}\n\ntype ExampleFuncType func(string) error\n\nfunc (i *TestExampleImplementation) TheExampleMethodFuncType(fn ExampleFuncType) error {\n\targs := i.Called(fn)\n\treturn args.Error(0)\n}\n\n// MockTestingT mocks a test struct\ntype MockTestingT struct {\n\tlogfCount, errorfCount, failNowCount int\n}\n\nconst mockTestingTFailNowCalled = \"FailNow was called\"\n\nfunc (m *MockTestingT) Logf(string, ...interface{}) {\n\tm.logfCount++\n}\n\nfunc (m *MockTestingT) Errorf(string, ...interface{}) {\n\tm.errorfCount++\n}\n\n// FailNow mocks the FailNow call.\n// It panics in order to mimic the FailNow behavior in the sense that\n// the execution stops.\n// When expecting this method, the call that invokes it should use the following code:\n//\n//     assert.PanicsWithValue(t, mockTestingTFailNowCalled, func() {...})\nfunc (m *MockTestingT) FailNow() {\n\tm.failNowCount++\n\n\t// this function should panic now to stop the execution as expected\n\tpanic(mockTestingTFailNowCalled)\n}\n\n/*\n\tMock\n*/\n\nfunc Test_Mock_TestData(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tif assert.NotNil(t, mockedService.TestData()) {\n\n\t\tmockedService.TestData().Set(\"something\", 123)\n\t\tassert.Equal(t, 123, mockedService.TestData().Get(\"something\").Data())\n\t}\n}\n\nfunc Test_Mock_On(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\")\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethod\", c.Method)\n}\n\nfunc Test_Mock_Chained_On(t *testing.T) {\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\t// determine our current line number so we can assert the expected calls callerInfo properly\n\t_, _, line, _ := runtime.Caller(0)\n\tmockedService.\n\t\tOn(\"TheExampleMethod\", 1, 2, 3).\n\t\tReturn(0).\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tReturn(nil)\n\n\texpectedCalls := []*Call{\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod\",\n\t\t\tArguments:       []interface{}{1, 2, 3},\n\t\t\tReturnArguments: []interface{}{0},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"mock_test.go:%d\", line+2)},\n\t\t},\n\t\t{\n\t\t\tParent:          &mockedService.Mock,\n\t\t\tMethod:          \"TheExampleMethod3\",\n\t\t\tArguments:       []interface{}{AnythingOfType(\"*mock.ExampleType\")},\n\t\t\tReturnArguments: []interface{}{nil},\n\t\t\tcallerInfo:      []string{fmt.Sprintf(\"mock_test.go:%d\", line+4)},\n\t\t},\n\t}\n\tassert.Equal(t, expectedCalls, mockedService.ExpectedCalls)\n}\n\nfunc Test_Mock_On_WithArgs(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\", 1, 2, 3, 4)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethod\", c.Method)\n\tassert.Equal(t, Arguments{1, 2, 3, 4}, c.Arguments)\n}\n\nfunc Test_Mock_On_WithFuncArg(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodFunc\", AnythingOfType(\"func(string) error\")).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, \"TheExampleMethodFunc\", c.Method)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, AnythingOfType(\"func(string) error\"), c.Arguments[0])\n\n\tfn := func(string) error { return nil }\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodFunc(fn)\n\t})\n}\n\nfunc Test_Mock_On_WithIntArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod\",\n\t\tMatchedBy(func(a int) bool {\n\t\t\treturn a == 1\n\t\t}), MatchedBy(func(b int) bool {\n\t\t\treturn b == 2\n\t\t}), MatchedBy(func(c int) bool {\n\t\t\treturn c == 3\n\t\t})).Return(0, nil)\n\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 4)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(2, 2, 3)\n\t})\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n}\n\nfunc TestMock_WithTest(t *testing.T) {\n\tvar (\n\t\tmockedService TestExampleImplementation\n\t\tmockedTest    MockTestingT\n\t)\n\n\tmockedService.Test(&mockedTest)\n\tmockedService.On(\"TheExampleMethod\", 1, 2, 3).Return(0, nil)\n\n\t// Test that on an expected call, the test was not failed\n\n\tmockedService.TheExampleMethod(1, 2, 3)\n\n\t// Assert that Errorf and FailNow were not called\n\tassert.Equal(t, 0, mockedTest.errorfCount)\n\tassert.Equal(t, 0, mockedTest.failNowCount)\n\n\t// Test that on unexpected call, the mocked test was called to fail the test\n\n\tassert.PanicsWithValue(t, mockTestingTFailNowCalled, func() {\n\t\tmockedService.TheExampleMethod(1, 1, 1)\n\t})\n\n\t// Assert that Errorf and FailNow were called once\n\tassert.Equal(t, 1, mockedTest.errorfCount)\n\tassert.Equal(t, 1, mockedTest.failNowCount)\n}\n\nfunc Test_Mock_On_WithPtrArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == true }),\n\t).Return(nil)\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == false }),\n\t).Return(errors.New(\"error\"))\n\n\tmockedService.On(\"TheExampleMethod3\",\n\t\tMatchedBy(func(a *ExampleType) bool { return a == nil }),\n\t).Return(errors.New(\"error2\"))\n\n\tassert.Equal(t, mockedService.TheExampleMethod3(&ExampleType{true}), nil)\n\tassert.EqualError(t, mockedService.TheExampleMethod3(&ExampleType{false}), \"error\")\n\tassert.EqualError(t, mockedService.TheExampleMethod3(nil), \"error2\")\n}\n\nfunc Test_Mock_On_WithFuncArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tfixture1, fixture2 := errors.New(\"fixture1\"), errors.New(\"fixture2\")\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a != nil && a(\"string\") == fixture1 }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a != nil && a(\"string\") == fixture2 }),\n\t).Return(errors.New(\"fixture2\"))\n\n\tmockedService.On(\"TheExampleMethodFunc\",\n\t\tMatchedBy(func(a func(string) error) bool { return a == nil }),\n\t).Return(errors.New(\"fixture3\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(\n\t\tfunc(string) error { return fixture1 }), \"fixture1\")\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(\n\t\tfunc(string) error { return fixture2 }), \"fixture2\")\n\tassert.EqualError(t, mockedService.TheExampleMethodFunc(nil), \"fixture3\")\n}\n\nfunc Test_Mock_On_WithInterfaceArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod4\",\n\t\tMatchedBy(func(a ExampleInterface) bool { return a == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod4(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithChannelArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod5\",\n\t\tMatchedBy(func(ch chan struct{}) bool { return ch == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod5(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithMapArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod6\",\n\t\tMatchedBy(func(m map[string]bool) bool { return m == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod6(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithSliceArgMatcher(t *testing.T) {\n\tvar mockedService TestExampleImplementation\n\n\tmockedService.On(\"TheExampleMethod7\",\n\t\tMatchedBy(func(slice []bool) bool { return slice == nil }),\n\t).Return(errors.New(\"fixture1\"))\n\n\tassert.EqualError(t, mockedService.TheExampleMethod7(nil), \"fixture1\")\n}\n\nfunc Test_Mock_On_WithVariadicFunc(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodVariadic\", []int{1, 2, 3}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, []int{1, 2, 3}, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadic(1, 2, 3)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadic(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithMixedVariadicFunc(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodMixedVariadic\", 1, []int{2, 3, 4}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 2, len(c.Arguments))\n\tassert.Equal(t, 1, c.Arguments[0])\n\tassert.Equal(t, []int{2, 3, 4}, c.Arguments[1])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodMixedVariadic(1, 2, 3, 4)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodMixedVariadic(1, 2, 3, 5)\n\t})\n\n}\n\nfunc Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethodVariadicInterface\", []interface{}{1, 2, 3}).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, []interface{}{1, 2, 3}, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2, 3)\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tvar expected []interface{}\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodVariadicInterface\", expected).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, expected, c.Arguments[0])\n\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface()\n\t})\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethodVariadicInterface(1, 2)\n\t})\n\n}\n\nfunc Test_Mock_On_WithFuncPanics(t *testing.T) {\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tassert.Panics(t, func() {\n\t\tmockedService.On(\"TheExampleMethodFunc\", func(string) error { return nil })\n\t})\n}\n\nfunc Test_Mock_On_WithFuncTypeArg(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethodFuncType\", AnythingOfType(\"mock.ExampleFuncType\")).\n\t\tReturn(nil)\n\n\tassert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\tassert.Equal(t, 1, len(c.Arguments))\n\tassert.Equal(t, AnythingOfType(\"mock.ExampleFuncType\"), c.Arguments[0])\n\n\tfn := func(string) error { return nil }\n\tassert.NotPanics(t, func() {\n\t\tmockedService.TheExampleMethodFuncType(fn)\n\t})\n}\n\nfunc Test_Mock_Return(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_WaitUntil(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\tch := time.After(time.Second)\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tWaitUntil(ch).\n\t\tReturn(1, \"two\", true)\n\n\t// assert that the call was created\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.Equal(t, ch, call.WaitFor)\n}\n\nfunc Test_Mock_Return_After(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tAfter(time.Second)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\n}\n\nfunc Test_Mock_Return_Run(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tfn := func(args Arguments) {\n\t\targ := args.Get(0).(*ExampleType)\n\t\targ.ran = true\n\t}\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tReturn(nil).\n\t\tRun(fn)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod3\", call.Method)\n\tassert.Equal(t, AnythingOfType(\"*mock.ExampleType\"), call.Arguments[0])\n\tassert.Equal(t, nil, call.ReturnArguments[0])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\tassert.NotNil(t, call.Run)\n\n\tet := ExampleType{}\n\tassert.Equal(t, false, et.ran)\n\tmockedService.TheExampleMethod3(&et)\n\tassert.Equal(t, true, et.ran)\n}\n\nfunc Test_Mock_Return_Run_Out_Of_Order(t *testing.T) {\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\tf := func(args Arguments) {\n\t\targ := args.Get(0).(*ExampleType)\n\t\targ.ran = true\n\t}\n\n\tc := mockedService.Mock.\n\t\tOn(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).\n\t\tRun(f).\n\t\tReturn(nil)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.Mock.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod3\", call.Method)\n\tassert.Equal(t, AnythingOfType(\"*mock.ExampleType\"), call.Arguments[0])\n\tassert.Equal(t, nil, call.ReturnArguments[0])\n\tassert.Equal(t, 0, call.Repeatability)\n\tassert.NotEqual(t, nil, call.WaitFor)\n\tassert.NotNil(t, call.Run)\n}\n\nfunc Test_Mock_Return_Once(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.On(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tOnce()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 1, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Twice(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tTwice()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 2, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Times(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn(1, \"two\", true).\n\t\tTimes(5)\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 1, call.ReturnArguments[0])\n\tassert.Equal(t, \"two\", call.ReturnArguments[1])\n\tassert.Equal(t, true, call.ReturnArguments[2])\n\tassert.Equal(t, 5, call.Repeatability)\n\tassert.Nil(t, call.WaitFor)\n}\n\nfunc Test_Mock_Return_Nothing(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tc := mockedService.\n\t\tOn(\"TheExampleMethod\", \"A\", \"B\", true).\n\t\tReturn()\n\n\trequire.Equal(t, []*Call{c}, mockedService.ExpectedCalls)\n\n\tcall := mockedService.ExpectedCalls[0]\n\n\tassert.Equal(t, \"TheExampleMethod\", call.Method)\n\tassert.Equal(t, \"A\", call.Arguments[0])\n\tassert.Equal(t, \"B\", call.Arguments[1])\n\tassert.Equal(t, true, call.Arguments[2])\n\tassert.Equal(t, 0, len(call.ReturnArguments))\n}\n\nfunc Test_Mock_findExpectedCall(t *testing.T) {\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\")\n\tm.On(\"Two\", 3).Return(\"three\")\n\n\tf, c := m.findExpectedCall(\"Two\", 3)\n\n\tif assert.Equal(t, 2, f) {\n\t\tif assert.NotNil(t, c) {\n\t\t\tassert.Equal(t, \"Two\", c.Method)\n\t\t\tassert.Equal(t, 3, c.Arguments[0])\n\t\t\tassert.Equal(t, \"three\", c.ReturnArguments[0])\n\t\t}\n\t}\n\n}\n\nfunc Test_Mock_findExpectedCall_For_Unknown_Method(t *testing.T) {\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\")\n\tm.On(\"Two\", 3).Return(\"three\")\n\n\tf, _ := m.findExpectedCall(\"Two\")\n\n\tassert.Equal(t, -1, f)\n\n}\n\nfunc Test_Mock_findExpectedCall_Respects_Repeatability(t *testing.T) {\n\n\tm := new(Mock)\n\tm.On(\"One\", 1).Return(\"one\")\n\tm.On(\"Two\", 2).Return(\"two\").Once()\n\tm.On(\"Two\", 3).Return(\"three\").Twice()\n\tm.On(\"Two\", 3).Return(\"three\").Times(8)\n\n\tf, c := m.findExpectedCall(\"Two\", 3)\n\n\tif assert.Equal(t, 2, f) {\n\t\tif assert.NotNil(t, c) {\n\t\t\tassert.Equal(t, \"Two\", c.Method)\n\t\t\tassert.Equal(t, 3, c.Arguments[0])\n\t\t\tassert.Equal(t, \"three\", c.ReturnArguments[0])\n\t\t}\n\t}\n\n}\n\nfunc Test_callString(t *testing.T) {\n\n\tassert.Equal(t, `Method(int,bool,string)`, callString(\"Method\", []interface{}{1, true, \"something\"}, false))\n\n}\n\nfunc Test_Mock_Called(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_Called\", 1, 2, 3).Return(5, \"6\", true)\n\n\treturnArguments := mockedService.Called(1, 2, 3)\n\n\tif assert.Equal(t, 1, len(mockedService.Calls)) {\n\t\tassert.Equal(t, \"Test_Mock_Called\", mockedService.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[0].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments)) {\n\t\tassert.Equal(t, 5, returnArguments[0])\n\t\tassert.Equal(t, \"6\", returnArguments[1])\n\t\tassert.Equal(t, true, returnArguments[2])\n\t}\n\n}\n\nfunc asyncCall(m *Mock, ch chan Arguments) {\n\tch <- m.Called(1, 2, 3)\n}\n\nfunc Test_Mock_Called_blocks(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.Mock.On(\"asyncCall\", 1, 2, 3).Return(5, \"6\", true).After(2 * time.Millisecond)\n\n\tch := make(chan Arguments)\n\n\tgo asyncCall(&mockedService.Mock, ch)\n\n\tselect {\n\tcase <-ch:\n\t\tt.Fatal(\"should have waited\")\n\tcase <-time.After(1 * time.Millisecond):\n\t}\n\n\treturnArguments := <-ch\n\n\tif assert.Equal(t, 1, len(mockedService.Mock.Calls)) {\n\t\tassert.Equal(t, \"asyncCall\", mockedService.Mock.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Mock.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Mock.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Mock.Calls[0].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments)) {\n\t\tassert.Equal(t, 5, returnArguments[0])\n\t\tassert.Equal(t, \"6\", returnArguments[1])\n\t\tassert.Equal(t, true, returnArguments[2])\n\t}\n\n}\n\nfunc Test_Mock_Called_For_Bounded_Repeatability(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.\n\t\tOn(\"Test_Mock_Called_For_Bounded_Repeatability\", 1, 2, 3).\n\t\tReturn(5, \"6\", true).\n\t\tOnce()\n\tmockedService.\n\t\tOn(\"Test_Mock_Called_For_Bounded_Repeatability\", 1, 2, 3).\n\t\tReturn(-1, \"hi\", false)\n\n\treturnArguments1 := mockedService.Called(1, 2, 3)\n\treturnArguments2 := mockedService.Called(1, 2, 3)\n\n\tif assert.Equal(t, 2, len(mockedService.Calls)) {\n\t\tassert.Equal(t, \"Test_Mock_Called_For_Bounded_Repeatability\", mockedService.Calls[0].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[0].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[0].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[0].Arguments[2])\n\n\t\tassert.Equal(t, \"Test_Mock_Called_For_Bounded_Repeatability\", mockedService.Calls[1].Method)\n\t\tassert.Equal(t, 1, mockedService.Calls[1].Arguments[0])\n\t\tassert.Equal(t, 2, mockedService.Calls[1].Arguments[1])\n\t\tassert.Equal(t, 3, mockedService.Calls[1].Arguments[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments1)) {\n\t\tassert.Equal(t, 5, returnArguments1[0])\n\t\tassert.Equal(t, \"6\", returnArguments1[1])\n\t\tassert.Equal(t, true, returnArguments1[2])\n\t}\n\n\tif assert.Equal(t, 3, len(returnArguments2)) {\n\t\tassert.Equal(t, -1, returnArguments2[0])\n\t\tassert.Equal(t, \"hi\", returnArguments2[1])\n\t\tassert.Equal(t, false, returnArguments2[2])\n\t}\n\n}\n\nfunc Test_Mock_Called_For_SetTime_Expectation(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethod\", 1, 2, 3).Return(5, \"6\", true).Times(4)\n\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tmockedService.TheExampleMethod(1, 2, 3)\n\tassert.Panics(t, func() {\n\t\tmockedService.TheExampleMethod(1, 2, 3)\n\t})\n\n}\n\nfunc Test_Mock_Called_Unexpected(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\t// make sure it panics if no expectation was made\n\tassert.Panics(t, func() {\n\t\tmockedService.Called(1, 2, 3)\n\t}, \"Calling unexpected method should panic\")\n\n}\n\nfunc Test_AssertExpectationsForObjects_Helper(t *testing.T) {\n\n\tvar mockedService1 = new(TestExampleImplementation)\n\tvar mockedService2 = new(TestExampleImplementation)\n\tvar mockedService3 = new(TestExampleImplementation)\n\n\tmockedService1.On(\"Test_AssertExpectationsForObjects_Helper\", 1).Return()\n\tmockedService2.On(\"Test_AssertExpectationsForObjects_Helper\", 2).Return()\n\tmockedService3.On(\"Test_AssertExpectationsForObjects_Helper\", 3).Return()\n\n\tmockedService1.Called(1)\n\tmockedService2.Called(2)\n\tmockedService3.Called(3)\n\n\tassert.True(t, AssertExpectationsForObjects(t, &mockedService1.Mock, &mockedService2.Mock, &mockedService3.Mock))\n\tassert.True(t, AssertExpectationsForObjects(t, mockedService1, mockedService2, mockedService3))\n\n}\n\nfunc Test_AssertExpectationsForObjects_Helper_Failed(t *testing.T) {\n\n\tvar mockedService1 = new(TestExampleImplementation)\n\tvar mockedService2 = new(TestExampleImplementation)\n\tvar mockedService3 = new(TestExampleImplementation)\n\n\tmockedService1.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 1).Return()\n\tmockedService2.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 2).Return()\n\tmockedService3.On(\"Test_AssertExpectationsForObjects_Helper_Failed\", 3).Return()\n\n\tmockedService1.Called(1)\n\tmockedService3.Called(3)\n\n\ttt := new(testing.T)\n\tassert.False(t, AssertExpectationsForObjects(tt, &mockedService1.Mock, &mockedService2.Mock, &mockedService3.Mock))\n\tassert.False(t, AssertExpectationsForObjects(tt, mockedService1, mockedService2, mockedService3))\n\n}\n\nfunc Test_Mock_AssertExpectations(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations\", 1, 2, 3).Return(5, 6, 7)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_Placeholder_NoArgs(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder_NoArgs\").Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder_NoArgs\").Return(7, 6, 5)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called()\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_Placeholder(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder\", 1, 2, 3).Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertExpectations_Placeholder\", 3, 2, 1).Return(7, 6, 5)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make call to the second expectation\n\tmockedService.Called(3, 2, 1)\n\n\t// now assert expectations again\n\tassert.True(t, mockedService.AssertExpectations(tt))\n}\n\nfunc Test_Mock_AssertExpectations_With_Pointers(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Pointers\", &struct{ Foo int }{1}).Return(1)\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Pointers\", &struct{ Foo int }{2}).Return(2)\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\ts := struct{ Foo int }{1}\n\t// make the calls now\n\tmockedService.Called(&s)\n\ts.Foo = 2\n\tmockedService.Called(&s)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectationsCustomType(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"TheExampleMethod3\", AnythingOfType(\"*mock.ExampleType\")).Return(nil).Once()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.TheExampleMethod3(&ExampleType{})\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_AssertExpectations_With_Repeatability(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertExpectations_With_Repeatability\", 1, 2, 3).Return(5, 6, 7).Twice()\n\n\ttt := new(testing.T)\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\t// make the call now\n\tmockedService.Called(1, 2, 3)\n\n\tassert.False(t, mockedService.AssertExpectations(tt))\n\n\tmockedService.Called(1, 2, 3)\n\n\t// now assert expectations\n\tassert.True(t, mockedService.AssertExpectations(tt))\n\n}\n\nfunc Test_Mock_TwoCallsWithDifferentArguments(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_TwoCallsWithDifferentArguments\", 1, 2, 3).Return(5, 6, 7)\n\tmockedService.On(\"Test_Mock_TwoCallsWithDifferentArguments\", 4, 5, 6).Return(5, 6, 7)\n\n\targs1 := mockedService.Called(1, 2, 3)\n\tassert.Equal(t, 5, args1.Int(0))\n\tassert.Equal(t, 6, args1.Int(1))\n\tassert.Equal(t, 7, args1.Int(2))\n\n\targs2 := mockedService.Called(4, 5, 6)\n\tassert.Equal(t, 5, args2.Int(0))\n\tassert.Equal(t, 6, args2.Int(1))\n\tassert.Equal(t, 7, args2.Int(2))\n\n}\n\nfunc Test_Mock_AssertNumberOfCalls(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertNumberOfCalls\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\tassert.True(t, mockedService.AssertNumberOfCalls(t, \"Test_Mock_AssertNumberOfCalls\", 1))\n\n\tmockedService.Called(1, 2, 3)\n\tassert.True(t, mockedService.AssertNumberOfCalls(t, \"Test_Mock_AssertNumberOfCalls\", 2))\n\n}\n\nfunc Test_Mock_AssertCalled(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\tassert.True(t, mockedService.AssertCalled(t, \"Test_Mock_AssertCalled\", 1, 2, 3))\n\n}\n\nfunc Test_Mock_AssertCalled_WithAnythingOfTypeArgument(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.\n\t\tOn(\"Test_Mock_AssertCalled_WithAnythingOfTypeArgument\", Anything, Anything, Anything).\n\t\tReturn()\n\n\tmockedService.Called(1, \"two\", []uint8(\"three\"))\n\n\tassert.True(t, mockedService.AssertCalled(t, \"Test_Mock_AssertCalled_WithAnythingOfTypeArgument\", AnythingOfType(\"int\"), AnythingOfType(\"string\"), AnythingOfType(\"[]uint8\")))\n\n}\n\nfunc Test_Mock_AssertCalled_WithArguments(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\ttt := new(testing.T)\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments\", 1, 2, 3))\n\tassert.False(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments\", 2, 3, 4))\n\n}\n\nfunc Test_Mock_AssertCalled_WithArguments_With_Repeatability(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 1, 2, 3).Return(5, 6, 7).Once()\n\tmockedService.On(\"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 2, 3, 4).Return(5, 6, 7).Once()\n\n\tmockedService.Called(1, 2, 3)\n\tmockedService.Called(2, 3, 4)\n\n\ttt := new(testing.T)\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 1, 2, 3))\n\tassert.True(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 2, 3, 4))\n\tassert.False(t, mockedService.AssertCalled(tt, \"Test_Mock_AssertCalled_WithArguments_With_Repeatability\", 3, 4, 5))\n\n}\n\nfunc Test_Mock_AssertNotCalled(t *testing.T) {\n\n\tvar mockedService = new(TestExampleImplementation)\n\n\tmockedService.On(\"Test_Mock_AssertNotCalled\", 1, 2, 3).Return(5, 6, 7)\n\n\tmockedService.Called(1, 2, 3)\n\n\tassert.True(t, mockedService.AssertNotCalled(t, \"Test_Mock_NotCalled\"))\n\n}\n\nfunc Test_Mock_AssertOptional(t *testing.T) {\n\t// Optional called\n\tvar ms1 = new(TestExampleImplementation)\n\tms1.On(\"TheExampleMethod\", 1, 2, 3).Maybe().Return(4, nil)\n\tms1.TheExampleMethod(1, 2, 3)\n\n\ttt1 := new(testing.T)\n\tassert.Equal(t, true, ms1.AssertExpectations(tt1))\n\n\t// Optional not called\n\tvar ms2 = new(TestExampleImplementation)\n\tms2.On(\"TheExampleMethod\", 1, 2, 3).Maybe().Return(4, nil)\n\n\ttt2 := new(testing.T)\n\tassert.Equal(t, true, ms2.AssertExpectations(tt2))\n\n\t// Non-optional called\n\tvar ms3 = new(TestExampleImplementation)\n\tms3.On(\"TheExampleMethod\", 1, 2, 3).Return(4, nil)\n\tms3.TheExampleMethod(1, 2, 3)\n\n\ttt3 := new(testing.T)\n\tassert.Equal(t, true, ms3.AssertExpectations(tt3))\n}\n\n/*\n\tArguments helper methods\n*/\nfunc Test_Arguments_Get(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, \"string\", args.Get(0).(string))\n\tassert.Equal(t, 123, args.Get(1).(int))\n\tassert.Equal(t, true, args.Get(2).(bool))\n\n}\n\nfunc Test_Arguments_Is(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.True(t, args.Is(\"string\", 123, true))\n\tassert.False(t, args.Is(\"wrong\", 456, false))\n\n}\n\nfunc Test_Arguments_Diff(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"Hello World\", 123, true})\n\tvar diff string\n\tvar count int\n\tdiff, count = args.Diff([]interface{}{\"Hello World\", 456, \"false\"})\n\n\tassert.Equal(t, 2, count)\n\tassert.Contains(t, diff, `%!s(int=456) != %!s(int=123)`)\n\tassert.Contains(t, diff, `false != %!s(bool=true)`)\n\n}\n\nfunc Test_Arguments_Diff_DifferentNumberOfArgs(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tvar diff string\n\tvar count int\n\tdiff, count = args.Diff([]interface{}{\"string\", 456, \"false\", \"extra\"})\n\n\tassert.Equal(t, 3, count)\n\tassert.Contains(t, diff, `extra != (Missing)`)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingArgument(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", Anything, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingArgument_InActualToo(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", Anything, true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingOfTypeArgument(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", AnythingOfType(\"int\"), true})\n\tvar count int\n\t_, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 0, count)\n\n}\n\nfunc Test_Arguments_Diff_WithAnythingOfTypeArgument_Failing(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", AnythingOfType(\"string\"), true})\n\tvar count int\n\tvar diff string\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, true})\n\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `string != type int - %!s(int=123)`)\n\n}\n\nfunc Test_Arguments_Diff_WithArgMatcher(t *testing.T) {\n\tmatchFn := func(a int) bool {\n\t\treturn a == 123\n\t}\n\tvar args = Arguments([]interface{}{\"string\", MatchedBy(matchFn), true})\n\n\tdiff, count := args.Diff([]interface{}{\"string\", 124, true})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `%!s(int=124) not matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", false, true})\n\tassert.Equal(t, 1, count)\n\tassert.Contains(t, diff, `%!s(bool=false) not matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, false})\n\tassert.Contains(t, diff, `%!s(int=123) matched by func(int) bool`)\n\n\tdiff, count = args.Diff([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, 0, count)\n\tassert.Contains(t, diff, `No differences.`)\n}\n\nfunc Test_Arguments_Assert(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\n\tassert.True(t, args.Assert(t, \"string\", 123, true))\n\n}\n\nfunc Test_Arguments_String_Representation(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, `string,int,bool`, args.String())\n\n}\n\nfunc Test_Arguments_String(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, \"string\", args.String(0))\n\n}\n\nfunc Test_Arguments_Error(t *testing.T) {\n\n\tvar err = errors.New(\"An Error\")\n\tvar args = Arguments([]interface{}{\"string\", 123, true, err})\n\tassert.Equal(t, err, args.Error(3))\n\n}\n\nfunc Test_Arguments_Error_Nil(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true, nil})\n\tassert.Equal(t, nil, args.Error(3))\n\n}\n\nfunc Test_Arguments_Int(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, 123, args.Int(1))\n\n}\n\nfunc Test_Arguments_Bool(t *testing.T) {\n\n\tvar args = Arguments([]interface{}{\"string\", 123, true})\n\tassert.Equal(t, true, args.Bool(2))\n\n}\n\nfunc Test_WaitUntil_Parallel(t *testing.T) {\n\n\t// make a test impl object\n\tvar mockedService = new(TestExampleImplementation)\n\n\tch1 := make(chan time.Time)\n\tch2 := make(chan time.Time)\n\n\tmockedService.Mock.On(\"TheExampleMethod2\", true).Return().WaitUntil(ch2).Run(func(args Arguments) {\n\t\tch1 <- time.Now()\n\t})\n\n\tmockedService.Mock.On(\"TheExampleMethod2\", false).Return().WaitUntil(ch1)\n\n\t// Lock both goroutines on the .WaitUntil method\n\tgo func() {\n\t\tmockedService.TheExampleMethod2(false)\n\t}()\n\tgo func() {\n\t\tmockedService.TheExampleMethod2(true)\n\t}()\n\n\t// Allow the first call to execute, so the second one executes afterwards\n\tch2 <- time.Now()\n}\n\nfunc Test_MockMethodCalled(t *testing.T) {\n\tm := new(Mock)\n\tm.On(\"foo\", \"hello\").Return(\"world\")\n\n\tretArgs := m.MethodCalled(\"foo\", \"hello\")\n\trequire.True(t, len(retArgs) == 1)\n\trequire.Equal(t, \"world\", retArgs[0])\n\tm.AssertExpectations(t)\n}\n\n// Test to validate fix for racy concurrent call access in MethodCalled()\nfunc Test_MockReturnAndCalledConcurrent(t *testing.T) {\n\titerations := 1000\n\tm := &Mock{}\n\tcall := m.On(\"ConcurrencyTestMethod\")\n\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\n\tgo func() {\n\t\tfor i := 0; i < iterations; i++ {\n\t\t\tcall.Return(10)\n\t\t}\n\t\twg.Done()\n\t}()\n\tgo func() {\n\t\tfor i := 0; i < iterations; i++ {\n\t\t\tConcurrencyTestMethod(m)\n\t\t}\n\t\twg.Done()\n\t}()\n\twg.Wait()\n}\n\ntype timer struct{ Mock }\n\nfunc (s *timer) GetTime(i int) string {\n\treturn s.Called(i).Get(0).(string)\n}\n\ntype tCustomLogger struct {\n\t*testing.T\n\tlogs []string\n\terrs []string\n}\n\nfunc (tc *tCustomLogger) Logf(format string, args ...interface{}) {\n\ttc.T.Logf(format, args...)\n\ttc.logs = append(tc.logs, fmt.Sprintf(format, args...))\n}\n\nfunc (tc *tCustomLogger) Errorf(format string, args ...interface{}) {\n\ttc.errs = append(tc.errs, fmt.Sprintf(format, args...))\n}\n\nfunc (tc *tCustomLogger) FailNow() {}\n\nfunc TestLoggingAssertExpectations(t *testing.T) {\n\tm := new(timer)\n\tm.On(\"GetTime\", 0).Return(\"\")\n\ttcl := &tCustomLogger{t, []string{}, []string{}}\n\n\tAssertExpectationsForObjects(tcl, m, new(TestExampleImplementation))\n\n\trequire.Equal(t, 1, len(tcl.errs))\n\tassert.Regexp(t, regexp.MustCompile(\"(?s)FAIL: 0 out of 1 expectation\\\\(s\\\\) were met.*The code you are testing needs to make 1 more call\\\\(s\\\\).*\"), tcl.errs[0])\n\trequire.Equal(t, 2, len(tcl.logs))\n\tassert.Regexp(t, regexp.MustCompile(\"(?s)FAIL:\\tGetTime\\\\(int\\\\).*\"), tcl.logs[0])\n\trequire.Equal(t, \"Expectations didn't match for Mock: *mock.timer\", tcl.logs[1])\n}\n\nfunc TestAfterTotalWaitTimeWhileExecution(t *testing.T) {\n\twaitDuration := 1\n\ttotal, waitMs := 5, time.Millisecond*time.Duration(waitDuration)\n\taTimer := new(timer)\n\tfor i := 0; i < total; i++ {\n\t\taTimer.On(\"GetTime\", i).After(waitMs).Return(fmt.Sprintf(\"Time%d\", i)).Once()\n\t}\n\ttime.Sleep(waitMs)\n\tstart := time.Now()\n\tvar results []string\n\n\tfor i := 0; i < total; i++ {\n\t\tresults = append(results, aTimer.GetTime(i))\n\t}\n\n\tend := time.Now()\n\telapsedTime := end.Sub(start)\n\tassert.True(t, elapsedTime > waitMs, fmt.Sprintf(\"Total elapsed time:%v should be atleast greater than %v\", elapsedTime, waitMs))\n\tassert.Equal(t, total, len(results))\n\tfor i := range results {\n\t\tassert.Equal(t, fmt.Sprintf(\"Time%d\", i), results[i], \"Return value of method should be same\")\n\t}\n}\n\nfunc TestArgumentMatcherToPrintMismatch(t *testing.T) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(\n\t\t\t\t`\\s+mock: Unexpected Method Call\\s+-*\\s+GetTime\\(int\\)\\s+0: 1\\s+The closest call I have is:\\s+GetTime\\(mock.argumentMatcher\\)\\s+0: mock.argumentMatcher\\{.*?\\}\\s+Diff:.*\\(int=1\\) not matched by func\\(int\\) bool`)\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(timer)\n\tm.On(\"GetTime\", MatchedBy(func(i int) bool { return false })).Return(\"SomeTime\").Once()\n\n\tres := m.GetTime(1)\n\trequire.Equal(t, \"SomeTime\", res)\n\tm.AssertExpectations(t)\n}\n\nfunc TestClosestCallMismatchedArgumentInformationShowsTheClosest(t *testing.T) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod(int,int,int)`, `0: 1\\s+1: 1\\s+2: 2`, `0: 1\\s+1: 1\\s+2: 1`, `0: PASS:  %!s\\(int=1\\) == %!s\\(int=1\\)\\s+1: PASS:  %!s\\(int=1\\) == %!s\\(int=1\\)\\s+2: FAIL:  %!s\\(int=2\\) != %!s\\(int=1\\)`))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(TestExampleImplementation)\n\tm.On(\"TheExampleMethod\", 1, 1, 1).Return(1, nil).Once()\n\tm.On(\"TheExampleMethod\", 2, 2, 2).Return(2, nil).Once()\n\n\tm.TheExampleMethod(1, 1, 2)\n}\n\nfunc TestClosestCallMismatchedArgumentValueInformation(t *testing.T) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tmatchingExp := regexp.MustCompile(unexpectedCallRegex(`GetTime(int)`, \"0: 1\", \"0: 999\", `0: FAIL:  %!s\\(int=1\\) != %!s\\(int=999\\)`))\n\t\t\tassert.Regexp(t, matchingExp, r)\n\t\t}\n\t}()\n\n\tm := new(timer)\n\tm.On(\"GetTime\", 999).Return(\"SomeTime\").Once()\n\n\t_ = m.GetTime(1)\n}\n\nfunc unexpectedCallRegex(method, calledArg, expectedArg, diff string) string {\n\trMethod := regexp.QuoteMeta(method)\n\treturn fmt.Sprintf(`\\s+mock: Unexpected Method Call\\s+-*\\s+%s\\s+%s\\s+The closest call I have is:\\s+%s\\s+%s\\s+Diff: %s`,\n\t\trMethod, calledArg, rMethod, expectedArg, diff)\n}\n\nfunc ConcurrencyTestMethod(m *Mock) {\n\tm.Called()\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/package_test.go",
    "content": "package testify\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestImports(t *testing.T) {\n\tif assert.Equal(t, 1, 1) != true {\n\t\tt.Error(\"Something is wrong.\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/doc.go",
    "content": "// Package require implements the same assertions as the `assert` package but\n// stops test execution when a test fails.\n//\n// Example Usage\n//\n// The following is a complete example using require in a standard test function:\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/require\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      require.Equal(t, a, b, \"The two words should be the same.\")\n//\n//    }\n//\n// Assertions\n//\n// The `require` package have same global functions as in the `assert` package,\n// but instead of returning a boolean result they call `t.FailNow()`.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage require\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/forward_requirements.go",
    "content": "package require\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/forward_requirements_test.go",
    "content": "package require\n\nimport (\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n)\n\nfunc TestImplementsWrapper(t *testing.T) {\n\trequire := New(t)\n\n\trequire.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestIsTypeWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Equal(1, 1)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Equal(1, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEqualWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotEqual(1, 2)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotEqual(2, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestExactlyWrapper(t *testing.T) {\n\trequire := New(t)\n\n\ta := float32(1)\n\tb := float32(1)\n\tc := float64(1)\n\n\trequire.Exactly(a, b)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Exactly(a, c)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotNilWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotNil(t, new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotNil(nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNilWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Nil(nil)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Nil(new(AssertionTesterConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestTrueWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.True(true)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.True(false)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestFalseWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.False(false)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.False(true)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestContainsWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Contains(\"Hello World\", \"Hello\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Contains(\"Hello World\", \"Salut\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotContainsWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotContains(\"Hello World\", \"Hello!\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotContains(\"Hello World\", \"Hello\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestPanicsWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Panics(func() {\n\t\tpanic(\"Panic!\")\n\t})\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Panics(func() {})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotPanicsWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotPanics(func() {})\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotPanics(func() {\n\t\tpanic(\"Panic!\")\n\t})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNoErrorWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NoError(nil)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NoError(errors.New(\"some error\"))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestErrorWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Error(errors.New(\"some error\"))\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Error(nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualErrorWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.EqualError(errors.New(\"some error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.EqualError(errors.New(\"some error\"), \"Not some error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEmptyWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Empty(\"\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Empty(\"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEmptyWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotEmpty(\"x\")\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotEmpty(\"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestWithinDurationWrapper(t *testing.T) {\n\trequire := New(t)\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\trequire.WithinDuration(a, b, 15*time.Second)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.WithinDuration(a, b, 5*time.Second)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestInDeltaWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.InDelta(1.001, 1, 0.01)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.InDelta(1, 2, 0.5)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestZeroWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.Zero(0)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.Zero(1)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotZeroWrapper(t *testing.T) {\n\trequire := New(t)\n\trequire.NotZero(1)\n\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\tmockRequire.NotZero(0)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_EqualSONString(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_Array(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`{\"foo\": \"bar\"}`, \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(\"Not JSON\", \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) {\n\tmockT := new(MockT)\n\tmockRequire := New(mockT)\n\n\tmockRequire.JSONEq(`[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/require.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Condition(t, comp, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Conditionf(t, comp, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Contains(t, \"Hello World\", \"World\")\n//    assert.Contains(t, [\"Hello\", \"World\"], \"World\")\n//    assert.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\nfunc Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Contains(t, s, contains, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Containsf(t, s, contains, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.DirExists(t, path, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.DirExistsf(t, path, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])\nfunc ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.ElementsMatch(t, listA, listB, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.ElementsMatchf(t, listA, listB, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Empty(t, obj)\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Empty(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Emptyf(t, obj, \"error message %s\", \"formatted\")\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Emptyf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Equal asserts that two objects are equal.\n//\n//    assert.Equal(t, 123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Equal(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualError(t, err,  expectedErrorString)\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.EqualError(t, theError, errString, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.EqualErrorf(t, theError, errString, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValues(t, uint32(123), int32(123))\nfunc EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.EqualValues(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValuesf(t, uint32(123, \"error message %s\", \"formatted\"), int32(123))\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.EqualValuesf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    assert.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Equalf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Error(t, err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Error(t, err, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Errorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Errorf(t, err, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    assert.Exactly(t, int32(123), int64(123))\nfunc Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Exactly(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    assert.Exactlyf(t, int32(123, \"error message %s\", \"formatted\"), int64(123))\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Exactlyf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Fail(t, failureMessage, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.FailNow(t, failureMessage, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.FailNowf(t, failureMessage, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Failf(t, failureMessage, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// False asserts that the specified value is false.\n//\n//    assert.False(t, myBool)\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.False(t, value, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    assert.Falsef(t, myBool, \"error message %s\", \"formatted\")\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Falsef(t, value, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.FileExists(t, path, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.FileExistsf(t, path, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    assert.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Implements(t, interfaceObject, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    assert.Implementsf(t, (*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Implementsf(t, interfaceObject, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)\nfunc InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDeltaf(t, math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InDeltaf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.IsType(t, expectedType, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.IsTypef(t, expectedType, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.JSONEq(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.JSONEqf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    assert.Len(t, mySlice, 3)\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Len(t, object, length, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    assert.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Lenf(t, object, length, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    assert.Nil(t, err)\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Nil(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    assert.Nilf(t, err, \"error message %s\", \"formatted\")\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Nilf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoError(t, err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NoError(t, err, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoErrorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NoErrorf(t, err, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContains(t, \"Hello World\", \"Earth\")\n//    assert.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//    assert.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\nfunc NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotContains(t, s, contains, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotContainsf(t, s, contains, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmpty(t, obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotEmpty(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmptyf(t, obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotEmptyf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    assert.NotEqual(t, obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotEqual(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    assert.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotEqualf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    assert.NotNil(t, err)\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotNil(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    assert.NotNilf(t, err, \"error message %s\", \"formatted\")\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotNilf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanics(t, func(){ RemainCalm() })\nfunc NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotPanics(t, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotPanicsf(t, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//  assert.NotRegexp(t, \"^start\", \"it's not starting\")\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotRegexp(t, rx, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexpf(t, regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotRegexpf(t, rx, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubset(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\nfunc NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotSubset(t, list, subset, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubsetf(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotSubsetf(t, list, subset, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotZero(t, i, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.NotZerof(t, i, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panics(t, func(){ GoCrazy() })\nfunc Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Panics(t, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\nfunc PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.PanicsWithValue(t, expected, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.PanicsWithValuef(t, expected, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Panicsf(t, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  assert.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//  assert.Regexp(t, \"start...$\", \"it's not starting\")\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Regexp(t, rx, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  assert.Regexpf(t, regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Regexpf(t, rx, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subset(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\nfunc Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Subset(t, list, subset, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subsetf(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Subsetf(t, list, subset, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// True asserts that the specified value is true.\n//\n//    assert.True(t, myBool)\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.True(t, value, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Truef asserts that the specified value is true.\n//\n//    assert.Truef(t, myBool, \"error message %s\", \"formatted\")\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Truef(t, value, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\nfunc WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.WithinDurationf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Zero(t, i, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif !assert.Zerof(t, i, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/require.go.tmpl",
    "content": "{{.Comment}}\nfunc {{.DocInfo.Name}}(t TestingT, {{.Params}}) {\n\tif h, ok := t.(tHelper); ok { h.Helper() }\n\tif !assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) {\n\t\tt.FailNow()\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/require_forward.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tCondition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tConditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Contains(\"Hello World\", \"World\")\n//    a.Contains([\"Hello\", \"World\"], \"World\")\n//    a.Contains({\"Hello\": \"World\"}, \"Hello\")\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tContains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tContainsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tDirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tDirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\")\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Empty(obj)\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEmpty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Emptyf(obj, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEmptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//    a.Equal(123, 123)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualError(err,  expectedErrorString)\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValues(uint32(123), int32(123))\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValuesf(uint32(123, \"error message %s\", \"formatted\"), int32(123))\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    a.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tEqualf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Error(err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tError(a.t, err, msgAndArgs...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Errorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tErrorf(a.t, err, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    a.Exactly(int32(123), int64(123))\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tExactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    a.Exactlyf(int32(123, \"error message %s\", \"formatted\"), int64(123))\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tExactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFailf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//    a.False(myBool)\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFalse(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    a.Falsef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFalsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tFileExistsf(a.t, path, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  a.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  a.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tHTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    a.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tImplements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    a.Implementsf((*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tImplementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t a.InDelta(math.Pi, (22 / 7.0), 0.01)\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t a.InDeltaf(math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tInEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tIsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  a.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tJSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  a.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tJSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    a.Len(mySlice, 3)\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLen(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    a.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tLenf(a.t, object, length, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    a.Nil(err)\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    a.Nilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNilf(a.t, object, msg, args...)\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoError(err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoErrorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNoErrorf(a.t, err, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContains(\"Hello World\", \"Earth\")\n//    a.NotContains([\"Hello\", \"World\"], \"Earth\")\n//    a.NotContains({\"Hello\": \"World\"}, \"Earth\")\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmpty(obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmptyf(obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    a.NotEqual(obj1, obj2)\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    a.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    a.NotNil(err)\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    a.NotNilf(err, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanics(func(){ RemainCalm() })\nfunc (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//  a.NotRegexp(\"^start\", \"it's not starting\")\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexpf(regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubset([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubsetf([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tNotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panics(func(){ GoCrazy() })\nfunc (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tPanicsf(a.t, f, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  a.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//  a.Regexp(\"start...$\", \"it's not starting\")\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  a.Regexpf(regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tRegexpf(a.t, rx, str, msg, args...)\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subset([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subsetf([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tSubsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//    a.True(myBool)\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tTrue(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    a.Truef(myBool, \"error message %s\", \"formatted\")\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tTruef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDuration(time.Now(), time.Now(), 10*time.Second)\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tWithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tZero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {\n\tif h, ok := a.t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tZerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/require_forward.go.tmpl",
    "content": "{{.CommentWithoutT \"a\"}}\nfunc (a *Assertions) {{.DocInfo.Name}}({{.Params}}) {\n\tif h, ok := a.t.(tHelper); ok { h.Helper() }\n\t{{.DocInfo.Name}}(a.t, {{.ForwardedParams}})\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/requirements.go",
    "content": "package require\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n\tFailNow()\n}\n\ntype tHelper interface {\n\tHelper()\n}\n\n// ComparisonAssertionFunc is a common function prototype when comparing two values.  Can be useful\n// for table driven tests.\ntype ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{})\n\n// ValueAssertionFunc is a common function prototype when validating a single value.  Can be useful\n// for table driven tests.\ntype ValueAssertionFunc func(TestingT, interface{}, ...interface{})\n\n// BoolAssertionFunc is a common function prototype when validating a bool value.  Can be useful\n// for table driven tests.\ntype BoolAssertionFunc func(TestingT, bool, ...interface{})\n\n// ValuesAssertionFunc is a common function prototype when validating an error value.  Can be useful\n// for table driven tests.\ntype ErrorAssertionFunc func(TestingT, error, ...interface{})\n\n//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "src/github.com/stretchr/testify/require/requirements_test.go",
    "content": "package require\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n)\n\n// AssertionTesterInterface defines an interface to be used for testing assertion methods\ntype AssertionTesterInterface interface {\n\tTestMethod()\n}\n\n// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface\ntype AssertionTesterConformingObject struct {\n}\n\nfunc (a *AssertionTesterConformingObject) TestMethod() {\n}\n\n// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface\ntype AssertionTesterNonConformingObject struct {\n}\n\ntype MockT struct {\n\tFailed bool\n}\n\nfunc (t *MockT) FailNow() {\n\tt.Failed = true\n}\n\nfunc (t *MockT) Errorf(format string, args ...interface{}) {\n\t_, _ = format, args\n}\n\nfunc TestImplements(t *testing.T) {\n\n\tImplements(t, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tImplements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestIsType(t *testing.T) {\n\n\tIsType(t, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tIsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqual(t *testing.T) {\n\n\tEqual(t, 1, 1)\n\n\tmockT := new(MockT)\n\tEqual(mockT, 1, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n\n}\n\nfunc TestNotEqual(t *testing.T) {\n\n\tNotEqual(t, 1, 2)\n\tmockT := new(MockT)\n\tNotEqual(mockT, 2, 2)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestExactly(t *testing.T) {\n\n\ta := float32(1)\n\tb := float32(1)\n\tc := float64(1)\n\n\tExactly(t, a, b)\n\n\tmockT := new(MockT)\n\tExactly(mockT, a, c)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotNil(t *testing.T) {\n\n\tNotNil(t, new(AssertionTesterConformingObject))\n\n\tmockT := new(MockT)\n\tNotNil(mockT, nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNil(t *testing.T) {\n\n\tNil(t, nil)\n\n\tmockT := new(MockT)\n\tNil(mockT, new(AssertionTesterConformingObject))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestTrue(t *testing.T) {\n\n\tTrue(t, true)\n\n\tmockT := new(MockT)\n\tTrue(mockT, false)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestFalse(t *testing.T) {\n\n\tFalse(t, false)\n\n\tmockT := new(MockT)\n\tFalse(mockT, true)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestContains(t *testing.T) {\n\n\tContains(t, \"Hello World\", \"Hello\")\n\n\tmockT := new(MockT)\n\tContains(mockT, \"Hello World\", \"Salut\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotContains(t *testing.T) {\n\n\tNotContains(t, \"Hello World\", \"Hello!\")\n\n\tmockT := new(MockT)\n\tNotContains(mockT, \"Hello World\", \"Hello\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestPanics(t *testing.T) {\n\n\tPanics(t, func() {\n\t\tpanic(\"Panic!\")\n\t})\n\n\tmockT := new(MockT)\n\tPanics(mockT, func() {})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotPanics(t *testing.T) {\n\n\tNotPanics(t, func() {})\n\n\tmockT := new(MockT)\n\tNotPanics(mockT, func() {\n\t\tpanic(\"Panic!\")\n\t})\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNoError(t *testing.T) {\n\n\tNoError(t, nil)\n\n\tmockT := new(MockT)\n\tNoError(mockT, errors.New(\"some error\"))\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestError(t *testing.T) {\n\n\tError(t, errors.New(\"some error\"))\n\n\tmockT := new(MockT)\n\tError(mockT, nil)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEqualError(t *testing.T) {\n\n\tEqualError(t, errors.New(\"some error\"), \"some error\")\n\n\tmockT := new(MockT)\n\tEqualError(mockT, errors.New(\"some error\"), \"Not some error\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestEmpty(t *testing.T) {\n\n\tEmpty(t, \"\")\n\n\tmockT := new(MockT)\n\tEmpty(mockT, \"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotEmpty(t *testing.T) {\n\n\tNotEmpty(t, \"x\")\n\n\tmockT := new(MockT)\n\tNotEmpty(mockT, \"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestWithinDuration(t *testing.T) {\n\n\ta := time.Now()\n\tb := a.Add(10 * time.Second)\n\n\tWithinDuration(t, a, b, 15*time.Second)\n\n\tmockT := new(MockT)\n\tWithinDuration(mockT, a, b, 5*time.Second)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestInDelta(t *testing.T) {\n\n\tInDelta(t, 1.001, 1, 0.01)\n\n\tmockT := new(MockT)\n\tInDelta(mockT, 1, 2, 0.5)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestZero(t *testing.T) {\n\n\tZero(t, \"\")\n\n\tmockT := new(MockT)\n\tZero(mockT, \"x\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestNotZero(t *testing.T) {\n\n\tNotZero(t, \"x\")\n\n\tmockT := new(MockT)\n\tNotZero(mockT, \"\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_EqualSONString(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"hello\": \"world\", \"foo\": \"bar\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_EquivalentButNotEqual(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_HashOfArraysAndHashes(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]],\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\"\\r\\n}\",\n\t\t\"{\\r\\n\\t\\\"numeric\\\": 1.5,\\r\\n\\t\\\"hash\\\": {\\\"nested\\\": \\\"hash\\\", \\\"nested_slice\\\": [\\\"this\\\", \\\"is\\\", \\\"nested\\\"]},\\r\\n\\t\\\"string\\\": \\\"foo\\\",\\r\\n\\t\\\"array\\\": [{\\\"foo\\\": \\\"bar\\\"}, 1, \\\"string\\\", [\\\"nested\\\", \\\"array\\\", 5.5]]\\r\\n}\")\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_Array(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[\"foo\", {\"nested\": \"hash\", \"hello\": \"world\"}]`)\n\tif mockT.Failed {\n\t\tt.Error(\"Check should pass\")\n\t}\n}\n\nfunc TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `{\"foo\": \"bar\", {\"nested\": \"hash\", \"hello\": \"world\"}}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_HashesNotEquivalent(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ActualIsNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `{\"foo\": \"bar\"}`, \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ExpectedIsNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"Not JSON\", `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, \"Not JSON\", \"Not JSON\")\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc TestJSONEq_ArraysOfDifferentOrder(t *testing.T) {\n\tmockT := new(MockT)\n\tJSONEq(mockT, `[\"foo\", {\"hello\": \"world\", \"nested\": \"hash\"}]`, `[{ \"hello\": \"world\", \"nested\": \"hash\"}, \"foo\"]`)\n\tif !mockT.Failed {\n\t\tt.Error(\"Check should fail\")\n\t}\n}\n\nfunc ExampleComparisonAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tadder := func(x, y int) int {\n\t\treturn x + y\n\t}\n\n\ttype args struct {\n\t\tx int\n\t\ty int\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targs      args\n\t\texpect    int\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"2+2=4\", args{2, 2}, 4, Equal},\n\t\t{\"2+2!=5\", args{2, 2}, 5, NotEqual},\n\t\t{\"2+3==5\", args{2, 3}, 5, Exactly},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y))\n\t\t})\n\t}\n}\n\nfunc TestComparisonAssertionFunc(t *testing.T) {\n\ttype iface interface {\n\t\tName() string\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\texpect    interface{}\n\t\tgot       interface{}\n\t\tassertion ComparisonAssertionFunc\n\t}{\n\t\t{\"implements\", (*iface)(nil), t, Implements},\n\t\t{\"isType\", (*testing.T)(nil), t, IsType},\n\t\t{\"equal\", t, t, Equal},\n\t\t{\"equalValues\", t, t, EqualValues},\n\t\t{\"exactly\", t, t, Exactly},\n\t\t{\"notEqual\", t, nil, NotEqual},\n\t\t{\"notContains\", []int{1, 2, 3}, 4, NotContains},\n\t\t{\"subset\", []int{1, 2, 3, 4}, []int{2, 3}, Subset},\n\t\t{\"notSubset\", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset},\n\t\t{\"elementsMatch\", []byte(\"abc\"), []byte(\"bac\"), ElementsMatch},\n\t\t{\"regexp\", \"^t.*y$\", \"testify\", Regexp},\n\t\t{\"notRegexp\", \"^t.*y$\", \"Testify\", NotRegexp},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.expect, tt.got)\n\t\t})\n\t}\n}\n\nfunc ExampleValueAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParse := func(input string) interface{} {\n\t\tvar x interface{}\n\t\tjson.Unmarshal([]byte(input), &x)\n\t\treturn x\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"true is not nil\", \"true\", NotNil},\n\t\t{\"empty string is nil\", \"\", Nil},\n\t\t{\"zero is not nil\", \"0\", NotNil},\n\t\t{\"zero is zero\", \"0\", Zero},\n\t\t{\"false is zero\", \"false\", Zero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, dumbParse(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestValueAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     interface{}\n\t\tassertion ValueAssertionFunc\n\t}{\n\t\t{\"notNil\", true, NotNil},\n\t\t{\"nil\", nil, Nil},\n\t\t{\"empty\", []int{}, Empty},\n\t\t{\"notEmpty\", []int{1}, NotEmpty},\n\t\t{\"zero\", false, Zero},\n\t\t{\"notZero\", 42, NotZero},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleBoolAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tisOkay := func(x int) bool {\n\t\treturn x >= 42\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       int\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"-1 is bad\", -1, False},\n\t\t{\"42 is good\", 42, True},\n\t\t{\"41 is bad\", 41, False},\n\t\t{\"45 is cool\", 45, True},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, isOkay(tt.arg))\n\t\t})\n\t}\n}\n\nfunc TestBoolAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\tvalue     bool\n\t\tassertion BoolAssertionFunc\n\t}{\n\t\t{\"true\", true, True},\n\t\t{\"false\", false, False},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.value)\n\t\t})\n\t}\n}\n\nfunc ExampleErrorAssertionFunc() {\n\tt := &testing.T{} // provided by test\n\n\tdumbParseNum := func(input string, v interface{}) error {\n\t\treturn json.Unmarshal([]byte(input), v)\n\t}\n\n\ttests := []struct {\n\t\tname      string\n\t\targ       string\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"1.2 is number\", \"1.2\", NoError},\n\t\t{\"1.2.3 not number\", \"1.2.3\", Error},\n\t\t{\"true is not number\", \"true\", Error},\n\t\t{\"3 is number\", \"3\", NoError},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tvar x float64\n\t\t\ttt.assertion(t, dumbParseNum(tt.arg, &x))\n\t\t})\n\t}\n}\n\nfunc TestErrorAssertionFunc(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\terr       error\n\t\tassertion ErrorAssertionFunc\n\t}{\n\t\t{\"noError\", nil, NoError},\n\t\t{\"error\", errors.New(\"whoops\"), Error},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttt.assertion(t, tt.err)\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/suite/doc.go",
    "content": "// Package suite contains logic for creating testing suite structs\n// and running the methods on those structs as tests.  The most useful\n// piece of this package is that you can create setup/teardown methods\n// on your testing suites, which will run before/after the whole suite\n// or individual tests (depending on which interface(s) you\n// implement).\n//\n// A testing suite is usually built by first extending the built-in\n// suite functionality from suite.Suite in testify.  Alternatively,\n// you could reproduce that logic on your own if you wanted (you\n// just need to implement the TestingSuite interface from\n// suite/interfaces.go).\n//\n// After that, you can implement any of the interfaces in\n// suite/interfaces.go to add setup/teardown functionality to your\n// suite, and add any methods that start with \"Test\" to add tests.\n// Methods that do not match any suite interfaces and do not begin\n// with \"Test\" will not be run by testify, and can safely be used as\n// helper methods.\n//\n// Once you've built your testing suite, you need to run the suite\n// (using suite.Run from testify) inside any function that matches the\n// identity that \"go test\" is already looking for (i.e.\n// func(*testing.T)).\n//\n// Regular expression to select test suites specified command-line\n// argument \"-run\". Regular expression to select the methods\n// of test suites specified command-line argument \"-m\".\n// Suite object has assertion methods.\n//\n// A crude example:\n//     // Basic imports\n//     import (\n//         \"testing\"\n//         \"github.com/stretchr/testify/assert\"\n//         \"github.com/stretchr/testify/suite\"\n//     )\n//\n//     // Define the suite, and absorb the built-in basic suite\n//     // functionality from testify - including a T() method which\n//     // returns the current testing context\n//     type ExampleTestSuite struct {\n//         suite.Suite\n//         VariableThatShouldStartAtFive int\n//     }\n//\n//     // Make sure that VariableThatShouldStartAtFive is set to five\n//     // before each test\n//     func (suite *ExampleTestSuite) SetupTest() {\n//         suite.VariableThatShouldStartAtFive = 5\n//     }\n//\n//     // All methods that begin with \"Test\" are run as tests within a\n//     // suite.\n//     func (suite *ExampleTestSuite) TestExample() {\n//         assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive)\n//         suite.Equal(5, suite.VariableThatShouldStartAtFive)\n//     }\n//\n//     // In order for 'go test' to run this suite, we need to create\n//     // a normal test function and pass our suite to suite.Run\n//     func TestExampleTestSuite(t *testing.T) {\n//         suite.Run(t, new(ExampleTestSuite))\n//     }\npackage suite\n"
  },
  {
    "path": "src/github.com/stretchr/testify/suite/interfaces.go",
    "content": "package suite\n\nimport \"testing\"\n\n// TestingSuite can store and return the current *testing.T context\n// generated by 'go test'.\ntype TestingSuite interface {\n\tT() *testing.T\n\tSetT(*testing.T)\n}\n\n// SetupAllSuite has a SetupSuite method, which will run before the\n// tests in the suite are run.\ntype SetupAllSuite interface {\n\tSetupSuite()\n}\n\n// SetupTestSuite has a SetupTest method, which will run before each\n// test in the suite.\ntype SetupTestSuite interface {\n\tSetupTest()\n}\n\n// TearDownAllSuite has a TearDownSuite method, which will run after\n// all the tests in the suite have been run.\ntype TearDownAllSuite interface {\n\tTearDownSuite()\n}\n\n// TearDownTestSuite has a TearDownTest method, which will run after\n// each test in the suite.\ntype TearDownTestSuite interface {\n\tTearDownTest()\n}\n\n// BeforeTest has a function to be executed right before the test\n// starts and receives the suite and test names as input\ntype BeforeTest interface {\n\tBeforeTest(suiteName, testName string)\n}\n\n// AfterTest has a function to be executed right after the test\n// finishes and receives the suite and test names as input\ntype AfterTest interface {\n\tAfterTest(suiteName, testName string)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/suite/suite.go",
    "content": "package suite\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\nvar allTestsFilter = func(_, _ string) (bool, error) { return true, nil }\nvar matchMethod = flag.String(\"testify.m\", \"\", \"regular expression to select tests of the testify suite to run\")\n\n// Suite is a basic testing suite with methods for storing and\n// retrieving the current *testing.T context.\ntype Suite struct {\n\t*assert.Assertions\n\trequire *require.Assertions\n\tt       *testing.T\n}\n\n// T retrieves the current *testing.T context.\nfunc (suite *Suite) T() *testing.T {\n\treturn suite.t\n}\n\n// SetT sets the current *testing.T context.\nfunc (suite *Suite) SetT(t *testing.T) {\n\tsuite.t = t\n\tsuite.Assertions = assert.New(t)\n\tsuite.require = require.New(t)\n}\n\n// Require returns a require context for suite.\nfunc (suite *Suite) Require() *require.Assertions {\n\tif suite.require == nil {\n\t\tsuite.require = require.New(suite.T())\n\t}\n\treturn suite.require\n}\n\n// Assert returns an assert context for suite.  Normally, you can call\n// `suite.NoError(expected, actual)`, but for situations where the embedded\n// methods are overridden (for example, you might want to override\n// assert.Assertions with require.Assertions), this method is provided so you\n// can call `suite.Assert().NoError()`.\nfunc (suite *Suite) Assert() *assert.Assertions {\n\tif suite.Assertions == nil {\n\t\tsuite.Assertions = assert.New(suite.T())\n\t}\n\treturn suite.Assertions\n}\n\n// Run takes a testing suite and runs all of the tests attached\n// to it.\nfunc Run(t *testing.T, suite TestingSuite) {\n\tsuite.SetT(t)\n\n\tif setupAllSuite, ok := suite.(SetupAllSuite); ok {\n\t\tsetupAllSuite.SetupSuite()\n\t}\n\tdefer func() {\n\t\tif tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {\n\t\t\ttearDownAllSuite.TearDownSuite()\n\t\t}\n\t}()\n\n\tmethodFinder := reflect.TypeOf(suite)\n\ttests := []testing.InternalTest{}\n\tfor index := 0; index < methodFinder.NumMethod(); index++ {\n\t\tmethod := methodFinder.Method(index)\n\t\tok, err := methodFilter(method.Name)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"testify: invalid regexp for -m: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif ok {\n\t\t\ttest := testing.InternalTest{\n\t\t\t\tName: method.Name,\n\t\t\t\tF: func(t *testing.T) {\n\t\t\t\t\tparentT := suite.T()\n\t\t\t\t\tsuite.SetT(t)\n\t\t\t\t\tif setupTestSuite, ok := suite.(SetupTestSuite); ok {\n\t\t\t\t\t\tsetupTestSuite.SetupTest()\n\t\t\t\t\t}\n\t\t\t\t\tif beforeTestSuite, ok := suite.(BeforeTest); ok {\n\t\t\t\t\t\tbeforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name)\n\t\t\t\t\t}\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif afterTestSuite, ok := suite.(AfterTest); ok {\n\t\t\t\t\t\t\tafterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif tearDownTestSuite, ok := suite.(TearDownTestSuite); ok {\n\t\t\t\t\t\t\ttearDownTestSuite.TearDownTest()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsuite.SetT(parentT)\n\t\t\t\t\t}()\n\t\t\t\t\tmethod.Func.Call([]reflect.Value{reflect.ValueOf(suite)})\n\t\t\t\t},\n\t\t\t}\n\t\t\ttests = append(tests, test)\n\t\t}\n\t}\n\trunTests(t, tests)\n}\n\nfunc runTests(t testing.TB, tests []testing.InternalTest) {\n\tr, ok := t.(runner)\n\tif !ok { // backwards compatibility with Go 1.6 and below\n\t\tif !testing.RunTests(allTestsFilter, tests) {\n\t\t\tt.Fail()\n\t\t}\n\t\treturn\n\t}\n\n\tfor _, test := range tests {\n\t\tr.Run(test.Name, test.F)\n\t}\n}\n\n// Filtering method according to set regular expression\n// specified command-line argument -m\nfunc methodFilter(name string) (bool, error) {\n\tif ok, _ := regexp.MatchString(\"^Test\", name); !ok {\n\t\treturn false, nil\n\t}\n\treturn regexp.MatchString(*matchMethod, name)\n}\n\ntype runner interface {\n\tRun(name string, f func(t *testing.T)) bool\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/suite/suite_test.go",
    "content": "package suite\n\nimport (\n\t\"errors\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\n// SuiteRequireTwice is intended to test the usage of suite.Require in two\n// different tests\ntype SuiteRequireTwice struct{ Suite }\n\n// TestSuiteRequireTwice checks for regressions of issue #149 where\n// suite.requirements was not initialised in suite.SetT()\n// A regression would result on these tests panicking rather than failing.\nfunc TestSuiteRequireTwice(t *testing.T) {\n\tok := testing.RunTests(\n\t\tallTestsFilter,\n\t\t[]testing.InternalTest{{\n\t\t\tName: \"TestSuiteRequireTwice\",\n\t\t\tF: func(t *testing.T) {\n\t\t\t\tsuite := new(SuiteRequireTwice)\n\t\t\t\tRun(t, suite)\n\t\t\t},\n\t\t}},\n\t)\n\tassert.Equal(t, false, ok)\n}\n\nfunc (s *SuiteRequireTwice) TestRequireOne() {\n\tr := s.Require()\n\tr.Equal(1, 2)\n}\n\nfunc (s *SuiteRequireTwice) TestRequireTwo() {\n\tr := s.Require()\n\tr.Equal(1, 2)\n}\n\n// This suite is intended to store values to make sure that only\n// testing-suite-related methods are run.  It's also a fully\n// functional example of a testing suite, using setup/teardown methods\n// and a helper method that is ignored by testify.  To make this look\n// more like a real world example, all tests in the suite perform some\n// type of assertion.\ntype SuiteTester struct {\n\t// Include our basic suite logic.\n\tSuite\n\n\t// Keep counts of how many times each method is run.\n\tSetupSuiteRunCount    int\n\tTearDownSuiteRunCount int\n\tSetupTestRunCount     int\n\tTearDownTestRunCount  int\n\tTestOneRunCount       int\n\tTestTwoRunCount       int\n\tNonTestMethodRunCount int\n\n\tSuiteNameBefore []string\n\tTestNameBefore  []string\n\n\tSuiteNameAfter []string\n\tTestNameAfter  []string\n\n\tTimeBefore []time.Time\n\tTimeAfter  []time.Time\n}\n\ntype SuiteSkipTester struct {\n\t// Include our basic suite logic.\n\tSuite\n\n\t// Keep counts of how many times each method is run.\n\tSetupSuiteRunCount    int\n\tTearDownSuiteRunCount int\n}\n\n// The SetupSuite method will be run by testify once, at the very\n// start of the testing suite, before any tests are run.\nfunc (suite *SuiteTester) SetupSuite() {\n\tsuite.SetupSuiteRunCount++\n}\n\nfunc (suite *SuiteTester) BeforeTest(suiteName, testName string) {\n\tsuite.SuiteNameBefore = append(suite.SuiteNameBefore, suiteName)\n\tsuite.TestNameBefore = append(suite.TestNameBefore, testName)\n\tsuite.TimeBefore = append(suite.TimeBefore, time.Now())\n}\n\nfunc (suite *SuiteTester) AfterTest(suiteName, testName string) {\n\tsuite.SuiteNameAfter = append(suite.SuiteNameAfter, suiteName)\n\tsuite.TestNameAfter = append(suite.TestNameAfter, testName)\n\tsuite.TimeAfter = append(suite.TimeAfter, time.Now())\n}\n\nfunc (suite *SuiteSkipTester) SetupSuite() {\n\tsuite.SetupSuiteRunCount++\n\tsuite.T().Skip()\n}\n\n// The TearDownSuite method will be run by testify once, at the very\n// end of the testing suite, after all tests have been run.\nfunc (suite *SuiteTester) TearDownSuite() {\n\tsuite.TearDownSuiteRunCount++\n}\n\nfunc (suite *SuiteSkipTester) TearDownSuite() {\n\tsuite.TearDownSuiteRunCount++\n}\n\n// The SetupTest method will be run before every test in the suite.\nfunc (suite *SuiteTester) SetupTest() {\n\tsuite.SetupTestRunCount++\n}\n\n// The TearDownTest method will be run after every test in the suite.\nfunc (suite *SuiteTester) TearDownTest() {\n\tsuite.TearDownTestRunCount++\n}\n\n// Every method in a testing suite that begins with \"Test\" will be run\n// as a test.  TestOne is an example of a test.  For the purposes of\n// this example, we've included assertions in the tests, since most\n// tests will issue assertions.\nfunc (suite *SuiteTester) TestOne() {\n\tbeforeCount := suite.TestOneRunCount\n\tsuite.TestOneRunCount++\n\tassert.Equal(suite.T(), suite.TestOneRunCount, beforeCount+1)\n\tsuite.Equal(suite.TestOneRunCount, beforeCount+1)\n}\n\n// TestTwo is another example of a test.\nfunc (suite *SuiteTester) TestTwo() {\n\tbeforeCount := suite.TestTwoRunCount\n\tsuite.TestTwoRunCount++\n\tassert.NotEqual(suite.T(), suite.TestTwoRunCount, beforeCount)\n\tsuite.NotEqual(suite.TestTwoRunCount, beforeCount)\n}\n\nfunc (suite *SuiteTester) TestSkip() {\n\tsuite.T().Skip()\n}\n\n// NonTestMethod does not begin with \"Test\", so it will not be run by\n// testify as a test in the suite.  This is useful for creating helper\n// methods for your tests.\nfunc (suite *SuiteTester) NonTestMethod() {\n\tsuite.NonTestMethodRunCount++\n}\n\n// TestRunSuite will be run by the 'go test' command, so within it, we\n// can run our suite using the Run(*testing.T, TestingSuite) function.\nfunc TestRunSuite(t *testing.T) {\n\tsuiteTester := new(SuiteTester)\n\tRun(t, suiteTester)\n\n\t// Normally, the test would end here.  The following are simply\n\t// some assertions to ensure that the Run function is working as\n\t// intended - they are not part of the example.\n\n\t// The suite was only run once, so the SetupSuite and TearDownSuite\n\t// methods should have each been run only once.\n\tassert.Equal(t, suiteTester.SetupSuiteRunCount, 1)\n\tassert.Equal(t, suiteTester.TearDownSuiteRunCount, 1)\n\n\tassert.Equal(t, len(suiteTester.SuiteNameAfter), 3)\n\tassert.Equal(t, len(suiteTester.SuiteNameBefore), 3)\n\tassert.Equal(t, len(suiteTester.TestNameAfter), 3)\n\tassert.Equal(t, len(suiteTester.TestNameBefore), 3)\n\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestOne\")\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestTwo\")\n\tassert.Contains(t, suiteTester.TestNameAfter, \"TestSkip\")\n\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestOne\")\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestTwo\")\n\tassert.Contains(t, suiteTester.TestNameBefore, \"TestSkip\")\n\n\tfor _, suiteName := range suiteTester.SuiteNameAfter {\n\t\tassert.Equal(t, \"SuiteTester\", suiteName)\n\t}\n\n\tfor _, suiteName := range suiteTester.SuiteNameBefore {\n\t\tassert.Equal(t, \"SuiteTester\", suiteName)\n\t}\n\n\tfor _, when := range suiteTester.TimeAfter {\n\t\tassert.False(t, when.IsZero())\n\t}\n\n\tfor _, when := range suiteTester.TimeBefore {\n\t\tassert.False(t, when.IsZero())\n\t}\n\n\t// There are three test methods (TestOne, TestTwo, and TestSkip), so\n\t// the SetupTest and TearDownTest methods (which should be run once for\n\t// each test) should have been run three times.\n\tassert.Equal(t, suiteTester.SetupTestRunCount, 3)\n\tassert.Equal(t, suiteTester.TearDownTestRunCount, 3)\n\n\t// Each test should have been run once.\n\tassert.Equal(t, suiteTester.TestOneRunCount, 1)\n\tassert.Equal(t, suiteTester.TestTwoRunCount, 1)\n\n\t// Methods that don't match the test method identifier shouldn't\n\t// have been run at all.\n\tassert.Equal(t, suiteTester.NonTestMethodRunCount, 0)\n\n\tsuiteSkipTester := new(SuiteSkipTester)\n\tRun(t, suiteSkipTester)\n\n\t// The suite was only run once, so the SetupSuite and TearDownSuite\n\t// methods should have each been run only once, even though SetupSuite\n\t// called Skip()\n\tassert.Equal(t, suiteSkipTester.SetupSuiteRunCount, 1)\n\tassert.Equal(t, suiteSkipTester.TearDownSuiteRunCount, 1)\n\n}\n\nfunc TestSuiteGetters(t *testing.T) {\n\tsuite := new(SuiteTester)\n\tsuite.SetT(t)\n\tassert.NotNil(t, suite.Assert())\n\tassert.Equal(t, suite.Assertions, suite.Assert())\n\tassert.NotNil(t, suite.Require())\n\tassert.Equal(t, suite.require, suite.Require())\n}\n\ntype SuiteLoggingTester struct {\n\tSuite\n}\n\nfunc (s *SuiteLoggingTester) TestLoggingPass() {\n\ts.T().Log(\"TESTLOGPASS\")\n}\n\nfunc (s *SuiteLoggingTester) TestLoggingFail() {\n\ts.T().Log(\"TESTLOGFAIL\")\n\tassert.NotNil(s.T(), nil) // expected to fail\n}\n\ntype StdoutCapture struct {\n\toldStdout *os.File\n\treadPipe  *os.File\n}\n\nfunc (sc *StdoutCapture) StartCapture() {\n\tsc.oldStdout = os.Stdout\n\tsc.readPipe, os.Stdout, _ = os.Pipe()\n}\n\nfunc (sc *StdoutCapture) StopCapture() (string, error) {\n\tif sc.oldStdout == nil || sc.readPipe == nil {\n\t\treturn \"\", errors.New(\"StartCapture not called before StopCapture\")\n\t}\n\tos.Stdout.Close()\n\tos.Stdout = sc.oldStdout\n\tbytes, err := ioutil.ReadAll(sc.readPipe)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes), nil\n}\n\nfunc TestSuiteLogging(t *testing.T) {\n\tsuiteLoggingTester := new(SuiteLoggingTester)\n\tcapture := StdoutCapture{}\n\tinternalTest := testing.InternalTest{\n\t\tName: \"SomeTest\",\n\t\tF: func(subT *testing.T) {\n\t\t\tRun(subT, suiteLoggingTester)\n\t\t},\n\t}\n\tcapture.StartCapture()\n\ttesting.RunTests(allTestsFilter, []testing.InternalTest{internalTest})\n\toutput, err := capture.StopCapture()\n\trequire.NoError(t, err, \"Got an error trying to capture stdout and stderr!\")\n\trequire.NotEmpty(t, output, \"output content must not be empty\")\n\n\t// Failed tests' output is always printed\n\tassert.Contains(t, output, \"TESTLOGFAIL\")\n\n\tif testing.Verbose() {\n\t\t// In verbose mode, output from successful tests is also printed\n\t\tassert.Contains(t, output, \"TESTLOGPASS\")\n\t} else {\n\t\tassert.NotContains(t, output, \"TESTLOGPASS\")\n\t}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/LICENSE",
    "content": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/bypass.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is not running on Google App Engine, compiled by GopherJS, and\n// \"-tags safe\" is not added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n// +build !js,!appengine,!safe,!disableunsafe\n\npackage spew\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = false\n\n\t// ptrSize is the size of a pointer on the current arch.\n\tptrSize = unsafe.Sizeof((*byte)(nil))\n)\n\nvar (\n\t// offsetPtr, offsetScalar, and offsetFlag are the offsets for the\n\t// internal reflect.Value fields.  These values are valid before golang\n\t// commit ecccf07e7f9d which changed the format.  The are also valid\n\t// after commit 82f48826c6c7 which changed the format again to mirror\n\t// the original format.  Code in the init function updates these offsets\n\t// as necessary.\n\toffsetPtr    = uintptr(ptrSize)\n\toffsetScalar = uintptr(0)\n\toffsetFlag   = uintptr(ptrSize * 2)\n\n\t// flagKindWidth and flagKindShift indicate various bits that the\n\t// reflect package uses internally to track kind information.\n\t//\n\t// flagRO indicates whether or not the value field of a reflect.Value is\n\t// read-only.\n\t//\n\t// flagIndir indicates whether the value field of a reflect.Value is\n\t// the actual data or a pointer to the data.\n\t//\n\t// These values are valid before golang commit 90a7c3c86944 which\n\t// changed their positions.  Code in the init function updates these\n\t// flags as necessary.\n\tflagKindWidth = uintptr(5)\n\tflagKindShift = uintptr(flagKindWidth - 1)\n\tflagRO        = uintptr(1 << 0)\n\tflagIndir     = uintptr(1 << 1)\n)\n\nfunc init() {\n\t// Older versions of reflect.Value stored small integers directly in the\n\t// ptr field (which is named val in the older versions).  Versions\n\t// between commits ecccf07e7f9d and 82f48826c6c7 added a new field named\n\t// scalar for this purpose which unfortunately came before the flag\n\t// field, so the offset of the flag field is different for those\n\t// versions.\n\t//\n\t// This code constructs a new reflect.Value from a known small integer\n\t// and checks if the size of the reflect.Value struct indicates it has\n\t// the scalar field. When it does, the offsets are updated accordingly.\n\tvv := reflect.ValueOf(0xf00)\n\tif unsafe.Sizeof(vv) == (ptrSize * 4) {\n\t\toffsetScalar = ptrSize * 2\n\t\toffsetFlag = ptrSize * 3\n\t}\n\n\t// Commit 90a7c3c86944 changed the flag positions such that the low\n\t// order bits are the kind.  This code extracts the kind from the flags\n\t// field and ensures it's the correct type.  When it's not, the flag\n\t// order has been changed to the newer format, so the flags are updated\n\t// accordingly.\n\tupf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag)\n\tupfv := *(*uintptr)(upf)\n\tflagKindMask := uintptr((1<<flagKindWidth - 1) << flagKindShift)\n\tif (upfv&flagKindMask)>>flagKindShift != uintptr(reflect.Int) {\n\t\tflagKindShift = 0\n\t\tflagRO = 1 << 5\n\t\tflagIndir = 1 << 6\n\n\t\t// Commit adf9b30e5594 modified the flags to separate the\n\t\t// flagRO flag into two bits which specifies whether or not the\n\t\t// field is embedded.  This causes flagIndir to move over a bit\n\t\t// and means that flagRO is the combination of either of the\n\t\t// original flagRO bit and the new bit.\n\t\t//\n\t\t// This code detects the change by extracting what used to be\n\t\t// the indirect bit to ensure it's set.  When it's not, the flag\n\t\t// order has been changed to the newer format, so the flags are\n\t\t// updated accordingly.\n\t\tif upfv&flagIndir == 0 {\n\t\t\tflagRO = 3 << 5\n\t\t\tflagIndir = 1 << 7\n\t\t}\n\t}\n}\n\n// unsafeReflectValue converts the passed reflect.Value into a one that bypasses\n// the typical safety restrictions preventing access to unaddressable and\n// unexported data.  It works by digging the raw pointer to the underlying\n// value out of the protected value and generating a new unprotected (unsafe)\n// reflect.Value to it.\n//\n// This allows us to check for implementations of the Stringer and error\n// interfaces to be used for pretty printing ordinarily unaddressable and\n// inaccessible values such as unexported struct fields.\nfunc unsafeReflectValue(v reflect.Value) (rv reflect.Value) {\n\tindirects := 1\n\tvt := v.Type()\n\tupv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr)\n\trvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag))\n\tif rvf&flagIndir != 0 {\n\t\tvt = reflect.PtrTo(v.Type())\n\t\tindirects++\n\t} else if offsetScalar != 0 {\n\t\t// The value is in the scalar field when it's not one of the\n\t\t// reference types.\n\t\tswitch vt.Kind() {\n\t\tcase reflect.Uintptr:\n\t\tcase reflect.Chan:\n\t\tcase reflect.Func:\n\t\tcase reflect.Map:\n\t\tcase reflect.Ptr:\n\t\tcase reflect.UnsafePointer:\n\t\tdefault:\n\t\t\tupv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) +\n\t\t\t\toffsetScalar)\n\t\t}\n\t}\n\n\tpv := reflect.NewAt(vt, upv)\n\trv = pv\n\tfor i := 0; i < indirects; i++ {\n\t\trv = rv.Elem()\n\t}\n\treturn rv\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is running on Google App Engine, compiled by GopherJS, or\n// \"-tags safe\" is added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n// +build js appengine safe disableunsafe\n\npackage spew\n\nimport \"reflect\"\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = true\n)\n\n// unsafeReflectValue typically converts the passed reflect.Value into a one\n// that bypasses the typical safety restrictions preventing access to\n// unaddressable and unexported data.  However, doing this relies on access to\n// the unsafe package.  This is a stub version which simply returns the passed\n// reflect.Value when the unsafe package is not available.\nfunc unsafeReflectValue(v reflect.Value) reflect.Value {\n\treturn v\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/common.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n)\n\n// Some constants in the form of bytes to avoid string overhead.  This mirrors\n// the technique used in the fmt package.\nvar (\n\tpanicBytes            = []byte(\"(PANIC=\")\n\tplusBytes             = []byte(\"+\")\n\tiBytes                = []byte(\"i\")\n\ttrueBytes             = []byte(\"true\")\n\tfalseBytes            = []byte(\"false\")\n\tinterfaceBytes        = []byte(\"(interface {})\")\n\tcommaNewlineBytes     = []byte(\",\\n\")\n\tnewlineBytes          = []byte(\"\\n\")\n\topenBraceBytes        = []byte(\"{\")\n\topenBraceNewlineBytes = []byte(\"{\\n\")\n\tcloseBraceBytes       = []byte(\"}\")\n\tasteriskBytes         = []byte(\"*\")\n\tcolonBytes            = []byte(\":\")\n\tcolonSpaceBytes       = []byte(\": \")\n\topenParenBytes        = []byte(\"(\")\n\tcloseParenBytes       = []byte(\")\")\n\tspaceBytes            = []byte(\" \")\n\tpointerChainBytes     = []byte(\"->\")\n\tnilAngleBytes         = []byte(\"<nil>\")\n\tmaxNewlineBytes       = []byte(\"<max depth reached>\\n\")\n\tmaxShortBytes         = []byte(\"<max>\")\n\tcircularBytes         = []byte(\"<already shown>\")\n\tcircularShortBytes    = []byte(\"<shown>\")\n\tinvalidAngleBytes     = []byte(\"<invalid>\")\n\topenBracketBytes      = []byte(\"[\")\n\tcloseBracketBytes     = []byte(\"]\")\n\tpercentBytes          = []byte(\"%\")\n\tprecisionBytes        = []byte(\".\")\n\topenAngleBytes        = []byte(\"<\")\n\tcloseAngleBytes       = []byte(\">\")\n\topenMapBytes          = []byte(\"map[\")\n\tcloseMapBytes         = []byte(\"]\")\n\tlenEqualsBytes        = []byte(\"len=\")\n\tcapEqualsBytes        = []byte(\"cap=\")\n)\n\n// hexDigits is used to map a decimal value to a hex digit.\nvar hexDigits = \"0123456789abcdef\"\n\n// catchPanic handles any panics that might occur during the handleMethods\n// calls.\nfunc catchPanic(w io.Writer, v reflect.Value) {\n\tif err := recover(); err != nil {\n\t\tw.Write(panicBytes)\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\tw.Write(closeParenBytes)\n\t}\n}\n\n// handleMethods attempts to call the Error and String methods on the underlying\n// type the passed reflect.Value represents and outputes the result to Writer w.\n//\n// It handles panics in any called methods by catching and displaying the error\n// as the formatted value.\nfunc handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {\n\t// We need an interface to check if the type implements the error or\n\t// Stringer interface.  However, the reflect package won't give us an\n\t// interface on certain things like unexported struct fields in order\n\t// to enforce visibility rules.  We use unsafe, when it's available,\n\t// to bypass these restrictions since this package does not mutate the\n\t// values.\n\tif !v.CanInterface() {\n\t\tif UnsafeDisabled {\n\t\t\treturn false\n\t\t}\n\n\t\tv = unsafeReflectValue(v)\n\t}\n\n\t// Choose whether or not to do error and Stringer interface lookups against\n\t// the base type or a pointer to the base type depending on settings.\n\t// Technically calling one of these methods with a pointer receiver can\n\t// mutate the value, however, types which choose to satisify an error or\n\t// Stringer interface with a pointer receiver should not be mutating their\n\t// state inside these interface methods.\n\tif !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {\n\t\tv = unsafeReflectValue(v)\n\t}\n\tif v.CanAddr() {\n\t\tv = v.Addr()\n\t}\n\n\t// Is it an error or Stringer?\n\tswitch iface := v.Interface().(type) {\n\tcase error:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.Error()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\n\t\tw.Write([]byte(iface.Error()))\n\t\treturn true\n\n\tcase fmt.Stringer:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.String()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\t\tw.Write([]byte(iface.String()))\n\t\treturn true\n\t}\n\treturn false\n}\n\n// printBool outputs a boolean value as true or false to Writer w.\nfunc printBool(w io.Writer, val bool) {\n\tif val {\n\t\tw.Write(trueBytes)\n\t} else {\n\t\tw.Write(falseBytes)\n\t}\n}\n\n// printInt outputs a signed integer value to Writer w.\nfunc printInt(w io.Writer, val int64, base int) {\n\tw.Write([]byte(strconv.FormatInt(val, base)))\n}\n\n// printUint outputs an unsigned integer value to Writer w.\nfunc printUint(w io.Writer, val uint64, base int) {\n\tw.Write([]byte(strconv.FormatUint(val, base)))\n}\n\n// printFloat outputs a floating point value using the specified precision,\n// which is expected to be 32 or 64bit, to Writer w.\nfunc printFloat(w io.Writer, val float64, precision int) {\n\tw.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))\n}\n\n// printComplex outputs a complex value using the specified float precision\n// for the real and imaginary parts to Writer w.\nfunc printComplex(w io.Writer, c complex128, floatPrecision int) {\n\tr := real(c)\n\tw.Write(openParenBytes)\n\tw.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))\n\ti := imag(c)\n\tif i >= 0 {\n\t\tw.Write(plusBytes)\n\t}\n\tw.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))\n\tw.Write(iBytes)\n\tw.Write(closeParenBytes)\n}\n\n// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x'\n// prefix to Writer w.\nfunc printHexPtr(w io.Writer, p uintptr) {\n\t// Null pointer.\n\tnum := uint64(p)\n\tif num == 0 {\n\t\tw.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix\n\tbuf := make([]byte, 18)\n\n\t// It's simpler to construct the hex string right to left.\n\tbase := uint64(16)\n\ti := len(buf) - 1\n\tfor num >= base {\n\t\tbuf[i] = hexDigits[num%base]\n\t\tnum /= base\n\t\ti--\n\t}\n\tbuf[i] = hexDigits[num]\n\n\t// Add '0x' prefix.\n\ti--\n\tbuf[i] = 'x'\n\ti--\n\tbuf[i] = '0'\n\n\t// Strip unused leading bytes.\n\tbuf = buf[i:]\n\tw.Write(buf)\n}\n\n// valuesSorter implements sort.Interface to allow a slice of reflect.Value\n// elements to be sorted.\ntype valuesSorter struct {\n\tvalues  []reflect.Value\n\tstrings []string // either nil or same len and values\n\tcs      *ConfigState\n}\n\n// newValuesSorter initializes a valuesSorter instance, which holds a set of\n// surrogate keys on which the data should be sorted.  It uses flags in\n// ConfigState to decide if and how to populate those surrogate keys.\nfunc newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {\n\tvs := &valuesSorter{values: values, cs: cs}\n\tif canSortSimply(vs.values[0].Kind()) {\n\t\treturn vs\n\t}\n\tif !cs.DisableMethods {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tb := bytes.Buffer{}\n\t\t\tif !handleMethods(cs, &b, vs.values[i]) {\n\t\t\t\tvs.strings = nil\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvs.strings[i] = b.String()\n\t\t}\n\t}\n\tif vs.strings == nil && cs.SpewKeys {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tvs.strings[i] = Sprintf(\"%#v\", vs.values[i].Interface())\n\t\t}\n\t}\n\treturn vs\n}\n\n// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted\n// directly, or whether it should be considered for sorting by surrogate keys\n// (if the ConfigState allows it).\nfunc canSortSimply(kind reflect.Kind) bool {\n\t// This switch parallels valueSortLess, except for the default case.\n\tswitch kind {\n\tcase reflect.Bool:\n\t\treturn true\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn true\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn true\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn true\n\tcase reflect.String:\n\t\treturn true\n\tcase reflect.Uintptr:\n\t\treturn true\n\tcase reflect.Array:\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Len returns the number of values in the slice.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Len() int {\n\treturn len(s.values)\n}\n\n// Swap swaps the values at the passed indices.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Swap(i, j int) {\n\ts.values[i], s.values[j] = s.values[j], s.values[i]\n\tif s.strings != nil {\n\t\ts.strings[i], s.strings[j] = s.strings[j], s.strings[i]\n\t}\n}\n\n// valueSortLess returns whether the first value should sort before the second\n// value.  It is used by valueSorter.Less as part of the sort.Interface\n// implementation.\nfunc valueSortLess(a, b reflect.Value) bool {\n\tswitch a.Kind() {\n\tcase reflect.Bool:\n\t\treturn !a.Bool() && b.Bool()\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn a.Int() < b.Int()\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn a.Float() < b.Float()\n\tcase reflect.String:\n\t\treturn a.String() < b.String()\n\tcase reflect.Uintptr:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Array:\n\t\t// Compare the contents of both arrays.\n\t\tl := a.Len()\n\t\tfor i := 0; i < l; i++ {\n\t\t\tav := a.Index(i)\n\t\t\tbv := b.Index(i)\n\t\t\tif av.Interface() == bv.Interface() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn valueSortLess(av, bv)\n\t\t}\n\t}\n\treturn a.String() < b.String()\n}\n\n// Less returns whether the value at index i should sort before the\n// value at index j.  It is part of the sort.Interface implementation.\nfunc (s *valuesSorter) Less(i, j int) bool {\n\tif s.strings == nil {\n\t\treturn valueSortLess(s.values[i], s.values[j])\n\t}\n\treturn s.strings[i] < s.strings[j]\n}\n\n// sortValues is a sort function that handles both native types and any type that\n// can be converted to error or Stringer.  Other inputs are sorted according to\n// their Value.String() value to ensure display stability.\nfunc sortValues(values []reflect.Value, cs *ConfigState) {\n\tif len(values) == 0 {\n\t\treturn\n\t}\n\tsort.Sort(newValuesSorter(values, cs))\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/config.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\n// ConfigState houses the configuration options used by spew to format and\n// display values.  There is a global instance, Config, that is used to control\n// all top-level Formatter and Dump functionality.  Each ConfigState instance\n// provides methods equivalent to the top-level functions.\n//\n// The zero value for ConfigState provides no indentation.  You would typically\n// want to set it to a space or a tab.\n//\n// Alternatively, you can use NewDefaultConfig to get a ConfigState instance\n// with default settings.  See the documentation of NewDefaultConfig for default\n// values.\ntype ConfigState struct {\n\t// Indent specifies the string to use for each indentation level.  The\n\t// global config instance that all top-level functions use set this to a\n\t// single space by default.  If you would like more indentation, you might\n\t// set this to a tab with \"\\t\" or perhaps two spaces with \"  \".\n\tIndent string\n\n\t// MaxDepth controls the maximum number of levels to descend into nested\n\t// data structures.  The default, 0, means there is no limit.\n\t//\n\t// NOTE: Circular data structures are properly detected, so it is not\n\t// necessary to set this value unless you specifically want to limit deeply\n\t// nested data structures.\n\tMaxDepth int\n\n\t// DisableMethods specifies whether or not error and Stringer interfaces are\n\t// invoked for types that implement them.\n\tDisableMethods bool\n\n\t// DisablePointerMethods specifies whether or not to check for and invoke\n\t// error and Stringer interfaces on types which only accept a pointer\n\t// receiver when the current type is not a pointer.\n\t//\n\t// NOTE: This might be an unsafe action since calling one of these methods\n\t// with a pointer receiver could technically mutate the value, however,\n\t// in practice, types which choose to satisify an error or Stringer\n\t// interface with a pointer receiver should not be mutating their state\n\t// inside these interface methods.  As a result, this option relies on\n\t// access to the unsafe package, so it will not have any effect when\n\t// running in environments without access to the unsafe package such as\n\t// Google App Engine or with the \"safe\" build tag specified.\n\tDisablePointerMethods bool\n\n\t// DisablePointerAddresses specifies whether to disable the printing of\n\t// pointer addresses. This is useful when diffing data structures in tests.\n\tDisablePointerAddresses bool\n\n\t// DisableCapacities specifies whether to disable the printing of capacities\n\t// for arrays, slices, maps and channels. This is useful when diffing\n\t// data structures in tests.\n\tDisableCapacities bool\n\n\t// ContinueOnMethod specifies whether or not recursion should continue once\n\t// a custom error or Stringer interface is invoked.  The default, false,\n\t// means it will print the results of invoking the custom error or Stringer\n\t// interface and return immediately instead of continuing to recurse into\n\t// the internals of the data type.\n\t//\n\t// NOTE: This flag does not have any effect if method invocation is disabled\n\t// via the DisableMethods or DisablePointerMethods options.\n\tContinueOnMethod bool\n\n\t// SortKeys specifies map keys should be sorted before being printed. Use\n\t// this to have a more deterministic, diffable output.  Note that only\n\t// native types (bool, int, uint, floats, uintptr and string) and types\n\t// that support the error or Stringer interfaces (if methods are\n\t// enabled) are supported, with other types sorted according to the\n\t// reflect.Value.String() output which guarantees display stability.\n\tSortKeys bool\n\n\t// SpewKeys specifies that, as a last resort attempt, map keys should\n\t// be spewed to strings and sorted by those strings.  This is only\n\t// considered if SortKeys is true.\n\tSpewKeys bool\n}\n\n// Config is the active configuration of the top-level functions.\n// The configuration can be changed by modifying the contents of spew.Config.\nvar Config = ConfigState{Indent: \" \"}\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the formatted string as a value that satisfies error.  See NewFormatter\n// for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, c.convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, c.convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, c.convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a Formatter interface returned by c.NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, c.convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(c.convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, c.convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(c.convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(c.convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, c.convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a Formatter interface returned by c.NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(c.convertArgs(a)...)\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nc.Printf, c.Println, or c.Printf.\n*/\nfunc (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(c, v)\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {\n\tfdump(c, w, a...)\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by modifying the public members\nof c.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc (c *ConfigState) Dump(a ...interface{}) {\n\tfdump(c, os.Stdout, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc (c *ConfigState) Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(c, &buf, a...)\n\treturn buf.String()\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a spew Formatter interface using\n// the ConfigState associated with s.\nfunc (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = newFormatter(c, arg)\n\t}\n\treturn formatters\n}\n\n// NewDefaultConfig returns a ConfigState with the following default settings.\n//\n// \tIndent: \" \"\n// \tMaxDepth: 0\n// \tDisableMethods: false\n// \tDisablePointerMethods: false\n// \tContinueOnMethod: false\n// \tSortKeys: false\nfunc NewDefaultConfig() *ConfigState {\n\treturn &ConfigState{Indent: \" \"}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/doc.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nPackage spew implements a deep pretty printer for Go data structures to aid in\ndebugging.\n\nA quick overview of the additional features spew provides over the built-in\nprinting facilities for Go data types are as follows:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output (only when using\n\t  Dump style)\n\nThere are two different approaches spew allows for dumping Go data structures:\n\n\t* Dump style which prints with newlines, customizable indentation,\n\t  and additional debug information such as types and all pointer addresses\n\t  used to indirect to the final value\n\t* A custom Formatter interface that integrates cleanly with the standard fmt\n\t  package and replaces %v, %+v, %#v, and %#+v to provide inline printing\n\t  similar to the default %v while providing the additional functionality\n\t  outlined above and passing unsupported format verbs such as %x and %q\n\t  along to fmt\n\nQuick Start\n\nThis section demonstrates how to quickly get started with spew.  See the\nsections below for further details on formatting and configuration options.\n\nTo dump a variable with full newlines, indentation, type, and pointer\ninformation use Dump, Fdump, or Sdump:\n\tspew.Dump(myVar1, myVar2, ...)\n\tspew.Fdump(someWriter, myVar1, myVar2, ...)\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nAlternatively, if you would prefer to use format strings with a compacted inline\nprinting style, use the convenience wrappers Printf, Fprintf, etc with\n%v (most compact), %+v (adds pointer addresses), %#v (adds types), or\n%#+v (adds types and pointer addresses):\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Fprintf(someWriter, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(someWriter, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nConfiguration Options\n\nConfiguration of spew is handled by fields in the ConfigState type.  For\nconvenience, all of the top-level functions use a global state available\nvia the spew.Config global.\n\nIt is also possible to create a ConfigState instance that provides methods\nequivalent to the top-level functions.  This allows concurrent configuration\noptions.  See the ConfigState documentation for more details.\n\nThe following configuration options are available:\n\t* Indent\n\t\tString to use for each indentation level for Dump functions.\n\t\tIt is a single space by default.  A popular alternative is \"\\t\".\n\n\t* MaxDepth\n\t\tMaximum number of levels to descend into nested data structures.\n\t\tThere is no limit by default.\n\n\t* DisableMethods\n\t\tDisables invocation of error and Stringer interface methods.\n\t\tMethod invocation is enabled by default.\n\n\t* DisablePointerMethods\n\t\tDisables invocation of error and Stringer interface methods on types\n\t\twhich only accept pointer receivers from non-pointer variables.\n\t\tPointer method invocation is enabled by default.\n\n\t* DisablePointerAddresses\n\t\tDisablePointerAddresses specifies whether to disable the printing of\n\t\tpointer addresses. This is useful when diffing data structures in tests.\n\n\t* DisableCapacities\n\t\tDisableCapacities specifies whether to disable the printing of\n\t\tcapacities for arrays, slices, maps and channels. This is useful when\n\t\tdiffing data structures in tests.\n\n\t* ContinueOnMethod\n\t\tEnables recursion into types after invoking error and Stringer interface\n\t\tmethods. Recursion after method invocation is disabled by default.\n\n\t* SortKeys\n\t\tSpecifies map keys should be sorted before being printed. Use\n\t\tthis to have a more deterministic, diffable output.  Note that\n\t\tonly native types (bool, int, uint, floats, uintptr and string)\n\t\tand types which implement error or Stringer interfaces are\n\t\tsupported with other types sorted according to the\n\t\treflect.Value.String() output which guarantees display\n\t\tstability.  Natural map order is used by default.\n\n\t* SpewKeys\n\t\tSpecifies that, as a last resort attempt, map keys should be\n\t\tspewed to strings and sorted by those strings.  This is only\n\t\tconsidered if SortKeys is true.\n\nDump Usage\n\nSimply call spew.Dump with a list of variables you want to dump:\n\n\tspew.Dump(myVar1, myVar2, ...)\n\nYou may also call spew.Fdump if you would prefer to output to an arbitrary\nio.Writer.  For example, to dump to standard error:\n\n\tspew.Fdump(os.Stderr, myVar1, myVar2, ...)\n\nA third option is to call spew.Sdump to get the formatted output as a string:\n\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nSample Dump Output\n\nSee the Dump example for details on the setup of the types and variables being\nshown here.\n\n\t(main.Foo) {\n\t unexportedField: (*main.Bar)(0xf84002e210)({\n\t  flag: (main.Flag) flagTwo,\n\t  data: (uintptr) <nil>\n\t }),\n\t ExportedField: (map[interface {}]interface {}) (len=1) {\n\t  (string) (len=3) \"one\": (bool) true\n\t }\n\t}\n\nByte (and uint8) arrays and slices are displayed uniquely like the hexdump -C\ncommand as shown.\n\t([]uint8) (len=32 cap=32) {\n\t 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |\n\t 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!\"#$%&'()*+,-./0|\n\t 00000020  31 32                                             |12|\n\t}\n\nCustom Formatter\n\nSpew provides a custom formatter that implements the fmt.Formatter interface\nso that it integrates cleanly with standard fmt package printing functions. The\nformatter is useful for inline printing of smaller data types similar to the\nstandard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nCustom Formatter Usage\n\nThe simplest way to make use of the spew custom formatter is to call one of the\nconvenience functions such as spew.Printf, spew.Println, or spew.Printf.  The\nfunctions have syntax you are most likely already familiar with:\n\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Println(myVar, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nSee the Index for the full list convenience functions.\n\nSample Formatter Output\n\nDouble pointer to a uint8:\n\t  %v: <**>5\n\t %+v: <**>(0xf8400420d0->0xf8400420c8)5\n\t %#v: (**uint8)5\n\t%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5\n\nPointer to circular struct with a uint8 field and a pointer to itself:\n\t  %v: <*>{1 <*><shown>}\n\t %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}\n\t %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}\n\t%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}\n\nSee the Printf example for details on the setup of variables being shown\nhere.\n\nErrors\n\nSince it is possible for custom Stringer/error interfaces to panic, spew\ndetects them and handles them internally by printing the panic information\ninline with the output.  Since spew is intended to provide deep pretty printing\ncapabilities on structures, it intentionally does not return any errors.\n*/\npackage spew\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/dump.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nvar (\n\t// uint8Type is a reflect.Type representing a uint8.  It is used to\n\t// convert cgo types to uint8 slices for hexdumping.\n\tuint8Type = reflect.TypeOf(uint8(0))\n\n\t// cCharRE is a regular expression that matches a cgo char.\n\t// It is used to detect character arrays to hexdump them.\n\tcCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_char$\")\n\n\t// cUnsignedCharRE is a regular expression that matches a cgo unsigned\n\t// char.  It is used to detect unsigned character arrays to hexdump\n\t// them.\n\tcUnsignedCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_unsignedchar$\")\n\n\t// cUint8tCharRE is a regular expression that matches a cgo uint8_t.\n\t// It is used to detect uint8_t arrays to hexdump them.\n\tcUint8tCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_uint8_t$\")\n)\n\n// dumpState contains information about the state of a dump operation.\ntype dumpState struct {\n\tw                io.Writer\n\tdepth            int\n\tpointers         map[uintptr]int\n\tignoreNextType   bool\n\tignoreNextIndent bool\n\tcs               *ConfigState\n}\n\n// indent performs indentation according to the depth level and cs.Indent\n// option.\nfunc (d *dumpState) indent() {\n\tif d.ignoreNextIndent {\n\t\td.ignoreNextIndent = false\n\t\treturn\n\t}\n\td.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (d *dumpState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface && !v.IsNil() {\n\t\tv = v.Elem()\n\t}\n\treturn v\n}\n\n// dumpPtr handles formatting of pointers by indirecting them as necessary.\nfunc (d *dumpState) dumpPtr(v reflect.Value) {\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range d.pointers {\n\t\tif depth >= d.depth {\n\t\t\tdelete(d.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by dereferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := d.pointers[addr]; ok && pd < d.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\td.pointers[addr] = d.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type information.\n\td.w.Write(openParenBytes)\n\td.w.Write(bytes.Repeat(asteriskBytes, indirects))\n\td.w.Write([]byte(ve.Type().String()))\n\td.w.Write(closeParenBytes)\n\n\t// Display pointer information.\n\tif !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {\n\t\td.w.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\td.w.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(d.w, addr)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\td.w.Write(openParenBytes)\n\tswitch {\n\tcase nilFound == true:\n\t\td.w.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\td.w.Write(circularBytes)\n\n\tdefault:\n\t\td.ignoreNextType = true\n\t\td.dump(ve)\n\t}\n\td.w.Write(closeParenBytes)\n}\n\n// dumpSlice handles formatting of arrays and slices.  Byte (uint8 under\n// reflection) arrays and slices are dumped in hexdump -C fashion.\nfunc (d *dumpState) dumpSlice(v reflect.Value) {\n\t// Determine whether this type should be hex dumped or not.  Also,\n\t// for types which should be hexdumped, try to use the underlying data\n\t// first, then fall back to trying to convert them to a uint8 slice.\n\tvar buf []uint8\n\tdoConvert := false\n\tdoHexDump := false\n\tnumEntries := v.Len()\n\tif numEntries > 0 {\n\t\tvt := v.Index(0).Type()\n\t\tvts := vt.String()\n\t\tswitch {\n\t\t// C types that need to be converted.\n\t\tcase cCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUnsignedCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUint8tCharRE.MatchString(vts):\n\t\t\tdoConvert = true\n\n\t\t// Try to use existing uint8 slices and fall back to converting\n\t\t// and copying if that fails.\n\t\tcase vt.Kind() == reflect.Uint8:\n\t\t\t// We need an addressable interface to convert the type\n\t\t\t// to a byte slice.  However, the reflect package won't\n\t\t\t// give us an interface on certain things like\n\t\t\t// unexported struct fields in order to enforce\n\t\t\t// visibility rules.  We use unsafe, when available, to\n\t\t\t// bypass these restrictions since this package does not\n\t\t\t// mutate the values.\n\t\t\tvs := v\n\t\t\tif !vs.CanInterface() || !vs.CanAddr() {\n\t\t\t\tvs = unsafeReflectValue(vs)\n\t\t\t}\n\t\t\tif !UnsafeDisabled {\n\t\t\t\tvs = vs.Slice(0, numEntries)\n\n\t\t\t\t// Use the existing uint8 slice if it can be\n\t\t\t\t// type asserted.\n\t\t\t\tiface := vs.Interface()\n\t\t\t\tif slice, ok := iface.([]uint8); ok {\n\t\t\t\t\tbuf = slice\n\t\t\t\t\tdoHexDump = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The underlying data needs to be converted if it can't\n\t\t\t// be type asserted to a uint8 slice.\n\t\t\tdoConvert = true\n\t\t}\n\n\t\t// Copy and convert the underlying type if needed.\n\t\tif doConvert && vt.ConvertibleTo(uint8Type) {\n\t\t\t// Convert and copy each element into a uint8 byte\n\t\t\t// slice.\n\t\t\tbuf = make([]uint8, numEntries)\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tvv := v.Index(i)\n\t\t\t\tbuf[i] = uint8(vv.Convert(uint8Type).Uint())\n\t\t\t}\n\t\t\tdoHexDump = true\n\t\t}\n\t}\n\n\t// Hexdump the entire slice as needed.\n\tif doHexDump {\n\t\tindent := strings.Repeat(d.cs.Indent, d.depth)\n\t\tstr := indent + hex.Dump(buf)\n\t\tstr = strings.Replace(str, \"\\n\", \"\\n\"+indent, -1)\n\t\tstr = strings.TrimRight(str, d.cs.Indent)\n\t\td.w.Write([]byte(str))\n\t\treturn\n\t}\n\n\t// Recursively call dump for each item.\n\tfor i := 0; i < numEntries; i++ {\n\t\td.dump(d.unpackValue(v.Index(i)))\n\t\tif i < (numEntries - 1) {\n\t\t\td.w.Write(commaNewlineBytes)\n\t\t} else {\n\t\t\td.w.Write(newlineBytes)\n\t\t}\n\t}\n}\n\n// dump is the main workhorse for dumping a value.  It uses the passed reflect\n// value to figure out what kind of object we are dealing with and formats it\n// appropriately.  It is a recursive function, however circular data structures\n// are detected and handled properly.\nfunc (d *dumpState) dump(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\td.w.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\td.indent()\n\t\td.dumpPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !d.ignoreNextType {\n\t\td.indent()\n\t\td.w.Write(openParenBytes)\n\t\td.w.Write([]byte(v.Type().String()))\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\td.ignoreNextType = false\n\n\t// Display length and capacity if the built-in len and cap functions\n\t// work with the value's kind and the len/cap itself is non-zero.\n\tvalueLen, valueCap := 0, 0\n\tswitch v.Kind() {\n\tcase reflect.Array, reflect.Slice, reflect.Chan:\n\t\tvalueLen, valueCap = v.Len(), v.Cap()\n\tcase reflect.Map, reflect.String:\n\t\tvalueLen = v.Len()\n\t}\n\tif valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {\n\t\td.w.Write(openParenBytes)\n\t\tif valueLen != 0 {\n\t\t\td.w.Write(lenEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueLen), 10)\n\t\t}\n\t\tif !d.cs.DisableCapacities && valueCap != 0 {\n\t\t\tif valueLen != 0 {\n\t\t\t\td.w.Write(spaceBytes)\n\t\t\t}\n\t\t\td.w.Write(capEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueCap), 10)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\n\t// Call Stringer/error interfaces if they exist and the handle methods flag\n\t// is enabled\n\tif !d.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(d.cs, d.w, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(d.w, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(d.w, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(d.w, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(d.w, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(d.w, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(d.w, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(d.w, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\td.dumpSlice(v)\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.String:\n\t\td.w.Write([]byte(strconv.Quote(v.String())))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tkeys := v.MapKeys()\n\t\t\tif d.cs.SortKeys {\n\t\t\t\tsortValues(keys, d.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\td.dump(d.unpackValue(key))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.MapIndex(key)))\n\t\t\t\tif i < (numEntries - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Struct:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tnumFields := v.NumField()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\td.indent()\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\td.w.Write([]byte(vtf.Name))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.Field(i)))\n\t\t\t\tif i < (numFields - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(d.w, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(d.w, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it in case any new\n\t// types are added.\n\tdefault:\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.String())\n\t\t}\n\t}\n}\n\n// fdump is a helper function to consolidate the logic from the various public\n// methods which take varying writers and config states.\nfunc fdump(cs *ConfigState, w io.Writer, a ...interface{}) {\n\tfor _, arg := range a {\n\t\tif arg == nil {\n\t\t\tw.Write(interfaceBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\tw.Write(nilAngleBytes)\n\t\t\tw.Write(newlineBytes)\n\t\t\tcontinue\n\t\t}\n\n\t\td := dumpState{w: w, cs: cs}\n\t\td.pointers = make(map[uintptr]int)\n\t\td.dump(reflect.ValueOf(arg))\n\t\td.w.Write(newlineBytes)\n\t}\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc Fdump(w io.Writer, a ...interface{}) {\n\tfdump(&Config, w, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(&Config, &buf, a...)\n\treturn buf.String()\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by an exported package global,\nspew.Config.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc Dump(a ...interface{}) {\n\tfdump(&Config, os.Stdout, a...)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/format.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// supportedFlags is a list of all the character flags supported by fmt package.\nconst supportedFlags = \"0-+# \"\n\n// formatState implements the fmt.Formatter interface and contains information\n// about the state of a formatting operation.  The NewFormatter function can\n// be used to get a new Formatter which can be used directly as arguments\n// in standard fmt package printing calls.\ntype formatState struct {\n\tvalue          interface{}\n\tfs             fmt.State\n\tdepth          int\n\tpointers       map[uintptr]int\n\tignoreNextType bool\n\tcs             *ConfigState\n}\n\n// buildDefaultFormat recreates the original format string without precision\n// and width information to pass in to fmt.Sprintf in the case of an\n// unrecognized type.  Unless new types are added to the language, this\n// function won't ever be called.\nfunc (f *formatState) buildDefaultFormat() (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tbuf.WriteRune('v')\n\n\tformat = buf.String()\n\treturn format\n}\n\n// constructOrigFormat recreates the original format string including precision\n// and width information to pass along to the standard fmt package.  This allows\n// automatic deferral of all format strings this package doesn't support.\nfunc (f *formatState) constructOrigFormat(verb rune) (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tif width, ok := f.fs.Width(); ok {\n\t\tbuf.WriteString(strconv.Itoa(width))\n\t}\n\n\tif precision, ok := f.fs.Precision(); ok {\n\t\tbuf.Write(precisionBytes)\n\t\tbuf.WriteString(strconv.Itoa(precision))\n\t}\n\n\tbuf.WriteRune(verb)\n\n\tformat = buf.String()\n\treturn format\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible and\n// ensures that types for values which have been unpacked from an interface\n// are displayed when the show types flag is also set.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (f *formatState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface {\n\t\tf.ignoreNextType = false\n\t\tif !v.IsNil() {\n\t\t\tv = v.Elem()\n\t\t}\n\t}\n\treturn v\n}\n\n// formatPtr handles formatting of pointers by indirecting them as necessary.\nfunc (f *formatState) formatPtr(v reflect.Value) {\n\t// Display nil if top level pointer is nil.\n\tshowTypes := f.fs.Flag('#')\n\tif v.IsNil() && (!showTypes || f.ignoreNextType) {\n\t\tf.fs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range f.pointers {\n\t\tif depth >= f.depth {\n\t\t\tdelete(f.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to possibly show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by derferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := f.pointers[addr]; ok && pd < f.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\tf.pointers[addr] = f.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type or indirection level depending on flags.\n\tif showTypes && !f.ignoreNextType {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write(bytes.Repeat(asteriskBytes, indirects))\n\t\tf.fs.Write([]byte(ve.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t} else {\n\t\tif nilFound || cycleFound {\n\t\t\tindirects += strings.Count(ve.Type().String(), \"*\")\n\t\t}\n\t\tf.fs.Write(openAngleBytes)\n\t\tf.fs.Write([]byte(strings.Repeat(\"*\", indirects)))\n\t\tf.fs.Write(closeAngleBytes)\n\t}\n\n\t// Display pointer information depending on flags.\n\tif f.fs.Flag('+') && (len(pointerChain) > 0) {\n\t\tf.fs.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\tf.fs.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(f.fs, addr)\n\t\t}\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\tswitch {\n\tcase nilFound == true:\n\t\tf.fs.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\tf.fs.Write(circularShortBytes)\n\n\tdefault:\n\t\tf.ignoreNextType = true\n\t\tf.format(ve)\n\t}\n}\n\n// format is the main workhorse for providing the Formatter interface.  It\n// uses the passed reflect value to figure out what kind of object we are\n// dealing with and formats it appropriately.  It is a recursive function,\n// however circular data structures are detected and handled properly.\nfunc (f *formatState) format(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\tf.fs.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\tf.formatPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !f.ignoreNextType && f.fs.Flag('#') {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write([]byte(v.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\tf.ignoreNextType = false\n\n\t// Call Stringer/error interfaces if they exist and the handle methods\n\t// flag is enabled.\n\tif !f.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(f.cs, f.fs, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(f.fs, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(f.fs, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(f.fs, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(f.fs, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(f.fs, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(f.fs, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(f.fs, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\tf.fs.Write(openBracketBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.Index(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBracketBytes)\n\n\tcase reflect.String:\n\t\tf.fs.Write([]byte(v.String()))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\tf.fs.Write(openMapBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tkeys := v.MapKeys()\n\t\t\tif f.cs.SortKeys {\n\t\t\t\tsortValues(keys, f.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(key))\n\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.MapIndex(key)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeMapBytes)\n\n\tcase reflect.Struct:\n\t\tnumFields := v.NumField()\n\t\tf.fs.Write(openBraceBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\tif f.fs.Flag('+') || f.fs.Flag('#') {\n\t\t\t\t\tf.fs.Write([]byte(vtf.Name))\n\t\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\t}\n\t\t\t\tf.format(f.unpackValue(v.Field(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(f.fs, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(f.fs, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it if any get added.\n\tdefault:\n\t\tformat := f.buildDefaultFormat()\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(f.fs, format, v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(f.fs, format, v.String())\n\t\t}\n\t}\n}\n\n// Format satisfies the fmt.Formatter interface. See NewFormatter for usage\n// details.\nfunc (f *formatState) Format(fs fmt.State, verb rune) {\n\tf.fs = fs\n\n\t// Use standard formatting for verbs that are not v.\n\tif verb != 'v' {\n\t\tformat := f.constructOrigFormat(verb)\n\t\tfmt.Fprintf(fs, format, f.value)\n\t\treturn\n\t}\n\n\tif f.value == nil {\n\t\tif fs.Flag('#') {\n\t\t\tfs.Write(interfaceBytes)\n\t\t}\n\t\tfs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\tf.format(reflect.ValueOf(f.value))\n}\n\n// newFormatter is a helper function to consolidate the logic from the various\n// public methods which take varying config states.\nfunc newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {\n\tfs := &formatState{value: v, cs: cs}\n\tfs.pointers = make(map[uintptr]int)\n\treturn fs\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nPrintf, Println, or Fprintf.\n*/\nfunc NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(&Config, v)\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew/spew.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the formatted string as a value that satisfies error.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a default Formatter interface returned by NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(convertArgs(a)...)\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a default spew Formatter interface.\nfunc convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = NewFormatter(arg)\n\t}\n\treturn formatters\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/pmezard/go-difflib/LICENSE",
    "content": "Copyright (c) 2013, Patrick Mezard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n    Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n    The names of its contributors may not be used to endorse or promote\nproducts derived from this software without specific prior written\npermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/pmezard/go-difflib/difflib/difflib.go",
    "content": "// Package difflib is a partial port of Python difflib module.\n//\n// It provides tools to compare sequences of strings and generate textual diffs.\n//\n// The following class and functions have been ported:\n//\n// - SequenceMatcher\n//\n// - unified_diff\n//\n// - context_diff\n//\n// Getting unified diffs was the main goal of the port. Keep in mind this code\n// is mostly suitable to output text differences in a human friendly way, there\n// are no guarantees generated diffs are consumable by patch(1).\npackage difflib\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n)\n\nfunc min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc max(a, b int) int {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc calculateRatio(matches, length int) float64 {\n\tif length > 0 {\n\t\treturn 2.0 * float64(matches) / float64(length)\n\t}\n\treturn 1.0\n}\n\ntype Match struct {\n\tA    int\n\tB    int\n\tSize int\n}\n\ntype OpCode struct {\n\tTag byte\n\tI1  int\n\tI2  int\n\tJ1  int\n\tJ2  int\n}\n\n// SequenceMatcher compares sequence of strings. The basic\n// algorithm predates, and is a little fancier than, an algorithm\n// published in the late 1980's by Ratcliff and Obershelp under the\n// hyperbolic name \"gestalt pattern matching\".  The basic idea is to find\n// the longest contiguous matching subsequence that contains no \"junk\"\n// elements (R-O doesn't address junk).  The same idea is then applied\n// recursively to the pieces of the sequences to the left and to the right\n// of the matching subsequence.  This does not yield minimal edit\n// sequences, but does tend to yield matches that \"look right\" to people.\n//\n// SequenceMatcher tries to compute a \"human-friendly diff\" between two\n// sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the\n// longest *contiguous* & junk-free matching subsequence.  That's what\n// catches peoples' eyes.  The Windows(tm) windiff has another interesting\n// notion, pairing up elements that appear uniquely in each sequence.\n// That, and the method here, appear to yield more intuitive difference\n// reports than does diff.  This method appears to be the least vulnerable\n// to synching up on blocks of \"junk lines\", though (like blank lines in\n// ordinary text files, or maybe \"<P>\" lines in HTML files).  That may be\n// because this is the only method of the 3 that has a *concept* of\n// \"junk\" <wink>.\n//\n// Timing:  Basic R-O is cubic time worst case and quadratic time expected\n// case.  SequenceMatcher is quadratic time for the worst case and has\n// expected-case behavior dependent in a complicated way on how many\n// elements the sequences have in common; best case time is linear.\ntype SequenceMatcher struct {\n\ta              []string\n\tb              []string\n\tb2j            map[string][]int\n\tIsJunk         func(string) bool\n\tautoJunk       bool\n\tbJunk          map[string]struct{}\n\tmatchingBlocks []Match\n\tfullBCount     map[string]int\n\tbPopular       map[string]struct{}\n\topCodes        []OpCode\n}\n\nfunc NewMatcher(a, b []string) *SequenceMatcher {\n\tm := SequenceMatcher{autoJunk: true}\n\tm.SetSeqs(a, b)\n\treturn &m\n}\n\nfunc NewMatcherWithJunk(a, b []string, autoJunk bool,\n\tisJunk func(string) bool) *SequenceMatcher {\n\n\tm := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk}\n\tm.SetSeqs(a, b)\n\treturn &m\n}\n\n// Set two sequences to be compared.\nfunc (m *SequenceMatcher) SetSeqs(a, b []string) {\n\tm.SetSeq1(a)\n\tm.SetSeq2(b)\n}\n\n// Set the first sequence to be compared. The second sequence to be compared is\n// not changed.\n//\n// SequenceMatcher computes and caches detailed information about the second\n// sequence, so if you want to compare one sequence S against many sequences,\n// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other\n// sequences.\n//\n// See also SetSeqs() and SetSeq2().\nfunc (m *SequenceMatcher) SetSeq1(a []string) {\n\tif &a == &m.a {\n\t\treturn\n\t}\n\tm.a = a\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n}\n\n// Set the second sequence to be compared. The first sequence to be compared is\n// not changed.\nfunc (m *SequenceMatcher) SetSeq2(b []string) {\n\tif &b == &m.b {\n\t\treturn\n\t}\n\tm.b = b\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n\tm.fullBCount = nil\n\tm.chainB()\n}\n\nfunc (m *SequenceMatcher) chainB() {\n\t// Populate line -> index mapping\n\tb2j := map[string][]int{}\n\tfor i, s := range m.b {\n\t\tindices := b2j[s]\n\t\tindices = append(indices, i)\n\t\tb2j[s] = indices\n\t}\n\n\t// Purge junk elements\n\tm.bJunk = map[string]struct{}{}\n\tif m.IsJunk != nil {\n\t\tjunk := m.bJunk\n\t\tfor s, _ := range b2j {\n\t\t\tif m.IsJunk(s) {\n\t\t\t\tjunk[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range junk {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\n\t// Purge remaining popular elements\n\tpopular := map[string]struct{}{}\n\tn := len(m.b)\n\tif m.autoJunk && n >= 200 {\n\t\tntest := n/100 + 1\n\t\tfor s, indices := range b2j {\n\t\t\tif len(indices) > ntest {\n\t\t\t\tpopular[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range popular {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\tm.bPopular = popular\n\tm.b2j = b2j\n}\n\nfunc (m *SequenceMatcher) isBJunk(s string) bool {\n\t_, ok := m.bJunk[s]\n\treturn ok\n}\n\n// Find longest matching block in a[alo:ahi] and b[blo:bhi].\n//\n// If IsJunk is not defined:\n//\n// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where\n//     alo <= i <= i+k <= ahi\n//     blo <= j <= j+k <= bhi\n// and for all (i',j',k') meeting those conditions,\n//     k >= k'\n//     i <= i'\n//     and if i == i', j <= j'\n//\n// In other words, of all maximal matching blocks, return one that\n// starts earliest in a, and of all those maximal matching blocks that\n// start earliest in a, return the one that starts earliest in b.\n//\n// If IsJunk is defined, first the longest matching block is\n// determined as above, but with the additional restriction that no\n// junk element appears in the block.  Then that block is extended as\n// far as possible by matching (only) junk elements on both sides.  So\n// the resulting block never matches on junk except as identical junk\n// happens to be adjacent to an \"interesting\" match.\n//\n// If no blocks match, return (alo, blo, 0).\nfunc (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {\n\t// CAUTION:  stripping common prefix or suffix would be incorrect.\n\t// E.g.,\n\t//    ab\n\t//    acab\n\t// Longest matching block is \"ab\", but if common prefix is\n\t// stripped, it's \"a\" (tied with \"b\").  UNIX(tm) diff does so\n\t// strip, so ends up claiming that ab is changed to acab by\n\t// inserting \"ca\" in the middle.  That's minimal but unintuitive:\n\t// \"it's obvious\" that someone inserted \"ac\" at the front.\n\t// Windiff ends up at the same place as diff, but by pairing up\n\t// the unique 'b's and then matching the first two 'a's.\n\tbesti, bestj, bestsize := alo, blo, 0\n\n\t// find longest junk-free match\n\t// during an iteration of the loop, j2len[j] = length of longest\n\t// junk-free match ending with a[i-1] and b[j]\n\tj2len := map[int]int{}\n\tfor i := alo; i != ahi; i++ {\n\t\t// look at all instances of a[i] in b; note that because\n\t\t// b2j has no junk keys, the loop is skipped if a[i] is junk\n\t\tnewj2len := map[int]int{}\n\t\tfor _, j := range m.b2j[m.a[i]] {\n\t\t\t// a[i] matches b[j]\n\t\t\tif j < blo {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif j >= bhi {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tk := j2len[j-1] + 1\n\t\t\tnewj2len[j] = k\n\t\t\tif k > bestsize {\n\t\t\t\tbesti, bestj, bestsize = i-k+1, j-k+1, k\n\t\t\t}\n\t\t}\n\t\tj2len = newj2len\n\t}\n\n\t// Extend the best by non-junk elements on each end.  In particular,\n\t// \"popular\" non-junk elements aren't in b2j, which greatly speeds\n\t// the inner loop above, but also means \"the best\" match so far\n\t// doesn't contain any junk *or* popular non-junk elements.\n\tfor besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\t!m.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\t// Now that we have a wholly interesting match (albeit possibly\n\t// empty!), we may as well suck up the matching junk on each\n\t// side of it too.  Can't think of a good reason not to, and it\n\t// saves post-processing the (possibly considerable) expense of\n\t// figuring out what to do with it.  In the case of an empty\n\t// interesting match, this is clearly the right thing to do,\n\t// because no other kind of match is possible in the regions.\n\tfor besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\tm.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\treturn Match{A: besti, B: bestj, Size: bestsize}\n}\n\n// Return list of triples describing matching subsequences.\n//\n// Each triple is of the form (i, j, n), and means that\n// a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in\n// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are\n// adjacent triples in the list, and the second is not the last triple in the\n// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe\n// adjacent equal blocks.\n//\n// The last triple is a dummy, (len(a), len(b), 0), and is the only\n// triple with n==0.\nfunc (m *SequenceMatcher) GetMatchingBlocks() []Match {\n\tif m.matchingBlocks != nil {\n\t\treturn m.matchingBlocks\n\t}\n\n\tvar matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match\n\tmatchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {\n\t\tmatch := m.findLongestMatch(alo, ahi, blo, bhi)\n\t\ti, j, k := match.A, match.B, match.Size\n\t\tif match.Size > 0 {\n\t\t\tif alo < i && blo < j {\n\t\t\t\tmatched = matchBlocks(alo, i, blo, j, matched)\n\t\t\t}\n\t\t\tmatched = append(matched, match)\n\t\t\tif i+k < ahi && j+k < bhi {\n\t\t\t\tmatched = matchBlocks(i+k, ahi, j+k, bhi, matched)\n\t\t\t}\n\t\t}\n\t\treturn matched\n\t}\n\tmatched := matchBlocks(0, len(m.a), 0, len(m.b), nil)\n\n\t// It's possible that we have adjacent equal blocks in the\n\t// matching_blocks list now.\n\tnonAdjacent := []Match{}\n\ti1, j1, k1 := 0, 0, 0\n\tfor _, b := range matched {\n\t\t// Is this block adjacent to i1, j1, k1?\n\t\ti2, j2, k2 := b.A, b.B, b.Size\n\t\tif i1+k1 == i2 && j1+k1 == j2 {\n\t\t\t// Yes, so collapse them -- this just increases the length of\n\t\t\t// the first block by the length of the second, and the first\n\t\t\t// block so lengthened remains the block to compare against.\n\t\t\tk1 += k2\n\t\t} else {\n\t\t\t// Not adjacent.  Remember the first block (k1==0 means it's\n\t\t\t// the dummy we started with), and make the second block the\n\t\t\t// new block to compare against.\n\t\t\tif k1 > 0 {\n\t\t\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t\t\t}\n\t\t\ti1, j1, k1 = i2, j2, k2\n\t\t}\n\t}\n\tif k1 > 0 {\n\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t}\n\n\tnonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})\n\tm.matchingBlocks = nonAdjacent\n\treturn m.matchingBlocks\n}\n\n// Return list of 5-tuples describing how to turn a into b.\n//\n// Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple\n// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the\n// tuple preceding it, and likewise for j1 == the previous j2.\n//\n// The tags are characters, with these meanings:\n//\n// 'r' (replace):  a[i1:i2] should be replaced by b[j1:j2]\n//\n// 'd' (delete):   a[i1:i2] should be deleted, j1==j2 in this case.\n//\n// 'i' (insert):   b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.\n//\n// 'e' (equal):    a[i1:i2] == b[j1:j2]\nfunc (m *SequenceMatcher) GetOpCodes() []OpCode {\n\tif m.opCodes != nil {\n\t\treturn m.opCodes\n\t}\n\ti, j := 0, 0\n\tmatching := m.GetMatchingBlocks()\n\topCodes := make([]OpCode, 0, len(matching))\n\tfor _, m := range matching {\n\t\t//  invariant:  we've pumped out correct diffs to change\n\t\t//  a[:i] into b[:j], and the next matching block is\n\t\t//  a[ai:ai+size] == b[bj:bj+size]. So we need to pump\n\t\t//  out a diff to change a[i:ai] into b[j:bj], pump out\n\t\t//  the matching block, and move (i,j) beyond the match\n\t\tai, bj, size := m.A, m.B, m.Size\n\t\ttag := byte(0)\n\t\tif i < ai && j < bj {\n\t\t\ttag = 'r'\n\t\t} else if i < ai {\n\t\t\ttag = 'd'\n\t\t} else if j < bj {\n\t\t\ttag = 'i'\n\t\t}\n\t\tif tag > 0 {\n\t\t\topCodes = append(opCodes, OpCode{tag, i, ai, j, bj})\n\t\t}\n\t\ti, j = ai+size, bj+size\n\t\t// the list of matching blocks is terminated by a\n\t\t// sentinel with size 0\n\t\tif size > 0 {\n\t\t\topCodes = append(opCodes, OpCode{'e', ai, i, bj, j})\n\t\t}\n\t}\n\tm.opCodes = opCodes\n\treturn m.opCodes\n}\n\n// Isolate change clusters by eliminating ranges with no changes.\n//\n// Return a generator of groups with up to n lines of context.\n// Each group is in the same format as returned by GetOpCodes().\nfunc (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {\n\tif n < 0 {\n\t\tn = 3\n\t}\n\tcodes := m.GetOpCodes()\n\tif len(codes) == 0 {\n\t\tcodes = []OpCode{OpCode{'e', 0, 1, 0, 1}}\n\t}\n\t// Fixup leading and trailing groups if they show no changes.\n\tif codes[0].Tag == 'e' {\n\t\tc := codes[0]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}\n\t}\n\tif codes[len(codes)-1].Tag == 'e' {\n\t\tc := codes[len(codes)-1]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}\n\t}\n\tnn := n + n\n\tgroups := [][]OpCode{}\n\tgroup := []OpCode{}\n\tfor _, c := range codes {\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t// End the current group and start a new one whenever\n\t\t// there is a large range with no changes.\n\t\tif c.Tag == 'e' && i2-i1 > nn {\n\t\t\tgroup = append(group, OpCode{c.Tag, i1, min(i2, i1+n),\n\t\t\t\tj1, min(j2, j1+n)})\n\t\t\tgroups = append(groups, group)\n\t\t\tgroup = []OpCode{}\n\t\t\ti1, j1 = max(i1, i2-n), max(j1, j2-n)\n\t\t}\n\t\tgroup = append(group, OpCode{c.Tag, i1, i2, j1, j2})\n\t}\n\tif len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {\n\t\tgroups = append(groups, group)\n\t}\n\treturn groups\n}\n\n// Return a measure of the sequences' similarity (float in [0,1]).\n//\n// Where T is the total number of elements in both sequences, and\n// M is the number of matches, this is 2.0*M / T.\n// Note that this is 1 if the sequences are identical, and 0 if\n// they have nothing in common.\n//\n// .Ratio() is expensive to compute if you haven't already computed\n// .GetMatchingBlocks() or .GetOpCodes(), in which case you may\n// want to try .QuickRatio() or .RealQuickRation() first to get an\n// upper bound.\nfunc (m *SequenceMatcher) Ratio() float64 {\n\tmatches := 0\n\tfor _, m := range m.GetMatchingBlocks() {\n\t\tmatches += m.Size\n\t}\n\treturn calculateRatio(matches, len(m.a)+len(m.b))\n}\n\n// Return an upper bound on ratio() relatively quickly.\n//\n// This isn't defined beyond that it is an upper bound on .Ratio(), and\n// is faster to compute.\nfunc (m *SequenceMatcher) QuickRatio() float64 {\n\t// viewing a and b as multisets, set matches to the cardinality\n\t// of their intersection; this counts the number of matches\n\t// without regard to order, so is clearly an upper bound\n\tif m.fullBCount == nil {\n\t\tm.fullBCount = map[string]int{}\n\t\tfor _, s := range m.b {\n\t\t\tm.fullBCount[s] = m.fullBCount[s] + 1\n\t\t}\n\t}\n\n\t// avail[x] is the number of times x appears in 'b' less the\n\t// number of times we've seen it in 'a' so far ... kinda\n\tavail := map[string]int{}\n\tmatches := 0\n\tfor _, s := range m.a {\n\t\tn, ok := avail[s]\n\t\tif !ok {\n\t\t\tn = m.fullBCount[s]\n\t\t}\n\t\tavail[s] = n - 1\n\t\tif n > 0 {\n\t\t\tmatches += 1\n\t\t}\n\t}\n\treturn calculateRatio(matches, len(m.a)+len(m.b))\n}\n\n// Return an upper bound on ratio() very quickly.\n//\n// This isn't defined beyond that it is an upper bound on .Ratio(), and\n// is faster to compute than either .Ratio() or .QuickRatio().\nfunc (m *SequenceMatcher) RealQuickRatio() float64 {\n\tla, lb := len(m.a), len(m.b)\n\treturn calculateRatio(min(la, lb), la+lb)\n}\n\n// Convert range to the \"ed\" format\nfunc formatRangeUnified(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, length)\n}\n\n// Unified diff parameters\ntype UnifiedDiff struct {\n\tA        []string // First sequence lines\n\tFromFile string   // First file name\n\tFromDate string   // First file time\n\tB        []string // Second sequence lines\n\tToFile   string   // Second file name\n\tToDate   string   // Second file time\n\tEol      string   // Headers end of line, defaults to LF\n\tContext  int      // Number of context lines\n}\n\n// Compare two sequences of lines; generate the delta as a unified diff.\n//\n// Unified diffs are a compact way of showing line changes and a few\n// lines of context.  The number of context lines is set by 'n' which\n// defaults to three.\n//\n// By default, the diff control lines (those with ---, +++, or @@) are\n// created with a trailing newline.  This is helpful so that inputs\n// created from file.readlines() result in diffs that are suitable for\n// file.writelines() since both the inputs and outputs have trailing\n// newlines.\n//\n// For inputs that do not have trailing newlines, set the lineterm\n// argument to \"\" so that the output will be uniformly newline free.\n//\n// The unidiff format normally has a header for filenames and modification\n// times.  Any or all of these may be specified using strings for\n// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.\n// The modification times are normally expressed in the ISO 8601 format.\nfunc WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {\n\tbuf := bufio.NewWriter(writer)\n\tdefer buf.Flush()\n\twf := func(format string, args ...interface{}) error {\n\t\t_, err := buf.WriteString(fmt.Sprintf(format, args...))\n\t\treturn err\n\t}\n\tws := func(s string) error {\n\t\t_, err := buf.WriteString(s)\n\t\treturn err\n\t}\n\n\tif len(diff.Eol) == 0 {\n\t\tdiff.Eol = \"\\n\"\n\t}\n\n\tstarted := false\n\tm := NewMatcher(diff.A, diff.B)\n\tfor _, g := range m.GetGroupedOpCodes(diff.Context) {\n\t\tif !started {\n\t\t\tstarted = true\n\t\t\tfromDate := \"\"\n\t\t\tif len(diff.FromDate) > 0 {\n\t\t\t\tfromDate = \"\\t\" + diff.FromDate\n\t\t\t}\n\t\t\ttoDate := \"\"\n\t\t\tif len(diff.ToDate) > 0 {\n\t\t\t\ttoDate = \"\\t\" + diff.ToDate\n\t\t\t}\n\t\t\tif diff.FromFile != \"\" || diff.ToFile != \"\" {\n\t\t\t\terr := wf(\"--- %s%s%s\", diff.FromFile, fromDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = wf(\"+++ %s%s%s\", diff.ToFile, toDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfirst, last := g[0], g[len(g)-1]\n\t\trange1 := formatRangeUnified(first.I1, last.I2)\n\t\trange2 := formatRangeUnified(first.J1, last.J2)\n\t\tif err := wf(\"@@ -%s +%s @@%s\", range1, range2, diff.Eol); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, c := range g {\n\t\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t\tif c.Tag == 'e' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\" \" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'd' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\"-\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'i' {\n\t\t\t\tfor _, line := range diff.B[j1:j2] {\n\t\t\t\t\tif err := ws(\"+\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Like WriteUnifiedDiff but returns the diff a string.\nfunc GetUnifiedDiffString(diff UnifiedDiff) (string, error) {\n\tw := &bytes.Buffer{}\n\terr := WriteUnifiedDiff(w, diff)\n\treturn string(w.Bytes()), err\n}\n\n// Convert range to the \"ed\" format.\nfunc formatRangeContext(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\tif length <= 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, beginning+length-1)\n}\n\ntype ContextDiff UnifiedDiff\n\n// Compare two sequences of lines; generate the delta as a context diff.\n//\n// Context diffs are a compact way of showing line changes and a few\n// lines of context. The number of context lines is set by diff.Context\n// which defaults to three.\n//\n// By default, the diff control lines (those with *** or ---) are\n// created with a trailing newline.\n//\n// For inputs that do not have trailing newlines, set the diff.Eol\n// argument to \"\" so that the output will be uniformly newline free.\n//\n// The context diff format normally has a header for filenames and\n// modification times.  Any or all of these may be specified using\n// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate.\n// The modification times are normally expressed in the ISO 8601 format.\n// If not specified, the strings default to blanks.\nfunc WriteContextDiff(writer io.Writer, diff ContextDiff) error {\n\tbuf := bufio.NewWriter(writer)\n\tdefer buf.Flush()\n\tvar diffErr error\n\twf := func(format string, args ...interface{}) {\n\t\t_, err := buf.WriteString(fmt.Sprintf(format, args...))\n\t\tif diffErr == nil && err != nil {\n\t\t\tdiffErr = err\n\t\t}\n\t}\n\tws := func(s string) {\n\t\t_, err := buf.WriteString(s)\n\t\tif diffErr == nil && err != nil {\n\t\t\tdiffErr = err\n\t\t}\n\t}\n\n\tif len(diff.Eol) == 0 {\n\t\tdiff.Eol = \"\\n\"\n\t}\n\n\tprefix := map[byte]string{\n\t\t'i': \"+ \",\n\t\t'd': \"- \",\n\t\t'r': \"! \",\n\t\t'e': \"  \",\n\t}\n\n\tstarted := false\n\tm := NewMatcher(diff.A, diff.B)\n\tfor _, g := range m.GetGroupedOpCodes(diff.Context) {\n\t\tif !started {\n\t\t\tstarted = true\n\t\t\tfromDate := \"\"\n\t\t\tif len(diff.FromDate) > 0 {\n\t\t\t\tfromDate = \"\\t\" + diff.FromDate\n\t\t\t}\n\t\t\ttoDate := \"\"\n\t\t\tif len(diff.ToDate) > 0 {\n\t\t\t\ttoDate = \"\\t\" + diff.ToDate\n\t\t\t}\n\t\t\tif diff.FromFile != \"\" || diff.ToFile != \"\" {\n\t\t\t\twf(\"*** %s%s%s\", diff.FromFile, fromDate, diff.Eol)\n\t\t\t\twf(\"--- %s%s%s\", diff.ToFile, toDate, diff.Eol)\n\t\t\t}\n\t\t}\n\n\t\tfirst, last := g[0], g[len(g)-1]\n\t\tws(\"***************\" + diff.Eol)\n\n\t\trange1 := formatRangeContext(first.I1, last.I2)\n\t\twf(\"*** %s ****%s\", range1, diff.Eol)\n\t\tfor _, c := range g {\n\t\t\tif c.Tag == 'r' || c.Tag == 'd' {\n\t\t\t\tfor _, cc := range g {\n\t\t\t\t\tif cc.Tag == 'i' {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor _, line := range diff.A[cc.I1:cc.I2] {\n\t\t\t\t\t\tws(prefix[cc.Tag] + line)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\trange2 := formatRangeContext(first.J1, last.J2)\n\t\twf(\"--- %s ----%s\", range2, diff.Eol)\n\t\tfor _, c := range g {\n\t\t\tif c.Tag == 'r' || c.Tag == 'i' {\n\t\t\t\tfor _, cc := range g {\n\t\t\t\t\tif cc.Tag == 'd' {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor _, line := range diff.B[cc.J1:cc.J2] {\n\t\t\t\t\t\tws(prefix[cc.Tag] + line)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn diffErr\n}\n\n// Like WriteContextDiff but returns the diff a string.\nfunc GetContextDiffString(diff ContextDiff) (string, error) {\n\tw := &bytes.Buffer{}\n\terr := WriteContextDiff(w, diff)\n\treturn string(w.Bytes()), err\n}\n\n// Split a string on \"\\n\" while preserving them. The output can be used\n// as input for UnifiedDiff and ContextDiff structures.\nfunc SplitLines(s string) []string {\n\tlines := strings.SplitAfter(s, \"\\n\")\n\tlines[len(lines)-1] += \"\\n\"\n\treturn lines\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2014 Stretchr, Inc.\nCopyright (c) 2017-2018 objx contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/accessors.go",
    "content": "package objx\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// arrayAccesRegexString is the regex used to extract the array number\n// from the access path\nconst arrayAccesRegexString = `^(.+)\\[([0-9]+)\\]$`\n\n// arrayAccesRegex is the compiled arrayAccesRegexString\nvar arrayAccesRegex = regexp.MustCompile(arrayAccesRegexString)\n\n// Get gets the value using the specified selector and\n// returns it inside a new Obj object.\n//\n// If it cannot find the value, Get will return a nil\n// value inside an instance of Obj.\n//\n// Get can only operate directly on map[string]interface{} and []interface.\n//\n// Example\n//\n// To access the title of the third chapter of the second book, do:\n//\n//    o.Get(\"books[1].chapters[2].title\")\nfunc (m Map) Get(selector string) *Value {\n\trawObj := access(m, selector, nil, false, false)\n\treturn &Value{data: rawObj}\n}\n\n// Set sets the value using the specified selector and\n// returns the object on which Set was called.\n//\n// Set can only operate directly on map[string]interface{} and []interface\n//\n// Example\n//\n// To set the title of the third chapter of the second book, do:\n//\n//    o.Set(\"books[1].chapters[2].title\",\"Time to Go\")\nfunc (m Map) Set(selector string, value interface{}) Map {\n\taccess(m, selector, value, true, false)\n\treturn m\n}\n\n// access accesses the object using the selector and performs the\n// appropriate action.\nfunc access(current, selector, value interface{}, isSet, panics bool) interface{} {\n\n\tswitch selector.(type) {\n\tcase int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:\n\n\t\tif array, ok := current.([]interface{}); ok {\n\t\t\tindex := intFromInterface(selector)\n\n\t\t\tif index >= len(array) {\n\t\t\t\tif panics {\n\t\t\t\t\tpanic(fmt.Sprintf(\"objx: Index %d is out of range. Slice only contains %d items.\", index, len(array)))\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn array[index]\n\t\t}\n\n\t\treturn nil\n\n\tcase string:\n\n\t\tselStr := selector.(string)\n\t\tselSegs := strings.SplitN(selStr, PathSeparator, 2)\n\t\tthisSel := selSegs[0]\n\t\tindex := -1\n\t\tvar err error\n\n\t\tif strings.Contains(thisSel, \"[\") {\n\t\t\tarrayMatches := arrayAccesRegex.FindStringSubmatch(thisSel)\n\n\t\t\tif len(arrayMatches) > 0 {\n\t\t\t\t// Get the key into the map\n\t\t\t\tthisSel = arrayMatches[1]\n\n\t\t\t\t// Get the index into the array at the key\n\t\t\t\tindex, err = strconv.Atoi(arrayMatches[2])\n\n\t\t\t\tif err != nil {\n\t\t\t\t\t// This should never happen. If it does, something has gone\n\t\t\t\t\t// seriously wrong. Panic.\n\t\t\t\t\tpanic(\"objx: Array index is not an integer.  Must use array[int].\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif curMap, ok := current.(Map); ok {\n\t\t\tcurrent = map[string]interface{}(curMap)\n\t\t}\n\n\t\t// get the object in question\n\t\tswitch current.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tcurMSI := current.(map[string]interface{})\n\t\t\tif len(selSegs) <= 1 && isSet {\n\t\t\t\tcurMSI[thisSel] = value\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tcurrent = curMSI[thisSel]\n\t\tdefault:\n\t\t\tcurrent = nil\n\t\t}\n\n\t\tif current == nil && panics {\n\t\t\tpanic(fmt.Sprintf(\"objx: '%v' invalid on object.\", selector))\n\t\t}\n\n\t\t// do we need to access the item of an array?\n\t\tif index > -1 {\n\t\t\tif array, ok := current.([]interface{}); ok {\n\t\t\t\tif index < len(array) {\n\t\t\t\t\tcurrent = array[index]\n\t\t\t\t} else {\n\t\t\t\t\tif panics {\n\t\t\t\t\t\tpanic(fmt.Sprintf(\"objx: Index %d is out of range. Slice only contains %d items.\", index, len(array)))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(selSegs) > 1 {\n\t\t\tcurrent = access(current, selSegs[1], value, isSet, panics)\n\t\t}\n\n\t}\n\treturn current\n}\n\n// intFromInterface converts an interface object to the largest\n// representation of an unsigned integer using a type switch and\n// assertions\nfunc intFromInterface(selector interface{}) int {\n\tvar value int\n\tswitch selector.(type) {\n\tcase int:\n\t\tvalue = selector.(int)\n\tcase int8:\n\t\tvalue = int(selector.(int8))\n\tcase int16:\n\t\tvalue = int(selector.(int16))\n\tcase int32:\n\t\tvalue = int(selector.(int32))\n\tcase int64:\n\t\tvalue = int(selector.(int64))\n\tcase uint:\n\t\tvalue = int(selector.(uint))\n\tcase uint8:\n\t\tvalue = int(selector.(uint8))\n\tcase uint16:\n\t\tvalue = int(selector.(uint16))\n\tcase uint32:\n\t\tvalue = int(selector.(uint32))\n\tcase uint64:\n\t\tvalue = int(selector.(uint64))\n\tdefault:\n\t\tpanic(\"objx: array access argument is not an integer type (this should never happen)\")\n\t}\n\treturn value\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/constants.go",
    "content": "package objx\n\nconst (\n\t// PathSeparator is the character used to separate the elements\n\t// of the keypath.\n\t//\n\t// For example, `location.address.city`\n\tPathSeparator string = \".\"\n\n\t// SignatureSeparator is the character that is used to\n\t// separate the Base64 string from the security signature.\n\tSignatureSeparator = \"_\"\n)\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/conversions.go",
    "content": "package objx\n\nimport (\n\t\"bytes\"\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/url\"\n)\n\n// JSON converts the contained object to a JSON string\n// representation\nfunc (m Map) JSON() (string, error) {\n\tresult, err := json.Marshal(m)\n\tif err != nil {\n\t\terr = errors.New(\"objx: JSON encode failed with: \" + err.Error())\n\t}\n\treturn string(result), err\n}\n\n// MustJSON converts the contained object to a JSON string\n// representation and panics if there is an error\nfunc (m Map) MustJSON() string {\n\tresult, err := m.JSON()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn result\n}\n\n// Base64 converts the contained object to a Base64 string\n// representation of the JSON string representation\nfunc (m Map) Base64() (string, error) {\n\tvar buf bytes.Buffer\n\n\tjsonData, err := m.JSON()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tencoder := base64.NewEncoder(base64.StdEncoding, &buf)\n\t_, err = encoder.Write([]byte(jsonData))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t_ = encoder.Close()\n\n\treturn buf.String(), nil\n}\n\n// MustBase64 converts the contained object to a Base64 string\n// representation of the JSON string representation and panics\n// if there is an error\nfunc (m Map) MustBase64() string {\n\tresult, err := m.Base64()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn result\n}\n\n// SignedBase64 converts the contained object to a Base64 string\n// representation of the JSON string representation and signs it\n// using the provided key.\nfunc (m Map) SignedBase64(key string) (string, error) {\n\tbase64, err := m.Base64()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsig := HashWithKey(base64, key)\n\treturn base64 + SignatureSeparator + sig, nil\n}\n\n// MustSignedBase64 converts the contained object to a Base64 string\n// representation of the JSON string representation and signs it\n// using the provided key and panics if there is an error\nfunc (m Map) MustSignedBase64(key string) string {\n\tresult, err := m.SignedBase64(key)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn result\n}\n\n/*\n\tURL Query\n\t------------------------------------------------\n*/\n\n// URLValues creates a url.Values object from an Obj. This\n// function requires that the wrapped object be a map[string]interface{}\nfunc (m Map) URLValues() url.Values {\n\tvals := make(url.Values)\n\tfor k, v := range m {\n\t\t//TODO: can this be done without sprintf?\n\t\tvals.Set(k, fmt.Sprintf(\"%v\", v))\n\t}\n\treturn vals\n}\n\n// URLQuery gets an encoded URL query representing the given\n// Obj. This function requires that the wrapped object be a\n// map[string]interface{}\nfunc (m Map) URLQuery() (string, error) {\n\treturn m.URLValues().Encode(), nil\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/doc.go",
    "content": "/*\nObjx - Go package for dealing with maps, slices, JSON and other data.\n\nOverview\n\nObjx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes\na powerful `Get` method (among others) that allows you to easily and quickly get\naccess to data within the map, without having to worry too much about type assertions,\nmissing data, default values etc.\n\nPattern\n\nObjx uses a preditable pattern to make access data from within `map[string]interface{}` easy.\nCall one of the `objx.` functions to create your `objx.Map` to get going:\n\n    m, err := objx.FromJSON(json)\n\nNOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong,\nthe rest will be optimistic and try to figure things out without panicking.\n\nUse `Get` to access the value you're interested in.  You can use dot and array\nnotation too:\n\n     m.Get(\"places[0].latlng\")\n\nOnce you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type.\n\n     if m.Get(\"code\").IsStr() { // Your code... }\n\nOr you can just assume the type, and use one of the strong type methods to extract the real value:\n\n   m.Get(\"code\").Int()\n\nIf there's no value there (or if it's the wrong type) then a default value will be returned,\nor you can be explicit about the default value.\n\n     Get(\"code\").Int(-1)\n\nIf you're dealing with a slice of data as a value, Objx provides many useful methods for iterating,\nmanipulating and selecting that data.  You can find out more by exploring the index below.\n\nReading data\n\nA simple example of how to use Objx:\n\n   // Use MustFromJSON to make an objx.Map from some JSON\n   m := objx.MustFromJSON(`{\"name\": \"Mat\", \"age\": 30}`)\n\n   // Get the details\n   name := m.Get(\"name\").Str()\n   age := m.Get(\"age\").Int()\n\n   // Get their nickname (or use their name if they don't have one)\n   nickname := m.Get(\"nickname\").Str(name)\n\nRanging\n\nSince `objx.Map` is a `map[string]interface{}` you can treat it as such.\nFor example, to `range` the data, do what you would expect:\n\n    m := objx.MustFromJSON(json)\n    for key, value := range m {\n      // Your code...\n    }\n*/\npackage objx\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/map.go",
    "content": "package objx\n\nimport (\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"io/ioutil\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// MSIConvertable is an interface that defines methods for converting your\n// custom types to a map[string]interface{} representation.\ntype MSIConvertable interface {\n\t// MSI gets a map[string]interface{} (msi) representing the\n\t// object.\n\tMSI() map[string]interface{}\n}\n\n// Map provides extended functionality for working with\n// untyped data, in particular map[string]interface (msi).\ntype Map map[string]interface{}\n\n// Value returns the internal value instance\nfunc (m Map) Value() *Value {\n\treturn &Value{data: m}\n}\n\n// Nil represents a nil Map.\nvar Nil = New(nil)\n\n// New creates a new Map containing the map[string]interface{} in the data argument.\n// If the data argument is not a map[string]interface, New attempts to call the\n// MSI() method on the MSIConvertable interface to create one.\nfunc New(data interface{}) Map {\n\tif _, ok := data.(map[string]interface{}); !ok {\n\t\tif converter, ok := data.(MSIConvertable); ok {\n\t\t\tdata = converter.MSI()\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn Map(data.(map[string]interface{}))\n}\n\n// MSI creates a map[string]interface{} and puts it inside a new Map.\n//\n// The arguments follow a key, value pattern.\n//\n// Panics\n//\n// Panics if any key argument is non-string or if there are an odd number of arguments.\n//\n// Example\n//\n// To easily create Maps:\n//\n//     m := objx.MSI(\"name\", \"Mat\", \"age\", 29, \"subobj\", objx.MSI(\"active\", true))\n//\n//     // creates an Map equivalent to\n//     m := objx.New(map[string]interface{}{\"name\": \"Mat\", \"age\": 29, \"subobj\": map[string]interface{}{\"active\": true}})\nfunc MSI(keyAndValuePairs ...interface{}) Map {\n\tnewMap := make(map[string]interface{})\n\tkeyAndValuePairsLen := len(keyAndValuePairs)\n\tif keyAndValuePairsLen%2 != 0 {\n\t\tpanic(\"objx: MSI must have an even number of arguments following the 'key, value' pattern.\")\n\t}\n\n\tfor i := 0; i < keyAndValuePairsLen; i = i + 2 {\n\t\tkey := keyAndValuePairs[i]\n\t\tvalue := keyAndValuePairs[i+1]\n\n\t\t// make sure the key is a string\n\t\tkeyString, keyStringOK := key.(string)\n\t\tif !keyStringOK {\n\t\t\tpanic(\"objx: MSI must follow 'string, interface{}' pattern.  \" + keyString + \" is not a valid key.\")\n\t\t}\n\t\tnewMap[keyString] = value\n\t}\n\treturn New(newMap)\n}\n\n// ****** Conversion Constructors\n\n// MustFromJSON creates a new Map containing the data specified in the\n// jsonString.\n//\n// Panics if the JSON is invalid.\nfunc MustFromJSON(jsonString string) Map {\n\to, err := FromJSON(jsonString)\n\tif err != nil {\n\t\tpanic(\"objx: MustFromJSON failed with error: \" + err.Error())\n\t}\n\treturn o\n}\n\n// FromJSON creates a new Map containing the data specified in the\n// jsonString.\n//\n// Returns an error if the JSON is invalid.\nfunc FromJSON(jsonString string) (Map, error) {\n\tvar data interface{}\n\terr := json.Unmarshal([]byte(jsonString), &data)\n\tif err != nil {\n\t\treturn Nil, err\n\t}\n\treturn New(data), nil\n}\n\n// FromBase64 creates a new Obj containing the data specified\n// in the Base64 string.\n//\n// The string is an encoded JSON string returned by Base64\nfunc FromBase64(base64String string) (Map, error) {\n\tdecoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String))\n\tdecoded, err := ioutil.ReadAll(decoder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn FromJSON(string(decoded))\n}\n\n// MustFromBase64 creates a new Obj containing the data specified\n// in the Base64 string and panics if there is an error.\n//\n// The string is an encoded JSON string returned by Base64\nfunc MustFromBase64(base64String string) Map {\n\tresult, err := FromBase64(base64String)\n\tif err != nil {\n\t\tpanic(\"objx: MustFromBase64 failed with error: \" + err.Error())\n\t}\n\treturn result\n}\n\n// FromSignedBase64 creates a new Obj containing the data specified\n// in the Base64 string.\n//\n// The string is an encoded JSON string returned by SignedBase64\nfunc FromSignedBase64(base64String, key string) (Map, error) {\n\tparts := strings.Split(base64String, SignatureSeparator)\n\tif len(parts) != 2 {\n\t\treturn nil, errors.New(\"objx: Signed base64 string is malformed\")\n\t}\n\n\tsig := HashWithKey(parts[0], key)\n\tif parts[1] != sig {\n\t\treturn nil, errors.New(\"objx: Signature for base64 data does not match\")\n\t}\n\treturn FromBase64(parts[0])\n}\n\n// MustFromSignedBase64 creates a new Obj containing the data specified\n// in the Base64 string and panics if there is an error.\n//\n// The string is an encoded JSON string returned by Base64\nfunc MustFromSignedBase64(base64String, key string) Map {\n\tresult, err := FromSignedBase64(base64String, key)\n\tif err != nil {\n\t\tpanic(\"objx: MustFromSignedBase64 failed with error: \" + err.Error())\n\t}\n\treturn result\n}\n\n// FromURLQuery generates a new Obj by parsing the specified\n// query.\n//\n// For queries with multiple values, the first value is selected.\nfunc FromURLQuery(query string) (Map, error) {\n\tvals, err := url.ParseQuery(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := make(map[string]interface{})\n\tfor k, vals := range vals {\n\t\tm[k] = vals[0]\n\t}\n\treturn New(m), nil\n}\n\n// MustFromURLQuery generates a new Obj by parsing the specified\n// query.\n//\n// For queries with multiple values, the first value is selected.\n//\n// Panics if it encounters an error\nfunc MustFromURLQuery(query string) Map {\n\to, err := FromURLQuery(query)\n\tif err != nil {\n\t\tpanic(\"objx: MustFromURLQuery failed with error: \" + err.Error())\n\t}\n\treturn o\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/mutations.go",
    "content": "package objx\n\n// Exclude returns a new Map with the keys in the specified []string\n// excluded.\nfunc (m Map) Exclude(exclude []string) Map {\n\texcluded := make(Map)\n\tfor k, v := range m {\n\t\tvar shouldInclude = true\n\t\tfor _, toExclude := range exclude {\n\t\t\tif k == toExclude {\n\t\t\t\tshouldInclude = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif shouldInclude {\n\t\t\texcluded[k] = v\n\t\t}\n\t}\n\treturn excluded\n}\n\n// Copy creates a shallow copy of the Obj.\nfunc (m Map) Copy() Map {\n\tcopied := make(map[string]interface{})\n\tfor k, v := range m {\n\t\tcopied[k] = v\n\t}\n\treturn New(copied)\n}\n\n// Merge blends the specified map with a copy of this map and returns the result.\n//\n// Keys that appear in both will be selected from the specified map.\n// This method requires that the wrapped object be a map[string]interface{}\nfunc (m Map) Merge(merge Map) Map {\n\treturn m.Copy().MergeHere(merge)\n}\n\n// MergeHere blends the specified map with this map and returns the current map.\n//\n// Keys that appear in both will be selected from the specified map. The original map\n// will be modified. This method requires that\n// the wrapped object be a map[string]interface{}\nfunc (m Map) MergeHere(merge Map) Map {\n\tfor k, v := range merge {\n\t\tm[k] = v\n\t}\n\treturn m\n}\n\n// Transform builds a new Obj giving the transformer a chance\n// to change the keys and values as it goes. This method requires that\n// the wrapped object be a map[string]interface{}\nfunc (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map {\n\tnewMap := make(map[string]interface{})\n\tfor k, v := range m {\n\t\tmodifiedKey, modifiedVal := transformer(k, v)\n\t\tnewMap[modifiedKey] = modifiedVal\n\t}\n\treturn New(newMap)\n}\n\n// TransformKeys builds a new map using the specified key mapping.\n//\n// Unspecified keys will be unaltered.\n// This method requires that the wrapped object be a map[string]interface{}\nfunc (m Map) TransformKeys(mapping map[string]string) Map {\n\treturn m.Transform(func(key string, value interface{}) (string, interface{}) {\n\t\tif newKey, ok := mapping[key]; ok {\n\t\t\treturn newKey, value\n\t\t}\n\t\treturn key, value\n\t})\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/security.go",
    "content": "package objx\n\nimport (\n\t\"crypto/sha1\"\n\t\"encoding/hex\"\n)\n\n// HashWithKey hashes the specified string using the security\n// key.\nfunc HashWithKey(data, key string) string {\n\thash := sha1.New()\n\t_, err := hash.Write([]byte(data + \":\" + key))\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn hex.EncodeToString(hash.Sum(nil))\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/tests.go",
    "content": "package objx\n\n// Has gets whether there is something at the specified selector\n// or not.\n//\n// If m is nil, Has will always return false.\nfunc (m Map) Has(selector string) bool {\n\tif m == nil {\n\t\treturn false\n\t}\n\treturn !m.Get(selector).IsNil()\n}\n\n// IsNil gets whether the data is nil or not.\nfunc (v *Value) IsNil() bool {\n\treturn v == nil || v.data == nil\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/type_specific_codegen.go",
    "content": "package objx\n\n/*\n\tInter (interface{} and []interface{})\n*/\n\n// Inter gets the value as a interface{}, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Inter(optionalDefault ...interface{}) interface{} {\n\tif s, ok := v.data.(interface{}); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInter gets the value as a interface{}.\n//\n// Panics if the object is not a interface{}.\nfunc (v *Value) MustInter() interface{} {\n\treturn v.data.(interface{})\n}\n\n// InterSlice gets the value as a []interface{}, returns the optionalDefault\n// value or nil if the value is not a []interface{}.\nfunc (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} {\n\tif s, ok := v.data.([]interface{}); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInterSlice gets the value as a []interface{}.\n//\n// Panics if the object is not a []interface{}.\nfunc (v *Value) MustInterSlice() []interface{} {\n\treturn v.data.([]interface{})\n}\n\n// IsInter gets whether the object contained is a interface{} or not.\nfunc (v *Value) IsInter() bool {\n\t_, ok := v.data.(interface{})\n\treturn ok\n}\n\n// IsInterSlice gets whether the object contained is a []interface{} or not.\nfunc (v *Value) IsInterSlice() bool {\n\t_, ok := v.data.([]interface{})\n\treturn ok\n}\n\n// EachInter calls the specified callback for each object\n// in the []interface{}.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInter(callback func(int, interface{}) bool) *Value {\n\tfor index, val := range v.MustInterSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInter uses the specified decider function to select items\n// from the []interface{}.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInter(decider func(int, interface{}) bool) *Value {\n\tvar selected []interface{}\n\tv.EachInter(func(index int, val interface{}) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInter uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]interface{}.\nfunc (v *Value) GroupInter(grouper func(int, interface{}) string) *Value {\n\tgroups := make(map[string][]interface{})\n\tv.EachInter(func(index int, val interface{}) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]interface{}, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInter uses the specified function to replace each interface{}s\n// by iterating each item.  The data in the returned result will be a\n// []interface{} containing the replaced items.\nfunc (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value {\n\tarr := v.MustInterSlice()\n\treplaced := make([]interface{}, len(arr))\n\tv.EachInter(func(index int, val interface{}) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInter uses the specified collector function to collect a value\n// for each of the interface{}s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value {\n\tarr := v.MustInterSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInter(func(index int, val interface{}) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tMSI (map[string]interface{} and []map[string]interface{})\n*/\n\n// MSI gets the value as a map[string]interface{}, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} {\n\tif s, ok := v.data.(map[string]interface{}); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustMSI gets the value as a map[string]interface{}.\n//\n// Panics if the object is not a map[string]interface{}.\nfunc (v *Value) MustMSI() map[string]interface{} {\n\treturn v.data.(map[string]interface{})\n}\n\n// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault\n// value or nil if the value is not a []map[string]interface{}.\nfunc (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} {\n\tif s, ok := v.data.([]map[string]interface{}); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustMSISlice gets the value as a []map[string]interface{}.\n//\n// Panics if the object is not a []map[string]interface{}.\nfunc (v *Value) MustMSISlice() []map[string]interface{} {\n\treturn v.data.([]map[string]interface{})\n}\n\n// IsMSI gets whether the object contained is a map[string]interface{} or not.\nfunc (v *Value) IsMSI() bool {\n\t_, ok := v.data.(map[string]interface{})\n\treturn ok\n}\n\n// IsMSISlice gets whether the object contained is a []map[string]interface{} or not.\nfunc (v *Value) IsMSISlice() bool {\n\t_, ok := v.data.([]map[string]interface{})\n\treturn ok\n}\n\n// EachMSI calls the specified callback for each object\n// in the []map[string]interface{}.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value {\n\tfor index, val := range v.MustMSISlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereMSI uses the specified decider function to select items\n// from the []map[string]interface{}.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value {\n\tvar selected []map[string]interface{}\n\tv.EachMSI(func(index int, val map[string]interface{}) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupMSI uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]map[string]interface{}.\nfunc (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value {\n\tgroups := make(map[string][]map[string]interface{})\n\tv.EachMSI(func(index int, val map[string]interface{}) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]map[string]interface{}, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceMSI uses the specified function to replace each map[string]interface{}s\n// by iterating each item.  The data in the returned result will be a\n// []map[string]interface{} containing the replaced items.\nfunc (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value {\n\tarr := v.MustMSISlice()\n\treplaced := make([]map[string]interface{}, len(arr))\n\tv.EachMSI(func(index int, val map[string]interface{}) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectMSI uses the specified collector function to collect a value\n// for each of the map[string]interface{}s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value {\n\tarr := v.MustMSISlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachMSI(func(index int, val map[string]interface{}) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tObjxMap ((Map) and [](Map))\n*/\n\n// ObjxMap gets the value as a (Map), returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) ObjxMap(optionalDefault ...(Map)) Map {\n\tif s, ok := v.data.((Map)); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn New(nil)\n}\n\n// MustObjxMap gets the value as a (Map).\n//\n// Panics if the object is not a (Map).\nfunc (v *Value) MustObjxMap() Map {\n\treturn v.data.((Map))\n}\n\n// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault\n// value or nil if the value is not a [](Map).\nfunc (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) {\n\tif s, ok := v.data.([](Map)); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustObjxMapSlice gets the value as a [](Map).\n//\n// Panics if the object is not a [](Map).\nfunc (v *Value) MustObjxMapSlice() [](Map) {\n\treturn v.data.([](Map))\n}\n\n// IsObjxMap gets whether the object contained is a (Map) or not.\nfunc (v *Value) IsObjxMap() bool {\n\t_, ok := v.data.((Map))\n\treturn ok\n}\n\n// IsObjxMapSlice gets whether the object contained is a [](Map) or not.\nfunc (v *Value) IsObjxMapSlice() bool {\n\t_, ok := v.data.([](Map))\n\treturn ok\n}\n\n// EachObjxMap calls the specified callback for each object\n// in the [](Map).\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachObjxMap(callback func(int, Map) bool) *Value {\n\tfor index, val := range v.MustObjxMapSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereObjxMap uses the specified decider function to select items\n// from the [](Map).  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value {\n\tvar selected [](Map)\n\tv.EachObjxMap(func(index int, val Map) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupObjxMap uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][](Map).\nfunc (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value {\n\tgroups := make(map[string][](Map))\n\tv.EachObjxMap(func(index int, val Map) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([](Map), 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceObjxMap uses the specified function to replace each (Map)s\n// by iterating each item.  The data in the returned result will be a\n// [](Map) containing the replaced items.\nfunc (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value {\n\tarr := v.MustObjxMapSlice()\n\treplaced := make([](Map), len(arr))\n\tv.EachObjxMap(func(index int, val Map) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectObjxMap uses the specified collector function to collect a value\n// for each of the (Map)s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value {\n\tarr := v.MustObjxMapSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachObjxMap(func(index int, val Map) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tBool (bool and []bool)\n*/\n\n// Bool gets the value as a bool, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Bool(optionalDefault ...bool) bool {\n\tif s, ok := v.data.(bool); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn false\n}\n\n// MustBool gets the value as a bool.\n//\n// Panics if the object is not a bool.\nfunc (v *Value) MustBool() bool {\n\treturn v.data.(bool)\n}\n\n// BoolSlice gets the value as a []bool, returns the optionalDefault\n// value or nil if the value is not a []bool.\nfunc (v *Value) BoolSlice(optionalDefault ...[]bool) []bool {\n\tif s, ok := v.data.([]bool); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustBoolSlice gets the value as a []bool.\n//\n// Panics if the object is not a []bool.\nfunc (v *Value) MustBoolSlice() []bool {\n\treturn v.data.([]bool)\n}\n\n// IsBool gets whether the object contained is a bool or not.\nfunc (v *Value) IsBool() bool {\n\t_, ok := v.data.(bool)\n\treturn ok\n}\n\n// IsBoolSlice gets whether the object contained is a []bool or not.\nfunc (v *Value) IsBoolSlice() bool {\n\t_, ok := v.data.([]bool)\n\treturn ok\n}\n\n// EachBool calls the specified callback for each object\n// in the []bool.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachBool(callback func(int, bool) bool) *Value {\n\tfor index, val := range v.MustBoolSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereBool uses the specified decider function to select items\n// from the []bool.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereBool(decider func(int, bool) bool) *Value {\n\tvar selected []bool\n\tv.EachBool(func(index int, val bool) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupBool uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]bool.\nfunc (v *Value) GroupBool(grouper func(int, bool) string) *Value {\n\tgroups := make(map[string][]bool)\n\tv.EachBool(func(index int, val bool) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]bool, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceBool uses the specified function to replace each bools\n// by iterating each item.  The data in the returned result will be a\n// []bool containing the replaced items.\nfunc (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value {\n\tarr := v.MustBoolSlice()\n\treplaced := make([]bool, len(arr))\n\tv.EachBool(func(index int, val bool) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectBool uses the specified collector function to collect a value\n// for each of the bools in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectBool(collector func(int, bool) interface{}) *Value {\n\tarr := v.MustBoolSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachBool(func(index int, val bool) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tStr (string and []string)\n*/\n\n// Str gets the value as a string, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Str(optionalDefault ...string) string {\n\tif s, ok := v.data.(string); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn \"\"\n}\n\n// MustStr gets the value as a string.\n//\n// Panics if the object is not a string.\nfunc (v *Value) MustStr() string {\n\treturn v.data.(string)\n}\n\n// StrSlice gets the value as a []string, returns the optionalDefault\n// value or nil if the value is not a []string.\nfunc (v *Value) StrSlice(optionalDefault ...[]string) []string {\n\tif s, ok := v.data.([]string); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustStrSlice gets the value as a []string.\n//\n// Panics if the object is not a []string.\nfunc (v *Value) MustStrSlice() []string {\n\treturn v.data.([]string)\n}\n\n// IsStr gets whether the object contained is a string or not.\nfunc (v *Value) IsStr() bool {\n\t_, ok := v.data.(string)\n\treturn ok\n}\n\n// IsStrSlice gets whether the object contained is a []string or not.\nfunc (v *Value) IsStrSlice() bool {\n\t_, ok := v.data.([]string)\n\treturn ok\n}\n\n// EachStr calls the specified callback for each object\n// in the []string.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachStr(callback func(int, string) bool) *Value {\n\tfor index, val := range v.MustStrSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereStr uses the specified decider function to select items\n// from the []string.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereStr(decider func(int, string) bool) *Value {\n\tvar selected []string\n\tv.EachStr(func(index int, val string) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupStr uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]string.\nfunc (v *Value) GroupStr(grouper func(int, string) string) *Value {\n\tgroups := make(map[string][]string)\n\tv.EachStr(func(index int, val string) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]string, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceStr uses the specified function to replace each strings\n// by iterating each item.  The data in the returned result will be a\n// []string containing the replaced items.\nfunc (v *Value) ReplaceStr(replacer func(int, string) string) *Value {\n\tarr := v.MustStrSlice()\n\treplaced := make([]string, len(arr))\n\tv.EachStr(func(index int, val string) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectStr uses the specified collector function to collect a value\n// for each of the strings in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectStr(collector func(int, string) interface{}) *Value {\n\tarr := v.MustStrSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachStr(func(index int, val string) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tInt (int and []int)\n*/\n\n// Int gets the value as a int, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Int(optionalDefault ...int) int {\n\tif s, ok := v.data.(int); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustInt gets the value as a int.\n//\n// Panics if the object is not a int.\nfunc (v *Value) MustInt() int {\n\treturn v.data.(int)\n}\n\n// IntSlice gets the value as a []int, returns the optionalDefault\n// value or nil if the value is not a []int.\nfunc (v *Value) IntSlice(optionalDefault ...[]int) []int {\n\tif s, ok := v.data.([]int); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustIntSlice gets the value as a []int.\n//\n// Panics if the object is not a []int.\nfunc (v *Value) MustIntSlice() []int {\n\treturn v.data.([]int)\n}\n\n// IsInt gets whether the object contained is a int or not.\nfunc (v *Value) IsInt() bool {\n\t_, ok := v.data.(int)\n\treturn ok\n}\n\n// IsIntSlice gets whether the object contained is a []int or not.\nfunc (v *Value) IsIntSlice() bool {\n\t_, ok := v.data.([]int)\n\treturn ok\n}\n\n// EachInt calls the specified callback for each object\n// in the []int.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInt(callback func(int, int) bool) *Value {\n\tfor index, val := range v.MustIntSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInt uses the specified decider function to select items\n// from the []int.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInt(decider func(int, int) bool) *Value {\n\tvar selected []int\n\tv.EachInt(func(index int, val int) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInt uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]int.\nfunc (v *Value) GroupInt(grouper func(int, int) string) *Value {\n\tgroups := make(map[string][]int)\n\tv.EachInt(func(index int, val int) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]int, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInt uses the specified function to replace each ints\n// by iterating each item.  The data in the returned result will be a\n// []int containing the replaced items.\nfunc (v *Value) ReplaceInt(replacer func(int, int) int) *Value {\n\tarr := v.MustIntSlice()\n\treplaced := make([]int, len(arr))\n\tv.EachInt(func(index int, val int) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInt uses the specified collector function to collect a value\n// for each of the ints in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInt(collector func(int, int) interface{}) *Value {\n\tarr := v.MustIntSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInt(func(index int, val int) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tInt8 (int8 and []int8)\n*/\n\n// Int8 gets the value as a int8, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Int8(optionalDefault ...int8) int8 {\n\tif s, ok := v.data.(int8); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustInt8 gets the value as a int8.\n//\n// Panics if the object is not a int8.\nfunc (v *Value) MustInt8() int8 {\n\treturn v.data.(int8)\n}\n\n// Int8Slice gets the value as a []int8, returns the optionalDefault\n// value or nil if the value is not a []int8.\nfunc (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 {\n\tif s, ok := v.data.([]int8); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInt8Slice gets the value as a []int8.\n//\n// Panics if the object is not a []int8.\nfunc (v *Value) MustInt8Slice() []int8 {\n\treturn v.data.([]int8)\n}\n\n// IsInt8 gets whether the object contained is a int8 or not.\nfunc (v *Value) IsInt8() bool {\n\t_, ok := v.data.(int8)\n\treturn ok\n}\n\n// IsInt8Slice gets whether the object contained is a []int8 or not.\nfunc (v *Value) IsInt8Slice() bool {\n\t_, ok := v.data.([]int8)\n\treturn ok\n}\n\n// EachInt8 calls the specified callback for each object\n// in the []int8.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInt8(callback func(int, int8) bool) *Value {\n\tfor index, val := range v.MustInt8Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInt8 uses the specified decider function to select items\n// from the []int8.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInt8(decider func(int, int8) bool) *Value {\n\tvar selected []int8\n\tv.EachInt8(func(index int, val int8) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInt8 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]int8.\nfunc (v *Value) GroupInt8(grouper func(int, int8) string) *Value {\n\tgroups := make(map[string][]int8)\n\tv.EachInt8(func(index int, val int8) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]int8, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInt8 uses the specified function to replace each int8s\n// by iterating each item.  The data in the returned result will be a\n// []int8 containing the replaced items.\nfunc (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value {\n\tarr := v.MustInt8Slice()\n\treplaced := make([]int8, len(arr))\n\tv.EachInt8(func(index int, val int8) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInt8 uses the specified collector function to collect a value\n// for each of the int8s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value {\n\tarr := v.MustInt8Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInt8(func(index int, val int8) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tInt16 (int16 and []int16)\n*/\n\n// Int16 gets the value as a int16, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Int16(optionalDefault ...int16) int16 {\n\tif s, ok := v.data.(int16); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustInt16 gets the value as a int16.\n//\n// Panics if the object is not a int16.\nfunc (v *Value) MustInt16() int16 {\n\treturn v.data.(int16)\n}\n\n// Int16Slice gets the value as a []int16, returns the optionalDefault\n// value or nil if the value is not a []int16.\nfunc (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 {\n\tif s, ok := v.data.([]int16); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInt16Slice gets the value as a []int16.\n//\n// Panics if the object is not a []int16.\nfunc (v *Value) MustInt16Slice() []int16 {\n\treturn v.data.([]int16)\n}\n\n// IsInt16 gets whether the object contained is a int16 or not.\nfunc (v *Value) IsInt16() bool {\n\t_, ok := v.data.(int16)\n\treturn ok\n}\n\n// IsInt16Slice gets whether the object contained is a []int16 or not.\nfunc (v *Value) IsInt16Slice() bool {\n\t_, ok := v.data.([]int16)\n\treturn ok\n}\n\n// EachInt16 calls the specified callback for each object\n// in the []int16.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInt16(callback func(int, int16) bool) *Value {\n\tfor index, val := range v.MustInt16Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInt16 uses the specified decider function to select items\n// from the []int16.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInt16(decider func(int, int16) bool) *Value {\n\tvar selected []int16\n\tv.EachInt16(func(index int, val int16) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInt16 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]int16.\nfunc (v *Value) GroupInt16(grouper func(int, int16) string) *Value {\n\tgroups := make(map[string][]int16)\n\tv.EachInt16(func(index int, val int16) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]int16, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInt16 uses the specified function to replace each int16s\n// by iterating each item.  The data in the returned result will be a\n// []int16 containing the replaced items.\nfunc (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value {\n\tarr := v.MustInt16Slice()\n\treplaced := make([]int16, len(arr))\n\tv.EachInt16(func(index int, val int16) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInt16 uses the specified collector function to collect a value\n// for each of the int16s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value {\n\tarr := v.MustInt16Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInt16(func(index int, val int16) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tInt32 (int32 and []int32)\n*/\n\n// Int32 gets the value as a int32, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Int32(optionalDefault ...int32) int32 {\n\tif s, ok := v.data.(int32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustInt32 gets the value as a int32.\n//\n// Panics if the object is not a int32.\nfunc (v *Value) MustInt32() int32 {\n\treturn v.data.(int32)\n}\n\n// Int32Slice gets the value as a []int32, returns the optionalDefault\n// value or nil if the value is not a []int32.\nfunc (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 {\n\tif s, ok := v.data.([]int32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInt32Slice gets the value as a []int32.\n//\n// Panics if the object is not a []int32.\nfunc (v *Value) MustInt32Slice() []int32 {\n\treturn v.data.([]int32)\n}\n\n// IsInt32 gets whether the object contained is a int32 or not.\nfunc (v *Value) IsInt32() bool {\n\t_, ok := v.data.(int32)\n\treturn ok\n}\n\n// IsInt32Slice gets whether the object contained is a []int32 or not.\nfunc (v *Value) IsInt32Slice() bool {\n\t_, ok := v.data.([]int32)\n\treturn ok\n}\n\n// EachInt32 calls the specified callback for each object\n// in the []int32.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInt32(callback func(int, int32) bool) *Value {\n\tfor index, val := range v.MustInt32Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInt32 uses the specified decider function to select items\n// from the []int32.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInt32(decider func(int, int32) bool) *Value {\n\tvar selected []int32\n\tv.EachInt32(func(index int, val int32) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInt32 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]int32.\nfunc (v *Value) GroupInt32(grouper func(int, int32) string) *Value {\n\tgroups := make(map[string][]int32)\n\tv.EachInt32(func(index int, val int32) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]int32, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInt32 uses the specified function to replace each int32s\n// by iterating each item.  The data in the returned result will be a\n// []int32 containing the replaced items.\nfunc (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value {\n\tarr := v.MustInt32Slice()\n\treplaced := make([]int32, len(arr))\n\tv.EachInt32(func(index int, val int32) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInt32 uses the specified collector function to collect a value\n// for each of the int32s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value {\n\tarr := v.MustInt32Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInt32(func(index int, val int32) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tInt64 (int64 and []int64)\n*/\n\n// Int64 gets the value as a int64, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Int64(optionalDefault ...int64) int64 {\n\tif s, ok := v.data.(int64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustInt64 gets the value as a int64.\n//\n// Panics if the object is not a int64.\nfunc (v *Value) MustInt64() int64 {\n\treturn v.data.(int64)\n}\n\n// Int64Slice gets the value as a []int64, returns the optionalDefault\n// value or nil if the value is not a []int64.\nfunc (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 {\n\tif s, ok := v.data.([]int64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustInt64Slice gets the value as a []int64.\n//\n// Panics if the object is not a []int64.\nfunc (v *Value) MustInt64Slice() []int64 {\n\treturn v.data.([]int64)\n}\n\n// IsInt64 gets whether the object contained is a int64 or not.\nfunc (v *Value) IsInt64() bool {\n\t_, ok := v.data.(int64)\n\treturn ok\n}\n\n// IsInt64Slice gets whether the object contained is a []int64 or not.\nfunc (v *Value) IsInt64Slice() bool {\n\t_, ok := v.data.([]int64)\n\treturn ok\n}\n\n// EachInt64 calls the specified callback for each object\n// in the []int64.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachInt64(callback func(int, int64) bool) *Value {\n\tfor index, val := range v.MustInt64Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereInt64 uses the specified decider function to select items\n// from the []int64.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereInt64(decider func(int, int64) bool) *Value {\n\tvar selected []int64\n\tv.EachInt64(func(index int, val int64) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupInt64 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]int64.\nfunc (v *Value) GroupInt64(grouper func(int, int64) string) *Value {\n\tgroups := make(map[string][]int64)\n\tv.EachInt64(func(index int, val int64) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]int64, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceInt64 uses the specified function to replace each int64s\n// by iterating each item.  The data in the returned result will be a\n// []int64 containing the replaced items.\nfunc (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value {\n\tarr := v.MustInt64Slice()\n\treplaced := make([]int64, len(arr))\n\tv.EachInt64(func(index int, val int64) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectInt64 uses the specified collector function to collect a value\n// for each of the int64s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value {\n\tarr := v.MustInt64Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachInt64(func(index int, val int64) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUint (uint and []uint)\n*/\n\n// Uint gets the value as a uint, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uint(optionalDefault ...uint) uint {\n\tif s, ok := v.data.(uint); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUint gets the value as a uint.\n//\n// Panics if the object is not a uint.\nfunc (v *Value) MustUint() uint {\n\treturn v.data.(uint)\n}\n\n// UintSlice gets the value as a []uint, returns the optionalDefault\n// value or nil if the value is not a []uint.\nfunc (v *Value) UintSlice(optionalDefault ...[]uint) []uint {\n\tif s, ok := v.data.([]uint); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUintSlice gets the value as a []uint.\n//\n// Panics if the object is not a []uint.\nfunc (v *Value) MustUintSlice() []uint {\n\treturn v.data.([]uint)\n}\n\n// IsUint gets whether the object contained is a uint or not.\nfunc (v *Value) IsUint() bool {\n\t_, ok := v.data.(uint)\n\treturn ok\n}\n\n// IsUintSlice gets whether the object contained is a []uint or not.\nfunc (v *Value) IsUintSlice() bool {\n\t_, ok := v.data.([]uint)\n\treturn ok\n}\n\n// EachUint calls the specified callback for each object\n// in the []uint.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUint(callback func(int, uint) bool) *Value {\n\tfor index, val := range v.MustUintSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUint uses the specified decider function to select items\n// from the []uint.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUint(decider func(int, uint) bool) *Value {\n\tvar selected []uint\n\tv.EachUint(func(index int, val uint) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUint uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uint.\nfunc (v *Value) GroupUint(grouper func(int, uint) string) *Value {\n\tgroups := make(map[string][]uint)\n\tv.EachUint(func(index int, val uint) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uint, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUint uses the specified function to replace each uints\n// by iterating each item.  The data in the returned result will be a\n// []uint containing the replaced items.\nfunc (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value {\n\tarr := v.MustUintSlice()\n\treplaced := make([]uint, len(arr))\n\tv.EachUint(func(index int, val uint) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUint uses the specified collector function to collect a value\n// for each of the uints in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUint(collector func(int, uint) interface{}) *Value {\n\tarr := v.MustUintSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUint(func(index int, val uint) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUint8 (uint8 and []uint8)\n*/\n\n// Uint8 gets the value as a uint8, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uint8(optionalDefault ...uint8) uint8 {\n\tif s, ok := v.data.(uint8); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUint8 gets the value as a uint8.\n//\n// Panics if the object is not a uint8.\nfunc (v *Value) MustUint8() uint8 {\n\treturn v.data.(uint8)\n}\n\n// Uint8Slice gets the value as a []uint8, returns the optionalDefault\n// value or nil if the value is not a []uint8.\nfunc (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 {\n\tif s, ok := v.data.([]uint8); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUint8Slice gets the value as a []uint8.\n//\n// Panics if the object is not a []uint8.\nfunc (v *Value) MustUint8Slice() []uint8 {\n\treturn v.data.([]uint8)\n}\n\n// IsUint8 gets whether the object contained is a uint8 or not.\nfunc (v *Value) IsUint8() bool {\n\t_, ok := v.data.(uint8)\n\treturn ok\n}\n\n// IsUint8Slice gets whether the object contained is a []uint8 or not.\nfunc (v *Value) IsUint8Slice() bool {\n\t_, ok := v.data.([]uint8)\n\treturn ok\n}\n\n// EachUint8 calls the specified callback for each object\n// in the []uint8.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUint8(callback func(int, uint8) bool) *Value {\n\tfor index, val := range v.MustUint8Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUint8 uses the specified decider function to select items\n// from the []uint8.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUint8(decider func(int, uint8) bool) *Value {\n\tvar selected []uint8\n\tv.EachUint8(func(index int, val uint8) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUint8 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uint8.\nfunc (v *Value) GroupUint8(grouper func(int, uint8) string) *Value {\n\tgroups := make(map[string][]uint8)\n\tv.EachUint8(func(index int, val uint8) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uint8, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUint8 uses the specified function to replace each uint8s\n// by iterating each item.  The data in the returned result will be a\n// []uint8 containing the replaced items.\nfunc (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value {\n\tarr := v.MustUint8Slice()\n\treplaced := make([]uint8, len(arr))\n\tv.EachUint8(func(index int, val uint8) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUint8 uses the specified collector function to collect a value\n// for each of the uint8s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value {\n\tarr := v.MustUint8Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUint8(func(index int, val uint8) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUint16 (uint16 and []uint16)\n*/\n\n// Uint16 gets the value as a uint16, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uint16(optionalDefault ...uint16) uint16 {\n\tif s, ok := v.data.(uint16); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUint16 gets the value as a uint16.\n//\n// Panics if the object is not a uint16.\nfunc (v *Value) MustUint16() uint16 {\n\treturn v.data.(uint16)\n}\n\n// Uint16Slice gets the value as a []uint16, returns the optionalDefault\n// value or nil if the value is not a []uint16.\nfunc (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 {\n\tif s, ok := v.data.([]uint16); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUint16Slice gets the value as a []uint16.\n//\n// Panics if the object is not a []uint16.\nfunc (v *Value) MustUint16Slice() []uint16 {\n\treturn v.data.([]uint16)\n}\n\n// IsUint16 gets whether the object contained is a uint16 or not.\nfunc (v *Value) IsUint16() bool {\n\t_, ok := v.data.(uint16)\n\treturn ok\n}\n\n// IsUint16Slice gets whether the object contained is a []uint16 or not.\nfunc (v *Value) IsUint16Slice() bool {\n\t_, ok := v.data.([]uint16)\n\treturn ok\n}\n\n// EachUint16 calls the specified callback for each object\n// in the []uint16.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUint16(callback func(int, uint16) bool) *Value {\n\tfor index, val := range v.MustUint16Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUint16 uses the specified decider function to select items\n// from the []uint16.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUint16(decider func(int, uint16) bool) *Value {\n\tvar selected []uint16\n\tv.EachUint16(func(index int, val uint16) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUint16 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uint16.\nfunc (v *Value) GroupUint16(grouper func(int, uint16) string) *Value {\n\tgroups := make(map[string][]uint16)\n\tv.EachUint16(func(index int, val uint16) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uint16, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUint16 uses the specified function to replace each uint16s\n// by iterating each item.  The data in the returned result will be a\n// []uint16 containing the replaced items.\nfunc (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value {\n\tarr := v.MustUint16Slice()\n\treplaced := make([]uint16, len(arr))\n\tv.EachUint16(func(index int, val uint16) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUint16 uses the specified collector function to collect a value\n// for each of the uint16s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value {\n\tarr := v.MustUint16Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUint16(func(index int, val uint16) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUint32 (uint32 and []uint32)\n*/\n\n// Uint32 gets the value as a uint32, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uint32(optionalDefault ...uint32) uint32 {\n\tif s, ok := v.data.(uint32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUint32 gets the value as a uint32.\n//\n// Panics if the object is not a uint32.\nfunc (v *Value) MustUint32() uint32 {\n\treturn v.data.(uint32)\n}\n\n// Uint32Slice gets the value as a []uint32, returns the optionalDefault\n// value or nil if the value is not a []uint32.\nfunc (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 {\n\tif s, ok := v.data.([]uint32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUint32Slice gets the value as a []uint32.\n//\n// Panics if the object is not a []uint32.\nfunc (v *Value) MustUint32Slice() []uint32 {\n\treturn v.data.([]uint32)\n}\n\n// IsUint32 gets whether the object contained is a uint32 or not.\nfunc (v *Value) IsUint32() bool {\n\t_, ok := v.data.(uint32)\n\treturn ok\n}\n\n// IsUint32Slice gets whether the object contained is a []uint32 or not.\nfunc (v *Value) IsUint32Slice() bool {\n\t_, ok := v.data.([]uint32)\n\treturn ok\n}\n\n// EachUint32 calls the specified callback for each object\n// in the []uint32.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUint32(callback func(int, uint32) bool) *Value {\n\tfor index, val := range v.MustUint32Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUint32 uses the specified decider function to select items\n// from the []uint32.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUint32(decider func(int, uint32) bool) *Value {\n\tvar selected []uint32\n\tv.EachUint32(func(index int, val uint32) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUint32 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uint32.\nfunc (v *Value) GroupUint32(grouper func(int, uint32) string) *Value {\n\tgroups := make(map[string][]uint32)\n\tv.EachUint32(func(index int, val uint32) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uint32, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUint32 uses the specified function to replace each uint32s\n// by iterating each item.  The data in the returned result will be a\n// []uint32 containing the replaced items.\nfunc (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value {\n\tarr := v.MustUint32Slice()\n\treplaced := make([]uint32, len(arr))\n\tv.EachUint32(func(index int, val uint32) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUint32 uses the specified collector function to collect a value\n// for each of the uint32s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value {\n\tarr := v.MustUint32Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUint32(func(index int, val uint32) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUint64 (uint64 and []uint64)\n*/\n\n// Uint64 gets the value as a uint64, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uint64(optionalDefault ...uint64) uint64 {\n\tif s, ok := v.data.(uint64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUint64 gets the value as a uint64.\n//\n// Panics if the object is not a uint64.\nfunc (v *Value) MustUint64() uint64 {\n\treturn v.data.(uint64)\n}\n\n// Uint64Slice gets the value as a []uint64, returns the optionalDefault\n// value or nil if the value is not a []uint64.\nfunc (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 {\n\tif s, ok := v.data.([]uint64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUint64Slice gets the value as a []uint64.\n//\n// Panics if the object is not a []uint64.\nfunc (v *Value) MustUint64Slice() []uint64 {\n\treturn v.data.([]uint64)\n}\n\n// IsUint64 gets whether the object contained is a uint64 or not.\nfunc (v *Value) IsUint64() bool {\n\t_, ok := v.data.(uint64)\n\treturn ok\n}\n\n// IsUint64Slice gets whether the object contained is a []uint64 or not.\nfunc (v *Value) IsUint64Slice() bool {\n\t_, ok := v.data.([]uint64)\n\treturn ok\n}\n\n// EachUint64 calls the specified callback for each object\n// in the []uint64.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUint64(callback func(int, uint64) bool) *Value {\n\tfor index, val := range v.MustUint64Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUint64 uses the specified decider function to select items\n// from the []uint64.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUint64(decider func(int, uint64) bool) *Value {\n\tvar selected []uint64\n\tv.EachUint64(func(index int, val uint64) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUint64 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uint64.\nfunc (v *Value) GroupUint64(grouper func(int, uint64) string) *Value {\n\tgroups := make(map[string][]uint64)\n\tv.EachUint64(func(index int, val uint64) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uint64, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUint64 uses the specified function to replace each uint64s\n// by iterating each item.  The data in the returned result will be a\n// []uint64 containing the replaced items.\nfunc (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value {\n\tarr := v.MustUint64Slice()\n\treplaced := make([]uint64, len(arr))\n\tv.EachUint64(func(index int, val uint64) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUint64 uses the specified collector function to collect a value\n// for each of the uint64s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value {\n\tarr := v.MustUint64Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUint64(func(index int, val uint64) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tUintptr (uintptr and []uintptr)\n*/\n\n// Uintptr gets the value as a uintptr, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Uintptr(optionalDefault ...uintptr) uintptr {\n\tif s, ok := v.data.(uintptr); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustUintptr gets the value as a uintptr.\n//\n// Panics if the object is not a uintptr.\nfunc (v *Value) MustUintptr() uintptr {\n\treturn v.data.(uintptr)\n}\n\n// UintptrSlice gets the value as a []uintptr, returns the optionalDefault\n// value or nil if the value is not a []uintptr.\nfunc (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr {\n\tif s, ok := v.data.([]uintptr); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustUintptrSlice gets the value as a []uintptr.\n//\n// Panics if the object is not a []uintptr.\nfunc (v *Value) MustUintptrSlice() []uintptr {\n\treturn v.data.([]uintptr)\n}\n\n// IsUintptr gets whether the object contained is a uintptr or not.\nfunc (v *Value) IsUintptr() bool {\n\t_, ok := v.data.(uintptr)\n\treturn ok\n}\n\n// IsUintptrSlice gets whether the object contained is a []uintptr or not.\nfunc (v *Value) IsUintptrSlice() bool {\n\t_, ok := v.data.([]uintptr)\n\treturn ok\n}\n\n// EachUintptr calls the specified callback for each object\n// in the []uintptr.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value {\n\tfor index, val := range v.MustUintptrSlice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereUintptr uses the specified decider function to select items\n// from the []uintptr.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value {\n\tvar selected []uintptr\n\tv.EachUintptr(func(index int, val uintptr) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupUintptr uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]uintptr.\nfunc (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value {\n\tgroups := make(map[string][]uintptr)\n\tv.EachUintptr(func(index int, val uintptr) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]uintptr, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceUintptr uses the specified function to replace each uintptrs\n// by iterating each item.  The data in the returned result will be a\n// []uintptr containing the replaced items.\nfunc (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value {\n\tarr := v.MustUintptrSlice()\n\treplaced := make([]uintptr, len(arr))\n\tv.EachUintptr(func(index int, val uintptr) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectUintptr uses the specified collector function to collect a value\n// for each of the uintptrs in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value {\n\tarr := v.MustUintptrSlice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachUintptr(func(index int, val uintptr) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tFloat32 (float32 and []float32)\n*/\n\n// Float32 gets the value as a float32, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Float32(optionalDefault ...float32) float32 {\n\tif s, ok := v.data.(float32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustFloat32 gets the value as a float32.\n//\n// Panics if the object is not a float32.\nfunc (v *Value) MustFloat32() float32 {\n\treturn v.data.(float32)\n}\n\n// Float32Slice gets the value as a []float32, returns the optionalDefault\n// value or nil if the value is not a []float32.\nfunc (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 {\n\tif s, ok := v.data.([]float32); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustFloat32Slice gets the value as a []float32.\n//\n// Panics if the object is not a []float32.\nfunc (v *Value) MustFloat32Slice() []float32 {\n\treturn v.data.([]float32)\n}\n\n// IsFloat32 gets whether the object contained is a float32 or not.\nfunc (v *Value) IsFloat32() bool {\n\t_, ok := v.data.(float32)\n\treturn ok\n}\n\n// IsFloat32Slice gets whether the object contained is a []float32 or not.\nfunc (v *Value) IsFloat32Slice() bool {\n\t_, ok := v.data.([]float32)\n\treturn ok\n}\n\n// EachFloat32 calls the specified callback for each object\n// in the []float32.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachFloat32(callback func(int, float32) bool) *Value {\n\tfor index, val := range v.MustFloat32Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereFloat32 uses the specified decider function to select items\n// from the []float32.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereFloat32(decider func(int, float32) bool) *Value {\n\tvar selected []float32\n\tv.EachFloat32(func(index int, val float32) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupFloat32 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]float32.\nfunc (v *Value) GroupFloat32(grouper func(int, float32) string) *Value {\n\tgroups := make(map[string][]float32)\n\tv.EachFloat32(func(index int, val float32) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]float32, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceFloat32 uses the specified function to replace each float32s\n// by iterating each item.  The data in the returned result will be a\n// []float32 containing the replaced items.\nfunc (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value {\n\tarr := v.MustFloat32Slice()\n\treplaced := make([]float32, len(arr))\n\tv.EachFloat32(func(index int, val float32) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectFloat32 uses the specified collector function to collect a value\n// for each of the float32s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value {\n\tarr := v.MustFloat32Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachFloat32(func(index int, val float32) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tFloat64 (float64 and []float64)\n*/\n\n// Float64 gets the value as a float64, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Float64(optionalDefault ...float64) float64 {\n\tif s, ok := v.data.(float64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustFloat64 gets the value as a float64.\n//\n// Panics if the object is not a float64.\nfunc (v *Value) MustFloat64() float64 {\n\treturn v.data.(float64)\n}\n\n// Float64Slice gets the value as a []float64, returns the optionalDefault\n// value or nil if the value is not a []float64.\nfunc (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 {\n\tif s, ok := v.data.([]float64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustFloat64Slice gets the value as a []float64.\n//\n// Panics if the object is not a []float64.\nfunc (v *Value) MustFloat64Slice() []float64 {\n\treturn v.data.([]float64)\n}\n\n// IsFloat64 gets whether the object contained is a float64 or not.\nfunc (v *Value) IsFloat64() bool {\n\t_, ok := v.data.(float64)\n\treturn ok\n}\n\n// IsFloat64Slice gets whether the object contained is a []float64 or not.\nfunc (v *Value) IsFloat64Slice() bool {\n\t_, ok := v.data.([]float64)\n\treturn ok\n}\n\n// EachFloat64 calls the specified callback for each object\n// in the []float64.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachFloat64(callback func(int, float64) bool) *Value {\n\tfor index, val := range v.MustFloat64Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereFloat64 uses the specified decider function to select items\n// from the []float64.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereFloat64(decider func(int, float64) bool) *Value {\n\tvar selected []float64\n\tv.EachFloat64(func(index int, val float64) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupFloat64 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]float64.\nfunc (v *Value) GroupFloat64(grouper func(int, float64) string) *Value {\n\tgroups := make(map[string][]float64)\n\tv.EachFloat64(func(index int, val float64) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]float64, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceFloat64 uses the specified function to replace each float64s\n// by iterating each item.  The data in the returned result will be a\n// []float64 containing the replaced items.\nfunc (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value {\n\tarr := v.MustFloat64Slice()\n\treplaced := make([]float64, len(arr))\n\tv.EachFloat64(func(index int, val float64) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectFloat64 uses the specified collector function to collect a value\n// for each of the float64s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value {\n\tarr := v.MustFloat64Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachFloat64(func(index int, val float64) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tComplex64 (complex64 and []complex64)\n*/\n\n// Complex64 gets the value as a complex64, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Complex64(optionalDefault ...complex64) complex64 {\n\tif s, ok := v.data.(complex64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustComplex64 gets the value as a complex64.\n//\n// Panics if the object is not a complex64.\nfunc (v *Value) MustComplex64() complex64 {\n\treturn v.data.(complex64)\n}\n\n// Complex64Slice gets the value as a []complex64, returns the optionalDefault\n// value or nil if the value is not a []complex64.\nfunc (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 {\n\tif s, ok := v.data.([]complex64); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustComplex64Slice gets the value as a []complex64.\n//\n// Panics if the object is not a []complex64.\nfunc (v *Value) MustComplex64Slice() []complex64 {\n\treturn v.data.([]complex64)\n}\n\n// IsComplex64 gets whether the object contained is a complex64 or not.\nfunc (v *Value) IsComplex64() bool {\n\t_, ok := v.data.(complex64)\n\treturn ok\n}\n\n// IsComplex64Slice gets whether the object contained is a []complex64 or not.\nfunc (v *Value) IsComplex64Slice() bool {\n\t_, ok := v.data.([]complex64)\n\treturn ok\n}\n\n// EachComplex64 calls the specified callback for each object\n// in the []complex64.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachComplex64(callback func(int, complex64) bool) *Value {\n\tfor index, val := range v.MustComplex64Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereComplex64 uses the specified decider function to select items\n// from the []complex64.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value {\n\tvar selected []complex64\n\tv.EachComplex64(func(index int, val complex64) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupComplex64 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]complex64.\nfunc (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value {\n\tgroups := make(map[string][]complex64)\n\tv.EachComplex64(func(index int, val complex64) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]complex64, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceComplex64 uses the specified function to replace each complex64s\n// by iterating each item.  The data in the returned result will be a\n// []complex64 containing the replaced items.\nfunc (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value {\n\tarr := v.MustComplex64Slice()\n\treplaced := make([]complex64, len(arr))\n\tv.EachComplex64(func(index int, val complex64) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectComplex64 uses the specified collector function to collect a value\n// for each of the complex64s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value {\n\tarr := v.MustComplex64Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachComplex64(func(index int, val complex64) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n\n/*\n\tComplex128 (complex128 and []complex128)\n*/\n\n// Complex128 gets the value as a complex128, returns the optionalDefault\n// value or a system default object if the value is the wrong type.\nfunc (v *Value) Complex128(optionalDefault ...complex128) complex128 {\n\tif s, ok := v.data.(complex128); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn 0\n}\n\n// MustComplex128 gets the value as a complex128.\n//\n// Panics if the object is not a complex128.\nfunc (v *Value) MustComplex128() complex128 {\n\treturn v.data.(complex128)\n}\n\n// Complex128Slice gets the value as a []complex128, returns the optionalDefault\n// value or nil if the value is not a []complex128.\nfunc (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 {\n\tif s, ok := v.data.([]complex128); ok {\n\t\treturn s\n\t}\n\tif len(optionalDefault) == 1 {\n\t\treturn optionalDefault[0]\n\t}\n\treturn nil\n}\n\n// MustComplex128Slice gets the value as a []complex128.\n//\n// Panics if the object is not a []complex128.\nfunc (v *Value) MustComplex128Slice() []complex128 {\n\treturn v.data.([]complex128)\n}\n\n// IsComplex128 gets whether the object contained is a complex128 or not.\nfunc (v *Value) IsComplex128() bool {\n\t_, ok := v.data.(complex128)\n\treturn ok\n}\n\n// IsComplex128Slice gets whether the object contained is a []complex128 or not.\nfunc (v *Value) IsComplex128Slice() bool {\n\t_, ok := v.data.([]complex128)\n\treturn ok\n}\n\n// EachComplex128 calls the specified callback for each object\n// in the []complex128.\n//\n// Panics if the object is the wrong type.\nfunc (v *Value) EachComplex128(callback func(int, complex128) bool) *Value {\n\tfor index, val := range v.MustComplex128Slice() {\n\t\tcarryon := callback(index, val)\n\t\tif !carryon {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn v\n}\n\n// WhereComplex128 uses the specified decider function to select items\n// from the []complex128.  The object contained in the result will contain\n// only the selected items.\nfunc (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value {\n\tvar selected []complex128\n\tv.EachComplex128(func(index int, val complex128) bool {\n\t\tshouldSelect := decider(index, val)\n\t\tif !shouldSelect {\n\t\t\tselected = append(selected, val)\n\t\t}\n\t\treturn true\n\t})\n\treturn &Value{data: selected}\n}\n\n// GroupComplex128 uses the specified grouper function to group the items\n// keyed by the return of the grouper.  The object contained in the\n// result will contain a map[string][]complex128.\nfunc (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value {\n\tgroups := make(map[string][]complex128)\n\tv.EachComplex128(func(index int, val complex128) bool {\n\t\tgroup := grouper(index, val)\n\t\tif _, ok := groups[group]; !ok {\n\t\t\tgroups[group] = make([]complex128, 0)\n\t\t}\n\t\tgroups[group] = append(groups[group], val)\n\t\treturn true\n\t})\n\treturn &Value{data: groups}\n}\n\n// ReplaceComplex128 uses the specified function to replace each complex128s\n// by iterating each item.  The data in the returned result will be a\n// []complex128 containing the replaced items.\nfunc (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value {\n\tarr := v.MustComplex128Slice()\n\treplaced := make([]complex128, len(arr))\n\tv.EachComplex128(func(index int, val complex128) bool {\n\t\treplaced[index] = replacer(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: replaced}\n}\n\n// CollectComplex128 uses the specified collector function to collect a value\n// for each of the complex128s in the slice.  The data returned will be a\n// []interface{}.\nfunc (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value {\n\tarr := v.MustComplex128Slice()\n\tcollected := make([]interface{}, len(arr))\n\tv.EachComplex128(func(index int, val complex128) bool {\n\t\tcollected[index] = collector(index, val)\n\t\treturn true\n\t})\n\treturn &Value{data: collected}\n}\n"
  },
  {
    "path": "src/github.com/stretchr/testify/vendor/github.com/stretchr/objx/value.go",
    "content": "package objx\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n)\n\n// Value provides methods for extracting interface{} data in various\n// types.\ntype Value struct {\n\t// data contains the raw data being managed by this Value\n\tdata interface{}\n}\n\n// Data returns the raw data contained by this Value\nfunc (v *Value) Data() interface{} {\n\treturn v.data\n}\n\n// String returns the value always as a string\nfunc (v *Value) String() string {\n\tswitch {\n\tcase v.IsStr():\n\t\treturn v.Str()\n\tcase v.IsBool():\n\t\treturn strconv.FormatBool(v.Bool())\n\tcase v.IsFloat32():\n\t\treturn strconv.FormatFloat(float64(v.Float32()), 'f', -1, 32)\n\tcase v.IsFloat64():\n\t\treturn strconv.FormatFloat(v.Float64(), 'f', -1, 64)\n\tcase v.IsInt():\n\t\treturn strconv.FormatInt(int64(v.Int()), 10)\n\tcase v.IsInt():\n\t\treturn strconv.FormatInt(int64(v.Int()), 10)\n\tcase v.IsInt8():\n\t\treturn strconv.FormatInt(int64(v.Int8()), 10)\n\tcase v.IsInt16():\n\t\treturn strconv.FormatInt(int64(v.Int16()), 10)\n\tcase v.IsInt32():\n\t\treturn strconv.FormatInt(int64(v.Int32()), 10)\n\tcase v.IsInt64():\n\t\treturn strconv.FormatInt(v.Int64(), 10)\n\tcase v.IsUint():\n\t\treturn strconv.FormatUint(uint64(v.Uint()), 10)\n\tcase v.IsUint8():\n\t\treturn strconv.FormatUint(uint64(v.Uint8()), 10)\n\tcase v.IsUint16():\n\t\treturn strconv.FormatUint(uint64(v.Uint16()), 10)\n\tcase v.IsUint32():\n\t\treturn strconv.FormatUint(uint64(v.Uint32()), 10)\n\tcase v.IsUint64():\n\t\treturn strconv.FormatUint(v.Uint64(), 10)\n\t}\n\n\treturn fmt.Sprintf(\"%#v\", v.Data())\n}\n"
  },
  {
    "path": "src/main.go",
    "content": "package main\n\nimport (\n\t\"github.com/dolotech/leaf\"\n\t\"server/conf\"\n\t\"server/gate\"\n\t\"server/login\"\n\t\"net/http\"\n\t\"flag\"\n\t\"github.com/golang/glog\"\n\t\"github.com/dolotech/lib/db\"\n\t\"server/model\"\n\t\"server/game\"\n)\n\nvar Commit = \"\"\nvar BUILD_TIME = \"\"\nvar VERSION = \"\"\n\nvar createdb bool\n\nfunc init() {\n\tflag.StringVar(&conf.Server.WSAddr, \"addr\", \":8989\", \"websocket port\")\n\tflag.IntVar(&conf.Server.MaxConnNum, \"maxconn\", 20000, \"Max Conn Num\")\n\tflag.StringVar(&conf.Server.DBUrl, \"pg\", \"postgres://postgres:haosql@127.0.0.1:5432/postgres?sslmode=disable\", \"pg addr\")\n\tflag.BoolVar(&createdb, \"createdb\", false, \"initial database\")\n\n\tflag.Parse()\n\n\tdb.Init(conf.Server.DBUrl)\n\tif createdb {\n\t\tcreateDb()\n\t}\n}\n\nfunc main() {\n\n\tgo leaf.Run(\n\t\tgame.Module,\n\t\tgate.Module,\n\t\tlogin.Module,\n\t)\n\n\t// for test client\n\thttp.Handle(\"/\", http.StripPrefix(\"/\", http.FileServer(http.Dir(\"./\"))))\n\terr := http.ListenAndServe(\":12345\", nil)\n\tif err != nil {\n\t\tglog.Fatalf(\"ListenAndServe: %v \", err)\n\t}\n}\n\nfunc createDb() {\n\t// 建表,只维护和服务器game里面有关的表\n\terr := db.C().Sync(model.User{}, model.Room{})\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t}\n}\n"
  },
  {
    "path": "src/server/algorithm/7462.txt",
    "content": "TOTAL    FIVE CARDS     HAND VALUE                     POKER HAND\n=====================================================================\n   4     T J Q K A      Royal Flush                    ROYAL FLUSH\n   4     9 T J Q K      King High Straight Flush       STRAIGHT FLUSH\n   4     8 9 T J Q      Queen High Straight Flush\n   4     7 8 9 T J      Jack High Straight Flush\n   4     6 7 8 9 T      Ten High Straight Flush\n   4     5 6 7 8 9      Nine High Straight Flush\n   4     4 5 6 7 8      Eight High Straight Flush\n   4     3 4 5 6 7      Seven High Straight Flush\n   4     2 3 4 5 6      Six High Straight Flush\n   4     A 2 3 4 5      Five High Straight Flush\n   4     A A A A K      Four Aces                      FOUR OF A KIND\n   4     A A A A Q\n   4     A A A A J\n   4     A A A A T\n   4     A A A A 9\n   4     A A A A 8\n   4     A A A A 7\n   4     A A A A 6\n   4     A A A A 5\n   4     A A A A 4\n   4     A A A A 3\n   4     A A A A 2\n   4     K K K K A      Four Kings\n   4     K K K K Q\n   4     K K K K J\n   4     K K K K T\n   4     K K K K 9\n   4     K K K K 8\n   4     K K K K 7\n   4     K K K K 6\n   4     K K K K 5\n   4     K K K K 4\n   4     K K K K 3\n   4     K K K K 2\n   4     Q Q Q Q A      Four Queens\n   4     Q Q Q Q K\n   4     Q Q Q Q J\n   4     Q Q Q Q T\n   4     Q Q Q Q 9\n   4     Q Q Q Q 8\n   4     Q Q Q Q 7\n   4     Q Q Q Q 6\n   4     Q Q Q Q 5\n   4     Q Q Q Q 4\n   4     Q Q Q Q 3\n   4     Q Q Q Q 2\n   4     J J J J A      Four Jacks\n   4     J J J J K\n   4     J J J J Q\n   4     J J J J T\n   4     J J J J 9\n   4     J J J J 8\n   4     J J J J 7\n   4     J J J J 6\n   4     J J J J 5\n   4     J J J J 4\n   4     J J J J 3\n   4     J J J J 2\n   4     T T T T A      Four Tens\n   4     T T T T K\n   4     T T T T Q\n   4     T T T T J\n   4     T T T T 9\n   4     T T T T 8\n   4     T T T T 7\n   4     T T T T 6\n   4     T T T T 5\n   4     T T T T 4\n   4     T T T T 3\n   4     T T T T 2\n   4     9 9 9 9 A      Four Nines\n   4     9 9 9 9 K\n   4     9 9 9 9 Q\n   4     9 9 9 9 J\n   4     9 9 9 9 T\n   4     9 9 9 9 8\n   4     9 9 9 9 7\n   4     9 9 9 9 6\n   4     9 9 9 9 5\n   4     9 9 9 9 4\n   4     9 9 9 9 3\n   4     9 9 9 9 2\n   4     8 8 8 8 A      Four Eights\n   4     8 8 8 8 K\n   4     8 8 8 8 Q\n   4     8 8 8 8 J\n   4     8 8 8 8 T\n   4     8 8 8 8 9\n   4     8 8 8 8 7\n   4     8 8 8 8 6\n   4     8 8 8 8 5\n   4     8 8 8 8 4\n   4     8 8 8 8 3\n   4     8 8 8 8 2\n   4     7 7 7 7 A      Four Sevens\n   4     7 7 7 7 K\n   4     7 7 7 7 Q\n   4     7 7 7 7 J\n   4     7 7 7 7 T\n   4     7 7 7 7 9\n   4     7 7 7 7 8\n   4     7 7 7 7 6\n   4     7 7 7 7 5\n   4     7 7 7 7 4\n   4     7 7 7 7 3\n   4     7 7 7 7 2\n   4     6 6 6 6 A      Four Sixes\n   4     6 6 6 6 K\n   4     6 6 6 6 Q\n   4     6 6 6 6 J\n   4     6 6 6 6 T\n   4     6 6 6 6 9\n   4     6 6 6 6 8\n   4     6 6 6 6 7\n   4     6 6 6 6 5\n   4     6 6 6 6 4\n   4     6 6 6 6 3\n   4     6 6 6 6 2\n   4     5 5 5 5 A      Four Fives\n   4     5 5 5 5 K\n   4     5 5 5 5 Q\n   4     5 5 5 5 J\n   4     5 5 5 5 T\n   4     5 5 5 5 9\n   4     5 5 5 5 8\n   4     5 5 5 5 7\n   4     5 5 5 5 6\n   4     5 5 5 5 4\n   4     5 5 5 5 3\n   4     5 5 5 5 2\n   4     4 4 4 4 A      Four Fours\n   4     4 4 4 4 K\n   4     4 4 4 4 Q\n   4     4 4 4 4 J\n   4     4 4 4 4 T\n   4     4 4 4 4 9\n   4     4 4 4 4 8\n   4     4 4 4 4 7\n   4     4 4 4 4 6\n   4     4 4 4 4 5\n   4     4 4 4 4 3\n   4     4 4 4 4 2\n   4     3 3 3 3 A      Four Treys\n   4     3 3 3 3 K\n   4     3 3 3 3 Q\n   4     3 3 3 3 J\n   4     3 3 3 3 T\n   4     3 3 3 3 9\n   4     3 3 3 3 8\n   4     3 3 3 3 7\n   4     3 3 3 3 6\n   4     3 3 3 3 5\n   4     3 3 3 3 4\n   4     3 3 3 3 2\n   4     2 2 2 2 A      Four Deuces\n   4     2 2 2 2 K\n   4     2 2 2 2 Q\n   4     2 2 2 2 J\n   4     2 2 2 2 T\n   4     2 2 2 2 9\n   4     2 2 2 2 8\n   4     2 2 2 2 7\n   4     2 2 2 2 6\n   4     2 2 2 2 5\n   4     2 2 2 2 4\n   4     2 2 2 2 3\n  24     A A A K K      Aces Full                      FULL HOUSE\n  24     A A A Q Q\n  24     A A A J J\n  24     A A A T T\n  24     A A A 9 9\n  24     A A A 8 8\n  24     A A A 7 7\n  24     A A A 6 6\n  24     A A A 5 5\n  24     A A A 4 4\n  24     A A A 3 3\n  24     A A A 2 2\n  24     K K K A A      Kings Full\n  24     K K K Q Q\n  24     K K K J J\n  24     K K K T T\n  24     K K K 9 9\n  24     K K K 8 8\n  24     K K K 7 7\n  24     K K K 6 6\n  24     K K K 5 5\n  24     K K K 4 4\n  24     K K K 3 3\n  24     K K K 2 2\n  24     Q Q Q A A      Queens Full\n  24     Q Q Q K K\n  24     Q Q Q J J\n  24     Q Q Q T T\n  24     Q Q Q 9 9\n  24     Q Q Q 8 8\n  24     Q Q Q 7 7\n  24     Q Q Q 6 6\n  24     Q Q Q 5 5\n  24     Q Q Q 4 4\n  24     Q Q Q 3 3\n  24     Q Q Q 2 2\n  24     J J J A A      Jacks Full\n  24     J J J K K\n  24     J J J Q Q\n  24     J J J T T\n  24     J J J 9 9\n  24     J J J 8 8\n  24     J J J 7 7\n  24     J J J 6 6\n  24     J J J 5 5\n  24     J J J 4 4\n  24     J J J 3 3\n  24     J J J 2 2\n  24     T T T A A      Tens Full\n  24     T T T K K\n  24     T T T Q Q\n  24     T T T J J\n  24     T T T 9 9\n  24     T T T 8 8\n  24     T T T 7 7\n  24     T T T 6 6\n  24     T T T 5 5\n  24     T T T 4 4\n  24     T T T 3 3\n  24     T T T 2 2\n  24     9 9 9 A A      Nines Full\n  24     9 9 9 K K\n  24     9 9 9 Q Q\n  24     9 9 9 J J\n  24     9 9 9 T T\n  24     9 9 9 8 8\n  24     9 9 9 7 7\n  24     9 9 9 6 6\n  24     9 9 9 5 5\n  24     9 9 9 4 4\n  24     9 9 9 3 3\n  24     9 9 9 2 2\n  24     8 8 8 A A      Eights Full\n  24     8 8 8 K K\n  24     8 8 8 Q Q\n  24     8 8 8 J J\n  24     8 8 8 T T\n  24     8 8 8 9 9\n  24     8 8 8 7 7\n  24     8 8 8 6 6\n  24     8 8 8 5 5\n  24     8 8 8 4 4\n  24     8 8 8 3 3\n  24     8 8 8 2 2\n  24     7 7 7 A A      Sevens Full\n  24     7 7 7 K K\n  24     7 7 7 Q Q\n  24     7 7 7 J J\n  24     7 7 7 T T\n  24     7 7 7 9 9\n  24     7 7 7 8 8\n  24     7 7 7 6 6\n  24     7 7 7 5 5\n  24     7 7 7 4 4\n  24     7 7 7 3 3\n  24     7 7 7 2 2\n  24     6 6 6 A A      Sixes Full\n  24     6 6 6 K K\n  24     6 6 6 Q Q\n  24     6 6 6 J J\n  24     6 6 6 T T\n  24     6 6 6 9 9\n  24     6 6 6 8 8\n  24     6 6 6 7 7\n  24     6 6 6 5 5\n  24     6 6 6 4 4\n  24     6 6 6 3 3\n  24     6 6 6 2 2\n  24     5 5 5 A A      Fives Full\n  24     5 5 5 K K\n  24     5 5 5 Q Q\n  24     5 5 5 J J\n  24     5 5 5 T T\n  24     5 5 5 9 9\n  24     5 5 5 8 8\n  24     5 5 5 7 7\n  24     5 5 5 6 6\n  24     5 5 5 4 4\n  24     5 5 5 3 3\n  24     5 5 5 2 2\n  24     4 4 4 A A      Fours Full\n  24     4 4 4 K K\n  24     4 4 4 Q Q\n  24     4 4 4 J J\n  24     4 4 4 T T\n  24     4 4 4 9 9\n  24     4 4 4 8 8\n  24     4 4 4 7 7\n  24     4 4 4 6 6\n  24     4 4 4 5 5\n  24     4 4 4 3 3\n  24     4 4 4 2 2\n  24     3 3 3 A A      Threes Full\n  24     3 3 3 K K\n  24     3 3 3 Q Q\n  24     3 3 3 J J\n  24     3 3 3 T T\n  24     3 3 3 9 9\n  24     3 3 3 8 8\n  24     3 3 3 7 7\n  24     3 3 3 6 6\n  24     3 3 3 5 5\n  24     3 3 3 4 4\n  24     3 3 3 2 2\n  24     2 2 2 A A      Deuces Full\n  24     2 2 2 K K\n  24     2 2 2 Q Q\n  24     2 2 2 J J\n  24     2 2 2 T T\n  24     2 2 2 9 9\n  24     2 2 2 8 8\n  24     2 2 2 7 7\n  24     2 2 2 6 6\n  24     2 2 2 5 5\n  24     2 2 2 4 4\n  24     2 2 2 3 3\n   4     9 J Q K A      Ace High Flush                 FLUSH\n   4     8 J Q K A\n   4     7 J Q K A\n   4     6 J Q K A\n   4     5 J Q K A\n   4     4 J Q K A\n   4     3 J Q K A\n   4     2 J Q K A\n   4     9 T Q K A\n   4     8 T Q K A\n   4     7 T Q K A\n   4     6 T Q K A\n   4     5 T Q K A\n   4     4 T Q K A\n   4     3 T Q K A\n   4     2 T Q K A\n   4     8 9 Q K A\n   4     7 9 Q K A\n   4     6 9 Q K A\n   4     5 9 Q K A\n   4     4 9 Q K A\n   4     3 9 Q K A\n   4     2 9 Q K A\n   4     7 8 Q K A\n   4     6 8 Q K A\n   4     5 8 Q K A\n   4     4 8 Q K A\n   4     3 8 Q K A\n   4     2 8 Q K A\n   4     6 7 Q K A\n   4     5 7 Q K A\n   4     4 7 Q K A\n   4     3 7 Q K A\n   4     2 7 Q K A\n   4     5 6 Q K A\n   4     4 6 Q K A\n   4     3 6 Q K A\n   4     2 6 Q K A\n   4     4 5 Q K A\n   4     3 5 Q K A\n   4     2 5 Q K A\n   4     3 4 Q K A\n   4     2 4 Q K A\n   4     2 3 Q K A\n   4     9 T J K A\n   4     8 T J K A\n   4     7 T J K A\n   4     6 T J K A\n   4     5 T J K A\n   4     4 T J K A\n   4     3 T J K A\n   4     2 T J K A\n   4     8 9 J K A\n   4     7 9 J K A\n   4     6 9 J K A\n   4     5 9 J K A\n   4     4 9 J K A\n   4     3 9 J K A\n   4     2 9 J K A\n   4     7 8 J K A\n   4     6 8 J K A\n   4     5 8 J K A\n   4     4 8 J K A\n   4     3 8 J K A\n   4     2 8 J K A\n   4     6 7 J K A\n   4     5 7 J K A\n   4     4 7 J K A\n   4     3 7 J K A\n   4     2 7 J K A\n   4     5 6 J K A\n   4     4 6 J K A\n   4     3 6 J K A\n   4     2 6 J K A\n   4     4 5 J K A\n   4     3 5 J K A\n   4     2 5 J K A\n   4     3 4 J K A\n   4     2 4 J K A\n   4     2 3 J K A\n   4     8 9 T K A\n   4     7 9 T K A\n   4     6 9 T K A\n   4     5 9 T K A\n   4     4 9 T K A\n   4     3 9 T K A\n   4     2 9 T K A\n   4     7 8 T K A\n   4     6 8 T K A\n   4     5 8 T K A\n   4     4 8 T K A\n   4     3 8 T K A\n   4     2 8 T K A\n   4     6 7 T K A\n   4     5 7 T K A\n   4     4 7 T K A\n   4     3 7 T K A\n   4     2 7 T K A\n   4     5 6 T K A\n   4     4 6 T K A\n   4     3 6 T K A\n   4     2 6 T K A\n   4     4 5 T K A\n   4     3 5 T K A\n   4     2 5 T K A\n   4     3 4 T K A\n   4     2 4 T K A\n   4     2 3 T K A\n   4     7 8 9 K A\n   4     6 8 9 K A\n   4     5 8 9 K A\n   4     4 8 9 K A\n   4     3 8 9 K A\n   4     2 8 9 K A\n   4     6 7 9 K A\n   4     5 7 9 K A\n   4     4 7 9 K A\n   4     3 7 9 K A\n   4     2 7 9 K A\n   4     5 6 9 K A\n   4     4 6 9 K A\n   4     3 6 9 K A\n   4     2 6 9 K A\n   4     4 5 9 K A\n   4     3 5 9 K A\n   4     2 5 9 K A\n   4     3 4 9 K A\n   4     2 4 9 K A\n   4     2 3 9 K A\n   4     6 7 8 K A\n   4     5 7 8 K A\n   4     4 7 8 K A\n   4     3 7 8 K A\n   4     2 7 8 K A\n   4     5 6 8 K A\n   4     4 6 8 K A\n   4     3 6 8 K A\n   4     2 6 8 K A\n   4     4 5 8 K A\n   4     3 5 8 K A\n   4     2 5 8 K A\n   4     3 4 8 K A\n   4     2 4 8 K A\n   4     2 3 8 K A\n   4     5 6 7 K A\n   4     4 6 7 K A\n   4     3 6 7 K A\n   4     2 6 7 K A\n   4     4 5 7 K A\n   4     3 5 7 K A\n   4     2 5 7 K A\n   4     3 4 7 K A\n   4     2 4 7 K A\n   4     2 3 7 K A\n   4     4 5 6 K A\n   4     3 5 6 K A\n   4     2 5 6 K A\n   4     3 4 6 K A\n   4     2 4 6 K A\n   4     2 3 6 K A\n   4     3 4 5 K A\n   4     2 4 5 K A\n   4     2 3 5 K A\n   4     2 3 4 K A\n   4     9 T J Q A\n   4     8 T J Q A\n   4     7 T J Q A\n   4     6 T J Q A\n   4     5 T J Q A\n   4     4 T J Q A\n   4     3 T J Q A\n   4     2 T J Q A\n   4     8 9 J Q A\n   4     7 9 J Q A\n   4     6 9 J Q A\n   4     5 9 J Q A\n   4     4 9 J Q A\n   4     3 9 J Q A\n   4     2 9 J Q A\n   4     7 8 J Q A\n   4     6 8 J Q A\n   4     5 8 J Q A\n   4     4 8 J Q A\n   4     3 8 J Q A\n   4     2 8 J Q A\n   4     6 7 J Q A\n   4     5 7 J Q A\n   4     4 7 J Q A\n   4     3 7 J Q A\n   4     2 7 J Q A\n   4     5 6 J Q A\n   4     4 6 J Q A\n   4     3 6 J Q A\n   4     2 6 J Q A\n   4     4 5 J Q A\n   4     3 5 J Q A\n   4     2 5 J Q A\n   4     3 4 J Q A\n   4     2 4 J Q A\n   4     2 3 J Q A\n   4     8 9 T Q A\n   4     7 9 T Q A\n   4     6 9 T Q A\n   4     5 9 T Q A\n   4     4 9 T Q A\n   4     3 9 T Q A\n   4     2 9 T Q A\n   4     7 8 T Q A\n   4     6 8 T Q A\n   4     5 8 T Q A\n   4     4 8 T Q A\n   4     3 8 T Q A\n   4     2 8 T Q A\n   4     6 7 T Q A\n   4     5 7 T Q A\n   4     4 7 T Q A\n   4     3 7 T Q A\n   4     2 7 T Q A\n   4     5 6 T Q A\n   4     4 6 T Q A\n   4     3 6 T Q A\n   4     2 6 T Q A\n   4     4 5 T Q A\n   4     3 5 T Q A\n   4     2 5 T Q A\n   4     3 4 T Q A\n   4     2 4 T Q A\n   4     2 3 T Q A\n   4     7 8 9 Q A\n   4     6 8 9 Q A\n   4     5 8 9 Q A\n   4     4 8 9 Q A\n   4     3 8 9 Q A\n   4     2 8 9 Q A\n   4     6 7 9 Q A\n   4     5 7 9 Q A\n   4     4 7 9 Q A\n   4     3 7 9 Q A\n   4     2 7 9 Q A\n   4     5 6 9 Q A\n   4     4 6 9 Q A\n   4     3 6 9 Q A\n   4     2 6 9 Q A\n   4     4 5 9 Q A\n   4     3 5 9 Q A\n   4     2 5 9 Q A\n   4     3 4 9 Q A\n   4     2 4 9 Q A\n   4     2 3 9 Q A\n   4     6 7 8 Q A\n   4     5 7 8 Q A\n   4     4 7 8 Q A\n   4     3 7 8 Q A\n   4     2 7 8 Q A\n   4     5 6 8 Q A\n   4     4 6 8 Q A\n   4     3 6 8 Q A\n   4     2 6 8 Q A\n   4     4 5 8 Q A\n   4     3 5 8 Q A\n   4     2 5 8 Q A\n   4     3 4 8 Q A\n   4     2 4 8 Q A\n   4     2 3 8 Q A\n   4     5 6 7 Q A\n   4     4 6 7 Q A\n   4     3 6 7 Q A\n   4     2 6 7 Q A\n   4     4 5 7 Q A\n   4     3 5 7 Q A\n   4     2 5 7 Q A\n   4     3 4 7 Q A\n   4     2 4 7 Q A\n   4     2 3 7 Q A\n   4     4 5 6 Q A\n   4     3 5 6 Q A\n   4     2 5 6 Q A\n   4     3 4 6 Q A\n   4     2 4 6 Q A\n   4     2 3 6 Q A\n   4     3 4 5 Q A\n   4     2 4 5 Q A\n   4     2 3 5 Q A\n   4     2 3 4 Q A\n   4     8 9 T J A\n   4     7 9 T J A\n   4     6 9 T J A\n   4     5 9 T J A\n   4     4 9 T J A\n   4     3 9 T J A\n   4     2 9 T J A\n   4     7 8 T J A\n   4     6 8 T J A\n   4     5 8 T J A\n   4     4 8 T J A\n   4     3 8 T J A\n   4     2 8 T J A\n   4     6 7 T J A\n   4     5 7 T J A\n   4     4 7 T J A\n   4     3 7 T J A\n   4     2 7 T J A\n   4     5 6 T J A\n   4     4 6 T J A\n   4     3 6 T J A\n   4     2 6 T J A\n   4     4 5 T J A\n   4     3 5 T J A\n   4     2 5 T J A\n   4     3 4 T J A\n   4     2 4 T J A\n   4     2 3 T J A\n   4     7 8 9 J A\n   4     6 8 9 J A\n   4     5 8 9 J A\n   4     4 8 9 J A\n   4     3 8 9 J A\n   4     2 8 9 J A\n   4     6 7 9 J A\n   4     5 7 9 J A\n   4     4 7 9 J A\n   4     3 7 9 J A\n   4     2 7 9 J A\n   4     5 6 9 J A\n   4     4 6 9 J A\n   4     3 6 9 J A\n   4     2 6 9 J A\n   4     4 5 9 J A\n   4     3 5 9 J A\n   4     2 5 9 J A\n   4     3 4 9 J A\n   4     2 4 9 J A\n   4     2 3 9 J A\n   4     6 7 8 J A\n   4     5 7 8 J A\n   4     4 7 8 J A\n   4     3 7 8 J A\n   4     2 7 8 J A\n   4     5 6 8 J A\n   4     4 6 8 J A\n   4     3 6 8 J A\n   4     2 6 8 J A\n   4     4 5 8 J A\n   4     3 5 8 J A\n   4     2 5 8 J A\n   4     3 4 8 J A\n   4     2 4 8 J A\n   4     2 3 8 J A\n   4     5 6 7 J A\n   4     4 6 7 J A\n   4     3 6 7 J A\n   4     2 6 7 J A\n   4     4 5 7 J A\n   4     3 5 7 J A\n   4     2 5 7 J A\n   4     3 4 7 J A\n   4     2 4 7 J A\n   4     2 3 7 J A\n   4     4 5 6 J A\n   4     3 5 6 J A\n   4     2 5 6 J A\n   4     3 4 6 J A\n   4     2 4 6 J A\n   4     2 3 6 J A\n   4     3 4 5 J A\n   4     2 4 5 J A\n   4     2 3 5 J A\n   4     2 3 4 J A\n   4     7 8 9 T A\n   4     6 8 9 T A\n   4     5 8 9 T A\n   4     4 8 9 T A\n   4     3 8 9 T A\n   4     2 8 9 T A\n   4     6 7 9 T A\n   4     5 7 9 T A\n   4     4 7 9 T A\n   4     3 7 9 T A\n   4     2 7 9 T A\n   4     5 6 9 T A\n   4     4 6 9 T A\n   4     3 6 9 T A\n   4     2 6 9 T A\n   4     4 5 9 T A\n   4     3 5 9 T A\n   4     2 5 9 T A\n   4     3 4 9 T A\n   4     2 4 9 T A\n   4     2 3 9 T A\n   4     6 7 8 T A\n   4     5 7 8 T A\n   4     4 7 8 T A\n   4     3 7 8 T A\n   4     2 7 8 T A\n   4     5 6 8 T A\n   4     4 6 8 T A\n   4     3 6 8 T A\n   4     2 6 8 T A\n   4     4 5 8 T A\n   4     3 5 8 T A\n   4     2 5 8 T A\n   4     3 4 8 T A\n   4     2 4 8 T A\n   4     2 3 8 T A\n   4     5 6 7 T A\n   4     4 6 7 T A\n   4     3 6 7 T A\n   4     2 6 7 T A\n   4     4 5 7 T A\n   4     3 5 7 T A\n   4     2 5 7 T A\n   4     3 4 7 T A\n   4     2 4 7 T A\n   4     2 3 7 T A\n   4     4 5 6 T A\n   4     3 5 6 T A\n   4     2 5 6 T A\n   4     3 4 6 T A\n   4     2 4 6 T A\n   4     2 3 6 T A\n   4     3 4 5 T A\n   4     2 4 5 T A\n   4     2 3 5 T A\n   4     2 3 4 T A\n   4     6 7 8 9 A\n   4     5 7 8 9 A\n   4     4 7 8 9 A\n   4     3 7 8 9 A\n   4     2 7 8 9 A\n   4     5 6 8 9 A\n   4     4 6 8 9 A\n   4     3 6 8 9 A\n   4     2 6 8 9 A\n   4     4 5 8 9 A\n   4     3 5 8 9 A\n   4     2 5 8 9 A\n   4     3 4 8 9 A\n   4     2 4 8 9 A\n   4     2 3 8 9 A\n   4     5 6 7 9 A\n   4     4 6 7 9 A\n   4     3 6 7 9 A\n   4     2 6 7 9 A\n   4     4 5 7 9 A\n   4     3 5 7 9 A\n   4     2 5 7 9 A\n   4     3 4 7 9 A\n   4     2 4 7 9 A\n   4     2 3 7 9 A\n   4     4 5 6 9 A\n   4     3 5 6 9 A\n   4     2 5 6 9 A\n   4     3 4 6 9 A\n   4     2 4 6 9 A\n   4     2 3 6 9 A\n   4     3 4 5 9 A\n   4     2 4 5 9 A\n   4     2 3 5 9 A\n   4     2 3 4 9 A\n   4     5 6 7 8 A\n   4     4 6 7 8 A\n   4     3 6 7 8 A\n   4     2 6 7 8 A\n   4     4 5 7 8 A\n   4     3 5 7 8 A\n   4     2 5 7 8 A\n   4     3 4 7 8 A\n   4     2 4 7 8 A\n   4     2 3 7 8 A\n   4     4 5 6 8 A\n   4     3 5 6 8 A\n   4     2 5 6 8 A\n   4     3 4 6 8 A\n   4     2 4 6 8 A\n   4     2 3 6 8 A\n   4     3 4 5 8 A\n   4     2 4 5 8 A\n   4     2 3 5 8 A\n   4     2 3 4 8 A\n   4     4 5 6 7 A\n   4     3 5 6 7 A\n   4     2 5 6 7 A\n   4     3 4 6 7 A\n   4     2 4 6 7 A\n   4     2 3 6 7 A\n   4     3 4 5 7 A\n   4     2 4 5 7 A\n   4     2 3 5 7 A\n   4     2 3 4 7 A\n   4     3 4 5 6 A\n   4     2 4 5 6 A\n   4     2 3 5 6 A\n   4     2 3 4 6 A\n   4     8 T J Q K      King High Flush\n   4     7 T J Q K\n   4     6 T J Q K\n   4     5 T J Q K\n   4     4 T J Q K\n   4     3 T J Q K\n   4     2 T J Q K\n   4     8 9 J Q K\n   4     7 9 J Q K\n   4     6 9 J Q K\n   4     5 9 J Q K\n   4     4 9 J Q K\n   4     3 9 J Q K\n   4     2 9 J Q K\n   4     7 8 J Q K\n   4     6 8 J Q K\n   4     5 8 J Q K\n   4     4 8 J Q K\n   4     3 8 J Q K\n   4     2 8 J Q K\n   4     6 7 J Q K\n   4     5 7 J Q K\n   4     4 7 J Q K\n   4     3 7 J Q K\n   4     2 7 J Q K\n   4     5 6 J Q K\n   4     4 6 J Q K\n   4     3 6 J Q K\n   4     2 6 J Q K\n   4     4 5 J Q K\n   4     3 5 J Q K\n   4     2 5 J Q K\n   4     3 4 J Q K\n   4     2 4 J Q K\n   4     2 3 J Q K\n   4     8 9 T Q K\n   4     7 9 T Q K\n   4     6 9 T Q K\n   4     5 9 T Q K\n   4     4 9 T Q K\n   4     3 9 T Q K\n   4     2 9 T Q K\n   4     7 8 T Q K\n   4     6 8 T Q K\n   4     5 8 T Q K\n   4     4 8 T Q K\n   4     3 8 T Q K\n   4     2 8 T Q K\n   4     6 7 T Q K\n   4     5 7 T Q K\n   4     4 7 T Q K\n   4     3 7 T Q K\n   4     2 7 T Q K\n   4     5 6 T Q K\n   4     4 6 T Q K\n   4     3 6 T Q K\n   4     2 6 T Q K\n   4     4 5 T Q K\n   4     3 5 T Q K\n   4     2 5 T Q K\n   4     3 4 T Q K\n   4     2 4 T Q K\n   4     2 3 T Q K\n   4     7 8 9 Q K\n   4     6 8 9 Q K\n   4     5 8 9 Q K\n   4     4 8 9 Q K\n   4     3 8 9 Q K\n   4     2 8 9 Q K\n   4     6 7 9 Q K\n   4     5 7 9 Q K\n   4     4 7 9 Q K\n   4     3 7 9 Q K\n   4     2 7 9 Q K\n   4     5 6 9 Q K\n   4     4 6 9 Q K\n   4     3 6 9 Q K\n   4     2 6 9 Q K\n   4     4 5 9 Q K\n   4     3 5 9 Q K\n   4     2 5 9 Q K\n   4     3 4 9 Q K\n   4     2 4 9 Q K\n   4     2 3 9 Q K\n   4     6 7 8 Q K\n   4     5 7 8 Q K\n   4     4 7 8 Q K\n   4     3 7 8 Q K\n   4     2 7 8 Q K\n   4     5 6 8 Q K\n   4     4 6 8 Q K\n   4     3 6 8 Q K\n   4     2 6 8 Q K\n   4     4 5 8 Q K\n   4     3 5 8 Q K\n   4     2 5 8 Q K\n   4     3 4 8 Q K\n   4     2 4 8 Q K\n   4     2 3 8 Q K\n   4     5 6 7 Q K\n   4     4 6 7 Q K\n   4     3 6 7 Q K\n   4     2 6 7 Q K\n   4     4 5 7 Q K\n   4     3 5 7 Q K\n   4     2 5 7 Q K\n   4     3 4 7 Q K\n   4     2 4 7 Q K\n   4     2 3 7 Q K\n   4     4 5 6 Q K\n   4     3 5 6 Q K\n   4     2 5 6 Q K\n   4     3 4 6 Q K\n   4     2 4 6 Q K\n   4     2 3 6 Q K\n   4     3 4 5 Q K\n   4     2 4 5 Q K\n   4     2 3 5 Q K\n   4     2 3 4 Q K\n   4     8 9 T J K\n   4     7 9 T J K\n   4     6 9 T J K\n   4     5 9 T J K\n   4     4 9 T J K\n   4     3 9 T J K\n   4     2 9 T J K\n   4     7 8 T J K\n   4     6 8 T J K\n   4     5 8 T J K\n   4     4 8 T J K\n   4     3 8 T J K\n   4     2 8 T J K\n   4     6 7 T J K\n   4     5 7 T J K\n   4     4 7 T J K\n   4     3 7 T J K\n   4     2 7 T J K\n   4     5 6 T J K\n   4     4 6 T J K\n   4     3 6 T J K\n   4     2 6 T J K\n   4     4 5 T J K\n   4     3 5 T J K\n   4     2 5 T J K\n   4     3 4 T J K\n   4     2 4 T J K\n   4     2 3 T J K\n   4     7 8 9 J K\n   4     6 8 9 J K\n   4     5 8 9 J K\n   4     4 8 9 J K\n   4     3 8 9 J K\n   4     2 8 9 J K\n   4     6 7 9 J K\n   4     5 7 9 J K\n   4     4 7 9 J K\n   4     3 7 9 J K\n   4     2 7 9 J K\n   4     5 6 9 J K\n   4     4 6 9 J K\n   4     3 6 9 J K\n   4     2 6 9 J K\n   4     4 5 9 J K\n   4     3 5 9 J K\n   4     2 5 9 J K\n   4     3 4 9 J K\n   4     2 4 9 J K\n   4     2 3 9 J K\n   4     6 7 8 J K\n   4     5 7 8 J K\n   4     4 7 8 J K\n   4     3 7 8 J K\n   4     2 7 8 J K\n   4     5 6 8 J K\n   4     4 6 8 J K\n   4     3 6 8 J K\n   4     2 6 8 J K\n   4     4 5 8 J K\n   4     3 5 8 J K\n   4     2 5 8 J K\n   4     3 4 8 J K\n   4     2 4 8 J K\n   4     2 3 8 J K\n   4     5 6 7 J K\n   4     4 6 7 J K\n   4     3 6 7 J K\n   4     2 6 7 J K\n   4     4 5 7 J K\n   4     3 5 7 J K\n   4     2 5 7 J K\n   4     3 4 7 J K\n   4     2 4 7 J K\n   4     2 3 7 J K\n   4     4 5 6 J K\n   4     3 5 6 J K\n   4     2 5 6 J K\n   4     3 4 6 J K\n   4     2 4 6 J K\n   4     2 3 6 J K\n   4     3 4 5 J K\n   4     2 4 5 J K\n   4     2 3 5 J K\n   4     2 3 4 J K\n   4     7 8 9 T K\n   4     6 8 9 T K\n   4     5 8 9 T K\n   4     4 8 9 T K\n   4     3 8 9 T K\n   4     2 8 9 T K\n   4     6 7 9 T K\n   4     5 7 9 T K\n   4     4 7 9 T K\n   4     3 7 9 T K\n   4     2 7 9 T K\n   4     5 6 9 T K\n   4     4 6 9 T K\n   4     3 6 9 T K\n   4     2 6 9 T K\n   4     4 5 9 T K\n   4     3 5 9 T K\n   4     2 5 9 T K\n   4     3 4 9 T K\n   4     2 4 9 T K\n   4     2 3 9 T K\n   4     6 7 8 T K\n   4     5 7 8 T K\n   4     4 7 8 T K\n   4     3 7 8 T K\n   4     2 7 8 T K\n   4     5 6 8 T K\n   4     4 6 8 T K\n   4     3 6 8 T K\n   4     2 6 8 T K\n   4     4 5 8 T K\n   4     3 5 8 T K\n   4     2 5 8 T K\n   4     3 4 8 T K\n   4     2 4 8 T K\n   4     2 3 8 T K\n   4     5 6 7 T K\n   4     4 6 7 T K\n   4     3 6 7 T K\n   4     2 6 7 T K\n   4     4 5 7 T K\n   4     3 5 7 T K\n   4     2 5 7 T K\n   4     3 4 7 T K\n   4     2 4 7 T K\n   4     2 3 7 T K\n   4     4 5 6 T K\n   4     3 5 6 T K\n   4     2 5 6 T K\n   4     3 4 6 T K\n   4     2 4 6 T K\n   4     2 3 6 T K\n   4     3 4 5 T K\n   4     2 4 5 T K\n   4     2 3 5 T K\n   4     2 3 4 T K\n   4     6 7 8 9 K\n   4     5 7 8 9 K\n   4     4 7 8 9 K\n   4     3 7 8 9 K\n   4     2 7 8 9 K\n   4     5 6 8 9 K\n   4     4 6 8 9 K\n   4     3 6 8 9 K\n   4     2 6 8 9 K\n   4     4 5 8 9 K\n   4     3 5 8 9 K\n   4     2 5 8 9 K\n   4     3 4 8 9 K\n   4     2 4 8 9 K\n   4     2 3 8 9 K\n   4     5 6 7 9 K\n   4     4 6 7 9 K\n   4     3 6 7 9 K\n   4     2 6 7 9 K\n   4     4 5 7 9 K\n   4     3 5 7 9 K\n   4     2 5 7 9 K\n   4     3 4 7 9 K\n   4     2 4 7 9 K\n   4     2 3 7 9 K\n   4     4 5 6 9 K\n   4     3 5 6 9 K\n   4     2 5 6 9 K\n   4     3 4 6 9 K\n   4     2 4 6 9 K\n   4     2 3 6 9 K\n   4     3 4 5 9 K\n   4     2 4 5 9 K\n   4     2 3 5 9 K\n   4     2 3 4 9 K\n   4     5 6 7 8 K\n   4     4 6 7 8 K\n   4     3 6 7 8 K\n   4     2 6 7 8 K\n   4     4 5 7 8 K\n   4     3 5 7 8 K\n   4     2 5 7 8 K\n   4     3 4 7 8 K\n   4     2 4 7 8 K\n   4     2 3 7 8 K\n   4     4 5 6 8 K\n   4     3 5 6 8 K\n   4     2 5 6 8 K\n   4     3 4 6 8 K\n   4     2 4 6 8 K\n   4     2 3 6 8 K\n   4     3 4 5 8 K\n   4     2 4 5 8 K\n   4     2 3 5 8 K\n   4     2 3 4 8 K\n   4     4 5 6 7 K\n   4     3 5 6 7 K\n   4     2 5 6 7 K\n   4     3 4 6 7 K\n   4     2 4 6 7 K\n   4     2 3 6 7 K\n   4     3 4 5 7 K\n   4     2 4 5 7 K\n   4     2 3 5 7 K\n   4     2 3 4 7 K\n   4     3 4 5 6 K\n   4     2 4 5 6 K\n   4     2 3 5 6 K\n   4     2 3 4 6 K\n   4     2 3 4 5 K\n   4     7 9 T J Q      Queen High Flush\n   4     6 9 T J Q\n   4     5 9 T J Q\n   4     4 9 T J Q\n   4     3 9 T J Q\n   4     2 9 T J Q\n   4     7 8 T J Q\n   4     6 8 T J Q\n   4     5 8 T J Q\n   4     4 8 T J Q\n   4     3 8 T J Q\n   4     2 8 T J Q\n   4     6 7 T J Q\n   4     5 7 T J Q\n   4     4 7 T J Q\n   4     3 7 T J Q\n   4     2 7 T J Q\n   4     5 6 T J Q\n   4     4 6 T J Q\n   4     3 6 T J Q\n   4     2 6 T J Q\n   4     4 5 T J Q\n   4     3 5 T J Q\n   4     2 5 T J Q\n   4     3 4 T J Q\n   4     2 4 T J Q\n   4     2 3 T J Q\n   4     7 8 9 J Q\n   4     6 8 9 J Q\n   4     5 8 9 J Q\n   4     4 8 9 J Q\n   4     3 8 9 J Q\n   4     2 8 9 J Q\n   4     6 7 9 J Q\n   4     5 7 9 J Q\n   4     4 7 9 J Q\n   4     3 7 9 J Q\n   4     2 7 9 J Q\n   4     5 6 9 J Q\n   4     4 6 9 J Q\n   4     3 6 9 J Q\n   4     2 6 9 J Q\n   4     4 5 9 J Q\n   4     3 5 9 J Q\n   4     2 5 9 J Q\n   4     3 4 9 J Q\n   4     2 4 9 J Q\n   4     2 3 9 J Q\n   4     6 7 8 J Q\n   4     5 7 8 J Q\n   4     4 7 8 J Q\n   4     3 7 8 J Q\n   4     2 7 8 J Q\n   4     5 6 8 J Q\n   4     4 6 8 J Q\n   4     3 6 8 J Q\n   4     2 6 8 J Q\n   4     4 5 8 J Q\n   4     3 5 8 J Q\n   4     2 5 8 J Q\n   4     3 4 8 J Q\n   4     2 4 8 J Q\n   4     2 3 8 J Q\n   4     5 6 7 J Q\n   4     4 6 7 J Q\n   4     3 6 7 J Q\n   4     2 6 7 J Q\n   4     4 5 7 J Q\n   4     3 5 7 J Q\n   4     2 5 7 J Q\n   4     3 4 7 J Q\n   4     2 4 7 J Q\n   4     2 3 7 J Q\n   4     4 5 6 J Q\n   4     3 5 6 J Q\n   4     2 5 6 J Q\n   4     3 4 6 J Q\n   4     2 4 6 J Q\n   4     2 3 6 J Q\n   4     3 4 5 J Q\n   4     2 4 5 J Q\n   4     2 3 5 J Q\n   4     2 3 4 J Q\n   4     7 8 9 T Q\n   4     6 8 9 T Q\n   4     5 8 9 T Q\n   4     4 8 9 T Q\n   4     3 8 9 T Q\n   4     2 8 9 T Q\n   4     6 7 9 T Q\n   4     5 7 9 T Q\n   4     4 7 9 T Q\n   4     3 7 9 T Q\n   4     2 7 9 T Q\n   4     5 6 9 T Q\n   4     4 6 9 T Q\n   4     3 6 9 T Q\n   4     2 6 9 T Q\n   4     4 5 9 T Q\n   4     3 5 9 T Q\n   4     2 5 9 T Q\n   4     3 4 9 T Q\n   4     2 4 9 T Q\n   4     2 3 9 T Q\n   4     6 7 8 T Q\n   4     5 7 8 T Q\n   4     4 7 8 T Q\n   4     3 7 8 T Q\n   4     2 7 8 T Q\n   4     5 6 8 T Q\n   4     4 6 8 T Q\n   4     3 6 8 T Q\n   4     2 6 8 T Q\n   4     4 5 8 T Q\n   4     3 5 8 T Q\n   4     2 5 8 T Q\n   4     3 4 8 T Q\n   4     2 4 8 T Q\n   4     2 3 8 T Q\n   4     5 6 7 T Q\n   4     4 6 7 T Q\n   4     3 6 7 T Q\n   4     2 6 7 T Q\n   4     4 5 7 T Q\n   4     3 5 7 T Q\n   4     2 5 7 T Q\n   4     3 4 7 T Q\n   4     2 4 7 T Q\n   4     2 3 7 T Q\n   4     4 5 6 T Q\n   4     3 5 6 T Q\n   4     2 5 6 T Q\n   4     3 4 6 T Q\n   4     2 4 6 T Q\n   4     2 3 6 T Q\n   4     3 4 5 T Q\n   4     2 4 5 T Q\n   4     2 3 5 T Q\n   4     2 3 4 T Q\n   4     6 7 8 9 Q\n   4     5 7 8 9 Q\n   4     4 7 8 9 Q\n   4     3 7 8 9 Q\n   4     2 7 8 9 Q\n   4     5 6 8 9 Q\n   4     4 6 8 9 Q\n   4     3 6 8 9 Q\n   4     2 6 8 9 Q\n   4     4 5 8 9 Q\n   4     3 5 8 9 Q\n   4     2 5 8 9 Q\n   4     3 4 8 9 Q\n   4     2 4 8 9 Q\n   4     2 3 8 9 Q\n   4     5 6 7 9 Q\n   4     4 6 7 9 Q\n   4     3 6 7 9 Q\n   4     2 6 7 9 Q\n   4     4 5 7 9 Q\n   4     3 5 7 9 Q\n   4     2 5 7 9 Q\n   4     3 4 7 9 Q\n   4     2 4 7 9 Q\n   4     2 3 7 9 Q\n   4     4 5 6 9 Q\n   4     3 5 6 9 Q\n   4     2 5 6 9 Q\n   4     3 4 6 9 Q\n   4     2 4 6 9 Q\n   4     2 3 6 9 Q\n   4     3 4 5 9 Q\n   4     2 4 5 9 Q\n   4     2 3 5 9 Q\n   4     2 3 4 9 Q\n   4     5 6 7 8 Q\n   4     4 6 7 8 Q\n   4     3 6 7 8 Q\n   4     2 6 7 8 Q\n   4     4 5 7 8 Q\n   4     3 5 7 8 Q\n   4     2 5 7 8 Q\n   4     3 4 7 8 Q\n   4     2 4 7 8 Q\n   4     2 3 7 8 Q\n   4     4 5 6 8 Q\n   4     3 5 6 8 Q\n   4     2 5 6 8 Q\n   4     3 4 6 8 Q\n   4     2 4 6 8 Q\n   4     2 3 6 8 Q\n   4     3 4 5 8 Q\n   4     2 4 5 8 Q\n   4     2 3 5 8 Q\n   4     2 3 4 8 Q\n   4     4 5 6 7 Q\n   4     3 5 6 7 Q\n   4     2 5 6 7 Q\n   4     3 4 6 7 Q\n   4     2 4 6 7 Q\n   4     2 3 6 7 Q\n   4     3 4 5 7 Q\n   4     2 4 5 7 Q\n   4     2 3 5 7 Q\n   4     2 3 4 7 Q\n   4     3 4 5 6 Q\n   4     2 4 5 6 Q\n   4     2 3 5 6 Q\n   4     2 3 4 6 Q\n   4     2 3 4 5 Q\n   4     6 8 9 T J       Jack High Flush\n   4     5 8 9 T J\n   4     4 8 9 T J\n   4     3 8 9 T J\n   4     2 8 9 T J\n   4     6 7 9 T J\n   4     5 7 9 T J\n   4     4 7 9 T J\n   4     3 7 9 T J\n   4     2 7 9 T J\n   4     5 6 9 T J\n   4     4 6 9 T J\n   4     3 6 9 T J\n   4     2 6 9 T J\n   4     4 5 9 T J\n   4     3 5 9 T J\n   4     2 5 9 T J\n   4     3 4 9 T J\n   4     2 4 9 T J\n   4     2 3 9 T J\n   4     6 7 8 T J\n   4     5 7 8 T J\n   4     4 7 8 T J\n   4     3 7 8 T J\n   4     2 7 8 T J\n   4     5 6 8 T J\n   4     4 6 8 T J\n   4     3 6 8 T J\n   4     2 6 8 T J\n   4     4 5 8 T J\n   4     3 5 8 T J\n   4     2 5 8 T J\n   4     3 4 8 T J\n   4     2 4 8 T J\n   4     2 3 8 T J\n   4     5 6 7 T J\n   4     4 6 7 T J\n   4     3 6 7 T J\n   4     2 6 7 T J\n   4     4 5 7 T J\n   4     3 5 7 T J\n   4     2 5 7 T J\n   4     3 4 7 T J\n   4     2 4 7 T J\n   4     2 3 7 T J\n   4     4 5 6 T J\n   4     3 5 6 T J\n   4     2 5 6 T J\n   4     3 4 6 T J\n   4     2 4 6 T J\n   4     2 3 6 T J\n   4     3 4 5 T J\n   4     2 4 5 T J\n   4     2 3 5 T J\n   4     2 3 4 T J\n   4     6 7 8 9 J\n   4     5 7 8 9 J\n   4     4 7 8 9 J\n   4     3 7 8 9 J\n   4     2 7 8 9 J\n   4     5 6 8 9 J\n   4     4 6 8 9 J\n   4     3 6 8 9 J\n   4     2 6 8 9 J\n   4     4 5 8 9 J\n   4     3 5 8 9 J\n   4     2 5 8 9 J\n   4     3 4 8 9 J\n   4     2 4 8 9 J\n   4     2 3 8 9 J\n   4     5 6 7 9 J\n   4     4 6 7 9 J\n   4     3 6 7 9 J\n   4     2 6 7 9 J\n   4     4 5 7 9 J\n   4     3 5 7 9 J\n   4     2 5 7 9 J\n   4     3 4 7 9 J\n   4     2 4 7 9 J\n   4     2 3 7 9 J\n   4     4 5 6 9 J\n   4     3 5 6 9 J\n   4     2 5 6 9 J\n   4     3 4 6 9 J\n   4     2 4 6 9 J\n   4     2 3 6 9 J\n   4     3 4 5 9 J\n   4     2 4 5 9 J\n   4     2 3 5 9 J\n   4     2 3 4 9 J\n   4     5 6 7 8 J\n   4     4 6 7 8 J\n   4     3 6 7 8 J\n   4     2 6 7 8 J\n   4     4 5 7 8 J\n   4     3 5 7 8 J\n   4     2 5 7 8 J\n   4     3 4 7 8 J\n   4     2 4 7 8 J\n   4     2 3 7 8 J\n   4     4 5 6 8 J\n   4     3 5 6 8 J\n   4     2 5 6 8 J\n   4     3 4 6 8 J\n   4     2 4 6 8 J\n   4     2 3 6 8 J\n   4     3 4 5 8 J\n   4     2 4 5 8 J\n   4     2 3 5 8 J\n   4     2 3 4 8 J\n   4     4 5 6 7 J\n   4     3 5 6 7 J\n   4     2 5 6 7 J\n   4     3 4 6 7 J\n   4     2 4 6 7 J\n   4     2 3 6 7 J\n   4     3 4 5 7 J\n   4     2 4 5 7 J\n   4     2 3 5 7 J\n   4     2 3 4 7 J\n   4     3 4 5 6 J\n   4     2 4 5 6 J\n   4     2 3 5 6 J\n   4     2 3 4 6 J\n   4     2 3 4 5 J\n   4     5 7 8 9 T      Ten High Flush\n   4     4 7 8 9 T\n   4     3 7 8 9 T\n   4     2 7 8 9 T\n   4     5 6 8 9 T\n   4     4 6 8 9 T\n   4     3 6 8 9 T\n   4     2 6 8 9 T\n   4     4 5 8 9 T\n   4     3 5 8 9 T\n   4     2 5 8 9 T\n   4     3 4 8 9 T\n   4     2 4 8 9 T\n   4     2 3 8 9 T\n   4     5 6 7 9 T\n   4     4 6 7 9 T\n   4     3 6 7 9 T\n   4     2 6 7 9 T\n   4     4 5 7 9 T\n   4     3 5 7 9 T\n   4     2 5 7 9 T\n   4     3 4 7 9 T\n   4     2 4 7 9 T\n   4     2 3 7 9 T\n   4     4 5 6 9 T\n   4     3 5 6 9 T\n   4     2 5 6 9 T\n   4     3 4 6 9 T\n   4     2 4 6 9 T\n   4     2 3 6 9 T\n   4     3 4 5 9 T\n   4     2 4 5 9 T\n   4     2 3 5 9 T\n   4     2 3 4 9 T\n   4     5 6 7 8 T\n   4     4 6 7 8 T\n   4     3 6 7 8 T\n   4     2 6 7 8 T\n   4     4 5 7 8 T\n   4     3 5 7 8 T\n   4     2 5 7 8 T\n   4     3 4 7 8 T\n   4     2 4 7 8 T\n   4     2 3 7 8 T\n   4     4 5 6 8 T\n   4     3 5 6 8 T\n   4     2 5 6 8 T\n   4     3 4 6 8 T\n   4     2 4 6 8 T\n   4     2 3 6 8 T\n   4     3 4 5 8 T\n   4     2 4 5 8 T\n   4     2 3 5 8 T\n   4     2 3 4 8 T\n   4     4 5 6 7 T\n   4     3 5 6 7 T\n   4     2 5 6 7 T\n   4     3 4 6 7 T\n   4     2 4 6 7 T\n   4     2 3 6 7 T\n   4     3 4 5 7 T\n   4     2 4 5 7 T\n   4     2 3 5 7 T\n   4     2 3 4 7 T\n   4     3 4 5 6 T\n   4     2 4 5 6 T\n   4     2 3 5 6 T\n   4     2 3 4 6 T\n   4     2 3 4 5 T\n   4     4 6 7 8 9      Nine High Flush\n   4     3 6 7 8 9\n   4     2 6 7 8 9\n   4     4 5 7 8 9\n   4     3 5 7 8 9\n   4     2 5 7 8 9\n   4     3 4 7 8 9\n   4     2 4 7 8 9\n   4     2 3 7 8 9\n   4     4 5 6 8 9\n   4     3 5 6 8 9\n   4     2 5 6 8 9\n   4     3 4 6 8 9\n   4     2 4 6 8 9\n   4     2 3 6 8 9\n   4     3 4 5 8 9\n   4     2 4 5 8 9\n   4     2 3 5 8 9\n   4     2 3 4 8 9\n   4     4 5 6 7 9\n   4     3 5 6 7 9\n   4     2 5 6 7 9\n   4     3 4 6 7 9\n   4     2 4 6 7 9\n   4     2 3 6 7 9\n   4     3 4 5 7 9\n   4     2 4 5 7 9\n   4     2 3 5 7 9\n   4     2 3 4 7 9\n   4     3 4 5 6 9\n   4     2 4 5 6 9\n   4     2 3 5 6 9\n   4     2 3 4 6 9\n   4     2 3 4 5 9\n   4     3 5 6 7 8      Eight High Flush\n   4     2 5 6 7 8\n   4     3 4 6 7 8\n   4     2 4 6 7 8\n   4     2 3 6 7 8\n   4     3 4 5 7 8\n   4     2 4 5 7 8\n   4     2 3 5 7 8\n   4     2 3 4 7 8\n   4     3 4 5 6 8\n   4     2 4 5 6 8\n   4     2 3 5 6 8\n   4     2 3 4 6 8\n   4     2 3 4 5 8\n   4     2 4 5 6 7      Seven High Flush\n   4     2 3 5 6 7\n   4     2 3 4 6 7\n   4     2 3 4 5 7\n1024     T J Q K A      Ace High Straight              STRAIGHT\n1024     9 T J Q K      King High Straight\n1024     8 9 T J Q      Queen High Straight\n1024     7 8 9 T J      Jack High Straight\n1024     6 7 8 9 T      Ten High Straight\n1024     5 6 7 8 9      Nine High Straight\n1024     4 5 6 7 8      Eight High Straight\n1024     3 4 5 6 7      Seven High Straight\n1024     2 3 4 5 6      Six High Straight\n1024     A 2 3 4 5      Five High Straight\n  64     Q K A A A      Three Aces                     THREE OF A KIND\n  64     J K A A A\n  64     T K A A A\n  64     9 K A A A\n  64     8 K A A A\n  64     7 K A A A\n  64     6 K A A A\n  64     5 K A A A\n  64     4 K A A A\n  64     3 K A A A\n  64     2 K A A A\n  64     J Q A A A\n  64     T Q A A A\n  64     9 Q A A A\n  64     8 Q A A A\n  64     7 Q A A A\n  64     6 Q A A A\n  64     5 Q A A A\n  64     4 Q A A A\n  64     3 Q A A A\n  64     2 Q A A A\n  64     T J A A A\n  64     9 J A A A\n  64     8 J A A A\n  64     7 J A A A\n  64     6 J A A A\n  64     5 J A A A\n  64     4 J A A A\n  64     3 J A A A\n  64     2 J A A A\n  64     9 T A A A\n  64     8 T A A A\n  64     7 T A A A\n  64     6 T A A A\n  64     5 T A A A\n  64     4 T A A A\n  64     3 T A A A\n  64     2 T A A A\n  64     8 9 A A A\n  64     7 9 A A A\n  64     6 9 A A A\n  64     5 9 A A A\n  64     4 9 A A A\n  64     3 9 A A A\n  64     2 9 A A A\n  64     7 8 A A A\n  64     6 8 A A A\n  64     5 8 A A A\n  64     4 8 A A A\n  64     3 8 A A A\n  64     2 8 A A A\n  64     6 7 A A A\n  64     5 7 A A A\n  64     4 7 A A A\n  64     3 7 A A A\n  64     2 7 A A A\n  64     5 6 A A A\n  64     4 6 A A A\n  64     3 6 A A A\n  64     2 6 A A A\n  64     4 5 A A A\n  64     3 5 A A A\n  64     2 5 A A A\n  64     3 4 A A A\n  64     2 4 A A A\n  64     2 3 A A A\n  64     Q K K K A      Three Kings\n  64     J K K K A\n  64     T K K K A\n  64     9 K K K A\n  64     8 K K K A\n  64     7 K K K A\n  64     6 K K K A\n  64     5 K K K A\n  64     4 K K K A\n  64     3 K K K A\n  64     2 K K K A\n  64     J Q K K K\n  64     T Q K K K\n  64     9 Q K K K\n  64     8 Q K K K\n  64     7 Q K K K\n  64     6 Q K K K\n  64     5 Q K K K\n  64     4 Q K K K\n  64     3 Q K K K\n  64     2 Q K K K\n  64     T J K K K\n  64     9 J K K K\n  64     8 J K K K\n  64     7 J K K K\n  64     6 J K K K\n  64     5 J K K K\n  64     4 J K K K\n  64     3 J K K K\n  64     2 J K K K\n  64     9 T K K K\n  64     8 T K K K\n  64     7 T K K K\n  64     6 T K K K\n  64     5 T K K K\n  64     4 T K K K\n  64     3 T K K K\n  64     2 T K K K\n  64     8 9 K K K\n  64     7 9 K K K\n  64     6 9 K K K\n  64     5 9 K K K\n  64     4 9 K K K\n  64     3 9 K K K\n  64     2 9 K K K\n  64     7 8 K K K\n  64     6 8 K K K\n  64     5 8 K K K\n  64     4 8 K K K\n  64     3 8 K K K\n  64     2 8 K K K\n  64     6 7 K K K\n  64     5 7 K K K\n  64     4 7 K K K\n  64     3 7 K K K\n  64     2 7 K K K\n  64     5 6 K K K\n  64     4 6 K K K\n  64     3 6 K K K\n  64     2 6 K K K\n  64     4 5 K K K\n  64     3 5 K K K\n  64     2 5 K K K\n  64     3 4 K K K\n  64     2 4 K K K\n  64     2 3 K K K\n  64     Q Q Q K A      Three Queens\n  64     J Q Q Q A\n  64     T Q Q Q A\n  64     9 Q Q Q A\n  64     8 Q Q Q A\n  64     7 Q Q Q A\n  64     6 Q Q Q A\n  64     5 Q Q Q A\n  64     4 Q Q Q A\n  64     3 Q Q Q A\n  64     2 Q Q Q A\n  64     J Q Q Q K\n  64     T Q Q Q K\n  64     9 Q Q Q K\n  64     8 Q Q Q K\n  64     7 Q Q Q K\n  64     6 Q Q Q K\n  64     5 Q Q Q K\n  64     4 Q Q Q K\n  64     3 Q Q Q K\n  64     2 Q Q Q K\n  64     T J Q Q Q\n  64     9 J Q Q Q\n  64     8 J Q Q Q\n  64     7 J Q Q Q\n  64     6 J Q Q Q\n  64     5 J Q Q Q\n  64     4 J Q Q Q\n  64     3 J Q Q Q\n  64     2 J Q Q Q\n  64     9 T Q Q Q\n  64     8 T Q Q Q\n  64     7 T Q Q Q\n  64     6 T Q Q Q\n  64     5 T Q Q Q\n  64     4 T Q Q Q\n  64     3 T Q Q Q\n  64     2 T Q Q Q\n  64     8 9 Q Q Q\n  64     7 9 Q Q Q\n  64     6 9 Q Q Q\n  64     5 9 Q Q Q\n  64     4 9 Q Q Q\n  64     3 9 Q Q Q\n  64     2 9 Q Q Q\n  64     7 8 Q Q Q\n  64     6 8 Q Q Q\n  64     5 8 Q Q Q\n  64     4 8 Q Q Q\n  64     3 8 Q Q Q\n  64     2 8 Q Q Q\n  64     6 7 Q Q Q\n  64     5 7 Q Q Q\n  64     4 7 Q Q Q\n  64     3 7 Q Q Q\n  64     2 7 Q Q Q\n  64     5 6 Q Q Q\n  64     4 6 Q Q Q\n  64     3 6 Q Q Q\n  64     2 6 Q Q Q\n  64     4 5 Q Q Q\n  64     3 5 Q Q Q\n  64     2 5 Q Q Q\n  64     3 4 Q Q Q\n  64     2 4 Q Q Q\n  64     2 3 Q Q Q\n  64     J J J K A      Three Jacks\n  64     J J J Q A\n  64     T J J J A\n  64     9 J J J A\n  64     8 J J J A\n  64     7 J J J A\n  64     6 J J J A\n  64     5 J J J A\n  64     4 J J J A\n  64     3 J J J A\n  64     2 J J J A\n  64     J J J Q K\n  64     T J J J K\n  64     9 J J J K\n  64     8 J J J K\n  64     7 J J J K\n  64     6 J J J K\n  64     5 J J J K\n  64     4 J J J K\n  64     3 J J J K\n  64     2 J J J K\n  64     T J J J Q\n  64     9 J J J Q\n  64     8 J J J Q\n  64     7 J J J Q\n  64     6 J J J Q\n  64     5 J J J Q\n  64     4 J J J Q\n  64     3 J J J Q\n  64     2 J J J Q\n  64     9 T J J J\n  64     8 T J J J\n  64     7 T J J J\n  64     6 T J J J\n  64     5 T J J J\n  64     4 T J J J\n  64     3 T J J J\n  64     2 T J J J\n  64     8 9 J J J\n  64     7 9 J J J\n  64     6 9 J J J\n  64     5 9 J J J\n  64     4 9 J J J\n  64     3 9 J J J\n  64     2 9 J J J\n  64     7 8 J J J\n  64     6 8 J J J\n  64     5 8 J J J\n  64     4 8 J J J\n  64     3 8 J J J\n  64     2 8 J J J\n  64     6 7 J J J\n  64     5 7 J J J\n  64     4 7 J J J\n  64     3 7 J J J\n  64     2 7 J J J\n  64     5 6 J J J\n  64     4 6 J J J\n  64     3 6 J J J\n  64     2 6 J J J\n  64     4 5 J J J\n  64     3 5 J J J\n  64     2 5 J J J\n  64     3 4 J J J\n  64     2 4 J J J\n  64     2 3 J J J\n  64     T T T K A      Three Tens\n  64     T T T Q A\n  64     T T T J A\n  64     9 T T T A\n  64     8 T T T A\n  64     7 T T T A\n  64     6 T T T A\n  64     5 T T T A\n  64     4 T T T A\n  64     3 T T T A\n  64     2 T T T A\n  64     T T T Q K\n  64     T T T J K\n  64     9 T T T K\n  64     8 T T T K\n  64     7 T T T K\n  64     6 T T T K\n  64     5 T T T K\n  64     4 T T T K\n  64     3 T T T K\n  64     2 T T T K\n  64     T T T J Q\n  64     9 T T T Q\n  64     8 T T T Q\n  64     7 T T T Q\n  64     6 T T T Q\n  64     5 T T T Q\n  64     4 T T T Q\n  64     3 T T T Q\n  64     2 T T T Q\n  64     9 T T T J\n  64     8 T T T J\n  64     7 T T T J\n  64     6 T T T J\n  64     5 T T T J\n  64     4 T T T J\n  64     3 T T T J\n  64     2 T T T J\n  64     8 9 T T T\n  64     7 9 T T T\n  64     6 9 T T T\n  64     5 9 T T T\n  64     4 9 T T T\n  64     3 9 T T T\n  64     2 9 T T T\n  64     7 8 T T T\n  64     6 8 T T T\n  64     5 8 T T T\n  64     4 8 T T T\n  64     3 8 T T T\n  64     2 8 T T T\n  64     6 7 T T T\n  64     5 7 T T T\n  64     4 7 T T T\n  64     3 7 T T T\n  64     2 7 T T T\n  64     5 6 T T T\n  64     4 6 T T T\n  64     3 6 T T T\n  64     2 6 T T T\n  64     4 5 T T T\n  64     3 5 T T T\n  64     2 5 T T T\n  64     3 4 T T T\n  64     2 4 T T T\n  64     2 3 T T T\n  64     9 9 9 K A      Three Nines\n  64     9 9 9 Q A\n  64     9 9 9 J A\n  64     9 9 9 T A\n  64     8 9 9 9 A\n  64     7 9 9 9 A\n  64     6 9 9 9 A\n  64     5 9 9 9 A\n  64     4 9 9 9 A\n  64     3 9 9 9 A\n  64     2 9 9 9 A\n  64     9 9 9 Q K\n  64     9 9 9 J K\n  64     9 9 9 T K\n  64     8 9 9 9 K\n  64     7 9 9 9 K\n  64     6 9 9 9 K\n  64     5 9 9 9 K\n  64     4 9 9 9 K\n  64     3 9 9 9 K\n  64     2 9 9 9 K\n  64     9 9 9 J Q\n  64     9 9 9 T Q\n  64     8 9 9 9 Q\n  64     7 9 9 9 Q\n  64     6 9 9 9 Q\n  64     5 9 9 9 Q\n  64     4 9 9 9 Q\n  64     3 9 9 9 Q\n  64     2 9 9 9 Q\n  64     9 9 9 T J\n  64     8 9 9 9 J\n  64     7 9 9 9 J\n  64     6 9 9 9 J\n  64     5 9 9 9 J\n  64     4 9 9 9 J\n  64     3 9 9 9 J\n  64     2 9 9 9 J\n  64     8 9 9 9 T\n  64     7 9 9 9 T\n  64     6 9 9 9 T\n  64     5 9 9 9 T\n  64     4 9 9 9 T\n  64     3 9 9 9 T\n  64     2 9 9 9 T\n  64     7 8 9 9 9\n  64     6 8 9 9 9\n  64     5 8 9 9 9\n  64     4 8 9 9 9\n  64     3 8 9 9 9\n  64     2 8 9 9 9\n  64     6 7 9 9 9\n  64     5 7 9 9 9\n  64     4 7 9 9 9\n  64     3 7 9 9 9\n  64     2 7 9 9 9\n  64     5 6 9 9 9\n  64     4 6 9 9 9\n  64     3 6 9 9 9\n  64     2 6 9 9 9\n  64     4 5 9 9 9\n  64     3 5 9 9 9\n  64     2 5 9 9 9\n  64     3 4 9 9 9\n  64     2 4 9 9 9\n  64     2 3 9 9 9\n  64     8 8 8 K A      Three Eights\n  64     8 8 8 Q A\n  64     8 8 8 J A\n  64     8 8 8 T A\n  64     8 8 8 9 A\n  64     7 8 8 8 A\n  64     6 8 8 8 A\n  64     5 8 8 8 A\n  64     4 8 8 8 A\n  64     3 8 8 8 A\n  64     2 8 8 8 A\n  64     8 8 8 Q K\n  64     8 8 8 J K\n  64     8 8 8 T K\n  64     8 8 8 9 K\n  64     7 8 8 8 K\n  64     6 8 8 8 K\n  64     5 8 8 8 K\n  64     4 8 8 8 K\n  64     3 8 8 8 K\n  64     2 8 8 8 K\n  64     8 8 8 J Q\n  64     8 8 8 T Q\n  64     8 8 8 9 Q\n  64     7 8 8 8 Q\n  64     6 8 8 8 Q\n  64     5 8 8 8 Q\n  64     4 8 8 8 Q\n  64     3 8 8 8 Q\n  64     2 8 8 8 Q\n  64     8 8 8 T J\n  64     8 8 8 9 J\n  64     7 8 8 8 J\n  64     6 8 8 8 J\n  64     5 8 8 8 J\n  64     4 8 8 8 J\n  64     3 8 8 8 J\n  64     2 8 8 8 J\n  64     8 8 8 9 T\n  64     7 8 8 8 T\n  64     6 8 8 8 T\n  64     5 8 8 8 T\n  64     4 8 8 8 T\n  64     3 8 8 8 T\n  64     2 8 8 8 T\n  64     7 8 8 8 9\n  64     6 8 8 8 9\n  64     5 8 8 8 9\n  64     4 8 8 8 9\n  64     3 8 8 8 9\n  64     2 8 8 8 9\n  64     6 7 8 8 8\n  64     5 7 8 8 8\n  64     4 7 8 8 8\n  64     3 7 8 8 8\n  64     2 7 8 8 8\n  64     5 6 8 8 8\n  64     4 6 8 8 8\n  64     3 6 8 8 8\n  64     2 6 8 8 8\n  64     4 5 8 8 8\n  64     3 5 8 8 8\n  64     2 5 8 8 8\n  64     3 4 8 8 8\n  64     2 4 8 8 8\n  64     2 3 8 8 8\n  64     7 7 7 K A      Three Sevens\n  64     7 7 7 Q A\n  64     7 7 7 J A\n  64     7 7 7 T A\n  64     7 7 7 9 A\n  64     7 7 7 8 A\n  64     6 7 7 7 A\n  64     5 7 7 7 A\n  64     4 7 7 7 A\n  64     3 7 7 7 A\n  64     2 7 7 7 A\n  64     7 7 7 Q K\n  64     7 7 7 J K\n  64     7 7 7 T K\n  64     7 7 7 9 K\n  64     7 7 7 8 K\n  64     6 7 7 7 K\n  64     5 7 7 7 K\n  64     4 7 7 7 K\n  64     3 7 7 7 K\n  64     2 7 7 7 K\n  64     7 7 7 J Q\n  64     7 7 7 T Q\n  64     7 7 7 9 Q\n  64     7 7 7 8 Q\n  64     6 7 7 7 Q\n  64     5 7 7 7 Q\n  64     4 7 7 7 Q\n  64     3 7 7 7 Q\n  64     2 7 7 7 Q\n  64     7 7 7 T J\n  64     7 7 7 9 J\n  64     7 7 7 8 J\n  64     6 7 7 7 J\n  64     5 7 7 7 J\n  64     4 7 7 7 J\n  64     3 7 7 7 J\n  64     2 7 7 7 J\n  64     7 7 7 9 T\n  64     7 7 7 8 T\n  64     6 7 7 7 T\n  64     5 7 7 7 T\n  64     4 7 7 7 T\n  64     3 7 7 7 T\n  64     2 7 7 7 T\n  64     7 7 7 8 9\n  64     6 7 7 7 9\n  64     5 7 7 7 9\n  64     4 7 7 7 9\n  64     3 7 7 7 9\n  64     2 7 7 7 9\n  64     6 7 7 7 8\n  64     5 7 7 7 8\n  64     4 7 7 7 8\n  64     3 7 7 7 8\n  64     2 7 7 7 8\n  64     5 6 7 7 7\n  64     4 6 7 7 7\n  64     3 6 7 7 7\n  64     2 6 7 7 7\n  64     4 5 7 7 7\n  64     3 5 7 7 7\n  64     2 5 7 7 7\n  64     3 4 7 7 7\n  64     2 4 7 7 7\n  64     2 3 7 7 7\n  64     6 6 6 K A      Three Sixes\n  64     6 6 6 Q A\n  64     6 6 6 J A\n  64     6 6 6 T A\n  64     6 6 6 9 A\n  64     6 6 6 8 A\n  64     6 6 6 7 A\n  64     5 6 6 6 A\n  64     4 6 6 6 A\n  64     3 6 6 6 A\n  64     2 6 6 6 A\n  64     6 6 6 Q K\n  64     6 6 6 J K\n  64     6 6 6 T K\n  64     6 6 6 9 K\n  64     6 6 6 8 K\n  64     6 6 6 7 K\n  64     5 6 6 6 K\n  64     4 6 6 6 K\n  64     3 6 6 6 K\n  64     2 6 6 6 K\n  64     6 6 6 J Q\n  64     6 6 6 T Q\n  64     6 6 6 9 Q\n  64     6 6 6 8 Q\n  64     6 6 6 7 Q\n  64     5 6 6 6 Q\n  64     4 6 6 6 Q\n  64     3 6 6 6 Q\n  64     2 6 6 6 Q\n  64     6 6 6 T J\n  64     6 6 6 9 J\n  64     6 6 6 8 J\n  64     6 6 6 7 J\n  64     5 6 6 6 J\n  64     4 6 6 6 J\n  64     3 6 6 6 J\n  64     2 6 6 6 J\n  64     6 6 6 9 T\n  64     6 6 6 8 T\n  64     6 6 6 7 T\n  64     5 6 6 6 T\n  64     4 6 6 6 T\n  64     3 6 6 6 T\n  64     2 6 6 6 T\n  64     6 6 6 8 9\n  64     6 6 6 7 9\n  64     5 6 6 6 9\n  64     4 6 6 6 9\n  64     3 6 6 6 9\n  64     2 6 6 6 9\n  64     6 6 6 7 8\n  64     5 6 6 6 8\n  64     4 6 6 6 8\n  64     3 6 6 6 8\n  64     2 6 6 6 8\n  64     5 6 6 6 7\n  64     4 6 6 6 7\n  64     3 6 6 6 7\n  64     2 6 6 6 7\n  64     4 5 6 6 6\n  64     3 5 6 6 6\n  64     2 5 6 6 6\n  64     3 4 6 6 6\n  64     2 4 6 6 6\n  64     2 3 6 6 6\n  64     5 5 5 K A      Three Fives\n  64     5 5 5 Q A\n  64     5 5 5 J A\n  64     5 5 5 T A\n  64     5 5 5 9 A\n  64     5 5 5 8 A\n  64     5 5 5 7 A\n  64     5 5 5 6 A\n  64     4 5 5 5 A\n  64     3 5 5 5 A\n  64     2 5 5 5 A\n  64     5 5 5 Q K\n  64     5 5 5 J K\n  64     5 5 5 T K\n  64     5 5 5 9 K\n  64     5 5 5 8 K\n  64     5 5 5 7 K\n  64     5 5 5 6 K\n  64     4 5 5 5 K\n  64     3 5 5 5 K\n  64     2 5 5 5 K\n  64     5 5 5 J Q\n  64     5 5 5 T Q\n  64     5 5 5 9 Q\n  64     5 5 5 8 Q\n  64     5 5 5 7 Q\n  64     5 5 5 6 Q\n  64     4 5 5 5 Q\n  64     3 5 5 5 Q\n  64     2 5 5 5 Q\n  64     5 5 5 T J\n  64     5 5 5 9 J\n  64     5 5 5 8 J\n  64     5 5 5 7 J\n  64     5 5 5 6 J\n  64     4 5 5 5 J\n  64     3 5 5 5 J\n  64     2 5 5 5 J\n  64     5 5 5 9 T\n  64     5 5 5 8 T\n  64     5 5 5 7 T\n  64     5 5 5 6 T\n  64     4 5 5 5 T\n  64     3 5 5 5 T\n  64     2 5 5 5 T\n  64     5 5 5 8 9\n  64     5 5 5 7 9\n  64     5 5 5 6 9\n  64     4 5 5 5 9\n  64     3 5 5 5 9\n  64     2 5 5 5 9\n  64     5 5 5 7 8\n  64     5 5 5 6 8\n  64     4 5 5 5 8\n  64     3 5 5 5 8\n  64     2 5 5 5 8\n  64     5 5 5 6 7\n  64     4 5 5 5 7\n  64     3 5 5 5 7\n  64     2 5 5 5 7\n  64     4 5 5 5 6\n  64     3 5 5 5 6\n  64     2 5 5 5 6\n  64     3 4 5 5 5\n  64     2 4 5 5 5\n  64     2 3 5 5 5\n  64     4 4 4 K A      Three Fours\n  64     4 4 4 Q A\n  64     4 4 4 J A\n  64     4 4 4 T A\n  64     4 4 4 9 A\n  64     4 4 4 8 A\n  64     4 4 4 7 A\n  64     4 4 4 6 A\n  64     4 4 4 5 A\n  64     3 4 4 4 A\n  64     2 4 4 4 A\n  64     4 4 4 Q K\n  64     4 4 4 J K\n  64     4 4 4 T K\n  64     4 4 4 9 K\n  64     4 4 4 8 K\n  64     4 4 4 7 K\n  64     4 4 4 6 K\n  64     4 4 4 5 K\n  64     3 4 4 4 K\n  64     2 4 4 4 K\n  64     4 4 4 J Q\n  64     4 4 4 T Q\n  64     4 4 4 9 Q\n  64     4 4 4 8 Q\n  64     4 4 4 7 Q\n  64     4 4 4 6 Q\n  64     4 4 4 5 Q\n  64     3 4 4 4 Q\n  64     2 4 4 4 Q\n  64     4 4 4 T J\n  64     4 4 4 9 J\n  64     4 4 4 8 J\n  64     4 4 4 7 J\n  64     4 4 4 6 J\n  64     4 4 4 5 J\n  64     3 4 4 4 J\n  64     2 4 4 4 J\n  64     4 4 4 9 T\n  64     4 4 4 8 T\n  64     4 4 4 7 T\n  64     4 4 4 6 T\n  64     4 4 4 5 T\n  64     3 4 4 4 T\n  64     2 4 4 4 T\n  64     4 4 4 8 9\n  64     4 4 4 7 9\n  64     4 4 4 6 9\n  64     4 4 4 5 9\n  64     3 4 4 4 9\n  64     2 4 4 4 9\n  64     4 4 4 7 8\n  64     4 4 4 6 8\n  64     4 4 4 5 8\n  64     3 4 4 4 8\n  64     2 4 4 4 8\n  64     4 4 4 6 7\n  64     4 4 4 5 7\n  64     3 4 4 4 7\n  64     2 4 4 4 7\n  64     4 4 4 5 6\n  64     3 4 4 4 6\n  64     2 4 4 4 6\n  64     3 4 4 4 5\n  64     2 4 4 4 5\n  64     2 3 4 4 4\n  64     3 3 3 K A      Three Treys\n  64     3 3 3 Q A\n  64     3 3 3 J A\n  64     3 3 3 T A\n  64     3 3 3 9 A\n  64     3 3 3 8 A\n  64     3 3 3 7 A\n  64     3 3 3 6 A\n  64     3 3 3 5 A\n  64     3 3 3 4 A\n  64     2 3 3 3 A\n  64     3 3 3 Q K\n  64     3 3 3 J K\n  64     3 3 3 T K\n  64     3 3 3 9 K\n  64     3 3 3 8 K\n  64     3 3 3 7 K\n  64     3 3 3 6 K\n  64     3 3 3 5 K\n  64     3 3 3 4 K\n  64     2 3 3 3 K\n  64     3 3 3 J Q\n  64     3 3 3 T Q\n  64     3 3 3 9 Q\n  64     3 3 3 8 Q\n  64     3 3 3 7 Q\n  64     3 3 3 6 Q\n  64     3 3 3 5 Q\n  64     3 3 3 4 Q\n  64     2 3 3 3 Q\n  64     3 3 3 T J\n  64     3 3 3 9 J\n  64     3 3 3 8 J\n  64     3 3 3 7 J\n  64     3 3 3 6 J\n  64     3 3 3 5 J\n  64     3 3 3 4 J\n  64     2 3 3 3 J\n  64     3 3 3 9 T\n  64     3 3 3 8 T\n  64     3 3 3 7 T\n  64     3 3 3 6 T\n  64     3 3 3 5 T\n  64     3 3 3 4 T\n  64     2 3 3 3 T\n  64     3 3 3 8 9\n  64     3 3 3 7 9\n  64     3 3 3 6 9\n  64     3 3 3 5 9\n  64     3 3 3 4 9\n  64     2 3 3 3 9\n  64     3 3 3 7 8\n  64     3 3 3 6 8\n  64     3 3 3 5 8\n  64     3 3 3 4 8\n  64     2 3 3 3 8\n  64     3 3 3 6 7\n  64     3 3 3 5 7\n  64     3 3 3 4 7\n  64     2 3 3 3 7\n  64     3 3 3 5 6\n  64     3 3 3 4 6\n  64     2 3 3 3 6\n  64     3 3 3 4 5\n  64     2 3 3 3 5\n  64     2 3 3 3 4\n  64     2 2 2 K A      Three Deuces\n  64     2 2 2 Q A\n  64     2 2 2 J A\n  64     2 2 2 T A\n  64     2 2 2 9 A\n  64     2 2 2 8 A\n  64     2 2 2 7 A\n  64     2 2 2 6 A\n  64     2 2 2 5 A\n  64     2 2 2 4 A\n  64     2 2 2 3 A\n  64     2 2 2 Q K\n  64     2 2 2 J K\n  64     2 2 2 T K\n  64     2 2 2 9 K\n  64     2 2 2 8 K\n  64     2 2 2 7 K\n  64     2 2 2 6 K\n  64     2 2 2 5 K\n  64     2 2 2 4 K\n  64     2 2 2 3 K\n  64     2 2 2 J Q\n  64     2 2 2 T Q\n  64     2 2 2 9 Q\n  64     2 2 2 8 Q\n  64     2 2 2 7 Q\n  64     2 2 2 6 Q\n  64     2 2 2 5 Q\n  64     2 2 2 4 Q\n  64     2 2 2 3 Q\n  64     2 2 2 T J\n  64     2 2 2 9 J\n  64     2 2 2 8 J\n  64     2 2 2 7 J\n  64     2 2 2 6 J\n  64     2 2 2 5 J\n  64     2 2 2 4 J\n  64     2 2 2 3 J\n  64     2 2 2 9 T\n  64     2 2 2 8 T\n  64     2 2 2 7 T\n  64     2 2 2 6 T\n  64     2 2 2 5 T\n  64     2 2 2 4 T\n  64     2 2 2 3 T\n  64     2 2 2 8 9\n  64     2 2 2 7 9\n  64     2 2 2 6 9\n  64     2 2 2 5 9\n  64     2 2 2 4 9\n  64     2 2 2 3 9\n  64     2 2 2 7 8\n  64     2 2 2 6 8\n  64     2 2 2 5 8\n  64     2 2 2 4 8\n  64     2 2 2 3 8\n  64     2 2 2 6 7\n  64     2 2 2 5 7\n  64     2 2 2 4 7\n  64     2 2 2 3 7\n  64     2 2 2 5 6\n  64     2 2 2 4 6\n  64     2 2 2 3 6\n  64     2 2 2 4 5\n  64     2 2 2 3 5\n  64     2 2 2 3 4\n 144     Q K K A A      Aces over Kings                TWO PAIR\n 144     J K K A A\n 144     T K K A A\n 144     9 K K A A\n 144     8 K K A A\n 144     7 K K A A\n 144     6 K K A A\n 144     5 K K A A\n 144     4 K K A A\n 144     3 K K A A\n 144     2 K K A A\n 144     Q Q K A A      Aces over Queens\n 144     J Q Q A A\n 144     T Q Q A A\n 144     9 Q Q A A\n 144     8 Q Q A A\n 144     7 Q Q A A\n 144     6 Q Q A A\n 144     5 Q Q A A\n 144     4 Q Q A A\n 144     3 Q Q A A\n 144     2 Q Q A A\n 144     J J K A A      Aces over Jacks\n 144     J J Q A A\n 144     T J J A A\n 144     9 J J A A\n 144     8 J J A A\n 144     7 J J A A\n 144     6 J J A A\n 144     5 J J A A\n 144     4 J J A A\n 144     3 J J A A\n 144     2 J J A A\n 144     T T K A A      Aces over Tens\n 144     T T Q A A\n 144     T T J A A\n 144     9 T T A A\n 144     8 T T A A\n 144     7 T T A A\n 144     6 T T A A\n 144     5 T T A A\n 144     4 T T A A\n 144     3 T T A A\n 144     2 T T A A\n 144     9 9 K A A      Aces over Nines\n 144     9 9 Q A A\n 144     9 9 J A A\n 144     9 9 T A A\n 144     8 9 9 A A\n 144     7 9 9 A A\n 144     6 9 9 A A\n 144     5 9 9 A A\n 144     4 9 9 A A\n 144     3 9 9 A A\n 144     2 9 9 A A\n 144     8 8 K A A      Aces over Eights\n 144     8 8 Q A A\n 144     8 8 J A A\n 144     8 8 T A A\n 144     8 8 9 A A\n 144     7 8 8 A A\n 144     6 8 8 A A\n 144     5 8 8 A A\n 144     4 8 8 A A\n 144     3 8 8 A A\n 144     2 8 8 A A\n 144     7 7 K A A      Aces over Sevens\n 144     7 7 Q A A\n 144     7 7 J A A\n 144     7 7 T A A\n 144     7 7 9 A A\n 144     7 7 8 A A\n 144     6 7 7 A A\n 144     5 7 7 A A\n 144     4 7 7 A A\n 144     3 7 7 A A\n 144     2 7 7 A A\n 144     6 6 K A A      Aces over Sixes\n 144     6 6 Q A A\n 144     6 6 J A A\n 144     6 6 T A A\n 144     6 6 9 A A\n 144     6 6 8 A A\n 144     6 6 7 A A\n 144     5 6 6 A A\n 144     4 6 6 A A\n 144     3 6 6 A A\n 144     2 6 6 A A\n 144     5 5 K A A      Aces over Fives\n 144     5 5 Q A A\n 144     5 5 J A A\n 144     5 5 T A A\n 144     5 5 9 A A\n 144     5 5 8 A A\n 144     5 5 7 A A\n 144     5 5 6 A A\n 144     4 5 5 A A\n 144     3 5 5 A A\n 144     2 5 5 A A\n 144     4 4 K A A      Aces over Fours\n 144     4 4 Q A A\n 144     4 4 J A A\n 144     4 4 T A A\n 144     4 4 9 A A\n 144     4 4 8 A A\n 144     4 4 7 A A\n 144     4 4 6 A A\n 144     4 4 5 A A\n 144     3 4 4 A A\n 144     2 4 4 A A\n 144     3 3 K A A      Aces over Treys\n 144     3 3 Q A A\n 144     3 3 J A A\n 144     3 3 T A A\n 144     3 3 9 A A\n 144     3 3 8 A A\n 144     3 3 7 A A\n 144     3 3 6 A A\n 144     3 3 5 A A\n 144     3 3 4 A A\n 144     2 3 3 A A\n 144     2 2 K A A      Aces over Deuces\n 144     2 2 Q A A\n 144     2 2 J A A\n 144     2 2 T A A\n 144     2 2 9 A A\n 144     2 2 8 A A\n 144     2 2 7 A A\n 144     2 2 6 A A\n 144     2 2 5 A A\n 144     2 2 4 A A\n 144     2 2 3 A A\n 144     Q Q K K A      Kings over Queens\n 144     J Q Q K K\n 144     T Q Q K K\n 144     9 Q Q K K\n 144     8 Q Q K K\n 144     7 Q Q K K\n 144     6 Q Q K K\n 144     5 Q Q K K\n 144     4 Q Q K K\n 144     3 Q Q K K\n 144     2 Q Q K K\n 144     J J K K A      Kings over Jacks\n 144     J J Q K K\n 144     T J J K K\n 144     9 J J K K\n 144     8 J J K K\n 144     7 J J K K\n 144     6 J J K K\n 144     5 J J K K\n 144     4 J J K K\n 144     3 J J K K\n 144     2 J J K K\n 144     T T K K A      Kings over Tens\n 144     T T Q K K\n 144     T T J K K\n 144     9 T T K K\n 144     8 T T K K\n 144     7 T T K K\n 144     6 T T K K\n 144     5 T T K K\n 144     4 T T K K\n 144     3 T T K K\n 144     2 T T K K\n 144     9 9 K K A      Kings over Nines\n 144     9 9 Q K K\n 144     9 9 J K K\n 144     9 9 T K K\n 144     8 9 9 K K\n 144     7 9 9 K K\n 144     6 9 9 K K\n 144     5 9 9 K K\n 144     4 9 9 K K\n 144     3 9 9 K K\n 144     2 9 9 K K\n 144     8 8 K K A      Kings over Eights\n 144     8 8 Q K K\n 144     8 8 J K K\n 144     8 8 T K K\n 144     8 8 9 K K\n 144     7 8 8 K K\n 144     6 8 8 K K\n 144     5 8 8 K K\n 144     4 8 8 K K\n 144     3 8 8 K K\n 144     2 8 8 K K\n 144     7 7 K K A      Kings over Sevens\n 144     7 7 Q K K\n 144     7 7 J K K\n 144     7 7 T K K\n 144     7 7 9 K K\n 144     7 7 8 K K\n 144     6 7 7 K K\n 144     5 7 7 K K\n 144     4 7 7 K K\n 144     3 7 7 K K\n 144     2 7 7 K K\n 144     6 6 K K A      Kings over Sixes\n 144     6 6 Q K K\n 144     6 6 J K K\n 144     6 6 T K K\n 144     6 6 9 K K\n 144     6 6 8 K K\n 144     6 6 7 K K\n 144     5 6 6 K K\n 144     4 6 6 K K\n 144     3 6 6 K K\n 144     2 6 6 K K\n 144     5 5 K K A      Kings over Fives\n 144     5 5 Q K K\n 144     5 5 J K K\n 144     5 5 T K K\n 144     5 5 9 K K\n 144     5 5 8 K K\n 144     5 5 7 K K\n 144     5 5 6 K K\n 144     4 5 5 K K\n 144     3 5 5 K K\n 144     2 5 5 K K\n 144     4 4 K K A      Kings over Fours\n 144     4 4 Q K K\n 144     4 4 J K K\n 144     4 4 T K K\n 144     4 4 9 K K\n 144     4 4 8 K K\n 144     4 4 7 K K\n 144     4 4 6 K K\n 144     4 4 5 K K\n 144     3 4 4 K K\n 144     2 4 4 K K\n 144     3 3 K K A      Kings over Treys\n 144     3 3 Q K K\n 144     3 3 J K K\n 144     3 3 T K K\n 144     3 3 9 K K\n 144     3 3 8 K K\n 144     3 3 7 K K\n 144     3 3 6 K K\n 144     3 3 5 K K\n 144     3 3 4 K K\n 144     2 3 3 K K\n 144     2 2 K K A      Kings over Deuces\n 144     2 2 Q K K\n 144     2 2 J K K\n 144     2 2 T K K\n 144     2 2 9 K K\n 144     2 2 8 K K\n 144     2 2 7 K K\n 144     2 2 6 K K\n 144     2 2 5 K K\n 144     2 2 4 K K\n 144     2 2 3 K K\n 144     J J Q Q A      Queens over Jacks\n 144     J J Q Q K\n 144     T J J Q Q\n 144     9 J J Q Q\n 144     8 J J Q Q\n 144     7 J J Q Q\n 144     6 J J Q Q\n 144     5 J J Q Q\n 144     4 J J Q Q\n 144     3 J J Q Q\n 144     2 J J Q Q\n 144     T T Q Q A      Queens over Tens\n 144     T T Q Q K\n 144     T T J Q Q\n 144     9 T T Q Q\n 144     8 T T Q Q\n 144     7 T T Q Q\n 144     6 T T Q Q\n 144     5 T T Q Q\n 144     4 T T Q Q\n 144     3 T T Q Q\n 144     2 T T Q Q\n 144     9 9 Q Q A      Queens over Nines\n 144     9 9 Q Q K\n 144     9 9 J Q Q\n 144     9 9 T Q Q\n 144     8 9 9 Q Q\n 144     7 9 9 Q Q\n 144     6 9 9 Q Q\n 144     5 9 9 Q Q\n 144     4 9 9 Q Q\n 144     3 9 9 Q Q\n 144     2 9 9 Q Q\n 144     8 8 Q Q A      Queens over Eights\n 144     8 8 Q Q K\n 144     8 8 J Q Q\n 144     8 8 T Q Q\n 144     8 8 9 Q Q\n 144     7 8 8 Q Q\n 144     6 8 8 Q Q\n 144     5 8 8 Q Q\n 144     4 8 8 Q Q\n 144     3 8 8 Q Q\n 144     2 8 8 Q Q\n 144     7 7 Q Q A      Queens over Sevens\n 144     7 7 Q Q K\n 144     7 7 J Q Q\n 144     7 7 T Q Q\n 144     7 7 9 Q Q\n 144     7 7 8 Q Q\n 144     6 7 7 Q Q\n 144     5 7 7 Q Q\n 144     4 7 7 Q Q\n 144     3 7 7 Q Q\n 144     2 7 7 Q Q\n 144     6 6 Q Q A      Queens over Sixes\n 144     6 6 Q Q K\n 144     6 6 J Q Q\n 144     6 6 T Q Q\n 144     6 6 9 Q Q\n 144     6 6 8 Q Q\n 144     6 6 7 Q Q\n 144     5 6 6 Q Q\n 144     4 6 6 Q Q\n 144     3 6 6 Q Q\n 144     2 6 6 Q Q\n 144     5 5 Q Q A      Queens over Fives\n 144     5 5 Q Q K\n 144     5 5 J Q Q\n 144     5 5 T Q Q\n 144     5 5 9 Q Q\n 144     5 5 8 Q Q\n 144     5 5 7 Q Q\n 144     5 5 6 Q Q\n 144     4 5 5 Q Q\n 144     3 5 5 Q Q\n 144     2 5 5 Q Q\n 144     4 4 Q Q A      Queens over Fours\n 144     4 4 Q Q K\n 144     4 4 J Q Q\n 144     4 4 T Q Q\n 144     4 4 9 Q Q\n 144     4 4 8 Q Q\n 144     4 4 7 Q Q\n 144     4 4 6 Q Q\n 144     4 4 5 Q Q\n 144     3 4 4 Q Q\n 144     2 4 4 Q Q\n 144     3 3 Q Q A      Queens over Treys\n 144     3 3 Q Q K\n 144     3 3 J Q Q\n 144     3 3 T Q Q\n 144     3 3 9 Q Q\n 144     3 3 8 Q Q\n 144     3 3 7 Q Q\n 144     3 3 6 Q Q\n 144     3 3 5 Q Q\n 144     3 3 4 Q Q\n 144     2 3 3 Q Q\n 144     2 2 Q Q A      Queens over Deuces\n 144     2 2 Q Q K\n 144     2 2 J Q Q\n 144     2 2 T Q Q\n 144     2 2 9 Q Q\n 144     2 2 8 Q Q\n 144     2 2 7 Q Q\n 144     2 2 6 Q Q\n 144     2 2 5 Q Q\n 144     2 2 4 Q Q\n 144     2 2 3 Q Q\n 144     T T J J A      Jacks over Tens\n 144     T T J J K\n 144     T T J J Q\n 144     9 T T J J\n 144     8 T T J J\n 144     7 T T J J\n 144     6 T T J J\n 144     5 T T J J\n 144     4 T T J J\n 144     3 T T J J\n 144     2 T T J J\n 144     9 9 J J A      Jacks over Nines\n 144     9 9 J J K\n 144     9 9 J J Q\n 144     9 9 T J J\n 144     8 9 9 J J\n 144     7 9 9 J J\n 144     6 9 9 J J\n 144     5 9 9 J J\n 144     4 9 9 J J\n 144     3 9 9 J J\n 144     2 9 9 J J\n 144     8 8 J J A      Jacks over Eights\n 144     8 8 J J K\n 144     8 8 J J Q\n 144     8 8 T J J\n 144     8 8 9 J J\n 144     7 8 8 J J\n 144     6 8 8 J J\n 144     5 8 8 J J\n 144     4 8 8 J J\n 144     3 8 8 J J\n 144     2 8 8 J J\n 144     7 7 J J A      Jacks over Sevens\n 144     7 7 J J K\n 144     7 7 J J Q\n 144     7 7 T J J\n 144     7 7 9 J J\n 144     7 7 8 J J\n 144     6 7 7 J J\n 144     5 7 7 J J\n 144     4 7 7 J J\n 144     3 7 7 J J\n 144     2 7 7 J J\n 144     6 6 J J A      Jacks over Sixes\n 144     6 6 J J K\n 144     6 6 J J Q\n 144     6 6 T J J\n 144     6 6 9 J J\n 144     6 6 8 J J\n 144     6 6 7 J J\n 144     5 6 6 J J\n 144     4 6 6 J J\n 144     3 6 6 J J\n 144     2 6 6 J J\n 144     5 5 J J A      Jacks over Fives\n 144     5 5 J J K\n 144     5 5 J J Q\n 144     5 5 T J J\n 144     5 5 9 J J\n 144     5 5 8 J J\n 144     5 5 7 J J\n 144     5 5 6 J J\n 144     4 5 5 J J\n 144     3 5 5 J J\n 144     2 5 5 J J\n 144     4 4 J J A      Jacks over Fours\n 144     4 4 J J K\n 144     4 4 J J Q\n 144     4 4 T J J\n 144     4 4 9 J J\n 144     4 4 8 J J\n 144     4 4 7 J J\n 144     4 4 6 J J\n 144     4 4 5 J J\n 144     3 4 4 J J\n 144     2 4 4 J J\n 144     3 3 J J A      Jacks over Treys\n 144     3 3 J J K\n 144     3 3 J J Q\n 144     3 3 T J J\n 144     3 3 9 J J\n 144     3 3 8 J J\n 144     3 3 7 J J\n 144     3 3 6 J J\n 144     3 3 5 J J\n 144     3 3 4 J J\n 144     2 3 3 J J\n 144     2 2 J J A      Jacks over Deuces\n 144     2 2 J J K\n 144     2 2 J J Q\n 144     2 2 T J J\n 144     2 2 9 J J\n 144     2 2 8 J J\n 144     2 2 7 J J\n 144     2 2 6 J J\n 144     2 2 5 J J\n 144     2 2 4 J J\n 144     2 2 3 J J\n 144     9 9 T T A      Tens over Nines\n 144     9 9 T T K\n 144     9 9 T T Q\n 144     9 9 T T J\n 144     8 9 9 T T\n 144     7 9 9 T T\n 144     6 9 9 T T\n 144     5 9 9 T T\n 144     4 9 9 T T\n 144     3 9 9 T T\n 144     2 9 9 T T\n 144     8 8 T T A      Tens over Eights\n 144     8 8 T T K\n 144     8 8 T T Q\n 144     8 8 T T J\n 144     8 8 9 T T\n 144     7 8 8 T T\n 144     6 8 8 T T\n 144     5 8 8 T T\n 144     4 8 8 T T\n 144     3 8 8 T T\n 144     2 8 8 T T\n 144     7 7 T T A      Tens over Sevens\n 144     7 7 T T K\n 144     7 7 T T Q\n 144     7 7 T T J\n 144     7 7 9 T T\n 144     7 7 8 T T\n 144     6 7 7 T T\n 144     5 7 7 T T\n 144     4 7 7 T T\n 144     3 7 7 T T\n 144     2 7 7 T T\n 144     6 6 T T A      Tens over Sixes\n 144     6 6 T T K\n 144     6 6 T T Q\n 144     6 6 T T J\n 144     6 6 9 T T\n 144     6 6 8 T T\n 144     6 6 7 T T\n 144     5 6 6 T T\n 144     4 6 6 T T\n 144     3 6 6 T T\n 144     2 6 6 T T\n 144     5 5 T T A      Tens over Fives\n 144     5 5 T T K\n 144     5 5 T T Q\n 144     5 5 T T J\n 144     5 5 9 T T\n 144     5 5 8 T T\n 144     5 5 7 T T\n 144     5 5 6 T T\n 144     4 5 5 T T\n 144     3 5 5 T T\n 144     2 5 5 T T\n 144     4 4 T T A      Tens over Fours\n 144     4 4 T T K\n 144     4 4 T T Q\n 144     4 4 T T J\n 144     4 4 9 T T\n 144     4 4 8 T T\n 144     4 4 7 T T\n 144     4 4 6 T T\n 144     4 4 5 T T\n 144     3 4 4 T T\n 144     2 4 4 T T\n 144     3 3 T T A      Tens over Treys\n 144     3 3 T T K\n 144     3 3 T T Q\n 144     3 3 T T J\n 144     3 3 9 T T\n 144     3 3 8 T T\n 144     3 3 7 T T\n 144     3 3 6 T T\n 144     3 3 5 T T\n 144     3 3 4 T T\n 144     2 3 3 T T\n 144     2 2 T T A      Tens over Deuces\n 144     2 2 T T K\n 144     2 2 T T Q\n 144     2 2 T T J\n 144     2 2 9 T T\n 144     2 2 8 T T\n 144     2 2 7 T T\n 144     2 2 6 T T\n 144     2 2 5 T T\n 144     2 2 4 T T\n 144     2 2 3 T T\n 144     8 8 9 9 A      Nines over Eights\n 144     8 8 9 9 K\n 144     8 8 9 9 Q\n 144     8 8 9 9 J\n 144     8 8 9 9 T\n 144     7 8 8 9 9\n 144     6 8 8 9 9\n 144     5 8 8 9 9\n 144     4 8 8 9 9\n 144     3 8 8 9 9\n 144     2 8 8 9 9\n 144     7 7 9 9 A      Nines over Sevens\n 144     7 7 9 9 K\n 144     7 7 9 9 Q\n 144     7 7 9 9 J\n 144     7 7 9 9 T\n 144     7 7 8 9 9\n 144     6 7 7 9 9\n 144     5 7 7 9 9\n 144     4 7 7 9 9\n 144     3 7 7 9 9\n 144     2 7 7 9 9\n 144     6 6 9 9 A      Nines over Sixes\n 144     6 6 9 9 K\n 144     6 6 9 9 Q\n 144     6 6 9 9 J\n 144     6 6 9 9 T\n 144     6 6 8 9 9\n 144     6 6 7 9 9\n 144     5 6 6 9 9\n 144     4 6 6 9 9\n 144     3 6 6 9 9\n 144     2 6 6 9 9\n 144     5 5 9 9 A      Nines over Fives\n 144     5 5 9 9 K\n 144     5 5 9 9 Q\n 144     5 5 9 9 J\n 144     5 5 9 9 T\n 144     5 5 8 9 9\n 144     5 5 7 9 9\n 144     5 5 6 9 9\n 144     4 5 5 9 9\n 144     3 5 5 9 9\n 144     2 5 5 9 9\n 144     4 4 9 9 A      Nines over Fours\n 144     4 4 9 9 K\n 144     4 4 9 9 Q\n 144     4 4 9 9 J\n 144     4 4 9 9 T\n 144     4 4 8 9 9\n 144     4 4 7 9 9\n 144     4 4 6 9 9\n 144     4 4 5 9 9\n 144     3 4 4 9 9\n 144     2 4 4 9 9\n 144     3 3 9 9 A      Nines over Treys\n 144     3 3 9 9 K\n 144     3 3 9 9 Q\n 144     3 3 9 9 J\n 144     3 3 9 9 T\n 144     3 3 8 9 9\n 144     3 3 7 9 9\n 144     3 3 6 9 9\n 144     3 3 5 9 9\n 144     3 3 4 9 9\n 144     2 3 3 9 9\n 144     2 2 9 9 A      Nines over Deuces\n 144     2 2 9 9 K\n 144     2 2 9 9 Q\n 144     2 2 9 9 J\n 144     2 2 9 9 T\n 144     2 2 8 9 9\n 144     2 2 7 9 9\n 144     2 2 6 9 9\n 144     2 2 5 9 9\n 144     2 2 4 9 9\n 144     2 2 3 9 9\n 144     7 7 8 8 A      Eights over Sevens\n 144     7 7 8 8 K\n 144     7 7 8 8 Q\n 144     7 7 8 8 J\n 144     7 7 8 8 T\n 144     7 7 8 8 9\n 144     6 7 7 8 8\n 144     5 7 7 8 8\n 144     4 7 7 8 8\n 144     3 7 7 8 8\n 144     2 7 7 8 8\n 144     6 6 8 8 A      Eights over Sixes\n 144     6 6 8 8 K\n 144     6 6 8 8 Q\n 144     6 6 8 8 J\n 144     6 6 8 8 T\n 144     6 6 8 8 9\n 144     6 6 7 8 8\n 144     5 6 6 8 8\n 144     4 6 6 8 8\n 144     3 6 6 8 8\n 144     2 6 6 8 8\n 144     5 5 8 8 A      Eights over Fives\n 144     5 5 8 8 K\n 144     5 5 8 8 Q\n 144     5 5 8 8 J\n 144     5 5 8 8 T\n 144     5 5 8 8 9\n 144     5 5 7 8 8\n 144     5 5 6 8 8\n 144     4 5 5 8 8\n 144     3 5 5 8 8\n 144     2 5 5 8 8\n 144     4 4 8 8 A      Eights over Fours\n 144     4 4 8 8 K\n 144     4 4 8 8 Q\n 144     4 4 8 8 J\n 144     4 4 8 8 T\n 144     4 4 8 8 9\n 144     4 4 7 8 8\n 144     4 4 6 8 8\n 144     4 4 5 8 8\n 144     3 4 4 8 8\n 144     2 4 4 8 8\n 144     3 3 8 8 A      Eights over Treys\n 144     3 3 8 8 K\n 144     3 3 8 8 Q\n 144     3 3 8 8 J\n 144     3 3 8 8 T\n 144     3 3 8 8 9\n 144     3 3 7 8 8\n 144     3 3 6 8 8\n 144     3 3 5 8 8\n 144     3 3 4 8 8\n 144     2 3 3 8 8\n 144     2 2 8 8 A      Eights over Deuces\n 144     2 2 8 8 K\n 144     2 2 8 8 Q\n 144     2 2 8 8 J\n 144     2 2 8 8 T\n 144     2 2 8 8 9\n 144     2 2 7 8 8\n 144     2 2 6 8 8\n 144     2 2 5 8 8\n 144     2 2 4 8 8\n 144     2 2 3 8 8\n 144     6 6 7 7 A      Sevens over Sixes\n 144     6 6 7 7 K\n 144     6 6 7 7 Q\n 144     6 6 7 7 J\n 144     6 6 7 7 T\n 144     6 6 7 7 9\n 144     6 6 7 7 8\n 144     5 6 6 7 7\n 144     4 6 6 7 7\n 144     3 6 6 7 7\n 144     2 6 6 7 7\n 144     5 5 7 7 A      Sevens over Fives\n 144     5 5 7 7 K\n 144     5 5 7 7 Q\n 144     5 5 7 7 J\n 144     5 5 7 7 T\n 144     5 5 7 7 9\n 144     5 5 7 7 8\n 144     5 5 6 7 7\n 144     4 5 5 7 7\n 144     3 5 5 7 7\n 144     2 5 5 7 7\n 144     4 4 7 7 A      Sevens over Fours\n 144     4 4 7 7 K\n 144     4 4 7 7 Q\n 144     4 4 7 7 J\n 144     4 4 7 7 T\n 144     4 4 7 7 9\n 144     4 4 7 7 8\n 144     4 4 6 7 7\n 144     4 4 5 7 7\n 144     3 4 4 7 7\n 144     2 4 4 7 7\n 144     3 3 7 7 A      Sevens over Treys\n 144     3 3 7 7 K\n 144     3 3 7 7 Q\n 144     3 3 7 7 J\n 144     3 3 7 7 T\n 144     3 3 7 7 9\n 144     3 3 7 7 8\n 144     3 3 6 7 7\n 144     3 3 5 7 7\n 144     3 3 4 7 7\n 144     2 3 3 7 7\n 144     2 2 7 7 A      Sevens over Deuces\n 144     2 2 7 7 K\n 144     2 2 7 7 Q\n 144     2 2 7 7 J\n 144     2 2 7 7 T\n 144     2 2 7 7 9\n 144     2 2 7 7 8\n 144     2 2 6 7 7\n 144     2 2 5 7 7\n 144     2 2 4 7 7\n 144     2 2 3 7 7\n 144     5 5 6 6 A      Sixes over Fives\n 144     5 5 6 6 K\n 144     5 5 6 6 Q\n 144     5 5 6 6 J\n 144     5 5 6 6 T\n 144     5 5 6 6 9\n 144     5 5 6 6 8\n 144     5 5 6 6 7\n 144     4 5 5 6 6\n 144     3 5 5 6 6\n 144     2 5 5 6 6\n 144     4 4 6 6 A      Sixes over Fours\n 144     4 4 6 6 K\n 144     4 4 6 6 Q\n 144     4 4 6 6 J\n 144     4 4 6 6 T\n 144     4 4 6 6 9\n 144     4 4 6 6 8\n 144     4 4 6 6 7\n 144     4 4 5 6 6\n 144     3 4 4 6 6\n 144     2 4 4 6 6\n 144     3 3 6 6 A      Sixes over Treys\n 144     3 3 6 6 K\n 144     3 3 6 6 Q\n 144     3 3 6 6 J\n 144     3 3 6 6 T\n 144     3 3 6 6 9\n 144     3 3 6 6 8\n 144     3 3 6 6 7\n 144     3 3 5 6 6\n 144     3 3 4 6 6\n 144     2 3 3 6 6\n 144     2 2 6 6 A      Sixes over Deuces\n 144     2 2 6 6 K\n 144     2 2 6 6 Q\n 144     2 2 6 6 J\n 144     2 2 6 6 T\n 144     2 2 6 6 9\n 144     2 2 6 6 8\n 144     2 2 6 6 7\n 144     2 2 5 6 6\n 144     2 2 4 6 6\n 144     2 2 3 6 6\n 144     4 4 5 5 A      Fives over Fours\n 144     4 4 5 5 K\n 144     4 4 5 5 Q\n 144     4 4 5 5 J\n 144     4 4 5 5 T\n 144     4 4 5 5 9\n 144     4 4 5 5 8\n 144     4 4 5 5 7\n 144     4 4 5 5 6\n 144     3 4 4 5 5\n 144     2 4 4 5 5\n 144     3 3 5 5 A      Fives over Treys\n 144     3 3 5 5 K\n 144     3 3 5 5 Q\n 144     3 3 5 5 J\n 144     3 3 5 5 T\n 144     3 3 5 5 9\n 144     3 3 5 5 8\n 144     3 3 5 5 7\n 144     3 3 5 5 6\n 144     3 3 4 5 5\n 144     2 3 3 5 5\n 144     2 2 5 5 A      Fives over Deuces\n 144     2 2 5 5 K\n 144     2 2 5 5 Q\n 144     2 2 5 5 J\n 144     2 2 5 5 T\n 144     2 2 5 5 9\n 144     2 2 5 5 8\n 144     2 2 5 5 7\n 144     2 2 5 5 6\n 144     2 2 4 5 5\n 144     2 2 3 5 5\n 144     3 3 4 4 A      Fours over Treys\n 144     3 3 4 4 K\n 144     3 3 4 4 Q\n 144     3 3 4 4 J\n 144     3 3 4 4 T\n 144     3 3 4 4 9\n 144     3 3 4 4 8\n 144     3 3 4 4 7\n 144     3 3 4 4 6\n 144     3 3 4 4 5\n 144     3 3 4 4 2\n 144     2 2 4 4 A      Fours over Deuces\n 144     2 2 4 4 K\n 144     2 2 4 4 Q\n 144     2 2 4 4 J\n 144     2 2 4 4 T\n 144     2 2 4 4 9\n 144     2 2 4 4 8\n 144     2 2 4 4 7\n 144     2 2 4 4 6\n 144     2 2 4 4 5\n 144     2 2 4 4 3\n 144     2 2 3 3 A      Treys over Deuces\n 144     2 2 3 3 K\n 144     2 2 3 3 Q\n 144     2 2 3 3 J\n 144     2 2 3 3 T\n 144     2 2 3 3 9\n 144     2 2 3 3 8\n 144     2 2 3 3 7\n 144     2 2 3 3 6\n 144     2 2 3 3 5\n 144     2 2 3 3 4\n 384     J Q K A A      Pair of Aces                   ONE PAIR\n 384     T Q K A A\n 384     9 Q K A A\n 384     8 Q K A A\n 384     7 Q K A A\n 384     6 Q K A A\n 384     5 Q K A A\n 384     4 Q K A A\n 384     3 Q K A A\n 384     2 Q K A A\n 384     T J K A A\n 384     9 J K A A\n 384     8 J K A A\n 384     7 J K A A\n 384     6 J K A A\n 384     5 J K A A\n 384     4 J K A A\n 384     3 J K A A\n 384     2 J K A A\n 384     9 T K A A\n 384     8 T K A A\n 384     7 T K A A\n 384     6 T K A A\n 384     5 T K A A\n 384     4 T K A A\n 384     3 T K A A\n 384     2 T K A A\n 384     8 9 K A A\n 384     7 9 K A A\n 384     6 9 K A A\n 384     5 9 K A A\n 384     4 9 K A A\n 384     3 9 K A A\n 384     2 9 K A A\n 384     7 8 K A A\n 384     6 8 K A A\n 384     5 8 K A A\n 384     4 8 K A A\n 384     3 8 K A A\n 384     2 8 K A A\n 384     6 7 K A A\n 384     5 7 K A A\n 384     4 7 K A A\n 384     3 7 K A A\n 384     2 7 K A A\n 384     5 6 K A A\n 384     4 6 K A A\n 384     3 6 K A A\n 384     2 6 K A A\n 384     4 5 K A A\n 384     3 5 K A A\n 384     2 5 K A A\n 384     3 4 K A A\n 384     2 4 K A A\n 384     2 3 K A A\n 384     T J Q A A\n 384     9 J Q A A\n 384     8 J Q A A\n 384     7 J Q A A\n 384     6 J Q A A\n 384     5 J Q A A\n 384     4 J Q A A\n 384     3 J Q A A\n 384     2 J Q A A\n 384     9 T Q A A\n 384     8 T Q A A\n 384     7 T Q A A\n 384     6 T Q A A\n 384     5 T Q A A\n 384     4 T Q A A\n 384     3 T Q A A\n 384     2 T Q A A\n 384     8 9 Q A A\n 384     7 9 Q A A\n 384     6 9 Q A A\n 384     5 9 Q A A\n 384     4 9 Q A A\n 384     3 9 Q A A\n 384     2 9 Q A A\n 384     7 8 Q A A\n 384     6 8 Q A A\n 384     5 8 Q A A\n 384     4 8 Q A A\n 384     3 8 Q A A\n 384     2 8 Q A A\n 384     6 7 Q A A\n 384     5 7 Q A A\n 384     4 7 Q A A\n 384     3 7 Q A A\n 384     2 7 Q A A\n 384     5 6 Q A A\n 384     4 6 Q A A\n 384     3 6 Q A A\n 384     2 6 Q A A\n 384     4 5 Q A A\n 384     3 5 Q A A\n 384     2 5 Q A A\n 384     3 4 Q A A\n 384     2 4 Q A A\n 384     2 3 Q A A\n 384     9 T J A A\n 384     8 T J A A\n 384     7 T J A A\n 384     6 T J A A\n 384     5 T J A A\n 384     4 T J A A\n 384     3 T J A A\n 384     2 T J A A\n 384     8 9 J A A\n 384     7 9 J A A\n 384     6 9 J A A\n 384     5 9 J A A\n 384     4 9 J A A\n 384     3 9 J A A\n 384     2 9 J A A\n 384     7 8 J A A\n 384     6 8 J A A\n 384     5 8 J A A\n 384     4 8 J A A\n 384     3 8 J A A\n 384     2 8 J A A\n 384     6 7 J A A\n 384     5 7 J A A\n 384     4 7 J A A\n 384     3 7 J A A\n 384     2 7 J A A\n 384     5 6 J A A\n 384     4 6 J A A\n 384     3 6 J A A\n 384     2 6 J A A\n 384     4 5 J A A\n 384     3 5 J A A\n 384     2 5 J A A\n 384     3 4 J A A\n 384     2 4 J A A\n 384     2 3 J A A\n 384     8 9 T A A\n 384     7 9 T A A\n 384     6 9 T A A\n 384     5 9 T A A\n 384     4 9 T A A\n 384     3 9 T A A\n 384     2 9 T A A\n 384     7 8 T A A\n 384     6 8 T A A\n 384     5 8 T A A\n 384     4 8 T A A\n 384     3 8 T A A\n 384     2 8 T A A\n 384     6 7 T A A\n 384     5 7 T A A\n 384     4 7 T A A\n 384     3 7 T A A\n 384     2 7 T A A\n 384     5 6 T A A\n 384     4 6 T A A\n 384     3 6 T A A\n 384     2 6 T A A\n 384     4 5 T A A\n 384     3 5 T A A\n 384     2 5 T A A\n 384     3 4 T A A\n 384     2 4 T A A\n 384     2 3 T A A\n 384     7 8 9 A A\n 384     6 8 9 A A\n 384     5 8 9 A A\n 384     4 8 9 A A\n 384     3 8 9 A A\n 384     2 8 9 A A\n 384     6 7 9 A A\n 384     5 7 9 A A\n 384     4 7 9 A A\n 384     3 7 9 A A\n 384     2 7 9 A A\n 384     5 6 9 A A\n 384     4 6 9 A A\n 384     3 6 9 A A\n 384     2 6 9 A A\n 384     4 5 9 A A\n 384     3 5 9 A A\n 384     2 5 9 A A\n 384     3 4 9 A A\n 384     2 4 9 A A\n 384     2 3 9 A A\n 384     6 7 8 A A\n 384     5 7 8 A A\n 384     4 7 8 A A\n 384     3 7 8 A A\n 384     2 7 8 A A\n 384     5 6 8 A A\n 384     4 6 8 A A\n 384     3 6 8 A A\n 384     2 6 8 A A\n 384     4 5 8 A A\n 384     3 5 8 A A\n 384     2 5 8 A A\n 384     3 4 8 A A\n 384     2 4 8 A A\n 384     2 3 8 A A\n 384     5 6 7 A A\n 384     4 6 7 A A\n 384     3 6 7 A A\n 384     2 6 7 A A\n 384     4 5 7 A A\n 384     3 5 7 A A\n 384     2 5 7 A A\n 384     3 4 7 A A\n 384     2 4 7 A A\n 384     2 3 7 A A\n 384     4 5 6 A A\n 384     3 5 6 A A\n 384     2 5 6 A A\n 384     3 4 6 A A\n 384     2 4 6 A A\n 384     2 3 6 A A\n 384     3 4 5 A A\n 384     2 4 5 A A\n 384     2 3 5 A A\n 384     2 3 4 A A\n 384     J Q K K A      Pair of Kings\n 384     T Q K K A\n 384     9 Q K K A\n 384     8 Q K K A\n 384     7 Q K K A\n 384     6 Q K K A\n 384     5 Q K K A\n 384     4 Q K K A\n 384     3 Q K K A\n 384     2 Q K K A\n 384     T J K K A\n 384     9 J K K A\n 384     8 J K K A\n 384     7 J K K A\n 384     6 J K K A\n 384     5 J K K A\n 384     4 J K K A\n 384     3 J K K A\n 384     2 J K K A\n 384     9 T K K A\n 384     8 T K K A\n 384     7 T K K A\n 384     6 T K K A\n 384     5 T K K A\n 384     4 T K K A\n 384     3 T K K A\n 384     2 T K K A\n 384     8 9 K K A\n 384     7 9 K K A\n 384     6 9 K K A\n 384     5 9 K K A\n 384     4 9 K K A\n 384     3 9 K K A\n 384     2 9 K K A\n 384     7 8 K K A\n 384     6 8 K K A\n 384     5 8 K K A\n 384     4 8 K K A\n 384     3 8 K K A\n 384     2 8 K K A\n 384     6 7 K K A\n 384     5 7 K K A\n 384     4 7 K K A\n 384     3 7 K K A\n 384     2 7 K K A\n 384     5 6 K K A\n 384     4 6 K K A\n 384     3 6 K K A\n 384     2 6 K K A\n 384     4 5 K K A\n 384     3 5 K K A\n 384     2 5 K K A\n 384     3 4 K K A\n 384     2 4 K K A\n 384     2 3 K K A\n 384     T J Q K K\n 384     9 J Q K K\n 384     8 J Q K K\n 384     7 J Q K K\n 384     6 J Q K K\n 384     5 J Q K K\n 384     4 J Q K K\n 384     3 J Q K K\n 384     2 J Q K K\n 384     9 T Q K K\n 384     8 T Q K K\n 384     7 T Q K K\n 384     6 T Q K K\n 384     5 T Q K K\n 384     4 T Q K K\n 384     3 T Q K K\n 384     2 T Q K K\n 384     8 9 Q K K\n 384     7 9 Q K K\n 384     6 9 Q K K\n 384     5 9 Q K K\n 384     4 9 Q K K\n 384     3 9 Q K K\n 384     2 9 Q K K\n 384     7 8 Q K K\n 384     6 8 Q K K\n 384     5 8 Q K K\n 384     4 8 Q K K\n 384     3 8 Q K K\n 384     2 8 Q K K\n 384     6 7 Q K K\n 384     5 7 Q K K\n 384     4 7 Q K K\n 384     3 7 Q K K\n 384     2 7 Q K K\n 384     5 6 Q K K\n 384     4 6 Q K K\n 384     3 6 Q K K\n 384     2 6 Q K K\n 384     4 5 Q K K\n 384     3 5 Q K K\n 384     2 5 Q K K\n 384     3 4 Q K K\n 384     2 4 Q K K\n 384     2 3 Q K K\n 384     9 T J K K\n 384     8 T J K K\n 384     7 T J K K\n 384     6 T J K K\n 384     5 T J K K\n 384     4 T J K K\n 384     3 T J K K\n 384     2 T J K K\n 384     8 9 J K K\n 384     7 9 J K K\n 384     6 9 J K K\n 384     5 9 J K K\n 384     4 9 J K K\n 384     3 9 J K K\n 384     2 9 J K K\n 384     7 8 J K K\n 384     6 8 J K K\n 384     5 8 J K K\n 384     4 8 J K K\n 384     3 8 J K K\n 384     2 8 J K K\n 384     6 7 J K K\n 384     5 7 J K K\n 384     4 7 J K K\n 384     3 7 J K K\n 384     2 7 J K K\n 384     5 6 J K K\n 384     4 6 J K K\n 384     3 6 J K K\n 384     2 6 J K K\n 384     4 5 J K K\n 384     3 5 J K K\n 384     2 5 J K K\n 384     3 4 J K K\n 384     2 4 J K K\n 384     2 3 J K K\n 384     8 9 T K K\n 384     7 9 T K K\n 384     6 9 T K K\n 384     5 9 T K K\n 384     4 9 T K K\n 384     3 9 T K K\n 384     2 9 T K K\n 384     7 8 T K K\n 384     6 8 T K K\n 384     5 8 T K K\n 384     4 8 T K K\n 384     3 8 T K K\n 384     2 8 T K K\n 384     6 7 T K K\n 384     5 7 T K K\n 384     4 7 T K K\n 384     3 7 T K K\n 384     2 7 T K K\n 384     5 6 T K K\n 384     4 6 T K K\n 384     3 6 T K K\n 384     2 6 T K K\n 384     4 5 T K K\n 384     3 5 T K K\n 384     2 5 T K K\n 384     3 4 T K K\n 384     2 4 T K K\n 384     2 3 T K K\n 384     7 8 9 K K\n 384     6 8 9 K K\n 384     5 8 9 K K\n 384     4 8 9 K K\n 384     3 8 9 K K\n 384     2 8 9 K K\n 384     6 7 9 K K\n 384     5 7 9 K K\n 384     4 7 9 K K\n 384     3 7 9 K K\n 384     2 7 9 K K\n 384     5 6 9 K K\n 384     4 6 9 K K\n 384     3 6 9 K K\n 384     2 6 9 K K\n 384     4 5 9 K K\n 384     3 5 9 K K\n 384     2 5 9 K K\n 384     3 4 9 K K\n 384     2 4 9 K K\n 384     2 3 9 K K\n 384     6 7 8 K K\n 384     5 7 8 K K\n 384     4 7 8 K K\n 384     3 7 8 K K\n 384     2 7 8 K K\n 384     5 6 8 K K\n 384     4 6 8 K K\n 384     3 6 8 K K\n 384     2 6 8 K K\n 384     4 5 8 K K\n 384     3 5 8 K K\n 384     2 5 8 K K\n 384     3 4 8 K K\n 384     2 4 8 K K\n 384     2 3 8 K K\n 384     5 6 7 K K\n 384     4 6 7 K K\n 384     3 6 7 K K\n 384     2 6 7 K K\n 384     4 5 7 K K\n 384     3 5 7 K K\n 384     2 5 7 K K\n 384     3 4 7 K K\n 384     2 4 7 K K\n 384     2 3 7 K K\n 384     4 5 6 K K\n 384     3 5 6 K K\n 384     2 5 6 K K\n 384     3 4 6 K K\n 384     2 4 6 K K\n 384     2 3 6 K K\n 384     3 4 5 K K\n 384     2 4 5 K K\n 384     2 3 5 K K\n 384     2 3 4 K K\n 384     J Q Q K A      Pair of Queens\n 384     T Q Q K A\n 384     9 Q Q K A\n 384     8 Q Q K A\n 384     7 Q Q K A\n 384     6 Q Q K A\n 384     5 Q Q K A\n 384     4 Q Q K A\n 384     3 Q Q K A\n 384     2 Q Q K A\n 384     T J Q Q A\n 384     9 J Q Q A\n 384     8 J Q Q A\n 384     7 J Q Q A\n 384     6 J Q Q A\n 384     5 J Q Q A\n 384     4 J Q Q A\n 384     3 J Q Q A\n 384     2 J Q Q A\n 384     9 T Q Q A\n 384     8 T Q Q A\n 384     7 T Q Q A\n 384     6 T Q Q A\n 384     5 T Q Q A\n 384     4 T Q Q A\n 384     3 T Q Q A\n 384     2 T Q Q A\n 384     8 9 Q Q A\n 384     7 9 Q Q A\n 384     6 9 Q Q A\n 384     5 9 Q Q A\n 384     4 9 Q Q A\n 384     3 9 Q Q A\n 384     2 9 Q Q A\n 384     7 8 Q Q A\n 384     6 8 Q Q A\n 384     5 8 Q Q A\n 384     4 8 Q Q A\n 384     3 8 Q Q A\n 384     2 8 Q Q A\n 384     6 7 Q Q A\n 384     5 7 Q Q A\n 384     4 7 Q Q A\n 384     3 7 Q Q A\n 384     2 7 Q Q A\n 384     5 6 Q Q A\n 384     4 6 Q Q A\n 384     3 6 Q Q A\n 384     2 6 Q Q A\n 384     4 5 Q Q A\n 384     3 5 Q Q A\n 384     2 5 Q Q A\n 384     3 4 Q Q A\n 384     2 4 Q Q A\n 384     2 3 Q Q A\n 384     T J Q Q K\n 384     9 J Q Q K\n 384     8 J Q Q K\n 384     7 J Q Q K\n 384     6 J Q Q K\n 384     5 J Q Q K\n 384     4 J Q Q K\n 384     3 J Q Q K\n 384     2 J Q Q K\n 384     9 T Q Q K\n 384     8 T Q Q K\n 384     7 T Q Q K\n 384     6 T Q Q K\n 384     5 T Q Q K\n 384     4 T Q Q K\n 384     3 T Q Q K\n 384     2 T Q Q K\n 384     8 9 Q Q K\n 384     7 9 Q Q K\n 384     6 9 Q Q K\n 384     5 9 Q Q K\n 384     4 9 Q Q K\n 384     3 9 Q Q K\n 384     2 9 Q Q K\n 384     7 8 Q Q K\n 384     6 8 Q Q K\n 384     5 8 Q Q K\n 384     4 8 Q Q K\n 384     3 8 Q Q K\n 384     2 8 Q Q K\n 384     6 7 Q Q K\n 384     5 7 Q Q K\n 384     4 7 Q Q K\n 384     3 7 Q Q K\n 384     2 7 Q Q K\n 384     5 6 Q Q K\n 384     4 6 Q Q K\n 384     3 6 Q Q K\n 384     2 6 Q Q K\n 384     4 5 Q Q K\n 384     3 5 Q Q K\n 384     2 5 Q Q K\n 384     3 4 Q Q K\n 384     2 4 Q Q K\n 384     2 3 Q Q K\n 384     9 T J Q Q\n 384     8 T J Q Q\n 384     7 T J Q Q\n 384     6 T J Q Q\n 384     5 T J Q Q\n 384     4 T J Q Q\n 384     3 T J Q Q\n 384     2 T J Q Q\n 384     8 9 J Q Q\n 384     7 9 J Q Q\n 384     6 9 J Q Q\n 384     5 9 J Q Q\n 384     4 9 J Q Q\n 384     3 9 J Q Q\n 384     2 9 J Q Q\n 384     7 8 J Q Q\n 384     6 8 J Q Q\n 384     5 8 J Q Q\n 384     4 8 J Q Q\n 384     3 8 J Q Q\n 384     2 8 J Q Q\n 384     6 7 J Q Q\n 384     5 7 J Q Q\n 384     4 7 J Q Q\n 384     3 7 J Q Q\n 384     2 7 J Q Q\n 384     5 6 J Q Q\n 384     4 6 J Q Q\n 384     3 6 J Q Q\n 384     2 6 J Q Q\n 384     4 5 J Q Q\n 384     3 5 J Q Q\n 384     2 5 J Q Q\n 384     3 4 J Q Q\n 384     2 4 J Q Q\n 384     2 3 J Q Q\n 384     8 9 T Q Q\n 384     7 9 T Q Q\n 384     6 9 T Q Q\n 384     5 9 T Q Q\n 384     4 9 T Q Q\n 384     3 9 T Q Q\n 384     2 9 T Q Q\n 384     7 8 T Q Q\n 384     6 8 T Q Q\n 384     5 8 T Q Q\n 384     4 8 T Q Q\n 384     3 8 T Q Q\n 384     2 8 T Q Q\n 384     6 7 T Q Q\n 384     5 7 T Q Q\n 384     4 7 T Q Q\n 384     3 7 T Q Q\n 384     2 7 T Q Q\n 384     5 6 T Q Q\n 384     4 6 T Q Q\n 384     3 6 T Q Q\n 384     2 6 T Q Q\n 384     4 5 T Q Q\n 384     3 5 T Q Q\n 384     2 5 T Q Q\n 384     3 4 T Q Q\n 384     2 4 T Q Q\n 384     2 3 T Q Q\n 384     7 8 9 Q Q\n 384     6 8 9 Q Q\n 384     5 8 9 Q Q\n 384     4 8 9 Q Q\n 384     3 8 9 Q Q\n 384     2 8 9 Q Q\n 384     6 7 9 Q Q\n 384     5 7 9 Q Q\n 384     4 7 9 Q Q\n 384     3 7 9 Q Q\n 384     2 7 9 Q Q\n 384     5 6 9 Q Q\n 384     4 6 9 Q Q\n 384     3 6 9 Q Q\n 384     2 6 9 Q Q\n 384     4 5 9 Q Q\n 384     3 5 9 Q Q\n 384     2 5 9 Q Q\n 384     3 4 9 Q Q\n 384     2 4 9 Q Q\n 384     2 3 9 Q Q\n 384     6 7 8 Q Q\n 384     5 7 8 Q Q\n 384     4 7 8 Q Q\n 384     3 7 8 Q Q\n 384     2 7 8 Q Q\n 384     5 6 8 Q Q\n 384     4 6 8 Q Q\n 384     3 6 8 Q Q\n 384     2 6 8 Q Q\n 384     4 5 8 Q Q\n 384     3 5 8 Q Q\n 384     2 5 8 Q Q\n 384     3 4 8 Q Q\n 384     2 4 8 Q Q\n 384     2 3 8 Q Q\n 384     5 6 7 Q Q\n 384     4 6 7 Q Q\n 384     3 6 7 Q Q\n 384     2 6 7 Q Q\n 384     4 5 7 Q Q\n 384     3 5 7 Q Q\n 384     2 5 7 Q Q\n 384     3 4 7 Q Q\n 384     2 4 7 Q Q\n 384     2 3 7 Q Q\n 384     4 5 6 Q Q\n 384     3 5 6 Q Q\n 384     2 5 6 Q Q\n 384     3 4 6 Q Q\n 384     2 4 6 Q Q\n 384     2 3 6 Q Q\n 384     3 4 5 Q Q\n 384     2 4 5 Q Q\n 384     2 3 5 Q Q\n 384     2 3 4 Q Q\n 384     J J Q K A      Pair of Jacks\n 384     T J J K A\n 384     9 J J K A\n 384     8 J J K A\n 384     7 J J K A\n 384     6 J J K A\n 384     5 J J K A\n 384     4 J J K A\n 384     3 J J K A\n 384     2 J J K A\n 384     T J J Q A\n 384     9 J J Q A\n 384     8 J J Q A\n 384     7 J J Q A\n 384     6 J J Q A\n 384     5 J J Q A\n 384     4 J J Q A\n 384     3 J J Q A\n 384     2 J J Q A\n 384     9 T J J A\n 384     8 T J J A\n 384     7 T J J A\n 384     6 T J J A\n 384     5 T J J A\n 384     4 T J J A\n 384     3 T J J A\n 384     2 T J J A\n 384     8 9 J J A\n 384     7 9 J J A\n 384     6 9 J J A\n 384     5 9 J J A\n 384     4 9 J J A\n 384     3 9 J J A\n 384     2 9 J J A\n 384     7 8 J J A\n 384     6 8 J J A\n 384     5 8 J J A\n 384     4 8 J J A\n 384     3 8 J J A\n 384     2 8 J J A\n 384     6 7 J J A\n 384     5 7 J J A\n 384     4 7 J J A\n 384     3 7 J J A\n 384     2 7 J J A\n 384     5 6 J J A\n 384     4 6 J J A\n 384     3 6 J J A\n 384     2 6 J J A\n 384     4 5 J J A\n 384     3 5 J J A\n 384     2 5 J J A\n 384     3 4 J J A\n 384     2 4 J J A\n 384     2 3 J J A\n 384     T J J Q K\n 384     9 J J Q K\n 384     8 J J Q K\n 384     7 J J Q K\n 384     6 J J Q K\n 384     5 J J Q K\n 384     4 J J Q K\n 384     3 J J Q K\n 384     2 J J Q K\n 384     9 T J J K\n 384     8 T J J K\n 384     7 T J J K\n 384     6 T J J K\n 384     5 T J J K\n 384     4 T J J K\n 384     3 T J J K\n 384     2 T J J K\n 384     8 9 J J K\n 384     7 9 J J K\n 384     6 9 J J K\n 384     5 9 J J K\n 384     4 9 J J K\n 384     3 9 J J K\n 384     2 9 J J K\n 384     7 8 J J K\n 384     6 8 J J K\n 384     5 8 J J K\n 384     4 8 J J K\n 384     3 8 J J K\n 384     2 8 J J K\n 384     6 7 J J K\n 384     5 7 J J K\n 384     4 7 J J K\n 384     3 7 J J K\n 384     2 7 J J K\n 384     5 6 J J K\n 384     4 6 J J K\n 384     3 6 J J K\n 384     2 6 J J K\n 384     4 5 J J K\n 384     3 5 J J K\n 384     2 5 J J K\n 384     3 4 J J K\n 384     2 4 J J K\n 384     2 3 J J K\n 384     9 T J J Q\n 384     8 T J J Q\n 384     7 T J J Q\n 384     6 T J J Q\n 384     5 T J J Q\n 384     4 T J J Q\n 384     3 T J J Q\n 384     2 T J J Q\n 384     8 9 J J Q\n 384     7 9 J J Q\n 384     6 9 J J Q\n 384     5 9 J J Q\n 384     4 9 J J Q\n 384     3 9 J J Q\n 384     2 9 J J Q\n 384     7 8 J J Q\n 384     6 8 J J Q\n 384     5 8 J J Q\n 384     4 8 J J Q\n 384     3 8 J J Q\n 384     2 8 J J Q\n 384     6 7 J J Q\n 384     5 7 J J Q\n 384     4 7 J J Q\n 384     3 7 J J Q\n 384     2 7 J J Q\n 384     5 6 J J Q\n 384     4 6 J J Q\n 384     3 6 J J Q\n 384     2 6 J J Q\n 384     4 5 J J Q\n 384     3 5 J J Q\n 384     2 5 J J Q\n 384     3 4 J J Q\n 384     2 4 J J Q\n 384     2 3 J J Q\n 384     8 9 T J J\n 384     7 9 T J J\n 384     6 9 T J J\n 384     5 9 T J J\n 384     4 9 T J J\n 384     3 9 T J J\n 384     2 9 T J J\n 384     7 8 T J J\n 384     6 8 T J J\n 384     5 8 T J J\n 384     4 8 T J J\n 384     3 8 T J J\n 384     2 8 T J J\n 384     6 7 T J J\n 384     5 7 T J J\n 384     4 7 T J J\n 384     3 7 T J J\n 384     2 7 T J J\n 384     5 6 T J J\n 384     4 6 T J J\n 384     3 6 T J J\n 384     2 6 T J J\n 384     4 5 T J J\n 384     3 5 T J J\n 384     2 5 T J J\n 384     3 4 T J J\n 384     2 4 T J J\n 384     2 3 T J J\n 384     7 8 9 J J\n 384     6 8 9 J J\n 384     5 8 9 J J\n 384     4 8 9 J J\n 384     3 8 9 J J\n 384     2 8 9 J J\n 384     6 7 9 J J\n 384     5 7 9 J J\n 384     4 7 9 J J\n 384     3 7 9 J J\n 384     2 7 9 J J\n 384     5 6 9 J J\n 384     4 6 9 J J\n 384     3 6 9 J J\n 384     2 6 9 J J\n 384     4 5 9 J J\n 384     3 5 9 J J\n 384     2 5 9 J J\n 384     3 4 9 J J\n 384     2 4 9 J J\n 384     2 3 9 J J\n 384     6 7 8 J J\n 384     5 7 8 J J\n 384     4 7 8 J J\n 384     3 7 8 J J\n 384     2 7 8 J J\n 384     5 6 8 J J\n 384     4 6 8 J J\n 384     3 6 8 J J\n 384     2 6 8 J J\n 384     4 5 8 J J\n 384     3 5 8 J J\n 384     2 5 8 J J\n 384     3 4 8 J J\n 384     2 4 8 J J\n 384     2 3 8 J J\n 384     5 6 7 J J\n 384     4 6 7 J J\n 384     3 6 7 J J\n 384     2 6 7 J J\n 384     4 5 7 J J\n 384     3 5 7 J J\n 384     2 5 7 J J\n 384     3 4 7 J J\n 384     2 4 7 J J\n 384     2 3 7 J J\n 384     4 5 6 J J\n 384     3 5 6 J J\n 384     2 5 6 J J\n 384     3 4 6 J J\n 384     2 4 6 J J\n 384     2 3 6 J J\n 384     3 4 5 J J\n 384     2 4 5 J J\n 384     2 3 5 J J\n 384     2 3 4 J J\n 384     T T Q K A      Pair of Tens\n 384     T T J K A\n 384     9 T T K A\n 384     8 T T K A\n 384     7 T T K A\n 384     6 T T K A\n 384     5 T T K A\n 384     4 T T K A\n 384     3 T T K A\n 384     2 T T K A\n 384     T T J Q A\n 384     9 T T Q A\n 384     8 T T Q A\n 384     7 T T Q A\n 384     6 T T Q A\n 384     5 T T Q A\n 384     4 T T Q A\n 384     3 T T Q A\n 384     2 T T Q A\n 384     9 T T J A\n 384     8 T T J A\n 384     7 T T J A\n 384     6 T T J A\n 384     5 T T J A\n 384     4 T T J A\n 384     3 T T J A\n 384     2 T T J A\n 384     8 9 T T A\n 384     7 9 T T A\n 384     6 9 T T A\n 384     5 9 T T A\n 384     4 9 T T A\n 384     3 9 T T A\n 384     2 9 T T A\n 384     7 8 T T A\n 384     6 8 T T A\n 384     5 8 T T A\n 384     4 8 T T A\n 384     3 8 T T A\n 384     2 8 T T A\n 384     6 7 T T A\n 384     5 7 T T A\n 384     4 7 T T A\n 384     3 7 T T A\n 384     2 7 T T A\n 384     5 6 T T A\n 384     4 6 T T A\n 384     3 6 T T A\n 384     2 6 T T A\n 384     4 5 T T A\n 384     3 5 T T A\n 384     2 5 T T A\n 384     3 4 T T A\n 384     2 4 T T A\n 384     2 3 T T A\n 384     T T J Q K\n 384     9 T T Q K\n 384     8 T T Q K\n 384     7 T T Q K\n 384     6 T T Q K\n 384     5 T T Q K\n 384     4 T T Q K\n 384     3 T T Q K\n 384     2 T T Q K\n 384     9 T T J K\n 384     8 T T J K\n 384     7 T T J K\n 384     6 T T J K\n 384     5 T T J K\n 384     4 T T J K\n 384     3 T T J K\n 384     2 T T J K\n 384     8 9 T T K\n 384     7 9 T T K\n 384     6 9 T T K\n 384     5 9 T T K\n 384     4 9 T T K\n 384     3 9 T T K\n 384     2 9 T T K\n 384     7 8 T T K\n 384     6 8 T T K\n 384     5 8 T T K\n 384     4 8 T T K\n 384     3 8 T T K\n 384     2 8 T T K\n 384     6 7 T T K\n 384     5 7 T T K\n 384     4 7 T T K\n 384     3 7 T T K\n 384     2 7 T T K\n 384     5 6 T T K\n 384     4 6 T T K\n 384     3 6 T T K\n 384     2 6 T T K\n 384     4 5 T T K\n 384     3 5 T T K\n 384     2 5 T T K\n 384     3 4 T T K\n 384     2 4 T T K\n 384     2 3 T T K\n 384     9 T T J Q\n 384     8 T T J Q\n 384     7 T T J Q\n 384     6 T T J Q\n 384     5 T T J Q\n 384     4 T T J Q\n 384     3 T T J Q\n 384     2 T T J Q\n 384     8 9 T T Q\n 384     7 9 T T Q\n 384     6 9 T T Q\n 384     5 9 T T Q\n 384     4 9 T T Q\n 384     3 9 T T Q\n 384     2 9 T T Q\n 384     7 8 T T Q\n 384     6 8 T T Q\n 384     5 8 T T Q\n 384     4 8 T T Q\n 384     3 8 T T Q\n 384     2 8 T T Q\n 384     6 7 T T Q\n 384     5 7 T T Q\n 384     4 7 T T Q\n 384     3 7 T T Q\n 384     2 7 T T Q\n 384     5 6 T T Q\n 384     4 6 T T Q\n 384     3 6 T T Q\n 384     2 6 T T Q\n 384     4 5 T T Q\n 384     3 5 T T Q\n 384     2 5 T T Q\n 384     3 4 T T Q\n 384     2 4 T T Q\n 384     2 3 T T Q\n 384     8 9 T T J\n 384     7 9 T T J\n 384     6 9 T T J\n 384     5 9 T T J\n 384     4 9 T T J\n 384     3 9 T T J\n 384     2 9 T T J\n 384     7 8 T T J\n 384     6 8 T T J\n 384     5 8 T T J\n 384     4 8 T T J\n 384     3 8 T T J\n 384     2 8 T T J\n 384     6 7 T T J\n 384     5 7 T T J\n 384     4 7 T T J\n 384     3 7 T T J\n 384     2 7 T T J\n 384     5 6 T T J\n 384     4 6 T T J\n 384     3 6 T T J\n 384     2 6 T T J\n 384     4 5 T T J\n 384     3 5 T T J\n 384     2 5 T T J\n 384     3 4 T T J\n 384     2 4 T T J\n 384     2 3 T T J\n 384     7 8 9 T T\n 384     6 8 9 T T\n 384     5 8 9 T T\n 384     4 8 9 T T\n 384     3 8 9 T T\n 384     2 8 9 T T\n 384     6 7 9 T T\n 384     5 7 9 T T\n 384     4 7 9 T T\n 384     3 7 9 T T\n 384     2 7 9 T T\n 384     5 6 9 T T\n 384     4 6 9 T T\n 384     3 6 9 T T\n 384     2 6 9 T T\n 384     4 5 9 T T\n 384     3 5 9 T T\n 384     2 5 9 T T\n 384     3 4 9 T T\n 384     2 4 9 T T\n 384     2 3 9 T T\n 384     6 7 8 T T\n 384     5 7 8 T T\n 384     4 7 8 T T\n 384     3 7 8 T T\n 384     2 7 8 T T\n 384     5 6 8 T T\n 384     4 6 8 T T\n 384     3 6 8 T T\n 384     2 6 8 T T\n 384     4 5 8 T T\n 384     3 5 8 T T\n 384     2 5 8 T T\n 384     3 4 8 T T\n 384     2 4 8 T T\n 384     2 3 8 T T\n 384     5 6 7 T T\n 384     4 6 7 T T\n 384     3 6 7 T T\n 384     2 6 7 T T\n 384     4 5 7 T T\n 384     3 5 7 T T\n 384     2 5 7 T T\n 384     3 4 7 T T\n 384     2 4 7 T T\n 384     2 3 7 T T\n 384     4 5 6 T T\n 384     3 5 6 T T\n 384     2 5 6 T T\n 384     3 4 6 T T\n 384     2 4 6 T T\n 384     2 3 6 T T\n 384     3 4 5 T T\n 384     2 4 5 T T\n 384     2 3 5 T T\n 384     2 3 4 T T\n 384     9 9 Q K A      Pair of Nines\n 384     9 9 J K A\n 384     9 9 T K A\n 384     8 9 9 K A\n 384     7 9 9 K A\n 384     6 9 9 K A\n 384     5 9 9 K A\n 384     4 9 9 K A\n 384     3 9 9 K A\n 384     2 9 9 K A\n 384     9 9 J Q A\n 384     9 9 T Q A\n 384     8 9 9 Q A\n 384     7 9 9 Q A\n 384     6 9 9 Q A\n 384     5 9 9 Q A\n 384     4 9 9 Q A\n 384     3 9 9 Q A\n 384     2 9 9 Q A\n 384     9 9 T J A\n 384     8 9 9 J A\n 384     7 9 9 J A\n 384     6 9 9 J A\n 384     5 9 9 J A\n 384     4 9 9 J A\n 384     3 9 9 J A\n 384     2 9 9 J A\n 384     8 9 9 T A\n 384     7 9 9 T A\n 384     6 9 9 T A\n 384     5 9 9 T A\n 384     4 9 9 T A\n 384     3 9 9 T A\n 384     2 9 9 T A\n 384     7 8 9 9 A\n 384     6 8 9 9 A\n 384     5 8 9 9 A\n 384     4 8 9 9 A\n 384     3 8 9 9 A\n 384     2 8 9 9 A\n 384     6 7 9 9 A\n 384     5 7 9 9 A\n 384     4 7 9 9 A\n 384     3 7 9 9 A\n 384     2 7 9 9 A\n 384     5 6 9 9 A\n 384     4 6 9 9 A\n 384     3 6 9 9 A\n 384     2 6 9 9 A\n 384     4 5 9 9 A\n 384     3 5 9 9 A\n 384     2 5 9 9 A\n 384     3 4 9 9 A\n 384     2 4 9 9 A\n 384     2 3 9 9 A\n 384     9 9 J Q K\n 384     9 9 T Q K\n 384     8 9 9 Q K\n 384     7 9 9 Q K\n 384     6 9 9 Q K\n 384     5 9 9 Q K\n 384     4 9 9 Q K\n 384     3 9 9 Q K\n 384     2 9 9 Q K\n 384     9 9 T J K\n 384     8 9 9 J K\n 384     7 9 9 J K\n 384     6 9 9 J K\n 384     5 9 9 J K\n 384     4 9 9 J K\n 384     3 9 9 J K\n 384     2 9 9 J K\n 384     8 9 9 T K\n 384     7 9 9 T K\n 384     6 9 9 T K\n 384     5 9 9 T K\n 384     4 9 9 T K\n 384     3 9 9 T K\n 384     2 9 9 T K\n 384     7 8 9 9 K\n 384     6 8 9 9 K\n 384     5 8 9 9 K\n 384     4 8 9 9 K\n 384     3 8 9 9 K\n 384     2 8 9 9 K\n 384     6 7 9 9 K\n 384     5 7 9 9 K\n 384     4 7 9 9 K\n 384     3 7 9 9 K\n 384     2 7 9 9 K\n 384     5 6 9 9 K\n 384     4 6 9 9 K\n 384     3 6 9 9 K\n 384     2 6 9 9 K\n 384     4 5 9 9 K\n 384     3 5 9 9 K\n 384     2 5 9 9 K\n 384     3 4 9 9 K\n 384     2 4 9 9 K\n 384     2 3 9 9 K\n 384     9 9 T J Q\n 384     8 9 9 J Q\n 384     7 9 9 J Q\n 384     6 9 9 J Q\n 384     5 9 9 J Q\n 384     4 9 9 J Q\n 384     3 9 9 J Q\n 384     2 9 9 J Q\n 384     8 9 9 T Q\n 384     7 9 9 T Q\n 384     6 9 9 T Q\n 384     5 9 9 T Q\n 384     4 9 9 T Q\n 384     3 9 9 T Q\n 384     2 9 9 T Q\n 384     7 8 9 9 Q\n 384     6 8 9 9 Q\n 384     5 8 9 9 Q\n 384     4 8 9 9 Q\n 384     3 8 9 9 Q\n 384     2 8 9 9 Q\n 384     6 7 9 9 Q\n 384     5 7 9 9 Q\n 384     4 7 9 9 Q\n 384     3 7 9 9 Q\n 384     2 7 9 9 Q\n 384     5 6 9 9 Q\n 384     4 6 9 9 Q\n 384     3 6 9 9 Q\n 384     2 6 9 9 Q\n 384     4 5 9 9 Q\n 384     3 5 9 9 Q\n 384     2 5 9 9 Q\n 384     3 4 9 9 Q\n 384     2 4 9 9 Q\n 384     2 3 9 9 Q\n 384     8 9 9 T J\n 384     7 9 9 T J\n 384     6 9 9 T J\n 384     5 9 9 T J\n 384     4 9 9 T J\n 384     3 9 9 T J\n 384     2 9 9 T J\n 384     7 8 9 9 J\n 384     6 8 9 9 J\n 384     5 8 9 9 J\n 384     4 8 9 9 J\n 384     3 8 9 9 J\n 384     2 8 9 9 J\n 384     6 7 9 9 J\n 384     5 7 9 9 J\n 384     4 7 9 9 J\n 384     3 7 9 9 J\n 384     2 7 9 9 J\n 384     5 6 9 9 J\n 384     4 6 9 9 J\n 384     3 6 9 9 J\n 384     2 6 9 9 J\n 384     4 5 9 9 J\n 384     3 5 9 9 J\n 384     2 5 9 9 J\n 384     3 4 9 9 J\n 384     2 4 9 9 J\n 384     2 3 9 9 J\n 384     7 8 9 9 T\n 384     6 8 9 9 T\n 384     5 8 9 9 T\n 384     4 8 9 9 T\n 384     3 8 9 9 T\n 384     2 8 9 9 T\n 384     6 7 9 9 T\n 384     5 7 9 9 T\n 384     4 7 9 9 T\n 384     3 7 9 9 T\n 384     2 7 9 9 T\n 384     5 6 9 9 T\n 384     4 6 9 9 T\n 384     3 6 9 9 T\n 384     2 6 9 9 T\n 384     4 5 9 9 T\n 384     3 5 9 9 T\n 384     2 5 9 9 T\n 384     3 4 9 9 T\n 384     2 4 9 9 T\n 384     2 3 9 9 T\n 384     6 7 8 9 9\n 384     5 7 8 9 9\n 384     4 7 8 9 9\n 384     3 7 8 9 9\n 384     2 7 8 9 9\n 384     5 6 8 9 9\n 384     4 6 8 9 9\n 384     3 6 8 9 9\n 384     2 6 8 9 9\n 384     4 5 8 9 9\n 384     3 5 8 9 9\n 384     2 5 8 9 9\n 384     3 4 8 9 9\n 384     2 4 8 9 9\n 384     2 3 8 9 9\n 384     5 6 7 9 9\n 384     4 6 7 9 9\n 384     3 6 7 9 9\n 384     2 6 7 9 9\n 384     4 5 7 9 9\n 384     3 5 7 9 9\n 384     2 5 7 9 9\n 384     3 4 7 9 9\n 384     2 4 7 9 9\n 384     2 3 7 9 9\n 384     4 5 6 9 9\n 384     3 5 6 9 9\n 384     2 5 6 9 9\n 384     3 4 6 9 9\n 384     2 4 6 9 9\n 384     2 3 6 9 9\n 384     3 4 5 9 9\n 384     2 4 5 9 9\n 384     2 3 5 9 9\n 384     2 3 4 9 9\n 384     8 8 Q K A      Pair of Eights\n 384     8 8 J K A\n 384     8 8 T K A\n 384     8 8 9 K A\n 384     7 8 8 K A\n 384     6 8 8 K A\n 384     5 8 8 K A\n 384     4 8 8 K A\n 384     3 8 8 K A\n 384     2 8 8 K A\n 384     8 8 J Q A\n 384     8 8 T Q A\n 384     8 8 9 Q A\n 384     7 8 8 Q A\n 384     6 8 8 Q A\n 384     5 8 8 Q A\n 384     4 8 8 Q A\n 384     3 8 8 Q A\n 384     2 8 8 Q A\n 384     8 8 T J A\n 384     8 8 9 J A\n 384     7 8 8 J A\n 384     6 8 8 J A\n 384     5 8 8 J A\n 384     4 8 8 J A\n 384     3 8 8 J A\n 384     2 8 8 J A\n 384     8 8 9 T A\n 384     7 8 8 T A\n 384     6 8 8 T A\n 384     5 8 8 T A\n 384     4 8 8 T A\n 384     3 8 8 T A\n 384     2 8 8 T A\n 384     7 8 8 9 A\n 384     6 8 8 9 A\n 384     5 8 8 9 A\n 384     4 8 8 9 A\n 384     3 8 8 9 A\n 384     2 8 8 9 A\n 384     6 7 8 8 A\n 384     5 7 8 8 A\n 384     4 7 8 8 A\n 384     3 7 8 8 A\n 384     2 7 8 8 A\n 384     5 6 8 8 A\n 384     4 6 8 8 A\n 384     3 6 8 8 A\n 384     2 6 8 8 A\n 384     4 5 8 8 A\n 384     3 5 8 8 A\n 384     2 5 8 8 A\n 384     3 4 8 8 A\n 384     2 4 8 8 A\n 384     2 3 8 8 A\n 384     8 8 J Q K\n 384     8 8 T Q K\n 384     8 8 9 Q K\n 384     7 8 8 Q K\n 384     6 8 8 Q K\n 384     5 8 8 Q K\n 384     4 8 8 Q K\n 384     3 8 8 Q K\n 384     2 8 8 Q K\n 384     8 8 T J K\n 384     8 8 9 J K\n 384     7 8 8 J K\n 384     6 8 8 J K\n 384     5 8 8 J K\n 384     4 8 8 J K\n 384     3 8 8 J K\n 384     2 8 8 J K\n 384     8 8 9 T K\n 384     7 8 8 T K\n 384     6 8 8 T K\n 384     5 8 8 T K\n 384     4 8 8 T K\n 384     3 8 8 T K\n 384     2 8 8 T K\n 384     7 8 8 9 K\n 384     6 8 8 9 K\n 384     5 8 8 9 K\n 384     4 8 8 9 K\n 384     3 8 8 9 K\n 384     2 8 8 9 K\n 384     6 7 8 8 K\n 384     5 7 8 8 K\n 384     4 7 8 8 K\n 384     3 7 8 8 K\n 384     2 7 8 8 K\n 384     5 6 8 8 K\n 384     4 6 8 8 K\n 384     3 6 8 8 K\n 384     2 6 8 8 K\n 384     4 5 8 8 K\n 384     3 5 8 8 K\n 384     2 5 8 8 K\n 384     3 4 8 8 K\n 384     2 4 8 8 K\n 384     2 3 8 8 K\n 384     8 8 T J Q\n 384     8 8 9 J Q\n 384     7 8 8 J Q\n 384     6 8 8 J Q\n 384     5 8 8 J Q\n 384     4 8 8 J Q\n 384     3 8 8 J Q\n 384     2 8 8 J Q\n 384     8 8 9 T Q\n 384     7 8 8 T Q\n 384     6 8 8 T Q\n 384     5 8 8 T Q\n 384     4 8 8 T Q\n 384     3 8 8 T Q\n 384     2 8 8 T Q\n 384     7 8 8 9 Q\n 384     6 8 8 9 Q\n 384     5 8 8 9 Q\n 384     4 8 8 9 Q\n 384     3 8 8 9 Q\n 384     2 8 8 9 Q\n 384     6 7 8 8 Q\n 384     5 7 8 8 Q\n 384     4 7 8 8 Q\n 384     3 7 8 8 Q\n 384     2 7 8 8 Q\n 384     5 6 8 8 Q\n 384     4 6 8 8 Q\n 384     3 6 8 8 Q\n 384     2 6 8 8 Q\n 384     4 5 8 8 Q\n 384     3 5 8 8 Q\n 384     2 5 8 8 Q\n 384     3 4 8 8 Q\n 384     2 4 8 8 Q\n 384     2 3 8 8 Q\n 384     8 8 9 T J\n 384     7 8 8 T J\n 384     6 8 8 T J\n 384     5 8 8 T J\n 384     4 8 8 T J\n 384     3 8 8 T J\n 384     2 8 8 T J\n 384     7 8 8 9 J\n 384     6 8 8 9 J\n 384     5 8 8 9 J\n 384     4 8 8 9 J\n 384     3 8 8 9 J\n 384     2 8 8 9 J\n 384     6 7 8 8 J\n 384     5 7 8 8 J\n 384     4 7 8 8 J\n 384     3 7 8 8 J\n 384     2 7 8 8 J\n 384     5 6 8 8 J\n 384     4 6 8 8 J\n 384     3 6 8 8 J\n 384     2 6 8 8 J\n 384     4 5 8 8 J\n 384     3 5 8 8 J\n 384     2 5 8 8 J\n 384     3 4 8 8 J\n 384     2 4 8 8 J\n 384     2 3 8 8 J\n 384     7 8 8 9 T\n 384     6 8 8 9 T\n 384     5 8 8 9 T\n 384     4 8 8 9 T\n 384     3 8 8 9 T\n 384     2 8 8 9 T\n 384     6 7 8 8 T\n 384     5 7 8 8 T\n 384     4 7 8 8 T\n 384     3 7 8 8 T\n 384     2 7 8 8 T\n 384     5 6 8 8 T\n 384     4 6 8 8 T\n 384     3 6 8 8 T\n 384     2 6 8 8 T\n 384     4 5 8 8 T\n 384     3 5 8 8 T\n 384     2 5 8 8 T\n 384     3 4 8 8 T\n 384     2 4 8 8 T\n 384     2 3 8 8 T\n 384     6 7 8 8 9\n 384     5 7 8 8 9\n 384     4 7 8 8 9\n 384     3 7 8 8 9\n 384     2 7 8 8 9\n 384     5 6 8 8 9\n 384     4 6 8 8 9\n 384     3 6 8 8 9\n 384     2 6 8 8 9\n 384     4 5 8 8 9\n 384     3 5 8 8 9\n 384     2 5 8 8 9\n 384     3 4 8 8 9\n 384     2 4 8 8 9\n 384     2 3 8 8 9\n 384     5 6 7 8 8\n 384     4 6 7 8 8\n 384     3 6 7 8 8\n 384     2 6 7 8 8\n 384     4 5 7 8 8\n 384     3 5 7 8 8\n 384     2 5 7 8 8\n 384     3 4 7 8 8\n 384     2 4 7 8 8\n 384     2 3 7 8 8\n 384     4 5 6 8 8\n 384     3 5 6 8 8\n 384     2 5 6 8 8\n 384     3 4 6 8 8\n 384     2 4 6 8 8\n 384     2 3 6 8 8\n 384     3 4 5 8 8\n 384     2 4 5 8 8\n 384     2 3 5 8 8\n 384     2 3 4 8 8\n 384     7 7 Q K A      Pair of Sevens\n 384     7 7 J K A\n 384     7 7 T K A\n 384     7 7 9 K A\n 384     7 7 8 K A\n 384     6 7 7 K A\n 384     5 7 7 K A\n 384     4 7 7 K A\n 384     3 7 7 K A\n 384     2 7 7 K A\n 384     7 7 J Q A\n 384     7 7 T Q A\n 384     7 7 9 Q A\n 384     7 7 8 Q A\n 384     6 7 7 Q A\n 384     5 7 7 Q A\n 384     4 7 7 Q A\n 384     3 7 7 Q A\n 384     2 7 7 Q A\n 384     7 7 T J A\n 384     7 7 9 J A\n 384     7 7 8 J A\n 384     6 7 7 J A\n 384     5 7 7 J A\n 384     4 7 7 J A\n 384     3 7 7 J A\n 384     2 7 7 J A\n 384     7 7 9 T A\n 384     7 7 8 T A\n 384     6 7 7 T A\n 384     5 7 7 T A\n 384     4 7 7 T A\n 384     3 7 7 T A\n 384     2 7 7 T A\n 384     7 7 8 9 A\n 384     6 7 7 9 A\n 384     5 7 7 9 A\n 384     4 7 7 9 A\n 384     3 7 7 9 A\n 384     2 7 7 9 A\n 384     6 7 7 8 A\n 384     5 7 7 8 A\n 384     4 7 7 8 A\n 384     3 7 7 8 A\n 384     2 7 7 8 A\n 384     5 6 7 7 A\n 384     4 6 7 7 A\n 384     3 6 7 7 A\n 384     2 6 7 7 A\n 384     4 5 7 7 A\n 384     3 5 7 7 A\n 384     2 5 7 7 A\n 384     3 4 7 7 A\n 384     2 4 7 7 A\n 384     2 3 7 7 A\n 384     7 7 J Q K\n 384     7 7 T Q K\n 384     7 7 9 Q K\n 384     7 7 8 Q K\n 384     6 7 7 Q K\n 384     5 7 7 Q K\n 384     4 7 7 Q K\n 384     3 7 7 Q K\n 384     2 7 7 Q K\n 384     7 7 T J K\n 384     7 7 9 J K\n 384     7 7 8 J K\n 384     6 7 7 J K\n 384     5 7 7 J K\n 384     4 7 7 J K\n 384     3 7 7 J K\n 384     2 7 7 J K\n 384     7 7 9 T K\n 384     7 7 8 T K\n 384     6 7 7 T K\n 384     5 7 7 T K\n 384     4 7 7 T K\n 384     3 7 7 T K\n 384     2 7 7 T K\n 384     7 7 8 9 K\n 384     6 7 7 9 K\n 384     5 7 7 9 K\n 384     4 7 7 9 K\n 384     3 7 7 9 K\n 384     2 7 7 9 K\n 384     6 7 7 8 K\n 384     5 7 7 8 K\n 384     4 7 7 8 K\n 384     3 7 7 8 K\n 384     2 7 7 8 K\n 384     5 6 7 7 K\n 384     4 6 7 7 K\n 384     3 6 7 7 K\n 384     2 6 7 7 K\n 384     4 5 7 7 K\n 384     3 5 7 7 K\n 384     2 5 7 7 K\n 384     3 4 7 7 K\n 384     2 4 7 7 K\n 384     2 3 7 7 K\n 384     7 7 T J Q\n 384     7 7 9 J Q\n 384     7 7 8 J Q\n 384     6 7 7 J Q\n 384     5 7 7 J Q\n 384     4 7 7 J Q\n 384     3 7 7 J Q\n 384     2 7 7 J Q\n 384     7 7 9 T Q\n 384     7 7 8 T Q\n 384     6 7 7 T Q\n 384     5 7 7 T Q\n 384     4 7 7 T Q\n 384     3 7 7 T Q\n 384     2 7 7 T Q\n 384     7 7 8 9 Q\n 384     6 7 7 9 Q\n 384     5 7 7 9 Q\n 384     4 7 7 9 Q\n 384     3 7 7 9 Q\n 384     2 7 7 9 Q\n 384     6 7 7 8 Q\n 384     5 7 7 8 Q\n 384     4 7 7 8 Q\n 384     3 7 7 8 Q\n 384     2 7 7 8 Q\n 384     5 6 7 7 Q\n 384     4 6 7 7 Q\n 384     3 6 7 7 Q\n 384     2 6 7 7 Q\n 384     4 5 7 7 Q\n 384     3 5 7 7 Q\n 384     2 5 7 7 Q\n 384     3 4 7 7 Q\n 384     2 4 7 7 Q\n 384     2 3 7 7 Q\n 384     7 7 9 T J\n 384     7 7 8 T J\n 384     6 7 7 T J\n 384     5 7 7 T J\n 384     4 7 7 T J\n 384     3 7 7 T J\n 384     2 7 7 T J\n 384     7 7 8 9 J\n 384     6 7 7 9 J\n 384     5 7 7 9 J\n 384     4 7 7 9 J\n 384     3 7 7 9 J\n 384     2 7 7 9 J\n 384     6 7 7 8 J\n 384     5 7 7 8 J\n 384     4 7 7 8 J\n 384     3 7 7 8 J\n 384     2 7 7 8 J\n 384     5 6 7 7 J\n 384     4 6 7 7 J\n 384     3 6 7 7 J\n 384     2 6 7 7 J\n 384     4 5 7 7 J\n 384     3 5 7 7 J\n 384     2 5 7 7 J\n 384     3 4 7 7 J\n 384     2 4 7 7 J\n 384     2 3 7 7 J\n 384     7 7 8 9 T\n 384     6 7 7 9 T\n 384     5 7 7 9 T\n 384     4 7 7 9 T\n 384     3 7 7 9 T\n 384     2 7 7 9 T\n 384     6 7 7 8 T\n 384     5 7 7 8 T\n 384     4 7 7 8 T\n 384     3 7 7 8 T\n 384     2 7 7 8 T\n 384     5 6 7 7 T\n 384     4 6 7 7 T\n 384     3 6 7 7 T\n 384     2 6 7 7 T\n 384     4 5 7 7 T\n 384     3 5 7 7 T\n 384     2 5 7 7 T\n 384     3 4 7 7 T\n 384     2 4 7 7 T\n 384     2 3 7 7 T\n 384     6 7 7 8 9\n 384     5 7 7 8 9\n 384     4 7 7 8 9\n 384     3 7 7 8 9\n 384     2 7 7 8 9\n 384     5 6 7 7 9\n 384     4 6 7 7 9\n 384     3 6 7 7 9\n 384     2 6 7 7 9\n 384     4 5 7 7 9\n 384     3 5 7 7 9\n 384     2 5 7 7 9\n 384     3 4 7 7 9\n 384     2 4 7 7 9\n 384     2 3 7 7 9\n 384     5 6 7 7 8\n 384     4 6 7 7 8\n 384     3 6 7 7 8\n 384     2 6 7 7 8\n 384     4 5 7 7 8\n 384     3 5 7 7 8\n 384     2 5 7 7 8\n 384     3 4 7 7 8\n 384     2 4 7 7 8\n 384     2 3 7 7 8\n 384     4 5 6 7 7\n 384     3 5 6 7 7\n 384     2 5 6 7 7\n 384     3 4 6 7 7\n 384     2 4 6 7 7\n 384     2 3 6 7 7\n 384     3 4 5 7 7\n 384     2 4 5 7 7\n 384     2 3 5 7 7\n 384     2 3 4 7 7\n 384     6 6 Q K A      Pair of Sixes\n 384     6 6 J K A\n 384     6 6 T K A\n 384     6 6 9 K A\n 384     6 6 8 K A\n 384     6 6 7 K A\n 384     5 6 6 K A\n 384     4 6 6 K A\n 384     3 6 6 K A\n 384     2 6 6 K A\n 384     6 6 J Q A\n 384     6 6 T Q A\n 384     6 6 9 Q A\n 384     6 6 8 Q A\n 384     6 6 7 Q A\n 384     5 6 6 Q A\n 384     4 6 6 Q A\n 384     3 6 6 Q A\n 384     2 6 6 Q A\n 384     6 6 T J A\n 384     6 6 9 J A\n 384     6 6 8 J A\n 384     6 6 7 J A\n 384     5 6 6 J A\n 384     4 6 6 J A\n 384     3 6 6 J A\n 384     2 6 6 J A\n 384     6 6 9 T A\n 384     6 6 8 T A\n 384     6 6 7 T A\n 384     5 6 6 T A\n 384     4 6 6 T A\n 384     3 6 6 T A\n 384     2 6 6 T A\n 384     6 6 8 9 A\n 384     6 6 7 9 A\n 384     5 6 6 9 A\n 384     4 6 6 9 A\n 384     3 6 6 9 A\n 384     2 6 6 9 A\n 384     6 6 7 8 A\n 384     5 6 6 8 A\n 384     4 6 6 8 A\n 384     3 6 6 8 A\n 384     2 6 6 8 A\n 384     5 6 6 7 A\n 384     4 6 6 7 A\n 384     3 6 6 7 A\n 384     2 6 6 7 A\n 384     4 5 6 6 A\n 384     3 5 6 6 A\n 384     2 5 6 6 A\n 384     3 4 6 6 A\n 384     2 4 6 6 A\n 384     2 3 6 6 A\n 384     6 6 J Q K\n 384     6 6 T Q K\n 384     6 6 9 Q K\n 384     6 6 8 Q K\n 384     6 6 7 Q K\n 384     5 6 6 Q K\n 384     4 6 6 Q K\n 384     3 6 6 Q K\n 384     2 6 6 Q K\n 384     6 6 T J K\n 384     6 6 9 J K\n 384     6 6 8 J K\n 384     6 6 7 J K\n 384     5 6 6 J K\n 384     4 6 6 J K\n 384     3 6 6 J K\n 384     2 6 6 J K\n 384     6 6 9 T K\n 384     6 6 8 T K\n 384     6 6 7 T K\n 384     5 6 6 T K\n 384     4 6 6 T K\n 384     3 6 6 T K\n 384     2 6 6 T K\n 384     6 6 8 9 K\n 384     6 6 7 9 K\n 384     5 6 6 9 K\n 384     4 6 6 9 K\n 384     3 6 6 9 K\n 384     2 6 6 9 K\n 384     6 6 7 8 K\n 384     5 6 6 8 K\n 384     4 6 6 8 K\n 384     3 6 6 8 K\n 384     2 6 6 8 K\n 384     5 6 6 7 K\n 384     4 6 6 7 K\n 384     3 6 6 7 K\n 384     2 6 6 7 K\n 384     4 5 6 6 K\n 384     3 5 6 6 K\n 384     2 5 6 6 K\n 384     3 4 6 6 K\n 384     2 4 6 6 K\n 384     2 3 6 6 K\n 384     6 6 T J Q\n 384     6 6 9 J Q\n 384     6 6 8 J Q\n 384     6 6 7 J Q\n 384     5 6 6 J Q\n 384     4 6 6 J Q\n 384     3 6 6 J Q\n 384     2 6 6 J Q\n 384     6 6 9 T Q\n 384     6 6 8 T Q\n 384     6 6 7 T Q\n 384     5 6 6 T Q\n 384     4 6 6 T Q\n 384     3 6 6 T Q\n 384     2 6 6 T Q\n 384     6 6 8 9 Q\n 384     6 6 7 9 Q\n 384     5 6 6 9 Q\n 384     4 6 6 9 Q\n 384     3 6 6 9 Q\n 384     2 6 6 9 Q\n 384     6 6 7 8 Q\n 384     5 6 6 8 Q\n 384     4 6 6 8 Q\n 384     3 6 6 8 Q\n 384     2 6 6 8 Q\n 384     5 6 6 7 Q\n 384     4 6 6 7 Q\n 384     3 6 6 7 Q\n 384     2 6 6 7 Q\n 384     4 5 6 6 Q\n 384     3 5 6 6 Q\n 384     2 5 6 6 Q\n 384     3 4 6 6 Q\n 384     2 4 6 6 Q\n 384     2 3 6 6 Q\n 384     6 6 9 T J\n 384     6 6 8 T J\n 384     6 6 7 T J\n 384     5 6 6 T J\n 384     4 6 6 T J\n 384     3 6 6 T J\n 384     2 6 6 T J\n 384     6 6 8 9 J\n 384     6 6 7 9 J\n 384     5 6 6 9 J\n 384     4 6 6 9 J\n 384     3 6 6 9 J\n 384     2 6 6 9 J\n 384     6 6 7 8 J\n 384     5 6 6 8 J\n 384     4 6 6 8 J\n 384     3 6 6 8 J\n 384     2 6 6 8 J\n 384     5 6 6 7 J\n 384     4 6 6 7 J\n 384     3 6 6 7 J\n 384     2 6 6 7 J\n 384     4 5 6 6 J\n 384     3 5 6 6 J\n 384     2 5 6 6 J\n 384     3 4 6 6 J\n 384     2 4 6 6 J\n 384     2 3 6 6 J\n 384     6 6 8 9 T\n 384     6 6 7 9 T\n 384     5 6 6 9 T\n 384     4 6 6 9 T\n 384     3 6 6 9 T\n 384     2 6 6 9 T\n 384     6 6 7 8 T\n 384     5 6 6 8 T\n 384     4 6 6 8 T\n 384     3 6 6 8 T\n 384     2 6 6 8 T\n 384     5 6 6 7 T\n 384     4 6 6 7 T\n 384     3 6 6 7 T\n 384     2 6 6 7 T\n 384     4 5 6 6 T\n 384     3 5 6 6 T\n 384     2 5 6 6 T\n 384     3 4 6 6 T\n 384     2 4 6 6 T\n 384     2 3 6 6 T\n 384     6 6 7 8 9\n 384     5 6 6 8 9\n 384     4 6 6 8 9\n 384     3 6 6 8 9\n 384     2 6 6 8 9\n 384     5 6 6 7 9\n 384     4 6 6 7 9\n 384     3 6 6 7 9\n 384     2 6 6 7 9\n 384     4 5 6 6 9\n 384     3 5 6 6 9\n 384     2 5 6 6 9\n 384     3 4 6 6 9\n 384     2 4 6 6 9\n 384     2 3 6 6 9\n 384     5 6 6 7 8\n 384     4 6 6 7 8\n 384     3 6 6 7 8\n 384     2 6 6 7 8\n 384     4 5 6 6 8\n 384     3 5 6 6 8\n 384     2 5 6 6 8\n 384     3 4 6 6 8\n 384     2 4 6 6 8\n 384     2 3 6 6 8\n 384     4 5 6 6 7\n 384     3 5 6 6 7\n 384     2 5 6 6 7\n 384     3 4 6 6 7\n 384     2 4 6 6 7\n 384     2 3 6 6 7\n 384     3 4 5 6 6\n 384     2 4 5 6 6\n 384     2 3 5 6 6\n 384     2 3 4 6 6\n 384     5 5 Q K A      Pair of Fives\n 384     5 5 J K A\n 384     5 5 T K A\n 384     5 5 9 K A\n 384     5 5 8 K A\n 384     5 5 7 K A\n 384     5 5 6 K A\n 384     4 5 5 K A\n 384     3 5 5 K A\n 384     2 5 5 K A\n 384     5 5 J Q A\n 384     5 5 T Q A\n 384     5 5 9 Q A\n 384     5 5 8 Q A\n 384     5 5 7 Q A\n 384     5 5 6 Q A\n 384     4 5 5 Q A\n 384     3 5 5 Q A\n 384     2 5 5 Q A\n 384     5 5 T J A\n 384     5 5 9 J A\n 384     5 5 8 J A\n 384     5 5 7 J A\n 384     5 5 6 J A\n 384     4 5 5 J A\n 384     3 5 5 J A\n 384     2 5 5 J A\n 384     5 5 9 T A\n 384     5 5 8 T A\n 384     5 5 7 T A\n 384     5 5 6 T A\n 384     4 5 5 T A\n 384     3 5 5 T A\n 384     2 5 5 T A\n 384     5 5 8 9 A\n 384     5 5 7 9 A\n 384     5 5 6 9 A\n 384     4 5 5 9 A\n 384     3 5 5 9 A\n 384     2 5 5 9 A\n 384     5 5 7 8 A\n 384     5 5 6 8 A\n 384     4 5 5 8 A\n 384     3 5 5 8 A\n 384     2 5 5 8 A\n 384     5 5 6 7 A\n 384     4 5 5 7 A\n 384     3 5 5 7 A\n 384     2 5 5 7 A\n 384     4 5 5 6 A\n 384     3 5 5 6 A\n 384     2 5 5 6 A\n 384     3 4 5 5 A\n 384     2 4 5 5 A\n 384     2 3 5 5 A\n 384     5 5 J Q K\n 384     5 5 T Q K\n 384     5 5 9 Q K\n 384     5 5 8 Q K\n 384     5 5 7 Q K\n 384     5 5 6 Q K\n 384     4 5 5 Q K\n 384     3 5 5 Q K\n 384     2 5 5 Q K\n 384     5 5 T J K\n 384     5 5 9 J K\n 384     5 5 8 J K\n 384     5 5 7 J K\n 384     5 5 6 J K\n 384     4 5 5 J K\n 384     3 5 5 J K\n 384     2 5 5 J K\n 384     5 5 9 T K\n 384     5 5 8 T K\n 384     5 5 7 T K\n 384     5 5 6 T K\n 384     4 5 5 T K\n 384     3 5 5 T K\n 384     2 5 5 T K\n 384     5 5 8 9 K\n 384     5 5 7 9 K\n 384     5 5 6 9 K\n 384     4 5 5 9 K\n 384     3 5 5 9 K\n 384     2 5 5 9 K\n 384     5 5 7 8 K\n 384     5 5 6 8 K\n 384     4 5 5 8 K\n 384     3 5 5 8 K\n 384     2 5 5 8 K\n 384     5 5 6 7 K\n 384     4 5 5 7 K\n 384     3 5 5 7 K\n 384     2 5 5 7 K\n 384     4 5 5 6 K\n 384     3 5 5 6 K\n 384     2 5 5 6 K\n 384     3 4 5 5 K\n 384     2 4 5 5 K\n 384     2 3 5 5 K\n 384     5 5 T J Q\n 384     5 5 9 J Q\n 384     5 5 8 J Q\n 384     5 5 7 J Q\n 384     5 5 6 J Q\n 384     4 5 5 J Q\n 384     3 5 5 J Q\n 384     2 5 5 J Q\n 384     5 5 9 T Q\n 384     5 5 8 T Q\n 384     5 5 7 T Q\n 384     5 5 6 T Q\n 384     4 5 5 T Q\n 384     3 5 5 T Q\n 384     2 5 5 T Q\n 384     5 5 8 9 Q\n 384     5 5 7 9 Q\n 384     5 5 6 9 Q\n 384     4 5 5 9 Q\n 384     3 5 5 9 Q\n 384     2 5 5 9 Q\n 384     5 5 7 8 Q\n 384     5 5 6 8 Q\n 384     4 5 5 8 Q\n 384     3 5 5 8 Q\n 384     2 5 5 8 Q\n 384     5 5 6 7 Q\n 384     4 5 5 7 Q\n 384     3 5 5 7 Q\n 384     2 5 5 7 Q\n 384     4 5 5 6 Q\n 384     3 5 5 6 Q\n 384     2 5 5 6 Q\n 384     3 4 5 5 Q\n 384     2 4 5 5 Q\n 384     2 3 5 5 Q\n 384     5 5 9 T J\n 384     5 5 8 T J\n 384     5 5 7 T J\n 384     5 5 6 T J\n 384     4 5 5 T J\n 384     3 5 5 T J\n 384     2 5 5 T J\n 384     5 5 8 9 J\n 384     5 5 7 9 J\n 384     5 5 6 9 J\n 384     4 5 5 9 J\n 384     3 5 5 9 J\n 384     2 5 5 9 J\n 384     5 5 7 8 J\n 384     5 5 6 8 J\n 384     4 5 5 8 J\n 384     3 5 5 8 J\n 384     2 5 5 8 J\n 384     5 5 6 7 J\n 384     4 5 5 7 J\n 384     3 5 5 7 J\n 384     2 5 5 7 J\n 384     4 5 5 6 J\n 384     3 5 5 6 J\n 384     2 5 5 6 J\n 384     3 4 5 5 J\n 384     2 4 5 5 J\n 384     2 3 5 5 J\n 384     5 5 8 9 T\n 384     5 5 7 9 T\n 384     5 5 6 9 T\n 384     4 5 5 9 T\n 384     3 5 5 9 T\n 384     2 5 5 9 T\n 384     5 5 7 8 T\n 384     5 5 6 8 T\n 384     4 5 5 8 T\n 384     3 5 5 8 T\n 384     2 5 5 8 T\n 384     5 5 6 7 T\n 384     4 5 5 7 T\n 384     3 5 5 7 T\n 384     2 5 5 7 T\n 384     4 5 5 6 T\n 384     3 5 5 6 T\n 384     2 5 5 6 T\n 384     3 4 5 5 T\n 384     2 4 5 5 T\n 384     2 3 5 5 T\n 384     5 5 7 8 9\n 384     5 5 6 8 9\n 384     4 5 5 8 9\n 384     3 5 5 8 9\n 384     2 5 5 8 9\n 384     5 5 6 7 9\n 384     4 5 5 7 9\n 384     3 5 5 7 9\n 384     2 5 5 7 9\n 384     4 5 5 6 9\n 384     3 5 5 6 9\n 384     2 5 5 6 9\n 384     3 4 5 5 9\n 384     2 4 5 5 9\n 384     2 3 5 5 9\n 384     5 5 6 7 8\n 384     4 5 5 7 8\n 384     3 5 5 7 8\n 384     2 5 5 7 8\n 384     4 5 5 6 8\n 384     3 5 5 6 8\n 384     2 5 5 6 8\n 384     3 4 5 5 8\n 384     2 4 5 5 8\n 384     2 3 5 5 8\n 384     4 5 5 6 7\n 384     3 5 5 6 7\n 384     2 5 5 6 7\n 384     3 4 5 5 7\n 384     2 4 5 5 7\n 384     2 3 5 5 7\n 384     3 4 5 5 6\n 384     2 4 5 5 6\n 384     2 3 5 5 6\n 384     2 3 4 5 5\n 384     4 4 Q K A      Pair of Fours\n 384     4 4 J K A\n 384     4 4 T K A\n 384     4 4 9 K A\n 384     4 4 8 K A\n 384     4 4 7 K A\n 384     4 4 6 K A\n 384     4 4 5 K A\n 384     3 4 4 K A\n 384     2 4 4 K A\n 384     4 4 J Q A\n 384     4 4 T Q A\n 384     4 4 9 Q A\n 384     4 4 8 Q A\n 384     4 4 7 Q A\n 384     4 4 6 Q A\n 384     4 4 5 Q A\n 384     3 4 4 Q A\n 384     2 4 4 Q A\n 384     4 4 T J A\n 384     4 4 9 J A\n 384     4 4 8 J A\n 384     4 4 7 J A\n 384     4 4 6 J A\n 384     4 4 5 J A\n 384     3 4 4 J A\n 384     2 4 4 J A\n 384     4 4 9 T A\n 384     4 4 8 T A\n 384     4 4 7 T A\n 384     4 4 6 T A\n 384     4 4 5 T A\n 384     3 4 4 T A\n 384     2 4 4 T A\n 384     4 4 8 9 A\n 384     4 4 7 9 A\n 384     4 4 6 9 A\n 384     4 4 5 9 A\n 384     3 4 4 9 A\n 384     2 4 4 9 A\n 384     4 4 7 8 A\n 384     4 4 6 8 A\n 384     4 4 5 8 A\n 384     3 4 4 8 A\n 384     2 4 4 8 A\n 384     4 4 6 7 A\n 384     4 4 5 7 A\n 384     3 4 4 7 A\n 384     2 4 4 7 A\n 384     4 4 5 6 A\n 384     3 4 4 6 A\n 384     2 4 4 6 A\n 384     3 4 4 5 A\n 384     2 4 4 5 A\n 384     2 3 4 4 A\n 384     4 4 J Q K\n 384     4 4 T Q K\n 384     4 4 9 Q K\n 384     4 4 8 Q K\n 384     4 4 7 Q K\n 384     4 4 6 Q K\n 384     4 4 5 Q K\n 384     3 4 4 Q K\n 384     2 4 4 Q K\n 384     4 4 T J K\n 384     4 4 9 J K\n 384     4 4 8 J K\n 384     4 4 7 J K\n 384     4 4 6 J K\n 384     4 4 5 J K\n 384     3 4 4 J K\n 384     2 4 4 J K\n 384     4 4 9 T K\n 384     4 4 8 T K\n 384     4 4 7 T K\n 384     4 4 6 T K\n 384     4 4 5 T K\n 384     3 4 4 T K\n 384     2 4 4 T K\n 384     4 4 8 9 K\n 384     4 4 7 9 K\n 384     4 4 6 9 K\n 384     4 4 5 9 K\n 384     3 4 4 9 K\n 384     2 4 4 9 K\n 384     4 4 7 8 K\n 384     4 4 6 8 K\n 384     4 4 5 8 K\n 384     3 4 4 8 K\n 384     2 4 4 8 K\n 384     4 4 6 7 K\n 384     4 4 5 7 K\n 384     3 4 4 7 K\n 384     2 4 4 7 K\n 384     4 4 5 6 K\n 384     3 4 4 6 K\n 384     2 4 4 6 K\n 384     3 4 4 5 K\n 384     2 4 4 5 K\n 384     2 3 4 4 K\n 384     4 4 T J Q\n 384     4 4 9 J Q\n 384     4 4 8 J Q\n 384     4 4 7 J Q\n 384     4 4 6 J Q\n 384     4 4 5 J Q\n 384     3 4 4 J Q\n 384     2 4 4 J Q\n 384     4 4 9 T Q\n 384     4 4 8 T Q\n 384     4 4 7 T Q\n 384     4 4 6 T Q\n 384     4 4 5 T Q\n 384     3 4 4 T Q\n 384     2 4 4 T Q\n 384     4 4 8 9 Q\n 384     4 4 7 9 Q\n 384     4 4 6 9 Q\n 384     4 4 5 9 Q\n 384     3 4 4 9 Q\n 384     2 4 4 9 Q\n 384     4 4 7 8 Q\n 384     4 4 6 8 Q\n 384     4 4 5 8 Q\n 384     3 4 4 8 Q\n 384     2 4 4 8 Q\n 384     4 4 6 7 Q\n 384     4 4 5 7 Q\n 384     3 4 4 7 Q\n 384     2 4 4 7 Q\n 384     4 4 5 6 Q\n 384     3 4 4 6 Q\n 384     2 4 4 6 Q\n 384     3 4 4 5 Q\n 384     2 4 4 5 Q\n 384     2 3 4 4 Q\n 384     4 4 9 T J\n 384     4 4 8 T J\n 384     4 4 7 T J\n 384     4 4 6 T J\n 384     4 4 5 T J\n 384     3 4 4 T J\n 384     2 4 4 T J\n 384     4 4 8 9 J\n 384     4 4 7 9 J\n 384     4 4 6 9 J\n 384     4 4 5 9 J\n 384     3 4 4 9 J\n 384     2 4 4 9 J\n 384     4 4 7 8 J\n 384     4 4 6 8 J\n 384     4 4 5 8 J\n 384     3 4 4 8 J\n 384     2 4 4 8 J\n 384     4 4 6 7 J\n 384     4 4 5 7 J\n 384     3 4 4 7 J\n 384     2 4 4 7 J\n 384     4 4 5 6 J\n 384     3 4 4 6 J\n 384     2 4 4 6 J\n 384     3 4 4 5 J\n 384     2 4 4 5 J\n 384     2 3 4 4 J\n 384     4 4 8 9 T\n 384     4 4 7 9 T\n 384     4 4 6 9 T\n 384     4 4 5 9 T\n 384     3 4 4 9 T\n 384     2 4 4 9 T\n 384     4 4 7 8 T\n 384     4 4 6 8 T\n 384     4 4 5 8 T\n 384     3 4 4 8 T\n 384     2 4 4 8 T\n 384     4 4 6 7 T\n 384     4 4 5 7 T\n 384     3 4 4 7 T\n 384     2 4 4 7 T\n 384     4 4 5 6 T\n 384     3 4 4 6 T\n 384     2 4 4 6 T\n 384     3 4 4 5 T\n 384     2 4 4 5 T\n 384     2 3 4 4 T\n 384     4 4 7 8 9\n 384     4 4 6 8 9\n 384     4 4 5 8 9\n 384     3 4 4 8 9\n 384     2 4 4 8 9\n 384     4 4 6 7 9\n 384     4 4 5 7 9\n 384     3 4 4 7 9\n 384     2 4 4 7 9\n 384     4 4 5 6 9\n 384     3 4 4 6 9\n 384     2 4 4 6 9\n 384     3 4 4 5 9\n 384     2 4 4 5 9\n 384     2 3 4 4 9\n 384     4 4 6 7 8\n 384     4 4 5 7 8\n 384     3 4 4 7 8\n 384     2 4 4 7 8\n 384     4 4 5 6 8\n 384     3 4 4 6 8\n 384     2 4 4 6 8\n 384     3 4 4 5 8\n 384     2 4 4 5 8\n 384     2 3 4 4 8\n 384     4 4 5 6 7\n 384     3 4 4 6 7\n 384     2 4 4 6 7\n 384     3 4 4 5 7\n 384     2 4 4 5 7\n 384     2 3 4 4 7\n 384     3 4 4 5 6\n 384     2 4 4 5 6\n 384     2 3 4 4 6\n 384     2 3 4 4 5\n 384     3 3 Q K A      Pair of Treys\n 384     3 3 J K A\n 384     3 3 T K A\n 384     3 3 9 K A\n 384     3 3 8 K A\n 384     3 3 7 K A\n 384     3 3 6 K A\n 384     3 3 5 K A\n 384     3 3 4 K A\n 384     2 3 3 K A\n 384     3 3 J Q A\n 384     3 3 T Q A\n 384     3 3 9 Q A\n 384     3 3 8 Q A\n 384     3 3 7 Q A\n 384     3 3 6 Q A\n 384     3 3 5 Q A\n 384     3 3 4 Q A\n 384     2 3 3 Q A\n 384     3 3 T J A\n 384     3 3 9 J A\n 384     3 3 8 J A\n 384     3 3 7 J A\n 384     3 3 6 J A\n 384     3 3 5 J A\n 384     3 3 4 J A\n 384     2 3 3 J A\n 384     3 3 9 T A\n 384     3 3 8 T A\n 384     3 3 7 T A\n 384     3 3 6 T A\n 384     3 3 5 T A\n 384     3 3 4 T A\n 384     2 3 3 T A\n 384     3 3 8 9 A\n 384     3 3 7 9 A\n 384     3 3 6 9 A\n 384     3 3 5 9 A\n 384     3 3 4 9 A\n 384     2 3 3 9 A\n 384     3 3 7 8 A\n 384     3 3 6 8 A\n 384     3 3 5 8 A\n 384     3 3 4 8 A\n 384     2 3 3 8 A\n 384     3 3 6 7 A\n 384     3 3 5 7 A\n 384     3 3 4 7 A\n 384     2 3 3 7 A\n 384     3 3 5 6 A\n 384     3 3 4 6 A\n 384     2 3 3 6 A\n 384     3 3 4 5 A\n 384     2 3 3 5 A\n 384     2 3 3 4 A\n 384     3 3 J Q K\n 384     3 3 T Q K\n 384     3 3 9 Q K\n 384     3 3 8 Q K\n 384     3 3 7 Q K\n 384     3 3 6 Q K\n 384     3 3 5 Q K\n 384     3 3 4 Q K\n 384     2 3 3 Q K\n 384     3 3 T J K\n 384     3 3 9 J K\n 384     3 3 8 J K\n 384     3 3 7 J K\n 384     3 3 6 J K\n 384     3 3 5 J K\n 384     3 3 4 J K\n 384     2 3 3 J K\n 384     3 3 9 T K\n 384     3 3 8 T K\n 384     3 3 7 T K\n 384     3 3 6 T K\n 384     3 3 5 T K\n 384     3 3 4 T K\n 384     2 3 3 T K\n 384     3 3 8 9 K\n 384     3 3 7 9 K\n 384     3 3 6 9 K\n 384     3 3 5 9 K\n 384     3 3 4 9 K\n 384     2 3 3 9 K\n 384     3 3 7 8 K\n 384     3 3 6 8 K\n 384     3 3 5 8 K\n 384     3 3 4 8 K\n 384     2 3 3 8 K\n 384     3 3 6 7 K\n 384     3 3 5 7 K\n 384     3 3 4 7 K\n 384     2 3 3 7 K\n 384     3 3 5 6 K\n 384     3 3 4 6 K\n 384     2 3 3 6 K\n 384     3 3 4 5 K\n 384     2 3 3 5 K\n 384     2 3 3 4 K\n 384     3 3 T J Q\n 384     3 3 9 J Q\n 384     3 3 8 J Q\n 384     3 3 7 J Q\n 384     3 3 6 J Q\n 384     3 3 5 J Q\n 384     3 3 4 J Q\n 384     2 3 3 J Q\n 384     3 3 9 T Q\n 384     3 3 8 T Q\n 384     3 3 7 T Q\n 384     3 3 6 T Q\n 384     3 3 5 T Q\n 384     3 3 4 T Q\n 384     2 3 3 T Q\n 384     3 3 8 9 Q\n 384     3 3 7 9 Q\n 384     3 3 6 9 Q\n 384     3 3 5 9 Q\n 384     3 3 4 9 Q\n 384     2 3 3 9 Q\n 384     3 3 7 8 Q\n 384     3 3 6 8 Q\n 384     3 3 5 8 Q\n 384     3 3 4 8 Q\n 384     2 3 3 8 Q\n 384     3 3 6 7 Q\n 384     3 3 5 7 Q\n 384     3 3 4 7 Q\n 384     2 3 3 7 Q\n 384     3 3 5 6 Q\n 384     3 3 4 6 Q\n 384     2 3 3 6 Q\n 384     3 3 4 5 Q\n 384     2 3 3 5 Q\n 384     2 3 3 4 Q\n 384     3 3 9 T J\n 384     3 3 8 T J\n 384     3 3 7 T J\n 384     3 3 6 T J\n 384     3 3 5 T J\n 384     3 3 4 T J\n 384     2 3 3 T J\n 384     3 3 8 9 J\n 384     3 3 7 9 J\n 384     3 3 6 9 J\n 384     3 3 5 9 J\n 384     3 3 4 9 J\n 384     2 3 3 9 J\n 384     3 3 7 8 J\n 384     3 3 6 8 J\n 384     3 3 5 8 J\n 384     3 3 4 8 J\n 384     2 3 3 8 J\n 384     3 3 6 7 J\n 384     3 3 5 7 J\n 384     3 3 4 7 J\n 384     2 3 3 7 J\n 384     3 3 5 6 J\n 384     3 3 4 6 J\n 384     2 3 3 6 J\n 384     3 3 4 5 J\n 384     2 3 3 5 J\n 384     2 3 3 4 J\n 384     3 3 8 9 T\n 384     3 3 7 9 T\n 384     3 3 6 9 T\n 384     3 3 5 9 T\n 384     3 3 4 9 T\n 384     2 3 3 9 T\n 384     3 3 7 8 T\n 384     3 3 6 8 T\n 384     3 3 5 8 T\n 384     3 3 4 8 T\n 384     2 3 3 8 T\n 384     3 3 6 7 T\n 384     3 3 5 7 T\n 384     3 3 4 7 T\n 384     2 3 3 7 T\n 384     3 3 5 6 T\n 384     3 3 4 6 T\n 384     2 3 3 6 T\n 384     3 3 4 5 T\n 384     2 3 3 5 T\n 384     2 3 3 4 T\n 384     3 3 7 8 9\n 384     3 3 6 8 9\n 384     3 3 5 8 9\n 384     3 3 4 8 9\n 384     2 3 3 8 9\n 384     3 3 6 7 9\n 384     3 3 5 7 9\n 384     3 3 4 7 9\n 384     2 3 3 7 9\n 384     3 3 5 6 9\n 384     3 3 4 6 9\n 384     2 3 3 6 9\n 384     3 3 4 5 9\n 384     2 3 3 5 9\n 384     2 3 3 4 9\n 384     3 3 6 7 8\n 384     3 3 5 7 8\n 384     3 3 4 7 8\n 384     2 3 3 7 8\n 384     3 3 5 6 8\n 384     3 3 4 6 8\n 384     2 3 3 6 8\n 384     3 3 4 5 8\n 384     2 3 3 5 8\n 384     2 3 3 4 8\n 384     3 3 5 6 7\n 384     3 3 4 6 7\n 384     2 3 3 6 7\n 384     3 3 4 5 7\n 384     2 3 3 5 7\n 384     2 3 3 4 7\n 384     3 3 4 5 6\n 384     2 3 3 5 6\n 384     2 3 3 4 6\n 384     2 3 3 4 5\n 384     2 2 Q K A      Pair of Deuces\n 384     2 2 J K A\n 384     2 2 T K A\n 384     2 2 9 K A\n 384     2 2 8 K A\n 384     2 2 7 K A\n 384     2 2 6 K A\n 384     2 2 5 K A\n 384     2 2 4 K A\n 384     2 2 3 K A\n 384     2 2 J Q A\n 384     2 2 T Q A\n 384     2 2 9 Q A\n 384     2 2 8 Q A\n 384     2 2 7 Q A\n 384     2 2 6 Q A\n 384     2 2 5 Q A\n 384     2 2 4 Q A\n 384     2 2 3 Q A\n 384     2 2 T J A\n 384     2 2 9 J A\n 384     2 2 8 J A\n 384     2 2 7 J A\n 384     2 2 6 J A\n 384     2 2 5 J A\n 384     2 2 4 J A\n 384     2 2 3 J A\n 384     2 2 9 T A\n 384     2 2 8 T A\n 384     2 2 7 T A\n 384     2 2 6 T A\n 384     2 2 5 T A\n 384     2 2 4 T A\n 384     2 2 3 T A\n 384     2 2 8 9 A\n 384     2 2 7 9 A\n 384     2 2 6 9 A\n 384     2 2 5 9 A\n 384     2 2 4 9 A\n 384     2 2 3 9 A\n 384     2 2 7 8 A\n 384     2 2 6 8 A\n 384     2 2 5 8 A\n 384     2 2 4 8 A\n 384     2 2 3 8 A\n 384     2 2 6 7 A\n 384     2 2 5 7 A\n 384     2 2 4 7 A\n 384     2 2 3 7 A\n 384     2 2 5 6 A\n 384     2 2 4 6 A\n 384     2 2 3 6 A\n 384     2 2 4 5 A\n 384     2 2 3 5 A\n 384     2 2 3 4 A\n 384     2 2 J Q K\n 384     2 2 T Q K\n 384     2 2 9 Q K\n 384     2 2 8 Q K\n 384     2 2 7 Q K\n 384     2 2 6 Q K\n 384     2 2 5 Q K\n 384     2 2 4 Q K\n 384     2 2 3 Q K\n 384     2 2 T J K\n 384     2 2 9 J K\n 384     2 2 8 J K\n 384     2 2 7 J K\n 384     2 2 6 J K\n 384     2 2 5 J K\n 384     2 2 4 J K\n 384     2 2 3 J K\n 384     2 2 9 T K\n 384     2 2 8 T K\n 384     2 2 7 T K\n 384     2 2 6 T K\n 384     2 2 5 T K\n 384     2 2 4 T K\n 384     2 2 3 T K\n 384     2 2 8 9 K\n 384     2 2 7 9 K\n 384     2 2 6 9 K\n 384     2 2 5 9 K\n 384     2 2 4 9 K\n 384     2 2 3 9 K\n 384     2 2 7 8 K\n 384     2 2 6 8 K\n 384     2 2 5 8 K\n 384     2 2 4 8 K\n 384     2 2 3 8 K\n 384     2 2 6 7 K\n 384     2 2 5 7 K\n 384     2 2 4 7 K\n 384     2 2 3 7 K\n 384     2 2 5 6 K\n 384     2 2 4 6 K\n 384     2 2 3 6 K\n 384     2 2 4 5 K\n 384     2 2 3 5 K\n 384     2 2 3 4 K\n 384     2 2 T J Q\n 384     2 2 9 J Q\n 384     2 2 8 J Q\n 384     2 2 7 J Q\n 384     2 2 6 J Q\n 384     2 2 5 J Q\n 384     2 2 4 J Q\n 384     2 2 3 J Q\n 384     2 2 9 T Q\n 384     2 2 8 T Q\n 384     2 2 7 T Q\n 384     2 2 6 T Q\n 384     2 2 5 T Q\n 384     2 2 4 T Q\n 384     2 2 3 T Q\n 384     2 2 8 9 Q\n 384     2 2 7 9 Q\n 384     2 2 6 9 Q\n 384     2 2 5 9 Q\n 384     2 2 4 9 Q\n 384     2 2 3 9 Q\n 384     2 2 7 8 Q\n 384     2 2 6 8 Q\n 384     2 2 5 8 Q\n 384     2 2 4 8 Q\n 384     2 2 3 8 Q\n 384     2 2 6 7 Q\n 384     2 2 5 7 Q\n 384     2 2 4 7 Q\n 384     2 2 3 7 Q\n 384     2 2 5 6 Q\n 384     2 2 4 6 Q\n 384     2 2 3 6 Q\n 384     2 2 4 5 Q\n 384     2 2 3 5 Q\n 384     2 2 3 4 Q\n 384     2 2 9 T J\n 384     2 2 8 T J\n 384     2 2 7 T J\n 384     2 2 6 T J\n 384     2 2 5 T J\n 384     2 2 4 T J\n 384     2 2 3 T J\n 384     2 2 8 9 J\n 384     2 2 7 9 J\n 384     2 2 6 9 J\n 384     2 2 5 9 J\n 384     2 2 4 9 J\n 384     2 2 3 9 J\n 384     2 2 7 8 J\n 384     2 2 6 8 J\n 384     2 2 5 8 J\n 384     2 2 4 8 J\n 384     2 2 3 8 J\n 384     2 2 6 7 J\n 384     2 2 5 7 J\n 384     2 2 4 7 J\n 384     2 2 3 7 J\n 384     2 2 5 6 J\n 384     2 2 4 6 J\n 384     2 2 3 6 J\n 384     2 2 4 5 J\n 384     2 2 3 5 J\n 384     2 2 3 4 J\n 384     2 2 8 9 T\n 384     2 2 7 9 T\n 384     2 2 6 9 T\n 384     2 2 5 9 T\n 384     2 2 4 9 T\n 384     2 2 3 9 T\n 384     2 2 7 8 T\n 384     2 2 6 8 T\n 384     2 2 5 8 T\n 384     2 2 4 8 T\n 384     2 2 3 8 T\n 384     2 2 6 7 T\n 384     2 2 5 7 T\n 384     2 2 4 7 T\n 384     2 2 3 7 T\n 384     2 2 5 6 T\n 384     2 2 4 6 T\n 384     2 2 3 6 T\n 384     2 2 4 5 T\n 384     2 2 3 5 T\n 384     2 2 3 4 T\n 384     2 2 7 8 9\n 384     2 2 6 8 9\n 384     2 2 5 8 9\n 384     2 2 4 8 9\n 384     2 2 3 8 9\n 384     2 2 6 7 9\n 384     2 2 5 7 9\n 384     2 2 4 7 9\n 384     2 2 3 7 9\n 384     2 2 5 6 9\n 384     2 2 4 6 9\n 384     2 2 3 6 9\n 384     2 2 4 5 9\n 384     2 2 3 5 9\n 384     2 2 3 4 9\n 384     2 2 6 7 8\n 384     2 2 5 7 8\n 384     2 2 4 7 8\n 384     2 2 3 7 8\n 384     2 2 5 6 8\n 384     2 2 4 6 8\n 384     2 2 3 6 8\n 384     2 2 4 5 8\n 384     2 2 3 5 8\n 384     2 2 3 4 8\n 384     2 2 5 6 7\n 384     2 2 4 6 7\n 384     2 2 3 6 7\n 384     2 2 4 5 7\n 384     2 2 3 5 7\n 384     2 2 3 4 7\n 384     2 2 4 5 6\n 384     2 2 3 5 6\n 384     2 2 3 4 6\n 384     2 2 3 4 5\n1024     9 J Q K A      Ace High                       HIGH CARD\n1024     8 J Q K A\n1024     7 J Q K A\n1024     6 J Q K A\n1024     5 J Q K A\n1024     4 J Q K A\n1024     3 J Q K A\n1024     2 J Q K A\n1024     9 T Q K A\n1024     8 T Q K A\n1024     7 T Q K A\n1024     6 T Q K A\n1024     5 T Q K A\n1024     4 T Q K A\n1024     3 T Q K A\n1024     2 T Q K A\n1024     8 9 Q K A\n1024     7 9 Q K A\n1024     6 9 Q K A\n1024     5 9 Q K A\n1024     4 9 Q K A\n1024     3 9 Q K A\n1024     2 9 Q K A\n1024     7 8 Q K A\n1024     6 8 Q K A\n1024     5 8 Q K A\n1024     4 8 Q K A\n1024     3 8 Q K A\n1024     2 8 Q K A\n1024     6 7 Q K A\n1024     5 7 Q K A\n1024     4 7 Q K A\n1024     3 7 Q K A\n1024     2 7 Q K A\n1024     5 6 Q K A\n1024     4 6 Q K A\n1024     3 6 Q K A\n1024     2 6 Q K A\n1024     4 5 Q K A\n1024     3 5 Q K A\n1024     2 5 Q K A\n1024     3 4 Q K A\n1024     2 4 Q K A\n1024     2 3 Q K A\n1024     9 T J K A\n1024     8 T J K A\n1024     7 T J K A\n1024     6 T J K A\n1024     5 T J K A\n1024     4 T J K A\n1024     3 T J K A\n1024     2 T J K A\n1024     8 9 J K A\n1024     7 9 J K A\n1024     6 9 J K A\n1024     5 9 J K A\n1024     4 9 J K A\n1024     3 9 J K A\n1024     2 9 J K A\n1024     7 8 J K A\n1024     6 8 J K A\n1024     5 8 J K A\n1024     4 8 J K A\n1024     3 8 J K A\n1024     2 8 J K A\n1024     6 7 J K A\n1024     5 7 J K A\n1024     4 7 J K A\n1024     3 7 J K A\n1024     2 7 J K A\n1024     5 6 J K A\n1024     4 6 J K A\n1024     3 6 J K A\n1024     2 6 J K A\n1024     4 5 J K A\n1024     3 5 J K A\n1024     2 5 J K A\n1024     3 4 J K A\n1024     2 4 J K A\n1024     2 3 J K A\n1024     8 9 T K A\n1024     7 9 T K A\n1024     6 9 T K A\n1024     5 9 T K A\n1024     4 9 T K A\n1024     3 9 T K A\n1024     2 9 T K A\n1024     7 8 T K A\n1024     6 8 T K A\n1024     5 8 T K A\n1024     4 8 T K A\n1024     3 8 T K A\n1024     2 8 T K A\n1024     6 7 T K A\n1024     5 7 T K A\n1024     4 7 T K A\n1024     3 7 T K A\n1024     2 7 T K A\n1024     5 6 T K A\n1024     4 6 T K A\n1024     3 6 T K A\n1024     2 6 T K A\n1024     4 5 T K A\n1024     3 5 T K A\n1024     2 5 T K A\n1024     3 4 T K A\n1024     2 4 T K A\n1024     2 3 T K A\n1024     7 8 9 K A\n1024     6 8 9 K A\n1024     5 8 9 K A\n1024     4 8 9 K A\n1024     3 8 9 K A\n1024     2 8 9 K A\n1024     6 7 9 K A\n1024     5 7 9 K A\n1024     4 7 9 K A\n1024     3 7 9 K A\n1024     2 7 9 K A\n1024     5 6 9 K A\n1024     4 6 9 K A\n1024     3 6 9 K A\n1024     2 6 9 K A\n1024     4 5 9 K A\n1024     3 5 9 K A\n1024     2 5 9 K A\n1024     3 4 9 K A\n1024     2 4 9 K A\n1024     2 3 9 K A\n1024     6 7 8 K A\n1024     5 7 8 K A\n1024     4 7 8 K A\n1024     3 7 8 K A\n1024     2 7 8 K A\n1024     5 6 8 K A\n1024     4 6 8 K A\n1024     3 6 8 K A\n1024     2 6 8 K A\n1024     4 5 8 K A\n1024     3 5 8 K A\n1024     2 5 8 K A\n1024     3 4 8 K A\n1024     2 4 8 K A\n1024     2 3 8 K A\n1024     5 6 7 K A\n1024     4 6 7 K A\n1024     3 6 7 K A\n1024     2 6 7 K A\n1024     4 5 7 K A\n1024     3 5 7 K A\n1024     2 5 7 K A\n1024     3 4 7 K A\n1024     2 4 7 K A\n1024     2 3 7 K A\n1024     4 5 6 K A\n1024     3 5 6 K A\n1024     2 5 6 K A\n1024     3 4 6 K A\n1024     2 4 6 K A\n1024     2 3 6 K A\n1024     3 4 5 K A\n1024     2 4 5 K A\n1024     2 3 5 K A\n1024     2 3 4 K A\n1024     9 T J Q A\n1024     8 T J Q A\n1024     7 T J Q A\n1024     6 T J Q A\n1024     5 T J Q A\n1024     4 T J Q A\n1024     3 T J Q A\n1024     2 T J Q A\n1024     8 9 J Q A\n1024     7 9 J Q A\n1024     6 9 J Q A\n1024     5 9 J Q A\n1024     4 9 J Q A\n1024     3 9 J Q A\n1024     2 9 J Q A\n1024     7 8 J Q A\n1024     6 8 J Q A\n1024     5 8 J Q A\n1024     4 8 J Q A\n1024     3 8 J Q A\n1024     2 8 J Q A\n1024     6 7 J Q A\n1024     5 7 J Q A\n1024     4 7 J Q A\n1024     3 7 J Q A\n1024     2 7 J Q A\n1024     5 6 J Q A\n1024     4 6 J Q A\n1024     3 6 J Q A\n1024     2 6 J Q A\n1024     4 5 J Q A\n1024     3 5 J Q A\n1024     2 5 J Q A\n1024     3 4 J Q A\n1024     2 4 J Q A\n1024     2 3 J Q A\n1024     8 9 T Q A\n1024     7 9 T Q A\n1024     6 9 T Q A\n1024     5 9 T Q A\n1024     4 9 T Q A\n1024     3 9 T Q A\n1024     2 9 T Q A\n1024     7 8 T Q A\n1024     6 8 T Q A\n1024     5 8 T Q A\n1024     4 8 T Q A\n1024     3 8 T Q A\n1024     2 8 T Q A\n1024     6 7 T Q A\n1024     5 7 T Q A\n1024     4 7 T Q A\n1024     3 7 T Q A\n1024     2 7 T Q A\n1024     5 6 T Q A\n1024     4 6 T Q A\n1024     3 6 T Q A\n1024     2 6 T Q A\n1024     4 5 T Q A\n1024     3 5 T Q A\n1024     2 5 T Q A\n1024     3 4 T Q A\n1024     2 4 T Q A\n1024     2 3 T Q A\n1024     7 8 9 Q A\n1024     6 8 9 Q A\n1024     5 8 9 Q A\n1024     4 8 9 Q A\n1024     3 8 9 Q A\n1024     2 8 9 Q A\n1024     6 7 9 Q A\n1024     5 7 9 Q A\n1024     4 7 9 Q A\n1024     3 7 9 Q A\n1024     2 7 9 Q A\n1024     5 6 9 Q A\n1024     4 6 9 Q A\n1024     3 6 9 Q A\n1024     2 6 9 Q A\n1024     4 5 9 Q A\n1024     3 5 9 Q A\n1024     2 5 9 Q A\n1024     3 4 9 Q A\n1024     2 4 9 Q A\n1024     2 3 9 Q A\n1024     6 7 8 Q A\n1024     5 7 8 Q A\n1024     4 7 8 Q A\n1024     3 7 8 Q A\n1024     2 7 8 Q A\n1024     5 6 8 Q A\n1024     4 6 8 Q A\n1024     3 6 8 Q A\n1024     2 6 8 Q A\n1024     4 5 8 Q A\n1024     3 5 8 Q A\n1024     2 5 8 Q A\n1024     3 4 8 Q A\n1024     2 4 8 Q A\n1024     2 3 8 Q A\n1024     5 6 7 Q A\n1024     4 6 7 Q A\n1024     3 6 7 Q A\n1024     2 6 7 Q A\n1024     4 5 7 Q A\n1024     3 5 7 Q A\n1024     2 5 7 Q A\n1024     3 4 7 Q A\n1024     2 4 7 Q A\n1024     2 3 7 Q A\n1024     4 5 6 Q A\n1024     3 5 6 Q A\n1024     2 5 6 Q A\n1024     3 4 6 Q A\n1024     2 4 6 Q A\n1024     2 3 6 Q A\n1024     3 4 5 Q A\n1024     2 4 5 Q A\n1024     2 3 5 Q A\n1024     2 3 4 Q A\n1024     8 9 T J A\n1024     7 9 T J A\n1024     6 9 T J A\n1024     5 9 T J A\n1024     4 9 T J A\n1024     3 9 T J A\n1024     2 9 T J A\n1024     7 8 T J A\n1024     6 8 T J A\n1024     5 8 T J A\n1024     4 8 T J A\n1024     3 8 T J A\n1024     2 8 T J A\n1024     6 7 T J A\n1024     5 7 T J A\n1024     4 7 T J A\n1024     3 7 T J A\n1024     2 7 T J A\n1024     5 6 T J A\n1024     4 6 T J A\n1024     3 6 T J A\n1024     2 6 T J A\n1024     4 5 T J A\n1024     3 5 T J A\n1024     2 5 T J A\n1024     3 4 T J A\n1024     2 4 T J A\n1024     2 3 T J A\n1024     7 8 9 J A\n1024     6 8 9 J A\n1024     5 8 9 J A\n1024     4 8 9 J A\n1024     3 8 9 J A\n1024     2 8 9 J A\n1024     6 7 9 J A\n1024     5 7 9 J A\n1024     4 7 9 J A\n1024     3 7 9 J A\n1024     2 7 9 J A\n1024     5 6 9 J A\n1024     4 6 9 J A\n1024     3 6 9 J A\n1024     2 6 9 J A\n1024     4 5 9 J A\n1024     3 5 9 J A\n1024     2 5 9 J A\n1024     3 4 9 J A\n1024     2 4 9 J A\n1024     2 3 9 J A\n1024     6 7 8 J A\n1024     5 7 8 J A\n1024     4 7 8 J A\n1024     3 7 8 J A\n1024     2 7 8 J A\n1024     5 6 8 J A\n1024     4 6 8 J A\n1024     3 6 8 J A\n1024     2 6 8 J A\n1024     4 5 8 J A\n1024     3 5 8 J A\n1024     2 5 8 J A\n1024     3 4 8 J A\n1024     2 4 8 J A\n1024     2 3 8 J A\n1024     5 6 7 J A\n1024     4 6 7 J A\n1024     3 6 7 J A\n1024     2 6 7 J A\n1024     4 5 7 J A\n1024     3 5 7 J A\n1024     2 5 7 J A\n1024     3 4 7 J A\n1024     2 4 7 J A\n1024     2 3 7 J A\n1024     4 5 6 J A\n1024     3 5 6 J A\n1024     2 5 6 J A\n1024     3 4 6 J A\n1024     2 4 6 J A\n1024     2 3 6 J A\n1024     3 4 5 J A\n1024     2 4 5 J A\n1024     2 3 5 J A\n1024     2 3 4 J A\n1024     7 8 9 T A\n1024     6 8 9 T A\n1024     5 8 9 T A\n1024     4 8 9 T A\n1024     3 8 9 T A\n1024     2 8 9 T A\n1024     6 7 9 T A\n1024     5 7 9 T A\n1024     4 7 9 T A\n1024     3 7 9 T A\n1024     2 7 9 T A\n1024     5 6 9 T A\n1024     4 6 9 T A\n1024     3 6 9 T A\n1024     2 6 9 T A\n1024     4 5 9 T A\n1024     3 5 9 T A\n1024     2 5 9 T A\n1024     3 4 9 T A\n1024     2 4 9 T A\n1024     2 3 9 T A\n1024     6 7 8 T A\n1024     5 7 8 T A\n1024     4 7 8 T A\n1024     3 7 8 T A\n1024     2 7 8 T A\n1024     5 6 8 T A\n1024     4 6 8 T A\n1024     3 6 8 T A\n1024     2 6 8 T A\n1024     4 5 8 T A\n1024     3 5 8 T A\n1024     2 5 8 T A\n1024     3 4 8 T A\n1024     2 4 8 T A\n1024     2 3 8 T A\n1024     5 6 7 T A\n1024     4 6 7 T A\n1024     3 6 7 T A\n1024     2 6 7 T A\n1024     4 5 7 T A\n1024     3 5 7 T A\n1024     2 5 7 T A\n1024     3 4 7 T A\n1024     2 4 7 T A\n1024     2 3 7 T A\n1024     4 5 6 T A\n1024     3 5 6 T A\n1024     2 5 6 T A\n1024     3 4 6 T A\n1024     2 4 6 T A\n1024     2 3 6 T A\n1024     3 4 5 T A\n1024     2 4 5 T A\n1024     2 3 5 T A\n1024     2 3 4 T A\n1024     6 7 8 9 A\n1024     5 7 8 9 A\n1024     4 7 8 9 A\n1024     3 7 8 9 A\n1024     2 7 8 9 A\n1024     5 6 8 9 A\n1024     4 6 8 9 A\n1024     3 6 8 9 A\n1024     2 6 8 9 A\n1024     4 5 8 9 A\n1024     3 5 8 9 A\n1024     2 5 8 9 A\n1024     3 4 8 9 A\n1024     2 4 8 9 A\n1024     2 3 8 9 A\n1024     5 6 7 9 A\n1024     4 6 7 9 A\n1024     3 6 7 9 A\n1024     2 6 7 9 A\n1024     4 5 7 9 A\n1024     3 5 7 9 A\n1024     2 5 7 9 A\n1024     3 4 7 9 A\n1024     2 4 7 9 A\n1024     2 3 7 9 A\n1024     4 5 6 9 A\n1024     3 5 6 9 A\n1024     2 5 6 9 A\n1024     3 4 6 9 A\n1024     2 4 6 9 A\n1024     2 3 6 9 A\n1024     3 4 5 9 A\n1024     2 4 5 9 A\n1024     2 3 5 9 A\n1024     2 3 4 9 A\n1024     5 6 7 8 A\n1024     4 6 7 8 A\n1024     3 6 7 8 A\n1024     2 6 7 8 A\n1024     4 5 7 8 A\n1024     3 5 7 8 A\n1024     2 5 7 8 A\n1024     3 4 7 8 A\n1024     2 4 7 8 A\n1024     2 3 7 8 A\n1024     4 5 6 8 A\n1024     3 5 6 8 A\n1024     2 5 6 8 A\n1024     3 4 6 8 A\n1024     2 4 6 8 A\n1024     2 3 6 8 A\n1024     3 4 5 8 A\n1024     2 4 5 8 A\n1024     2 3 5 8 A\n1024     2 3 4 8 A\n1024     4 5 6 7 A\n1024     3 5 6 7 A\n1024     2 5 6 7 A\n1024     3 4 6 7 A\n1024     2 4 6 7 A\n1024     2 3 6 7 A\n1024     3 4 5 7 A\n1024     2 4 5 7 A\n1024     2 3 5 7 A\n1024     2 3 4 7 A\n1024     3 4 5 6 A\n1024     2 4 5 6 A\n1024     2 3 5 6 A\n1024     2 3 4 6 A\n1024     8 T J Q K      King High\n1024     7 T J Q K\n1024     6 T J Q K\n1024     5 T J Q K\n1024     4 T J Q K\n1024     3 T J Q K\n1024     2 T J Q K\n1024     8 9 J Q K\n1024     7 9 J Q K\n1024     6 9 J Q K\n1024     5 9 J Q K\n1024     4 9 J Q K\n1024     3 9 J Q K\n1024     2 9 J Q K\n1024     7 8 J Q K\n1024     6 8 J Q K\n1024     5 8 J Q K\n1024     4 8 J Q K\n1024     3 8 J Q K\n1024     2 8 J Q K\n1024     6 7 J Q K\n1024     5 7 J Q K\n1024     4 7 J Q K\n1024     3 7 J Q K\n1024     2 7 J Q K\n1024     5 6 J Q K\n1024     4 6 J Q K\n1024     3 6 J Q K\n1024     2 6 J Q K\n1024     4 5 J Q K\n1024     3 5 J Q K\n1024     2 5 J Q K\n1024     3 4 J Q K\n1024     2 4 J Q K\n1024     2 3 J Q K\n1024     8 9 T Q K\n1024     7 9 T Q K\n1024     6 9 T Q K\n1024     5 9 T Q K\n1024     4 9 T Q K\n1024     3 9 T Q K\n1024     2 9 T Q K\n1024     7 8 T Q K\n1024     6 8 T Q K\n1024     5 8 T Q K\n1024     4 8 T Q K\n1024     3 8 T Q K\n1024     2 8 T Q K\n1024     6 7 T Q K\n1024     5 7 T Q K\n1024     4 7 T Q K\n1024     3 7 T Q K\n1024     2 7 T Q K\n1024     5 6 T Q K\n1024     4 6 T Q K\n1024     3 6 T Q K\n1024     2 6 T Q K\n1024     4 5 T Q K\n1024     3 5 T Q K\n1024     2 5 T Q K\n1024     3 4 T Q K\n1024     2 4 T Q K\n1024     2 3 T Q K\n1024     7 8 9 Q K\n1024     6 8 9 Q K\n1024     5 8 9 Q K\n1024     4 8 9 Q K\n1024     3 8 9 Q K\n1024     2 8 9 Q K\n1024     6 7 9 Q K\n1024     5 7 9 Q K\n1024     4 7 9 Q K\n1024     3 7 9 Q K\n1024     2 7 9 Q K\n1024     5 6 9 Q K\n1024     4 6 9 Q K\n1024     3 6 9 Q K\n1024     2 6 9 Q K\n1024     4 5 9 Q K\n1024     3 5 9 Q K\n1024     2 5 9 Q K\n1024     3 4 9 Q K\n1024     2 4 9 Q K\n1024     2 3 9 Q K\n1024     6 7 8 Q K\n1024     5 7 8 Q K\n1024     4 7 8 Q K\n1024     3 7 8 Q K\n1024     2 7 8 Q K\n1024     5 6 8 Q K\n1024     4 6 8 Q K\n1024     3 6 8 Q K\n1024     2 6 8 Q K\n1024     4 5 8 Q K\n1024     3 5 8 Q K\n1024     2 5 8 Q K\n1024     3 4 8 Q K\n1024     2 4 8 Q K\n1024     2 3 8 Q K\n1024     5 6 7 Q K\n1024     4 6 7 Q K\n1024     3 6 7 Q K\n1024     2 6 7 Q K\n1024     4 5 7 Q K\n1024     3 5 7 Q K\n1024     2 5 7 Q K\n1024     3 4 7 Q K\n1024     2 4 7 Q K\n1024     2 3 7 Q K\n1024     4 5 6 Q K\n1024     3 5 6 Q K\n1024     2 5 6 Q K\n1024     3 4 6 Q K\n1024     2 4 6 Q K\n1024     2 3 6 Q K\n1024     3 4 5 Q K\n1024     2 4 5 Q K\n1024     2 3 5 Q K\n1024     2 3 4 Q K\n1024     8 9 T J K\n1024     7 9 T J K\n1024     6 9 T J K\n1024     5 9 T J K\n1024     4 9 T J K\n1024     3 9 T J K\n1024     2 9 T J K\n1024     7 8 T J K\n1024     6 8 T J K\n1024     5 8 T J K\n1024     4 8 T J K\n1024     3 8 T J K\n1024     2 8 T J K\n1024     6 7 T J K\n1024     5 7 T J K\n1024     4 7 T J K\n1024     3 7 T J K\n1024     2 7 T J K\n1024     5 6 T J K\n1024     4 6 T J K\n1024     3 6 T J K\n1024     2 6 T J K\n1024     4 5 T J K\n1024     3 5 T J K\n1024     2 5 T J K\n1024     3 4 T J K\n1024     2 4 T J K\n1024     2 3 T J K\n1024     7 8 9 J K\n1024     6 8 9 J K\n1024     5 8 9 J K\n1024     4 8 9 J K\n1024     3 8 9 J K\n1024     2 8 9 J K\n1024     6 7 9 J K\n1024     5 7 9 J K\n1024     4 7 9 J K\n1024     3 7 9 J K\n1024     2 7 9 J K\n1024     5 6 9 J K\n1024     4 6 9 J K\n1024     3 6 9 J K\n1024     2 6 9 J K\n1024     4 5 9 J K\n1024     3 5 9 J K\n1024     2 5 9 J K\n1024     3 4 9 J K\n1024     2 4 9 J K\n1024     2 3 9 J K\n1024     6 7 8 J K\n1024     5 7 8 J K\n1024     4 7 8 J K\n1024     3 7 8 J K\n1024     2 7 8 J K\n1024     5 6 8 J K\n1024     4 6 8 J K\n1024     3 6 8 J K\n1024     2 6 8 J K\n1024     4 5 8 J K\n1024     3 5 8 J K\n1024     2 5 8 J K\n1024     3 4 8 J K\n1024     2 4 8 J K\n1024     2 3 8 J K\n1024     5 6 7 J K\n1024     4 6 7 J K\n1024     3 6 7 J K\n1024     2 6 7 J K\n1024     4 5 7 J K\n1024     3 5 7 J K\n1024     2 5 7 J K\n1024     3 4 7 J K\n1024     2 4 7 J K\n1024     2 3 7 J K\n1024     4 5 6 J K\n1024     3 5 6 J K\n1024     2 5 6 J K\n1024     3 4 6 J K\n1024     2 4 6 J K\n1024     2 3 6 J K\n1024     3 4 5 J K\n1024     2 4 5 J K\n1024     2 3 5 J K\n1024     2 3 4 J K\n1024     7 8 9 T K\n1024     6 8 9 T K\n1024     5 8 9 T K\n1024     4 8 9 T K\n1024     3 8 9 T K\n1024     2 8 9 T K\n1024     6 7 9 T K\n1024     5 7 9 T K\n1024     4 7 9 T K\n1024     3 7 9 T K\n1024     2 7 9 T K\n1024     5 6 9 T K\n1024     4 6 9 T K\n1024     3 6 9 T K\n1024     2 6 9 T K\n1024     4 5 9 T K\n1024     3 5 9 T K\n1024     2 5 9 T K\n1024     3 4 9 T K\n1024     2 4 9 T K\n1024     2 3 9 T K\n1024     6 7 8 T K\n1024     5 7 8 T K\n1024     4 7 8 T K\n1024     3 7 8 T K\n1024     2 7 8 T K\n1024     5 6 8 T K\n1024     4 6 8 T K\n1024     3 6 8 T K\n1024     2 6 8 T K\n1024     4 5 8 T K\n1024     3 5 8 T K\n1024     2 5 8 T K\n1024     3 4 8 T K\n1024     2 4 8 T K\n1024     2 3 8 T K\n1024     5 6 7 T K\n1024     4 6 7 T K\n1024     3 6 7 T K\n1024     2 6 7 T K\n1024     4 5 7 T K\n1024     3 5 7 T K\n1024     2 5 7 T K\n1024     3 4 7 T K\n1024     2 4 7 T K\n1024     2 3 7 T K\n1024     4 5 6 T K\n1024     3 5 6 T K\n1024     2 5 6 T K\n1024     3 4 6 T K\n1024     2 4 6 T K\n1024     2 3 6 T K\n1024     3 4 5 T K\n1024     2 4 5 T K\n1024     2 3 5 T K\n1024     2 3 4 T K\n1024     6 7 8 9 K\n1024     5 7 8 9 K\n1024     4 7 8 9 K\n1024     3 7 8 9 K\n1024     2 7 8 9 K\n1024     5 6 8 9 K\n1024     4 6 8 9 K\n1024     3 6 8 9 K\n1024     2 6 8 9 K\n1024     4 5 8 9 K\n1024     3 5 8 9 K\n1024     2 5 8 9 K\n1024     3 4 8 9 K\n1024     2 4 8 9 K\n1024     2 3 8 9 K\n1024     5 6 7 9 K\n1024     4 6 7 9 K\n1024     3 6 7 9 K\n1024     2 6 7 9 K\n1024     4 5 7 9 K\n1024     3 5 7 9 K\n1024     2 5 7 9 K\n1024     3 4 7 9 K\n1024     2 4 7 9 K\n1024     2 3 7 9 K\n1024     4 5 6 9 K\n1024     3 5 6 9 K\n1024     2 5 6 9 K\n1024     3 4 6 9 K\n1024     2 4 6 9 K\n1024     2 3 6 9 K\n1024     3 4 5 9 K\n1024     2 4 5 9 K\n1024     2 3 5 9 K\n1024     2 3 4 9 K\n1024     5 6 7 8 K\n1024     4 6 7 8 K\n1024     3 6 7 8 K\n1024     2 6 7 8 K\n1024     4 5 7 8 K\n1024     3 5 7 8 K\n1024     2 5 7 8 K\n1024     3 4 7 8 K\n1024     2 4 7 8 K\n1024     2 3 7 8 K\n1024     4 5 6 8 K\n1024     3 5 6 8 K\n1024     2 5 6 8 K\n1024     3 4 6 8 K\n1024     2 4 6 8 K\n1024     2 3 6 8 K\n1024     3 4 5 8 K\n1024     2 4 5 8 K\n1024     2 3 5 8 K\n1024     2 3 4 8 K\n1024     4 5 6 7 K\n1024     3 5 6 7 K\n1024     2 5 6 7 K\n1024     3 4 6 7 K\n1024     2 4 6 7 K\n1024     2 3 6 7 K\n1024     3 4 5 7 K\n1024     2 4 5 7 K\n1024     2 3 5 7 K\n1024     2 3 4 7 K\n1024     3 4 5 6 K\n1024     2 4 5 6 K\n1024     2 3 5 6 K\n1024     2 3 4 6 K\n1024     2 3 4 5 K\n1024     7 9 T J Q      Queen High\n1024     6 9 T J Q\n1024     5 9 T J Q\n1024     4 9 T J Q\n1024     3 9 T J Q\n1024     2 9 T J Q\n1024     7 8 T J Q\n1024     6 8 T J Q\n1024     5 8 T J Q\n1024     4 8 T J Q\n1024     3 8 T J Q\n1024     2 8 T J Q\n1024     6 7 T J Q\n1024     5 7 T J Q\n1024     4 7 T J Q\n1024     3 7 T J Q\n1024     2 7 T J Q\n1024     5 6 T J Q\n1024     4 6 T J Q\n1024     3 6 T J Q\n1024     2 6 T J Q\n1024     4 5 T J Q\n1024     3 5 T J Q\n1024     2 5 T J Q\n1024     3 4 T J Q\n1024     2 4 T J Q\n1024     2 3 T J Q\n1024     7 8 9 J Q\n1024     6 8 9 J Q\n1024     5 8 9 J Q\n1024     4 8 9 J Q\n1024     3 8 9 J Q\n1024     2 8 9 J Q\n1024     6 7 9 J Q\n1024     5 7 9 J Q\n1024     4 7 9 J Q\n1024     3 7 9 J Q\n1024     2 7 9 J Q\n1024     5 6 9 J Q\n1024     4 6 9 J Q\n1024     3 6 9 J Q\n1024     2 6 9 J Q\n1024     4 5 9 J Q\n1024     3 5 9 J Q\n1024     2 5 9 J Q\n1024     3 4 9 J Q\n1024     2 4 9 J Q\n1024     2 3 9 J Q\n1024     6 7 8 J Q\n1024     5 7 8 J Q\n1024     4 7 8 J Q\n1024     3 7 8 J Q\n1024     2 7 8 J Q\n1024     5 6 8 J Q\n1024     4 6 8 J Q\n1024     3 6 8 J Q\n1024     2 6 8 J Q\n1024     4 5 8 J Q\n1024     3 5 8 J Q\n1024     2 5 8 J Q\n1024     3 4 8 J Q\n1024     2 4 8 J Q\n1024     2 3 8 J Q\n1024     5 6 7 J Q\n1024     4 6 7 J Q\n1024     3 6 7 J Q\n1024     2 6 7 J Q\n1024     4 5 7 J Q\n1024     3 5 7 J Q\n1024     2 5 7 J Q\n1024     3 4 7 J Q\n1024     2 4 7 J Q\n1024     2 3 7 J Q\n1024     4 5 6 J Q\n1024     3 5 6 J Q\n1024     2 5 6 J Q\n1024     3 4 6 J Q\n1024     2 4 6 J Q\n1024     2 3 6 J Q\n1024     3 4 5 J Q\n1024     2 4 5 J Q\n1024     2 3 5 J Q\n1024     2 3 4 J Q\n1024     7 8 9 T Q\n1024     6 8 9 T Q\n1024     5 8 9 T Q\n1024     4 8 9 T Q\n1024     3 8 9 T Q\n1024     2 8 9 T Q\n1024     6 7 9 T Q\n1024     5 7 9 T Q\n1024     4 7 9 T Q\n1024     3 7 9 T Q\n1024     2 7 9 T Q\n1024     5 6 9 T Q\n1024     4 6 9 T Q\n1024     3 6 9 T Q\n1024     2 6 9 T Q\n1024     4 5 9 T Q\n1024     3 5 9 T Q\n1024     2 5 9 T Q\n1024     3 4 9 T Q\n1024     2 4 9 T Q\n1024     2 3 9 T Q\n1024     6 7 8 T Q\n1024     5 7 8 T Q\n1024     4 7 8 T Q\n1024     3 7 8 T Q\n1024     2 7 8 T Q\n1024     5 6 8 T Q\n1024     4 6 8 T Q\n1024     3 6 8 T Q\n1024     2 6 8 T Q\n1024     4 5 8 T Q\n1024     3 5 8 T Q\n1024     2 5 8 T Q\n1024     3 4 8 T Q\n1024     2 4 8 T Q\n1024     2 3 8 T Q\n1024     5 6 7 T Q\n1024     4 6 7 T Q\n1024     3 6 7 T Q\n1024     2 6 7 T Q\n1024     4 5 7 T Q\n1024     3 5 7 T Q\n1024     2 5 7 T Q\n1024     3 4 7 T Q\n1024     2 4 7 T Q\n1024     2 3 7 T Q\n1024     4 5 6 T Q\n1024     3 5 6 T Q\n1024     2 5 6 T Q\n1024     3 4 6 T Q\n1024     2 4 6 T Q\n1024     2 3 6 T Q\n1024     3 4 5 T Q\n1024     2 4 5 T Q\n1024     2 3 5 T Q\n1024     2 3 4 T Q\n1024     6 7 8 9 Q\n1024     5 7 8 9 Q\n1024     4 7 8 9 Q\n1024     3 7 8 9 Q\n1024     2 7 8 9 Q\n1024     5 6 8 9 Q\n1024     4 6 8 9 Q\n1024     3 6 8 9 Q\n1024     2 6 8 9 Q\n1024     4 5 8 9 Q\n1024     3 5 8 9 Q\n1024     2 5 8 9 Q\n1024     3 4 8 9 Q\n1024     2 4 8 9 Q\n1024     2 3 8 9 Q\n1024     5 6 7 9 Q\n1024     4 6 7 9 Q\n1024     3 6 7 9 Q\n1024     2 6 7 9 Q\n1024     4 5 7 9 Q\n1024     3 5 7 9 Q\n1024     2 5 7 9 Q\n1024     3 4 7 9 Q\n1024     2 4 7 9 Q\n1024     2 3 7 9 Q\n1024     4 5 6 9 Q\n1024     3 5 6 9 Q\n1024     2 5 6 9 Q\n1024     3 4 6 9 Q\n1024     2 4 6 9 Q\n1024     2 3 6 9 Q\n1024     3 4 5 9 Q\n1024     2 4 5 9 Q\n1024     2 3 5 9 Q\n1024     2 3 4 9 Q\n1024     5 6 7 8 Q\n1024     4 6 7 8 Q\n1024     3 6 7 8 Q\n1024     2 6 7 8 Q\n1024     4 5 7 8 Q\n1024     3 5 7 8 Q\n1024     2 5 7 8 Q\n1024     3 4 7 8 Q\n1024     2 4 7 8 Q\n1024     2 3 7 8 Q\n1024     4 5 6 8 Q\n1024     3 5 6 8 Q\n1024     2 5 6 8 Q\n1024     3 4 6 8 Q\n1024     2 4 6 8 Q\n1024     2 3 6 8 Q\n1024     3 4 5 8 Q\n1024     2 4 5 8 Q\n1024     2 3 5 8 Q\n1024     2 3 4 8 Q\n1024     4 5 6 7 Q\n1024     3 5 6 7 Q\n1024     2 5 6 7 Q\n1024     3 4 6 7 Q\n1024     2 4 6 7 Q\n1024     2 3 6 7 Q\n1024     3 4 5 7 Q\n1024     2 4 5 7 Q\n1024     2 3 5 7 Q\n1024     2 3 4 7 Q\n1024     3 4 5 6 Q\n1024     2 4 5 6 Q\n1024     2 3 5 6 Q\n1024     2 3 4 6 Q\n1024     2 3 4 5 Q\n1024     6 8 9 T J      Jack High\n1024     5 8 9 T J\n1024     4 8 9 T J\n1024     3 8 9 T J\n1024     2 8 9 T J\n1024     6 7 9 T J\n1024     5 7 9 T J\n1024     4 7 9 T J\n1024     3 7 9 T J\n1024     2 7 9 T J\n1024     5 6 9 T J\n1024     4 6 9 T J\n1024     3 6 9 T J\n1024     2 6 9 T J\n1024     4 5 9 T J\n1024     3 5 9 T J\n1024     2 5 9 T J\n1024     3 4 9 T J\n1024     2 4 9 T J\n1024     2 3 9 T J\n1024     6 7 8 T J\n1024     5 7 8 T J\n1024     4 7 8 T J\n1024     3 7 8 T J\n1024     2 7 8 T J\n1024     5 6 8 T J\n1024     4 6 8 T J\n1024     3 6 8 T J\n1024     2 6 8 T J\n1024     4 5 8 T J\n1024     3 5 8 T J\n1024     2 5 8 T J\n1024     3 4 8 T J\n1024     2 4 8 T J\n1024     2 3 8 T J\n1024     5 6 7 T J\n1024     4 6 7 T J\n1024     3 6 7 T J\n1024     2 6 7 T J\n1024     4 5 7 T J\n1024     3 5 7 T J\n1024     2 5 7 T J\n1024     3 4 7 T J\n1024     2 4 7 T J\n1024     2 3 7 T J\n1024     4 5 6 T J\n1024     3 5 6 T J\n1024     2 5 6 T J\n1024     3 4 6 T J\n1024     2 4 6 T J\n1024     2 3 6 T J\n1024     3 4 5 T J\n1024     2 4 5 T J\n1024     2 3 5 T J\n1024     2 3 4 T J\n1024     6 7 8 9 J\n1024     5 7 8 9 J\n1024     4 7 8 9 J\n1024     3 7 8 9 J\n1024     2 7 8 9 J\n1024     5 6 8 9 J\n1024     4 6 8 9 J\n1024     3 6 8 9 J\n1024     2 6 8 9 J\n1024     4 5 8 9 J\n1024     3 5 8 9 J\n1024     2 5 8 9 J\n1024     3 4 8 9 J\n1024     2 4 8 9 J\n1024     2 3 8 9 J\n1024     5 6 7 9 J\n1024     4 6 7 9 J\n1024     3 6 7 9 J\n1024     2 6 7 9 J\n1024     4 5 7 9 J\n1024     3 5 7 9 J\n1024     2 5 7 9 J\n1024     3 4 7 9 J\n1024     2 4 7 9 J\n1024     2 3 7 9 J\n1024     4 5 6 9 J\n1024     3 5 6 9 J\n1024     2 5 6 9 J\n1024     3 4 6 9 J\n1024     2 4 6 9 J\n1024     2 3 6 9 J\n1024     3 4 5 9 J\n1024     2 4 5 9 J\n1024     2 3 5 9 J\n1024     2 3 4 9 J\n1024     5 6 7 8 J\n1024     4 6 7 8 J\n1024     3 6 7 8 J\n1024     2 6 7 8 J\n1024     4 5 7 8 J\n1024     3 5 7 8 J\n1024     2 5 7 8 J\n1024     3 4 7 8 J\n1024     2 4 7 8 J\n1024     2 3 7 8 J\n1024     4 5 6 8 J\n1024     3 5 6 8 J\n1024     2 5 6 8 J\n1024     3 4 6 8 J\n1024     2 4 6 8 J\n1024     2 3 6 8 J\n1024     3 4 5 8 J\n1024     2 4 5 8 J\n1024     2 3 5 8 J\n1024     2 3 4 8 J\n1024     4 5 6 7 J\n1024     3 5 6 7 J\n1024     2 5 6 7 J\n1024     3 4 6 7 J\n1024     2 4 6 7 J\n1024     2 3 6 7 J\n1024     3 4 5 7 J\n1024     2 4 5 7 J\n1024     2 3 5 7 J\n1024     2 3 4 7 J\n1024     3 4 5 6 J\n1024     2 4 5 6 J\n1024     2 3 5 6 J\n1024     2 3 4 6 J\n1024     2 3 4 5 J\n1024     5 7 8 9 T      Ten High\n1024     4 7 8 9 T\n1024     3 7 8 9 T\n1024     2 7 8 9 T\n1024     5 6 8 9 T\n1024     4 6 8 9 T\n1024     3 6 8 9 T\n1024     2 6 8 9 T\n1024     4 5 8 9 T\n1024     3 5 8 9 T\n1024     2 5 8 9 T\n1024     3 4 8 9 T\n1024     2 4 8 9 T\n1024     2 3 8 9 T\n1024     5 6 7 9 T\n1024     4 6 7 9 T\n1024     3 6 7 9 T\n1024     2 6 7 9 T\n1024     4 5 7 9 T\n1024     3 5 7 9 T\n1024     2 5 7 9 T\n1024     3 4 7 9 T\n1024     2 4 7 9 T\n1024     2 3 7 9 T\n1024     4 5 6 9 T\n1024     3 5 6 9 T\n1024     2 5 6 9 T\n1024     3 4 6 9 T\n1024     2 4 6 9 T\n1024     2 3 6 9 T\n1024     3 4 5 9 T\n1024     2 4 5 9 T\n1024     2 3 5 9 T\n1024     2 3 4 9 T\n1024     5 6 7 8 T\n1024     4 6 7 8 T\n1024     3 6 7 8 T\n1024     2 6 7 8 T\n1024     4 5 7 8 T\n1024     3 5 7 8 T\n1024     2 5 7 8 T\n1024     3 4 7 8 T\n1024     2 4 7 8 T\n1024     2 3 7 8 T\n1024     4 5 6 8 T\n1024     3 5 6 8 T\n1024     2 5 6 8 T\n1024     3 4 6 8 T\n1024     2 4 6 8 T\n1024     2 3 6 8 T\n1024     3 4 5 8 T\n1024     2 4 5 8 T\n1024     2 3 5 8 T\n1024     2 3 4 8 T\n1024     4 5 6 7 T\n1024     3 5 6 7 T\n1024     2 5 6 7 T\n1024     3 4 6 7 T\n1024     2 4 6 7 T\n1024     2 3 6 7 T\n1024     3 4 5 7 T\n1024     2 4 5 7 T\n1024     2 3 5 7 T\n1024     2 3 4 7 T\n1024     3 4 5 6 T\n1024     2 4 5 6 T\n1024     2 3 5 6 T\n1024     2 3 4 6 T\n1024     2 3 4 5 T\n1024     4 6 7 8 9      Nine High\n1024     3 6 7 8 9\n1024     2 6 7 8 9\n1024     4 5 7 8 9\n1024     3 5 7 8 9\n1024     2 5 7 8 9\n1024     3 4 7 8 9\n1024     2 4 7 8 9\n1024     2 3 7 8 9\n1024     4 5 6 8 9\n1024     3 5 6 8 9\n1024     2 5 6 8 9\n1024     3 4 6 8 9\n1024     2 4 6 8 9\n1024     2 3 6 8 9\n1024     3 4 5 8 9\n1024     2 4 5 8 9\n1024     2 3 5 8 9\n1024     2 3 4 8 9\n1024     4 5 6 7 9\n1024     3 5 6 7 9\n1024     2 5 6 7 9\n1024     3 4 6 7 9\n1024     2 4 6 7 9\n1024     2 3 6 7 9\n1024     3 4 5 7 9\n1024     2 4 5 7 9\n1024     2 3 5 7 9\n1024     2 3 4 7 9\n1024     3 4 5 6 9\n1024     2 4 5 6 9\n1024     2 3 5 6 9\n1024     2 3 4 6 9\n1024     2 3 4 5 9\n1024     3 5 6 7 8      Eight High\n1024     2 5 6 7 8\n1024     3 4 6 7 8\n1024     2 4 6 7 8\n1024     2 3 6 7 8\n1024     3 4 5 7 8\n1024     2 4 5 7 8\n1024     2 3 5 7 8\n1024     2 3 4 7 8\n1024     3 4 5 6 8\n1024     2 4 5 6 8\n1024     2 3 5 6 8\n1024     2 3 4 6 8\n1024     2 3 4 5 8\n1024     2 4 5 6 7      Seven High\n1024     2 3 5 6 7\n1024     2 3 4 6 7\n1024     2 3 4 5 7\n"
  },
  {
    "path": "src/server/algorithm/Pocker Rule.html",
    "content": "<html><head><title>&#24503;&#24030;&#25169;&#20811;&#27969;&#31243;&#19982;&#35268;&#21017;</title><meta content=\"text/html; charset=UTF-8\" http-equiv=\"content-type\"><style type=\"text/css\">.lst-kix_1h7jd02d177d-2>li:before{content:\"\\0025a0  \"}.lst-kix_26etd7yyufkn-1>li:before{content:\"\\0025cb  \"}.lst-kix_wyeoikf169tx-1>li:before{content:\"\\0025cb  \"}.lst-kix_26etd7yyufkn-6>li:before{content:\"\\0025cf  \"}ul.lst-kix_1h7jd02d177d-4{list-style-type:none}ul.lst-kix_1h7jd02d177d-5{list-style-type:none}ul.lst-kix_1h7jd02d177d-2{list-style-type:none}ul.lst-kix_1h7jd02d177d-3{list-style-type:none}.lst-kix_wyeoikf169tx-4>li:before{content:\"\\0025cb  \"}ul.lst-kix_1h7jd02d177d-0{list-style-type:none}ul.lst-kix_1h7jd02d177d-1{list-style-type:none}.lst-kix_1h7jd02d177d-6>li:before{content:\"\\0025cf  \"}ul.lst-kix_26etd7yyufkn-1{list-style-type:none}ul.lst-kix_26etd7yyufkn-2{list-style-type:none}ul.lst-kix_26etd7yyufkn-0{list-style-type:none}.lst-kix_26etd7yyufkn-2>li:before{content:\"\\0025a0  \"}ul.lst-kix_26etd7yyufkn-5{list-style-type:none}ul.lst-kix_26etd7yyufkn-6{list-style-type:none}ul.lst-kix_26etd7yyufkn-3{list-style-type:none}ul.lst-kix_26etd7yyufkn-4{list-style-type:none}.lst-kix_26etd7yyufkn-0>li:before{content:\"\\0025cf  \"}.lst-kix_1h7jd02d177d-7>li:before{content:\"\\0025cb  \"}.lst-kix_1h7jd02d177d-5>li:before{content:\"\\0025a0  \"}.lst-kix_wyeoikf169tx-2>li:before{content:\"\\0025a0  \"}.lst-kix_1h7jd02d177d-8>li:before{content:\"\\0025a0  \"}.lst-kix_26etd7yyufkn-7>li:before{content:\"\\0025cb  \"}.lst-kix_wyeoikf169tx-3>li:before{content:\"\\0025cf  \"}.lst-kix_wyeoikf169tx-7>li:before{content:\"\\0025cb  \"}.lst-kix_1h7jd02d177d-4>li:before{content:\"\\0025cb  \"}ul.lst-kix_wyeoikf169tx-0{list-style-type:none}.lst-kix_26etd7yyufkn-3>li:before{content:\"\\0025cf  \"}.lst-kix_26etd7yyufkn-8>li:before{content:\"\\0025a0  \"}.lst-kix_wyeoikf169tx-5>li:before{content:\"\\0025a0  \"}.lst-kix_wyeoikf169tx-6>li:before{content:\"\\0025cf  \"}ul.lst-kix_26etd7yyufkn-8{list-style-type:none}.lst-kix_1h7jd02d177d-3>li:before{content:\"\\0025cf  \"}ul.lst-kix_26etd7yyufkn-7{list-style-type:none}.lst-kix_wyeoikf169tx-8>li:before{content:\"\\0025a0  \"}ul.lst-kix_1h7jd02d177d-7{list-style-type:none}ul.lst-kix_1h7jd02d177d-6{list-style-type:none}ul.lst-kix_1h7jd02d177d-8{list-style-type:none}.lst-kix_1h7jd02d177d-1>li:before{content:\"\\0025cb  \"}ul.lst-kix_wyeoikf169tx-5{list-style-type:none}ul.lst-kix_wyeoikf169tx-6{list-style-type:none}ul.lst-kix_wyeoikf169tx-7{list-style-type:none}ul.lst-kix_wyeoikf169tx-8{list-style-type:none}ul.lst-kix_wyeoikf169tx-1{list-style-type:none}.lst-kix_26etd7yyufkn-5>li:before{content:\"\\0025a0  \"}ul.lst-kix_wyeoikf169tx-2{list-style-type:none}ul.lst-kix_wyeoikf169tx-3{list-style-type:none}.lst-kix_wyeoikf169tx-0>li:before{content:\"\\0025cf  \"}ul.lst-kix_wyeoikf169tx-4{list-style-type:none}.lst-kix_1h7jd02d177d-0>li:before{content:\"\\0025cf  \"}.lst-kix_26etd7yyufkn-4>li:before{content:\"\\0025cb  \"}ol{margin:0;padding:0}.c3{line-height:1.0178571428571428;padding-top:15pt;widows:2;orphans:2;direction:ltr;padding-bottom:9pt;page-break-after:avoid}.c0{widows:2;orphans:2;height:11pt;direction:ltr}.c8{padding-left:0pt;line-height:1.3;margin-left:36pt;padding-bottom:6pt}.c6{widows:2;orphans:2;direction:ltr}.c17{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c15{text-align:center;page-break-after:avoid}.c5{color:#252525;background-color:#ffffff}.c4{color:#333333;background-color:#ffffff}.c11{padding-left:0pt;margin-left:36pt}.c7{font-size:12pt;font-family:\"Microsoft Yahei\"}.c2{color:inherit;text-decoration:inherit}.c1{color:#1155cc;text-decoration:underline}.c18{margin:0;padding:0}.c19{line-height:1.3;padding-bottom:6pt}.c21{line-height:1.5272727012634297;padding-top:3pt}.c13{font-family:\"Microsoft Yahei\"}.c16{page-break-after:avoid}.c14{margin-left:18pt}.c9{font-weight:bold}.c12{margin-left:36pt}.c10{margin-left:54pt}.c20{text-indent:36pt}.title{widows:2;padding-top:0pt;line-height:1.15;orphans:2;text-align:left;color:#000000;font-size:21pt;font-family:\"Trebuchet MS\";padding-bottom:0pt;page-break-after:avoid}.subtitle{widows:2;padding-top:0pt;line-height:1.15;orphans:2;text-align:left;color:#666666;font-style:italic;font-size:13pt;font-family:\"Trebuchet MS\";padding-bottom:10pt;page-break-after:avoid}li{color:#000000;font-size:11pt;font-family:\"Arial\"}p{color:#000000;font-size:11pt;margin:0;font-family:\"Arial\"}h1{widows:2;padding-top:10pt;line-height:1.15;orphans:2;text-align:left;color:#000000;font-size:16pt;font-family:\"Trebuchet MS\";padding-bottom:0pt;page-break-after:avoid}h2{widows:2;padding-top:10pt;line-height:1.15;orphans:2;text-align:left;color:#000000;font-size:13pt;font-family:\"Trebuchet MS\";font-weight:bold;padding-bottom:0pt;page-break-after:avoid}h3{widows:2;padding-top:8pt;line-height:1.15;orphans:2;text-align:left;color:#666666;font-size:12pt;font-family:\"Trebuchet MS\";font-weight:bold;padding-bottom:0pt;page-break-after:avoid}h4{widows:2;padding-top:8pt;line-height:1.15;orphans:2;text-align:left;color:#666666;font-size:11pt;text-decoration:underline;font-family:\"Trebuchet MS\";padding-bottom:0pt;page-break-after:avoid}h5{widows:2;padding-top:8pt;line-height:1.15;orphans:2;text-align:left;color:#666666;font-size:11pt;font-family:\"Trebuchet MS\";padding-bottom:0pt;page-break-after:avoid}h6{widows:2;padding-top:8pt;line-height:1.15;orphans:2;text-align:left;color:#666666;font-style:italic;font-size:11pt;font-family:\"Trebuchet MS\";padding-bottom:0pt;page-break-after:avoid}</style></head><body class=\"c17\"><p class=\"c6 c15 title\"><a name=\"h.ty0r6dii9w5q\"></a><span>&#24503;&#24030;&#25169;&#20811;&#29609;&#27861;&#19982;&#35268;&#21017;</span></p><p class=\"c0\"><span></span></p><p class=\"c0\"><span></span></p><p class=\"c6 c14\"><span class=\"c1\"><a class=\"c2\" href=\"#h.gfiljoq3hex9\">&#28216;&#25103;&#35268;&#21017;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.wmjc0q1ngz52\">&#20351;&#29992;&#36947;&#20855;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.b6k3s414r7dp\">&#28216;&#25103;&#20154;&#25968;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.t13w397mmk7r\">&#21457;&#29260;&#19979;&#27880;</a></span></p><p class=\"c6 c10\"><span class=\"c1\"><a class=\"c2\" href=\"#h.9blr2z6h0cnh\">Pre-flop</a></span></p><p class=\"c6 c10\"><span class=\"c1\"><a class=\"c2\" href=\"#h.q2ve4odkxvra\">Flop</a></span></p><p class=\"c6 c10\"><span class=\"c1\"><a class=\"c2\" href=\"#h.v886kh2xrl8e\">Turn</a></span></p><p class=\"c6 c10\"><span class=\"c1\"><a class=\"c2\" href=\"#h.hg83xd4up6cn\">River</a></span></p><p class=\"c6 c10\"><span class=\"c1\"><a class=\"c2\" href=\"#h.222ntst8zr2b\">&#27604;&#29260;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.y771liajfiul\">&#27604;&#29260;&#26041;&#27861;</a></span></p><p class=\"c6 c14\"><span class=\"c1\"><a class=\"c2\" href=\"#h.rwz49udtid6n\">&#29609;&#27861;&#20171;&#32461;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.rhiuhyb3z16n\">&#24196;&#23478;(Dealer)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.jo3z6v1fldo1\">&#30450;&#27880;(Blinds)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.vxuznbr7fjzh\">&#24213;&#29260;(Hole cards)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.ct5kkeuabots\">&#31532;&#19968;&#36718;&#19979;&#27880;(Pre-flop)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.mhjkd5p67ujy\">&#32763;&#29260;&#21450;&#31532;&#20108;&#36718;&#19979;&#27880;(Flop)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.wyfyvt1748es\">&#36716;&#29260;&#21450;&#31532;&#19977;&#36718;&#19979;&#27880;(Turn)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.j348fp1yhcco\">&#27827;&#29260;&#21450;&#31532;&#22235;&#36718;&#19979;&#27880;(River)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.9okozipxnep2\">&#25674;&#29260;&#21644;&#27604;&#29260;(Showdown)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.jh3i0gkfweda\">&#26032;&#25163;&#30450;&#27880;</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.6r09orgvssm1\">&#20840;&#25276;(All-in)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.cmtkosp7jv0\">&#24213;&#27744;(Pot)</a></span></p><p class=\"c6 c12\"><span class=\"c1\"><a class=\"c2\" href=\"#h.7tnt381sixtq\">&#20027;&#27744;(Main pot)&#19982;&#36793;&#27744;(Side pot)</a></span></p><p class=\"c6 c14\"><span class=\"c1\"><a class=\"c2\" href=\"#h.25j1r7f1amgt\">&#21442;&#32771;&#25991;&#26723;</a></span></p><p class=\"c0\"><span></span></p><p class=\"c0\"><span></span></p><h1 class=\"c3\"><a name=\"h.gfiljoq3hex9\"></a><span>&#28216;&#25103;&#35268;&#21017;</span></h1><h2 class=\"c3\"><a name=\"h.wmjc0q1ngz52\"></a><span>&#20351;&#29992;&#36947;&#20855;</span></h2><p class=\"c6\"><span>&#19968;&#21103;&#26631;&#20934;&#25169;&#20811;&#29260;&#21435;&#25481;&#22823;&#23567;&#29579;&#21518;&#30340;52&#24352;&#29260;&#36827;&#34892;&#28216;&#25103;</span></p><p class=\"c0\"><span></span></p><h2 class=\"c3\"><a name=\"h.b6k3s414r7dp\"></a><span>&#28216;&#25103;&#20154;&#25968;</span></h2><p class=\"c6\"><span class=\"c5\">&#29702;&#35770;&#19978;&#19968;&#26700;&#21516;&#26102;&#26368;&#22810;&#21487;&#23481;&#32435;22&#20301;&#29609;&#23478;&#65292;</span><span class=\"c4\">&#19968;&#33324;2-10&#20010;&#29609;&#23478;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><h2 class=\"c3\"><a name=\"h.t13w397mmk7r\"></a><span>&#21457;&#29260;&#19979;&#27880;</span></h2><p class=\"c6\"><span>&#21457;&#29260;&#19968;&#33324;&#20998;&#20026;5&#20010;&#27493;&#39588;&#65292;&#20998;&#21035;&#20026;&#65306;</span></p><h3 class=\"c6 c16\"><a name=\"h.9blr2z6h0cnh\"></a><span>Pre-flop</span></h3><p class=\"c6\"><span>&#20808;&#19979;&#22823;&#23567;&#30450;&#27880;&#65292;&#28982;&#21518;&#32473;&#27599;&#20010;&#29609;&#23478;&#21457;2&#24352;&#24213;&#29260;&#65292;&#22823;&#30450;&#27880;&#21518;&#38754;&#31532;&#19968;&#20010;&#29609;&#23478;&#36873;&#25321;&#36319;&#27880;&#12289;&#21152;&#27880;&#25110;&#32773;&#30422;&#29260;&#25918;&#24323;&#65292;&#25353;&#29031;&#39034;&#26102;&#38024;&#26041;&#21521;&#65292;&#20854;&#20182;&#29609;&#23478;&#20381;&#27425;&#34920;&#24577;&#65292;&#22823;&#30450;&#27880;&#29609;&#23478;&#26368;&#21518;&#34920;&#24577;&#65292;&#22914;&#26524;&#29609;&#23478;&#26377;&#21152;&#27880;&#24773;&#20917;&#65292;&#21069;&#38754;&#24050;&#32463;&#36319;&#27880;&#30340;&#29609;&#23478;&#38656;&#35201;&#20877;&#27425;&#34920;&#24577;&#29978;&#33267;&#22810;&#27425;&#34920;&#24577;&#12290;</span></p><p class=\"c0\"><span></span></p><h3 class=\"c6 c16\"><a name=\"h.q2ve4odkxvra\"></a><span>Flop</span></h3><p class=\"c6\"><span>&#21516;&#26102;&#21457;&#19977;&#24352;&#20844;&#29260;&#65292;&#30001;&#23567;&#30450;&#27880;&#24320;&#22987;&#65288;&#22914;&#26524;&#23567;&#30450;&#27880;&#24050;&#30422;&#29260;&#65292;&#30001;&#21518;&#38754;&#26368;&#36817;&#30340;&#29609;&#23478;&#24320;&#22987;&#65292;&#20197;&#27492;&#31867;&#25512;&#65289;&#65292;&#25353;&#29031;&#39034;&#26102;&#38024;&#26041;&#21521;&#20381;&#27425;&#34920;&#24577;&#65292;&#29609;&#23478;&#21487;&#20197;&#36873;&#25321;&#19979;&#27880;&#12289;&#21152;&#27880;&#12289;&#25110;&#32773;&#30422;&#29260;&#25918;&#24323;&#12290;</span></p><p class=\"c0\"><span></span></p><h3 class=\"c6 c16\"><a name=\"h.v886kh2xrl8e\"></a><span>Turn</span></h3><p class=\"c6\"><span>&#21457;&#31532;4&#24352;&#29260;&#65292;&#30001;&#23567;&#30450;&#27880;&#24320;&#22987;&#65292;&#25353;&#29031;&#39034;&#26102;&#38024;&#26041;&#21521;&#20381;&#27425;&#34920;&#24577;&#12290;</span></p><p class=\"c0\"><span></span></p><h3 class=\"c6 c16\"><a name=\"h.hg83xd4up6cn\"></a><span>River</span></h3><p class=\"c6\"><span>&#21457;&#31532;</span><span>&#20116;&#24352;&#29260;</span><span>&#65292;&#30001;&#23567;&#30450;&#27880;&#24320;&#22987;&#65292;&#25353;&#29031;&#39034;&#26102;&#38024;&#26041;&#21521;&#20381;&#27425;&#34920;&#24577;&#65292;&#29609;&#23478;&#21487;&#20197;&#36873;&#25321;&#19979;&#27880;&#12289;&#21152;&#27880;&#12289;&#25110;&#32773;&#30422;&#29260;&#25918;&#24323;&#12290;</span></p><p class=\"c0\"><span></span></p><h3 class=\"c6 c16\"><a name=\"h.222ntst8zr2b\"></a><span>&#27604;&#29260;</span></h3><p class=\"c6\"><span>&#32463;&#36807;&#21069;&#38754;4&#36718;&#21457;&#29260;&#21644;&#19979;&#27880;&#65292;&#21097;&#20313;&#30340;&#29609;&#23478;&#24320;&#22987;&#20142;&#29260;&#27604;&#22823;&#23567;&#65292;&#25104;&#29260;&#26368;&#22823;&#30340;&#29609;&#23478;&#36194;&#21462;&#27744;&#24213;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c0\"><span class=\"c4\"></span></p><h2 class=\"c3\"><a name=\"h.y771liajfiul\"></a><span>&#27604;&#29260;&#26041;&#27861;</span></h2><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4\">&#29992;&#33258;&#24049;&#30340;2&#24352;&#24213;&#29260;&#21644;5&#24352;&#20844;&#20849;&#29260;&#32467;&#21512;&#22312;&#19968;&#36215;&#65292;&#36873;&#20986;5&#24352;&#29260;&#65292;&#19981;&#35770;&#25163;&#20013;&#30340;&#29260;&#20351;&#29992;&#20960;&#24352;&#65288;&#29978;&#33267;&#21487;&#20197;&#19981;&#29992;&#25163;&#20013;&#30340;&#24213;&#29260;&#65289;&#65292;&#20945;&#25104;&#26368;&#22823;&#30340;&#25104;&#29260;&#65292;&#36319;&#20854;&#20182;&#29609;&#23478;&#27604;&#22823;&#23567;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4\">&#27604;&#29260;&#20808;&#27604;&#29260;&#22411;&#65292;&#22823;&#30340;&#29260;&#22411;&#22823;&#20110;&#23567;&#30340;&#29260;&#22411;&#65292;&#29260;&#22411;&#19968;&#33324;&#20998;&#20026;10&#31181;&#65292;&#20174;&#22823;&#21040;&#23567;&#20026;&#65306;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c13 c9\">&#30343;&#23478;&#21516;&#33457;&#39034;</span><span class=\"c4\">&#65288;Royal Flush&#65289;</span></p><p class=\"c6\"><span>&#21516;&#33457;&#33394;&#30340;A, K, Q, J&#21644;10&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22312;&#25674;&#29260;&#30340;&#26102;&#20505;&#26377;&#20004;&#21103;&#22810;&#21103;&#30343;&#23478;&#21516;&#33457;&#39034;&#26102;&#65292;&#24179;&#20998;&#31609;&#30721;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#21516;&#33457;&#39034;</span><span class=\"c4\">&#65288;Straight Flush&#65289;</span></p><p class=\"c6\"><span>&#20116;&#24352;&#21516;&#33457;&#33394;&#30340;&#36830;&#32493;&#29260;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#25674;&#29260;&#26102;&#26377;&#20004;&#21103;&#25110;&#22810;&#21103;&#21516;&#33457;&#39034;&#65292;&#36830;&#32493;&#29260;&#30340;&#22836;&#24352;&#29260;&#22823;&#30340;&#33719;&#24471;&#31609;&#30721;&#12290;&#22914;&#26524;&#26159;&#20004;&#21103;&#25110;&#22810;&#21103;&#30456;&#21516;&#30340;&#36830;&#32493;&#29260;&#65292;&#24179;&#20998;&#31609;&#30721;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#22235;&#26465;</span><span class=\"c4\">&#65288;Four of a Kind&#65292;&#20134;&#31216;&ldquo;&#38081;&#25903;&rdquo;&#12289;&ldquo;&#22235;&#24352;&rdquo;&#25110;&ldquo;&#28856;&#24377;&rdquo;&#65289;</span></p><p class=\"c6\"><span>&#20854;&#20013;&#22235;&#24352;&#26159;&#30456;&#21516;&#28857;&#25968;&#20294;&#19981;&#21516;&#33457;&#30340;&#25169;&#20811;&#29260;&#65292;&#31532;&#20116;&#24352;&#26159;&#38543;&#24847;&#30340;&#19968;&#24352;&#29260;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#20004;&#32452;&#25110;&#32773;&#26356;&#22810;&#32452;&#25674;&#29260;&#65292;&#21017;&#22235;&#24352;&#29260;&#20013;&#30340;&#26368;&#22823;&#32773;&#36194;&#23616;&#65292;&#22914;&#26524;&#19968;&#32452;&#20154;&#25345;&#26377;&#30340;&#22235;&#24352;&#29260;&#26159;&#19968;&#26679;&#30340;&#65292;&#37027;&#20040;&#31532;&#20116;&#24352;&#29260;&#26368;&#22823;&#32773;&#36194;&#23616;&#65288;&#36215;&#33050;&#29260;&#65289;&#12290;&#22914;&#26524;&#36215;&#33050;&#29260;&#20063;&#19968;&#26679;&#65292;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9 c13\">&#28385;&#22530;&#24425;</span><span class=\"c4\">&#65288;Fullhouse&#65292;</span><span class=\"c4 c13\">&#33899;&#33446;&#65292;&#19977;&#24102;&#20108;</span><span class=\"c4\">&#65289;</span></p><p class=\"c6\"><span>&#30001;&#19977;&#24352;&#30456;&#21516;&#28857;&#25968;&#21450;&#20219;&#20309;&#20004;&#24352;&#20854;&#20182;&#30456;&#21516;&#28857;&#25968;&#30340;&#25169;&#20811;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#20004;&#32452;&#25110;&#32773;&#26356;&#22810;&#32452;&#25674;&#29260;&#65292;&#37027;&#20040;&#19977;&#24352;&#30456;&#21516;&#28857;&#25968;&#20013;&#36739;&#22823;&#32773;&#36194;&#23616;&#12290;&#22914;&#26524;&#19977;&#24352;&#29260;&#37117;&#19968;&#26679;&#65292;&#21017;&#20004;&#24352;&#29260;&#20013;&#28857;&#25968;&#36739;&#22823;&#32773;&#36194;&#23616;&#65292;&#22914;&#26524;&#25152;&#26377;&#30340;&#29260;&#37117;&#19968;&#26679;&#65292;&#21017;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#21516;&#33457;</span><span class=\"c4\">&#65288;Flush&#65292;&#31616;&#31216;&ldquo;&#33457;&rdquo;&#65289;</span></p><p class=\"c6\"><span>&#27492;&#29260;&#30001;&#20116;&#24352;&#19981;&#25353;&#39034;&#24207;&#20294;&#30456;&#21516;&#33457;&#30340;&#25169;&#20811;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#21040;&#27492;&#29260;&#30456;&#65292;&#21017;&#29260;&#28857;&#26368;&#39640;&#30340;&#20154;&#36194;&#24471;&#35813;&#23616;&#65292;&#22914;&#26524;&#26368;&#22823;&#28857;&#30456;&#21516;&#65292;&#21017;&#30001;&#31532;&#20108;&#12289;&#31532;&#19977;&#12289;&#31532;&#22235;&#25110;&#32773;&#31532;&#20116;&#24352;&#29260;&#26469;&#20915;&#23450;&#32988;&#36127;&#65292;&#22914;&#26524;&#25152;&#26377;&#30340;&#29260;&#37117;&#30456;&#21516;&#65292;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#39034;&#23376;</span><span class=\"c4\">&#65288;Straight&#65292;&#20134;&#31216;&ldquo;&#34503;&rdquo;&#65289;</span></p><p class=\"c6\"><span>&#27492;&#29260;&#30001;&#20116;&#24352;&#39034;&#24207;&#25169;&#20811;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#21040;&#27492;&#29260;&#65292;&#21017;&#20116;&#24352;&#29260;&#20013;&#28857;&#25968;&#26368;&#22823;&#30340;&#36194;&#24471;&#27492;&#23616;&#65292;&#22914;&#26524;&#25152;&#26377;&#29260;&#28857;&#25968;&#37117;&#30456;&#21516;&#65292;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#19977;&#26465;</span><span class=\"c4\">&#65288;Three of a kind&#65292;&#20134;&#31216;&ldquo;&#19977;&#24352;&rdquo;&#65289;</span></p><p class=\"c6\"><span>&#30001;&#19977;&#24352;&#30456;&#21516;&#28857;&#25968;&#21644;&#20004;&#24352;&#19981;&#21516;&#28857;&#25968;&#30340;&#25169;&#20811;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#21040;&#27492;&#29260;&#65292;&#21017;&#19977;&#24352;&#29260;&#20013;&#26368;&#22823;&#28857;&#25968;&#32773;&#36194;&#23616;&#65292;&#22914;&#26524;&#19977;&#24352;&#29260;&#37117;&#30456;&#21516;&#65292;&#27604;&#36739;&#31532;&#22235;&#24352;&#29260;&#65292;&#24517;&#35201;&#26102;&#27604;&#36739;&#31532;&#20116;&#24352;&#65292;&#28857;&#25968;&#22823;&#30340;&#20154;&#36194;&#23616;&#12290;&#22914;&#26524;&#25152;&#26377;&#29260;&#37117;&#30456;&#21516;&#65292;&#21017;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#20004;&#23545;</span><span class=\"c4\">&#65288;Two Pairs&#65289;</span></p><p class=\"c6\"><span>&#20004;&#23545;&#28857;&#25968;&#30456;&#21516;&#20294;&#20004;&#20004;&#19981;&#21516;&#30340;&#25169;&#20811;&#21644;&#38543;&#24847;&#30340;&#19968;&#24352;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#22823;&#27492;&#29260;&#30456;&#65292;&#29260;&#28857;&#27604;&#36739;&#22823;&#30340;&#20154;&#36194;&#65292;&#22914;&#26524;&#27604;&#36739;&#22823;&#30340;&#29260;&#28857;&#30456;&#21516;&#65292;&#37027;&#20040;&#36739;&#23567;&#29260;&#28857;&#20013;&#30340;&#36739;&#22823;&#32773;&#36194;&#65292;&#22914;&#26524;&#20004;&#23545;&#29260;&#28857;&#30456;&#21516;&#65292;&#37027;&#20040;&#31532;&#20116;&#24352;&#29260;&#28857;&#36739;&#22823;&#32773;&#36194;&#65288;&#36215;&#33050;&#29260;&#65289;&#12290;&#22914;&#26524;&#36215;&#33050;&#29260;&#20063;&#30456;&#21516;&#65292;&#21017;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#19968;&#23545;</span><span class=\"c4\">&#65288;One Pair&#65289;</span></p><p class=\"c6\"><span>&#30001;&#20004;&#24352;&#30456;&#21516;&#28857;&#25968;&#30340;&#25169;&#20811;&#29260;&#21644;&#21478;&#19977;&#24352;&#38543;&#24847;&#30340;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#21040;&#27492;&#29260;&#65292;&#21017;&#20004;&#24352;&#29260;&#20013;&#28857;&#25968;&#22823;&#30340;&#36194;&#65292;&#22914;&#26524;&#23545;&#29260;&#37117;&#19968;&#26679;&#65292;&#21017;&#27604;&#36739;&#21478;&#22806;&#19977;&#24352;&#29260;&#20013;&#22823;&#30340;&#36194;&#65292;&#22914;&#26524;&#21478;&#22806;&#19977;&#24352;&#29260;&#20013;&#36739;&#22823;&#30340;&#20063;&#19968;&#26679;&#21017;&#27604;&#36739;&#31532;&#20108;&#22823;&#30340;&#21644;&#31532;&#19977;&#22823;&#30340;&#65292;&#22914;&#26524;&#25152;&#26377;&#30340;&#29260;&#37117;&#19968;&#26679;&#65292;&#21017;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span class=\"c4 c9\">&#39640;&#29260;</span><span class=\"c4\">&#65288;high card&#65289;</span></p><p class=\"c6\"><span>&#26082;&#19981;&#26159;&#21516;&#19968;&#33457;&#33394;&#20063;&#19981;&#26159;&#21516;&#19968;&#28857;&#25968;&#30340;&#20116;&#24352;&#29260;&#32452;&#25104;&#12290;</span></p><p class=\"c6\"><span>&#24179;&#25163;&#29260;&#65306;&#22914;&#26524;&#19981;&#27490;&#19968;&#20154;&#25235;&#21040;&#27492;&#29260;&#65292;&#21017;&#27604;&#36739;&#28857;&#25968;&#26368;&#22823;&#32773;&#65292;&#22914;&#26524;&#28857;&#25968;&#26368;&#22823;&#30340;&#30456;&#21516;&#65292;&#21017;&#27604;&#36739;&#31532;&#20108;&#12289;&#31532;&#19977;&#12289;&#31532;&#22235;&#21644;&#31532;&#20116;&#22823;&#30340;&#65292;&#22914;&#26524;&#25152;&#26377;&#29260;&#37117;&#30456;&#21516;&#65292;&#21017;&#24179;&#20998;&#24425;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c0\"><span class=\"c4\"></span></p><h1 class=\"c6 c16\"><a name=\"h.rwz49udtid6n\"></a><span>&#29609;&#27861;&#20171;&#32461;</span></h1><p class=\"c0\"><span class=\"c4\"></span></p><h2 class=\"c6 c16\"><a name=\"h.rhiuhyb3z16n\"></a><span>&#24196;&#23478;(Dealer)</span></h2><p class=\"c0\"><span class=\"c4\"></span></p><p class=\"c6\"><span>&#39318;&#20808;&#30830;&#23450;&#24196;&#23478;&#65288;&#33521;&#25991;&#20026;Button&#65292;&#22266;&#20063;&#31216;&#25353;&#38062;&#65289;&#20301;&#32622;&#12290;&#31532;&#19968;&#23616;&#24196;&#23478;&#20301;&#32622;&#31995;&#32479;&#38543;&#26426;&#25351;&#23450;&#65292;&#20197;&#21518;&#27599;&#23616;&#24196;&#23478;&#20301;&#32622;&#25353;&#29031;&#39034;&#26102;&#38024;&#26041;&#21521;&#19979;&#31227;&#19968;&#20301;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.jo3z6v1fldo1\"></a><span>&#30450;&#27880;(Blinds)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#20026;&#20102;&#20351;&#24471;&#28216;&#25103;&#33021;&#22815;&#36827;&#34892;&#65292;&#24378;&#21046;&#24196;&#23478;&#24038;&#36793;&#31532;&#19968;&#20010;&#20154;&#19979;&#19968;&#27880;&#65288;&#31216;&#23567;&#30450;&#27880; Small Blind&#65289;&#65292;&#25353;&#38062;&#24038;&#36793;&#31532;&#20108;&#20010;&#20154;&#19979;&#20004;&#27880;&#65288;&#31216;&#22823;&#30450;&#27880; Big Blind&#65289;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.vxuznbr7fjzh\"></a><span>&#24213;&#29260;(Hole cards)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#19979;&#30450;&#27880;&#21518;&#20174;&#19979;&#22823;&#30450;&#27880;&#29609;&#23478;&#24320;&#22987;&#25353;&#39034;&#26102;&#38024;&#26041;&#21521;&#27599;&#20154;&#21457;&#20004;&#24352;&#29260;&#65292;&#30342;&#20026;&#26263;&#29260;&#65292;&#31216;&#24213;&#29260;&#25110;&#36215;&#25163;&#29260;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.ct5kkeuabots\"></a><span>&#31532;&#19968;&#36718;&#19979;&#27880;(Pre-flop)</span></h2><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span>&#21457;&#24213;&#29260;&#21518;&#65292;&#20174;&#22823;&#30450;&#27880;&#24038;&#36793;&#30340;&#29609;&#23478;&#24320;&#22987;&#34892;&#21160;/&#21483;&#27880;/&#35828;&#35805;</span><span class=\"c9\">(Action)</span><span>&#65292;&#34892;&#21160;&#25351;&#20174;&#20197;&#19979;&#20960;&#39033;&#36873;&#25321;&#20854;&#19968;&#65306;</span></p><ul class=\"c18 lst-kix_wyeoikf169tx-0 start\"><li class=\"c6 c11\"><span class=\"c9\">&#24323;&#29260;(Fold)</span><span>&#65306;&#25918;&#24323;&#26412;&#21103;&#29260;&#65292;&#19981;&#21442;&#19982;&#31454;&#20105;&#12290;</span></li><li class=\"c6 c11\"><span class=\"c9\">&#35753;&#29260;(Check)</span><span>&#65306;&#35266;&#26395;&#24577;&#24230;&#65292;&#25110;&#32773;&#26159;&#25366;&#38519;&#38449;&#12290;</span></li><li class=\"c6 c11\"><span class=\"c9\">&#36319;&#27880;(Call)</span><span>&#65306;&#36319;&#21040;&#21644;&#19978;&#23478;&#30456;&#21516;&#30340;&#27880;&#39069;&#12290;</span></li><li class=\"c6 c11\"><span class=\"c9\">&#21152;&#27880;(Raise)</span><span>&#65306;&#22686;&#21152;&#19979;&#27880;&#39069;&#65292;&#30452;&#21040;&#20840;&#37096;&#31609;&#30721;&#21363;</span><span class=\"c9\">&#20840;&#25276;</span><span>(</span><span class=\"c9\">All-in</span><span>)&#12290;</span></li></ul><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span>&#19968;&#20154;&#32467;&#26463;&#34892;&#21160;&#21518;&#25353;&#39034;&#26102;&#38024;&#26041;&#21521;&#19979;&#19968;&#29609;&#23478;&#33719;&#24471;&#34892;&#21160;&#26435;&#65292;&#30452;&#21040;&#19981;&#20877;&#26377;&#20154;&#24323;&#29260;&#65292;&#19988;&#27599;&#20154;&#24050;&#21521;&#22870;&#27744;&#25237;&#20837;&#30456;&#21516;&#27880;&#39069;&#12290;&#24050;&#24323;&#29260;&#29609;&#23478;&#19981;&#20877;&#26377;&#34892;&#21160;&#26435;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span class=\"c5\">&#22914;&#26080;&#30450;&#27880;&#65292;&#21017;&#20026;&#21457;&#29260;&#20154;&#24038;&#26041;&#30340;&#29609;&#23478;&#65292;&#22914;&#20026;&#19968;&#23545;&#19968;&#26102;&#65292;&#21017;&#30001;&#22823;&#30450;&#27880;&#20808;&#34892;&#21483;&#27880;&#12290;</span></p><p class=\"c0\"><span class=\"c5\"></span></p><h2 class=\"c6 c16\"><a name=\"h.mhjkd5p67ujy\"></a><span>&#32763;&#29260;&#21450;&#31532;&#20108;&#36718;&#19979;&#27880;(Flop)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#21457;&#19977;&#24352;&#29260;&#21040;&#29260;&#26700;&#20013;&#22830;&#65292;&#31216;&#20026;&ldquo;</span><span class=\"c9\">&#32763;&#29260;</span><span>&rdquo;&#65292;&#20026;&#20844;&#20849;&#29260;&#65292;&#25152;&#26377;&#20154;&#21487;&#35265;&#12290;</span></p><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#20174;&#23567;&#30450;&#27880;&#29609;&#23478;&#25353;&#39034;&#26102;&#38024;&#26041;&#21521;&#20570;&#21516;&#20110;&#31532;&#19968;&#36718;&#30340;&#34892;&#21160;&#65292;&#30452;&#21040;&#19981;&#20877;&#26377;&#20154;&#24323;&#29260;&#65292;&#19988;&#27599;&#20154;&#24050;&#21521;&#22870;&#27744;&#25237;&#20837;&#30456;&#21516;&#27880;&#39069;&#12290;&#24050;&#24323;&#29260;&#29609;&#23478;&#19981;&#20877;&#21442;&#19982;&#28216;&#25103;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.wyfyvt1748es\"></a><span>&#36716;&#29260;&#21450;&#31532;&#19977;&#36718;&#19979;&#27880;(Turn)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#21457;&#31532;&#22235;&#24352;&#29260;&#65292;&#31216;&#20026;&ldquo;</span><span class=\"c9\">&#36716;&#29260;</span><span>&rdquo;&#65292;&#20026;&#20844;&#20849;&#29260;&#65292;&#25152;&#26377;&#20154;&#21487;&#35265;&#12290;</span></p><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#20174;&#23567;&#30450;&#27880;&#29609;&#23478;&#25353;&#39034;&#26102;&#38024;&#26041;&#21521;&#20570;&#21516;&#20110;&#31532;&#19968;&#36718;&#30340;&#34892;&#21160;&#65292;&#30452;&#21040;&#19981;&#20877;&#26377;&#20154;&#24323;&#29260;&#65292;&#19988;&#27599;&#20154;&#24050;&#21521;&#22870;&#27744;&#25237;&#20837;&#30456;&#21516;&#27880;&#39069;&#12290;&#24050;&#24323;&#29260;&#29609;&#23478;&#19981;&#20877;&#21442;&#19982;&#28216;&#25103;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.j348fp1yhcco\"></a><span>&#27827;&#29260;&#21450;&#31532;&#22235;&#36718;&#19979;&#27880;(River)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#21457;&#31532;&#20116;&#24352;&#29260;&#65292;&#31216;&#20026;&ldquo;&#27827;&#29260;&rdquo;&#65292;&#20026;&#20844;&#20849;&#29260;&#65292;&#25152;&#26377;&#20154;&#21487;&#35265;&#12290;</span></p><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#20174;&#23567;&#30450;&#27880;&#29609;&#23478;&#25353;&#39034;&#26102;&#38024;&#26041;&#21521;&#20570;&#21516;&#20110;&#31532;&#19968;&#36718;&#30340;&#34892;&#21160;&#65292;&#30452;&#21040;&#19981;&#20877;&#26377;&#20154;&#24323;&#29260;&#65292;&#19988;&#27599;&#20154;&#24050;&#21521;&#22870;&#27744;&#25237;&#20837;&#30456;&#21516;&#27880;&#39069;&#12290;&#24050;&#24323;&#29260;&#29609;&#23478;&#19981;&#20877;&#21442;&#19982;&#28216;&#25103;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.9okozipxnep2\"></a><span>&#25674;&#29260;&#21644;&#27604;&#29260;(</span><span class=\"c4 c7\">Showdown)</span></h2><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span class=\"c4 c7\">&#22235;&#36718;&#19979;&#27880;&#37117;&#23436;&#25104;&#21518;&#65292;&#33509;&#20173;&#21097;&#20313;&#20004;&#21517;&#25110;&#20004;&#21517;&#20197;&#19978;&#29609;&#23478;&#65292;&#21017;&#36827;&#34892;&#27604;&#29260;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span class=\"c4 c7\">&#27604;&#29260;&#26102;&#65292;&#27599;&#20301;&#29609;&#23478;&#29992;&#25163;&#20013;2&#24352;&#24213;&#29260;&#19982;5&#24352;&#20844;&#20849;&#29260;&#20013;&#20219;&#36873;5&#24352;&#32452;&#25104;&#26368;&#22823;&#29260;&#32773;&#36827;&#34892;&#27604;&#36739;&#22823;&#23567;&#12290;&#32988;&#32773;&#36194;&#24471;&#24213;&#27744;&#25152;&#26377;&#27880;&#30721;&#12290;&#33509;&#26377;&#22810;&#20154;&#33719;&#32988;&#65292;&#21017;&#24179;&#20998;&#24213;&#27744;&#27880;&#30721;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><p class=\"c6\"><span>&#30070;&#24425;&#27744;&#30001;&#20841;&#20491;&#20197;&#19978;&#29609;&#23478;&#24179;&#20998;&#26178;&#65292;&#33509;&#26377;&#28961;&#27861;&#24179;&#20998;&#20043;&#23567;&#38989;&#31820;&#30908;&#65292;&#30001;&#38918;&#26178;&#37912;&#26041;&#21521;&#31639;&#36942;&#21435;&#65292;&#26368;&#38752;&#36817;&#30332;&#29260;&#32773;&#30340;&#36111;&#23478;&#21462;&#24471;&#65292;&#33289;&#20363;&#20358;&#35498;&#26377;ABCDE&#20381;&#38918;&#26178;&#37912;&#26041;&#21521;&#20837;&#24231;&#65292;A&#28858;&#26412;&#23616;&#30332;&#29260;&#32773;&#65292;&#26368;&#23567;&#38754;&#38989;&#31820;&#30908;&#28858;$10&#65292;&#25152;&#26377;&#29609;&#23478;&#30342;&#26410;&#33995;&#29260;&#33267;&#25892;&#29260;&#65292;&#26368;&#32066;&#30001;CDE&#21213;&#20986;&#24179;&#20998;&#26412;&#23616;&#24425;&#27744;$1000&#26178;&#65292;&#21063;DE&#21508;&#20998;&#21040;$330&#65292;&#32780;&#22810;&#20986;&#30340;$10&#23559;&#20998;&#37197;&#32102;&#26368;&#38752;&#36817;A&#30340;&#36111;&#23478;C&#65292;C&#26044;&#26412;&#23616;&#21487;&#20998;&#21040;$340&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.jh3i0gkfweda\"></a><span>&#26032;&#25163;&#30450;&#27880;</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#22312;&#29260;&#23616;&#24050;&#32463;&#24418;&#25104;&#30340;&#24773;&#20917;&#19979;&#65292;&#26032;&#21152;&#20837;&#29260;&#23616;&#30340;&#20154;&#65292;&#38656;&#35201;&#19979;&#26032;&#25163;&#30450;&#27880;&#65292;&#26032;&#25163;&#30450;&#27880;&#31561;&#20110;&#22823;&#30450;&#27880;&#12290;</span></p><p class=\"c0\"><span></span></p><h2 class=\"c6 c16\"><a name=\"h.6r09orgvssm1\"></a><span>&#20840;&#25276;(All-in)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span class=\"c4 c7\">&#24403;&#19968;&#20010;&#29609;&#23478;&#21152;&#27880;&#25110;&#20225;&#22270;&#36319;&#27880;&#21364;&#31609;&#30721;&#19981;&#36275;&#26102;&#65292;&#20182;&#21487;&#20197;&#36873;&#25321;&#20840;&#25276;&#12290;&#24403;&#26377;&#29609;&#23478;&#20840;&#25276;&#26102;&#65292;&#20182;&#20250;&#36319;&#36827;&#20182;&#25152;&#26377;&#30340;&#31609;&#30721;&#65292;&#24213;&#27744;&#34987;&#20998;&#20026;&#20027;&#27744;&#21644;&#36793;&#27744;&#12290;&#20854;&#20182;&#29609;&#23478;&#22810;&#20986;&#20840;&#25276;&#29609;&#23478;&#31609;&#30721;&#30340;&#27880;&#39069;&#23558;&#37117;&#20250;&#34987;&#21152;&#20837;&#36793;&#27744;&#65292;&#27492;&#20840;&#25276;&#29609;&#23478;&#23558;&#19981;&#21487;&#33021;&#33719;&#24471;&#36793;&#27744;&#32780;&#21482;&#21487;&#33021;&#36194;&#24471;&#20027;&#27744;&#12290;&#21516;&#29702;&#65292;&#24403;&#22810;&#20010;&#29609;&#23478;&#20840;&#25276;&#26102;&#21487;&#33021;&#20986;&#29616;&#22810;&#20010;&#36793;&#27744;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.cmtkosp7jv0\"></a><span>&#24213;&#27744;(Pot)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#27599;&#19968;&#20010;&#29260;&#23616;&#37324;&#20247;&#20154;&#24050;&#25276;&#19978;&#30340;&#31609;&#30721;&#24635;&#39069;&#65292;&#20063;&#21363;&#35813;&#23616;&#30340;&#22870;&#37329;&#25968;&#30446;&#12290;</span></p><p class=\"c0\"><span class=\"c4 c7\"></span></p><h2 class=\"c6 c16\"><a name=\"h.7tnt381sixtq\"></a><span class=\"c9\">&#20027;&#27744;(Main pot)</span><span>&#19982;</span><span class=\"c9\">&#36793;&#27744;(Side pot)</span></h2><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#24403;&#27809;&#26377;&#29609;&#23478;&#20840;&#25276;(All-in)&#26102;&#65292;&#24213;&#27744;&#30001;&#26410;&#24323;&#29260;&#30340;&#29609;&#23478;&#20013;&#29260;&#22411;&#26368;&#22823;&#32773;&#29420;&#24471;&#12290;</span></p><p class=\"c6\"><span>&#24403;&#26377;&#19968;&#20010;&#25110;&#22810;&#20010;&#29609;&#23478;&#20840;&#25276;&#26102;&#65292;&#36229;&#36807;&#29609;&#23478;&#21387;&#27880;&#37329;&#39069;&#30340;&#37096;&#20998;&#23558;&#20250;&#24418;&#25104;&#19968;&#20010;&#25110;&#22810;&#20010;&#36793;&#27744;&#12290;&#29609;&#23478;&#21442;&#19982;&#25237;&#27880;&#35813;&#36793;&#27744;&#25165;&#26377;&#26426;&#20250;&#36194;&#21462;&#25913;&#36793;&#27744;&#12290;</span></p><p class=\"c6\"><span>&#24403;&#19968;&#23616;&#32467;&#26463;&#32780;&#19988;&#25152;&#26377;&#24050;&#20840;&#25276;&#30340;&#29609;&#23478;&#26410;&#25345;&#26377;&#26368;&#22823;&#29260;&#22411;&#26102;&#65292;&#36793;&#27744;&#21644;&#20027;&#27744;&#37117;&#30001;&#29260;&#38754;&#26368;&#20339;&#33719;&#32988;&#32773;&#36194;&#21462;&#12290;</span></p><p class=\"c6\"><span>&#24403;&#19968;&#23616;&#32467;&#26463;&#32780;&#19988;&#26377;&#20840;&#25276;&#30340;&#29609;&#23478;&#36194;&#29260;&#26102;&#65292;&#35813;&#29609;&#23478;&#26377;&#21442;&#19982;&#25237;&#27880;&#30340;&#20027;&#27744;&#21644;&#36793;&#27744;&#22343;&#24402;&#35813;&#29609;&#23478;&#65292;&#32780;&#20854;&#20182;&#36793;&#27744;&#30001;&#21442;&#19982;&#25913;&#27744;&#25237;&#27880;&#37324;&#65292;&#25345;&#26377;&#26368;&#22823;&#29260;&#38754;&#30340;&#29609;&#23478;&#36194;&#24471;&#12290;</span></p><p class=\"c6\"><span>&#22312;&#20960;&#20010;&#29609;&#23478;&#20840;&#25276;&#24418;&#25104;&#22810;&#20010;&#36793;&#27744;&#26102;&#65292;&#20381;&#20840;&#25276;&#30340;&#39034;&#24207;&#20998;&#37197;&#32473;&#21508;&#36793;&#27744;&#20013;&#26368;&#20339;&#29260;&#38754;&#30340;&#29609;&#23478;&#65292;&#26377;&#26368;&#22823;&#29260;&#38754;&#30340;&#29609;&#23478;&#36194;&#24471;&#35813;&#29609;&#23478;&#20840;&#25276;&#21069;&#25152;&#32047;&#31215;&#30340;&#36793;&#27744;&#12290;&#24050;&#20840;&#25276;&#30340;&#29609;&#23478;&#26080;&#27861;&#36194;&#21462;&#20840;&#25276;&#21518;&#20135;&#29983;&#30340;&#36793;&#27744;&#65292;&#21363;&#26368;&#22810;&#21482;&#33021;&#20174;&#20854;&#20182;&#27599;&#20010;&#36319;&#29260;&#29609;&#23478;&#22788;&#21462;&#24471;&#30456;&#24403;&#20110;&#26412;&#36523;&#20840;&#25276;&#30340;&#24635;&#31609;&#30721;&#25968;&#12290;&#20840;&#25276;&#21518;&#30340;&#19979;&#27880;&#21487;&#35270;&#20026;&#21482;&#22312;&#20043;&#21518;&#21442;&#19982;&#30340;&#29609;&#23478;&#20043;&#38388;&#30340;&#29420;&#31435;&#36755;&#36194;&#20998;&#37197;&#12290;</span></p><p class=\"c6\"><span>&#26080;&#20154;&#36319;&#27880;&#30340;&#36793;&#27744;(&#20165;&#26377;&#19968;&#20301;&#29609;&#23478;&#19979;&#27880;&#65292;&#21097;&#19979;&#20854;&#20182;&#29609;&#23478;&#37117;&#24323;&#29260;)&#23558;&#20250;&#30452;&#25509;&#36194;&#24471;&#35813;&#36793;&#27744;&#65292;&#30456;&#24403;&#20110;&#36864;&#25442;&#19979;&#27880;&#20110;&#35813;&#36793;&#27744;&#30340;&#31609;&#30721;&#12290;</span></p><p class=\"c0\"><span></span></p><p class=\"c6 c21\"><span class=\"c9\">&#24213;&#27744;&#20998;&#37197;&#33539;&#20363;</span></p><p class=\"c0\"><span></span></p><p class=\"c6\"><span class=\"c5\">&#20363;&#22914;ABCDEF&#20845;&#21517;&#29609;&#23478;&#21443;&#33287;&#29260;&#23616;&#65292;F&#26044;&#20013;&#36884;&#33995;&#29260;&#36864;&#20986;&#65292;&#26368;&#32066;A&#20840;&#25276;&#25237;&#20837;$50&#65292;B&#20840;&#25276;&#25237;&#20837;$250&#65292;C&#20840;&#25276;&#25237;&#20837;$350&#65292;DE&#21508;&#25237;&#20837;$800&#65292;F&#25237;&#20837;$500&#65292;&#27492;&#26178;&#32317;&#24425;&#27744;&#22823;&#23567;&#28858;$2750&#65292;&#24418;&#25104;&#20102;&#19968;&#20491;&#20027;&#27744;&#28858;50*6=$300&#65292;&#37002;&#27744;&#21508;&#28858;&#65288;250-50&#65289;*5=$1000&#65292;&#65288;350-250&#65289;*4=$400&#65292;&#65288;500-350&#65289;*3=$450&#65292;&#65288;800-500&#65289;*2=$600&#65292;&#33509;&#26368;&#32066;&#32068;&#25104;&#29260;&#38754;&#22823;&#23567;&#28858;F&gt;A&gt;B&gt;D&gt;E&gt;C&#65292;&#20294;F&#24050;&#33995;&#29260;&#19981;&#33021;&#20998;&#37197;&#20219;&#20309;&#24425;&#27744;&#65292;&#21063;&#27492;&#23616;&#20027;&#27744;&#21363;&#28858;A&#26044;&#27492;&#23616;&#36111;&#24471;&#30340;&#31820;&#30908;&#65288;$300&#65289;&#65292;B&#21487;&#36111;&#24471;&#31532;&#19968;&#20491;&#37002;&#27744;&#65288;$1000&#65289;&#65292;D&#21443;&#33287;&#33267;&#26368;&#24460;&#19968;&#20491;&#37002;&#27744;&#65292;&#19988;&#29260;&#38754;&#21213;&#36942;&#21443;&#33287;&#31532;&#20108;&#12289;&#31532;&#19977;&#21450;&#31532;&#22235;&#37002;&#27744;&#30340;&#25152;&#26377;&#29609;&#23478;&#65292;&#22240;&#27492;&#21487;&#36111;&#24471;&#21097;&#19979;&#25152;&#26377;&#30340;&#37002;&#27744;&#65288;400+450+600=$1450&#65289;</span></p><p class=\"c0\"><span></span></p><p class=\"c6\"><span>&#22240;&#20026;&#27599;&#20010;&#20154;&#25163;&#20013;&#30340;&#31609;&#30721;&#37327;&#20250;&#19981;&#26102;&#30340;&#20135;&#29983;&#21464;&#21270;&#65292;&#24403;&#20986;&#29616;&#22810;&#20010;&#31609;&#30721;&#37327;&#19981;&#31561;&#30340;&#29609;&#23478;&ldquo;&#20840;&#19979;(ALL-IN)&rdquo;&#20105;&#22842;&#24213;&#27744;&#30340;&#26102;&#20505;&#23601;&#20250;&#20986;&#29616;&#22810;&#20010;&#22870;&#27744;&#65292;&#36825;&#26102;&#20505;&#24213;&#27744;&#23558;&#20998;&#20986;&#20027;&#27744;&#21644;&#36793;&#27744;&#65292;&#20027;&#27744;&#37324;&#30340;&#31609;&#30721;&#21487;&#30001;&#20219;&#20309;&#19968;&#20301;&#20105;&#22842;&#32773;&#32988;&#21033;&#21518;&#23558;&#20854;&#25343;&#36208;&#65292;&#20854;&#21518;&#27599;&#20010;&#36793;&#27744;&#23558;&#20998;&#21035;&#30001;&#21442;&#19982;&#32773;&#25353;&#29260;&#22411;&#22823;&#23567;&#20998;&#21035;&#25343;&#36208;&#12290;</span></p><p class=\"c6\"><span>&#20030;&#20010;&#20363;&#23376;&#65292;&#20551;&#22914;&#21457;&#21040;&#27827;&#29260;&#21518;&#20849;&#26377;&#19977;&#20010;&#20154;&#20105;&#22842;&#24213;&#27744;&#65292;&#19977;&#20154;&#20998;&#21035;&#29992;ABC&#20195;&#26367;&#65292;&#20551;&#35774;A&#29609;&#23478;&#25163;&#20013;&#26377;60&#65292;B&#25163;&#20013;&#26377;80&#65292;C&#25163;&#20013;&#26377;100&#12290;&#19977;&#20154;ALL-IN&#21518;&#21017;&#20808;&#25226;&#27599;&#20154;&#30340;&#31609;&#30721;&#21010;&#20998;&#25104;&#65306;</span></p><p class=\"c6\"><span>A&#29609;&#23478;60&#65307;B&#29609;&#23478;60+20&#65307;C&#29609;&#23478;60+20+20&#65292;&#28982;&#21518;&#20998;&#20986;&#24213;&#27744;&#65306;</span></p><p class=\"c6\"><span>&#20027;&#27744; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#30001;60&#20056;&#20197;&#19977;&#20010;&#20154;(A+B+C)&#24418;&#25104;&#19968;&#20010;&#22534;&#65292;&#24635;&#39069;&#20026;180&#65307;</span></p><p class=\"c6\"><span>&#36793;&#27744;&#19968; &#30001;20&#20056;&#20197;&#21097;&#19979;&#30340;&#20004;&#20010;&#20154;(B+C)&#22810;&#20986;&#30340;&#37096;&#20998;&#20026;&#19968;&#20010;&#22534;&#65292;&#24635;&#39069;&#20026;40&#65307;</span></p><p class=\"c6\"><span>&#36793;&#27744;&#20108; &#30001;&#31609;&#30721;&#26368;&#22810;&#32773;C&#30340;&#22810;&#20986;&#30340;&#37096;&#20998;20&#21333;&#29420;&#32452;&#25104;&#19968;&#20010;&#22534;&#65292;&#24635;&#39069;&#20026;20&#12290;</span></p><p class=\"c6\"><span>&#29616;&#22312;&#19977;&#20010;&#24213;&#27744;&#24418;&#25104;&#20102;&#65292;&#28982;&#21518;&#20998;&#21035;&#25353;&#29031;&#29260;&#22411;&#30340;&#22823;&#23567;&#26469;&#20915;&#23450;&#35841;&#25343;&#36208;&#21738;&#20010;&#24213;&#27744;&hellip;&hellip;</span></p><p class=\"c6\"><span>&#39318;&#20808;&#65292;&#20027;&#27744;&#21487;&#20197;&#30001;&#19977;&#20154;&#20013;&#30340;&#20219;&#20309;&#19968;&#20154;&#24471;&#21040;&#32988;&#21033;&#37117;&#21487;&#20197;&#25343;&#36208;&#65307;&#20294;&#26159;&#36793;&#27744;&#19968;&#30340;&#20105;&#22842;&#23601;&#21482;&#33021;&#22312;B&#19982;C&#20043;&#38388;&#20135;&#29983;&#65292;&#20004;&#20154;&#35841;&#36194;&#35841;&#25343;&#36208;&#65292;&#19982;A&#26080;&#20851;(&#23601;&#31639;A&#29609;&#23478;&#30340;&#29260;&#26368;&#22823;&#20063;&#21482;&#33021;&#25343;&#36208;&#20182;&#21442;&#19982;&#30340;&#20027;&#27744;)&#12290;&#32780;&#26368;&#21518;&#21097;&#19979;&#30340;&#36793;&#27744;&#20108;&#19981;&#35770;&#19977;&#20154;&#35841;&#36755;&#35841;&#36194;&#37117;&#21482;&#33021;&#30001;C&#25343;&#36208;&#65292;&#22240;&#20026;&#36793;&#27744;&#20108;&#37324;&#30340;&#31609;&#30721;&#21482;&#26377;C&#33258;&#24049;&#21442;&#19982;&#20102;&#65292;&#19982;&#20854;&#20182;&#20154;&#26080;&#20851;&#12290;</span></p><p class=\"c0\"><span></span></p><p class=\"c0\"><span></span></p><h1 class=\"c6 c16\"><a name=\"h.25j1r7f1amgt\"></a><span>&#21442;&#32771;&#25991;&#26723;</span></h1><p class=\"c0\"><span></span></p><ul class=\"c18 lst-kix_26etd7yyufkn-0 start\"><li class=\"c6 c11\"><span>&#24503;&#24030;&#25169;&#20811;&#35268;&#21017;</span></li></ul><p class=\"c6 c20\"><span class=\"c1\"><a class=\"c2\" href=\"http://www.google.com/url?q=http%3A%2F%2Fjingyan.baidu.com%2Farticle%2F0aa223758306b688cd0d6462.html&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNHyBCytHjOvkWCzaEQIrcFgZTrPGg\">http://jingyan.baidu.com/article/0aa223758306b688cd0d6462.html</a></span></p><ul class=\"c18 lst-kix_1h7jd02d177d-0 start\"><li class=\"c8 c6\"><span>&#24503;&#24030;&#25778;&#20811;<br></span><span class=\"c1\"><a class=\"c2\" href=\"https://www.google.com/url?q=https%3A%2F%2Fzh.wikipedia.org%2Fwiki%2F%25E5%25BE%25B7%25E5%25B7%259E%25E6%2592%25B2%25E5%2585%258B%23.E4.B8.8B.E6.B3.A8.E6.AC.A1.E5.BA.8F&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNHNdY_2plPus1a9ir9b0LLSSNkEgg\">https://zh.wikipedia.org/wiki/%E5%BE%B7%E5%B7%9E%E6%92%B2%E5%85%8B#.E4.B8.8B.E6.B3.A8.E6.AC.A1.E5.BA.8F</a></span></li><li class=\"c6 c8\"><span>&#24503;&#24030;&#25169;&#20811;&#36793;&#27744;&#38382;&#39064;</span></li></ul><p class=\"c6 c19\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class=\"c1\"><a class=\"c2\" href=\"http://www.google.com/url?q=http%3A%2F%2Fzhidao.baidu.com%2Fquestion%2F1446347228032870540.html&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNGOxDH45T7eAYq-gQDHTWNYH05XUA\">http://zhidao.baidu.com/question/1446347228032870540.html</a></span></p><p class=\"c0 c19\"><span></span></p><p class=\"c0 c19\"><span></span></p><p class=\"c0 c19\"><span></span></p><p class=\"c0\"><span></span></p></body></html>"
  },
  {
    "path": "src/server/algorithm/cards.go",
    "content": "package algorithm\n\ntype Cards []byte\n\n// todo 两对和四张起脚牌的判定\n\nvar StraightMask = []uint16{15872, 7936, 3968, 1984, 992, 496, 248, 124, 62, 31}\n//顺子（Straight，亦称“蛇”）\n//此牌由五张顺序扑克牌组成。\n//平手牌：如果不止一人抓到此牌，则五张牌中点数最大的赢得此局，\n// 如果所有牌点数都相同，平分彩池。\nfunc (this *Cards) straight() uint32 {\n\tvar handvalue uint16\n\tfor _, v := range (*this) {\n\t\tvalue := v & 0xF\n\t\tif value == 0xE {\n\t\t\thandvalue |= 1\n\t\t}\n\t\thandvalue |= (1 << (value - 1 ) )\n\t}\n\n\tfor i := uint8(0); i < 10; i++ {\n\t\tif handvalue&StraightMask[i] == StraightMask[i] {\n\t\t\treturn En(STRAIGHT, uint32(10-i+4))\n\t\t}\n\t}\n\treturn 0\n}\n\n//同花顺（Straight Flush）\n//五张同花色的连续牌。\n//平手牌：如果摊牌时有两副或多副同花顺，连续牌的头张牌大的获得筹码。\n//如果是两副或多副相同的连续牌，平分筹码。\nfunc (this *Cards) straightFlush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar handvalue uint16\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tvalue := v & 0xF\n\t\t\t\tif value == 0xE {\n\t\t\t\t\thandvalue |= 1\n\t\t\t\t}\n\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\t\t\t}\n\t\t}\n\n\t\tfor i := uint8(0); i < 10; i++ {\n\t\t\tif handvalue&StraightMask[i] == StraightMask[i] {\n\t\t\t\treturn En(STRAIGHT_FLUSH, uint32(10-i+4))\n\t\t\t}\n\t\t}\n\t}\n\treturn 0\n}\n\n//皇家同花顺（Royal Flush）\n//同花色的A, K, Q, J和10。\n//平手牌：在摊牌的时候有两副多副皇家同花顺时，平分筹码。\nfunc (this *Cards) royalFlush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar handvalue uint16\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tvalue := v & 0xF\n\t\t\t\tif value == 0xE {\n\t\t\t\t\thandvalue |= 1\n\t\t\t\t}\n\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\n\t\t\t}\n\t\t}\n\n\t\tif handvalue&StraightMask[0] == StraightMask[0] {\n\t\t\treturn En(ROYAL_FLUSH, 0)\n\t\t}\n\t}\n\treturn 0\n}\n\n//四条（Four of a Kind，亦称“铁支”、“四张”或“炸弹”）\n//其中四张是相同点数但不同花的扑克牌，第五张是随意的一张牌。\n//平手牌：如果两组或者更多组摊牌，则四张牌中的最大者赢局，如果一组人持有的四张牌是一样的，\n//那么第五张牌最大者赢局（起脚牌,2张起手牌中小的那张就叫做起脚牌）。如果起脚牌也一样，平分彩池。\nfunc (this *Cards) four(counter *ValueCounter) uint32 {\n\tcards := *this\n\tif counter.Get(cards[len(cards)-1]) == 4 {\n\t\treturn En(FOUR, ToValue(cards))\n\t}\n\treturn 0\n}\n\n//满堂彩（Fullhouse，葫芦，三带二）\n//由三张相同点数及任何两张其他相同点数的扑克牌组成。\n//平手牌：如果两组或者更多组摊牌，那么三张相同点数中较大者赢局。\n//如果三张牌都一样，则两张牌中点数较大者赢局，如果所有的牌都一样，则平分彩池。\nfunc (this *Cards) fullFouse(counter *ValueCounter) uint32 {\n\tcards := *this\n\tlength := len(cards)\n\n\tif length >= 5 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF &&\n\t\t\tcards[length-3]&0xF == cards[length-1]&0xF &&\n\t\t\tcards[length-4]&0xF == cards[length-5]&0xF {\n\n\t\t\treturn En(FULL_HOUSE, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\n//同花（Flush，简称“花”）\n//此牌由五张不按顺序但相同花的扑克牌组成。\n//平手牌：如果不止一人抓到此牌相，则牌点最高的人赢得该局，\n//如果最大点相同，则由第二、第三、第四或者第五张牌来决定胜负，如果所有的牌都相同，平分彩池。\nfunc (this *Cards) flush() uint32 {\n\tcards := *this\n\tfor i := byte(0); i < SUITSIZE; i++ {\n\t\tvar count uint8\n\t\tfor _, v := range cards {\n\t\t\tif (v >> 4) == i {\n\t\t\t\tcount ++\n\t\t\t\tif count == 5 {\n\t\t\t\t\tvar handvalue uint16\n\t\t\t\t\tfor _, v1 := range cards {\n\t\t\t\t\t\tif (v1 >> 4) == i {\n\t\t\t\t\t\t\tvalue := v1 & 0xF\n\t\t\t\t\t\t\tif value == 0xE {\n\t\t\t\t\t\t\t\thandvalue |= 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thandvalue |= (1 << (value - 1 ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn En(FLUSH, uint32(handvalue))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn 0\n}\n\n//三条（Three of a kind，亦称“三张”）\n//由三张相同点数和两张不同点数的扑克组成。\n//平手牌：如果不止一人抓到此牌，则三张牌中最大点数者赢局，\n//如果三张牌都相同，比较第四张牌，必要时比较第五张，点数大的人赢局。如果所有牌都相同，则平分彩池。\nfunc (this *Cards) three(counter *ValueCounter) uint32 {\n\tcards := *this\n\tif counter.Get(cards[len(cards)-1]) == 3 {\n\t\treturn En(THREE, ToValue(cards))\n\t}\n\treturn 0\n}\n\n//两对（Two Pairs）\n//两对点数相同但两两不同的扑克和随意的一张牌组成。\n//平手牌：如果不止一人抓大此牌相，牌点比较大的人赢，如果比较大的牌点相同，那么较小牌点中的较大者赢，\n//如果两对牌点相同，那么第五张牌点较大者赢（起脚牌,2张起手牌中小的那张就叫做起脚牌）。如果起脚牌也相同，则平分彩池。\nfunc (this *Cards) twoPair() uint32 {\n\tcards := *this\n\tlength := len(cards)\n\tif length >= 4 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF &&\n\t\t\tcards[length-3]&0xF == cards[length-4]&0xF {\n\t\t\treturn En(TWO_PAIR, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\n//一对（One Pair）\n//由两张相同点数的扑克牌和另三张随意的牌组成。\n//平手牌：如果不止一人抓到此牌，则两张牌中点数大的赢，如果对牌都一样，则比较另外三张牌中大的赢，\n//如果另外三张牌中较大的也一样则比较第二大的和第三大的，如果所有的牌都一样，则平分彩池。\nfunc (this *Cards) onePair() uint32 {\n\tcards := *this\n\tlength := len(cards)\n\tif length >= 2 {\n\t\tif cards[length-1]&0xF == cards[length-2]&0xF {\n\t\t\treturn En(ONE_PAIR, ToValue(cards))\n\t\t}\n\t}\n\treturn 0\n}\n\nfunc ToValue(cards []byte) uint32 {\n\tvar res uint32\n\tfor i := len(cards) - 1; i >= 0; i-- {\n\t\tres *= 10\n\t\tres += uint32(cards[i] & 0xF)\n\t}\n\treturn res\n}\n\nfunc De(v uint32) (uint8, uint32) {\n\treturn uint8(v >> 24), v & 0xFFFFFF\n}\n\nfunc En(t uint8, v uint32) uint32 {\n\tv1 := v | ( uint32(t) << 24)\n\treturn v1\n}\n"
  },
  {
    "path": "src/server/algorithm/cards_test.go",
    "content": "package algorithm\n\nimport (\n\t\"testing\"\n\t\"strings\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestFour(t *testing.T) {\n\tcards := Cards{0x12, 0x02, 0x22, 0xb, 0x1b, 0x7, 0x32}\n\tk,_:=De(cards.GetType())\n\tassert.Equal(t, k, FOUR)\n\n\tcards = Cards{0x12, 0x02, 0x22, 0x32}\n\tk,_=De(cards.GetType())\n\tassert.Equal(t, k, FOUR)\n}\n\nfunc TestThree(t *testing.T) {\n\tcards := Cards{0x12, 0x02, 0x22, 0x3a, 0x2a, 0x1a, 0x33}\n\tk,_:=De(cards.GetType())\n\tassert.Equal(t, k, FULL_HOUSE)\n\n}\n\nfunc TestHighCard(t *testing.T) {\n\t//var cs Cards\n\tcards := Cards{0x1E, 0x02, 0x22, 0x3a, 0x2a, 0x1a, 0x33}\n\tk, _ := De(cards.GetType())\n\tassert.Equal(t, k, FULL_HOUSE)\n\t//assert.Equal(t, v, uint32(0xE))\n}\n\nfunc TestCards_OnePair(t *testing.T) {\n\tcards := Cards{0x12, 0x0e, 0x2e, 0x3a, 0x2a, 0x1a, 0x32}\n\n\tk, _ := De(cards.GetType())\n\tassert.Equal(t, k, FULL_HOUSE)\n}\n\nfunc TestCards_Straight(t *testing.T) {\n\n\tcards := Cards{0x12, 0x03, 0x24, 0x35, 0x26, 0x17, 0x33}\n\tk, v := De(cards.GetType())\n\tassert.Equal(t, k, STRAIGHT)\n\tassert.Equal(t, v, uint32(7))\n\n\tcards = Cards{0x12, 0x03, 0x24, 0x34, 0x26, 0x17, 0x37}\n\tassert.Equal(t, k, STRAIGHT)\n\tassert.Equal(t, v, uint32(7))\n\n\tcards = Cards{0x12, 0x03, 0x24, 0x34, 0x25, 0x17, 0x3E}\n\n\tk, v = De(cards.GetType())\n\tassert.Equal(t, k, STRAIGHT)\n\tassert.Equal(t, v, uint32(0x5))\n\n\n\tcards = Cards{0x12, 0x03, 0x2a, 0x3c, 0x2b, 0x1d, 0x3E}\n\tk, v = De(cards.GetType())\n\tassert.Equal(t, k, STRAIGHT)\n\tassert.Equal(t, v, uint32(0xe))\n}\n\nfunc TestCards_Flush(t *testing.T) {\n\n\tcards := Cards{0x32, 0x33, 0x34, 0x35, 0x26, 0x37, 0x28}\n\n\tk, _ := De(cards.GetType())\n\tassert.Equal(t, k,FLUSH)\n\t//assert.Equal(t, v, uint32(6))\n}\n\nfunc TestCards_TwoPair(t *testing.T) {\n\n\tcards := Cards{0x12, 0x22, 0x34, 0x35, 0x25, 0x38, 0x28}\n\n\tk, _ := De(cards.GetType())\n\tassert.Equal(t, k, TWO_PAIR)\n}\nfunc TestCards_RoyalFlush(t *testing.T) {\n\n\tcards := Cards{0x3A, 0x3B, 0x3C, 0x3E, 0x3D, 0x38, 0x28}\n\tk, _ := De(cards.GetType())\n\tassert.Equal(t, k, ROYAL_FLUSH)\n\n\tcards = Cards{0x3A, 0x3B, 0x3C, 0x3E, 0x2D, 0x38, 0x28}\n\n\tk, _ = De(cards.GetType())\n\tassert.Equal(t, k, FLUSH)\n}\n\n\nfunc TestCards_FLUSH1(t *testing.T) {\n\tcards1 := Cards{0x22, 0x22, 0x22, 0x25, 0x38, 0x28}\n\tcards2 := Cards{0x32, 0x32, 0x33, 0x34, 0x25, 0x36}\n\tv1:=cards1.GetType()\n\tv2:=cards2.GetType()\n\n\tassert.Equal(t,v1 > v2 ,true)\n\n\n\tcards1 = Cards{0x22, 0x22, 0x2E, 0x25, 0x38, 0x28}\n\tcards2 = Cards{0x32, 0x32, 0x33, 0x3a, 0x2a, 0x3E}\n\tassert.Equal(t,cards1.GetType() > cards2.GetType() ,false)\n}\n\nfunc TestCards_FLUSH(t *testing.T) {\n\tcards1 := Cards{0x22, 0x22, 0x24, 0x25, 0x38, 0x28}\n\tcards2 := Cards{0x32, 0x32, 0x33, 0x34, 0x25, 0x36}\n\tv1:=cards1.GetType()\n\tv2:=cards2.GetType()\n\n\tassert.Equal(t,v1 > v2 ,true)\n}\n\nfunc TestCards_PK(t *testing.T) {\n\n\tcards1 := Cards{0x32, 0x32, 0x34, 0x35, 0x25, 0x38, 0x28}\n\tcards2 := Cards{0x32, 0x32, 0x33, 0x34, 0x25, 0x36}\n\tv1:=cards1.GetType()\n\tv2:=cards2.GetType()\n\tassert.Equal(t,v1 > v2 ,true)\n\n}\nfunc TestCards_StraightFlush(t *testing.T) {\n\tcards := Cards{0x32, 0x33, 0x34, 0x35, 0x36, 0x27, 0x28}\n\tk, v := De(cards.GetType())\n\tassert.Equal(t, k, uint8(9))\n\tassert.Equal(t, v, uint32(6))\n\n\tcards = Cards{0x32, 0x33, 0x34, 0x35, 0x3E, 0x37, 0x28}\n\tk, v = De(cards.GetType())\n\tassert.Equal(t, k, uint8(9))\n\tassert.Equal(t, v, uint32(5))\n\n\tcards = Cards{0x32, 0x33, 0x34, 0x35, 0x3E, 0x36, 0x28}\n\tk, v = De(cards.GetType())\n\tassert.Equal(t, k, uint8(9))\n\tassert.Equal(t, v, uint32(6))\n}\n\nfunc TestCards_FullFouse(t *testing.T) {\n\n\tcards := Cards{0x33, 0x33, 0x33, 0x35, 0x25, 0x35, 0x28}\n\tk, _ := De(cards.GetType())\n\n\t//t.Logf(\"%v %v %#v \",k,v,cards)\n\tassert.Equal(t, k, FULL_HOUSE)\n\t//assert.Equal(t, v, FULL_HOUSE)\n\n\t//t.Log(cards.String())\n\t//t.Log(cards.Hex())\n}\n\nfunc TestString2Num(t *testing.T) {\n\n\tarray := Cards{0x33, 0x33, 0x33, 0x35, 0x25, 0x35, 0x3E, 0x1A}\n\n\t//for i := 0; i < N; i++ {\n\tgo array.Shuffle()\n\tt.Log(array.String())\n\t//}\n\n}\n\nfunc TestFullFouse(t *testing.T) {\n\tvar s = \"A A A K K|\" +\n\t\t\"A A A Q Q|\" +\n\t\t\"A A A J J|\" +\n\t\t\"A A A T T|\" +\n\t\t\"A A A 9 9|\" +\n\t\t\"A A A 8 8|\" +\n\t\t\"A A A 7 7|\" +\n\t\t\"A A A 6 6|\" +\n\t\t\"A A A 5 5|\" +\n\t\t\"A A A 4 4|\" +\n\t\t\"A A A 3 3|\" +\n\t\t\"A A A 2 2|\" +\n\t\t\"K K K A A|\" +\n\t\t\"K K K Q Q|\" +\n\t\t\"K K K J J|\" +\n\t\t\"K K K T T|\" +\n\t\t\"K K K 9 9|\" +\n\t\t\"K K K 8 8|\" +\n\t\t\"K K K 7 7|\" +\n\t\t\"K K K 6 6|\" +\n\t\t\"K K K 5 5|\" +\n\t\t\"K K K 4 4|\" +\n\t\t\"K K K 3 3|\" +\n\t\t\"K K K 2 2|\" +\n\t\t\"Q Q Q A A|\" +\n\t\t\"Q Q Q K K|\" +\n\t\t\"Q Q Q J J|\" +\n\t\t\"Q Q Q T T|\" +\n\t\t\"Q Q Q 9 9\"\n\n\tarray := strings.Split(s, \"|\")\n\n\tvar oldValue uint32\n\tfor _, v := range array {\n\t\tcards := &Cards{}\n\t\tcards.SetByString(v)\n\t\t//t.Log(cards.String())\n\n\t\tk, value := De(cards.GetType())\n\t\tif oldValue == 0{\n\t\t\toldValue = value\n\t\t\tcontinue\n\t\t}\n\n\t\tassert.Equal(t, oldValue> value, true)\n\n\t\tassert.Equal(t, k, FULL_HOUSE)\n\t\t//assert.Equal(t,v,uint32(6))\n\n\t\t//t.Log(De(cards.FullFouse(cards.Counter())))\n\t}\n}\n\nfunc Test_Straight1(t *testing.T) {\n\n\t/*\ttestCards := \"T J Q K A|\" +\n\t\t\"9 T J Q K|\" +\n\t\t\"8 9 T J Q|\" +\n\t\t\"7 8 9 T J|\" +\n\t\t\"6 7 8 9 T|\" +\n\t\t\"5 6 7 8 9|\" +\n\t\t\"4 5 6 7 8|\" +\n\t\t\"3 4 5 6 7|\" +\n\t\t\"2 3 4 5 6|\" +\n\t\t\"A 2 3 4 5\"\n\n\t//array := strings.Split(testCards, \"|\")\nfor _, v := range array {\n\t\tcards := &Cards{}\n\t\tcards.SetByString(v)\n\t\tcards.Sort()\n\t\tt.Log(cards.String(), cards.Straight() > 0)\n\t}\n\tt.Log(\"--------------------------------------\")\n\n\tfor _, v := range array {\n\t\tcards := &Cards{}\n\t\tcards.SetByString(v)\n\t\tcards.Sort()\n\t\tt.Log(cards.String(), cards.StraightFlush() > 0)\n\t}*/\n\t/*\tt.Log(\"--------------------------------------\")\n\n\t\tfor _, v := range array {\n\t\t\tcards := &Cards{}\n\t\t\tcards.SetByString(v)\n\t\t\tcards.Sort()\n\t\t\tt.Log(cards.String(), cards.RoyalFlush())\n\t\t}*/\n}\n\nfunc Test_AnalyseCards(t *testing.T) {\n\tvar a ColorCounter\n\tcards := []byte{0x33, 0x35, 0x25, 0x35, 0x28}\n\ta.Set(cards)\n\n\tt.Log(a.Get(0x33), a.Get(0x35), a.Get(0x28))\n}\nfunc Test_Append(t *testing.T) {\n\tcards := Cards{0x33, 0x35, 0x25, 0x35, 0x28}\n\tcards = cards.Append(Cards{0x33, 0x33}...)\n\n\tt.Logf(\"%#v \", cards.GetType())\n}\n\nfunc Test_turnToValue1(t *testing.T) {\n\tv1 := []byte{0x33, 0x35, 0x25, 0x35, 0x28}\n\tv2 := []byte{0x35, 0x35, 0x25, 0x35, 0x27}\n\n\tt.Logf(\"%#v %#v \", v1, v2)\n\tb1 := ToValue(v1)\n\tb2 := ToValue(v2)\n\n\tt.Log(b1, b2)\n\n}\nfunc Test_ColorCounter(t *testing.T) {\n\tv2 := []byte{0x35, 0x35, 0x25, 0x35, 0x27}\n\n\tvar colorCounter ColorCounter\n\n\tcolorCounter.Set(v2)\n\n\tt.Log(v2)\n}\nfunc Test_turnToValue(t *testing.T) {\n\n\tv := ToValue([]byte{0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E})\n\n\t//var v3 uint16 = v\n\tv1 := v | ( 10 << 24)\n\n\t//t.Log(v3)\n\n\tt.Logf(\"%v %v %v\", v, v1>>24, v1&0xFFFFFF)\n\tt.Logf(\"%v \", ToValue([]byte{0x33, 0x35, 0x25, 0x35, 0x28}))\n\n}\n"
  },
  {
    "path": "src/server/algorithm/constan.go",
    "content": "package algorithm\n\n// 扑克牌52张，分别包含普通牌52张 2-10、J、Q、K、A （以上每种牌4个花色 黑桃、梅花、红心、方块）\nvar CARDS = []byte{\n\t//方块\n\t0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,\n\t//梅花\n\t0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,\n\t//红桃\n\t0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,\n\t//黑桃\n\t0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,\n}\n\nconst (\n\tCARDRANK = 13\n\tSUITSIZE = 4\n\tTOTAL    = 13 * 4\n\n\tTYPE_LEN  = 5 // 牌型长度\n\tCARDS_LEN = 7 // 河牌+底牌长度\n)\n\n//牌型大小：\n//1、皇家同花顺＞同花顺＞四条＞葫芦＞同花＞顺子＞三条＞两队＞一对＞单牌\n//2、牌点从大到小为：A、K、Q、J、10、9、8、7、6、5、4、3、2，各花色不分大小。\n//3、同种牌型，对子时比对子的大小，其它牌型比最大的牌张，如最大牌张相同则比第二大的牌张，以此类推，都相同时为相同。\n//4、A 可以组顺子 A、1、2、3、4、5  也可以组顺子 10、J、Q、K、A  同花顺同理\n//所有牌型如下：\nconst (\n\tROYAL_FLUSH    uint8= 10  // 皇家同花顺：同一花色的最大顺子。（最大牌：A-K-Q-J-10）\n\tSTRAIGHT_FLUSH uint8= 9  // 同花顺：同一花色的顺子。（最大牌：K-Q-J-10-9 最小牌：A-2-3-4-5）\n\tFOUR           uint8= 8 // 四条：四同张加单张。（最大牌：A-A-A-A-K 最小牌：2-2-2-2-3）\n\tFULL_HOUSE     uint8= 7  // 葫芦（豪斯）：三同张加对子。（最大牌：A-A-A-K-K 最小牌：2-2-2-3-3）\n\tFLUSH          uint8= 6  // 同花：同一花色。（最大牌：A-K-Q-J-9 最小牌：2-3-4-5-7）\n\tSTRAIGHT       uint8= 5 // 顺子：花色不一样的顺子。（最大牌：A-K-Q-J-10 最小牌：A-2-3-4-5）\n\tTHREE          uint8= 4  // 三条：三同张加两单张。（最大牌：A-A-A-K-Q 最小牌：2-2-2-3-4）\n\tTWO_PAIR       uint8= 3  // 两对：（最大牌：A-A-K-K-Q 最小牌：2-2-3-3-4）\n\tONE_PAIR       uint8= 2  // 一对：（最大牌：A-A-K-Q-J 最小牌：2-2-3-4-5）\n\tHIGH_CARD      uint8= 1 // 高牌：（最大牌：A-K-Q-J-9 最小牌：2-3-4-5-7）\n)\n"
  },
  {
    "path": "src/server/algorithm/dealer.go",
    "content": "package algorithm\n\nimport (\n\t\"time\"\n\t\"math/rand\"\n)\n\n\n\n//var n int64\n//var a int64= 1<<62\n// 洗牌\nfunc (this *Cards) Shuffle() {\n\t*this = make([]byte, TOTAL)\n\tcopy(*this, CARDS)\n\tsource := rand.NewSource(time.Now().UnixNano() )\n\t//n ++\n\t//n %=a\n\tr := rand.New(source)\n\tfor i := TOTAL - 1; i > 0; i-- {\n\t\tindex := r.Int() % i\n\t\t(*this)[i], (*this)[index] = (*this)[index], (*this)[i]\n\t}\n\n}\n"
  },
  {
    "path": "src/server/algorithm/dealer_test.go",
    "content": "package algorithm\n\nimport \"testing\"\n\nfunc Test_Dealer(t *testing.T)  {\n\td:= &Cards{}\n\n\td.Shuffle()\n\td.Shuffle()\n\tt.Logf(\"%#v \",d)\n\n}\n"
  },
  {
    "path": "src/server/algorithm/flush_test.go",
    "content": "package algorithm\n\nimport (\n\t\"testing\"\n\t\"strings\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestFlush1(t *testing.T) {\n\tvar s = \"9 J Q K A |\" +\n\t\t\"8 J Q K A |\" +\n\t\t\"7 J Q K A |\" +\n\t\t\"6 J Q K A |\" +\n\t\t\"5 J Q K A |\" +\n\t\t\"4 J Q K A |\" +\n\t\t\"3 J Q K A |\" +\n\t\t\"2 J Q K A |\" +\n\t\t\"9 T Q K A |\" +\n\t\t\"8 T Q K A |\" +\n\t\t\"7 T Q K A |\" +\n\t\t\"6 T Q K A |\" +\n\t\t\"5 T Q K A |\" +\n\t\t\"4 T Q K A |\" +\n\t\t\"3 T Q K A |\" +\n\t\t\"2 T Q K A |\" +\n\t\t\"8 9 Q K A |\" +\n\t\t\"7 9 Q K A |\" +\n\t\t\"6 9 Q K A |\" +\n\t\t\"5 9 Q K A |\" +\n\t\t\"4 9 Q K A |\" +\n\t\t\"3 9 Q K A |\" +\n\t\t\"2 9 Q K A |\" +\n\t\t\"7 8 Q K A |\" +\n\t\t\"6 8 Q K A |\" +\n\t\t\"5 8 Q K A |\" +\n\t\t\"4 8 Q K A |\" +\n\t\t\"3 8 Q K A |\" +\n\t\t\"2 8 Q K A |\" +\n\t\t\"6 7 Q K A |\" +\n\t\t\"5 7 Q K A |\" +\n\t\t\"4 7 Q K A |\" +\n\t\t\"3 7 Q K A |\" +\n\t\t\"2 7 Q K A |\" +\n\t\t\"5 6 Q K A |\" +\n\t\t\"4 6 Q K A |\" +\n\t\t\"3 6 Q K A |\" +\n\t\t\"2 6 Q K A |\" +\n\t\t\"4 5 Q K A |\" +\n\t\t\"3 5 Q K A |\" +\n\t\t\"2 5 Q K A |\" +\n\t\t\"3 4 Q K A |\" +\n\t\t\"2 4 Q K A |\" +\n\t\t\"2 3 Q K A |\" +\n\t\t\"9 T J K A |\" +\n\t\t\"8 T J K A |\" +\n\t\t\"7 T J K A |\" +\n\t\t\"6 T J K A |\" +\n\t\t\"5 T J K A |\" +\n\t\t\"4 T J K A |\" +\n\t\t\"3 T J K A |\" +\n\t\t\"2 T J K A |\" +\n\t\t\"8 9 J K A |\" +\n\t\t\"7 9 J K A |\" +\n\t\t\"6 9 J K A |\" +\n\t\t\"5 9 J K A |\" +\n\t\t\"4 9 J K A |\" +\n\t\t\"3 9 J K A |\" +\n\t\t\"2 9 J K A |\" +\n\t\t\"7 8 J K A |\" +\n\t\t\"6 8 J K A |\" +\n\t\t\"5 8 J K A |\" +\n\t\t\"4 8 J K A |\" +\n\t\t\"3 8 J K A |\" +\n\t\t\"2 8 J K A |\" +\n\t\t\"6 7 J K A |\" +\n\t\t\"5 7 J K A |\" +\n\t\t\"4 7 J K A |\" +\n\t\t\"3 7 J K A |\" +\n\t\t\"2 7 J K A |\" +\n\t\t\"5 6 J K A |\" +\n\t\t\"4 6 J K A |\" +\n\t\t\"3 6 J K A |\" +\n\t\t\"2 6 J K A |\" +\n\t\t\"4 5 J K A |\" +\n\t\t\"3 5 J K A |\" +\n\t\t\"2 5 J K A |\" +\n\t\t\"3 4 J K A |\" +\n\t\t\"2 4 J K A |\" +\n\t\t\"2 3 J K A |\" +\n\t\t\"8 9 T K A |\" +\n\t\t\"7 9 T K A |\" +\n\t\t\"6 9 T K A |\" +\n\t\t\"5 9 T K A |\" +\n\t\t\"4 9 T K A |\" +\n\t\t\"3 9 T K A |\" +\n\t\t\"2 9 T K A |\" +\n\t\t\"7 8 T K A |\" +\n\t\t\"6 8 T K A |\" +\n\t\t\"5 8 T K A |\" +\n\t\t\"4 8 T K A |\" +\n\t\t\"3 8 T K A |\" +\n\t\t\"2 8 T K A |\" +\n\t\t\"6 7 T K A |\" +\n\t\t\"5 7 T K A |\" +\n\t\t\"4 7 T K A |\" +\n\t\t\"3 7 T K A |\" +\n\t\t\"2 7 T K A |\" +\n\t\t\"5 6 T K A |\" +\n\t\t\"4 6 T K A |\" +\n\t\t\"3 6 T K A |\" +\n\t\t\"2 6 T K A |\" +\n\t\t\"4 5 T K A |\" +\n\t\t\"3 5 T K A |\" +\n\t\t\"2 5 T K A |\" +\n\t\t\"3 4 T K A |\" +\n\t\t\"2 4 T K A |\" +\n\t\t\"2 3 T K A |\" +\n\t\t\"7 8 9 K A |\" +\n\t\t\"6 8 9 K A |\" +\n\t\t\"5 8 9 K A |\" +\n\t\t\"4 8 9 K A |\" +\n\t\t\"3 8 9 K A |\" +\n\t\t\"2 8 9 K A |\" +\n\t\t\"6 7 9 K A |\" +\n\t\t\"5 7 9 K A |\" +\n\t\t\"4 7 9 K A |\" +\n\t\t\"3 7 9 K A |\" +\n\t\t\"2 7 9 K A |\" +\n\t\t\"5 6 9 K A |\" +\n\t\t\"4 6 9 K A |\" +\n\t\t\"3 6 9 K A |\" +\n\t\t\"2 6 9 K A |\" +\n\t\t\"4 5 9 K A |\" +\n\t\t\"3 5 9 K A |\" +\n\t\t\"2 5 9 K A |\" +\n\t\t\"3 4 9 K A |\" +\n\t\t\"2 4 9 K A |\" +\n\t\t\"2 3 9 K A |\" +\n\t\t\"6 7 8 K A |\" +\n\t\t\"5 7 8 K A |\" +\n\t\t\"4 7 8 K A |\" +\n\t\t\"3 7 8 K A |\" +\n\t\t\"2 7 8 K A |\" +\n\t\t\"5 6 8 K A |\" +\n\t\t\"4 6 8 K A |\" +\n\t\t\"3 6 8 K A |\" +\n\t\t\"2 6 8 K A |\" +\n\t\t\"4 5 8 K A |\" +\n\t\t\"3 5 8 K A |\" +\n\t\t\"2 5 8 K A |\" +\n\t\t\"3 4 8 K A |\" +\n\t\t\"2 4 8 K A |\" +\n\t\t\"2 3 8 K A |\" +\n\t\t\"5 6 7 K A |\" +\n\t\t\"4 6 7 K A |\" +\n\t\t\"3 6 7 K A |\" +\n\t\t\"2 6 7 K A |\" +\n\t\t\"4 5 7 K A |\" +\n\t\t\"3 5 7 K A |\" +\n\t\t\"2 5 7 K A |\" +\n\t\t\"3 4 7 K A |\" +\n\t\t\"2 4 7 K A |\" +\n\t\t\"2 3 7 K A |\" +\n\t\t\"4 5 6 K A |\" +\n\t\t\"3 5 6 K A |\" +\n\t\t\"2 5 6 K A |\" +\n\t\t\"3 4 6 K A |\" +\n\t\t\"2 4 6 K A |\" +\n\t\t\"2 3 6 K A |\" +\n\t\t\"3 4 5 K A |\" +\n\t\t\"2 4 5 K A |\" +\n\t\t\"2 3 5 K A |\" +\n\t\t\"2 3 4 K A |\" +\n\t\t\"9 T J Q A |\" +\n\t\t\"8 T J Q A |\" +\n\t\t\"7 T J Q A |\" +\n\t\t\"6 T J Q A |\" +\n\t\t\"5 T J Q A |\" +\n\t\t\"4 T J Q A |\" +\n\t\t\"3 T J Q A |\" +\n\t\t\"2 T J Q A |\" +\n\t\t\"8 9 J Q A |\" +\n\t\t\"7 9 J Q A |\" +\n\t\t\"6 9 J Q A |\" +\n\t\t\"5 9 J Q A |\" +\n\t\t\"4 9 J Q A |\" +\n\t\t\"3 9 J Q A |\" +\n\t\t\"2 9 J Q A |\" +\n\t\t\"7 8 J Q A |\" +\n\t\t\"6 8 J Q A |\" +\n\t\t\"5 8 J Q A |\" +\n\t\t\"4 8 J Q A |\" +\n\t\t\"3 8 J Q A |\" +\n\t\t\"2 8 J Q A |\" +\n\t\t\"6 7 J Q A |\" +\n\t\t\"5 7 J Q A |\" +\n\t\t\"4 7 J Q A |\" +\n\t\t\"3 7 J Q A |\" +\n\t\t\"2 7 J Q A |\" +\n\t\t\"5 6 J Q A |\" +\n\t\t\"4 6 J Q A |\" +\n\t\t\"3 6 J Q A |\" +\n\t\t\"2 6 J Q A |\" +\n\t\t\"4 5 J Q A |\" +\n\t\t\"3 5 J Q A |\" +\n\t\t\"2 5 J Q A |\" +\n\t\t\"3 4 J Q A |\" +\n\t\t\"2 4 J Q A |\" +\n\t\t\"2 3 J Q A |\" +\n\t\t\"8 9 T Q A |\" +\n\t\t\"7 9 T Q A |\" +\n\t\t\"6 9 T Q A |\" +\n\t\t\"5 9 T Q A |\" +\n\t\t\"4 9 T Q A |\" +\n\t\t\"3 9 T Q A |\" +\n\t\t\"2 9 T Q A |\" +\n\t\t\"7 8 T Q A |\" +\n\t\t\"6 8 T Q A |\" +\n\t\t\"5 8 T Q A |\" +\n\t\t\"4 8 T Q A |\" +\n\t\t\"3 8 T Q A |\" +\n\t\t\"2 8 T Q A |\" +\n\t\t\"6 7 T Q A |\" +\n\t\t\"5 7 T Q A |\" +\n\t\t\"4 7 T Q A |\" +\n\t\t\"3 7 T Q A |\" +\n\t\t\"2 7 T Q A |\" +\n\t\t\"5 6 T Q A |\" +\n\t\t\"4 6 T Q A |\" +\n\t\t\"3 6 T Q A |\" +\n\t\t\"2 6 T Q A |\" +\n\t\t\"4 5 T Q A |\" +\n\t\t\"3 5 T Q A |\" +\n\t\t\"2 5 T Q A |\" +\n\t\t\"3 4 T Q A |\" +\n\t\t\"2 4 T Q A |\" +\n\t\t\"2 3 T Q A |\" +\n\t\t\"7 8 9 Q A |\" +\n\t\t\"6 8 9 Q A |\" +\n\t\t\"5 8 9 Q A |\" +\n\t\t\"4 8 9 Q A |\" +\n\t\t\"3 8 9 Q A |\" +\n\t\t\"2 8 9 Q A |\" +\n\t\t\"6 7 9 Q A |\" +\n\t\t\"5 7 9 Q A |\" +\n\t\t\"4 7 9 Q A |\" +\n\t\t\"3 7 9 Q A |\" +\n\t\t\"2 7 9 Q A |\" +\n\t\t\"5 6 9 Q A |\" +\n\t\t\"4 6 9 Q A |\" +\n\t\t\"3 6 9 Q A |\" +\n\t\t\"2 6 9 Q A |\" +\n\t\t\"4 5 9 Q A |\" +\n\t\t\"3 5 9 Q A |\" +\n\t\t\"2 5 9 Q A |\" +\n\t\t\"3 4 9 Q A |\" +\n\t\t\"2 4 9 Q A |\" +\n\t\t\"2 3 9 Q A |\" +\n\t\t\"6 7 8 Q A |\" +\n\t\t\"5 7 8 Q A |\" +\n\t\t\"4 7 8 Q A |\" +\n\t\t\"3 7 8 Q A |\" +\n\t\t\"2 7 8 Q A |\" +\n\t\t\"5 6 8 Q A |\" +\n\t\t\"4 6 8 Q A |\" +\n\t\t\"3 6 8 Q A |\" +\n\t\t\"2 6 8 Q A |\" +\n\t\t\"4 5 8 Q A |\" +\n\t\t\"3 5 8 Q A |\" +\n\t\t\"2 5 8 Q A |\" +\n\t\t\"3 4 8 Q A |\" +\n\t\t\"2 4 8 Q A |\" +\n\t\t\"2 3 8 Q A |\" +\n\t\t\"5 6 7 Q A |\" +\n\t\t\"4 6 7 Q A |\" +\n\t\t\"3 6 7 Q A |\" +\n\t\t\"2 6 7 Q A |\" +\n\t\t\"4 5 7 Q A |\" +\n\t\t\"3 5 7 Q A |\" +\n\t\t\"2 5 7 Q A |\" +\n\t\t\"3 4 7 Q A |\" +\n\t\t\"2 4 7 Q A |\" +\n\t\t\"2 3 7 Q A |\" +\n\t\t\"4 5 6 Q A |\" +\n\t\t\"3 5 6 Q A |\" +\n\t\t\"2 5 6 Q A |\" +\n\t\t\"3 4 6 Q A |\" +\n\t\t\"2 4 6 Q A |\" +\n\t\t\"2 3 6 Q A |\" +\n\t\t\"3 4 5 Q A |\" +\n\t\t\"2 4 5 Q A |\" +\n\t\t\"2 3 5 Q A |\" +\n\t\t\"2 3 4 Q A |\" +\n\t\t\"8 9 T J A |\" +\n\t\t\"7 9 T J A |\" +\n\t\t\"6 9 T J A |\" +\n\t\t\"5 9 T J A |\" +\n\t\t\"4 9 T J A |\" +\n\t\t\"3 9 T J A |\" +\n\t\t\"2 9 T J A |\" +\n\t\t\"7 8 T J A |\" +\n\t\t\"6 8 T J A |\" +\n\t\t\"5 8 T J A |\" +\n\t\t\"4 8 T J A |\" +\n\t\t\"3 8 T J A |\" +\n\t\t\"2 8 T J A |\" +\n\t\t\"6 7 T J A |\" +\n\t\t\"5 7 T J A |\" +\n\t\t\"4 7 T J A |\" +\n\t\t\"3 7 T J A |\" +\n\t\t\"2 7 T J A |\" +\n\t\t\"5 6 T J A |\" +\n\t\t\"4 6 T J A |\" +\n\t\t\"3 6 T J A |\" +\n\t\t\"2 6 T J A |\" +\n\t\t\"4 5 T J A |\" +\n\t\t\"3 5 T J A |\" +\n\t\t\"2 5 T J A |\" +\n\t\t\"3 4 T J A |\" +\n\t\t\"2 4 T J A |\" +\n\t\t\"2 3 T J A |\" +\n\t\t\"7 8 9 J A |\" +\n\t\t\"6 8 9 J A |\" +\n\t\t\"5 8 9 J A |\" +\n\t\t\"4 8 9 J A |\" +\n\t\t\"3 8 9 J A |\" +\n\t\t\"2 8 9 J A |\" +\n\t\t\"6 7 9 J A |\" +\n\t\t\"5 7 9 J A |\" +\n\t\t\"4 7 9 J A |\" +\n\t\t\"3 7 9 J A |\" +\n\t\t\"2 7 9 J A |\" +\n\t\t\"5 6 9 J A |\" +\n\t\t\"4 6 9 J A |\" +\n\t\t\"3 6 9 J A |\" +\n\t\t\"2 6 9 J A |\" +\n\t\t\"4 5 9 J A |\" +\n\t\t\"3 5 9 J A |\" +\n\t\t\"2 5 9 J A |\" +\n\t\t\"3 4 9 J A |\" +\n\t\t\"2 4 9 J A |\" +\n\t\t\"2 3 9 J A |\" +\n\t\t\"6 7 8 J A |\" +\n\t\t\"5 7 8 J A |\" +\n\t\t\"4 7 8 J A |\" +\n\t\t\"3 7 8 J A |\" +\n\t\t\"2 7 8 J A |\" +\n\t\t\"5 6 8 J A |\" +\n\t\t\"4 6 8 J A |\" +\n\t\t\"3 6 8 J A |\" +\n\t\t\"2 6 8 J A |\" +\n\t\t\"4 5 8 J A |\" +\n\t\t\"3 5 8 J A |\" +\n\t\t\"2 5 8 J A |\" +\n\t\t\"3 4 8 J A |\" +\n\t\t\"2 4 8 J A |\" +\n\t\t\"2 3 8 J A |\" +\n\t\t\"5 6 7 J A |\" +\n\t\t\"4 6 7 J A |\" +\n\t\t\"3 6 7 J A |\" +\n\t\t\"2 6 7 J A |\" +\n\t\t\"4 5 7 J A |\" +\n\t\t\"3 5 7 J A |\" +\n\t\t\"2 5 7 J A |\" +\n\t\t\"3 4 7 J A |\" +\n\t\t\"2 4 7 J A |\" +\n\t\t\"2 3 7 J A |\" +\n\t\t\"4 5 6 J A |\" +\n\t\t\"3 5 6 J A |\" +\n\t\t\"2 5 6 J A |\" +\n\t\t\"3 4 6 J A |\" +\n\t\t\"2 4 6 J A |\" +\n\t\t\"2 3 6 J A |\" +\n\t\t\"3 4 5 J A |\" +\n\t\t\"2 4 5 J A |\" +\n\t\t\"2 3 5 J A |\" +\n\t\t\"2 3 4 J A |\" +\n\t\t\"7 8 9 T A |\" +\n\t\t\"6 8 9 T A |\" +\n\t\t\"5 8 9 T A |\" +\n\t\t\"4 8 9 T A |\" +\n\t\t\"3 8 9 T A |\" +\n\t\t\"2 8 9 T A |\" +\n\t\t\"6 7 9 T A |\" +\n\t\t\"5 7 9 T A |\" +\n\t\t\"4 7 9 T A |\" +\n\t\t\"3 7 9 T A |\" +\n\t\t\"2 7 9 T A |\" +\n\t\t\"5 6 9 T A |\" +\n\t\t\"4 6 9 T A |\" +\n\t\t\"3 6 9 T A |\" +\n\t\t\"2 6 9 T A |\" +\n\t\t\"4 5 9 T A |\" +\n\t\t\"3 5 9 T A |\" +\n\t\t\"2 5 9 T A |\" +\n\t\t\"3 4 9 T A |\" +\n\t\t\"2 4 9 T A |\" +\n\t\t\"2 3 9 T A |\" +\n\t\t\"6 7 8 T A |\" +\n\t\t\"5 7 8 T A |\" +\n\t\t\"4 7 8 T A |\" +\n\t\t\"3 7 8 T A |\" +\n\t\t\"2 7 8 T A |\" +\n\t\t\"5 6 8 T A |\" +\n\t\t\"4 6 8 T A |\" +\n\t\t\"3 6 8 T A |\" +\n\t\t\"2 6 8 T A |\" +\n\t\t\"4 5 8 T A |\" +\n\t\t\"3 5 8 T A |\" +\n\t\t\"2 5 8 T A |\" +\n\t\t\"3 4 8 T A |\" +\n\t\t\"2 4 8 T A |\" +\n\t\t\"2 3 8 T A |\" +\n\t\t\"5 6 7 T A |\" +\n\t\t\"4 6 7 T A |\" +\n\t\t\"3 6 7 T A |\" +\n\t\t\"2 6 7 T A |\" +\n\t\t\"4 5 7 T A |\" +\n\t\t\"3 5 7 T A |\" +\n\t\t\"2 5 7 T A |\" +\n\t\t\"3 4 7 T A |\" +\n\t\t\"2 4 7 T A |\" +\n\t\t\"2 3 7 T A |\" +\n\t\t\"4 5 6 T A |\" +\n\t\t\"3 5 6 T A |\" +\n\t\t\"2 5 6 T A |\" +\n\t\t\"3 4 6 T A |\" +\n\t\t\"2 4 6 T A |\" +\n\t\t\"2 3 6 T A |\" +\n\t\t\"3 4 5 T A |\" +\n\t\t\"2 4 5 T A |\" +\n\t\t\"2 3 5 T A |\" +\n\t\t\"2 3 4 T A |\" +\n\t\t\"6 7 8 9 A |\" +\n\t\t\"5 7 8 9 A |\" +\n\t\t\"4 7 8 9 A |\" +\n\t\t\"3 7 8 9 A |\" +\n\t\t\"2 7 8 9 A |\" +\n\t\t\"5 6 8 9 A |\" +\n\t\t\"4 6 8 9 A |\" +\n\t\t\"3 6 8 9 A |\" +\n\t\t\"2 6 8 9 A |\" +\n\t\t\"4 5 8 9 A |\" +\n\t\t\"3 5 8 9 A |\" +\n\t\t\"2 5 8 9 A |\" +\n\t\t\"3 4 8 9 A |\" +\n\t\t\"2 4 8 9 A |\" +\n\t\t\"2 3 8 9 A |\" +\n\t\t\"5 6 7 9 A |\" +\n\t\t\"4 6 7 9 A |\" +\n\t\t\"3 6 7 9 A |\" +\n\t\t\"2 6 7 9 A |\" +\n\t\t\"4 5 7 9 A |\" +\n\t\t\"3 5 7 9 A |\" +\n\t\t\"2 5 7 9 A |\" +\n\t\t\"3 4 7 9 A |\" +\n\t\t\"2 4 7 9 A |\" +\n\t\t\"2 3 7 9 A |\" +\n\t\t\"4 5 6 9 A |\" +\n\t\t\"3 5 6 9 A |\" +\n\t\t\"2 5 6 9 A |\" +\n\t\t\"3 4 6 9 A |\" +\n\t\t\"2 4 6 9 A |\" +\n\t\t\"2 3 6 9 A |\" +\n\t\t\"3 4 5 9 A |\" +\n\t\t\"2 4 5 9 A |\" +\n\t\t\"2 3 5 9 A |\" +\n\t\t\"2 3 4 9 A |\" +\n\t\t\"5 6 7 8 A |\" +\n\t\t\"4 6 7 8 A |\" +\n\t\t\"3 6 7 8 A |\" +\n\t\t\"2 6 7 8 A |\" +\n\t\t\"4 5 7 8 A |\" +\n\t\t\"3 5 7 8 A |\" +\n\t\t\"2 5 7 8 A |\" +\n\t\t\"3 4 7 8 A |\" +\n\t\t\"2 4 7 8 A |\" +\n\t\t\"2 3 7 8 A |\" +\n\t\t\"4 5 6 8 A |\" +\n\t\t\"3 5 6 8 A |\" +\n\t\t\"2 5 6 8 A |\" +\n\t\t\"3 4 6 8 A |\" +\n\t\t\"2 4 6 8 A |\" +\n\t\t\"2 3 6 8 A |\" +\n\t\t\"3 4 5 8 A |\" +\n\t\t\"2 4 5 8 A |\" +\n\t\t\"2 3 5 8 A |\" +\n\t\t\"2 3 4 8 A |\" +\n\t\t\"4 5 6 7 A |\" +\n\t\t\"3 5 6 7 A |\" +\n\t\t\"2 5 6 7 A |\" +\n\t\t\"3 4 6 7 A |\" +\n\t\t\"2 4 6 7 A |\" +\n\t\t\"2 3 6 7 A |\" +\n\t\t\"3 4 5 7 A |\" +\n\t\t\"2 4 5 7 A |\" +\n\t\t\"2 3 5 7 A |\" +\n\t\t\"2 3 4 7 A |\" +\n\t\t\"3 4 5 6 A |\" +\n\t\t\"2 4 5 6 A |\" +\n\t\t\"2 3 5 6 A |\" +\n\t\t\"2 3 4 6 A |\" +\n\t\t\"8 T J Q K |\" +\n\t\t\"7 T J Q K |\" +\n\t\t\"6 T J Q K |\" +\n\t\t\"5 T J Q K |\" +\n\t\t\"4 T J Q K |\" +\n\t\t\"3 T J Q K |\" +\n\t\t\"2 T J Q K |\" +\n\t\t\"8 9 J Q K |\" +\n\t\t\"7 9 J Q K |\" +\n\t\t\"6 9 J Q K |\" +\n\t\t\"5 9 J Q K |\" +\n\t\t\"4 9 J Q K |\" +\n\t\t\"3 9 J Q K |\" +\n\t\t\"2 9 J Q K |\" +\n\t\t\"7 8 J Q K |\" +\n\t\t\"6 8 J Q K |\" +\n\t\t\"5 8 J Q K |\" +\n\t\t\"4 8 J Q K |\" +\n\t\t\"3 8 J Q K |\" +\n\t\t\"2 8 J Q K |\" +\n\t\t\"6 7 J Q K |\" +\n\t\t\"5 7 J Q K |\" +\n\t\t\"4 7 J Q K |\" +\n\t\t\"3 7 J Q K |\" +\n\t\t\"2 7 J Q K |\" +\n\t\t\"5 6 J Q K |\" +\n\t\t\"4 6 J Q K |\" +\n\t\t\"3 6 J Q K |\" +\n\t\t\"2 6 J Q K |\" +\n\t\t\"4 5 J Q K |\" +\n\t\t\"3 5 J Q K |\" +\n\t\t\"2 5 J Q K |\" +\n\t\t\"3 4 J Q K |\" +\n\t\t\"2 4 J Q K |\" +\n\t\t\"2 3 J Q K |\" +\n\t\t\"8 9 T Q K |\" +\n\t\t\"7 9 T Q K |\" +\n\t\t\"6 9 T Q K |\" +\n\t\t\"5 9 T Q K |\" +\n\t\t\"4 9 T Q K |\" +\n\t\t\"3 9 T Q K |\" +\n\t\t\"2 9 T Q K |\" +\n\t\t\"7 8 T Q K |\" +\n\t\t\"6 8 T Q K |\" +\n\t\t\"5 8 T Q K |\" +\n\t\t\"4 8 T Q K |\" +\n\t\t\"3 8 T Q K |\" +\n\t\t\"2 8 T Q K |\" +\n\t\t\"6 7 T Q K |\" +\n\t\t\"5 7 T Q K |\" +\n\t\t\"4 7 T Q K |\" +\n\t\t\"3 7 T Q K |\" +\n\t\t\"2 7 T Q K |\" +\n\t\t\"5 6 T Q K |\" +\n\t\t\"4 6 T Q K |\" +\n\t\t\"3 6 T Q K |\" +\n\t\t\"2 6 T Q K |\" +\n\t\t\"4 5 T Q K |\" +\n\t\t\"3 5 T Q K |\" +\n\t\t\"2 5 T Q K |\" +\n\t\t\"3 4 T Q K |\" +\n\t\t\"2 4 T Q K |\" +\n\t\t\"2 3 T Q K |\" +\n\t\t\"7 8 9 Q K |\" +\n\t\t\"6 8 9 Q K |\" +\n\t\t\"5 8 9 Q K |\" +\n\t\t\"4 8 9 Q K |\" +\n\t\t\"3 8 9 Q K |\" +\n\t\t\"2 8 9 Q K |\" +\n\t\t\"6 7 9 Q K |\" +\n\t\t\"5 7 9 Q K |\" +\n\t\t\"4 7 9 Q K |\" +\n\t\t\"3 7 9 Q K |\" +\n\t\t\"2 7 9 Q K |\" +\n\t\t\"5 6 9 Q K |\" +\n\t\t\"4 6 9 Q K |\" +\n\t\t\"3 6 9 Q K |\" +\n\t\t\"2 6 9 Q K |\" +\n\t\t\"4 5 9 Q K |\" +\n\t\t\"3 5 9 Q K |\" +\n\t\t\"2 5 9 Q K |\" +\n\t\t\"3 4 9 Q K |\" +\n\t\t\"2 4 9 Q K |\" +\n\t\t\"2 3 9 Q K |\" +\n\t\t\"6 7 8 Q K |\" +\n\t\t\"5 7 8 Q K |\" +\n\t\t\"4 7 8 Q K |\" +\n\t\t\"3 7 8 Q K |\" +\n\t\t\"2 7 8 Q K |\" +\n\t\t\"5 6 8 Q K |\" +\n\t\t\"4 6 8 Q K |\" +\n\t\t\"3 6 8 Q K |\" +\n\t\t\"2 6 8 Q K |\" +\n\t\t\"4 5 8 Q K |\" +\n\t\t\"3 5 8 Q K |\" +\n\t\t\"2 5 8 Q K |\" +\n\t\t\"3 4 8 Q K |\" +\n\t\t\"2 4 8 Q K |\" +\n\t\t\"2 3 8 Q K |\" +\n\t\t\"5 6 7 Q K |\" +\n\t\t\"4 6 7 Q K |\" +\n\t\t\"3 6 7 Q K |\" +\n\t\t\"2 6 7 Q K |\" +\n\t\t\"4 5 7 Q K |\" +\n\t\t\"3 5 7 Q K |\" +\n\t\t\"2 5 7 Q K |\" +\n\t\t\"3 4 7 Q K |\" +\n\t\t\"2 4 7 Q K |\" +\n\t\t\"2 3 7 Q K |\" +\n\t\t\"4 5 6 Q K |\" +\n\t\t\"3 5 6 Q K |\" +\n\t\t\"2 5 6 Q K |\" +\n\t\t\"3 4 6 Q K |\" +\n\t\t\"2 4 6 Q K |\" +\n\t\t\"2 3 6 Q K |\" +\n\t\t\"3 4 5 Q K |\" +\n\t\t\"2 4 5 Q K |\" +\n\t\t\"2 3 5 Q K |\" +\n\t\t\"2 3 4 Q K |\" +\n\t\t\"8 9 T J K |\" +\n\t\t\"7 9 T J K |\" +\n\t\t\"6 9 T J K |\" +\n\t\t\"5 9 T J K |\" +\n\t\t\"4 9 T J K |\" +\n\t\t\"3 9 T J K |\" +\n\t\t\"2 9 T J K |\" +\n\t\t\"7 8 T J K |\" +\n\t\t\"6 8 T J K |\" +\n\t\t\"5 8 T J K |\" +\n\t\t\"4 8 T J K |\" +\n\t\t\"3 8 T J K |\" +\n\t\t\"2 8 T J K |\" +\n\t\t\"6 7 T J K |\" +\n\t\t\"5 7 T J K |\" +\n\t\t\"4 7 T J K |\" +\n\t\t\"3 7 T J K |\" +\n\t\t\"2 7 T J K |\" +\n\t\t\"5 6 T J K |\" +\n\t\t\"4 6 T J K |\" +\n\t\t\"3 6 T J K |\" +\n\t\t\"2 6 T J K |\" +\n\t\t\"4 5 T J K |\" +\n\t\t\"3 5 T J K |\" +\n\t\t\"2 5 T J K |\" +\n\t\t\"3 4 T J K |\" +\n\t\t\"2 4 T J K |\" +\n\t\t\"2 3 T J K |\" +\n\t\t\"7 8 9 J K |\" +\n\t\t\"6 8 9 J K |\" +\n\t\t\"5 8 9 J K |\" +\n\t\t\"4 8 9 J K |\" +\n\t\t\"3 8 9 J K |\" +\n\t\t\"2 8 9 J K |\" +\n\t\t\"6 7 9 J K |\" +\n\t\t\"5 7 9 J K |\" +\n\t\t\"4 7 9 J K |\" +\n\t\t\"3 7 9 J K |\" +\n\t\t\"2 7 9 J K |\" +\n\t\t\"5 6 9 J K |\" +\n\t\t\"4 6 9 J K |\" +\n\t\t\"3 6 9 J K |\" +\n\t\t\"2 6 9 J K |\" +\n\t\t\"4 5 9 J K |\" +\n\t\t\"3 5 9 J K |\" +\n\t\t\"2 5 9 J K |\" +\n\t\t\"3 4 9 J K |\" +\n\t\t\"2 4 9 J K |\" +\n\t\t\"2 3 9 J K |\" +\n\t\t\"6 7 8 J K |\" +\n\t\t\"5 7 8 J K |\" +\n\t\t\"4 7 8 J K |\" +\n\t\t\"3 7 8 J K |\" +\n\t\t\"2 7 8 J K |\" +\n\t\t\"5 6 8 J K |\" +\n\t\t\"4 6 8 J K |\" +\n\t\t\"3 6 8 J K |\" +\n\t\t\"2 6 8 J K |\" +\n\t\t\"4 5 8 J K |\" +\n\t\t\"3 5 8 J K |\" +\n\t\t\"2 5 8 J K |\" +\n\t\t\"3 4 8 J K |\" +\n\t\t\"2 4 8 J K |\" +\n\t\t\"2 3 8 J K |\" +\n\t\t\"5 6 7 J K |\" +\n\t\t\"4 6 7 J K |\" +\n\t\t\"3 6 7 J K |\" +\n\t\t\"2 6 7 J K |\" +\n\t\t\"4 5 7 J K |\" +\n\t\t\"3 5 7 J K |\" +\n\t\t\"2 5 7 J K |\" +\n\t\t\"3 4 7 J K |\" +\n\t\t\"2 4 7 J K |\" +\n\t\t\"2 3 7 J K |\" +\n\t\t\"4 5 6 J K |\" +\n\t\t\"3 5 6 J K |\" +\n\t\t\"2 5 6 J K |\" +\n\t\t\"3 4 6 J K |\" +\n\t\t\"2 4 6 J K |\" +\n\t\t\"2 3 6 J K |\" +\n\t\t\"3 4 5 J K |\" +\n\t\t\"2 4 5 J K |\" +\n\t\t\"2 3 5 J K |\" +\n\t\t\"2 3 4 J K |\" +\n\t\t\"7 8 9 T K |\" +\n\t\t\"6 8 9 T K |\" +\n\t\t\"5 8 9 T K |\" +\n\t\t\"4 8 9 T K |\" +\n\t\t\"3 8 9 T K |\" +\n\t\t\"2 8 9 T K |\" +\n\t\t\"6 7 9 T K |\" +\n\t\t\"5 7 9 T K |\" +\n\t\t\"4 7 9 T K |\" +\n\t\t\"3 7 9 T K |\" +\n\t\t\"2 7 9 T K |\" +\n\t\t\"5 6 9 T K |\" +\n\t\t\"4 6 9 T K |\" +\n\t\t\"3 6 9 T K |\" +\n\t\t\"2 6 9 T K |\" +\n\t\t\"4 5 9 T K |\" +\n\t\t\"3 5 9 T K |\" +\n\t\t\"2 5 9 T K |\" +\n\t\t\"3 4 9 T K |\" +\n\t\t\"2 4 9 T K |\" +\n\t\t\"2 3 9 T K |\" +\n\t\t\"6 7 8 T K |\" +\n\t\t\"5 7 8 T K |\" +\n\t\t\"4 7 8 T K |\" +\n\t\t\"3 7 8 T K |\" +\n\t\t\"2 7 8 T K |\" +\n\t\t\"5 6 8 T K |\" +\n\t\t\"4 6 8 T K |\" +\n\t\t\"3 6 8 T K |\" +\n\t\t\"2 6 8 T K |\" +\n\t\t\"4 5 8 T K |\" +\n\t\t\"3 5 8 T K |\" +\n\t\t\"2 5 8 T K |\" +\n\t\t\"3 4 8 T K |\" +\n\t\t\"2 4 8 T K |\" +\n\t\t\"2 3 8 T K |\" +\n\t\t\"5 6 7 T K |\" +\n\t\t\"4 6 7 T K |\" +\n\t\t\"3 6 7 T K |\" +\n\t\t\"2 6 7 T K |\" +\n\t\t\"4 5 7 T K |\" +\n\t\t\"3 5 7 T K |\" +\n\t\t\"2 5 7 T K |\" +\n\t\t\"3 4 7 T K |\" +\n\t\t\"2 4 7 T K |\" +\n\t\t\"2 3 7 T K |\" +\n\t\t\"4 5 6 T K |\" +\n\t\t\"3 5 6 T K |\" +\n\t\t\"2 5 6 T K |\" +\n\t\t\"3 4 6 T K |\" +\n\t\t\"2 4 6 T K |\" +\n\t\t\"2 3 6 T K |\" +\n\t\t\"3 4 5 T K |\" +\n\t\t\"2 4 5 T K |\" +\n\t\t\"2 3 5 T K |\" +\n\t\t\"2 3 4 T K |\" +\n\t\t\"6 7 8 9 K |\" +\n\t\t\"5 7 8 9 K |\" +\n\t\t\"4 7 8 9 K |\" +\n\t\t\"3 7 8 9 K |\" +\n\t\t\"2 7 8 9 K |\" +\n\t\t\"5 6 8 9 K |\" +\n\t\t\"4 6 8 9 K |\" +\n\t\t\"3 6 8 9 K |\" +\n\t\t\"2 6 8 9 K |\" +\n\t\t\"4 5 8 9 K |\" +\n\t\t\"3 5 8 9 K |\" +\n\t\t\"2 5 8 9 K |\" +\n\t\t\"3 4 8 9 K |\" +\n\t\t\"2 4 8 9 K |\" +\n\t\t\"2 3 8 9 K |\" +\n\t\t\"5 6 7 9 K |\" +\n\t\t\"4 6 7 9 K |\" +\n\t\t\"3 6 7 9 K |\" +\n\t\t\"2 6 7 9 K |\" +\n\t\t\"4 5 7 9 K |\" +\n\t\t\"3 5 7 9 K |\" +\n\t\t\"2 5 7 9 K |\" +\n\t\t\"3 4 7 9 K |\" +\n\t\t\"2 4 7 9 K |\" +\n\t\t\"2 3 7 9 K |\" +\n\t\t\"4 5 6 9 K |\" +\n\t\t\"3 5 6 9 K |\" +\n\t\t\"2 5 6 9 K |\" +\n\t\t\"3 4 6 9 K |\" +\n\t\t\"2 4 6 9 K |\" +\n\t\t\"2 3 6 9 K |\" +\n\t\t\"3 4 5 9 K |\" +\n\t\t\"2 4 5 9 K |\" +\n\t\t\"2 3 5 9 K |\" +\n\t\t\"2 3 4 9 K |\" +\n\t\t\"5 6 7 8 K |\" +\n\t\t\"4 6 7 8 K |\" +\n\t\t\"3 6 7 8 K |\" +\n\t\t\"2 6 7 8 K |\" +\n\t\t\"4 5 7 8 K |\" +\n\t\t\"3 5 7 8 K |\" +\n\t\t\"2 5 7 8 K |\" +\n\t\t\"3 4 7 8 K |\" +\n\t\t\"2 4 7 8 K |\" +\n\t\t\"2 3 7 8 K |\" +\n\t\t\"4 5 6 8 K |\" +\n\t\t\"3 5 6 8 K |\" +\n\t\t\"2 5 6 8 K |\" +\n\t\t\"3 4 6 8 K |\" +\n\t\t\"2 4 6 8 K |\" +\n\t\t\"2 3 6 8 K |\" +\n\t\t\"3 4 5 8 K |\" +\n\t\t\"2 4 5 8 K |\" +\n\t\t\"2 3 5 8 K |\" +\n\t\t\"2 3 4 8 K |\" +\n\t\t\"4 5 6 7 K |\" +\n\t\t\"3 5 6 7 K |\" +\n\t\t\"2 5 6 7 K |\" +\n\t\t\"3 4 6 7 K |\" +\n\t\t\"2 4 6 7 K |\" +\n\t\t\"2 3 6 7 K |\" +\n\t\t\"3 4 5 7 K |\" +\n\t\t\"2 4 5 7 K |\" +\n\t\t\"2 3 5 7 K |\" +\n\t\t\"2 3 4 7 K |\" +\n\t\t\"3 4 5 6 K |\" +\n\t\t\"2 4 5 6 K |\" +\n\t\t\"2 3 5 6 K |\" +\n\t\t\"2 3 4 6 K |\" +\n\t\t\"2 3 4 5 K |\" +\n\t\t\"7 9 T J Q |\" +\n\t\t\"6 9 T J Q |\" +\n\t\t\"5 9 T J Q |\" +\n\t\t\"4 9 T J Q |\" +\n\t\t\"3 9 T J Q |\" +\n\t\t\"2 9 T J Q |\" +\n\t\t\"7 8 T J Q |\" +\n\t\t\"6 8 T J Q |\" +\n\t\t\"5 8 T J Q |\" +\n\t\t\"4 8 T J Q |\" +\n\t\t\"3 8 T J Q |\" +\n\t\t\"2 8 T J Q |\" +\n\t\t\"6 7 T J Q |\" +\n\t\t\"5 7 T J Q |\" +\n\t\t\"4 7 T J Q |\" +\n\t\t\"3 7 T J Q |\" +\n\t\t\"2 7 T J Q |\" +\n\t\t\"5 6 T J Q |\" +\n\t\t\"4 6 T J Q |\" +\n\t\t\"3 6 T J Q |\" +\n\t\t\"2 6 T J Q |\" +\n\t\t\"4 5 T J Q |\" +\n\t\t\"3 5 T J Q |\" +\n\t\t\"2 5 T J Q |\" +\n\t\t\"3 4 T J Q |\" +\n\t\t\"2 4 T J Q |\" +\n\t\t\"2 3 T J Q |\" +\n\t\t\"7 8 9 J Q |\" +\n\t\t\"6 8 9 J Q |\" +\n\t\t\"5 8 9 J Q |\" +\n\t\t\"4 8 9 J Q |\" +\n\t\t\"3 8 9 J Q |\" +\n\t\t\"2 8 9 J Q |\" +\n\t\t\"6 7 9 J Q |\" +\n\t\t\"5 7 9 J Q |\" +\n\t\t\"4 7 9 J Q |\" +\n\t\t\"3 7 9 J Q |\" +\n\t\t\"2 7 9 J Q |\" +\n\t\t\"5 6 9 J Q |\" +\n\t\t\"4 6 9 J Q |\" +\n\t\t\"3 6 9 J Q |\" +\n\t\t\"2 6 9 J Q |\" +\n\t\t\"4 5 9 J Q |\" +\n\t\t\"3 5 9 J Q |\" +\n\t\t\"2 5 9 J Q |\" +\n\t\t\"3 4 9 J Q |\" +\n\t\t\"2 4 9 J Q |\" +\n\t\t\"2 3 9 J Q |\" +\n\t\t\"6 7 8 J Q |\" +\n\t\t\"5 7 8 J Q |\" +\n\t\t\"4 7 8 J Q |\" +\n\t\t\"3 7 8 J Q |\" +\n\t\t\"2 7 8 J Q |\" +\n\t\t\"5 6 8 J Q |\" +\n\t\t\"4 6 8 J Q |\" +\n\t\t\"3 6 8 J Q |\" +\n\t\t\"2 6 8 J Q |\" +\n\t\t\"4 5 8 J Q |\" +\n\t\t\"3 5 8 J Q |\" +\n\t\t\"2 5 8 J Q |\" +\n\t\t\"3 4 8 J Q |\" +\n\t\t\"2 4 8 J Q |\" +\n\t\t\"2 3 8 J Q |\" +\n\t\t\"5 6 7 J Q |\" +\n\t\t\"4 6 7 J Q |\" +\n\t\t\"3 6 7 J Q |\" +\n\t\t\"2 6 7 J Q |\" +\n\t\t\"4 5 7 J Q |\" +\n\t\t\"3 5 7 J Q |\" +\n\t\t\"2 5 7 J Q |\" +\n\t\t\"3 4 7 J Q |\" +\n\t\t\"2 4 7 J Q |\" +\n\t\t\"2 3 7 J Q |\" +\n\t\t\"4 5 6 J Q |\" +\n\t\t\"3 5 6 J Q |\" +\n\t\t\"2 5 6 J Q |\" +\n\t\t\"3 4 6 J Q |\" +\n\t\t\"2 4 6 J Q |\" +\n\t\t\"2 3 6 J Q |\" +\n\t\t\"3 4 5 J Q |\" +\n\t\t\"2 4 5 J Q |\" +\n\t\t\"2 3 5 J Q |\" +\n\t\t\"2 3 4 J Q |\" +\n\t\t\"7 8 9 T Q |\" +\n\t\t\"6 8 9 T Q |\" +\n\t\t\"5 8 9 T Q |\" +\n\t\t\"4 8 9 T Q |\" +\n\t\t\"3 8 9 T Q |\" +\n\t\t\"2 8 9 T Q |\" +\n\t\t\"6 7 9 T Q |\" +\n\t\t\"5 7 9 T Q\"\n\n\tarray := strings.Split(s, \" |\")\n\n\tvar oldValue uint32\n\tfor _, v := range array {\n\t\tcards := &Cards{}\n\t\tcards.SetByString(v)\n\t\t//t.Log(cards.String())\n\n\t\tk, value := De(cards.GetType())\n\t\tif oldValue == 0 {\n\t\t\toldValue = value\n\t\t\tcontinue\n\t\t}\n\n\t\tassert.Equal(t, oldValue > value, true)\n\t\tassert.Equal(t, k, FLUSH)\n\t\t//assert.Equal(t,v,uint32(6))\n\t\t//t.Log(De(cards.FullFouse(cards.Counter())))\n\t}\n\n}\n"
  },
  {
    "path": "src/server/algorithm/pk.go",
    "content": "package algorithm\n\nfunc (this *Cards) Counter() *ValueCounter {\n\tvar counter ValueCounter\n\tcounter.Set(*this)\n\treturn &counter\n}\nfunc (this *Cards) GetType() uint32 {\n\tif len(*this) == 0 {\n\t\treturn 0\n\t}\n\n\tcounter := this.Counter()\n\tASort(*this, 0, int8(len(*this))-1, counter)\n\n\tif res := this.royalFlush(); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.straightFlush(); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.four(counter); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.fullFouse(counter); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.flush(); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.straight(); res > 0 {\n\t\treturn res\n\t}\n\tif res := this.three(counter); res > 0 {\n\t\treturn res\n\t}\n\tif res := this.twoPair(); res > 0 {\n\t\treturn res\n\t}\n\n\tif res := this.onePair(); res > 0 {\n\t\treturn res\n\t}\n\t//高牌（high card）\n\t//既不是同一花色也不是同一点数的五张牌组成。\n\t//平手牌：如果不止一人抓到此牌，则比较点数最大者，\n\t//如果点数最大的相同，则比较第二、第三、第四和第五大的，如果所有牌都相同，则平分彩池。\n\treturn En(HIGH_CARD, ToValue(*this))\n}\n"
  },
  {
    "path": "src/server/algorithm/sort.go",
    "content": "package algorithm\n\n// 对牌值从小到大排序，采用快速排序算法\nfunc SortCards(arr []byte, start, end int8) {\n\tif start < end {\n\t\ti, j := start, end\n\t\tcard := arr[(start+end)/2]\n\t\tkey := card & 0xF\n\t\tsuit := card >> 4\n\t\tfor i <= j {\n\t\t\tfor (arr[i])&0xF < key || ((arr[i])&0xF == key && arr[i]>>4 < suit) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tfor (arr[j])&0xF > key || ((arr[j])&0xF == key && arr[j]>>4 > suit) {\n\n\t\t\t\tj--\n\t\t\t}\n\t\t\tif i <= j {\n\t\t\t\tarr[i], arr[j] = arr[j], arr[i]\n\t\t\t\ti++\n\t\t\t\tj--\n\t\t\t}\n\t\t}\n\t\tif start < j {\n\t\t\tSortCards(arr, start, j)\n\t\t}\n\t\tif end > i {\n\t\t\tSortCards(arr, i, end)\n\t\t}\n\t}\n}\n\nfunc Sort(cards []byte, start, end int8) {\n\tif start < end {\n\t\ti, j := start, end\n\t\tcard := cards[(start+end)/2]\n\t\tfor i <= j {\n\t\t\tfor cards[i] < card {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tfor cards[j] > card {\n\t\t\t\tj--\n\t\t\t}\n\t\t\tif i <= j {\n\t\t\t\tcards[i], cards[j] = cards[j], cards[i]\n\t\t\t\ti++\n\t\t\t\tj--\n\t\t\t}\n\t\t}\n\t\tif start < j {\n\t\t\tSort(cards, start, j)\n\t\t}\n\t\tif end > i {\n\t\t\tSort(cards, i, end)\n\t\t}\n\t}\n}\n\ntype ColorCounter uint16\n\nfunc (this *ColorCounter) Set(cards []byte) {\n\t//*this = 0\n\tl := uint8(len(cards))\n\tfor i := uint8(0); i < l; i++ {\n\t\tcard := (cards[i] >> 4) * 3\n\t\tcount := ((*this >> card) & 0x07) + 1\n\t\t*this &= (^(0x07 << card))\n\t\t*this |= (count << card)\n\t}\n}\n\nfunc (this *ColorCounter) Get(card byte) uint8 {\n\treturn uint8((*this >> (card >> 4) * 3 ) & 0x07)\n}\n\ntype ValueCounter uint64\n\nfunc (this *ValueCounter) Set(cards []byte) {\n\t//*this = 0\n\tl := uint8(len(cards))\n\tfor i := uint8(0); i < l; i++ {\n\t\tcard := (cards[i] & 0xF) * 3\n\t\tcount := ((*this >> card) & 0x07) + 1\n\t\t*this &= (^(0x07 << card))\n\t\t*this |= (count << card)\n\t}\n}\n\nfunc (this *ValueCounter) Get(card byte) uint8 {\n\treturn uint8((*this >> (card & 0xF * 3 )) & 0x07)\n}\n\nfunc ASort(arr []byte, start, end int8, counter *ValueCounter) {\n\tif start < end {\n\t\ti, j := start, end\n\t\tcard := arr[(start+end)/2]\n\t\tkey := card & 0xF\n\t\tcount := counter.Get(key)\n\t\tfor i <= j {\n\t\t\tfor (counter.Get(arr[i]&0xF) < count) || ((counter.Get(arr[i]&0xF) == count) && (arr[i])&0xF < key ) {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tfor (counter.Get(arr[j]&0xF) > count) || ((counter.Get(arr[j]&0xF) == count) && (arr[j])&0xF > key ) {\n\n\t\t\t\tj--\n\t\t\t}\n\t\t\tif i <= j {\n\t\t\t\tarr[i], arr[j] = arr[j], arr[i]\n\t\t\t\ti++\n\t\t\t\tj--\n\t\t\t}\n\t\t}\n\t\tif start < j {\n\t\t\tASort(arr, start, j, counter)\n\t\t}\n\t\tif end > i {\n\t\t\tASort(arr, i, end, counter)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/server/algorithm/sort_test.go",
    "content": "package algorithm\n\nimport \"testing\"\n\nfunc Test11Base(t *testing.T) {\n\n\tcards := Cards{0x12, 0x03, 0x24, 0x35, 0x26, 0x17, 0x33}\n\tvar a ValueCounter\n\ta.Set(cards)\n\tASort(cards, 0, int8(len(cards) -1), &a)\n\n\tt.Logf(\"%#v \",cards)\n}\nfunc Test10Base(t *testing.T) {\n\tarr := Cards([]byte{1, 2, 3, 4, 4, 5, 6})\n\n\tarr.Shuffle()\n\n\tt.Logf(\"%#v \", arr)\n\n\tt.Logf(\"%#v \", arr)\n}\n"
  },
  {
    "path": "src/server/algorithm/tostring.go",
    "content": "package algorithm\n\nimport (\n\t\"strings\"\n\t\"fmt\"\n)\n\nfunc (this *Cards) Bytes() []byte {\n\tb := make([]byte, len(*this))\n\tfor k, v := range *this {\n\t\tb[k] = byte(v)\n\t}\n\treturn b\n}\nfunc (this *Cards) Len() int {\n\treturn len(*this)\n}\nfunc (this *Cards) Take() byte {\n\tcard := (*this)[0]\n\t(*this) = (*this)[1:]\n\treturn card\n}\nfunc (this *Cards) Append(cards ...byte) Cards {\n\tcs := make([]byte, 0, len(cards)+len(*this))\n\tcs = append(cs, (*this)...)\n\tcs = append(cs, cards...)\n\treturn cs\n}\n\nfunc (this *Cards) Equal(cards []byte) bool {\n\tif len(*this) != len(cards) {\n\t\treturn false\n\t}\n\tfor k, v := range *this {\n\t\tif cards[k] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\nfunc Color(color byte) (char string) {\n\tswitch color {\n\tcase 0:\n\t\tchar = \"♦\"\n\tcase 1:\n\t\tchar = \"♣\"\n\tcase 2:\n\t\tchar = \"♥\"\n\tcase 3:\n\t\tchar = \"♠\"\n\t}\n\treturn\n}\n\nfunc String2Num(c byte) (n byte) {\n\tswitch c {\n\tcase '2':\n\t\tn = 2\n\tcase '3':\n\t\tn = 3\n\tcase '4':\n\t\tn = 4\n\tcase '5':\n\t\tn = 5\n\tcase '6':\n\t\tn = 6\n\tcase '7':\n\t\tn = 7\n\tcase '8':\n\t\tn = 8\n\tcase '9':\n\t\tn = 9\n\tcase 'T':\n\t\tn = 0xA\n\tcase 'J':\n\t\tn = 0xB\n\tcase 'Q':\n\t\tn = 0xC\n\tcase 'K':\n\t\tn = 0xD\n\tcase 'A':\n\t\tn = 0xE\n\t}\n\treturn\n}\nfunc Num2String(n byte) (c byte) {\n\tswitch n {\n\tcase 2:\n\t\tc = '2'\n\tcase 3:\n\t\tc = '3'\n\tcase 4:\n\t\tc = '4'\n\tcase 5:\n\t\tc = '5'\n\tcase 6:\n\t\tc = '6'\n\tcase 7:\n\t\tc = '7'\n\tcase 8:\n\t\tc = '8'\n\tcase 9:\n\t\tc = '9'\n\tcase 0xA:\n\t\tc = 'T'\n\tcase 0xB:\n\t\tc = 'J'\n\tcase 0xC:\n\t\tc = 'Q'\n\tcase 0xD:\n\t\tc = 'K'\n\tcase 0xE:\n\t\tc = 'A'\n\t}\n\treturn\n}\n\nfunc (this *Cards) SetByString(str string) {\n\tarray := strings.Split(str, \" \")\n\t*this = make([]byte, len(array))\n\tfor k, v := range array {\n\t\t(*this)[k] = String2Num(byte(v[0]))\n\t}\n\n}\nfunc (this *Cards) String() (str string) {\n\tfor k, v := range *this {\n\t\tcolor := Color(v)\n\t\tvalue := Num2String(v)\n\t\tstr += string(color) + string(value)\n\t\tif k < len(*this)-1 {\n\t\t\tstr += \" \"\n\t\t}\n\t}\n\treturn\n}\n\nfunc (this *Cards) Hex() string {\n\treturn fmt.Sprintf(\"%#v\", *this)\n}\n"
  },
  {
    "path": "src/server/base/skeleton.go",
    "content": "package base\n\nimport (\n\t\"github.com/dolotech/leaf/chanrpc\"\n\t\"github.com/dolotech/leaf/module\"\n\t\"server/conf\"\n)\n\nfunc NewSkeleton() *module.Skeleton {\n\tskeleton := &module.Skeleton{\n\t\tGoLen:              conf.GoLen,\n\t\tTimerDispatcherLen: conf.TimerDispatcherLen,\n\t\tAsynCallLen:        conf.AsynCallLen,\n\t\tChanRPCServer:      chanrpc.NewServer(conf.ChanRPCLen),\n\t}\n\tskeleton.Init()\n\treturn skeleton\n}\n"
  },
  {
    "path": "src/server/conf/conf.go",
    "content": "package conf\n\nimport (\n\t\"log\"\n\t\"time\"\n)\n\nvar (\n\t// glog conf\n\tLogFlag = log.LstdFlags\n\n\t// gate conf\n\tPendingWriteNum        = 2000\n\tMaxMsgLen       uint32 = 4096\n\tHTTPTimeout            = 10 * time.Second\n\tLenMsgLen              = 2\n\tLittleEndian           = false\n\n\t// skeleton conf\n\tGoLen              = 10000\n\tTimerDispatcherLen = 10000\n\tAsynCallLen        = 10000\n\tChanRPCLen         = 10000\n)\n\n\n\nvar Server struct {\n\tWSAddr       string\n\tCertFile     string\n\tKeyFile      string\n\tTCPAddr      string\n\tMaxConnNum   int\n\tDBMaxConnNum int\n\tDBUrl        string\n}"
  },
  {
    "path": "src/server/game/external.go",
    "content": "package game\n\nimport (\n\t\"server/game/internal\"\n)\n\nvar (\n\tModule  = new(internal.Module)//建立模块新的\n\tChanRPC = internal.ChanRPC\n)\n"
  },
  {
    "path": "src/server/game/internal/chanrpc.go",
    "content": "package internal\n\nimport (\n\t\"github.com/dolotech/leaf/gate\"\n\t\"github.com/golang/glog\"\n\t\"server/model\"\n\t\"github.com/dolotech/leaf/room\"\n)\n\nfunc init() {\n\tskeleton.RegisterChanRPC(model.Agent_New, rpcNewAgent)\n\tskeleton.RegisterChanRPC(model.Agent_Close, rpcCloseAgent)\n\tskeleton.RegisterChanRPC(model.Agent_Login, rpcLoginAgent)\n}\n\nfunc rpcNewAgent(a gate.Agent) {\n\tglog.Errorln(\"新建链接 \", a)\n}\n\nfunc rpcCloseAgent(a gate.Agent) {\n\tglog.Errorln(\"链接关闭 \", a)\n}\n\nfunc rpcLoginAgent(u *model.User, a gate.Agent) {\n\n\to := NewOccupant(u, a)\n\ta.SetUserData(o)\n\n\tif len(u.RoomID) > 0 {\n\t\to.room = room.GetRoom(u.RoomID)\n\t}\n\tglog.Errorln(\"rpcLoginAgent\", u)\n}\n"
  },
  {
    "path": "src/server/game/internal/game_rule.go",
    "content": "package internal\n\nimport (\n\t\"github.com/golang/glog\"\n\t\"server/protocol\"\n\t\"server/model\"\n\t\"server/algorithm\"\n\t\"time\"\n\t\"github.com/dolotech/lib/utils\"\n)\n\nfunc (r *Room) startDelay(startDelay *startDelay, o *Occupant) {\n\tif startDelay.kind == 0 {\n\t\tr.Info()\n\t\tr.start()\n\t}\n}\nfunc (r *Room) start() {\n\tif r.status == RUNNING {\n\t\treturn\n\t}\n\t// 产生庄\n\tvar dealer *Occupant\n\tbutton := r.Button - 1\n\tr.Each((button+1)%r.Cap(), func(o *Occupant) bool {\n\t\tr.Button = o.Pos\n\t\tdealer = o\n\t\treturn false\n\t})\n\n\tif dealer == nil {\n\t\treturn\n\t}\n\n\tr.remain = 0\n\tr.allin = 0\n\t// 剔除筹码小于大盲和离线的玩家\n\n\tn := 0\n\tr.Each(0, func(o *Occupant) bool {\n\t\tif o.chips < r.BB || o.IsOffline() {\n\t\t\to.SetSitdown()\n\t\t\treturn true\n\t\t}\n\t\to.SetGameing()\n\t\tn ++\n\t\treturn true\n\t})\n\n\t// 2人及以上才开始游戏\n\tif n < 2 {\n\t\treturn\n\t}\n\n\tr.status = RUNNING\n\t// 洗牌\n\tr.Cards.Shuffle()\n\n\t// 产生小盲\n\tsb := r.next(dealer.Pos)\n\tif n == 2 { // one-to-one\n\t\tsb = dealer\n\t}\n\t// 产生大盲\n\tbb := r.next(sb.Pos)\n\tbbPos := bb.Pos\n\n\t// 通报本局庄家\n\tr.WriteMsg(&protocol.Button{Uid: dealer.Uid})\n\n\t// 小大盲下注\n\tr.betting(sb, int32(r.SB))\n\tr.betting(bb, int32(r.BB))\n\n\t// Round 1 : preflop\n\tr.ready()\n\tr.Each(0, func(o *Occupant) bool {\n\t\to.cards = algorithm.Cards{r.Cards.Take(), r.Cards.Take()}\n\n\t\tkind, _ := algorithm.De(o.cards.GetType())\n\t\tm := &protocol.PreFlop{\n\t\t\tCards: o.cards.Bytes(),\n\t\t\tKind:  kind,\n\t\t}\n\t\to.WriteMsg(m)\n\t\treturn true\n\t})\n\tr.Broadcast(&protocol.PreFlop{}, false)\n\n\tr.action(0)\n\n\tif r.remain <= 1 {\n\t\tgoto showdown\n\t}\n\tr.calc()\n\n\t// Round 2 : Flop\n\tr.ready()\n\tr.Cards = algorithm.Cards{r.Cards.Take(), r.Cards.Take(), r.Cards.Take()}\n\tr.Each(0, func(o *Occupant) bool {\n\t\tcs := r.Cards.Append(o.cards...)\n\n\t\tkind, _ := algorithm.De(cs.GetType())\n\t\tm := &protocol.Flop{\n\t\t\tCards: cs.Bytes(),\n\t\t\tKind:  kind,\n\t\t}\n\t\to.WriteMsg(m)\n\t\treturn true\n\t})\n\tr.Broadcast(&protocol.Flop{Cards: r.Cards.Bytes()}, false)\n\n\tr.action(0)\n\n\tif r.remain <= 1 {\n\t\tgoto showdown\n\t}\n\tr.calc()\n\n\t// Round 3 : Turn\n\tr.ready()\n\tr.Cards = r.Cards.Append(r.Cards.Take())\n\tr.Each(0, func(o *Occupant) bool {\n\t\tcs := r.Cards.Append(o.cards...)\n\t\tkind, _ := algorithm.De(cs.GetType())\n\t\tm := &protocol.Turn{\n\t\t\tCard: r.Cards[3],\n\t\t\tKind: kind,\n\t\t}\n\t\to.WriteMsg(m)\n\t\treturn true\n\t})\n\tr.Broadcast(&protocol.Turn{Card: r.Cards[3]}, false)\n\n\tr.action(0)\n\n\tif r.remain <= 1 {\n\t\tgoto showdown\n\t}\n\tr.calc()\n\n\t// Round 4 : River\n\tr.ready()\n\tr.Cards = r.Cards.Append(r.Cards.Take())\n\tr.Each(0, func(o *Occupant) bool {\n\t\tcs := r.Cards.Append(o.cards...)\n\t\tvalue := cs.GetType()\n\t\tkind, _ := algorithm.De(value)\n\t\tm := &protocol.River{\n\t\t\tCard: r.Cards[4],\n\t\t\tKind: kind,\n\t\t}\n\t\to.WriteMsg(m)\n\t\to.HandValue = value\n\t\treturn true\n\t})\n\tr.Broadcast(&protocol.River{Card: r.Cards[4]}, false)\n\n\tr.action(0)\n\nshowdown:\n\tr.showdown()\n\tshowdown := &protocol.Showdown{}\n\tfor _, o := range r.Occupants {\n\t\tif o != nil && o.IsGameing() {\n\t\t\to.SetSitdown()\n\n\t\t\titem := &protocol.ShowdownItem{\n\t\t\t\tUid:      o.Uid,\n\t\t\t\tChipsWin: r.Chips[o.Pos-1],\n\t\t\t\tChips:    o.chips,\n\t\t\t}\n\t\t\tshowdown.Showdown = append(showdown.Showdown, item)\n\t\t}\n\t}\n\tr.Broadcast(showdown, true)\n\tr.Info(sb.Pos, bbPos)\n\n\tr.status = GAMEOVER\n\n\ttime.AfterFunc(time.Second*2, func() {\n\t\tdefer utils.PrintPanicStack()\n\t\tr.Send(nil, &startDelay{})\n\t})\n}\n\nfunc (r *Room) calc() (pots []handPot) {\n\tpots = calcPot(r.Chips)\n\tr.Pot = r.Pot[:]\n\tvar ps []uint32\n\tfor _, pot := range pots {\n\t\tr.Pot = append(r.Pot, pot.Pot)\n\t\tps = append(ps, pot.Pot)\n\t}\n\tr.Broadcast(&protocol.Pot{Pot: ps}, true)\n\treturn\n}\n\nfunc (r *Room) action(pos uint8) {\n\tif r.allin+1 >= r.remain {\n\t\treturn\n\t}\n\tvar skip uint8\n\tif pos == 0 { // start from left hand of button\n\t\tpos = (r.Button)%r.Cap() + 1\n\t}\n\n\tfor {\n\t\tvar raised uint8\n\t\tr.Each(pos-1, func(o *Occupant) bool {\n\t\t\tif r.remain <= 1 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif o.Pos == skip || o.chips == 0 {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tr.WriteMsg(&protocol.BetPrompt{})\n\t\t\tn := o.GetAction(r.Timeout)\n\t\t\tif r.remain <= 1 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif r.betting(o, n) {\n\t\t\t\traised = o.Pos\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t\tif raised == 0 {\n\t\t\tbreak\n\t\t}\n\t\tpos = raised\n\t\tskip = pos\n\t}\n}\n\nfunc (r *Room) ready() {\n\tr.Bet = 0\n\tr.Each(0, func(o *Occupant) bool {\n\t\to.Bet = 0\n\t\to.waitAction = false\n\t\tr.remain++\n\t\to.HandValue = 0\n\t\treturn true\n\t})\n}\n\n// 比牌\nfunc (r *Room) showdown() {\n\tpots := r.calc()\n\n\tfor i, _ := range r.Chips {\n\t\tr.Chips[i] = 0\n\t}\n\n\tfor _, pot := range pots {\n\t\tvar maxO *Occupant\n\t\tfor _, pos := range pot.OPos {\n\t\t\to := r.Occupants[pos-1]\n\t\t\tif o != nil && len(o.cards) > 0 {\n\t\t\t\tif maxO == nil {\n\t\t\t\t\tmaxO = o\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif o.HandValue > maxO.HandValue {\n\t\t\t\t\tmaxO = o\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar winners []uint8\n\n\t\tfor _, pos := range pot.OPos {\n\t\t\to := r.Occupants[pos-1]\n\t\t\tif o != nil && o.HandValue == maxO.HandValue && o.IsGameing() {\n\t\t\t\twinners = append(winners, o.Pos)\n\t\t\t}\n\t\t}\n\n\t\tif len(winners) == 0 {\n\t\t\tglog.Errorln(\"!!!no winners!!!\")\n\t\t\treturn\n\t\t}\n\n\t\tfor _, winner := range winners {\n\t\t\tr.Chips[winner-1] += pot.Pot / uint32(len(winners))\n\t\t}\n\t\tr.Chips[winners[0]-1] += pot.Pot % uint32(len(winners)) // odd chips\n\t}\n\n\tfor i, _ := range r.Chips {\n\t\tif r.Occupants[i] != nil {\n\t\t\tr.Occupants[i].chips += r.Chips[i]\n\t\t}\n\t}\n}\n\nfunc (r *Room) betting(o *Occupant, n int32) (raised bool) {\n\tif n > int32(o.chips) || // 手上筹码不足\n\t\t(n == 0 && o.Bet != r.Bet) || // 让牌\n\t\t(n > 0 && n != int32(o.chips) && ((n + int32(o.Bet)) < int32(r.Bet))) {\n\t\tglog.Errorf(\"下注筹码不合法!!！ n:%d  p.Bet:%d  p.Chips:%d  t.Bet:%d\", n, o.Bet, o.chips, r.Bet)\n\t\treturn\n\t}\n\n\tvalue := n\n\tactionName := \"\"\n\tif n < 0 {\n\t\tactionName = model.BET_FOLD\n\t\tn = 0\n\t\tr.remain--\n\t\to.SetSitdown()\n\t} else if n == 0 {\n\t\tactionName = model.BET_CHECK\n\t} else if uint32(n)+o.Bet <= r.Bet {\n\t\tactionName = model.BET_CALL\n\t\to.chips -= uint32(n)\n\t\to.Bet += uint32(n)\n\t} else {\n\t\tactionName = model.BET_RAISE\n\t\to.chips -= uint32(n)\n\t\to.Bet += uint32(n)\n\t\tr.Bet = o.Bet\n\t\traised = true\n\t}\n\tif o.chips == 0 {\n\t\tr.allin++\n\t\tactionName = model.BET_ALLIN\n\t}\n\tr.Chips[o.Pos-1] += uint32(n)\n\n\tr.Broadcast(&protocol.BetBroadcast{\n\t\tUid:   o.Uid,\n\t\tKind:  actionName,\n\t\tValue: value,\n\t}, true)\n\n\treturn\n}\n\nfunc (r *Room) next(pos uint8) *Occupant {\n\tvolume := r.Cap()\n\tfor i := (pos) % volume; i != pos-1; i = (i + 1) % volume {\n\t\tif r.Occupants[i] != nil && r.Occupants[i].IsGameing() {\n\t\t\treturn r.Occupants[i]\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/server/game/internal/module.go",
    "content": "package internal\n\nimport (\n\t\"github.com/dolotech/leaf/module\"\n\t\"server/base\"\n\t\"github.com/golang/glog\"\n\t\"server/protocol\"\n\t\"github.com/dolotech/leaf/room\"\n\t\"reflect\"\n\t\"server/model\"\n)\n\nvar (\n\tskeleton = base.NewSkeleton()\n\tChanRPC  = skeleton.ChanRPCServer\n)\n\nfunc handler(m interface{}, h interface{}) {\n\tskeleton.RegisterChanRPC(reflect.TypeOf(m), h)\n}\nfunc init() {\n\thandler(&protocol.JoinRoom{}, room.OnMessage)\n\thandler(&protocol.LeaveRoom{}, room.OnMessage)\n\thandler(&protocol.Bet{}, room.OnMessage)\n\thandler(&protocol.SitDown{}, room.OnMessage) //\n\thandler(&protocol.StandUp{}, room.OnMessage) //\n\thandler(&protocol.Chat{}, room.OnMessage)    //\n}\n\ntype Module struct {\n\t*module.Skeleton\n}\n\nfunc (m *Module) OnInit() {\n\tm.Skeleton = skeleton\n\troom.Init(&Creator{})\n}\n\nfunc (m *Module) OnDestroy() {\n\tglog.Errorln(\"OnDestroy\")\n}\n\ntype Creator struct{}\n\n// 对玩家未进入房间，或者没房间数据的处理\nfunc (this *Creator) Create(m interface{}) room.IRoom {\n\tif msg, ok := m.(*protocol.JoinRoom); ok {\n\t\tif len(msg.RoomNumber) == 0 {\n\t\t\tr := room.FindRoom()\n\t\t\treturn r\n\t\t}\n\t\tr := room.GetRoom(msg.RoomNumber)\n\t\tif r != nil {\n\t\t\treturn r\n\t\t}\n\t\troom := NewRoom(9, 5, 10, 1000, model.Timeout)\n\t\troom.Insert()\n\t\treturn room\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "src/server/game/internal/occupant.go",
    "content": "package internal\n\nimport (\n\t\"server/model\"\n\t\"github.com/dolotech/leaf/gate\"\n\t\"server/algorithm\"\n\t\"time\"\n\t\"errors\"\n\t\"github.com/dolotech/leaf/room\"\n)\n\ntype Occupant struct {\n\t*model.User\n\tgate.Agent\n\troom   room.IRoom\n\tcards  algorithm.Cards\n\tPos    uint8 // 玩家座位号，从1开始\n\tstatus int32 // 1为离线状态\n\n\tBet        uint32 // 当前下注\n\tactions    chan int32\n\twaitAction bool\n\n\tchips     uint32 // 带入的筹码\n\tHandValue      uint32\n}\n\nconst (\n\tOccupant_status_InGame  int32 = 3\n\tOccupant_status_Offline int32 = 1\n\tOccupant_status_Observe int32 = 2\n\tOccupant_status_Sitdown int32 = 0\n)\n\nfunc (o *Occupant) GetRoom() room.IRoom {\n\treturn o.room\n}\nfunc (o *Occupant) SetRoom(m room.IRoom) {\n\to.room = m\n}\nfunc (o *Occupant) SetAction(n int32)error {\n\tif o.waitAction {\n\t\to.actions <- n\n\t\treturn  nil\n\t}\n\treturn  errors.New(\"not your action\")\n}\nfunc (o *Occupant) GetAction(timeout time.Duration) int32 {\n\ttimer := time.NewTimer(timeout)\n\to.waitAction = true\n\tselect {\n\tcase n := <-o.actions:\n\t\ttimer.Stop()\n\t\to.waitAction = false\n\t\treturn n\n\tcase <-o.room.Closed():\n\t\ttimer.Stop()\n\t\to.waitAction = false\n\t\treturn -1\n\tcase <-timer.C:\n\t\to.waitAction = false\n\t\ttimer.Stop()\n\t\treturn -1 // 超时弃牌\n\t}\n}\nfunc (o *Occupant)SetPos(pos uint8)  {\n\t o.Pos = pos\n}\nfunc (o *Occupant) GetPos() uint8 {\n\treturn o.Pos\n}\nfunc (o *Occupant) GetUid() uint32 {\n\treturn  o.Uid\n}\nfunc (o *Occupant) WriteMsg(msg interface{}) {\n\tif o.status != Occupant_status_Offline {\n\t\to.Agent.WriteMsg(msg)\n\t}\n}\n\nfunc (o *Occupant) SetData(d interface{}) {\n\to.User = d.(*model.User)\n}\nfunc (o *Occupant) GetId() uint32 {\n\treturn o.Uid\n}\n\nfunc (o *Occupant) SetObserve() {\n\to.status = Occupant_status_Observe\n}\n\nfunc (o *Occupant) IsObserve() bool {\n\treturn o.status == Occupant_status_Observe\n}\n\nfunc (o *Occupant) SetOffline() {\n\to.status = Occupant_status_Offline\n}\n\nfunc (o *Occupant) IsOffline() bool {\n\treturn o.status == Occupant_status_Offline\n}\n\nfunc (o *Occupant) SetSitdown() {\n\to.status = Occupant_status_Sitdown\n}\n\nfunc (o *Occupant) IsSitdown() bool {\n\treturn o.status == Occupant_status_Sitdown\n}\n\nfunc (o *Occupant) SetGameing() {\n\to.status = Occupant_status_InGame\n}\n\nfunc (o *Occupant) IsGameing() bool {\n\treturn o.status == Occupant_status_InGame\n}\n\nfunc (o *Occupant) Replace(value *Occupant) {\n\to.Pos = value.Pos\n\to.cards = value.cards\n\to.room = value.room\n}\n\nfunc NewOccupant(data *model.User, conn gate.Agent) *Occupant {\n\to := &Occupant{\n\t\tUser:    data,\n\t\tAgent:   conn,\n\t\tactions: make(chan int32),\n\t}\n\treturn o\n}\n"
  },
  {
    "path": "src/server/game/internal/pot.go",
    "content": "package internal\n\nimport (\n\t\"sort\"\n)\n\ntype handBet struct {\n\tPos uint8\n\tBet uint32\n}\n\ntype handBets []handBet\n\nfunc (p handBets) Len() int {\n\treturn len(p)\n}\n\nfunc (p handBets) Less(i, j int) bool {\n\treturn p[i].Bet < p[j].Bet\n}\n\nfunc (p handBets) Swap(i, j int) {\n\tp[i], p[j] = p[j], p[i]\n}\n\ntype handPot struct {\n\tPot  uint32\n\tOPos []uint32\n}\n\n//因为每个人手中的筹码量会不时的产生变化，当出现多个筹码量不等的玩家“全下(ALL-IN)”争夺底池的时候就会出现多个奖池，\n//这时候底池将分出主池和边池，主池里的筹码可 由任何一位争夺者胜利后将其拿走，其后每个边池将分别由参与者按牌型大小分别拿走。\n//举个例子，假如发到河牌后共有三个人争夺底池，三人分别用ABC代替，\n//假设A玩家手中有60，B手中有80，C手中有100。三人ALL-IN后则先把每人的筹码划分成：\n//A玩家60；B玩家60+20；C玩家60+20+20，然后分出底池：\n//主池 由60乘以三个人(A+B+C)形成一个堆，总额为180；\n//边池一 由20乘以剩下的两个人(B+C)多出的部分为一个堆，总额为40；\n//边池二 由筹码最多者C的多出的部分20单独组成一个堆，总额为20。\n//现在三个底池形成了，然后分别按照牌型的大小来决定谁拿走哪个底池……\n//首先，主池可以由三人中的任何一人得到胜利都可以拿走；\n// 但是边池一的争夺就只能在B与C之间产生，两人谁赢谁拿走，与A无关(就算A玩家的牌最大也只能拿走他参与的主池)。\n//而最后剩下的边池二不论三人谁输谁赢都只能由C拿走，因为边池二里的筹码只有C自己参与了，与其他人无关。\nfunc calcPot(bets []uint32) (pots []handPot) {\n\tvar obs handBets\n\tfor i, bet := range bets {\n\t\tif bet > 0 {\n\t\t\tobs = append(obs, handBet{Pos: uint8(i) + 1, Bet: bet})\n\t\t}\n\t}\n\tsort.Sort(obs)\n\n\tfor i, ob := range obs {\n\t\tif ob.Bet > 0 {\n\t\t\ts := obs[i:]\n\t\t\thpot := handPot{Pot: ob.Bet * uint32(len(s))}\n\t\t\tfor j, _ := range s {\n\t\t\t\ts[j].Bet -= ob.Bet\n\t\t\t\thpot.OPos = append(hpot.OPos, uint32(s[j].Pos))\n\t\t\t}\n\t\t\tpots = append(pots, hpot)\n\t\t}\n\t}\n\treturn\n}\n"
  },
  {
    "path": "src/server/game/internal/pot_test.go",
    "content": "package internal\n\nimport \"testing\"\n\nfunc Test_Pot(t *testing.T)  {\n\tbets := []uint32{60,80,90,0,0,0,0,0,0}\n\tres:=calcPot(bets)\n\t//[{180 [1 2 3]} {40 [2 3]} {10 [3]}]\n\tt.Log(res)\n\n\n\tbets = []uint32{60,60,60,0,0,0,0,0,0}\n\tres=calcPot(bets)\n\t//[{180 [1 2 3]}]\n\tt.Log(res)\n\n\ta:= []byte{}\n\n\ta = nil\n\tt.Log(len(a))\n\n}\n"
  },
  {
    "path": "src/server/game/internal/room.go",
    "content": "package internal\n\nimport (\n\t\"server/model\"\n\t\"server/protocol\"\n\t\"server/algorithm\"\n\t\"time\"\n\t\"github.com/dolotech/leaf/room\"\n\t\"github.com/golang/glog\"\n)\n\nconst (\n\tRUNNING  uint8= 1\n\tGAMEOVER uint8= 0\n)\n\ntype Room struct {\n\t*model.Room\n\t*room.MsgLoop\n\t*room.Log\n\tOccupants   []*Occupant\n\tobserves    []*Occupant // 站起的玩家\n\tAutoSitdown []*Occupant // 自动坐下队列\n\n\tremain int\n\tallin  int\n\tn      uint8\n\tstatus uint8\n\n\tSB       uint32          // 小盲注\n\tBB       uint32          // 大盲注\n\tCards    algorithm.Cards // 公共牌\n\tPot      []uint32        // 奖池筹码数, 第一项为主池，其他项(若存在)为边池\n\tTimeout  time.Duration   // 倒计时超时时间(秒)\n\tButton   uint8           // 当前庄家座位号，从1开始\n\tChips    []uint32        // 玩家本局下注的总筹码数，与occupants一一对应\n\tBet      uint32          // 当前回合 上一玩家下注额\n\tMax      uint8           // 房间最大玩家人数\n\tMaxChips uint32\n\tMinChips uint32\n}\n\nfunc NewRoom(max uint8, sb, bb uint32, chips uint32, timeout uint8) *Room {\n\tif max <= 0 || max > 9 {\n\t\tmax = 9 // default 9 Occupants\n\t}\n\n\tr := &Room{\n\t\tRoom:      &model.Room{DraginChips: chips,},\n\t\tMsgLoop:   room.NewMsgLoop(),\n\t\tChips:     make([]uint32, max),\n\t\tOccupants: make([]*Occupant, max),\n\t\tPot:       make([]uint32, 0, max),\n\t\tTimeout:   time.Second * time.Duration(timeout),\n\t\tSB:        sb,\n\t\tBB:        bb,\n\t\tMax:       max,\n\t}\n\n\tr.Log = room.NewLog(r)\n\tr.Regist(&protocol.JoinRoom{}, r.joinRoom)\n\tr.Regist(&protocol.LeaveRoom{}, r.leaveRoom)\n\tr.Regist(&protocol.Bet{}, r.bet)\n\tr.Regist(&protocol.SitDown{}, r.sitDown) //\n\tr.Regist(&protocol.StandUp{}, r.standUp) //\n\tr.Regist(&protocol.Chat{}, r.chat)       //\n\tr.Regist(&protocol.Chat{}, r.chat)       //\n\tr.Regist(&startDelay{}, r.startDelay)    //\n\n\treturn r\n}\n\ntype startDelay struct {\n\tkind uint8\n}\n\nfunc (r *Room) New(m interface{}) room.IRoom {\n\tglog.Errorln(r, m)\n\tif msg, ok := m.(*protocol.JoinRoom); ok {\n\t\tif len(msg.RoomNumber) == 0 {\n\t\t\tr := room.FindRoom()\n\t\t\treturn r\n\t\t}\n\t\tr := room.GetRoom(msg.RoomNumber)\n\t\tif r != nil {\n\t\t\treturn r\n\t\t}\n\t\troom := NewRoom(9, 5, 10, 1000, model.Timeout)\n\t\troom.Insert()\n\t\treturn room\n\t}\n\treturn nil\n}\n\nfunc (r *Room) WriteMsg(msg interface{}, exc ...uint32) {\n\tfor _, v := range r.Occupants {\n\t\tif v != nil {\n\t\t\tfor _, uid := range exc {\n\t\t\t\tif uid == v.GetUid() {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\t}\n\t\t\tv.WriteMsg(msg)\n\t\t}\n\tEnd:\n\t}\n}\n\nfunc (r *Room) Broadcast(msg interface{}, all bool, exc ...uint32) {\n\tfor _, v := range r.Occupants {\n\t\tif v != nil && (all || !v.IsGameing()) {\n\t\t\tfor _, uid := range exc {\n\t\t\t\tif uid == v.GetUid() {\n\t\t\t\t\tgoto End1\n\t\t\t\t}\n\t\t\t}\n\t\t\tv.WriteMsg(msg)\n\t\t}\n\tEnd1:\n\t}\n\tfor _, v := range r.observes {\n\t\tif v != nil {\n\t\t\tfor _, uid := range exc {\n\t\t\t\tif uid == v.Uid {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\t}\n\t\t\tv.WriteMsg(msg)\n\t\t}\n\tEnd:\n\t}\n}\n\nfunc (r *Room) addOccupant(o *Occupant) uint8 {\n\tfor _, v := range r.Occupants {\n\t\tif v != nil && v.GetUid() == o.Uid {\n\t\t\treturn 0\n\t\t}\n\t}\n\n\tfor k, v := range r.Occupants {\n\t\tif v == nil {\n\t\t\tr.Occupants[k] = o\n\t\t\to.SetRoom(r)\n\t\t\to.Pos = uint8(k + 1)\n\t\t\to.SetSitdown()\n\t\t\treturn o.Pos\n\t\t}\n\t}\n\treturn 0\n}\n\nfunc (r *Room) removeOccupant(o *Occupant) uint8 {\n\tfor k, v := range r.Occupants {\n\t\tif v != nil && v.GetUid() == o.Uid {\n\t\t\tv.SetPos(0)\n\t\t\tr.Occupants[k] = nil\n\t\t\treturn uint8(k + 1)\n\t\t}\n\t}\n\treturn 0\n}\n\nfunc (r *Room) addObserve(o *Occupant) uint8 {\n\tfor _, v := range r.observes {\n\t\tif v != nil && v.Uid == o.Uid {\n\t\t\treturn 0\n\t\t}\n\t}\n\to.SetObserve()\n\tr.observes = append(r.observes, o)\n\n\treturn 0\n}\n\nfunc (r *Room) removeObserve(o *Occupant) {\n\tfor k, v := range r.observes {\n\t\tif v != nil && v.Uid == o.Uid {\n\t\t\tr.observes = append(r.observes[:k], r.observes[k+1:]...)\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// start starts from 0\nfunc (r *Room) Each(start uint8, f func(o *Occupant) bool) {\n\tvolume := r.Cap()\n\tend := (volume + start - 1) % volume\n\ti := start\n\tfor ; i != end; i = (i + 1) % volume {\n\t\tif r.Occupants[i] != nil && r.Occupants[i].IsGameing() && !f(r.Occupants[i]) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// end\n\tif r.Occupants[i] != nil && r.Occupants[i].IsGameing() {\n\t\tf(r.Occupants[i])\n\t}\n}\n\nfunc (r *Room) Cap() uint8 {\n\treturn r.Max\n}\nfunc (r *Room) Len() uint8 {\n\tvar num uint8\n\tfor _, v := range r.Occupants {\n\t\tif v != nil {\n\t\t\tnum ++\n\t\t}\n\t}\n\treturn num\n}\n\nfunc (r *Room) GetNumber() string {\n\treturn r.Number\n}\nfunc (r *Room) SetNumber(value string) {\n\tr.Number = value\n}\n\nfunc (r *Room) Data() interface{} { return r.Room }\nfunc (r *Room) SetData(d interface{}) {\n\tr.Room = d.(*model.Room)\n}\n"
  },
  {
    "path": "src/server/game/internal/room_internal_handler.go",
    "content": "package internal\n\nimport (\n\t\"server/protocol\"\n\t\"github.com/golang/glog\"\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"time\"\n\t\"github.com/dolotech/lib/utils\"\n)\n\nfunc (r *Room) joinRoom(m *protocol.JoinRoom, o *Occupant) {\n\tif o.room != nil {\n\t\tfor k, v := range r.Occupants {\n\t\t\tglog.Infoln(v, o)\n\t\t\tif v.Uid == o.Uid {\n\t\t\t\t// todo 掉线重连现场数据替换处理\n\t\t\t\to.Replace(r.Occupants[k])\n\t\t\t\tr.Occupants[k] = o\n\n\t\t\t\tif o != v {\n\t\t\t\t\tv.Close()\n\t\t\t\t\tglog.Infoln(\"掉线重连处理\")\n\t\t\t\t} else {\n\t\t\t\t\tglog.Infoln(\"同一个链接重复请求加入房间\")\n\t\t\t\t}\n\n\t\t\t\tr.WriteMsg(&protocol.UserInfo{Uid: o.Uid}, o.Uid)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\trinfo := &protocol.RoomInfo{\n\t\tNumber: r.Number,\n\t}\n\tuserinfos := make([]*protocol.UserInfo, 0, r.Cap())\n\tr.Each(0, func(o *Occupant) bool {\n\t\tuserinfo := &protocol.UserInfo{\n\t\t\tNickname: o.Nickname,\n\t\t\tUid:      o.Uid,\n\t\t\tAccount:  o.Account,\n\t\t\tSex:      o.Sex,\n\t\t\tProfile:  o.Profile,\n\t\t\tChips:    o.chips,\n\t\t}\n\t\tuserinfos = append(userinfos, userinfo)\n\t\treturn true\n\t})\n\n\tpos := r.addOccupant(o)\n\n\t// 坐下失败转为旁观\n\tif pos == 0 {\n\t\tr.addObserve(o)\n\t} else {\n\t\tuserInfo := &protocol.UserInfo{\n\t\t\tNickname: o.Nickname,\n\t\t\tUid:      o.Uid,\n\t\t\tAccount:  o.Account,\n\t\t\tSex:      o.Sex,\n\t\t\tProfile:  o.Profile,\n\t\t\tChips:    o.chips,\n\t\t}\n\t\tr.Broadcast(&protocol.JoinRoomBroadcast{UserInfo: userInfo}, true, o.Uid)\n\t}\n\n\to.RoomID = r.Number\n\to.UpdateRoomId()\n\n\to.WriteMsg(&protocol.JoinRoomResp{UserInfos: userinfos, RoomInfo: rinfo})\n\n\n\ttime.AfterFunc(time.Second*2, func() {\n\t\tdefer utils.PrintPanicStack()\n\t\tr.Send(o,&startDelay{})\n\t})\n\tr.Debug(\"joinRoom\", spew.Sdump(m))\n}\n\nfunc (r *Room) leaveAndRecycleChips(o *Occupant) {\n\tif r.removeOccupant(o) > 0 {\n\t\t// 玩家站起回收带入筹码\n\t\tgap := int32(o.chips) - int32(r.DraginChips)\n\t\tif gap == 0 {\n\t\t\to.UpdateChips(gap)\n\t\t}\n\t}\n}\nfunc (r *Room) leaveRoom(m *protocol.LeaveRoom, o *Occupant) {\n\n\tr.removeObserve(o)\n\tr.removeOccupant(o)\n\tr.leaveAndRecycleChips(o)\n\n\to.RoomID = \"\"\n\to.room = nil\n\to.UpdateRoomId()\n\n\tleave := &protocol.LeaveRoom{\n\t\tRoomNumber: r.Number,\n\t\tUid:        o.Uid,\n\t}\n\tr.Broadcast(leave, true)\n\n\tr.Debug()\n\n\t// 房间里没有玩家时关闭并从列表中删除\n\tif r.Len() == 0 {\n\t\tr.Close(r)\n\t}\n\tglog.Errorln(\"leaveRoom\", m)\n}\n\nfunc (r *Room) bet(m *protocol.Bet, o *Occupant) {\n\tif !o.IsGameing() {\n\t\to.WriteMsg(protocol.MSG_NOT_NOT_START)\n\t\treturn\n\t}\n\n\tif m.Value < 0 {\n\t\terr := o.SetAction(-1)\n\t\tif err != nil {\n\t\t\to.WriteMsg(protocol.MSG_NOT_TURN)\n\t\t}\n\n\t} else {\n\t\terr := o.SetAction(m.Value)\n\t\tif err != nil {\n\t\t\to.WriteMsg(protocol.MSG_NOT_TURN)\n\t\t}\n\t}\n\n\tglog.Errorln(\"bet\", m)\n}\n\nfunc (r *Room) sitDown(m *protocol.SitDown, o *Occupant) {\n\tpos := r.addOccupant(o)\n\tif pos == 0 {\n\t\t// 给进入房间的玩家带入筹码\n\t\to.chips = r.DraginChips\n\t\tr.addObserve(o)\n\t} else {\n\n\t}\n\tr.Broadcast(&protocol.SitDown{Uid: o.Uid, Pos: o.Pos}, true)\n\n\tglog.Errorln(\"sitDown\", m)\n}\n\nfunc (r *Room) standUp(m *protocol.StandUp, o *Occupant) {\n\n\to.SetAction(-1)\n\tr.leaveAndRecycleChips(o)\n\n\tr.addObserve(o)\n\tr.Broadcast(&protocol.StandUp{Uid: o.Uid}, true)\n\n\tglog.Errorln(\"standUp\", m)\n}\n\nfunc (r *Room) chat(m *protocol.Chat, o *Occupant) {\n\tr.Broadcast(m, true)\n}\n"
  },
  {
    "path": "src/server/game/internal/room_test.go",
    "content": "package internal\n\nimport (\n\t\"testing\"\n\t\"time\"\n\t\"reflect\"\n)\n\nfunc TestRoom_Value(t *testing.T) {\n\tt.Log(reflect.ValueOf(12))\n}\nfunc TestRoom_RecvMsg(t *testing.T) {\n\n\t/*room:= NewRoom(&model.Room{})\n\n\n\tprotocol:= &msg2.JoinRoom{RoomNumber:\"9999\"}\n\n\n\troom.Send(12,protocol)\n\n*/\n\t//msg1:= &msg2.LeaveRoom{RoomNumber:\"9999\"}\n\t//room.RecvMsg(12,msg1)\n\n\ttime.Sleep(time.Second * 2)\n}\nfunc TestClose(t *testing.T) {\n\n\tc:= make(chan struct{},1)\n\n\n\tgo func() {\n\t\tselect {\n\t\tcase <-c:\n\t\tdefault:\n\t\t\tt.Log(\"default\")\n\t\t}\n\t}()\n\t<- time.After(time.Second)\n\tclose(c)\n\n\tselect {\n\t\tcase c<- struct{}{}:\n\tdefault:\n\t\tt.Log(\"default\")\n\t}\n\n\t<- time.After(time.Second)\n\n}\nfunc BenchmarkCloseRoom(t *testing.B) {\n\n\t/*\n\n\t\tfor i:=0;i<t.N;i++{\n\t\t\troom:= NewRoom(&model.Room{})\n\n\n\n\t\t\tgo room.Close()\n\t\t\tgo room.SendMsg(111)\n\t\t}\n\n\t\tt.Log(\"adfasdfads\")\n\n\t\t<- time.After(time.Minute)*/\n\n\t//room.CloseChan <- struct{}{}\n\t//t.Log(Cap(room.CloseChan))\n}\n"
  },
  {
    "path": "src/server/gate/external.go",
    "content": "package gate\n\nimport (\n\t\"server/gate/internal\"\n)\n\nvar (\n\tModule = new(internal.Module)\n)\n"
  },
  {
    "path": "src/server/gate/internal/module.go",
    "content": "package internal\n\nimport (\n\t\"github.com/dolotech/leaf/gate\"\n\t\"server/conf\"\n\t\"server/game\"\n\t\"server/protocol\"\n\t\"github.com/golang/glog\"\n)\n\ntype Module struct {\n\t*gate.Gate\n}\n\nfunc (m *Module) OnInit() {\n\tm.Gate = &gate.Gate{\n\t\tMaxConnNum:      conf.Server.MaxConnNum,\n\t\tPendingWriteNum: conf.PendingWriteNum,\n\t\tMaxMsgLen:       conf.MaxMsgLen,\n\t\tWSAddr:          conf.Server.WSAddr,\n\t\tHTTPTimeout:     conf.HTTPTimeout,\n\t\tCertFile:        conf.Server.CertFile,\n\t\tKeyFile:         conf.Server.KeyFile,\n\t\tTCPAddr:         conf.Server.TCPAddr,\n\t\tLenMsgLen:       conf.LenMsgLen,\n\t\tLittleEndian:    conf.LittleEndian,\n\t\tProcessor:       protocol.Processor,\n\t\tAgentChanRPC:    game.ChanRPC,\n\t}\n}\nfunc (gate *Module) OnDestroy() {\n\tglog.Errorln(\"OnDestroy\")\n}\n\n\n"
  },
  {
    "path": "src/server/gate/router.go",
    "content": "package gate\n\nimport (\n\t\"server/protocol\"\n\t\"server/game\"\n\t\"server/login\"\n)\n\nfunc init() {\n\tprotocol.Processor.SetRouter(&protocol.UserLoginInfo{}, login.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.Version{}, login.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.RoomList{}, login.ChanRPC)\n\n\tprotocol.Processor.SetRouter(&protocol.JoinRoom{}, game.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.LeaveRoom{}, game.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.SitDown{}, game.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.StandUp{}, game.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.Bet{}, game.ChanRPC)\n\tprotocol.Processor.SetRouter(&protocol.Chat{}, game.ChanRPC)\n}\n"
  },
  {
    "path": "src/server/login/external.go",
    "content": "package login\n\nimport (\n\t\"server/login/internal\"\n)\n\nvar (\n\tModule  = new(internal.Module)\n\tChanRPC = internal.ChanRPC\n)\n"
  },
  {
    "path": "src/server/login/internal/handler.go",
    "content": "package internal\n\nimport (\n\t\"reflect\"\n\t\"server/protocol\"\n\t\"github.com/dolotech/leaf/gate\"\n\t\"server/game\"\n\t\"github.com/golang/glog\"\n\t\"server/model\"\n\t\"github.com/dolotech/leaf/room\"\n)\n\nfunc init() {\n\thandler(&protocol.UserLoginInfo{}, handlLoginUser)\n\thandler(&protocol.Version{}, handlVersion)\n\thandler(&protocol.RoomList{}, onRoomList) //\n}\n\nfunc handler(m interface{}, h interface{}) {\n\tskeleton.RegisterChanRPC(reflect.TypeOf(m), h)\n}\n\nfunc handlVersion(m *protocol.Version, a gate.Agent) {\n\tglog.Infoln(m)\n\ta.WriteMsg(m)\n}\n\nfunc handlLoginUser(m *protocol.UserLoginInfo, a gate.Agent) {\n\tuser := &model.User{UnionId: m.UnionId}\n\texist, err := user.GetByUnionId()\n\tif err != nil {\n\t\ta.WriteMsg(protocol.MSG_DB_Error)\n\t\treturn\n\t}\n\n\tif !exist {\n\t\tuser = &model.User{Nickname: m.Nickname,\n\t\t\tUnionId: m.UnionId}\n\t\terr := user.Insert()\n\t\tif err != nil {\n\t\t\ta.WriteMsg(protocol.MSG_User_Not_Exist)\n\t\t\treturn\n\t\t}\n\t}\n\n\tresp := &protocol.UserLoginInfoResp{\n\t\tNickname: user.Nickname,\n\t\tAccount:  user.Account,\n\t\tUnionId:  user.UnionId,\n\t}\n\n\ta.WriteMsg(resp)\n\tgame.ChanRPC.Go(model.Agent_Login, user, a)\n}\n\nfunc onRoomList(m *protocol.RoomList, a gate.Agent) {\n\n\tmsg := &protocol.RoomListResp{}\n\n\tarray := room.GetRooms()\n\trooms := make([]*protocol.Room, len(array))\n\n\tfor k, v := range array {\n\t\td := v.Data()\n\t\tdata := d.(*model.Room)\n\t\trooms[k] = &protocol.Room{\n\n\t\t\tNumber:      data.Number,\n\t\t\tMaxCap:      v.Cap(),\n\t\t\tCap:         v.Len(),\n\t\t\tDraginChips: data.DraginChips,\n\t\t\tCreatedAt:   data.CreatedTime(),\n\t\t\tRid:         data.Rid,\n\t\t}\n\t}\n\tmsg.Room = rooms\n\ta.WriteMsg(msg)\n}\n"
  },
  {
    "path": "src/server/login/internal/module.go",
    "content": "package internal\n\nimport (\n\t\"github.com/dolotech/leaf/module\"\n\t\"server/base\"\n)\n\nvar (\n\tskeleton = base.NewSkeleton()\n\tChanRPC  = skeleton.ChanRPCServer\n)\n\ntype Module struct {\n\t*module.Skeleton\n}\n\nfunc (m *Module) OnInit() {\n\tm.Skeleton = skeleton\n}\n\nfunc (m *Module) OnDestroy() {\n\n}\n"
  },
  {
    "path": "src/server/model/constan.go",
    "content": "package model\n\nconst (\n\tMaxN     = 10\n\tMaxLevel = 40\n\tTimeout  = 10 // 下注超时\n)\n\nconst (\n\tAgent_Login = \"LoginAgent\" // 登录\n\tAgent_New   = \"NewAgent\"   // 新建链接\n\tAgent_Close = \"CloseAgent\" //链接关闭\n)\n\nconst (\n\tBET_CALL  = \"call\"  //跟注：等于单注额 (call)\n\tBET_FOLD  = \"fold\"  //弃牌: <0 (fold)\n\tBET_CHECK = \"check\" //看注：= 0 表示看注 (check)\n\tBET_RAISE = \"raise\" //加注：大于单注额 (raise)\n\tBET_ALLIN = \"allin\" //全押：等于玩家手中所有筹码 (allin)\n)\n"
  },
  {
    "path": "src/server/model/room_data.go",
    "content": "package model\n\nimport (\n\t\"time\"\n\t\"github.com/dolotech/lib/db\"\n)\n\n//房间基本信息\n\ntype Room struct {\n\tRid             uint32    `xorm:\"'rid' pk autoincr BIGINT\"`\n\tNumber          string    `xorm:\"'number' index not null VARCHAR(8)\"` // 给玩家展示的房间号\n\tPwd             string    `xorm:\"'pwd' VARCHAR(16)\"`                  //房间锁--密码\n\tState           uint8     `xorm:\"'state' smallint\"`                   //房间状态 0默认可用 1不可用\n\tName            string    `xorm:\"'name' VARCHAR(16)\"`                 //房间名字\n\tCreatedAt       time.Time `xorm:\"'created_at' index  created\"`        //创建时间\n\tOriginalOwnerID uint32    `xorm:\"'original_owner_id'\"`                //原始创建人的信息\n\tOwner           uint32    `xorm:\"'owner'\"`                            //房管\n\tKind            uint32    `xorm:\"'kind'\"`                             //游戏类型 即玩法\n\tDraginChips     uint32    `xorm:\"'dragin_chips'\"`                     //带入筹码\n\n\t//Occupants       []*uint32 `xorm:\"'occupants'\"`                        // 玩家列表，列表第一项为庄家\n}\n\nfunc (u *Room) Insert() (int64, error) {\n\treturn db.C().Engine().InsertOne(u)\n}\n\nfunc (this *Room) GetById() (bool, error) {\n\treturn db.C().Engine().Where(\"uid = ?\", this.Rid).Get(this)\n}\n\n\nfunc (r *Room) CreatedTime() uint32 {\n\treturn uint32(r.CreatedAt.Unix())\n}"
  },
  {
    "path": "src/server/model/room_data_test.go",
    "content": "package model\n\nimport (\n\t\"testing\"\n\t\"github.com/dolotech/lib/db\"\n)\n\nfunc init() {\n\tdb.Init(\"postgres://postgres:haosql@127.0.0.1:5432/postgres?sslmode=disable\")\n}\n\nfunc TestUser_UpdateChips(t *testing.T) {\n\troom := &Room{\n\t}\n\n\tt.Log(room.Insert())\n\n\troom = &Room{Rid: 5}\n\n\n\tid,err:= room.GetById()\n\n\tt.Log(room.CreatedAt)\n\tt.Logf(\"%v %v %#+v\",id,err, room)\n}\n"
  },
  {
    "path": "src/server/model/room_list_test.go",
    "content": "package model\n\nimport (\n\t\"testing\"\n\t\"time\"\n)\n\nfunc BenchmarkCreateNumber(b *testing.B) {\n\tfor i:=0;i<b.N;i++{\n\n\t\tb.Log(createNumber())\n\t}\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunc Benchmark_map(b *testing.B) {\n\tm:= make(map[int]int)\n\tfor i:=0;i<b.N;i++{\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\tif err:=recover();err!=nil{\n\t\t\t\t\tb.Log(err)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tm[i] = i\n\t\t}()\n\t}\n\n\n\t<-time.After(time.Minute)\n}"
  },
  {
    "path": "src/server/model/user_data.go",
    "content": "package model\n\nimport (\n\t\"fmt\"\n\t\"github.com/golang/glog\"\n\t\"time\"\n\t\"github.com/dolotech/lib/db\"\n\t\"github.com/dolotech/lib/utils\"\n\t\"math/rand\"\n)\n\nfunc (this *User) GetById() (bool, error) {\n\treturn db.C().Engine().Where(\"uid = ?\", this.Uid).Get(this)\n}\n\nfunc (this *User) GetByAccount() (bool, error) {\n\treturn db.C().Engine().Where(\"account = ?\", this.Account).Get(this)\n}\n\nfunc (this *User) GetByUnionId() (bool, error) {\n\treturn db.C().Engine().Where(\"union_id = ?\", this.UnionId).Get(this)\n}\n\ntype User struct {\n\tUid        uint32    `xorm:\"'uid' pk autoincr BIGINT\"`            // 用户id\n\tAccount    string    `xorm:\"'account' index unique  VARCHAR(16)\"` // 客户端玩家展示的账号\n\tDeviceId   string    `xorm:\"'device_id' VARCHAR(32)\"`             // 设备id\n\tUnionId    string    `xorm:\"'union_id' VARCHAR(32)\"`              // 微信联合id\n\tNickname   string    `xorm:\"'nickname' VARCHAR(32)\"`              // 微信昵称\n\tSex        uint8     `xorm:\"'sex' smallint\"`                      // 微信性别 0-未知，1-男，2-女\n\tProfile    string    `xorm:\"'profile' VARCHAR(64)\"`               // 微信头像\n\tInvitecode string    `xorm:\"'invitecode' VARCHAR(6)\"`             // 绑定的邀请码\n\tCoin       uint32    `xorm:\"'coin'\"`                              // 筹码\n\tLv         uint8     `xorm:\"'lv' smallint\"`                       // 等级\n\tCreatedAt  time.Time `xorm:\"'created_at' index  created\"`         // 注册时间\n\tLastTime   time.Time `xorm:\"'last_time'\"`                         // 上次登录时间\n\tLastIp     uint32    `xorm:\"'last_ip' BIGINT\"`                    // 最后登录ip\n\tKind       uint8     `xorm:\"'kind'  not null smallint\"`           // 用户类型\n\tDisable    bool      `xorm:\"'disable'\"`                           // 是否禁用\n\tSignature  string    `xorm:\"'signature' VARCHAR(64)\"`             // 个性签名\n\tGps        string    `xorm:\"'gps' VARCHAR(32)\"`                   // gps定位数据\n\tBlack      bool      `xorm:\"'black'\"`                             // 黑名单列表\n\tRoomID     string    `xorm:\"'room_id'\"`                           // 当前所在房间号，0表示不在房间,用于掉线重连\n}\n\nfunc (u *User) Insert() error {\n\t_, err := db.C().Engine().InsertOne(u)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t\treturn err\n\t}\n\n\tn := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(9999-1000) + 1000\n\n\taccount := fmt.Sprintf(\"%v%v\", u.Uid, n)\n\tsql := `UPDATE public.user SET account =$1 WHERE uid = $2 `\n\t_, err = db.C().Engine().Exec(sql, account, u.Uid)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t\treturn err\n\t}\n\tglog.Errorln(u)\n\treturn nil\n}\nfunc (u *User) UpdateChips(value int32) error {\n\t_, err := db.C().Engine().Exec(`UPDATE public.user SET\n\t\tchips = chips + $1 WHERE uid =$2 `, value, u.Uid)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t}\n\n\treturn err\n\t//s:=db.C().Engine().Table(u).Incr(\"chips\",value)\n\t//return nil\n}\n\nfunc (u *User) UpdateLogin(ip string) error {\n\tsql := `UPDATE public.user SET\n\tlast_time =  $1 ,last_ip =  $2 WHERE uid = $3 `\n\t_, err := db.C().Engine().Exec(sql, time.Now(), utils.InetToaton(ip), u.Uid)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t}\n\treturn err\n}\n\nfunc (u *User) UpdateRoomId() error {\n\tsql := `UPDATE public.user SET\n\troom_id =  $1 WHERE uid = $2 `\n\t_, err := db.C().Engine().Exec(sql, u.RoomID, u.Uid)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t}\n\treturn err\n}\n"
  },
  {
    "path": "src/server/model/user_data_test.go",
    "content": "package model\n\nimport (\n\t\"testing\"\n\t\"time\"\n\t\"math/rand\"\n)\n\nfunc TestUser_UpdateChips2(t *testing.T) {\n\tuser:= &User{Uid:35}\n\tt.Log(user.UpdateChips(100),user)\n}\n\nfunc TestUser_Insert(t *testing.T) {\n\tuser:= &User{Nickname:\"Michael\",UnionId:\"aaasdfasd\"}\n\tt.Log(user.Insert(),user)\n}\n\nfunc BenchmarkUser_Insert(b *testing.B) {\n\tr:=rand.New(rand.NewSource(time.Now().UnixNano()))\n\tfor i:=0;i<b.N;i++{\n\t\tn:=r.Int31n(9999 -1000) +1000\n\t\t//n:=time.Now().Format(\"0102\") + \"123\"\n\t\tb.Log(n)\n\t}\n}\n\nfunc TestUserData_Login(t *testing.T) {\n\n\tn:=rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(9999 -1000) +1000\n\t//n:=time.Now().Format(\"0102\") + \"123\"\n\tt.Log(n)\n}\nfunc TestSeq(t *testing.T) {\n\n}\n"
  },
  {
    "path": "src/server/protocol/protocol.go",
    "content": "package protocol\n\nimport (\n\t//\"github.com/dolotech/leaf/network/protobuf\"\n\t\"github.com/dolotech/leaf/network/json\"\n)\n\nvar Processor = json.NewProcessor()\n\nvar (\n\t// 用户数据\n\tMSG_SUCCESS          = &CodeState{Code: 0, Message: \"success\"}        //注册成功\n\tMSG_Register_Existed = &CodeState{Code: 1, Message: \"existed user\"}   //注册用户已存在\n\tMSG_Login_Error      = &CodeState{Code: 2, Message: \"login fail\"}     //登录失败 信息错误\n\tMSG_Version_Error    = &CodeState{Code: 3, Message: \"version wrong\"}  //版本号不对\n\tMSG_User_Not_Exist   = &CodeState{Code: 4, Message: \"user not exist\"} //用户不存在\n\tMSG_DB_Error         = &CodeState{Code: 111, Message: \"db error\"}     //数据库出错\n\n\t//房间错误信息 1000开始标记\n\tMSG_ROOM_NOTAUTH    = &CodeState{Code: 1001, Message: \"Unauthorized\"}     //没有权限\n\tMSG_ROOM_ERRORPWD   = &CodeState{Code: 1002, Message: \"pwd wrong\"}        //密码错误\n\tMSG_ROOM_OVERVOLUME = &CodeState{Code: 1003, Message: \"aleady in room\"}   //你已经在其他房间了 拒绝加入其他房间\n\tMSG_ROOM_NOMONEY    = &CodeState{Code: 1004, Message: \"not enough money\"} //起始资金不够\n\tMSG_ROOM_NOTEMPTY   = &CodeState{Code: 1005, Message: \"room not empty\"}   //房子不空\n\tMSG_ROOM_NOROOM     = &CodeState{Code: 1006, Message: \"no room\"}          //没有该房子记录\n\tMSG_ROOM_FULL       = &CodeState{Code: 1007, Message: \"room full\"}        // 房间已满\n\tMSG_NOT_IN_ROOM     = &CodeState{Code: 1008, Message: \"not in room\"}      // 你不在房间\n\tMSG_ROOM_CLOSED     = &CodeState{Code: 1009, Message: \"room closed\"}      // 房间已经关闭\n\tMSG_NOT_TURN        = &CodeState{Code: 1010, Message: \"not your turn\"}    // 没轮到你下注\n\tMSG_NOT_NOT_START   = &CodeState{Code: 1011, Message: \"game not start\"}   // 游戏未开始不能下注\n)\n\nfunc init() {\n\tProcessor.Register(&Hello{})\n\tProcessor.Register(&UserLoginInfo{})\n\tProcessor.Register(&UserLoginInfoResp{})\n\n\tProcessor.Register(&CodeState{})\n\tProcessor.Register(&Version{})\n\n\t//房间会话注册\n\tProcessor.Register(&RoomInfo{})  //基本信息\n\tProcessor.Register(&JoinRoom{})  //\n\tProcessor.Register(&LeaveRoom{}) //\n\n\tProcessor.Register(&Showdown{})\n\tProcessor.Register(&PreFlop{})\n\tProcessor.Register(&Pot{})\n\tProcessor.Register(&Bet{})\n\tProcessor.Register(&Button{})\n\tProcessor.Register(&StandUp{})\n\tProcessor.Register(&SitDown{})\n\tProcessor.Register(&UserInfo{})\n\tProcessor.Register(&JoinRoomResp{})\n\tProcessor.Register(&JoinRoomBroadcast{})\n\tProcessor.Register(&BetResp{})\n\tProcessor.Register(&RoomList{})\n\tProcessor.Register(&RoomListResp{})\n\tProcessor.Register(&Chat{})\n}\n\n// 版本号\ntype Version struct {\n\tVersion string\n}\n\ntype CodeState struct {\n\tCode    int    // const\n\tMessage string //警告信息\n}\n\ntype Hello struct {\n\tName string\n}\n\n//登录\ntype UserLoginInfo struct {\n\tUnionId  string\n\tNickname string\n}\n\n//登录\ntype UserLoginInfoResp struct {\n\tUnionId  string\n\tUid      uint32 // 用户id\n\tAccount  string // 客户端玩家展示的账号\n\tNickname string // 微信昵称\n\tSex      uint8  // 微信性别 0-未知，1-男，2-女\n\tProfile  string // 微信头像\n\tChips    uint32 // 筹码\n}\n\ntype UserInfo struct {\n\tUid      uint32 // 用户id\n\tAccount  string // 客户端玩家展示的账号\n\tNickname string // 微信昵称\n\tSex      uint8  // 微信性别 0-未知，1-男，2-女\n\tProfile  string // 微信头像\n\tChips    uint32 // 筹码\n}\n\ntype RoomInfo struct {\n\tNumber    string\n\tVolume    uint8\n\tGameType  uint32 //游戏类型 即玩法\n\tPayValue  uint8  //倍数\n\tBaseMoney uint32 //最低资本 才能进房间\n\tRoomPwd   string //房间锁--密码\n\tRoomID    uint32\n\n\tSB       uint32   // 小盲注\n\tBB       uint32   // 大盲注\n\tCards    []byte   //公共牌\n\tPot      []uint32 // 当前奖池筹码数\n\tTimeout  uint8    // 倒计时超时时间(秒)\n\tButton   uint8    // 当前庄家座位号，从1开始\n\tChips    []uint32 // 玩家本局下注的总筹码数，与occupants一一对应\n\tBet      uint32   // 当前下注额\n\tMax      uint8    // 房间最大玩家人数\n\tMaxChips uint32\n\tMinChips uint32\n}\n\ntype StandUp struct {\n\tUid uint32\n}\n\ntype SitDown struct {\n\tUid uint32\n\tPos uint8\n}\n\ntype LeaveRoom struct {\n\tRoomNumber string\n\tUid        uint32\n}\n\ntype JoinRoom struct {\n\tUid        uint32\n\tRoomNumber string\n\tRoomPwd    string\n}\n\ntype JoinRoomBroadcast struct {\n\tUserInfo *UserInfo\n}\n\ntype JoinRoomResp struct {\n\tUserInfos []*UserInfo\n\tRoomInfo  *RoomInfo\n}\n\n//底牌\ntype PreFlop struct {\n\tCards []byte\n\tKind  uint8\n}\n\n// 翻牌\ntype Flop struct {\n\tCards []byte\n\tKind  uint8\n}\n\n// 转牌\ntype Turn struct {\n\tCard byte\n\tKind uint8\n}\n\n//河牌\ntype River struct {\n\tCard byte\n\tKind uint8\n}\n\n//通报本局庄家\ntype Button struct {\n\tUid uint32\n}\n\n// 玩家提交下注数据\n// 有四种下注方式，下注数分别对应为：\n//弃牌: <0 (fold)\n//跟注：等于单注额 (call)\n//看注：= 0 表示看注 (check)\n//加注：大于单注额 (raise)\n//全押：等于玩家手中所有筹码 (allin)\ntype Bet struct {\n\tValue int32\n}\n\n// 提示指定的玩家下注\ntype BetPrompt struct {\n}\n\n// 通报玩家下注\ntype BetBroadcast struct {\n\tValue int32\n\tKind  string\n\tUid   uint32\n}\n\ntype BetResp struct {\n\tValue int32\n\tKind  string\n\tUid   uint32\n}\n\n//通报奖池\ntype Pot struct {\n\tPot []uint32\n}\n\n//摊牌和比牌\ntype Showdown struct {\n\tShowdown []*ShowdownItem\n}\n\ntype ShowdownItem struct {\n\tUid      uint32\n\tChipsWin uint32\n\tChips    uint32\n}\n\ntype RoomList struct {\n}\n\ntype Room struct {\n\tRid             uint32\n\tNumber          string // 给玩家展示的房间号\n\tState           uint8  //房间状态 0默认可用 1不可用\n\tName            string //房间名字\n\tCreatedAt       uint32 //创建时间\n\tOriginalOwnerID uint32 //原始创建人的信息\n\tOwner           uint32 //房管\n\tKind            uint32 //游戏类型 即玩法\n\tDraginChips     uint32 // 带入筹码\n\tCap             uint8\n\tMaxCap          uint8\n}\n\ntype RoomListResp struct {\n\tRoom []*Room\n}\n\ntype Chat struct {\n\tUid  uint32\n\tText string\n}\n"
  }
]