
{"id":49468,"date":"2025-08-13T15:57:45","date_gmt":"2025-08-13T15:57:45","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=49468"},"modified":"2025-08-13T15:57:45","modified_gmt":"2025-08-13T15:57:45","slug":"golang-1-25-released-with-new-garbage-collector-new-packages","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2025\/08\/golang-1-25-released-with-new-garbage-collector-new-packages\/","title":{"rendered":"Golang 1.25 Released with New Garbage Collector &#038; New Packages"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-45494\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/02\/go-logo.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>Go programming language released new 1.25 version on Tuesday after another 6 months of development.<\/p>\n<p>The new release introduced new Go command options, runtime and compiler changes, some new packages, and platform changes.<\/p>\n<p><!--more--><\/p>\n<p>The <code>go doc<\/code> command in the release introduced new <code>-http<\/code> option, to start a documentation server showing documentation for the requested object, and open it in the default web browser.<\/p>\n<p><code>go version<\/code> command now has <code>-json<\/code> option that outputs the runtime\/debug.BuildInfo in JSON format.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-version-json.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-49471\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-version-json-700x483.webp\" alt=\"\" width=\"610\" height=\"421\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-version-json-700x483.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-version-json-300x207.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-version-json.webp 746w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>There are as well new <code>go.mod ignore<\/code> directive to specify directories the go command should ignore, and, new <code>work<\/code> package pattern matches all packages in the work modules.<\/p>\n<p>The <code>go vet<\/code> static analysis tool in the release got 2 new analyzers. They are <code>waitgroup<\/code> to check for misuses of sync.WaitGroup, and <code>hostport<\/code> that reports uses of fmt.Sprintf(&#8220;%s:%d&#8221;, host, port) to construct addresses for net.Dial.<\/p>\n<p>Go 1.25 introduced new <b>experimental garbage collector<\/b>, which can be enabled by setting <code>GOEXPERIMENT=greenteagc<\/code> at build time. The new garbage collector improves the performance of marking and scanning small objects, and expects a 10\u201440% reduction in garbage collection overhead cost.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-build-newgarbage-collector.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-49472\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-build-newgarbage-collector.webp\" alt=\"\" width=\"658\" height=\"407\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-build-newgarbage-collector.webp 658w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/08\/go-build-newgarbage-collector-300x186.webp 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/a><\/p>\n<p>The release also changed the default behavior of the GOMAXPROCS. In Linux, it will default to the number of cgroup CPU bandwidth limit if it&#8217;s lower than an the number of logical CPUs available. And, the runtime will periodically updates GOMAXPROCS (on all OSes) if the number of either bandwidth limit or logical CPUs change.<\/p>\n<p>The compiler and linker in Go 1.25 now generate debug information using <b>DWARF 5<\/b>, reducing the space for debugging information as well as the time for linking.<\/p>\n<p>The new Golang release also added new <code>testing\/synctest<\/code> package provides support for testing concurrent code. As well, it introduced an experimental JSON implementation, along with <code>encoding\/json\/v2<\/code> and <code>encoding\/json\/jsontext<\/code> packages.<\/p>\n<p>Other changes include:<\/p>\n<ul>\n<li><code>go build -asan<\/code> now defaults to doing leak detection at program exit.<\/li>\n<li>Support using a subdirectory of a repository as the path for a module root<\/li>\n<li>New API for a lightweight way to capture a runtime execution trace.<\/li>\n<li>Annotate anonymous memory mappings on Linux with Kernel that support it.<\/li>\n<li>New <code>-funcalign=N<\/code> linker option.<\/li>\n<li>Remove the notion of core types in the language specification.<\/li>\n<li>Support <code>plugin<\/code> build mode for Linux on riscv64, and more support on Linux\/loong64.<\/li>\n<li>For mac, requires macOS 12 Monterey or later.<\/li>\n<\/ul>\n<h3>Get Go 1.25<\/h3>\n<p>The official release note for Go 1.25 is available at <a href=\"https:\/\/go.dev\/doc\/go1.25\" target=\"_blank\" rel=\"noopener\">this page<\/a>.<\/p>\n<p>While, the package for Linux, Windows, and macOS are available to download at the link below along with source tarball:<\/p>\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-text-color has-background\" href=\"https:\/\/go.dev\/dl\/\" target=\"_blank\" rel=\"noreferrer noopener\">Download Go<\/a><\/div>\n<\/div>\n<p>For Ubuntu users who are new to Go, see this <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2024\/02\/how-to-install-go-golang-1-22-in-ubuntu-22-04\/\" target=\"_blank\" rel=\"noopener\">step by step guide<\/a> to install the language.<\/p>","protected":false},"excerpt":{"rendered":"<p>Go programming language released new 1.25 version on Tuesday after another 6 months of development. The new release introduced new Go command options, runtime and compiler changes, some new packages, and platform changes.<\/p>\n","protected":false},"author":1,"featured_media":45494,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[2147,2086],"class_list":["post-49468","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-golang","tag-programming"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/49468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=49468"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/49468\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/45494"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=49468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=49468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=49468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}