go.errors 1.24.13.2

dotnet add package go.errors --version 1.24.13.2
                    
NuGet\Install-Package go.errors -Version 1.24.13.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="go.errors" Version="1.24.13.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="go.errors" Version="1.24.13.2" />
                    
Directory.Packages.props
<PackageReference Include="go.errors" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add go.errors --version 1.24.13.2
                    
#r "nuget: go.errors, 1.24.13.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package go.errors@1.24.13.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=go.errors&version=1.24.13.2
                    
Install as a Cake Addin
#tool nuget:?package=go.errors&version=1.24.13.2
                    
Install as a Cake Tool

go.errors

C# package converted from the Go standard library by go2cs.

Tests Docs
Source Source

Package errors implements functions to manipulate errors.

The [New] function creates errors whose only content is a text message.

An error e wraps another error if e's type has one of the methods

Unwrap() error
Unwrap() []error

If e.Unwrap() returns a non-nil error w or a slice containing w, then we say that e wraps w. A nil error returned from e.Unwrap() indicates that e does not wrap any error. It is invalid for an Unwrap method to return an []error containing a nil error value.

An easy way to create wrapped errors is to call fmt.Errorf and apply the %w verb to the error argument:

wrapsErr := fmt.Errorf("... %w ...", ..., err, ...)

Successive unwrapping of an error creates a tree. The [Is] and [As] functions inspect an error's tree by examining first the error itself followed by the tree of each of its children in turn (pre-order, depth-first traversal).

See https://go.dev/blog/go1.13-errors for a deeper discussion of the philosophy of wrapping and when to wrap.

[Is] examines the tree of its first argument looking for an error that matches the second. It reports whether it finds a match. It should be used in preference to simple equality checks:

if errors.Is(err, fs.ErrExist)

is preferable to

if err == fs.ErrExist

because the former will succeed if err wraps io/fs.ErrExist.

[As] examines the tree of its first argument looking for an error that can be assigned to its second argument, which must be a pointer. If it succeeds, it performs the assignment and returns true. Otherwise, it returns false. The form

var perr *fs.PathError
if errors.As(err, &perr) {
	fmt.Println(perr.Path)
}

is preferable to

if perr, ok := err.(*fs.PathError); ok {
	fmt.Println(perr.Path)
}

because the former will succeed if err wraps an *io/fs.PathError.


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.

Artwork licensed under Creative Commons Attribution 3.0; see artwork attribution.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (156)

Showing the top 5 NuGet packages that depend on go.errors:

Package Downloads
go.io

io (net10.0 - Release) -- C# project converted from Go source

go.strconv

strconv (net10.0 - Release) -- C# project converted from Go source

go.time

time (net10.0 - Release) -- C# project converted from Go source

go.syscall

syscall (net10.0 - Release) -- C# project converted from Go source

go.internal.oserror

internal.oserror (net10.0 - Release) -- C# project converted from Go source

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.24.13.2 260 9/24/2026
1.24.13.1 513 9/24/2026
1.23.12.3 2,176 9/8/2026
1.23.12.2 1,962 8/29/2026
1.23.12.1 2,063 8/26/2026
1.23.1.7 3,436 8/23/2026
1.23.1.6 2,876 8/11/2026
1.23.1.5 2,876 8/9/2026
1.23.1.4 2,824 8/8/2026
1.23.1.3 3,281 8/4/2026
1.23.1.2 3,447 7/27/2026
1.23.1.1 3,470 7/14/2026
0.1.0 1,185 7/8/2020