{"id":372641,"date":"2024-05-21T05:17:19","date_gmt":"2024-05-21T05:17:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=372641"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=372641","title":{"rendered":"<span>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u043c \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0435 \u0432 Go 1.22<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2024 \u0433\u043e\u0434\u0430 <a href=\"https:\/\/go.dev\/doc\/devel\/release#go1.22.0\">\u0432\u044b\u0448\u0435\u043b Go 1.22<\/a>. \u0412\u043e\u0442, \u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0451\u0441 \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437: \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0446\u0438\u043a\u043b\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 rangefunc-\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u044e\u0441\u044c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c, \u0441\u0430\u043c\u043e\u043c \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u043e\u043c, \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 http-\u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0432 Go \u2014 \u043e\u0431\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043a\u0443\u0447\u0443 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0432 \u044d\u0442\u043e\u043c <a href=\"https:\/\/github.com\/avelino\/awesome-go?tab=readme-ov-file#routers\">GitHub-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u043b\u0443\u0447\u0448\u0438\u0435. Google \u0441\u0430\u043c\u0430 <a href=\"https:\/\/go.dev\/blog\/routing-enhancements\">\u043f\u0440\u0438\u0437\u043d\u0430\u0451\u0442\u0441\u044f<\/a>, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043b\u0443\u0447\u0448\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 <code>net\/http<\/code>. <\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c Go 1.22 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c http.ServeMux: \u043e\u043d \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 HTTP-\u043c\u0435\u0442\u043e\u0434\u044b, \u0445\u043e\u0441\u0442\u044b \u0438 \u0434\u043e\u043c\u0435\u043d\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/5s\/wl\/bu\/5swlbu7g_o6t-eo3ch1ra3khwss.png\" data-src=\"https:\/\/habrastorage.org\/webt\/5s\/wl\/bu\/5swlbu7g_o6t-eo3ch1ra3khwss.png\"\/>  <\/p>\n<h2 id=\"razberyom-routing-na-primere-bloga\">\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u043b\u043e\u0433\u0430<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 localhost \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f ServeMux \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u043b\u043e\u0433\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u0443\u0447\u043a\u0438 posts, \/posts\/{id} \u0438 \/posts\/latest \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0451\u0440\u0433\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 7777 \u043f\u043e\u0440\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"net\/http\" )  func h(name string) http.HandlerFunc {     return func(w http.ResponseWriter, r *http.Request) {         fmt.Fprintf(w, \"%s: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 %s \u043c\u0435\u0442\u043e\u0434\u043e\u043c %s\\n\", name, r.URL.String(), r.Method)     } }  func main() {     m := http.NewServeMux()     m.Handle(\"GET \/posts\/latest\", h(\"latest\"))     m.Handle(\"GET \/posts\/{id}\", h(\"id\"))     m.Handle(\"GET \/posts\", h(\"posts\"))     http.ListenAndServe(\":7777\", m) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0443\u043a\u0441\u0435\u0440 \u0438 \u043a\u0443\u0440\u043b\u043e\u043c \u0434\u0451\u0440\u0433\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0443\u0442\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"http-metody-v-shablonah\">HTTP-\u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043e 1.22. \u0414\u043b\u044f \u043f\u0443\u0442\u0438 <code>\/posts<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u2014 \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430. \u041c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"\/posts\", h(\"posts-no-method\"))<\/code><\/pre>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET:<\/strong> <code>curl localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-no-method: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST:<\/strong> <code>curl -X POST localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-no-method: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0447\u0451\u043c Go \u0441\u0430\u043c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043f\u0443\u0442\u044c \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c AVITO, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u2014 \u0438 \u0432\u0441\u0451 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  <\/p>\n<p>3) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c AVITO:<\/strong> <code>curl -X AVITO localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-no-method: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c AVITO<\/code><\/p>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0432 1.22<\/strong>. \u0415\u0441\u043b\u0438 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u044d\u0442\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 GET \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u0434\u043b\u044f GET, \u0438 \u0434\u043b\u044f HEAD.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"GET \/posts\", h(\"posts-with-method\"))<\/code><\/pre>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET:<\/strong> <code>curl localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-with-method: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST:<\/strong> <code>curl -X POST localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>Method Not Allowed<\/code> (\u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c 405)<\/p>\n<p>  <\/p>\n<h2 id=\"hosty-v-shablonah\">\u0425\u043e\u0441\u0442\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445<\/h2>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043e 1.22<\/strong>. \u0412\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0445\u043e\u0441\u0442\u0430 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"\/posts\", h(\"posts-no-host\"))<\/code><\/pre>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0441 \u0445\u043e\u0441\u0442\u043e\u043c localhost:<\/strong> <code>curl localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-no-host: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0441 \u0445\u043e\u0441\u0442\u043e\u043c 127.0.0.1:7777:<\/strong> <code>curl 127.0.0.1:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-no-host: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code>\u2014 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0432 1.22.<\/strong> \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u0443\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0445\u043e\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"localhost\/posts\", h(\"posts-with-localhost\")) m.Handle(\"127.0.0.1\/posts\", h(\"posts-with-127-0-0-1\"))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u0435\u0436\u0434\u0443 \u0445\u043e\u0441\u0442\u043e\u043c \u0443 \u043f\u0443\u0442\u0451\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0441 \u0445\u043e\u0441\u0442\u043e\u043c localhost:<\/strong> <code>curl localhost:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-with-localhost: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0441 \u0445\u043e\u0441\u0442\u043e\u043c 127.0.0.1:<\/strong> <code>curl 127.0.0.1:7777\/posts<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-with-127-0-0-1: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<h2 id=\"pleysholdery-v-shablonah\">\u041f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445<\/h2>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043e 1.22<\/strong>. \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0443\u0442\u0438 \u0432\u0438\u0434\u0430 <code>\/posts\/{id}<\/code>, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043b\u0435\u0448 \u043d\u0430 \u043a\u043e\u043d\u0446\u0435 \u043f\u0443\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 <code>\"\/posts\/\"<\/code> \u0432\u0441\u0435 \u043f\u0443\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043d\u0430 <code>\/posts\/<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c id \u043f\u043e\u0441\u0442\u0430. <\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"\/posts\/\", h(\"posts-with-slash\"))<\/code><\/pre>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \/posts\/1:<\/strong> <code>curl localhost:7777\/posts\/1<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-with-slash: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts\/1 \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \/posts\/latest:<\/strong> <code>curl localhost:7777\/posts\/latest<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>posts-with-slash: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts\/latest \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p><code>\/posts\/1<\/code> \u0438 <code>\/posts\/latest<\/code>, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u043d\u043e \u043e\u0431\u0430 \u043f\u0443\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a posts-with-slash.<\/p>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0432 1.22.<\/strong> \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/posts\/{id}<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u043c URL, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043d\u0430 <code>\/posts\/<\/code> \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0434\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. <\/p>\n<p>  <\/p>\n<pre><code class=\"go\">m.Handle(\"GET \/posts\/{id}\", h(\"id\")) m.Handle(\"GET \/posts\/latest\", h(\"latest\"))<\/code><\/pre>\n<p>  <\/p>\n<p>1) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \/posts\/1:<\/strong> <code>curl localhost:7777\/posts\/1<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>id: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts\/1 \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>2) <strong>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \/posts\/latest:<\/strong> <code>curl localhost:7777\/posts\/latest<\/code><br \/>  <strong>\u0412\u044b\u0432\u043e\u0434:<\/strong> <code>latest: \u0412\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \/posts\/latest \u043c\u0435\u0442\u043e\u0434\u043e\u043c GET<\/code><\/p>\n<p>  <\/p>\n<p>\u0410 id \u043f\u043e\u0441\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<p>  <\/p>\n<pre><code class=\"go\">idString := req.PathValue(\"id\")<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0446\u0435\u043b\u043e\u043c\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443, \u043a\u0430\u043a <code>{id}<\/code> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u043e\u043d \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>...,<\/code> \u2014 \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0441\u044f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c \u043f\u0443\u0442\u0438, \u043a\u0430\u043a \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 <code>\/files\/{pathname...}<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0446\u0430 \u043f\u0443\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u043d\u0430\u043a <code>{$}<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/posts\/{$}<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <code>\/posts\/<\/code>, \u043d\u043e \u043d\u0435 <code>\/posts<\/code> \u0438\u043b\u0438 <code>\/posts\/123\/<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"prioritet-shablonov\">\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0412 Go \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0448\u0430\u0431\u043b\u043e\u043d\u044b <code>\/posts\/{id}<\/code> \u0438 <code>\/posts\/latest<\/code> \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>\/posts\/latest<\/code> \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442.<\/p>\n<p>  <\/p>\n<p><strong>\u0412 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0434\u043e 1.22 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d<\/strong> \u2014 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Go \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0451\u0442 <code>\/posts\/latest<\/code>, \u0430 \u043d\u0435 <code>\/posts\/<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 1.22 \u043f\u0440\u0438 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0430\u0445 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d.<\/strong> \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Go \u0432\u044b\u0431\u0435\u0440\u0435\u0442 <code>\/posts\/latest<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>\/posts\/{id}<\/code>. \u0410 \u0432\u043c\u0435\u0441\u0442\u043e <code>\/users\/{u}\/posts\/{id}<\/code> \u0432\u044b\u0431\u0435\u0440\u0435\u0442 <code>\/users\/{u}\/posts\/latest<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>\u0414\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u2014 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/strong> \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>GET \/posts\/{id}<\/code> \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 <code>\/posts\/{id}<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c GET \u0438 HEAD, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c \u0441 \u043b\u044e\u0431\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043c\u0435\u043d\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439.<\/p>\n<p>  <\/p>\n<p><strong>\u0414\u043b\u044f \u0445\u043e\u0441\u0442\u043e\u0432 \u2014 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443<\/strong>. \u0414\u043b\u044f \u043d\u0438\u0445 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0442, \u043d\u043e \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d \u0445\u043e\u0441\u0442, \u0430 \u0443 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u2014 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0441 \u0445\u043e\u0441\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><strong>\u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0442, \u043d\u043e \u0441\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439<\/strong>, \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043f\u0430\u043d\u0438\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/posts\/latest<\/code> \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u044b <code>\/posts\/{id}<\/code> \u0438 <code>\/{resource}\/latest<\/code>. \u0412 \u043a\u0430\u043a\u043e\u043c \u0431\u044b \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u044b \u043d\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 <code>\/posts\/latest<\/code> \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u0430\u043d\u0438\u043a\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u043e\u043c \u0434\u0435\u043b\u043e \u043d\u0435 \u0434\u043e\u0439\u0434\u0451\u0442.<\/p>\n<p>  <\/p>\n<h2 id=\"obratnaya-sovmestimost\">\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c<\/h2>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0435 \u043b\u043e\u043c\u0430\u044e\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Go \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438 \u0438 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u043b\u0438 \u0438\u0445 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e, \u0430 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 1.22 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0440\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u0437\u0430\u0434\u0430\u0432 GODEBUG-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f: <code>GODEBUG=httpmuxgo121=1<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u043a\u0430\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Go \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0443 \u0432\u0430\u0441 \u0432 <code>go.mod<\/code>. \u0415\u0441\u043b\u0438 \u0442\u0430\u043c \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0438\u0436\u0435 1.22, \u0442\u043e \u0432\u0435\u0441\u044c \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438, \u0438 \u0432\u0441\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b. \u041f\u043e\u0434\u043d\u044f\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0432 <code>go.mod<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u0440\u0443\u043a\u0430\u043c\u0438, \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>go mod edit -go=1.22.2<\/code> (\u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432\u0430\u0448\u0443 \u0432\u0435\u0440\u0441\u0438\u044e Go).<\/p>\n<p>  <\/p>\n<h3 id=\"poleznye-materialy\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h3>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/go.dev\/doc\/go1.22\">\u0420\u0435\u043b\u0438\u0437 Go 1.22 (\u0431\u043b\u043e\u0433 Go)<\/a><\/li>\n<li><a href=\"https:\/\/go.dev\/blog\/routing-enhancements\">\u041f\u0440\u043e \u043d\u043e\u0432\u044b\u0439 \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0432 Go (\u0431\u043b\u043e\u0433 Go)<\/a><\/li>\n<li><a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f ServeMux (\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f)<\/a><\/li>\n<li><a href=\"https:\/\/tip.golang.org\/doc\/godebug\">\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0432 Go (\u0431\u043b\u043e\u0433 Go)<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/805097\/\"> https:\/\/habr.com\/ru\/articles\/805097\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2024 \u0433\u043e\u0434\u0430 <a href=\"https:\/\/go.dev\/doc\/devel\/release#go1.22.0\">\u0432\u044b\u0448\u0435\u043b Go 1.22<\/a>. \u0412\u043e\u0442, \u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0451\u0441 \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437: \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0446\u0438\u043a\u043b\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 rangefunc-\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u044e\u0441\u044c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c, \u0441\u0430\u043c\u043e\u043c \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u043e\u043c, \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 http-\u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430. <\/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-372641","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372641","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=372641"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372641\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}