From 41313db1b2eaa16063eafc702edf9815c8164747 Mon Sep 17 00:00:00 2001 From: hari-selvarajan_data Date: Mon, 27 Jan 2025 17:56:46 +0000 Subject: [PATCH] resolving review comments --- .vscode/settings.json | 21 +++++++++++++++++++++ cmd/labs/github/releases.go | 7 ++++--- cmd/labs/install.go | 2 +- cmd/labs/project/fetcher.go | 7 +------ 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..2c4fbeb90 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "[go]": { + "editor.insertSpaces": false, + "editor.formatOnSave": true + }, + "go.lintTool": "golangci-lint", + "go.lintFlags": [ + "--fast" + ], + "go.useLanguageServer": true, + "gopls": { + "formatting.gofumpt": true + }, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "python.envFile": "${workspaceRoot}/.env", + "python.analysis.stubPath": ".vscode", + "jupyter.interactiveWindow.cellMarker.codeRegex": "^# COMMAND ----------|^# Databricks notebook source|^(#\\s*%%|#\\s*\\|#\\s*In\\[\\d*?\\]|#\\s*In\\[ \\])", + "jupyter.interactiveWindow.cellMarker.default": "# COMMAND ----------" +} \ No newline at end of file diff --git a/cmd/labs/github/releases.go b/cmd/labs/github/releases.go index 1737ffbf4..d2a26c7f8 100644 --- a/cmd/labs/github/releases.go +++ b/cmd/labs/github/releases.go @@ -23,9 +23,10 @@ func NewReleaseCache(org, repo, cacheDir string) *ReleaseCache { } type ReleaseCache struct { - Cache localcache.LocalCache[Versions] - Org string - Repo string + Cache localcache.LocalCache[Versions] + Org string + Repo string + Offline bool } func (r *ReleaseCache) Load(ctx context.Context) (Versions, error) { diff --git a/cmd/labs/install.go b/cmd/labs/install.go index 978916bb8..5735ce30c 100644 --- a/cmd/labs/install.go +++ b/cmd/labs/install.go @@ -10,7 +10,7 @@ func newInstallCommand() *cobra.Command { cmd := &cobra.Command{} var offlineInstall bool - cmd.Flags().BoolVar(&offlineInstall, "offline-install", offlineInstall, `If installing in offline mode, set this flag to true.`) + cmd.Flags().BoolVar(&offlineInstall, "offline", offlineInstall, `If installing in offline mode, set this flag to true.`) cmd.Use = "install NAME" cmd.Args = root.ExactArgs(1) diff --git a/cmd/labs/project/fetcher.go b/cmd/labs/project/fetcher.go index efc654c8d..97f83750b 100644 --- a/cmd/labs/project/fetcher.go +++ b/cmd/labs/project/fetcher.go @@ -127,12 +127,7 @@ func (f *fetcher) checkReleasedVersions(cmd *cobra.Command, version string, offl // `databricks labs isntall X` doesn't know which exact version to fetch, so first // we fetch all versions and then pick the latest one dynamically. var versions github.Versions - if offlineInstall { - versions, err = github.NewReleaseCache("databrickslabs", f.name, cacheDir).LoadCache(ctx) - } else { - versions, err = github.NewReleaseCache("databrickslabs", f.name, cacheDir).Load(ctx) - } - + versions, err = github.NewReleaseCache("databrickslabs", f.name, cacheDir, offlineInstall).Load(ctx) if err != nil { return "", fmt.Errorf("versions: %w", err) }