mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 03:38:04 +00:00
Fix linter errors after go 1.20
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package dashboard
|
package dashboard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -34,7 +33,7 @@ func TestMain(m *testing.M) { // fixture to set logging level via env variable
|
|||||||
}
|
}
|
||||||
|
|
||||||
inMemStorage = storage.Init(driver.NewMemory())
|
inMemStorage = storage.Init(driver.NewMemory())
|
||||||
d, err := ioutil.TempDir("", "helm")
|
d, err := os.MkdirTemp("", "helm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -140,7 +140,7 @@ func locateChart(pathOpts action.ChartPathOptions, chart string, settings *cli.E
|
|||||||
err = errorx.Decorate(err, "An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies")
|
err = errorx.Decorate(err, "An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies")
|
||||||
if true { // client.DependencyUpdate
|
if true { // client.DependencyUpdate
|
||||||
man := &downloader.Manager{
|
man := &downloader.Manager{
|
||||||
Out: ioutil.Discard,
|
Out: io.Discard,
|
||||||
ChartPath: cp,
|
ChartPath: cp,
|
||||||
Keyring: pathOpts.Keyring,
|
Keyring: pathOpts.Keyring,
|
||||||
SkipUpdate: false,
|
SkipUpdate: false,
|
||||||
@@ -347,7 +347,7 @@ func (r *Release) restoreChart() (string, error) {
|
|||||||
// we're unlikely to have the original chart, let's try the cheesy thing...
|
// we're unlikely to have the original chart, let's try the cheesy thing...
|
||||||
|
|
||||||
log.Infof("Attempting to restore the chart for %s", r.Orig.Name)
|
log.Infof("Attempting to restore the chart for %s", r.Orig.Name)
|
||||||
dir, err := ioutil.TempDir("", "khd-*")
|
dir, err := os.MkdirTemp("", "khd-*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to get temporary directory")
|
return "", errorx.Decorate(err, "failed to get temporary directory")
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ func (r *Release) restoreChart() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to restore Chart.yaml")
|
return "", errorx.Decorate(err, "failed to restore Chart.yaml")
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(path.Join(dir, "Chart.yaml"), cdata, 0644)
|
err = os.WriteFile(path.Join(dir, "Chart.yaml"), cdata, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to write file Chart.yaml")
|
return "", errorx.Decorate(err, "failed to write file Chart.yaml")
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ func (r *Release) restoreChart() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to restore values.yaml")
|
return "", errorx.Decorate(err, "failed to restore values.yaml")
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(path.Join(dir, "values.yaml"), vdata, 0644)
|
err = os.WriteFile(path.Join(dir, "values.yaml"), vdata, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to write file values.yaml")
|
return "", errorx.Decorate(err, "failed to write file values.yaml")
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ func (r *Release) restoreChart() (string, error) {
|
|||||||
return "", errorx.Decorate(err, "failed to create directory for file: %s", fname)
|
return "", errorx.Decorate(err, "failed to create directory for file: %s", fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(fname, f.Data, 0644)
|
err = os.WriteFile(fname, f.Data, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errorx.Decorate(err, "failed to write file to restore chart: %s", fname)
|
return "", errorx.Decorate(err, "failed to write file to restore chart: %s", fname)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -22,23 +21,23 @@ func initRepository(t *testing.T, filePath string, devel bool) *Repositories {
|
|||||||
|
|
||||||
settings := cli.New()
|
settings := cli.New()
|
||||||
|
|
||||||
fname, err := ioutil.TempFile("", "repo-*.yaml")
|
fname, err := os.MkdirTemp("", "repo-*.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(filePath)
|
input, err := os.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(fname.Name(), input, 0644)
|
err = os.WriteFile(fname, input, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
err := os.Remove(fname.Name())
|
err := os.Remove(fname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -50,7 +49,7 @@ func initRepository(t *testing.T, filePath string, devel bool) *Repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sets the repository file path
|
// Sets the repository file path
|
||||||
settings.RepositoryConfig = fname.Name()
|
settings.RepositoryConfig = fname
|
||||||
settings.RepositoryCache = path.Dir(filePath)
|
settings.RepositoryCache = path.Dir(filePath)
|
||||||
|
|
||||||
testRepository := &Repositories{
|
testRepository := &Repositories{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -34,12 +33,12 @@ func ChartAndVersion(x string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TempFile(txt string) (string, func(), error) {
|
func TempFile(txt string) (string, func(), error) {
|
||||||
file, err := ioutil.TempFile("", "helm_dahsboard_*.yaml")
|
file, err := os.CreateTemp("", "helm_dahsboard_*.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(file.Name(), []byte(txt), 0600)
|
err = os.WriteFile(file.Name(), []byte(txt), 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user