go.internal.godebug
1.23.1.3
dotnet add package go.internal.godebug --version 1.23.1.3
NuGet\Install-Package go.internal.godebug -Version 1.23.1.3
<PackageReference Include="go.internal.godebug" Version="1.23.1.3" />
<PackageVersion Include="go.internal.godebug" Version="1.23.1.3" />
<PackageReference Include="go.internal.godebug" />
paket add go.internal.godebug --version 1.23.1.3
#r "nuget: go.internal.godebug, 1.23.1.3"
#:package go.internal.godebug@1.23.1.3
#addin nuget:?package=go.internal.godebug&version=1.23.1.3
#tool nuget:?package=go.internal.godebug&version=1.23.1.3
go.internal.godebug
C# package converted from the Go standard library by go2cs. Go version: 1.23.1
Package godebug makes the settings in the $GODEBUG environment variable available to other packages. These settings are often used for compatibility tweaks, when we need to change a default behavior but want to let users opt back in to the original. For example GODEBUG=http2server=0 disables HTTP/2 support in the net/http server.
In typical usage, code should declare a Setting as a global and then call Value each time the current setting value is needed:
var http2server = godebug.New("http2server")
func ServeConn(c net.Conn) {
if http2server.Value() == "0" {
disallow HTTP/2
...
}
...
}
Each time a non-default setting causes a change in program behavior, code must call [Setting.IncNonDefault] to increment a counter that can be reported by runtime/metrics.Read. The call must only happen when the program executes a non-default behavior, not just when the setting is set to a non-default value. This is occasionally (but very rarely) infeasible, in which case the internal/godebugs table entry must set Opaque: true, and the documentation in doc/godebug.md should mention that metrics are unavailable.
Conventionally, the global variable representing a godebug is named for the godebug itself, with no case changes:
var gotypesalias = godebug.New("gotypesalias") // this
var goTypesAlias = godebug.New("gotypesalias") // NOT THIS
The test in internal/godebugs that checks for use of IncNonDefault requires the use of this convention.
Note that counters used with IncNonDefault must be added to various tables in other packages. See the [Setting.IncNonDefault] documentation for details.
Part of the go2cs converted Go standard library. See the repository for usage and details.
Copyright 2009 The Go Authors. All rights reserved. This C# package is converted from Go standard library source; use of that source is governed by a BSD-style license that can be found in the LICENSE file. The go2cs conversion itself is distributed under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- go.internal.bisect (>= 1.23.1.3)
- go.internal.godebugs (>= 1.23.1.3)
- go.lib (>= 1.23.1.3)
- go.sync (>= 1.23.1.3)
- go.sync.atomic (>= 1.23.1.3)
- go.unsafe (>= 1.23.1.3)
NuGet packages (18)
Showing the top 5 NuGet packages that depend on go.internal.godebug:
| Package | Downloads |
|---|---|
|
go.time
time (net9.0 - Release) -- C# project converted from Go source |
|
|
go.os
os (net9.0 - Release) -- C# project converted from Go source |
|
|
go.math.rand
math.rand (net9.0 - Release) -- C# project converted from Go source |
|
|
go.net
net (net9.0 - Release) -- C# project converted from Go source |
|
|
go.crypto.x509
crypto.x509 (net9.0 - Release) -- C# project converted from Go source |
GitHub repositories
This package is not used by any popular GitHub repositories.