From cd02be836dc8b33e2350d650cd049dd55a68a6b0 Mon Sep 17 00:00:00 2001 From: Leonardo Risch Date: Thu, 2 Oct 2025 18:11:57 -0300 Subject: [PATCH] fix: building cli --- .github/workflows/release.yml | 14 ++++++++++++++ .goreleaser.yaml | 2 ++ cli/block_get_operation.go | 7 ++++--- cli/block_list_operation.go | 7 ++++--- cli/block_mount_operation.go | 11 ++++++----- cmd/lsh/go.mod | 3 --- 6 files changed, 30 insertions(+), 14 deletions(-) delete mode 100644 cmd/lsh/go.mod diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4724cf3..ab2cc5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,10 @@ on: push: tags: - 'v*' + workflow_dispatch: + create: + tags: + - 'v*' permissions: contents: write @@ -25,6 +29,11 @@ jobs: uses: actions/setup-go@v4 with: go-version: '1.22.0' + - + name: Remove conflicting go.mod + run: | + # Remove cmd/lsh/go.mod as it conflicts with root go.mod + rm -f cmd/lsh/go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 @@ -48,6 +57,11 @@ jobs: uses: actions/setup-go@v4 with: go-version: '1.22.0' + - + name: Remove conflicting go.mod + run: | + # Remove cmd/lsh/go.mod as it conflicts with root go.mod + rm -f cmd/lsh/go.mod - name: Generate documentation run: go run internal/generator/documentation/generate.go diff --git a/.goreleaser.yaml b/.goreleaser.yaml index f5f051d..06a523d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -10,6 +10,8 @@ project_name: lsh before: hooks: + # Remove conflicting go.mod in cmd/lsh if it exists + - rm -f cmd/lsh/go.mod - go mod tidy - go mod download diff --git a/cli/block_get_operation.go b/cli/block_get_operation.go index 5ecf3e9..50bf667 100644 --- a/cli/block_get_operation.go +++ b/cli/block_get_operation.go @@ -6,6 +6,7 @@ import ( "os" latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk" + "github.com/latitudesh/lsh/cmd/lsh" "github.com/latitudesh/lsh/internal/cmdflag" "github.com/latitudesh/lsh/internal/utils" "github.com/spf13/cobra" @@ -67,8 +68,8 @@ func (o *BlockGetOperation) run(cmd *cobra.Command, args []string) error { return fmt.Errorf("error getting block ID: %w", err) } - if dryRun { - logDebugf("dry-run flag specified. Skip sending request.") + if lsh.DryRun { + lsh.LogDebugf("dry-run flag specified. Skip sending request.") return nil } @@ -94,7 +95,7 @@ func (o *BlockGetOperation) run(cmd *cobra.Command, args []string) error { return nil } - if !debug { + if !lsh.Debug { if response != nil && response.HTTPMeta.Response != nil { fmt.Fprintf(os.Stdout, "Block storage details retrieved (Status: %s)\n", response.HTTPMeta.Response.Status) fmt.Fprintf(os.Stdout, "\nNote: This command will show connector_id, gateway IP, and port once the API returns them.\n") diff --git a/cli/block_list_operation.go b/cli/block_list_operation.go index 476f46a..b8a4c94 100644 --- a/cli/block_list_operation.go +++ b/cli/block_list_operation.go @@ -6,6 +6,7 @@ import ( "os" latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk" + "github.com/latitudesh/lsh/cmd/lsh" "github.com/latitudesh/lsh/internal/cmdflag" "github.com/latitudesh/lsh/internal/utils" "github.com/spf13/cobra" @@ -64,8 +65,8 @@ func (o *BlockListOperation) run(cmd *cobra.Command, args []string) error { // Get optional project filter project, _ := cmd.Flags().GetString("project") - if dryRun { - logDebugf("dry-run flag specified. Skip sending request.") + if lsh.DryRun { + lsh.LogDebugf("dry-run flag specified. Skip sending request.") return nil } @@ -93,7 +94,7 @@ func (o *BlockListOperation) run(cmd *cobra.Command, args []string) error { return nil } - if !debug { + if !lsh.Debug { if response != nil && response.HTTPMeta.Response != nil { fmt.Fprintf(os.Stdout, "Block storages listed successfully (Status: %s)\n", response.HTTPMeta.Response.Status) fmt.Fprintf(os.Stdout, "\nNote: Use 'lsh block get --id ' to see full details including connector information\n") diff --git a/cli/block_mount_operation.go b/cli/block_mount_operation.go index efa33a6..7f29f03 100644 --- a/cli/block_mount_operation.go +++ b/cli/block_mount_operation.go @@ -12,6 +12,7 @@ import ( latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk" "github.com/latitudesh/latitudesh-go-sdk/models/operations" + "github.com/latitudesh/lsh/cmd/lsh" "github.com/latitudesh/lsh/internal/cmdflag" "github.com/latitudesh/lsh/internal/utils" "github.com/spf13/cobra" @@ -450,8 +451,8 @@ func (o *BlockMountOperation) run(cmd *cobra.Command, args []string) error { printStatus(fmt.Sprintf("āœ“ Using NQN: %s", nqn)) } - if dryRun { - logDebugf("dry-run flag specified. Skip sending request.") + if lsh.DryRun { + lsh.LogDebugf("dry-run flag specified. Skip sending request.") return nil } @@ -478,7 +479,7 @@ func (o *BlockMountOperation) run(cmd *cobra.Command, args []string) error { fmt.Fprintf(os.Stdout, "\nšŸ“‹ Fetching block storage details...\n") printStatus(fmt.Sprintf("Block ID: %s", blockID)) - if debug { + if lsh.Debug { fmt.Fprintf(os.Stdout, "[DEBUG] Fetching block storage details to get connector_id\n") } @@ -546,7 +547,7 @@ func (o *BlockMountOperation) run(cmd *cobra.Command, args []string) error { printStatus(fmt.Sprintf("Block ID: %s", blockID)) printStatus(fmt.Sprintf("Client NQN (for authorization): %s", nqn)) - if debug { + if lsh.Debug { fmt.Fprintf(os.Stdout, "[DEBUG] API Request: POST /storage/blocks/%s/mount\n", blockID) fmt.Fprintf(os.Stdout, "[DEBUG] Request Body: {\"data\":{\"type\":\"blocks\",\"attributes\":{\"nqn\":\"%s\"}}}\n", nqn) } @@ -568,7 +569,7 @@ func (o *BlockMountOperation) run(cmd *cobra.Command, args []string) error { return err } - if debug { + if lsh.Debug { fmt.Fprintf(os.Stdout, "[DEBUG] API Response Status: %d\n", response.HTTPMeta.Response.StatusCode) } diff --git a/cmd/lsh/go.mod b/cmd/lsh/go.mod deleted file mode 100644 index 616ce1c..0000000 --- a/cmd/lsh/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/latitudesh/lsh - -go 1.21.6