Update linter settings and fix some linter hints

This commit is contained in:
Daniel 2019-10-07 16:45:03 +02:00
parent f1aacc5d45
commit 97f001d7d7
4 changed files with 8 additions and 4 deletions

View file

@ -4,3 +4,6 @@ linters:
- lll
- gochecknoinits
- gochecknoglobals
- funlen
- whitespace
- wsl

View file

@ -30,6 +30,7 @@ func (reg *ResourceRegistry) fetchFile(rv *ResourceVersion, tries int) error {
// check destination dir
dirPath := filepath.Dir(rv.storagePath())
err = reg.storageDir.EnsureAbsPath(dirPath)
if err != nil {
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
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)
if err != nil {
log.Warningf("%s: failed to set permissions on downloaded file %s: %s", reg.Name, rv.storagePath(), err)

View file

@ -154,6 +154,7 @@ func (res *Resource) GetFile() *File {
}
}
//nolint:gocognit // function already kept as simlpe as possible
func (res *Resource) selectVersion() {
sort.Sort(res)
@ -170,7 +171,8 @@ func (res *Resource) selectVersion() {
}()
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
}

View file

@ -65,7 +65,6 @@ func (reg *ResourceRegistry) downloadIndex(name string, stableRelease, betaRelea
// DownloadUpdates checks if updates are available and downloads updates of used components.
func (reg *ResourceRegistry) DownloadUpdates(ctx context.Context) error {
// create list of downloads
var toUpdate []*ResourceVersion
reg.RLock()
@ -83,7 +82,6 @@ func (reg *ResourceRegistry) DownloadUpdates(ctx context.Context) error {
toUpdate = append(toUpdate, rv)
}
}
}
res.Unlock()