mirror of
https://github.com/safing/portbase
synced 2025-09-04 19:50:18 +00:00
Update linter settings and fix some linter hints
This commit is contained in:
parent
f1aacc5d45
commit
97f001d7d7
4 changed files with 8 additions and 4 deletions
|
@ -4,3 +4,6 @@ linters:
|
||||||
- lll
|
- lll
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- gochecknoglobals
|
- gochecknoglobals
|
||||||
|
- funlen
|
||||||
|
- whitespace
|
||||||
|
- wsl
|
||||||
|
|
|
@ -30,6 +30,7 @@ func (reg *ResourceRegistry) fetchFile(rv *ResourceVersion, tries int) error {
|
||||||
|
|
||||||
// check destination dir
|
// check destination dir
|
||||||
dirPath := filepath.Dir(rv.storagePath())
|
dirPath := filepath.Dir(rv.storagePath())
|
||||||
|
|
||||||
err = reg.storageDir.EnsureAbsPath(dirPath)
|
err = reg.storageDir.EnsureAbsPath(dirPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not create updates folder: %s", dirPath)
|
return fmt.Errorf("could not create updates folder: %s", dirPath)
|
||||||
|
@ -65,7 +66,7 @@ func (reg *ResourceRegistry) fetchFile(rv *ResourceVersion, tries int) error {
|
||||||
}
|
}
|
||||||
// set permissions
|
// set permissions
|
||||||
if !onWindows {
|
if !onWindows {
|
||||||
// FIXME: only set executable files to 0755, set other to 0644
|
// TODO: only set executable files to 0755, set other to 0644
|
||||||
err = os.Chmod(rv.storagePath(), 0755)
|
err = os.Chmod(rv.storagePath(), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("%s: failed to set permissions on downloaded file %s: %s", reg.Name, rv.storagePath(), err)
|
log.Warningf("%s: failed to set permissions on downloaded file %s: %s", reg.Name, rv.storagePath(), err)
|
||||||
|
|
|
@ -154,6 +154,7 @@ func (res *Resource) GetFile() *File {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:gocognit // function already kept as simlpe as possible
|
||||||
func (res *Resource) selectVersion() {
|
func (res *Resource) selectVersion() {
|
||||||
sort.Sort(res)
|
sort.Sort(res)
|
||||||
|
|
||||||
|
@ -170,7 +171,8 @@ func (res *Resource) selectVersion() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if len(res.Versions) == 0 {
|
if len(res.Versions) == 0 {
|
||||||
res.SelectedVersion = nil // TODO: find a better way
|
// TODO: find better way to deal with an empty version slice (which should not happen)
|
||||||
|
res.SelectedVersion = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ func (reg *ResourceRegistry) downloadIndex(name string, stableRelease, betaRelea
|
||||||
|
|
||||||
// DownloadUpdates checks if updates are available and downloads updates of used components.
|
// DownloadUpdates checks if updates are available and downloads updates of used components.
|
||||||
func (reg *ResourceRegistry) DownloadUpdates(ctx context.Context) error {
|
func (reg *ResourceRegistry) DownloadUpdates(ctx context.Context) error {
|
||||||
|
|
||||||
// create list of downloads
|
// create list of downloads
|
||||||
var toUpdate []*ResourceVersion
|
var toUpdate []*ResourceVersion
|
||||||
reg.RLock()
|
reg.RLock()
|
||||||
|
@ -83,7 +82,6 @@ func (reg *ResourceRegistry) DownloadUpdates(ctx context.Context) error {
|
||||||
toUpdate = append(toUpdate, rv)
|
toUpdate = append(toUpdate, rv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Unlock()
|
res.Unlock()
|
||||||
|
|
Loading…
Add table
Reference in a new issue