Skip to content

Commit e8e3f85

Browse files
authored
Merge pull request #29 from Boemeltrein/go-lint-fix2
fix(workflow): go-lint, error resolving
2 parents 183f1d6 + 5ef5acb commit e8e3f85

10 files changed

Lines changed: 23 additions & 1 deletion

File tree

cmd/flux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
//nolint:unused
910
var fluxLongHelp = strings.TrimSpace(`
1011
These are all commands that can be used to maintain FluxCD
1112

cmd/helmrelease.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
//nolint:unused
910
var helmreleaseHelp = strings.TrimSpace(`
1011
A toolkit to load helm-release files onto a cluster without flux.
1112
originally created to make it easier to install/upgrade/edit flux-based clusterresources without flux

cmd/talos.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
//nolint:unused
910
var talosLongHelp = strings.TrimSpace(`
1011
These are all commands that can be used to maintain Talos OS
1112

cmd/talos_kubeconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/trueforge-org/forgetool/pkg/talassist"
1212
)
1313

14+
//nolint:unused
1415
var advKubeconfigLongHelp = strings.TrimSpace(`
1516
1617
`)

pkg/fluxhandler/helm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func HelmPull(repo string, name string, version string, dest string, silent bool
101101
link = name
102102
repoName := cleanRepoURL(repo)
103103
updateHelmRepo(repoName, repo, silent)
104-
repo = repoName
104+
// repo = repoName (Commented out by Boemeltrein, seems unused, changed for linting purposes)
105105
} else {
106106
link = repo + "/" + name
107107
client.RepoURL = ""

pkg/fluxhandler/sshsecretgen.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func CreateGitSecret(gitURL string) error {
128128
}
129129

130130
// indentYaml indents each line of the YAML string with the specified indentation.
131+
//nolint:unused
131132
func indentYaml(yamlStr, indent string) string {
132133
lines := strings.Split(yamlStr, "\n")
133134
for i, line := range lines {
@@ -193,11 +194,13 @@ func generateKnownHostsEntry(url string) string {
193194
}
194195

195196
// encodeToBase64 encodes data to a base64 string
197+
//nolint:unused
196198
func encodeToBase64(data []byte) string {
197199
return string(data)
198200
}
199201

200202
// decodeBase64 decodes a base64 string
203+
//nolint:unused
201204
func decodeBase64(data string) ([]byte, error) {
202205
return []byte(data), nil
203206
}

pkg/gencmd/bootstrap.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ func RunBootstrap(args []string) {
8989
helmRepoPath := filepath.Join("./repositories", "helm")
9090
HelmRepos, err = fluxhandler.LoadAllHelmRepos(helmRepoPath)
9191

92+
// Added by Boemeltrein, for linting purposes
93+
if err != nil {
94+
log.Error().Err(err).Msg("Failed to load Helm repositories")
95+
return
96+
}
97+
9298
// Call ApprovePendingCertificates with clientset and stopCh
9399
go kubectlcmds.ApprovePendingCertificates(clientset, stopCh)
94100

pkg/gencmd/execcmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func ExecCmd(cmd string) {
1515
log.Trace().Msgf("command", argslice[:])
1616

1717
// log.Info().Msg("test", strings.Join(argslice, " "))
18+
//nolint:ineffassign
1819
out, err := helper.RunCommand(argslice, false)
1920
if err != nil {
2021
log.Info().Msgf("err: %v", err)

pkg/initfiles/initfiles.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ func GetSecKey() (string, error) {
488488
func GenSopsSecret() error {
489489
secretPath := filepath.Join(helper.ClusterPath, "kubernetes", "flux-system", "flux", "sopssecret.secret.yaml")
490490
ageSecKey, err := GetSecKey()
491+
492+
// Added by Boemeltrein, for linting purposes
493+
if err != nil {
494+
return fmt.Errorf("failed to get age secret key: %w", err)
495+
}
496+
491497
// Generate Kubernetes secret YAML content
492498
secret := map[string]interface{}{
493499
"apiVersion": "v1",

pkg/sops/wrapper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import (
1818
"github.com/trueforge-org/forgetool/pkg/helper"
1919
)
2020

21+
//nolint:unused
2122
var encrConfig *EncryptionConfig
2223

24+
//nolint:unused
2325
const ageKeyFilePath = "./age.agekey"
2426

2527
func EncryptWithAgeKey(body []byte, regex string, format string) ([]byte, error) {

0 commit comments

Comments
 (0)