Skip to content

Commit c4e41c3

Browse files
committed
main/build: Use latest Go1.25 features if possible.
In order to avoid breaking backwards compatibility, newer versions of Go toolchains automatically set GODEBUG flags to disable any changes that are not strictly backwards compatible when compiling old code. However, it is often the case that older code will work properly with the new features and security updates enabled and those updates are generally desirable. The existing code in the main module will all work properly with all changes in Go1.25, so this adds a directive when building with Go1.25 or newer to override and remove the default GODEBUG flags which disable newer features and security updates that are not strictly backwards compatible. In other words, it ensure the new features and security updates implemented in Go1.25 are enabled when building with Go 1.25 or newer. The specific GODEBUG flags removed are: - `containermaxprocs=0` - `decoratemappings=0` - `tlssha1=1` - `updatemaxprocs=0` - `x509sha256skid=0`
1 parent ad2a2b6 commit c4e41c3

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

debug.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2025 The Decred developers
2+
// Use of this source code is governed by an ISC
3+
// license that can be found in the LICENSE file.
4+
5+
// This file changes the default GODEBUG values when building with newer
6+
// releases of Go to enable as many of the new features and security updates
7+
// that are not strictly backwards compatible as possible.
8+
//
9+
// For reference, in order to avoid breaking backwards compatibility, newer
10+
// versions of Go toolchains automatically set GODEBUG flags to disable any
11+
// changes that are not strictly backwards compatible when compiling old code.
12+
// However, it is often the case that older code will work properly with the
13+
// new features and security updates enabled and those updates are generally
14+
// desirable.
15+
//
16+
// WARNING: Do not blindly update this with each new Go release. It needs to
17+
// be analyzed with each new release before updating to ensure none of the
18+
// changes in the newer versions of Go that are disabled by default due to not
19+
// being striclty backwards compatibile will break the existing code.
20+
21+
//go:build go1.25
22+
//go:debug default=go1.25
23+
24+
package main

0 commit comments

Comments
 (0)