From e02ae94e633335a187c90c9e3ea54344ac12140c Mon Sep 17 00:00:00 2001 From: Amokstakov Date: Tue, 28 Nov 2023 11:53:49 -0800 Subject: [PATCH 1/3] Fixing spinner --- cmd/create.go | 14 +++++++------- cmd/ui/spinner/spinner.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index d5e760cf..3e52c135 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -155,23 +155,23 @@ var createCmd = &cobra.Command{ } project.AbsolutePath = currentWorkingDir spinner := tea.NewProgram(spinner.InitialModelNew()) + // add synchronization to wait for spinner to finish wg := sync.WaitGroup{} wg.Add(1) go func() { defer wg.Done() // only run the spinner if the command is interactive - if isInteractive { - if _, err := spinner.Run(); err != nil { - cobra.CheckErr(err) - } + if _, err := spinner.Run(); err != nil { + cobra.CheckErr(err) } }() + err = project.CreateMainFile() + // once the create is done, stop the spinner - if isInteractive { - spinner.Quit() - } + spinner.Quit() + // wait for the spinner to finish wg.Wait() if err != nil { diff --git a/cmd/ui/spinner/spinner.go b/cmd/ui/spinner/spinner.go index 4fa0b940..4a567785 100644 --- a/cmd/ui/spinner/spinner.go +++ b/cmd/ui/spinner/spinner.go @@ -54,7 +54,7 @@ func (m model) View() string { if m.err != nil { return m.err.Error() } - str := fmt.Sprintf("\n\n %s Preparing...\n\n", m.spinner.View()) + str := fmt.Sprintf("%s Preparing...", m.spinner.View()) if m.quitting { return str + "\n" } From 2dc546a6e2d0d56bf5e8104e5827ae71792a5410 Mon Sep 17 00:00:00 2001 From: Amokstakov Date: Tue, 28 Nov 2023 12:01:05 -0800 Subject: [PATCH 2/3] Temporary unblocker for high priority fix --- .github/workflows/generate-linter.yml | 5 ++--- cmd/create.go | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-linter.yml b/.github/workflows/generate-linter.yml index 090b96fb..6cfcca13 100644 --- a/.github/workflows/generate-linter.yml +++ b/.github/workflows/generate-linter.yml @@ -22,14 +22,13 @@ jobs: matrix: framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo] - driver: - [mysql, postgres, sqlite, mongo, none] + driver: [mysql, postgres, sqlite, mongo, none] goVersion: ["1.20"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: build templates - run: go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} + run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}}" /dev/null - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/cmd/create.go b/cmd/create.go index 3e52c135..eeaecb2d 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -161,7 +161,6 @@ var createCmd = &cobra.Command{ wg.Add(1) go func() { defer wg.Done() - // only run the spinner if the command is interactive if _, err := spinner.Run(); err != nil { cobra.CheckErr(err) } From ca31bac1e8e433f04fadaa2b71e48d2aed229dfb Mon Sep 17 00:00:00 2001 From: Amokstakov Date: Tue, 28 Nov 2023 12:11:17 -0800 Subject: [PATCH 3/3] trying to fix broken pipe tests --- .github/workflows/generate-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-linter.yml b/.github/workflows/generate-linter.yml index 6cfcca13..ae2fe55d 100644 --- a/.github/workflows/generate-linter.yml +++ b/.github/workflows/generate-linter.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: build templates - run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}}" /dev/null + run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{matrix.driver}}" /dev/null - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: