6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-06 11:37:57 +00:00

Replace deprecated modules

Replace go-homedir with builtin os.UserHomeDir and pkg/errors with
builtin errors
This commit is contained in:
Grzegorz Dlugoszewski
2025-08-11 20:43:49 +02:00
parent 8cd27a8f62
commit 7ecef9c85d
7 changed files with 17 additions and 23 deletions

View File

@@ -2,10 +2,10 @@ package pkg
import (
"bufio"
"errors"
"fmt"
"os"
"strings"
"github.com/pkg/errors"
)
var (
@@ -22,7 +22,7 @@ type parsedLine struct {
func parseDumpFile(path string) ([]parsedLine, error) {
file, err := os.Open(path)
if err != nil {
return nil, errors.Wrapf(err, "failed opening dump file %s", path)
return nil, fmt.Errorf("failed opening dump file %s: %w", path, err)
}
defer file.Close()
@@ -34,7 +34,7 @@ func parseDumpFile(path string) ([]parsedLine, error) {
line++
parsed, err := parseLine(scanner.Text())
if err != nil && !errors.Is(errEmptyLine, err) {
return nil, errors.Wrapf(err, "failed parsing dump file line %d", line)
return nil, fmt.Errorf("failed parsing dump file line %d: %w", line, err)
}
parsedLines = append(parsedLines, parsed)