{"id":367638,"date":"2024-05-21T03:25:13","date_gmt":"2024-05-21T03:25:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=367638"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T03:25:13","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=367638","title":{"rendered":"<span>Go 1.22: \u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043a \u0440\u0435\u043b\u0438\u0437\u0443<\/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><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sl\/rg\/xy\/slrgxynh7zns2zthlhjldphdpyy.png\" alt=\"Go 1.22\" data-src=\"https:\/\/habrastorage.org\/webt\/sl\/rg\/xy\/slrgxynh7zns2zthlhjldphdpyy.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412\u0447\u0435\u0440\u0430 \u0432\u044b\u0448\u0435\u043b Go 1.22, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u043d\u0438\u043c!<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<blockquote><p>\u0425\u0430\u0431\u0440 \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438.<\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"pochinili-schetchik-cikla-v-zamykaniyah\">\u041f\u043e\u0447\u0438\u043d\u0438\u043b\u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0446\u0438\u043a\u043b\u0430 \u0432 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f\u0445<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 for, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0432\u0440\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0432 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.21 values := []int{1, 2, 3, 4, 5} for _, val := range values {     go func() {         fmt.Printf(\"%d \", val)     }() }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">5 5 5 5 5<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22time%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.22%0A%09values+%3A%3D+%5B%5Dint%7B1%2C+2%2C+3%2C+4%2C+5%7D%0A%09for+_%2C+val+%3A%3D+range+values+%7B%0A%09%09go+func%28%29+%7B%0A%09%09%09fmt.Printf%28%22%25d+%22%2C+val%29%0A%09%09%7D%28%29%0A%09%7D%0A%0A%09%2F%2F+%D0%B4%D0%BB%D1%8F+%D0%BA%D1%80%D0%B0%D1%82%D0%BA%D0%BE%D1%81%D1%82%D0%B8+%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%BE+WaitGroup%0A%09time.Sleep%2850+*+time.Millisecond%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0412 Go 1.22 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0446\u0438\u043a\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0431\u0430\u0433\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.22 values := []int{1, 2, 3, 4, 5} for _, val := range values {     go func() {         fmt.Printf(\"%d \", val)     }() }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">5 1 2 3 4<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22time%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.22%0A%09values+%3A%3D+%5B%5Dint%7B1%2C+2%2C+3%2C+4%2C+5%7D%0A%09for+_%2C+val+%3A%3D+range+values+%7B%0A%09%09go+func%28%29+%7B%0A%09%09%09fmt.Printf%28%22%25d+%22%2C+val%29%0A%09%09%7D%28%29%0A%09%7D%0A%0A%09%2F%2F+%D0%B4%D0%BB%D1%8F+%D0%BA%D1%80%D0%B0%D1%82%D0%BA%D0%BE%D1%81%D1%82%D0%B8+%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%BE+WaitGroup%0A%09time.Sleep%2850+*+time.Millisecond%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <em>\u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e<\/em>: \u043d\u043e\u0432\u0430\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e 1.22 \u0432 <code>go.mod<\/code>. \u0422\u0430\u043a \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u043e\u043a\u0430 \u0432\u044b \u0441\u0430\u043c\u0438 \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"iterirovanie-po-chislam\">\u0418\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0447\u0438\u0441\u043b\u0430\u043c<\/h2>\n<p>  <\/p>\n<p>\u0426\u0438\u043a\u043b for range \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u043c\u0435\u0435\u0442 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0443 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">for i := range 10 {     fmt.Print(10 - i, \" \") } fmt.Println() fmt.Println(\"go1.22 has lift-off!\")<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">10 9 8 7 6 5 4 3 2 1 go1.22 has lift-off!<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%22fmt%22%0A%0Afunc+main%28%29+%7B%0A%09for+i+%3A%3D+range+10+%7B%0A%09%09fmt.Print%2810-i%2C+%22+%22%29%0A%09%7D%0A%09fmt.Println%28%29%0A%09fmt.Println%28%22go1.22+has+lift-off%21%22%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 <a href=\"https:\/\/tip.golang.org\/ref\/spec#For_range\" rel=\"nofollow noopener noreferrer\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 <a href=\"https:\/\/go.dev\/wiki\/RangefuncExperiment\" rel=\"nofollow noopener noreferrer\">\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c<\/a>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0444\u043b\u0430\u0433 <code>GOEXPERIMENT=rangefunc<\/code> \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"novyy-paket-mathrandv2\">\u041d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 math\/rand\/v2<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 v2-\u043f\u0430\u043a\u0435\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435: <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/\" rel=\"nofollow noopener noreferrer\"><code>math\/rand\/v2<\/code><\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/\" rel=\"nofollow noopener noreferrer\"><code>math\/rand<\/code><\/a> \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/golang\/go\/issues\/61716\" rel=\"nofollow noopener noreferrer\">#61716<\/a>. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 Go \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435 (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432 Go 1.23).<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<h3 id=\"bolshe-net-metoda-read\">\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 Read<\/h3>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>Read<\/code>, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c \u0435\u0449\u0435 \u0432 <code>math\/rand<\/code>, \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u043b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 <code>math\/rand\/v2<\/code> (\u0432 <code>math\/rand<\/code> \u043e\u043d \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d). \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/tip.golang.org\/pkg\/crypto\/rand\/#Read\" rel=\"nofollow noopener noreferrer\"><code>Read<\/code><\/a> \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 <code>crypto\/rand<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">package main  import (     \"crypto\/rand\"     \"fmt\" )  func main() {     b := make([]byte, 5)     _, err := rand.Read(b)     if err != nil {         panic(err)     }     fmt.Printf(\"5 random bytes: %v\\n\", b) }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">5 random bytes: [245 181 23 109 149]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22crypto%2Frand%22%0A%09%22fmt%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09b+%3A%3D+make%28%5B%5Dbyte%2C+5%29%0A%09_%2C+err+%3A%3D+rand.Read%28b%29%0A%09if+err+%21%3D+nil+%7B%0A%09%09panic%28err%29%0A%09%7D%0A%09fmt.Printf%28%225+random+bytes%3A+%25v%5Cn%22%2C+b%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u041b\u0438\u0431\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 <code>Read<\/code> \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Uint64<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">package main  import (     \"fmt\"     \"math\/rand\/v2\" )  func Read(p []byte) (n int, err error) {     for i := 0; i &lt; len(p); {         val := rand.Uint64()         for j := 0; j &lt; 8 &amp;&amp; i &lt; len(p); j++ {             p[i] = byte(val &amp; 0xff)             val >>= 8             i++         }     }     return len(p), nil }  func main() {     b := make([]byte, 5)     Read(b)     fmt.Printf(\"5 random bytes: %v\\n\", b) }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">5 random bytes: [135 25 55 202 33]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22math%2Frand%2Fv2%22%0A%29%0A%0Afunc+Read%28p+%5B%5Dbyte%29+%28n+int%2C+err+error%29+%7B%0A%09for+i+%3A%3D+0%3B+i+%3C+len%28p%29%3B+%7B%0A%09%09val+%3A%3D+rand.Uint64%28%29%0A%09%09for+j+%3A%3D+0%3B+j+%3C+8+%26%26+i+%3C+len%28p%29%3B+j%2B%2B+%7B%0A%09%09%09p%5Bi%5D+%3D+byte%28val+%26+0xff%29%0A%09%09%09val+%3E%3E%3D+8%0A%09%09%09i%2B%2B%0A%09%09%7D%0A%09%7D%0A%09return+len%28p%29%2C+nil%0A%7D%0A%0Afunc+main%28%29+%7B%0A%09b+%3A%3D+make%28%5B%5Dbyte%2C+5%29%0A%09Read%28b%29%0A%09fmt.Printf%28%225+random+bytes%3A+%25v%5Cn%22%2C+b%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<h3 id=\"obobschennaya-n-funkciya\">\u041e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u0430\u044f N-\u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u0430\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a-\u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#N\" rel=\"nofollow noopener noreferrer\"><code>N<\/code><\/a> \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#Int64N\" rel=\"nofollow noopener noreferrer\"><code>Int64N<\/code><\/a> \u0438\u043b\u0438 <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#Uint64N\" rel=\"nofollow noopener noreferrer\"><code>Uint64N<\/code><\/a>, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043b\u044e\u0431\u044b\u043c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">{     \/\/ random integer     var max int = 100     n := rand.N(max)     fmt.Println(\"integer n =\", n) }  {     \/\/ random unsigned integer     var max uint = 100     n := rand.N(max)     fmt.Println(\"unsigned int n =\", n) }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">integer n = 55 unsigned int n = 96<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22math%2Frand%2Fv2%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%7B%0A%09%09%2F%2F+random+integer%0A%09%09var+max+int+%3D+100%0A%09%09n+%3A%3D+rand.N%28max%29%0A%09%09fmt.Println%28%22integer+n+%3D%22%2C+n%29%0A%09%7D%0A%0A%09%7B%0A%09%09%2F%2F+random+unsigned+integer%0A%09%09var+max+uint+%3D+100%0A%09%09n+%3A%3D+rand.N%28max%29%0A%09%09fmt.Println%28%22unsigned+int+n+%3D%22%2C+n%29%0A%09%7D%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441 <code>time.Duration<\/code> \u0442\u043e\u0436\u0435 (\u043e\u043d \u0432\u0435\u0434\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 <code>int64<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ random duration max := 100*time.Millisecond n := rand.N(max) fmt.Println(\"duration n =\", n)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">duration n = 78.949532ms<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22math%2Frand%2Fv2%22%0A%09%22time%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+random+duration%0A%09max+%3A%3D+100+*+time.Millisecond%0A%09n+%3A%3D+rand.N%28max%29%0A%09fmt.Println%28%22duration+n+%3D%22%2C+n%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<h3 id=\"ispravleny-nazvaniya\">\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 <code>math\/rand<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Intn  Int31  Int31n  Int63  Int64n<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043a \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u043c\u0443 \u0432 Go \u0432\u0438\u0434\u0443 \u0432 <code>math\/rand\/v2<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">IntN  Int32  Int32N  Int64  Int64N<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"go\">fmt.Println(\"IntN   =\", rand.IntN(100)) fmt.Println(\"Int32  =\", rand.Int32()) fmt.Println(\"Int32N =\", rand.Int32N(100)) fmt.Println(\"Int64  =\", rand.Int64()) fmt.Println(\"Int64N =\", rand.Int64N(100))<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">IntN   = 48 Int32  = 925068909 Int32N = 11 Int64  = 4225327687323893784 Int64N = 73<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22math%2Frand%2Fv2%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09fmt.Println%28%22IntN+++%3D%22%2C+rand.IntN%28100%29%29%0A%09fmt.Println%28%22Int32++%3D%22%2C+rand.Int32%28%29%29%0A%09fmt.Println%28%22Int32N+%3D%22%2C+rand.Int32N%28100%29%29%0A%09fmt.Println%28%22Int64++%3D%22%2C+rand.Int64%28%29%29%0A%09fmt.Println%28%22Int64N+%3D%22%2C+rand.Int64N%28100%29%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043e\u0434\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">UintN  Uint32  Uint32N  Uint64  Uint64N<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"go\">fmt.Println(\"UintN   =\", rand.UintN(100)) fmt.Println(\"Uint32  =\", rand.Uint32()) fmt.Println(\"Uint32N =\", rand.Uint32N(100)) fmt.Println(\"Uint64  =\", rand.Uint64()) fmt.Println(\"Uint64N =\", rand.Uint64N(100))<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">UintN   = 46 Uint32  = 2549858040 Uint32N = 97 Uint64  = 3964182289933687247 Uint64N = 9<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22math%2Frand%2Fv2%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09fmt.Println%28%22UintN+++%3D%22%2C+rand.UintN%28100%29%29%0A%09fmt.Println%28%22Uint32++%3D%22%2C+rand.Uint32%28%29%29%0A%09fmt.Println%28%22Uint32N+%3D%22%2C+rand.Uint32N%28100%29%29%0A%09fmt.Println%28%22Uint64++%3D%22%2C+rand.Uint64%28%29%29%0A%09fmt.Println%28%22Uint64N+%3D%22%2C+rand.Uint64N%28100%29%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<h3 id=\"i-esche-vsyakoe\">\u0418 \u0435\u0449\u0435 \u0432\u0441\u044f\u043a\u043e\u0435<\/h3>\n<p>  <\/p>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0430\u043a\u0435\u0442\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 API \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0435\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0441\u0442\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u043e\u0434\u0435 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 <code>math\/rand<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 LFSR (Mitchell &amp; Reeds LFSR), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/#Source\" rel=\"nofollow noopener noreferrer\"><code>Source<\/code><\/a>, \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 \u0434\u0432\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#ChaCha8\" rel=\"nofollow noopener noreferrer\"><code>ChaCha8<\/code><\/a> and <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#PCG\" rel=\"nofollow noopener noreferrer\"><code>PCG<\/code><\/a>. ChaCha8 \u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u043e\u0439\u043a\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0439 \u043f\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0441 PCG.<\/p>\n<p>  <\/p>\n<p>ChaCha8 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 <code>math\/rand\/v2<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 <code>math\/rand<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u044f\u0432\u043d\u043e \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. \u0421\u0430\u043c\u0430 \u0441\u0440\u0435\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Go \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ChaCha8.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <a href=\"https:\/\/tip.golang.org\/pkg\/math\/rand\/v2\/#Source\" rel=\"nofollow noopener noreferrer\"><code>Source<\/code><\/a> \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Uint64<\/code>; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>Source64<\/code> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<h2 id=\"uluchshennye-shablony-routinga\">\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430<\/h2>\n<p>  <\/p>\n<p>HTTP-\u043c\u0430\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0441\u0442\u0430\u043b\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439. \u0428\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/tip.golang.org\/pkg\/net\/http#ServeMux\" rel=\"nofollow noopener noreferrer\"><code>net\/http.ServeMux<\/code><\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 HTTP-\u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>POST \/items\/create<\/code>), \u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \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. \u0428\u0430\u0431\u043b\u043e\u043d \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u0447\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0435\u0437 \u043d\u0435\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">mux.HandleFunc(\"POST \/items\/create\", func(w http.ResponseWriter, r *http.Request) {     fmt.Fprint(w, \"POST item created\") })  mux.HandleFunc(\"\/items\/create\", func(w http.ResponseWriter, r *http.Request) {     fmt.Fprint(w, \"item created\") })  {     \/\/ uses POST route     resp, _ := http.Post(server.URL+\"\/items\/create\", \"text\/plain\", nil)     body, _ := io.ReadAll(resp.Body)     fmt.Println(\"POST \/items\/create:\", string(body))     resp.Body.Close() }  {     \/\/ uses generic route     resp, _ := http.Get(server.URL+\"\/items\/create\")     body, _ := io.ReadAll(resp.Body)     fmt.Println(\"GET \/items\/create:\", string(body))     resp.Body.Close() }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">POST \/items\/create: POST item created GET \/items\/create: item created<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22io%22%0A%09%22net%2Fhttp%22%0A%09%22net%2Fhttp%2Fhttptest%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09mux+%3A%3D+http.NewServeMux%28%29%0A%0A%09server+%3A%3D+httptest.NewServer%28mux%29%0A%09defer+server.Close%28%29%0A%0A%09mux.HandleFunc%28%22POST+%2Fitems%2Fcreate%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09fmt.Fprint%28w%2C+%22POST+item+created%22%29%0A%09%7D%29%0A%0A%09mux.HandleFunc%28%22%2Fitems%2Fcreate%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09fmt.Fprint%28w%2C+%22item+created%22%29%0A%09%7D%29%0A%0A%09%7B%0A%09%09%2F%2F+uses+POST+route%0A%09%09resp%2C+_+%3A%3D+http.Post%28server.URL%2B%22%2Fitems%2Fcreate%22%2C+%22text%2Fplain%22%2C+nil%29%0A%09%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09%09fmt.Println%28%22POST+%2Fitems%2Fcreate%3A%22%2C+string%28body%29%29%0A%09%09resp.Body.Close%28%29%0A%09%7D%0A%0A%09%7B%0A%09%09%2F%2F+uses+generic+route%0A%09%09resp%2C+_+%3A%3D+http.Get%28server.URL+%2B+%22%2Fitems%2Fcreate%22%29%0A%09%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09%09fmt.Println%28%22GET+%2Fitems%2Fcreate%3A%22%2C+string%28body%29%29%0A%09%09resp.Body.Close%28%29%0A%09%7D%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c: \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043b\u044f <code>GET<\/code> \u0437\u0430\u043e\u0434\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0435\u0433\u043e \u0438 \u0434\u043b\u044f <code>HEAD<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/items\/{id}<\/code>) \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b URL. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/tip.golang.org\/pkg\/net\/http#Request.PathValue\" rel=\"nofollow noopener noreferrer\"><code>Request.PathValue<\/code><\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">mux.HandleFunc(\"\/items\/{id}\", func(w http.ResponseWriter, r *http.Request) {     id := r.PathValue(\"id\")     fmt.Fprintf(w, \"Item ID = %s\", id) })  req, _ := http.NewRequest(\"GET\", server.URL+\"\/items\/12345\", nil) resp, _ := http.DefaultClient.Do(req) body, _ := io.ReadAll(resp.Body) fmt.Println(\"GET \/items\/12345:\", string(body)) resp.Body.Close()<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">GET \/items\/{id}: Item ID: 12345<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22io%22%0A%09%22net%2Fhttp%22%0A%09%22net%2Fhttp%2Fhttptest%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09mux+%3A%3D+http.NewServeMux%28%29%0A%0A%09server+%3A%3D+httptest.NewServer%28mux%29%0A%09defer+server.Close%28%29%0A%0A%09mux.HandleFunc%28%22%2Fitems%2F%7Bid%7D%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09id+%3A%3D+r.PathValue%28%22id%22%29%0A%09%09fmt.Fprintf%28w%2C+%22Item+ID+%3D+%25s%22%2C+id%29%0A%09%7D%29%0A%0A%09req%2C+_+%3A%3D+http.NewRequest%28%22GET%22%2C+server.URL%2B%22%2Fitems%2F12345%22%2C+nil%29%0A%09resp%2C+_+%3A%3D+http.DefaultClient.Do%28req%29%0A%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09fmt.Println%28%22GET+%2Fitems%2F12345%3A%22%2C+string%28body%29%29%0A%09resp.Body.Close%28%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u043c\u043d\u043e\u0433\u043e\u0442\u043e\u0447\u0438\u0435\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/files\/{path...}<\/code>). \u0412 \u043d\u0435\u0435 \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u00ab\u0445\u0432\u043e\u0441\u0442\u00bb URL:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">mux.HandleFunc(\"\/files\/{path...}\", func(w http.ResponseWriter, r *http.Request) {     path := r.PathValue(\"path\")     fmt.Fprintf(w, \"File path = %s\", path) })  req, _ := http.NewRequest(\"GET\", server.URL+\"\/files\/a\/b\/c\", nil) resp, _ := http.DefaultClient.Do(req) body, _ := io.ReadAll(resp.Body) fmt.Println(\"GET \/files\/a\/b\/c:\", string(body)) resp.Body.Close()<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">GET \/files\/{path...}: File path: a\/b\/c<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22io%22%0A%09%22net%2Fhttp%22%0A%09%22net%2Fhttp%2Fhttptest%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09mux+%3A%3D+http.NewServeMux%28%29%0A%0A%09server+%3A%3D+httptest.NewServer%28mux%29%0A%09defer+server.Close%28%29%0A%0A%09mux.HandleFunc%28%22%2Ffiles%2F%7Bpath...%7D%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09path+%3A%3D+r.PathValue%28%22path%22%29%0A%09%09fmt.Fprintf%28w%2C+%22File+path+%3D+%25s%22%2C+path%29%0A%09%7D%29%0A%0A%09req%2C+_+%3A%3D+http.NewRequest%28%22GET%22%2C+server.URL%2B%22%2Ffiles%2Fa%2Fb%2Fc%22%2C+nil%29%0A%09resp%2C+_+%3A%3D+http.DefaultClient.Do%28req%29%0A%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09fmt.Println%28%22GET+%2Ffiles%2Fa%2Fb%2Fc%3A%22%2C+string%28body%29%29%0A%09resp.Body.Close%28%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>\/<\/code> \u2014 \u043e\u043d \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u043c URL (\u0442\u0430\u043a \u0431\u044b\u043b\u043e \u0438 \u0440\u0430\u043d\u044c\u0448\u0435). \u0427\u0442\u043e\u0431\u044b \u0448\u0430\u0431\u043b\u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u043d\u043e\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 (\u043d\u0435 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043d\u043e) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>{$}<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/exact\/match\/{$}<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">mux.HandleFunc(\"\/exact\/match\/{$}\", func(w http.ResponseWriter, r *http.Request) {     fmt.Fprint(w, \"exact match\") })  mux.HandleFunc(\"\/exact\/match\/\", func(w http.ResponseWriter, r *http.Request) {     fmt.Fprint(w, \"prefix match\") })  {     \/\/ exact match     req, _ := http.NewRequest(\"GET\", server.URL+\"\/exact\/match\/\", nil)     resp, _ := http.DefaultClient.Do(req)     body, _ := io.ReadAll(resp.Body)     fmt.Println(\"GET \/exact\/match\/:\", string(body))     resp.Body.Close() }  {     \/\/ prefix match     req, _ := http.NewRequest(\"GET\", server.URL+\"\/exact\/match\/123\", nil)     resp, _ := http.DefaultClient.Do(req)     body, _ := io.ReadAll(resp.Body)     fmt.Println(\"GET \/exact\/match\/123:\", string(body))     resp.Body.Close() }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">GET \/exact\/match\/: exact match GET \/exact\/match\/123: prefix match<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22io%22%0A%09%22net%2Fhttp%22%0A%09%22net%2Fhttp%2Fhttptest%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09mux+%3A%3D+http.NewServeMux%28%29%0A%0A%09server+%3A%3D+httptest.NewServer%28mux%29%0A%09defer+server.Close%28%29%0A%0A%09mux.HandleFunc%28%22%2Fexact%2Fmatch%2F%7B%24%7D%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09fmt.Fprint%28w%2C+%22exact+match%22%29%0A%09%7D%29%0A%0A%09mux.HandleFunc%28%22%2Fexact%2Fmatch%2F%22%2C+func%28w+http.ResponseWriter%2C+r+*http.Request%29+%7B%0A%09%09fmt.Fprint%28w%2C+%22prefix+match%22%29%0A%09%7D%29%0A%0A%09%7B%0A%09%09%2F%2F+exact+match%0A%09%09req%2C+_+%3A%3D+http.NewRequest%28%22GET%22%2C+server.URL%2B%22%2Fexact%2Fmatch%2F%22%2C+nil%29%0A%09%09resp%2C+_+%3A%3D+http.DefaultClient.Do%28req%29%0A%09%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09%09fmt.Println%28%22GET+%2Fexact%2Fmatch%2F%3A%22%2C+string%28body%29%29%0A%09%09resp.Body.Close%28%29%0A%09%7D%0A%0A%09%7B%0A%09%09%2F%2F+prefix+match%0A%09%09req%2C+_+%3A%3D+http.NewRequest%28%22GET%22%2C+server.URL%2B%22%2Fexact%2Fmatch%2F123%22%2C+nil%29%0A%09%09resp%2C+_+%3A%3D+http.DefaultClient.Do%28req%29%0A%09%09body%2C+_+%3A%3D+io.ReadAll%28resp.Body%29%0A%09%09fmt.Println%28%22GET+%2Fexact%2Fmatch%2F123%3A%22%2C+string%28body%29%29%0A%09%09resp.Body.Close%28%29%0A%09%7D%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439. \u0415\u0441\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u043e\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0442 (\u0431\u0443\u0434\u0435\u0442 \u043f\u0430\u043d\u0438\u043a\u0430). \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0440\u043e\u043b\u0438 \u043d\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 (\u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435).<\/p>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0435 \u0441\u043b\u0435\u0433\u043a\u0430 \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 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 <code>{}<\/code>). \u041c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0430\u0440\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0437\u0430\u0434\u0430\u0432 <a href=\"https:\/\/tip.golang.org\/doc\/godebug\" rel=\"nofollow noopener noreferrer\"><code>GODEBUG<\/code><\/a>-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>httpmuxgo121=1<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"srezy\">\u0421\u0440\u0435\u0437\u044b<\/h2>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/tip.golang.org\/pkg\/slices#Concat\" rel=\"nofollow noopener noreferrer\"><code>Concat<\/code><\/a> \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0435\u0437\u043e\u0432 \u0432 \u043e\u0434\u0438\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">s1 := []int{1, 2} s2 := []int{3, 4} s3 := []int{5, 6} res := slices.Concat(s1, s2, s3) fmt.Println(res)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[1 2 3 4 5 6]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09s1+%3A%3D+%5B%5Dint%7B1%2C+2%7D%0A%09s2+%3A%3D+%5B%5Dint%7B3%2C+4%7D%0A%09s3+%3A%3D+%5B%5Dint%7B5%2C+6%7D%0A%09res+%3A%3D+slices.Concat%28s1%2C+s2%2C+s3%29%0A%09fmt.Println%28res%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0440\u0435\u0437\u0430 (<a href=\"https:\/\/tip.golang.org\/pkg\/slices#Delete\" rel=\"nofollow noopener noreferrer\"><code>Delete<\/code><\/a>, <a href=\"https:\/\/tip.golang.org\/pkg\/slices#DeleteFunc\" rel=\"nofollow noopener noreferrer\"><code>DeleteFunc<\/code><\/a>, <a href=\"https:\/\/tip.golang.org\/pkg\/slices#Compact\" rel=\"nofollow noopener noreferrer\"><code>Compact<\/code><\/a>, <a href=\"https:\/\/tip.golang.org\/pkg\/slices#CompactFunc\" rel=\"nofollow noopener noreferrer\"><code>CompactFunc<\/code><\/a> \u0438 <a href=\"https:\/\/tip.golang.org\/pkg\/slices#Replace\" rel=\"nofollow noopener noreferrer\"><code>Replace<\/code><\/a>) \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u043d\u0443\u043b\u044f\u044e\u0442 \u00ab\u0445\u0432\u043e\u0441\u0442\u00bb \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0434 \u0441\u0440\u0435\u0437\u043e\u043c (\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u043e\u0439 \u0441\u0440\u0435\u0437\u0430). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u2014 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/golang\/go\/issues\/63393\" rel=\"nofollow noopener noreferrer\">#63393<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0440\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>src<\/code> \u043f\u043e\u0441\u043b\u0435 <code>Delete<\/code>):<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.21 src := []int{11, 12, 13, 14} \/\/ delete #1 and #2 mod := slices.Delete(src, 1, 3) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">src: [11 14 13 14] mod: [11 14]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.21%0A%09src+%3A%3D+%5B%5Dint%7B11%2C+12%2C+13%2C+14%7D%0A%09%2F%2F+delete+%231+and+%232%0A%09mod+%3A%3D+slices.Delete%28src%2C+1%2C+3%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.22 src := []int{11, 12, 13, 14} \/\/ delete #1 and #2 mod := slices.Delete(src, 1, 3) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">src: [11 14 0 0] mod: [11 14]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.22%0A%09src+%3A%3D+%5B%5Dint%7B11%2C+12%2C+13%2C+14%7D%0A%09%2F%2F+delete+%231+and+%232%0A%09mod+%3A%3D+slices.Delete%28src%2C+1%2C+3%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <code>Compact<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">src := []int{11, 12, 12, 12, 15} mod := slices.Compact(src) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">src: [11 12 15 0 0] mod: [11 12 15]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09src+%3A%3D+%5B%5Dint%7B11%2C+12%2C+12%2C+12%2C+15%7D%0A%09mod+%3A%3D+slices.Compact%28src%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <code>Replace<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">src := []int{11, 12, 13, 14} \/\/ replace #1 and #2 with 99 mod := slices.Replace(src, 1, 3, 99) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">src: [11 99 14 0] mod: [11 99 14]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09src+%3A%3D+%5B%5Dint%7B11%2C+12%2C+13%2C+14%7D%0A%09%2F%2F+replace+%231+and+%232+with+99%0A%09mod+%3A%3D+slices.Replace%28src%2C+1%2C+3%2C+99%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/tip.golang.org\/pkg\/slices#Insert\" rel=\"nofollow noopener noreferrer\"><code>Insert<\/code><\/a> \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442, \u0435\u0441\u043b\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>i<\/code> \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0441\u0440\u0435\u0437\u0430. \u0420\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u043f\u0430\u043d\u0438\u043a\u043e\u0432\u0430\u043b, \u0435\u0441\u043b\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.21 src := []string{\"alice\", \"bob\", \"cindy\"} \/\/ we are not actually inserting anything, \/\/ so don't panic mod := slices.Insert(src, 4) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">src: [alice bob cindy] mod: [alice bob cindy]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.21%0A%09src+%3A%3D+%5B%5Dstring%7B%22alice%22%2C+%22bob%22%2C+%22cindy%22%7D%0A%09%2F%2F+we+are+not+actually+inserting+anything%2C%0A%09%2F%2F+but+it+panics+anyway+because+4+is+out+of+range%0A%09mod+%3A%3D+slices.Insert%28src%2C+4%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0430\u043d\u0438\u043a\u0443\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ go 1.22 src := []string{\"alice\", \"bob\", \"cindy\"} \/\/ we are not actually inserting anything, \/\/ but it panics anyway because 4 is out of range mod := slices.Insert(src, 4) fmt.Println(\"src:\", src) fmt.Println(\"mod:\", mod)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">panic: runtime error: slice bounds out of range [4:3]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/codapi.org\/embed\/?sandbox=go%3Adev&amp;autorun=true&amp;code=package+main%0A%0Aimport+%28%0A%09%22fmt%22%0A%09%22slices%22%0A%29%0A%0Afunc+main%28%29+%7B%0A%09%2F%2F+go+1.22%0A%09src+%3A%3D+%5B%5Dstring%7B%22alice%22%2C+%22bob%22%2C+%22cindy%22%7D%0A%09%2F%2F+we+are+not+actually+inserting+anything%2C%0A%09%2F%2F+but+it+panics+anyway+because+4+is+out+of+range%0A%09mod+%3A%3D+slices.Insert%28src%2C+4%29%0A%09fmt.Println%28%22src%3A%22%2C+src%29%0A%09fmt.Println%28%22mod%3A%22%2C+mod%29%0A%7D\" rel=\"nofollow noopener noreferrer\">\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u25b6<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"prochie-izmeneniya\">\u041f\u0440\u043e\u0447\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<h3 id=\"standartnaya-biblioteka\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#minor_library_changes\" rel=\"nofollow noopener noreferrer\">\u043c\u0435\u043b\u043e\u0447\u0435\u0439<\/a> \u0432 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"tuling\">\u0422\u0443\u043b\u0438\u043d\u0433<\/h3>\n<p>  <\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#go-command\" rel=\"nofollow noopener noreferrer\">go<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430\u0445 (workspaces) \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>vendor<\/code> \u0434\u043b\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/li>\n<li><code>go get<\/code> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435 <code>GOPATH<\/code>.<\/li>\n<li><code>go mod init<\/code> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 (\u0432\u0440\u043e\u0434\u0435 <code>Gopkg.lock<\/code>).<\/li>\n<li><code>go test -cover<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#trace\" rel=\"nofollow noopener noreferrer\">trace<\/a>: \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>  <\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#vet\" rel=\"nofollow noopener noreferrer\">vet<\/a>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u043e\u0432\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0434\u043b\u044f <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#vet-loopclosure\" rel=\"nofollow noopener noreferrer\">\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0446\u0438\u043a\u043b\u0430<\/a>.<\/li>\n<li>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#vet-appends\" rel=\"nofollow noopener noreferrer\">append<\/a> \u0431\u0435\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/li>\n<li>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f defer <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#vet-defers\" rel=\"nofollow noopener noreferrer\">time.Since<\/a>.<\/li>\n<li>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <a href=\"https:\/\/tip.golang.org\/doc\/go1.22#vet-slog\" rel=\"nofollow noopener noreferrer\">log\/slog<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"sreda-ispolneniya\">\u0421\u0440\u0435\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0442\u0438\u043f\u0435 (\u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u0443\u0441\u043e\u0440\u0430) \u0431\u043b\u0438\u0436\u0435 \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043a\u0443\u0447\u0438. \u042d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c CPU (latency \u0438\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c) \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 1\u20133%.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043e\u0434\u043d\u043e \u044d\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 1% (\u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0435-\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<p>  <\/p>\n<h3 id=\"kompilyator\">\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440<\/h3>\n<p>  <\/p>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044e (PGO) \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0447\u0435\u043c \u0440\u0430\u043d\u044c\u0448\u0435. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438\u0437 \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 2-14% \u043f\u043e\u0441\u043b\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f PGO.<\/p>\n<p>  <\/p>\n<h2 id=\"rezyume\">\u0420\u0435\u0437\u044e\u043c\u0435<\/h2>\n<p>  <\/p>\n<p>Go 1.22 \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043e\u0441\u0430\u0434\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0446\u0438\u043a\u043b\u0430, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u043b\u043e \u043d\u0435 \u043e\u0434\u043d\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0438\u0441\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0445 Go-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u041d\u043e\u0432\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0441\u044b\u043f\u0430\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430 \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u0447\u0438\u0441\u043b\u0430\u043c, \u043f\u0440\u0438\u043d\u0435\u0441 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0432 HTTP-\u0440\u043e\u0443\u0442\u0438\u043d\u0433. \u0418 \u043f\u0440\u0438\u043d\u0435\u0441 \u0435\u0449\u0435 \u0442\u043e\u043d\u043d\u0443 \u043c\u0435\u043b\u043a\u0438\u0445 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439, \u043a\u043e\u043d\u0435\u0447\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437!<\/p>\n<p>  <\/p>\n<p><em>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0448\u0442\u0443\u043a \u043d\u0430 Go \u2014 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/thank_go\" rel=\"nofollow noopener noreferrer\"><strong>@thank_go<\/strong><\/a><\/em><\/p>\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\/792242\/\"> https:\/\/habr.com\/ru\/articles\/792242\/<\/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><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sl\/rg\/xy\/slrgxynh7zns2zthlhjldphdpyy.png\" alt=\"Go 1.22\" data-src=\"https:\/\/habrastorage.org\/webt\/sl\/rg\/xy\/slrgxynh7zns2zthlhjldphdpyy.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412\u0447\u0435\u0440\u0430 \u0432\u044b\u0448\u0435\u043b Go 1.22, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u043d\u0438\u043c!<\/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-367638","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367638","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=367638"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/367638\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}