{"id":48115,"date":"2025-02-13T14:59:57","date_gmt":"2025-02-13T14:59:57","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=48115"},"modified":"2025-02-14T04:39:09","modified_gmt":"2025-02-14T04:39:09","slug":"go-1-24-released-with-fully-generic-type-aliases-support","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2025\/02\/go-1-24-released-with-fully-generic-type-aliases-support\/","title":{"rendered":"Go 1.24 Released with Fully Generic Type Aliases Support"},"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>After 6 months of development, Go language announced new 1.24 release few days ago on Tuesday.<\/p>\n<p>Go 1.24 now <b>fully supports generic type aliases.<\/b> Type aliases, a concept introduced in Go 1.9, allows to create a new name for an existing type without creating a new type. Previously, it didn&#8217;t support type parameters. But this changed in Go 1.24. See more about <a href=\"https:\/\/medium.com\/@okoanton\/generic-type-aliases-in-go-1-24-what-they-are-and-why-we-need-them-07ca05539500\" target=\"_blank\" rel=\"noopener\">generic type aliases<\/a>.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go124-generic-aliases.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-48116\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go124-generic-aliases.webp\" alt=\"\" width=\"645\" height=\"275\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go124-generic-aliases.webp 645w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go124-generic-aliases-300x128.webp 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p>The feature is enabled by default in Go 1.24, but can be disabled by setting <code>GOEXPERIMENT=noaliastypeparams<\/code>; though the <code>aliastypeparams<\/code> setting will be removed for next Go 1.25.<\/p>\n<p>Go command in the release now has a new <code>-tool<\/code> flag for <code>go get<\/code>, allowing to add a tool directive to the current module for named packages. It also added new <code>tests<\/code> analyzer for <code>go vet<\/code> to report common mistakes in declarations of tests, fuzzers, benchmarks, and examples in test packages<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go-get-tool.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-48118\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go-get-tool-700x351.webp\" alt=\"\" width=\"610\" height=\"306\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go-get-tool-700x351.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go-get-tool-300x150.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/02\/go-get-tool.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Go 1.24 now includes a new set of mechanisms to facilitate FIPS 140-3 compliance. The Go Cryptographic Module is a set of standard library to implement FIPS 140-3 approved algorithms. And, applications require no changes to use it for approved algorithms.<\/p>\n<p>Benchmarks may now use the faster and less error-prone <code>testing.B.Loop<\/code> method to perform benchmark iterations like <code>for b.Loop() { ... }<\/code> in place of the typical loop structures involving <code>b.N<\/code> like <code>for range b.N<\/code>.<\/p>\n<p>There are as well new <code>os.Root<\/code> type provides the ability to perform filesystem operations within a specific directory, and new <code>runtime.AddCleanup<\/code> finalization mechanism that is more flexible, more efficient, and less error-prone than <code>runtime.SetFinalizer<\/code>.<\/p>\n<p>Other changes include <code>go:wasmexport<\/code> compiler directive to export functions to the WebAssembly host, as well as:<\/p>\n<ul>\n<li>Cgo supports new annotations for C functions to improve run time performance.<\/li>\n<li>Cache <code>go run<\/code> created executables and the new behavior of <code>go tool<\/code> into Go build cache.<\/li>\n<li>The objdump tool now supports dissassembly on 64-bit LoongArch (GOARCH=loong64), RISC-V (GOARCH=riscv64), and S390X (GOARCH=s390x).<\/li>\n<li>New weak package provides weak pointers.<\/li>\n<li>New crypto\/mlkem package implements ML-KEM-768 and ML-KEM-1024.<\/li>\n<li>New crypto\/hkdf, crypto\/pbkdf2, and crypto\/sha3 packages.<\/li>\n<li>New experimental testing\/synctest package provides support for testing concurrent code.<\/li>\n<\/ul>\n<p>For more about the new Go 1.24, see the official <a href=\"https:\/\/go.dev\/doc\/go1.24\" rel=\"noopener\" target=\"_blank\">release note<\/a>.<\/p>\n<h3>Get Go 1.24<\/h3>\n<p>Go provides official tarballs for Linux, Windows, macOS, and other supported platform in its website via the link below:<\/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 Linux, simply download the tarball, extract to desired location, and add the go bin folder into PATH, then done. Here&#8217;s a <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2024\/02\/how-to-install-go-golang-1-22-in-ubuntu-22-04\/\" rel=\"noopener\" target=\"_blank\">step by step guide<\/a> shows how to do the trick for Ubuntu.<\/p>","protected":false},"excerpt":{"rendered":"<p>After 6 months of development, Go language announced new 1.24 release few days ago on Tuesday. Go 1.24 now fully supports generic type aliases. Type aliases, a concept introduced in Go 1.9, allows to create a new name for an existing type without creating a new type. Previously, it didn&#8217;t support type parameters. But this [&hellip;]<\/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-48115","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-golang","tag-programming"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/48115","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=48115"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/48115\/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=48115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=48115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=48115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}