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

fix: replace the word temporal with temporary #3012

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions pkg/cosign/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.R
if cos.Signature != nil {
sigFile, err := afero.TempFile(v.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
defer v.fs.Remove(sigFile.Name()) //nolint:errcheck

Expand All @@ -81,7 +81,7 @@ func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.R
if cos.Key != nil {
keyFile, err := afero.TempFile(v.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
defer v.fs.Remove(keyFile.Name()) //nolint:errcheck

Expand All @@ -99,7 +99,7 @@ func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.R
if cos.Certificate != nil {
certFile, err := afero.TempFile(v.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
defer v.fs.Remove(certFile.Name()) //nolint:errcheck

Expand Down
2 changes: 1 addition & 1 deletion pkg/download/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (f *DownloadedFile) Wrap(w io.Writer) io.Writer {
func (f *DownloadedFile) copy() error {
tmp, err := afero.TempFile(f.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
f.path = tmp.Name()
var w io.Writer = tmp
Expand Down
2 changes: 1 addition & 1 deletion pkg/installpackage/aqua.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (is *Installer) copyAquaOnWindows(exePath string) error {
// > The system cannot move the file to a different disk drive
tempDir := filepath.Join(is.rootDir, "temp")
if err := osfile.MkdirAll(is.fs, tempDir); err != nil {
return fmt.Errorf("create a temporal directory: %w", err)
return fmt.Errorf("create a temporary directory: %w", err)
}
if err := is.fs.Rename(dest, filepath.Join(tempDir, "aqua.exe")); err != nil {
return fmt.Errorf("rename aqua.exe to update: %w", err)
Expand Down
8 changes: 4 additions & 4 deletions pkg/installpackage/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ func (is *Installer) dlAndExtractChecksum(ctx context.Context, logE *logrus.Entr
if cos := pkg.PackageInfo.Checksum.GetCosign(); cos.GetEnabled() && !is.cosignDisabled {
f, err := afero.TempFile(is.fs, "", "")
if err != nil {
return "", fmt.Errorf("create a temporal file: %w", err)
return "", fmt.Errorf("create a temporary file: %w", err)
}
defer f.Close()
defer is.fs.Remove(f.Name()) //nolint:errcheck
if _, err := f.Write(b); err != nil {
return "", fmt.Errorf("write a checksum to a temporal file: %w", err)
return "", fmt.Errorf("write a checksum to a temporary file: %w", err)
}
art := pkg.TemplateArtifact(is.runtime, assetName)
logE.Info("verify a checksum file with Cosign")
Expand Down Expand Up @@ -72,7 +72,7 @@ func (is *Installer) verifyChecksumWrap(ctx context.Context, logE *logrus.Entry,
ppkg := param.Package
tempFilePath, err := bodyFile.Path()
if err != nil {
return fmt.Errorf("get a temporal file path: %w", err)
return fmt.Errorf("get a temporary file path: %w", err)
}
paramVerifyChecksum := &ParamVerifyChecksum{
Checksum: param.Checksum,
Expand Down Expand Up @@ -113,7 +113,7 @@ func (is *Installer) verifyChecksum(ctx context.Context, logE *logrus.Entry, par
checksumID := param.ChecksumID
tempFilePath := param.TempFilePath

// Download an asset in a temporal directory
// Download an asset in a temporary directory
// Calculate the checksum of download asset
// Download a checksum file
// Extract the checksum from the checksum file
Expand Down
2 changes: 1 addition & 1 deletion pkg/installpackage/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (is *Installer) download(ctx context.Context, logE *logrus.Entry, param *Do
bodyFile := download.NewDownloadedFile(is.fs, body, pb)
defer func() {
if err := bodyFile.Remove(); err != nil {
logE.WithError(err).Warn("remove a temporal file")
logE.WithError(err).Warn("remove a temporary file")
}
}()

Expand Down
2 changes: 1 addition & 1 deletion pkg/installpackage/verify_cosign.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (is *Installer) verifyWithCosign(ctx context.Context, logE *logrus.Entry, b
}
tempFilePath, err := bodyFile.Path()
if err != nil {
return fmt.Errorf("get a temporal file path: %w", err)
return fmt.Errorf("get a temporary file path: %w", err)
}
if err := is.cosign.Verify(ctx, logE, is.runtime, &download.File{
RepoOwner: ppkg.PackageInfo.RepoOwner,
Expand Down
2 changes: 1 addition & 1 deletion pkg/installpackage/verify_slsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (is *Installer) verifyWithSLSA(ctx context.Context, logE *logrus.Entry, bod
}
tempFilePath, err := bodyFile.Path()
if err != nil {
return fmt.Errorf("get a temporal file path: %w", err)
return fmt.Errorf("get a temporary file path: %w", err)
}
if err := is.slsaVerifier.Verify(ctx, logE, is.runtime, sp, art, &download.File{
RepoOwner: ppkg.PackageInfo.RepoOwner,
Expand Down
2 changes: 1 addition & 1 deletion pkg/minisign/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.R

signatureFile, err := afero.TempFile(v.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
defer signatureFile.Close()
defer v.fs.Remove(signatureFile.Name()) //nolint:errcheck
Expand Down
4 changes: 2 additions & 2 deletions pkg/slsa/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func (v *Verifier) Verify(ctx context.Context, logE *logrus.Entry, rt *runtime.R

provenanceFile, err := afero.TempFile(v.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}
defer provenanceFile.Close()
defer v.fs.Remove(provenanceFile.Name()) //nolint:errcheck
if _, err := io.Copy(provenanceFile, rc); err != nil {
return fmt.Errorf("copy a provenance to a temporal file: %w", err)
return fmt.Errorf("copy a provenance to a temporary file: %w", err)
}

return v.exe.Verify(ctx, logE, param, provenanceFile.Name()) //nolint:wrapcheck
Expand Down
8 changes: 4 additions & 4 deletions pkg/unarchive/dmg.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ func (u *dmgUnarchiver) Unarchive(ctx context.Context, logE *logrus.Entry, src *

tempFilePath, err := src.Body.Path()
if err != nil {
return fmt.Errorf("get a temporal file path: %w", err)
return fmt.Errorf("get a temporary file path: %w", err)
}

tmpMountPoint, err := afero.TempDir(u.fs, "", "")
if err != nil {
return fmt.Errorf("create a temporal file: %w", err)
return fmt.Errorf("create a temporary file: %w", err)
}

if _, err := u.executor.HdiutilAttach(ctx, tempFilePath, tmpMountPoint); err != nil {
if err := u.fs.Remove(tmpMountPoint); err != nil {
logE.WithError(err).Warn("remove a temporal directory created to attach a DMG file")
logE.WithError(err).Warn("remove a temporary directory created to attach a DMG file")
}
return fmt.Errorf("hdiutil attach: %w", err)
}
Expand All @@ -49,7 +49,7 @@ func (u *dmgUnarchiver) Unarchive(ctx context.Context, logE *logrus.Entry, src *
logE.WithError(err).Warn("detach a DMG file")
}
if err := u.fs.Remove(tmpMountPoint); err != nil {
logE.WithError(err).Warn("remove a temporal directory created to attach a DMG file")
logE.WithError(err).Warn("remove a temporary directory created to attach a DMG file")
}
}()

Expand Down
2 changes: 1 addition & 1 deletion pkg/unarchive/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (u *pkgUnarchiver) Unarchive(ctx context.Context, _ *logrus.Entry, src *Fil

tempFilePath, err := src.Body.Path()
if err != nil {
return fmt.Errorf("get a temporal file path: %w", err)
return fmt.Errorf("get a temporary file path: %w", err)
}

if _, err := u.executor.UnarchivePkg(ctx, tempFilePath, u.dest); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/unarchive/unarchiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type unarchiverWithUnarchiver struct {
func (u *unarchiverWithUnarchiver) Unarchive(_ context.Context, _ *logrus.Entry, src *File) error {
tempFilePath, err := src.Body.Path()
if err != nil {
return fmt.Errorf("get a temporal file: %w", err)
return fmt.Errorf("get a temporary file: %w", err)
}
return u.unarchiver.Unarchive(tempFilePath, u.dest) //nolint:wrapcheck
}