Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fix golint
Browse files Browse the repository at this point in the history
  • Loading branch information
jryio committed May 4, 2020
1 parent f540ce4 commit 977b6f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ func (u *Updater) tempDir() string {
}

var tempDirRE = regexp.MustCompile(`^KeybaseUpdater.([ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]{52}|\d{18,})$`)
var keybaseAssetRE = regexp.MustCompile(`^Keybase(-|_)(.*)$`)

// CleanupPreviousUpdates removes temporary files from previous updates.
func (u *Updater) CleanupPreviousUpdates() (err error) {
Expand Down
7 changes: 6 additions & 1 deletion updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,10 @@ func TestApplyDownloaded(t *testing.T) {
func TestFindDownloadedAsset(t *testing.T) {
upr, err := newTestUpdater(t)
assert.NoError(t, err)
defer upr.CleanupPreviousUpdates()
defer func() {
err = upr.CleanupPreviousUpdates()
assert.NoError(t, err)
}()

// 1. empty asset
matchingAssetPath, err := upr.FindDownloadedAsset("")
Expand All @@ -708,6 +711,7 @@ func TestFindDownloadedAsset(t *testing.T) {

// 3. asset given -> created KeybaseUpdate. -> directory empty
tmpDir, err := util.MakeTempDir("KeybaseUpdater.", 0700)
assert.NoError(t, err)
require.NoError(t, err)

matchingAssetPath, err = upr.FindDownloadedAsset("temp")
Expand All @@ -718,6 +722,7 @@ func TestFindDownloadedAsset(t *testing.T) {

// 4. asset given -> created KeybaseUpdate. -> file exists but no match
tmpDir, err = util.MakeTempDir("KeybaseUpdater.", 0700)
assert.NoError(t, err)
tmpFile := filepath.Join(tmpDir, "nottemp")
err = ioutil.WriteFile(tmpFile, []byte("Contents of temp file"), 0700)
require.NoError(t, err)
Expand Down

0 comments on commit 977b6f5

Please sign in to comment.