forked from Silverfish/proton-bridge
Other: Update golangci-lint to v1.50.0
This commit is contained in:
@ -20,7 +20,6 @@ package updater
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -43,7 +42,7 @@ func (i *InstallerDarwin) InstallUpdate(_ *semver.Version, r io.Reader) error {
|
||||
}
|
||||
defer func() { _ = gr.Close() }()
|
||||
|
||||
tempDir, err := ioutil.TempDir("", "proton-update-source")
|
||||
tempDir, err := os.MkdirTemp("", "proton-update-source")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get temporary update directory")
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
package updater
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -104,10 +103,10 @@ func checkThatFilesAreSame(r *require.Assertions, src, dst string) {
|
||||
|
||||
r.Equal(srcLnk, dstLnk)
|
||||
} else {
|
||||
srcContent, err := ioutil.ReadFile(srcPath)
|
||||
srcContent, err := os.ReadFile(srcPath)
|
||||
r.NoError(err)
|
||||
|
||||
dstContent, err := ioutil.ReadFile(dstPath)
|
||||
dstContent, err := os.ReadFile(dstPath)
|
||||
r.NoError(err)
|
||||
|
||||
r.Equal(srcContent, dstContent)
|
||||
@ -155,7 +154,7 @@ func createTestFolder(dirPath, dirType string) error {
|
||||
path := filepath.Join(dirPath, "testpath")
|
||||
switch dirType {
|
||||
case FileType:
|
||||
err = ioutil.WriteFile(path, []byte("This is a test"), 0o640)
|
||||
err = os.WriteFile(path, []byte("This is a test"), 0o640)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -172,7 +171,7 @@ func createTestFolder(dirPath, dirType string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(path, "another_file"), []byte("This is a test"), 0o640)
|
||||
err = os.WriteFile(filepath.Join(path, "another_file"), []byte("This is a test"), 0o640)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@ -314,7 +314,7 @@ type fakeSettings struct {
|
||||
|
||||
// newFakeSettings creates a temporary folder for files.
|
||||
func newFakeSettings(rollout float64, earlyAccess bool) *fakeSettings {
|
||||
dir, err := ioutil.TempDir("", "test-settings")
|
||||
dir, err := os.MkdirTemp("", "test-settings")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@ -50,41 +50,42 @@ type VersionInfo struct {
|
||||
|
||||
// VersionMap represents the structure of the version.json file.
|
||||
// It looks like this:
|
||||
// {
|
||||
// "stable": {
|
||||
// "Version": "2.3.4",
|
||||
// "Package": "https://protonmail.com/.../bridge_2.3.4_linux.tgz",
|
||||
// "Installers": [
|
||||
// "https://protonmail.com/.../something.deb",
|
||||
// "https://protonmail.com/.../something.rpm",
|
||||
// "https://protonmail.com/.../PKGBUILD"
|
||||
// ],
|
||||
// "LandingPage": "https://protonmail.com/bridge",
|
||||
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
|
||||
// "RolloutProportion": 0.5
|
||||
// },
|
||||
// "early": {
|
||||
// "Version": "2.4.0",
|
||||
// "Package": "https://protonmail.com/.../bridge_2.4.0_linux.tgz",
|
||||
// "Installers": [
|
||||
// "https://protonmail.com/.../something.deb",
|
||||
// "https://protonmail.com/.../something.rpm",
|
||||
// "https://protonmail.com/.../PKGBUILD"
|
||||
// ],
|
||||
// "LandingPage": "https://protonmail.com/bridge",
|
||||
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
|
||||
// "RolloutProportion": 0.5
|
||||
// },
|
||||
// "...": {
|
||||
// ...
|
||||
// }
|
||||
// }.
|
||||
//
|
||||
// {
|
||||
// "stable": {
|
||||
// "Version": "2.3.4",
|
||||
// "Package": "https://protonmail.com/.../bridge_2.3.4_linux.tgz",
|
||||
// "Installers": [
|
||||
// "https://protonmail.com/.../something.deb",
|
||||
// "https://protonmail.com/.../something.rpm",
|
||||
// "https://protonmail.com/.../PKGBUILD"
|
||||
// ],
|
||||
// "LandingPage": "https://protonmail.com/bridge",
|
||||
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
|
||||
// "RolloutProportion": 0.5
|
||||
// },
|
||||
// "early": {
|
||||
// "Version": "2.4.0",
|
||||
// "Package": "https://protonmail.com/.../bridge_2.4.0_linux.tgz",
|
||||
// "Installers": [
|
||||
// "https://protonmail.com/.../something.deb",
|
||||
// "https://protonmail.com/.../something.rpm",
|
||||
// "https://protonmail.com/.../PKGBUILD"
|
||||
// ],
|
||||
// "LandingPage": "https://protonmail.com/bridge",
|
||||
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
|
||||
// "RolloutProportion": 0.5
|
||||
// },
|
||||
// "...": {
|
||||
// ...
|
||||
// }
|
||||
// }.
|
||||
type VersionMap map[string]VersionInfo
|
||||
|
||||
// getVersionFileURL returns the URL of the version file.
|
||||
// For example:
|
||||
// - https://protonmail.com/download/bridge/version_linux.json
|
||||
// - https://protonmail.com/download/ie/version_linux.json
|
||||
// - https://protonmail.com/download/bridge/version_linux.json
|
||||
// - https://protonmail.com/download/ie/version_linux.json
|
||||
func (u *Updater) getVersionFileURL() string {
|
||||
return fmt.Sprintf("%v/%v/version_%v.json", Host, u.updateURLName, u.platform)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user