Pull request: all: fix lint and naming issues
Merge in DNS/adguard-home from 2276-fix-lint to master Updates #2276. Squashed commit of the following: commit 433f44cc7b674a20ed60a9d29466ba888b3ef66e Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Dec 7 14:14:28 2020 +0300 querylog: improve code and documentation commit 851df97d2a87de5e7180a502055ee6f1a6defdca Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Dec 4 20:36:32 2020 +0300 all: fix lint and naming issues
This commit is contained in:
@@ -88,16 +88,16 @@ func TestUpdateGetVersion(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
_ = os.Mkdir("aghtest", 0755)
|
||||
_ = os.Mkdir("aghtest", 0o755)
|
||||
defer func() {
|
||||
_ = os.RemoveAll("aghtest")
|
||||
}()
|
||||
|
||||
// create "current" files
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome", []byte("AdGuardHome"), 0755))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/README.md", []byte("README.md"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/LICENSE.txt", []byte("LICENSE.txt"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.yaml", []byte("AdGuardHome.yaml"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome", []byte("AdGuardHome"), 0o755))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/README.md", []byte("README.md"), 0o644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/LICENSE.txt", []byte("LICENSE.txt"), 0o644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.yaml", []byte("AdGuardHome.yaml"), 0o644))
|
||||
|
||||
// start server for returning package file
|
||||
pkgData, err := ioutil.ReadFile("test/AdGuardHome.tar.gz")
|
||||
@@ -151,16 +151,16 @@ func TestUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateWindows(t *testing.T) {
|
||||
_ = os.Mkdir("aghtest", 0755)
|
||||
_ = os.Mkdir("aghtest", 0o755)
|
||||
defer func() {
|
||||
_ = os.RemoveAll("aghtest")
|
||||
}()
|
||||
|
||||
// create "current" files
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.exe", []byte("AdGuardHome.exe"), 0755))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/README.md", []byte("README.md"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/LICENSE.txt", []byte("LICENSE.txt"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.yaml", []byte("AdGuardHome.yaml"), 0644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.exe", []byte("AdGuardHome.exe"), 0o755))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/README.md", []byte("README.md"), 0o644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/LICENSE.txt", []byte("LICENSE.txt"), 0o644))
|
||||
assert.Nil(t, ioutil.WriteFile("aghtest/AdGuardHome.yaml", []byte("AdGuardHome.yaml"), 0o644))
|
||||
|
||||
// start server for returning package file
|
||||
pkgData, err := ioutil.ReadFile("test/AdGuardHome.zip")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Package update provides an updater for AdGuardHome.
|
||||
package update
|
||||
|
||||
import (
|
||||
@@ -224,7 +225,7 @@ func (u *Updater) clean() {
|
||||
const MaxPackageFileSize = 32 * 1024 * 1024
|
||||
|
||||
// Download package file and save it to disk
|
||||
func (u *Updater) downloadPackageFile(url string, filename string) error {
|
||||
func (u *Updater) downloadPackageFile(url, filename string) error {
|
||||
resp, err := u.Client.Get(url)
|
||||
if err != nil {
|
||||
return fmt.Errorf("http request failed: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user