Skip to content

Commit 05dadd9

Browse files
kolyshkindims
authored andcommitted
Stop using pkg/errors
... in favor of Go native error wrapping (available since Go 1.13). Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 2298a9c commit 05dadd9

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

console_windows.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
package console
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"os"
2223

23-
"github.com/pkg/errors"
2424
"golang.org/x/sys/windows"
2525
)
2626

@@ -103,7 +103,7 @@ func (m *master) Reset() error {
103103
{m.err, m.errMode},
104104
} {
105105
if err := windows.SetConsoleMode(s.fd, s.mode); err != nil {
106-
return errors.Wrap(err, "unable to restore console mode")
106+
return fmt.Errorf("unable to restore console mode: %w", err)
107107
}
108108
}
109109

@@ -114,7 +114,7 @@ func (m *master) Size() (WinSize, error) {
114114
var info windows.ConsoleScreenBufferInfo
115115
err := windows.GetConsoleScreenBufferInfo(m.out, &info)
116116
if err != nil {
117-
return WinSize{}, errors.Wrap(err, "unable to get console info")
117+
return WinSize{}, fmt.Errorf("unable to get console info: %w", err)
118118
}
119119

120120
winsize := WinSize{
@@ -139,7 +139,7 @@ func (m *master) DisableEcho() error {
139139
mode |= windows.ENABLE_LINE_INPUT
140140

141141
if err := windows.SetConsoleMode(m.in, mode); err != nil {
142-
return errors.Wrap(err, "unable to set console to disable echo")
142+
return fmt.Errorf("unable to set console to disable echo: %w", err)
143143
}
144144

145145
return nil
@@ -192,7 +192,7 @@ func makeInputRaw(fd windows.Handle, mode uint32) error {
192192
}
193193

194194
if err := windows.SetConsoleMode(fd, mode); err != nil {
195-
return errors.Wrap(err, "unable to set console to raw mode")
195+
return fmt.Errorf("unable to set console to raw mode: %w", err)
196196
}
197197

198198
return nil

go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module github.com/containerd/console
22

33
go 1.13
44

5-
require (
6-
github.com/pkg/errors v0.9.1
7-
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
8-
)
5+
require golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
2-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
31
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
42
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

0 commit comments

Comments
 (0)