サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Pixel 9
go.dev
The Go Blog Range Over Function Types Ian Lance Taylor 20 August 2024 Introduction This is the blog post version of my talk at GopherCon 2024. Range over function types is a new language feature in the Go 1.23 release. This blog post will explain why we are adding this new feature, what exactly it is, and how to use it. Why? Since Go 1.18 we’ve had the ability to write new generic container types
The Go Blog Secure Randomness in Go 1.22 Russ Cox and Filippo Valsorda 2 May 2024 Computers aren’t random. On the contrary, hardware designers work very hard to make sure computers run every program the same way every time. So when a program does need random numbers, that requires extra effort. Traditionally, computer scientists and programming languages have distinguished between two different ki
The Go Blog Evolving the Go Standard Library with math/rand/v2 Russ Cox 1 May 2024 Since Go 1 was released in March 2012, changes to the standard library have been constrained by Go’s compatibility promise. Overall, compatibility has been a boon for Go users, providing a stable base for production systems, documentation, tutorials, books, and more. Over time, however, we’ve realized mistakes in th
The Go Blog More powerful Go execution traces Michael Knyszek 14 March 2024 The runtime/trace package contains a powerful tool for understanding and troubleshooting Go programs. The functionality within allows one to produce a trace of each goroutine’s execution over some time period. With the go tool trace command (or the excellent open source gotraceui tool), one may then visualize and explore t
The Go Blog Go 1.22 is released! Eli Bendersky, on behalf of the Go team 6 February 2024 Today the Go team is thrilled to release Go 1.22, which you can get by visiting the download page. Go 1.22 comes with several important new features and improvements. Here are some of the notable changes; for the full list, refer to the release notes. Language changes The long-standing “for” loop gotcha with a
Introduction to Go 1.22 The latest Go release, version 1.22, arrives six months after Go 1.21. Most of its changes are in the implementation of the toolchain, runtime, and libraries. As always, the release maintains the Go 1 promise of compatibility. We expect almost all Go programs to continue to compile and run as before. Changes to the language Go 1.22 makes two changes to “for” loops. Previous
Alan Donovan 12 December 2023 Functions that are part of your project’s source code but can never be reached in any execution are called “dead code”, and they exert a drag on codebase maintenance efforts. Today we’re pleased to share a tool named deadcode to help you identify them. $ go install golang.org/x/tools/cmd/deadcode@latest $ deadcode -help The deadcode command reports unreachable functio
The Go Blog Deconstructing Type Parameters Ian Lance Taylor 26 September 2023 slices package function signatures The slices.Clone function is pretty simple: it makes a copy of a slice of any type. func Clone[S ~[]E, E any](s S) S { return append(s[:0:0], s...) } This works because appending to a slice with zero capacity will allocate a new backing array. The function body winds up being shorter th
A common question developers new to Go have is “How do I organize my Go project?”, in terms of the layout of files and folders. The goal of this document is to provide some guidelines that will help answer this question. To make the most of this document, make sure you’re familiar with the basics of Go modules by reading the tutorial and managing module source. Go projects can include packages, co
David Chase and Russ Cox 19 September 2023 Go 1.21 includes a preview of a change to for loop scoping that we plan to ship in Go 1.22, removing one of the most common Go mistakes. The Problem If you’ve written any amount of Go code, you’ve probably made the mistake of keeping a reference to a loop variable past the end of its iteration, at which point it takes on a new value that you didn’t want.
Johan Brandhorst-Satzkorn, Julien Fabre, Damian Gryski, Evan Phoenix, and Achille Roussel 13 September 2023 Go 1.21 adds a new port targeting the WASI preview 1 syscall API through the new GOOS value wasip1. This port builds on the existing WebAssembly port introduced in Go 1.11. What is WebAssembly? WebAssembly (Wasm) is a binary instruction format originally designed for the web. It represents a
Across these repos, the savings average around 75%, but memory reductions are non-linear: as projects get larger, so does the relative decrease in memory usage. We’ll explain this in more detail below. Gopls and the evolving Go ecosystem Gopls provides language-agnostic editors with IDE-like features such as auto-completion, formatting, cross-references, and refactoring. Since its beginnings in 20
Michael Pratt 5 September 2023 Earlier in 2023, Go 1.20 shipped a preview of profile-guided optimization (PGO) for users to test. After addressing known limitations in the preview, and with additional refinements thanks to community feedback and contributions, PGO support in Go 1.21 is ready for general production use! See the profile-guided optimization user guide for complete documentation. Belo
Russ Cox 28 August 2023 One of the key benefits of open-source software is that anyone can read the source code and inspect what it does. And yet most software, even open-source software, is downloaded in the form of compiled binaries, which are much more difficult to inspect. If an attacker wanted to run a supply chain attack on an open-source project, the least visible way would be to replace th
Jonathan Amsterdam 22 August 2023 The new log/slog package in Go 1.21 brings structured logging to the standard library. Structured logs use key-value pairs so they can be parsed, filtered, searched, and analyzed quickly and reliably. For servers, logging is an important way for developers to observe the detailed behavior of the system, and often the first place they go to debug it. Logs therefore
Russ Cox 14 August 2023 Beyond Go 1.21’s expanded commitment to backward compatibility, Go 1.21 also introduces better forward compatibility for Go code, meaning that Go 1.21 and later will take better care not to miscompile code that requires an even newer version of Go. Specifically, the go line in go.mod now specifies a minimum required Go toolchain version, while in previous releases it was a
Russ Cox 14 August 2023 Go 1.21 includes new features to improve compatibility. Before you stop reading, I know that sounds boring. But boring can be good. Back in the early days of Go 1, Go was exciting and full of surprises. Each week we cut a new snapshot release and everyone got to roll the dice to see what we’d changed and how their programs would break. We released Go 1 and its compatibility
Eli Bendersky, on behalf of the Go team 8 August 2023 Today the Go team is thrilled to release Go 1.21, which you can get by visiting the download page. Go 1.21 is packed with new features and improvements. Here are some of the notable changes; for the full list, refer to the release notes. Tool improvements The Profile Guided Optimization (PGO) feature we announced for preview in 1.20 is now gene
Introduction to Go 1.21 The latest Go release, version 1.21, arrives six months after Go 1.20. Most of its changes are in the implementation of the toolchain, runtime, and libraries. As always, the release maintains the Go 1 promise of compatibility; in fact, Go 1.21 improves upon that promise. We expect almost all Go programs to continue to compile and run as before. Go 1.21 introduces a small ch
Cameron Balahan 31 July 2023 When you start a new project in Go, you might begin by cloning an existing project. That way, you can start with something that already works, making incremental changes instead of starting from scratch. For a long time now, we have heard from Go developers that getting started is often the hardest part. New developers coming from other languages expect guidance on a d
Julie Qiu, for the Go security team 13 July 2023 We are excited to announce that govulncheck v1.0.0 has been released, along with v1.0.0 of the API for integrating scanning into other tools! Go’s support for vulnerability management was first announced last September. We have made several changes since then, culminating in today’s release. This post describes Go’s updated vulnerability tooling, an
Eli Bendersky, on behalf of the Go team 21 June 2023 The Go 1.21 first Release Candidate (RC) is available today on the download page! Go 1.21 is packed with new features and improvements. Getting the RC (release candidate) allows you to experiment with it early, try it on your workloads, and report any issues before the final release (scheduled for August). Here are some notable changes and featu
Introduction Starting in Go 1.21, the Go distribution consists of a go command and a bundled Go toolchain, which is the standard library as well as the compiler, assembler, and other tools. The go command can use its bundled Go toolchain as well as other versions that it finds in the local PATH or downloads as needed. The choice of Go toolchain being used depends on the GOTOOLCHAIN environment set
Tips for writing clear, performant, and idiomatic Go code
Than McIntosh 8 March 2023 Code coverage tools help developers determine what fraction of a source code base is executed (covered) when a given test suite is executed. Go has for some time provided support (introduced in the Go 1.2 release) to measure code coverage at the package level, using the "-cover" flag of the “go test” command. This tooling works well in most cases, but has some weaknesses
Robert Griesemer 17 February 2023 On February 1 we released our latest Go version, 1.20, which included a few language changes. Here we’ll discuss one of those changes: the predeclared comparable type constraint is now satisfied by all comparable types. Surprisingly, before Go 1.20, some comparable types did not satisfy comparable! If you’re confused, you’ve come to the right place. Consider the v
Michael Pratt 8 February 2023 When you build a Go binary, the Go compiler performs optimizations to try to generate the best performing binary it can. For example, constant propagation can evaluate constant expressions at compile time, avoiding runtime evaluation cost. Escape analysis avoids heap allocations for locally-scoped objects, avoiding GC overheads. Inlining copies the body of simple func
Robert Griesemer, on behalf of the Go team 1 February 2023 Today the Go team is thrilled to release Go 1.20, which you can get by visiting the download page. Go 1.20 benefited from an extended development phase, made possible by earlier broad testing and improved overall stability of the code base. We’re particularly excited to launch a preview of profile-guided optimization (PGO), which enables t
Introduction to Go 1.20 The latest Go release, version 1.20, arrives six months after Go 1.19. Most of its changes are in the implementation of the toolchain, runtime, and libraries. As always, the release maintains the Go 1 promise of compatibility. We expect almost all Go programs to continue to compile and run as before. Changes to the language Go 1.20 includes four changes to the language. Go
次のページ
このページを最初にブックマークしてみませんか?
『The Go Programming Language』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く