Skip to content

Commit 1fa7569

Browse files
authored
Merge pull request #2264 from pratikjagrut/gh.action
fix: bump up golangci-lint version
2 parents ffa1317 + 3a2e73e commit 1fa7569

6 files changed

Lines changed: 30 additions & 25 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ jobs:
1717
name: lint
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v2
21-
- name: golangci-lint
22-
uses: golangci/golangci-lint-action@v2
20+
- uses: actions/setup-go@v3
21+
with:
22+
go-version: 1.18
23+
- uses: actions/checkout@v3
24+
- name: Run golangci-lint
25+
uses: golangci/golangci-lint-action@v3.2.0
2326
with:
24-
version: v1.45.2
2527
args:
2628
-v
2729
--config=.golangci.yml

cmd/root.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ import (
44
"context"
55
"flag"
66
"fmt"
7+
"io/ioutil"
8+
"os"
9+
"strings"
10+
"sync"
11+
"time"
12+
713
"github.com/loft-sh/devspace/pkg/devspace/config/loader"
814
"github.com/loft-sh/devspace/pkg/devspace/config/loader/variable/expression"
915
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
1016
"github.com/loft-sh/devspace/pkg/devspace/env"
1117
"github.com/loft-sh/devspace/pkg/util/log"
1218
"github.com/loft-sh/devspace/pkg/util/message"
13-
"io/ioutil"
14-
"os"
15-
"strings"
16-
"sync"
17-
"time"
1819

1920
"github.com/loft-sh/devspace/pkg/devspace/hook"
2021
"github.com/loft-sh/devspace/pkg/util/interrupt"
@@ -191,7 +192,7 @@ func BuildRoot(f factory.Factory, excludePlugins bool) *cobra.Command {
191192
// This check is necessary to avoid process loops where a variable inside
192193
// the devspace.yaml would execute another devspace command which would again
193194
// load the config and execute DevSpace config parsing etc.
194-
if os.Getenv(expression.DEVSPACE_SKIP_PRELOAD_ENV) == "" {
195+
if os.Getenv(expression.DevSpaceSkipPreloadEnv) == "" {
195196
rawConfig, err = parseConfig(f)
196197
if err != nil {
197198
f.GetLog().Debugf("error parsing raw config: %v", err)

pkg/devspace/config/loader/variable/command_variable.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package variable
33
import (
44
"bytes"
55
"context"
6+
"os"
7+
"strings"
8+
69
"github.com/loft-sh/devspace/pkg/devspace/config/loader/variable/expression"
710
"github.com/loft-sh/devspace/pkg/devspace/pipeline/engine"
811
"mvdan.cc/sh/v3/expand"
9-
"os"
10-
"strings"
1112

1213
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
1314
"github.com/loft-sh/devspace/pkg/util/command"
@@ -55,7 +56,7 @@ func execCommand(ctx context.Context, varName string, definition *latest.Variabl
5556
stdErrWriter := &bytes.Buffer{}
5657
var err error
5758
envVars := []string{}
58-
envVars = append(envVars, expression.DEVSPACE_SKIP_PRELOAD_ENV+"=true")
59+
envVars = append(envVars, expression.DevSpaceSkipPreloadEnv+"=true")
5960
envVars = append(envVars, os.Environ()...)
6061
if args == nil {
6162
err = engine.ExecuteSimpleShellCommand(ctx, dir, expand.ListEnviron(envVars...), writer, stdErrWriter, nil, cmd)

pkg/devspace/config/loader/variable/default_variable.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package variable
22

33
import (
44
"context"
5-
"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
6-
"github.com/sirupsen/logrus"
75
"os"
86
"strconv"
97

8+
"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
9+
"github.com/sirupsen/logrus"
10+
1011
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
1112
"github.com/loft-sh/devspace/pkg/util/log"
1213
)
@@ -24,7 +25,6 @@ func NewDefaultVariable(name string, workingDirectory string, localCache localca
2425
type defaultVariable struct {
2526
name string
2627
workingDirectory string
27-
dry bool
2828
localCache localcache.Cache
2929
log log.Logger
3030
}

pkg/devspace/config/loader/variable/expression/expression.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"github.com/loft-sh/devspace/pkg/devspace/pipeline/engine"
8-
"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
9-
"github.com/loft-sh/devspace/pkg/util/yamlutil"
10-
"mvdan.cc/sh/v3/expand"
11-
"mvdan.cc/sh/v3/interp"
127
"os"
138
"os/exec"
149
"regexp"
1510
"strconv"
1611
"strings"
1712

13+
"github.com/loft-sh/devspace/pkg/devspace/pipeline/engine"
14+
"github.com/loft-sh/devspace/pkg/devspace/pipeline/env"
15+
"github.com/loft-sh/devspace/pkg/util/yamlutil"
16+
"mvdan.cc/sh/v3/expand"
17+
"mvdan.cc/sh/v3/interp"
18+
1819
"github.com/loft-sh/devspace/pkg/devspace/deploy/deployer/kubectl/walk"
1920
)
2021

2122
// ExpressionMatchRegex is the regex to check if a value matches the devspace var format
2223
var ExpressionMatchRegex = regexp.MustCompile(`(?ms)^\$\#?\!?\((.+)\)$`)
2324

24-
const DEVSPACE_SKIP_PRELOAD_ENV = "DEVSPACE_SKIP_PRELOAD"
25+
const DevSpaceSkipPreloadEnv = "DEVSPACE_SKIP_PRELOAD"
2526

2627
func expressionMatchFn(key, value string) bool {
2728
return ExpressionMatchRegex.MatchString(value)
@@ -99,7 +100,7 @@ func ResolveExpressions(ctx context.Context, value, dir string, variables map[st
99100
stderr := &bytes.Buffer{}
100101

101102
envVars := []string{}
102-
envVars = append(envVars, DEVSPACE_SKIP_PRELOAD_ENV+"=true")
103+
envVars = append(envVars, DevSpaceSkipPreloadEnv+"=true")
103104
envVars = append(envVars, os.Environ()...)
104105
err := engine.ExecuteSimpleShellCommand(ctx, dir, env.NewVariableEnvProvider(expand.ListEnviron(envVars...), vars), stdout, stderr, nil, match[1], os.Args[1:]...)
105106
if err != nil {

pkg/devspace/helm/v3/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ func (c *client) InstallChart(ctx devspacecontext.Context, releaseName string, r
8787
// log into OCI registry if specified
8888
if strings.HasPrefix(chartName, "oci://") {
8989
if helmConfig.Chart.Username != "" && helmConfig.Chart.Password != "" {
90-
chartNameUrl, err := url.Parse(chartName)
90+
chartNameURL, err := url.Parse(chartName)
9191
if err != nil {
9292
return nil, errors.Wrap(err, "chartName malformed for oci registry")
9393
}
9494

95-
_, err = c.genericHelm.Exec(ctx, []string{"registry", "login", chartNameUrl.Hostname(), "--username", helmConfig.Chart.Username, "--password", helmConfig.Chart.Password})
95+
_, err = c.genericHelm.Exec(ctx, []string{"registry", "login", chartNameURL.Hostname(), "--username", helmConfig.Chart.Username, "--password", helmConfig.Chart.Password})
9696
if err != nil {
9797
return nil, errors.Wrap(err, "login oci registry")
9898
}

0 commit comments

Comments
 (0)