Commit 275ba004 authored by Muhammad Umair Khan's avatar Muhammad Umair Khan
Browse files

chore(meepctl): fix golangci-lint v2 compatibility and code quality issues

- Update `.golangci.yml` to v2 format (add version, move goimports to formatters, remove deprecated linters)
- Replace deprecated `ioutil` calls with `os`/`io` equivalents
- Remove ineffectual `err = nil` assignments in utility functions
- Refactor `if/else` chains to `switch` statements for better readability
- Replace `strings.Replace` with `strings.ReplaceAll` where applicable
- Fix error string capitalization to comply with Go conventions
- Apply `goimports` formatting fixes across all modified files
- Fix CRLF line endings in `go-apps/meepctl/install.sh`
parent 70fd684c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -89,9 +89,10 @@ func deleteRun(cmd *cobra.Command, args []string) {
	}

	start := time.Now()
	if group == "core" {
	switch group {
	case "core":
		deleteApps(deleteData.coreApps, cmd)
	} else if group == "dep" {
	case "dep":
		deleteApps(deleteData.depApps, cmd)
	}

+3 −2
Original line number Diff line number Diff line
@@ -139,9 +139,10 @@ func deployRun(cmd *cobra.Command, args []string) {
	deployEnsureStorage(cmd)

	// Deploy microservices
	if group == "core" {
	switch group {
	case "core":
		deployCore(cmd)
	} else if group == "dep" {
	case "dep":
		createCRD(cmd)
		deployDep(cmd)
	}
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ func createClient(path string) (*sandbox.APIClient, error) {
	ceClientCfg.BasePath = path
	ceClient := sandbox.NewAPIClient(ceClientCfg)
	if ceClient == nil {
		err := errors.New("Failed to create REST API client")
		err := errors.New("failed to create REST API client")
		return nil, err
	}
	return ceClient, nil
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import (
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"

	"github.com/ghodss/yaml"
	"github.com/spf13/cobra"
@@ -75,7 +75,7 @@ func replayExport(cobraCmd *cobra.Command, replayFilename string, yamlFilename s
		return
	}

	err = ioutil.WriteFile(yamlFilename, jsonToYaml, 0644)
	err = os.WriteFile(yamlFilename, jsonToYaml, 0644)
	if err != nil {
		printError("Error creating yaml file: ", err, verbose)
		return
+7 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import (
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"io"
	"os"

	"github.com/ghodss/yaml"
@@ -65,9 +65,13 @@ func replayAdd(cobraCmd *cobra.Command, yamlFilename string, replayFilename stri
		printError("Error opening file: ", err, verbose)
		return
	}
	defer file.Close()
	defer func() {
		if closeErr := file.Close(); closeErr != nil {
			printError("Error closing file: ", closeErr, verbose)
		}
	}()

	b, err := ioutil.ReadAll(file)
	b, err := io.ReadAll(file)
	if err != nil {
		printError("Error reading file: ", err, verbose)
		return
Loading