Skip to content

Commit

Permalink
lint(nilaway): Updated GitHub Action
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Kosiewski <[email protected]>
  • Loading branch information
ThomasK33 committed Jul 10, 2024
1 parent e16b96a commit 9eb6b62
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,11 @@ jobs:
exit 1
fi
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]

- name: Build custom golangci-lint
run: golangci-lint custom

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
run: ./custom-gcl run
1 change: 1 addition & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ release-snapshot: gen-license-report
# Run golangci-lint for all packages
lint *ARGS:
[ -f ./custom-gcl ] || golangci-lint custom
./custom-gcl cache clean
./custom-gcl run {{ARGS}}

# Check struct memory alignment and print potential improvements
Expand Down
16 changes: 12 additions & 4 deletions cmd/vclusterctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand All @@ -27,13 +28,17 @@ import (
)

// NewRootCmd returns a new root command
func NewRootCmd(log log.Logger, globalFlags *flags.GlobalFlags) *cobra.Command {
func NewRootCmd(log log.Logger) *cobra.Command {
return &cobra.Command{
Use: "vcluster",
SilenceUsage: true,
SilenceErrors: true,
Short: "Welcome to vcluster!",
PersistentPreRun: func(_ *cobra.Command, _ []string) {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if globalFlags == nil {
return errors.New("nil globalFlags")
}

if globalFlags.Config == "" {
var err error
globalFlags.Config, err = config.DefaultFilePath()
Expand All @@ -52,6 +57,8 @@ func NewRootCmd(log log.Logger, globalFlags *flags.GlobalFlags) *cobra.Command {
} else {
log.SetLevel(logrus.InfoLevel)
}

return nil
},
Long: `vcluster root command`,
}
Expand Down Expand Up @@ -84,10 +91,11 @@ func Execute() {
}
}

var globalFlags *flags.GlobalFlags

// BuildRoot creates a new root command from the
func BuildRoot(log log.Logger) (*cobra.Command, *flags.GlobalFlags, error) {
var globalFlags *flags.GlobalFlags
rootCmd := NewRootCmd(log, globalFlags)
rootCmd := NewRootCmd(log)
persistentFlags := rootCmd.PersistentFlags()
globalFlags = flags.SetGlobalFlags(persistentFlags, log)

Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/resources/ingresses/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func TestSync(t *testing.T) {
"vcluster.loft.sh/object-namespace": baseIngress.Namespace,
translate.UIDAnnotation: "",
"alb.ingress.kubernetes.io/actions.testservice-x-test-x-suffix": `{"forwardConfig":{"targetGroups":[{"serviceName":"nginx-service-x-test-x-suffix","servicePort":"80","weight":100}]}}`,
"alb.ingress.kubernetes.io/actions.ssl-redirect-x-test-x-suffix": `{"type":"redirect","forwardConfig":{},"redirectConfig":{"Port":"443","Protocol":"HTTPS","StatusCode":"HTTP_301"}}`,
"alb.ingress.kubernetes.io/actions.ssl-redirect-x-test-x-suffix": `{"redirectConfig":{"Port":"443","Protocol":"HTTPS","StatusCode":"HTTP_301"},"type":"redirect","forwardConfig":{}}`,
},
},
},
Expand Down

0 comments on commit 9eb6b62

Please sign in to comment.