Remove dependency on pkg/errors

This commit is contained in:
Stefan Martinov 2017-11-01 13:23:56 +01:00
parent 663e50fdf6
commit f00b1f1eb3

View File

@ -7,7 +7,8 @@ import (
"sort" "sort"
"strings" "strings"
"time" "time"
"github.com/pkg/errors" "errors"
"fmt"
) )
const historyRepoJSONPrefix = "contentserver-repo-" const historyRepoJSONPrefix = "contentserver-repo-"
@ -62,7 +63,7 @@ func (h *history) cleanup() error {
for _, f := range files { for _, f := range files {
err := os.Remove(f) err := os.Remove(f)
if err != nil { if err != nil {
return errors.Wrapf(err, "could not remove file %q", f) return errors.New(fmt.Sprintf("could not remove file %s : %s", f, err.Error()))
} }
} }
@ -72,7 +73,7 @@ func (h *history) cleanup() error {
func (h *history) getFilesForCleanup(historyVersions int) (files []string, err error) { func (h *history) getFilesForCleanup(historyVersions int) (files []string, err error) {
contentFiles, err := h.getHistory() contentFiles, err := h.getHistory()
if err != nil { if err != nil {
return nil, errors.Wrap(err, "could not generate file cleanup list") return nil, errors.New("could not generate file cleanup list: " + err.Error())
} }
if len(contentFiles) > historyVersions { if len(contentFiles) > historyVersions {
for i := historyVersions; i < len(contentFiles); i++ { for i := historyVersions; i < len(contentFiles); i++ {