diff --git a/Makefile b/Makefile index 91fbfdbaed6..c886c3714f7 100755 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ fmt: lint: ifndef HAS_LINT - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 @echo "golangci-lint has been installed" endif hack/verify-golangci-lint.sh diff --git a/cmd/katib-controller/v1beta1/main.go b/cmd/katib-controller/v1beta1/main.go index aa1b7cd3785..5d8ee5f5fd0 100644 --- a/cmd/katib-controller/v1beta1/main.go +++ b/cmd/katib-controller/v1beta1/main.go @@ -15,7 +15,7 @@ limitations under the License. */ /* - Katib-controller is a controller (operator) for Experiments and Trials +Katib-controller is a controller (operator) for Experiments and Trials */ package main diff --git a/cmd/metricscollector/v1beta1/file-metricscollector/main.go b/cmd/metricscollector/v1beta1/file-metricscollector/main.go index 44631c8d26e..a846b8cfe79 100644 --- a/cmd/metricscollector/v1beta1/file-metricscollector/main.go +++ b/cmd/metricscollector/v1beta1/file-metricscollector/main.go @@ -42,7 +42,6 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" "os" "path/filepath" "regexp" @@ -268,7 +267,7 @@ func watchMetricsFile(mFile string, stopRules stopRulesFlag, filters []string, f klog.Fatalf("Create mark file %v error: %v", markFile, err) } - err = ioutil.WriteFile(markFile, []byte(common.TrainingEarlyStopped), 0) + err = os.WriteFile(markFile, []byte(common.TrainingEarlyStopped), 0) if err != nil { klog.Fatalf("Write to file %v error: %v", markFile, err) } diff --git a/docs/developer-guide.md b/docs/developer-guide.md index f7f248ae005..98d3186f609 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -12,7 +12,7 @@ see the following user guides: ## Requirements -- [Go](https://golang.org/) (1.18 or later) +- [Go](https://golang.org/) (1.19 or later) - [Docker](https://docs.docker.com/) (20.10 or later) - [Docker Buildx](https://docs.docker.com/build/buildx/) (0.8.0 or later) - [Java](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html) (8 or later) diff --git a/examples/v1beta1/trial-images/simple-pbt/README.md b/examples/v1beta1/trial-images/simple-pbt/README.md index 925fd3def7d..98cdc4e3afb 100644 --- a/examples/v1beta1/trial-images/simple-pbt/README.md +++ b/examples/v1beta1/trial-images/simple-pbt/README.md @@ -19,7 +19,7 @@ In this problem, using PBT with a population of 2-4 is sufficient to roughly approximate this lr schedule. Higher population sizes will yield faster convergence. Training will not converge without PBT. -If you want read more about this example, vist the +If you want to read more about this example, vist the [ray](https://github.com/ray-project/ray/blob/7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065/python/ray/tune/examples/README.rst) documentation. diff --git a/go.mod b/go.mod index 46c939e51da..678bc18ac00 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kubeflow/katib -go 1.18 +go 1.19 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 diff --git a/hack/verify-golangci-lint.sh b/hack/verify-golangci-lint.sh index 5b2bd4ec12e..4a8a440aecc 100755 --- a/hack/verify-golangci-lint.sh +++ b/hack/verify-golangci-lint.sh @@ -25,4 +25,4 @@ if [ -z "$(command -v golangci-lint)" ]; then fi echo 'Running golangci-lint' -golangci-lint run --timeout 5m --go 1.18 +golangci-lint run --timeout 5m --go 1.19 diff --git a/pkg/client/controller/clientset/versioned/fake/register.go b/pkg/client/controller/clientset/versioned/fake/register.go index 64a35f9b067..fa97ed11338 100644 --- a/pkg/client/controller/clientset/versioned/fake/register.go +++ b/pkg/client/controller/clientset/versioned/fake/register.go @@ -43,14 +43,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/controller/clientset/versioned/scheme/register.go b/pkg/client/controller/clientset/versioned/scheme/register.go index dac1ac07af1..fc5e8fd7b04 100644 --- a/pkg/client/controller/clientset/versioned/scheme/register.go +++ b/pkg/client/controller/clientset/versioned/scheme/register.go @@ -43,14 +43,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/metricscollector/v1beta1/common/pns.go b/pkg/metricscollector/v1beta1/common/pns.go index 39c7740bcb5..66a5a3f0bb5 100644 --- a/pkg/metricscollector/v1beta1/common/pns.go +++ b/pkg/metricscollector/v1beta1/common/pns.go @@ -18,7 +18,6 @@ package common import ( "fmt" - "io/ioutil" "os" "path/filepath" "runtime" @@ -139,7 +138,7 @@ func WaitPIDs(pids map[int]bool, mainPid int, opts WaitPidsOpts) error { if opts.CompletedMarkedDirPath != "" { markFile := filepath.Join(opts.CompletedMarkedDirPath, fmt.Sprintf("%d.pid", pid)) // Read file with "completed" marker - contents, err := ioutil.ReadFile(markFile) + contents, err := os.ReadFile(markFile) if err != nil { return fmt.Errorf("training container is failed. Unable to read file %v for pid %v, error: %v", markFile, pid, err) } diff --git a/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go b/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go index e2dbee76823..e92e6442d30 100644 --- a/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go +++ b/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go @@ -19,7 +19,7 @@ package sidecarmetricscollector import ( "encoding/json" "fmt" - "io/ioutil" + "io" "os" "regexp" "strconv" @@ -40,7 +40,7 @@ func CollectObservationLog(fileName string, metrics []string, filters []string, return nil, err } defer file.Close() - content, err := ioutil.ReadAll(file) + content, err := io.ReadAll(file) if err != nil { return nil, err } diff --git a/pkg/new-ui/v1beta1/backend.go b/pkg/new-ui/v1beta1/backend.go index eb6583550ba..80c5aff83b4 100644 --- a/pkg/new-ui/v1beta1/backend.go +++ b/pkg/new-ui/v1beta1/backend.go @@ -211,7 +211,7 @@ func (k *KatibUIHandler) FetchTrialTemplates(w http.ResponseWriter, r *http.Requ } } -//AddTemplate adds template to ConfigMap +// AddTemplate adds template to ConfigMap func (k *KatibUIHandler) AddTemplate(w http.ResponseWriter, r *http.Request) { var data map[string]interface{} if err := json.NewDecoder(r.Body).Decode(&data); err != nil { diff --git a/pkg/ui/v1beta1/backend.go b/pkg/ui/v1beta1/backend.go index 9274d82b27e..9b58eebd02c 100644 --- a/pkg/ui/v1beta1/backend.go +++ b/pkg/ui/v1beta1/backend.go @@ -226,7 +226,7 @@ func (k *KatibUIHandler) FetchTrialTemplates(w http.ResponseWriter, r *http.Requ } } -//AddTemplate adds template to ConfigMap +// AddTemplate adds template to ConfigMap func (k *KatibUIHandler) AddTemplate(w http.ResponseWriter, r *http.Request) { var data map[string]interface{} if err := json.NewDecoder(r.Body).Decode(&data); err != nil { diff --git a/test/e2e/v1beta1/hack/aws/run-e2e-experiment.go b/test/e2e/v1beta1/hack/aws/run-e2e-experiment.go index a84bd5e7def..23c46c2f963 100644 --- a/test/e2e/v1beta1/hack/aws/run-e2e-experiment.go +++ b/test/e2e/v1beta1/hack/aws/run-e2e-experiment.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "fmt" - "io/ioutil" "log" "os" "os/exec" @@ -55,7 +54,7 @@ func main() { log.Fatal("Path to Experiment yaml is missing") } expPath := os.Args[1] - byteExp, err := ioutil.ReadFile(expPath) + byteExp, err := os.ReadFile(expPath) if err != nil { log.Fatalf("Error in reading file: %v", err) } diff --git a/test/e2e/v1beta1/hack/gh-actions/run-e2e-experiment.go b/test/e2e/v1beta1/hack/gh-actions/run-e2e-experiment.go index 44504f2d224..d3021f6ed98 100644 --- a/test/e2e/v1beta1/hack/gh-actions/run-e2e-experiment.go +++ b/test/e2e/v1beta1/hack/gh-actions/run-e2e-experiment.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "fmt" - "io/ioutil" "log" "os" "os/exec" @@ -47,7 +46,7 @@ func main() { log.Fatal("Path to Experiment yaml is missing") } expPath := os.Args[1] - byteExp, err := ioutil.ReadFile(expPath) + byteExp, err := os.ReadFile(expPath) if err != nil { log.Fatalf("Error in reading file: %v", err) }