{"id":208680,"date":"2014-03-11T14:39:06","date_gmt":"2014-03-11T10:39:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=208680"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=208680","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 Go (\u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Go, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044e\u043d\u043d\u044b\u0439 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0443\u0441\u043f\u0435\u043b \u0437\u0430\u0432\u043e\u0435\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u041e\u0431\u044b\u0447\u043d\u043e, \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0438\u0448\u0443\u0442 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0440\u043e\u0434\u0435 TODO \u043b\u0438\u0441\u0442\u0430. \u041c\u044b \u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435, \u0447\u0442\u043e \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0427\u0430\u0441\u0442\u043e, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0442\u0440\u0430\u0444\u0444\u0438\u043a \u0435\u0441\u0442\u044c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u0418 \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/requestb.in\/\">requestb.in\/<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u0443\u0440\u043b\u0443 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u0445 \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0438 \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/martini.codegangsta.io\/\">Martini<\/a>.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441:<\/p>\n<p>  <img decoding=\"async\" align=\"left\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a18\/13a\/db9\/a1813adb9fcbbd5f30549ad4d0429b8f.png\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 \u0448\u0430\u0433\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043e\u0434, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043d\u0430 GitHub. \u0412\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u0434\u043e\u043c.<br \/>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 Go. \u042f \u0438\u0441\u0445\u043e\u0436\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043e\u043d \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435\u0442, \u0442\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"http:\/\/golang.org\/doc\/install\">\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0440\u0435\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0431\u043b\u0430\u0433\u043e, \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0434\u043b\u044f Go \u0435\u0441\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u043d <a href=\"https:\/\/github.com\/DisposaBoy\/GoSublime\">GoSublime<\/a>. \u041d\u043e \u044f \u0431\u044b \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b IntelijIdea + <a href=\"http:\/\/plugins.jetbrains.com\/plugin\/5047\">go-lang-ide-plugin<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0447\u0435\u043d\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u2014 \u0434\u0435\u0431\u0430\u0433 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"http:\/\/skimmer.tulu.la\/\">skimmer.tulu.la\/<\/a>.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043a \u0441\u0435\u0431\u0435 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0432 \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/m0sth8\/skimmer .\/skimmer <\/code><\/pre>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0441\u0432\u043e\u0451 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430 <a href=\"http:\/\/golang.org\/doc\/code.html#Workspaces\">\u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>), \u043b\u0438\u0431\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u042f \u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/github.com\/pwoolcoc\/goenv\">goenv<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 go \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u043e\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0439\u0442\u0438 \u0432 \u0441\u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e skimmer \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">go get -d .\/src\/ <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<pre><code class=\"bash\">go run .\/src\/main.go <\/code><\/pre>\n<p>  \u0423 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 3000 (\u043f\u043e\u0440\u0442 \u0438 \u0445\u043e\u0441\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f PORT \u0438 HOST \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e). \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 127.0.0.1:3000 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0412\u043f\u0435\u0440\u0435\u0434\u0438 \u043d\u0430\u0441 \u0436\u0434\u0443\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u0430\u043f\u044b:  <\/p>\n<ol>\n<li>\u0428\u0430\u0433 \u043f\u0435\u0440\u0432\u044b\u0439. \u0417\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Martini;<\/li>\n<li>\u0428\u0430\u0433 \u0432\u0442\u043e\u0440\u043e\u0439. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u043e\u0434\u0435\u043b\u044c Bin \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u043c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b;<\/li>\n<li>\u0428\u0430\u0433 \u0442\u0440\u0435\u0442\u0438\u0439. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0445 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435;<\/li>\n<li>\u0428\u0430\u0433 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u044b\u0439. \u0410 \u043a\u0430\u043a \u0436\u0435 \u0442\u0435\u0441\u0442\u044b?<\/li>\n<li>\u0428\u0430\u0433 \u043f\u044f\u0442\u044b\u0439\u2014 \u0443\u043a\u0440\u0430\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0438 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441;<\/li>\n<li>\u0428\u0430\u0433 \u0448\u0435\u0441\u0442\u043e\u0439. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438;<\/li>\n<li>\u0428\u0430\u0433 \u0441\u0435\u0434\u044c\u043c\u043e\u0439. \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0435;<\/li>\n<li>\u0428\u0430\u0433 \u0432\u043e\u0441\u044c\u043c\u043e\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Redis \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/li>\n<\/ol>\n<p>  \u041e\u0441\u043e\u0431\u0430\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c <a href=\"http:\/\/habrahabr.ru\/users\/kavu\/\" class=\"user_link\">kavu<\/a> \u0437\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<h4>\u0428\u0430\u0433 \u043f\u0435\u0440\u0432\u044b\u0439. \u0417\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Martini.<\/h4>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043a\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430:<\/p>\n<pre><code>git checkout step-1 <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043a \u043d\u0430\u043c. \u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043b\u044e\u0431\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Go, \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f main \u043f\u0430\u043a\u0435\u0442\u0430 main. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 src \u0444\u0430\u0439\u043b main.go. \u0412 Martini \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043b\u043e\u0433\u0438, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u043e\u0443\u0442\u0435\u0440; \u0438 \u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0435\u0439.<\/p>\n<p>  \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 Martini \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442:<\/p>\n<pre><code class=\"go\">\/\/ Martini represents the top level web application. inject.Injector methods can be invoked to map services on a global level. type Martini struct {      inject.Injector      handlers []Handler      action   Handler      logger   *log.Logger } <\/code><\/pre>\n<p>  \u041e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <a href=\"http:\/\/golang.org\/pkg\/net\/http\/#Handler\">http.Handler<\/a>, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u043c\u0435\u0442\u043e\u0434 ServeHTTP. \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 handlers \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 Handler action.<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Martini:<\/p>\n<pre><code class=\"go\">\/\/ Classic creates a classic Martini with some basic default middleware - martini.Logger, martini.Recovery, and martini.Static. func Classic() *ClassicMartini {      r := NewRouter()      m := New()      m.Use(Logger())      m.Use(Recovery())      m.Use(Static(&quot;public&quot;))      m.Action(r.Handle)      return &ClassicMartini{m, r} } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 Martini \u0438 Router, \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 handler \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 martini.Use \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 panic (<a href=\"http:\/\/blog.golang.org\/defer-panic-and-recover\">\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/a> \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0435), \u043e\u0442\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0442\u0438\u043a\u0438, \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0440\u043e\u0443\u0442\u0435\u0440\u0430.<\/p>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <code>Any<\/code> \u0443 \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043b\u044e\u0431\u044b\u0435 \u0443\u0440\u043b\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 Martini \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"go\">type Router interface {      \/\/ Get adds a route for a HTTP GET request to the specified matching pattern.      Get(string, ...Handler) Route      \/\/ Patch adds a route for a HTTP PATCH request to the specified matching pattern.      Patch(string, ...Handler) Route      \/\/ Post adds a route for a HTTP POST request to the specified matching pattern.      Post(string, ...Handler) Route      \/\/ Put adds a route for a HTTP PUT request to the specified matching pattern.      Put(string, ...Handler) Route      \/\/ Delete adds a route for a HTTP DELETE request to the specified matching pattern.      Delete(string, ...Handler) Route      \/\/ Options adds a route for a HTTP OPTIONS request to the specified matching pattern.      Options(string, ...Handler) Route      \/\/ Any adds a route for any HTTP method request to the specified matching pattern.      Any(string, ...Handler) Route       \/\/ NotFound sets the handlers that are called when a no route matches a request. Throws a basic 404 by default.      NotFound(...Handler)       \/\/ Handle is the entry point for routing. This is used as a martini.Handler      Handle(http.ResponseWriter, *http.Request, Context) } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u2014 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043d\u043e \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u043e\u0439, \u0447\u0442\u043e \u0438\u0434\u0435\u0442 \u0432 Martini \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u043a\u0435\u0439\u0448\u0435\u043d. \u041b\u043e\u043a\u0435\u0439\u0448\u0435\u043d\u044b \u0432 Martini \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0447\u0435\u0440\u0435\u0437 <code>&quot;:param&quot;<\/code>, \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a \u0436\u0435 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Glob_(programming)\">glob<\/a>. \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0430\u043a \u043a\u0430\u043a Martini \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0441\u044e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041d\u0430\u043c \u043f\u043e\u043a\u0430 \u044d\u0442\u043e \u043d\u0438 \u043a \u0447\u0435\u043c\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0432\u0435\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c Go (\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c<a href=\"http:\/\/golang.org\/doc\/articles\/wiki\/\"> \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>). \u0412\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<pre><code class=\"go\">func main() {      api := martini.Classic()      api.Any(&quot;\/&quot;, func(res http.ResponseWriter, req *http.Request,) {           if dumped, err := httputil.DumpRequest(req, true); err == nil {                res.WriteHeader(200)                res.Write(dumped)           } else {                res.WriteHeader(500)                fmt.Fprintf(res, &quot;Error: %v&quot;, err)           }      })      api.Run() } <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"http:\/\/golang.org\/pkg\/net\/http\/httputil\/#DumpRequest\">DumpRequest<\/a> \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"http:\/\/golang.org\/pkg\/net\/http\/httputil\/\">httputil<\/a> \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 http.Request, \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043e\u0442\u0432\u0435\u0442 http.ResponseWriter. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438. \u0424\u0443\u043d\u043a\u0446\u0438\u044f api.Run \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 go \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u043f\u043e\u0440\u0442 \u0438 \u0445\u043e\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u0431\u0435\u0440\u0451\u0442 \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f PORT(3000 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) \u0438 HOST.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">go run .\/src\/main.go <\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443:  <\/p>\n<pre><code class=\"bash\">&gt; curl -X POST -d &quot;fizz=buzz&quot; http:\/\/127.0.0.1:3000 POST \/ HTTP\/1.1 Host: 127.0.0.1:3000 Accept: *\/* Content-Type: application\/x-www-form-urlencoded User-Agent: curl\/7.24.0 (x86_64-apple-darwin12.0) libcurl\/7.24.0 OpenSSL\/0.9.8y zlib\/1.2.5  fizz=buzz <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0431\u0430 \u0441\u0438\u043b, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0428\u0430\u0433 \u0432\u0442\u043e\u0440\u043e\u0439. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u043e\u0434\u0435\u043b\u044c Bin \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u043c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/h4>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u0434:<\/p>\n<pre><code>git checkout step-2 <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 main \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/developers.google.com\/appengine\/docs\/go\/\">Google Application Engine<\/a> \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0432\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 main, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u0430\u0448\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 API \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 skimmer\/api.go.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0439\u043c\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0451 Bin, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 requestbin. \u041c\u043e\u0434\u0435\u043b\u044c\u044e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Go. <\/p>\n<blockquote><p>\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e\u043b\u0435\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0430\u0436\u0435\u043d, \u043d\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c, \u043d\u043e \u0442\u0435 \u043a\u0442\u043e \u0445\u043e\u0442\u044f\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 <a href=\"http:\/\/www.goinggo.net\/2013\/07\/understanding-type-in-go.html\">www.goinggo.net\/2013\/07\/understanding-type-in-go.html<\/a> \u0438 <a href=\"http:\/\/www.geeksforgeeks.org\/structure-member-alignment-padding-and-data-packing\/\">www.geeksforgeeks.org\/structure-member-alignment-padding-and-data-packing\/<\/a>.<\/p><\/blockquote>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c Bin \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u044f \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0439\u043c\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0438 \u0434\u0430\u0442\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 \u0443 \u043d\u0430\u0441 \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u044d\u0433\u043e\u043c.  <\/p>\n<blockquote><p>\u0422\u044d\u0433\u0438 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0430\u043a\u0435\u0442 reflection \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044f), \u0438 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0451 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u044d\u0433\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 <a href=\"http:\/\/golang.org\/pkg\/reflect\/#StructTag\">reflection<\/a>). \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043f\u0430\u043a\u0435\u0442 json \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438\/\u0440\u0430\u0441\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u044d\u0433\u0430, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"go\">package main  import (      &quot;reflect&quot;      &quot;fmt&quot; )  type Bin struct {      Name         string `json:&quot;name&quot;` }  func main() {      bin := Bin{}      bt := reflect.TypeOf(bin)      field := bt.Field(0)      fmt.Printf(&quot;Field's '%s' json name is '%s'&quot;, field.Name, field.Tag.Get(&quot;json&quot;)) } <\/code><\/pre>\n<p>  \u0412\u044b\u0432\u0435\u0434\u0435\u0442<br \/>  <code>Field's 'Name' json name is 'name' <\/code><\/p>\n<p>  \u041f\u0430\u043a\u0435\u0442 encoding\/json \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438 \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u044d\u0433\u043e\u0432:<\/p>\n<pre><code class=\"go\">\/\/ \u041f\u043e\u043b\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f Field int `json:&quot;-&quot;`  \/\/ \u0412 json \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043f\u043e\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a myName Field int `json:&quot;myName&quot;` <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0446\u0438\u044f omitempty \u2014 \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 json \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e, \u0442\u043e \u043f\u043e\u043b\u0435 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u0422\u0430\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u043e\u0439, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043e\u043d\u043e \u0432 json \u043e\u0431\u044a\u0435\u043a\u0442\u0435, \u0441\u0440\u0430\u0432\u043d\u0438\u0432 \u0435\u0433\u043e \u0441 nil. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e json \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"http:\/\/golang.org\/pkg\/encoding\/json\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <\/a><\/p><\/blockquote>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e NewBin, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Bin (\u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440):<\/p>\n<pre><code class=\"go\">type Bin struct {         Name         string `json:&quot;name&quot;`         Created      int64  `json:&quot;created&quot;`         Updated      int64  `json:&quot;updated&quot;`         RequestCount int    `json:&quot;requestCount&quot;` }  func NewBin() *Bin {         now := time.Now().Unix()         bin := Bin{                 Created:      now,                 Updated:          now,                 Name:         rs.Generate(6),         }         return &bin } <\/code><\/pre>\n<blockquote><p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 Go \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u0438\u0446\u0438\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>  1) \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<pre><code class=\"go\">Bin{rs.Generate(6), now, now, 0} <\/code><\/pre>\n<p>  2) \u0423\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0435\u0439, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"go\">Bin{           Created:      now,           Updated:      now,           Name:         rs.Generate(6),      } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 0, \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a \u2014 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 &quot;&quot;, \u0434\u043b\u044f \u0441\u0441\u044b\u043b\u043e\u043a, \u043a\u0430\u043d\u0430\u043b\u043e\u0432, \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432, \u0441\u043b\u0430\u0439\u0441\u043e\u0432 \u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 nil. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432 <a href=\"http:\/\/golang.org\/ref\/spec#The_zero_value\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043b\u044c\u0437\u044f.<\/p><\/blockquote>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0442\u0440\u043e\u043a \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442 rs. \u041e\u043d \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"go\">var rs = NewRandomString(&quot;0123456789abcdefghijklmnopqrstuvwxyz&quot;) <\/code><\/pre>\n<p>  \u0421\u0430\u043c \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 utils.go. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 RandomString:<\/p>\n<pre><code class=\"go\">type RandomString struct {      pool string      rg   *rand.Rand }  func NewRandomString(pool string) *RandomString {      return &RandomString{           pool,           rand.New(rand.NewSource(time.Now().Unix())),      } }  func (rs *RandomString) Generate(length int) (r string) {      if length &lt; 1 {           return      }      b := make([]byte, length)      for i, _ := range b {           b[i] = rs.pool[rs.rg.Intn(len(rs.pool))]      }      r = string(b)      return } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0430\u043a\u0435\u0442 <a href=\"http:\/\/golang.org\/pkg\/math\/rand\">math\/rand<\/a>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0421\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043f\u043e\u0441\u0435\u044f\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<p>  \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 Generate \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0431\u0430\u0439\u0442\u043e\u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 pool. \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e Api. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 Bin, \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<br \/>  \u0420\u0430\u043d\u0435\u0435 \u044f \u043f\u0438\u0441\u0430\u043b, \u0447\u0442\u043e martini \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c HandlerFunc, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 Martini \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a interface{} \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041a\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b? \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u2014 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Dependency_injection\">Dependency injection<\/a> (\u0434\u0430\u043b\u0435\u0435 DI) \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/github.com\/codegangsta\/inject\/\">inject<\/a> \u043e\u0442 \u0430\u0432\u0442\u043e\u0440\u0430 martini. \u041d\u0435 \u0431\u0443\u0434\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0431\u043b\u0430\u0433\u043e \u043e\u043d \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0442\u0430\u043c \u0432\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u0434\u0432\u0443\u043c\u044f \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 reflect, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0433\u0434\u0430 inject \u0432\u0438\u0434\u0438\u0442 \u0442\u0438\u043f *http.Request, \u043e\u043d \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 req *http.Request \u0432 \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440.<br \/>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Map \u0438 MapTo \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e, \u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 martini.Context \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041e\u0431\u044a\u044f\u0432\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 history \u0438 bins, \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Bin, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043a\u043e\u0439 \u043a\u0443\u0446\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Bin.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Bin<\/h5>\n<p>  <\/p>\n<pre><code class=\"go\">     api.Post(&quot;\/api\/v1\/bins\/&quot;, func(r render.Render){                bin := NewBin()                bins[bin.Name] = bin                history = append(history, bin.Name)                r.JSON(http.StatusCreated, bin)           }) <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Bin<\/h5>\n<p>  <\/p>\n<pre><code class=\"go\">     api.Get(&quot;\/api\/v1\/bins\/&quot;, func(r render.Render){                filteredBins := []*Bin{}                for _, name := range(history) {                     if bin, ok := bins[name]; ok {                          filteredBins = append(filteredBins, bin)                     }                }                r.JSON(http.StatusOK, filteredBins)           }) <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430<\/h5>\n<p>  <\/p>\n<pre><code class=\"go\">     api.Get(&quot;\/api\/v1\/bins\/:bin&quot;, func(r render.Render, params martini.Params){                if bin, ok := bins[params[&quot;bin&quot;]]; ok{                     r.JSON(http.StatusOK, bin)                } else {                     r.Error(http.StatusNotFound)                }           }) <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Bin \u043f\u043e \u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438, \u0432 \u043d\u0451\u043c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 martini.Params (\u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e map[string]string), \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c\u0441\u044f \u043a \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u0430\u0434\u0440\u0435\u0441\u0430.  <\/p>\n<blockquote><p>\u0412 \u044f\u0437\u044b\u043a\u0435 Go \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:  <\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 <code>a := m[key]<\/code>, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0435\u0441\u0442\u044c, \u043b\u0438\u0431\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438 \u043a\u043b\u044e\u0447 0 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0433\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/li>\n<li>\u0412 \u044d\u0442\u043e\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u0435, \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0432 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u2014 <code>a, ok := m[key]<\/code><\/li>\n<\/ol>\n<p>  <\/p><\/blockquote>\n<p>  \u041f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0433\u043e:<\/p>\n<pre><code>go run .\/src\/main.go <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Bin:<\/p>\n<pre><code>&gt; curl -i -X POST &quot;127.0.0.1:3000\/api\/v1\/bins\/&quot; HTTP\/1.1 201 Created Content-Type: application\/json; charset=UTF-8 Date: Mon, 03 Mar 2014 04:10:38 GMT Content-Length: 76  {&quot;name&quot;:&quot;7xpogf&quot;,&quot;created&quot;:1393819838,&quot;updated&quot;:1393819838,&quot;requestCount&quot;:0} <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430\u043c Bin \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code>&gt; curl -i &quot;127.0.0.1:3000\/api\/v1\/bins\/&quot; HTTP\/1.1 200 OK Content-Type: application\/json; charset=UTF-8 Date: Mon, 03 Mar 2014 04:11:18 GMT Content-Length: 78  [{&quot;name&quot;:&quot;7xpogf&quot;,&quot;created&quot;:1393819838,&quot;updated&quot;:1393819838,&quot;requestCount&quot;:0}] <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Bin, \u0432\u0437\u044f\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 name \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code>curl -i &quot;127.0.0.1:3000\/api\/v1\/bins\/7xpogf&quot; HTTP\/1.1 200 OK Content-Type: application\/json; charset=UTF-8 Date: Mon, 03 Mar 2014 04:12:13 GMT Content-Length: 76  {&quot;name&quot;:&quot;7xpogf&quot;,&quot;created&quot;:1393819838,&quot;updated&quot;:1393819838,&quot;requestCount&quot;:0} <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0443\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<h4>\u0428\u0430\u0433 \u0442\u0440\u0435\u0442\u0438\u0439. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0445 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u043d\u0430\u043c, \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 Bin.<\/p>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0448\u0430\u0433\u0430  <\/p>\n<pre><code>git checkout step-3 <\/code><\/pre>\n<p>  <\/p>\n<h5>\u041c\u043e\u0434\u0435\u043b\u044c Request<\/h5>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 HTTP \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<pre><code>type Request struct {      Id      string `json:&quot;id&quot;`      Created int64  `json:&quot;created&quot;`       Method        string              `json:&quot;method&quot;` \/\/ GET, POST, PUT, etc.      Proto         string              `json:&quot;proto&quot;`  \/\/ &quot;HTTP\/1.0&quot;      Header        http.Header         `json:&quot;header&quot;`      ContentLength int64               `json:&quot;contentLength&quot;`      RemoteAddr    string              `json:&quot;remoteAddr&quot;`      Host          string              `json:&quot;host&quot;`      RequestURI    string              `json:&quot;requestURI&quot;`      Body          string              `json:&quot;body&quot;`      FormValue     map[string][]string `json:&quot;formValue&quot;`      FormFile      []string            `json:&quot;formFile&quot;` } <\/code><\/pre>\n<p>  \u041e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u043b\u0430\u0433\u0430\u044e \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439: \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u044b \u2014 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Bin, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0443\u044e \u043e\u0431\u044a\u0435\u043a\u0442 Request \u0438\u0437 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code>func NewRequest(httpRequest *http.Request, maxBodySize int) *Request {      var (           bodyValue string           formValue map[string][]string           formFile  []string      )         \/\/ \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043b\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439      if body, err := ioutil.ReadAll(httpRequest.Body); err == nil {           if len(body) &gt; 0 && maxBodySize != 0 {                if maxBodySize == -1 || httpRequest.ContentLength &lt; int64(maxBodySize) {                     bodyValue = string(body)                } else {                     bodyValue = fmt.Sprintf(&quot;%s\\n&lt;&lt;&lt;TRUNCATED , %d of %d&quot;, string(body[0:maxBodySize]),                          maxBodySize, httpRequest.ContentLength)                }           }           httpRequest.Body = ioutil.NopCloser(bytes.NewBuffer(body))           defer httpRequest.Body.Close()      }      httpRequest.ParseMultipartForm(0)      if httpRequest.MultipartForm != nil {           formValue = httpRequest.MultipartForm.Value           for key := range httpRequest.MultipartForm.File {                formFile = append(formFile, key)           }      } else {           formValue = httpRequest.PostForm      }      request := Request{           Id:            rs.Generate(12),           Created:       time.Now().Unix(),           Method:        httpRequest.Method,           Proto:         httpRequest.Proto,           Host:          httpRequest.Host,           Header:        httpRequest.Header,           ContentLength: httpRequest.ContentLength,           RemoteAddr:    httpRequest.RemoteAddr,           RequestURI:    httpRequest.RequestURI,           FormValue:     formValue,           FormFile:      formFile,           Body:          bodyValue,      }      return &request } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439, \u043f\u043e\u044f\u0441\u043d\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0412 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <a href=\"http:\/\/golang.org\/pkg\/net\/http\/#Request\">http.Request<\/a>, \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u2014 Body \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0431\u0443\u0444\u0444\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <a href=\"http:\/\/golang.org\/pkg\/io\/#ReadCloser\">io.ReadCloser<\/a>, \u043f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u044b (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 ParseMultipartForm), \u043c\u044b \u0443\u0436\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c Body \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u0441\u0432\u043e\u0438\u043c. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0444\u043e\u0440\u043c \u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Bin, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432 \u0444\u0430\u0439\u043b\u0435 storage.go:<\/p>\n<pre><code>type Storage interface {      LookupBin(name string) (*Bin, error) \/\/ get one bin element by name      LookupBins(names []string) ([]*Bin, error) \/\/ get slice of bin elements      LookupRequest(binName, id string) (*Request, error) \/\/ get request from bin by id      LookupRequests(binName string, from, to int) ([]*Request, error) \/\/ get slice of requests from bin by position      CreateBin(bin *Bin) error \/\/ create bin in memory storage      UpdateBin(bin *Bin) error \/\/ save      CreateRequest(bin *Bin, req *Request) error } <\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0432 Go \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 storage, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u043e\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c Redis \u0438\u043b\u0438 Mongo). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 <a href=\"http:\/\/golangtutorials.blogspot.com\/2011\/06\/interfaces-in-go.html\">\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445<\/a>.<\/p><\/blockquote>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 storage, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043d\u0430\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>type BaseStorage struct {      maxRequests       int } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0441\u0451 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c <a href=\"http:\/\/ru.wikipedia.org\/wiki\/\u041c\u044c\u044e\u0442\u0435\u043a\u0441\">\u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430\u043c\u0438<\/a>.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b memory.go \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code>type MemoryStorage struct {      BaseStorage      sync.RWMutex      binRecords map[string]*BinRecord } <\/code><\/pre>\n<p>  \u041e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445, \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 BaseStorage \u0438 sync.RWMutex. <\/p>\n<blockquote><p>\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0434\u0430\u044e\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u043e\u043b\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f obj \u0442\u0438\u043f\u0430 MemoryStorage, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u043e\u043b\u044e maxRequests \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e obj.BaseStorage.maxRequests, \u043b\u0438\u0431\u043e \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043e\u043d\u0438 \u0447\u043b\u0435\u043d\u044b \u0441\u0430\u043c\u043e\u0433\u043e MemoryStorage obj.maxRequests. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u044f\u0445 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"http:\/\/golangtutorials.blogspot.com\/2011\/06\/anonymous-fields-in-structs-like-object.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p><\/blockquote>\n<p>  <a href=\"http:\/\/golang.org\/pkg\/sync\/#RWMutex\">RWMutex<\/a> \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u0451\u043c binRecords, \u0442\u0430\u043a \u043a\u0430\u043a Go \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445.<\/p>\n<p>  \u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 binRecords, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u0451\u043c \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0438\u0437 \u043f\u043e\u043b\u044f name Bin \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u0438\u0434\u0430 BinRecord.<\/p>\n<pre><code>type BinRecord struct {      bin        *Bin      requests   []*Request      requestMap map[string]*Request } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043f\u043e\u043b\u044f\u0445, \u0432 \u0441\u043f\u0438\u0441\u043a\u0435, \u0433\u0434\u0435 \u043e\u043d\u0438 \u0438\u0434\u0443\u0442 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443.  <\/p>\n<blockquote><p>\u0421\u043b\u043e\u0432\u0430\u0440\u0438 \u0432 Go \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0445\u0435\u0448 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 <a href=\"http:\/\/www.goinggo.net\/2013\/12\/macro-view-of-map-internals-in-go.html\">\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p><\/blockquote>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 BinRecord \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 requests \u0438 requestMap.<\/p>\n<pre><code>func (binRecord *BinRecord) ShrinkRequests(size int) {      if size &gt; 0 && len(binRecord.requests) &gt; size {           requests := binRecord.requests           lenDiff := len(requests) - size           removed := requests[:lenDiff]           for _, removedReq := range removed {                delete(binRecord.requestMap, removedReq.Id)           }           requests = requests[lenDiff:]           binRecord.requests = requests      } } <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b MemoryStorage \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Storage, \u0442\u0430\u043a \u0436\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 getBinRecord, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0437\u0430\u043f\u0438\u0441\u044c. \u0412 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c, \u043c\u044b \u0441\u0442\u0430\u0432\u0438\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0441\u043d\u044f\u0442\u0438\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 defer. \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 defer \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0431\u044b\u043b\u0430 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u043f\u0430\u043d\u0438\u043a\u043e\u0439. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e defer \u043c\u043e\u0436\u043d\u043e \u0432 <a href=\"http:\/\/blog.golang.org\/defer-panic-and-recover\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 MemoryStorage \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442, \u0442\u0430\u043c \u0432\u0441\u0451 \u0438 \u0442\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 MemoryStorage<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>package skimmer  import (      &quot;errors&quot;      &quot;sync&quot; )  type MemoryStorage struct {      BaseStorage      sync.RWMutex      binRecords map[string]*BinRecord }  type BinRecord struct {      bin        *Bin      requests   []*Request      requestMap map[string]*Request }  func (binRecord *BinRecord) ShrinkRequests(size int) {      if size &gt; 0 && len(binRecord.requests) &gt; size {           requests := binRecord.requests           lenDiff := len(requests) - size           removed := requests[:lenDiff]           for _, removedReq := range removed {                delete(binRecord.requestMap, removedReq.Id)           }           requests = requests[lenDiff:]           binRecord.requests = requests      } }  func NewMemoryStorage(maxRequests int) *MemoryStorage {      return &MemoryStorage{           BaseStorage{                maxRequests:        maxRequests,           },           sync.RWMutex{},           map[string]*BinRecord{},      } }  func (storage *MemoryStorage) getBinRecord(name string) (*BinRecord, error) {      storage.RLock()      defer storage.RUnlock()      if binRecord, ok := storage.binRecords[name]; ok {           return binRecord, nil      }      return nil, errors.New(&quot;Bin not found&quot;) }  func (storage *MemoryStorage) LookupBin(name string) (*Bin, error) {      if binRecord, err := storage.getBinRecord(name); err == nil {           return binRecord.bin, nil      } else {           return nil, err      } }  func (storage *MemoryStorage) LookupBins(names []string) ([]*Bin, error) {      bins := []*Bin{}      for _, name := range names {           if binRecord, err := storage.getBinRecord(name); err == nil {                bins = append(bins, binRecord.bin)           }      }      return bins, nil }  func (storage *MemoryStorage) CreateBin(bin *Bin) error {      storage.Lock()      defer storage.Unlock()      binRec := BinRecord{bin, []*Request{}, map[string]*Request{}}      storage.binRecords[bin.Name] = &binRec      return nil }  func (storage *MemoryStorage) UpdateBin(_ *Bin) error {      return nil }  func (storage *MemoryStorage) LookupRequest(binName, id string) (*Request, error) {      if binRecord, err := storage.getBinRecord(binName); err == nil {           if request, ok := binRecord.requestMap[id]; ok {                return request, nil           } else {                return nil, errors.New(&quot;Request not found&quot;)           }      } else {           return nil, err      } }  func (storage *MemoryStorage) LookupRequests(binName string, from int, to int) ([]*Request, error) {      if binRecord, err := storage.getBinRecord(binName); err == nil {           requestLen := len(binRecord.requests)           if to &gt;= requestLen {                to = requestLen           }           if to &lt; 0 {                to = 0           }           if from &lt; 0 {                from = 0           }           if from &gt; to {                from = to           }           reversedLen := to - from           reversed := make([]*Request, reversedLen)           for i, request := range binRecord.requests[from:to] {                reversed[reversedLen-i-1] = request           }           return reversed, nil      } else {           return nil, err      } }  func (storage *MemoryStorage) CreateRequest(bin *Bin, req *Request) error {      if binRecord, err := storage.getBinRecord(bin.Name); err == nil {           storage.Lock()           defer storage.Unlock()           binRecord.requests = append(binRecord.requests, req)           binRecord.requestMap[req.Id] = req           binRecord.ShrinkRequests(storage.maxRequests)           binRecord.bin.RequestCount = len(binRecord.requests)           return nil      } else {           return err      } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e api. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430.<\/p>\n<pre><code>\tmemoryStorage := NewMemoryStorage(MAX_REQUEST_COUNT) \tapi.MapTo(memoryStorage, (*Storage)(nil)) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 Storage \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443. \u0427\u0442\u043e \u043c\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u043c, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a Bin \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u0451\u043c \u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u044b \u043a Storage.<\/p>\n<pre><code>\tapi.Post(&quot;\/api\/v1\/bins\/&quot;, func(r render.Render, storage Storage){ \t\t\tbin := NewBin() \t\t\tif err := storage.CreateBin(bin); err == nil { \t\t\t\thistory = append(history, bin.Name) \t\t\t\tr.JSON(http.StatusCreated, bin) \t\t\t} else { \t\t\t\tr.JSON(http.StatusInternalServerError, ErrorMsg{err.Error()}) \t\t\t} \t\t})  \tapi.Get(&quot;\/api\/v1\/bins\/&quot;, func(r render.Render, storage Storage){ \t\t\tif bins, err := storage.LookupBins(history); err == nil { \t\t\t\tr.JSON(http.StatusOK, bins) \t\t\t} else { \t\t\t\tr.JSON(http.StatusInternalServerError, ErrorMsg{err.Error()}) \t\t\t} \t\t})  \tapi.Get(&quot;\/api\/v1\/bins\/:bin&quot;, func(r render.Render, params martini.Params, storage Storage){ \t\t\tif bin, err := storage.LookupBin(params[&quot;bin&quot;]); err == nil{ \t\t\t\tr.JSON(http.StatusOK, bin) \t\t\t} else { \t\t\t\tr.JSON(http.StatusNotFound, ErrorMsg{err.Error()}) \t\t\t} \t\t}) <\/code><\/pre>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 Request.<\/p>\n<pre><code>\/\/ \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u043e\u0432 \tapi.Get(&quot;\/api\/v1\/bins\/:bin\/requests\/&quot;, func(r render.Render, storage Storage, params martini.Params, \t\t\treq *http.Request){ \t\t\tif bin, error := storage.LookupBin(params[&quot;bin&quot;]); error == nil { \t\t\t\tfrom := 0 \t\t\t\tto := 20 \t\t\t\tif fromVal, err := strconv.Atoi(req.FormValue(&quot;from&quot;)); err == nil { \t\t\t\t\tfrom = fromVal \t\t\t\t} \t\t\t\tif toVal, err := strconv.Atoi(req.FormValue(&quot;to&quot;)); err == nil { \t\t\t\t\tto = toVal \t\t\t\t} \t\t\t\tif requests, err := storage.LookupRequests(bin.Name, from, to); err == nil { \t\t\t\t\tr.JSON(http.StatusOK, requests) \t\t\t\t} else { \t\t\t\t\tr.JSON(http.StatusInternalServerError, ErrorMsg{err.Error()}) \t\t\t\t} \t\t\t} else { \t\t\t\tr.Error(http.StatusNotFound) \t\t\t} \t\t}) \/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 Request \tapi.Get(&quot;\/api\/v1\/bins\/:bin\/requests\/:request&quot;, func(r render.Render, storage Storage, params martini.Params){ \t\t\tif request, err := storage.LookupRequest(params[&quot;bin&quot;], params[&quot;request&quot;]); err == nil { \t\t\t\tr.JSON(http.StatusOK, request) \t\t\t} else { \t\t\t\tr.JSON(http.StatusNotFound, ErrorMsg{err.Error()}) \t\t\t} \t\t}) \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 Request \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Bin(name) \tapi.Any(&quot;\/bins\/:name&quot;, func(r render.Render, storage Storage, params martini.Params, \t\t\treq *http.Request){ \t\t\tif bin, error := storage.LookupBin(params[&quot;name&quot;]); error == nil { \t\t\t\trequest := NewRequest(req, REQUEST_BODY_SIZE) \t\t\t\tif err := storage.CreateRequest(bin, request); err == nil { \t\t\t\t\tr.JSON(http.StatusOK, request) \t\t\t\t} else { \t\t\t\t\tr.JSON(http.StatusInternalServerError, ErrorMsg{err.Error()}) \t\t\t\t} \t\t\t} else { \t\t\t\tr.Error(http.StatusNotFound) \t\t\t} \t\t}) <\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Bin \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<pre><code>&gt; curl -i -X POST &quot;127.0.0.1:3000\/api\/v1\/bins\/&quot; HTTP\/1.1 201 Created Content-Type: application\/json; charset=UTF-8 Date: Mon, 03 Mar 2014 12:19:28 GMT Content-Length: 76  {&quot;name&quot;:&quot;ws87ui&quot;,&quot;created&quot;:1393849168,&quot;updated&quot;:1393849168,&quot;requestCount&quot;:0} <\/code><\/pre>\n<p>  \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440  <\/p>\n<pre><code>&gt; curl -X POST -d &quot;fizz=buzz&quot; http:\/\/127.0.0.1:3000\/bins\/ws87ui {&quot;id&quot;:&quot;i0aigrrc1b40&quot;,&quot;created&quot;:1393849284,...} <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f \u043b\u0438 \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441:  <\/p>\n<pre><code>&gt; curl  http:\/\/127.0.0.1:3000\/api\/v1\/bins\/ws87ui\/requests\/ [{&quot;id&quot;:&quot;i0aigrrc1b40&quot;,&quot;created&quot;:1393849284,...}] <\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0442\u043e\u0447\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0430\u043c\u0438.<\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u043e <a href=\"http:\/\/habrahabr.ru\/post\/214425\/\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>, \u0433\u0434\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 AngularJS \u0438 Bootstrap, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Redis \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/208680\/\"> http:\/\/habrahabr.ru\/post\/208680\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Go, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044e\u043d\u043d\u044b\u0439 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0443\u0441\u043f\u0435\u043b \u0437\u0430\u0432\u043e\u0435\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u041e\u0431\u044b\u0447\u043d\u043e, \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0438\u0448\u0443\u0442 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0440\u043e\u0434\u0435 TODO \u043b\u0438\u0441\u0442\u0430. \u041c\u044b \u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435, \u0447\u0442\u043e \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0427\u0430\u0441\u0442\u043e, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0442\u0440\u0430\u0444\u0444\u0438\u043a \u0435\u0441\u0442\u044c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u0418 \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/requestb.in\/\">requestb.in\/<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u0443\u0440\u043b\u0443 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u0445 \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u0438 \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/martini.codegangsta.io\/\">Martini<\/a>.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441:<\/p>\n<p>  <img decoding=\"async\" align=\"left\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a18\/13a\/db9\/a1813adb9fcbbd5f30549ad4d0429b8f.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-208680","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208680"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208680\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}