How To Install golang-github-hashicorp-errwrap-dev on Debian 9
Introduction
In this tutorial we learn how to install golang-github-hashicorp-errwrap-dev on Debian 9.
What is golang-github-hashicorp-errwrap-dev
golang-github-hashicorp-errwrap-dev is:
errwrap is a package for Go that formalizes the pattern of wrapping errors and checking if an error contains another error.
There is a common pattern in Go of taking a returned error value and then wrapping it (such as with fmt.Errorf) before returning it. The problem with this pattern is that you completely lose the original error structure.
Arguably the correct approach is that you should make a custom structure implementing the error interface, and have the original error as a field on that structure, such as this example. This is a good approach, but you have to know the entire chain of possible rewrapping that happens, when you might just care about one.
errwrap formalizes this pattern (it doesn’t matter what approach you use above) by giving a single interface for wrapping errors, checking if a specific error is wrapped, and extracting that error.
This package contains the source.
There are three methods to install golang-github-hashicorp-errwrap-dev on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install golang-github-hashicorp-errwrap-dev Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install golang-github-hashicorp-errwrap-dev using apt-get by running the following command:
sudo apt-get -y install golang-github-hashicorp-errwrap-dev
Install golang-github-hashicorp-errwrap-dev Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install golang-github-hashicorp-errwrap-dev using apt by running the following command:
sudo apt -y install golang-github-hashicorp-errwrap-dev
Install golang-github-hashicorp-errwrap-dev Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.
sudo aptitude update
After updating apt database, We can install golang-github-hashicorp-errwrap-dev using aptitude by running the following command:
sudo aptitude -y install golang-github-hashicorp-errwrap-dev
How To Uninstall golang-github-hashicorp-errwrap-dev on Debian 9
To uninstall only the golang-github-hashicorp-errwrap-dev package we can use the following command:
sudo apt-get remove golang-github-hashicorp-errwrap-dev
Uninstall golang-github-hashicorp-errwrap-dev And Its Dependencies
To uninstall golang-github-hashicorp-errwrap-dev and its dependencies that are no longer needed by Debian 9, we can use the command below:
sudo apt-get -y autoremove golang-github-hashicorp-errwrap-dev
Remove golang-github-hashicorp-errwrap-dev Configurations and Data
To remove golang-github-hashicorp-errwrap-dev configuration and data from Debian 9 we can use the following command:
sudo apt-get -y purge golang-github-hashicorp-errwrap-dev
Remove golang-github-hashicorp-errwrap-dev configuration, data, and all of its dependencies
We can use the following command to remove golang-github-hashicorp-errwrap-dev configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge golang-github-hashicorp-errwrap-dev
Dependencies
golang-github-hashicorp-errwrap-dev have the following dependencies:
References
Summary
In this tutorial we learn how to install golang-github-hashicorp-errwrap-dev package on Debian 9 using different package management tools: apt, apt-get and aptitude.