Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(archive): Migrate errors to constants #1601

Draft
wants to merge 1 commit into
base: staging
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"kraftkit.sh/log"
)

var (
ErrTarFileNoDest = fmt.Errorf("cannot tar file with no specified destination")

Check failure on line 25 in archive/archive.go

View workflow job for this annotation

GitHub Actions / All

File is not `gofumpt`-ed (gofumpt)
ErrTarFileWriteDir = fmt.Errorf("attempting to use TarFileWriter with directory")
)

// bufPool is a pool of byte buffers that can be reused for copying content
// between files.
var bufPool = sync.Pool{
Expand All @@ -38,12 +43,12 @@
dst = filepath.ToSlash(dst)

if dst == "" {
return fmt.Errorf("cannot tar file with no specified destination")
} else if dst[0] == filepath.Separator {
return ErrTarFileNoDest

Check failure on line 46 in archive/archive.go

View workflow job for this annotation

GitHub Actions / All

File is not `gofumpt`-ed (gofumpt)
} else if dst[0] == filepath.Separator {
dst = dst[1:]
}
if strings.HasSuffix(dst, string(filepath.Separator)) {
return fmt.Errorf("attempting to use TarFileWriter with directory")
return ErrTarFileWriteDir
}

aopts := ArchiveOptions{}
Expand Down
Loading