@@ -19,7 +19,6 @@ import (
19
19
type Cache struct {
20
20
executablePath string
21
21
archiveURL string
22
- destDir string
23
22
version string
24
23
getVersion func (string ) (string , error )
25
24
}
@@ -35,7 +34,7 @@ func (e *VersionMismatchError) Error() string {
35
34
}
36
35
37
36
func New (executablePath string , archiveURL string , version string , getVersion func (string ) (string , error )) * Cache {
38
- return & Cache {executablePath : executablePath , archiveURL : archiveURL , destDir : constants . BinDir (), version : version , getVersion : getVersion }
37
+ return & Cache {executablePath : executablePath , archiveURL : archiveURL , version : version , getVersion : getVersion }
39
38
}
40
39
41
40
func (c * Cache ) GetExecutablePath () string {
@@ -134,13 +133,13 @@ func (c *Cache) CacheExecutable() error {
134
133
}
135
134
136
135
// Copy the requested asset into its final destination
137
- err = os .MkdirAll (c . destDir , 0750 )
136
+ err = os .MkdirAll (constants . BinDir () , 0750 )
138
137
if err != nil {
139
138
return errors .Wrap (err , "cannot create the target directory" )
140
139
}
141
140
142
141
for _ , extractedFilePath := range extractedFiles {
143
- finalExecutablePath := filepath .Join (c . destDir , filepath .Base (extractedFilePath ))
142
+ finalExecutablePath := filepath .Join (constants . BinDir () , filepath .Base (extractedFilePath ))
144
143
// If the file exists then remove it (ignore error) first before copy because with `0500` permission
145
144
// it is not possible to overwrite the file.
146
145
os .Remove (finalExecutablePath )
0 commit comments