go.errors 1.23.1.2

dotnet add package go.errors --version 1.23.1.2
                    
NuGet\Install-Package go.errors -Version 1.23.1.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.23.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="go.errors" Version="1.23.1.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.23.1.2
                    
#r "nuget: go.errors, 1.23.1.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.23.1.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.23.1.2
                    
Install as a Cake Addin
#tool nuget:?package=go.errors&version=1.23.1.2
                    
Install as a Cake Tool

go.errors

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

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).

[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.


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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (126)

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

Package Downloads
go.io

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

go.time

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

go.strconv

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

go.fmt

fmt (net9.0 - Release) -- C# project converted from Go source

go.strings

strings (net9.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.23.1.2 3,087 7/27/2026
1.23.1.1 3,184 7/14/2026
0.1.0 1,179 7/8/2020