From 8a7bc0d38b057ae75a0332c93e70daea7840b36f Mon Sep 17 00:00:00 2001 From: John McBride Date: Mon, 26 Aug 2024 09:53:02 -0600 Subject: [PATCH] feat: Use justfile vs. makefile - Cleans up and updates GitHub actions with new versions of actions - Cleans up failing linter checks - Upgrades Go dependencies Signed-off-by: John McBride --- .github/workflows/auto-add-to-project.yml | 4 +- .github/workflows/release.yaml | 79 ++++++++--- .github/workflows/test.yaml | 37 +++--- .golangci.yaml | 12 +- Dockerfile | 24 ++++ Makefile | 27 ---- cmd/auth/auth.go | 5 +- cmd/bake/bake.go | 5 +- cmd/insights/contributors.go | 5 +- cmd/insights/insights.go | 2 +- cmd/insights/repositories.go | 5 +- cmd/insights/user-contributions.go | 5 +- cmd/insights/utils.go | 1 + cmd/repo-query/repo-query.go | 5 +- cmd/root/root.go | 5 +- cmd/show/show.go | 7 +- cmd/version/version.go | 5 +- go.mod | 34 +++-- go.sum | 106 ++++++++------- justfile | 151 ++++++++++++++++++++++ pkg/utils/root.go | 3 +- 21 files changed, 378 insertions(+), 149 deletions(-) create mode 100644 Dockerfile delete mode 100644 Makefile create mode 100644 justfile diff --git a/.github/workflows/auto-add-to-project.yml b/.github/workflows/auto-add-to-project.yml index 195774f..3109bfb 100644 --- a/.github/workflows/auto-add-to-project.yml +++ b/.github/workflows/auto-add-to-project.yml @@ -1,4 +1,4 @@ -name: Adds all issues opened in the /pizza-cli repo to the Team Dashboard +name: "Adds issues to Team Dashboard" on: issues: @@ -16,7 +16,7 @@ jobs: with: app_id: ${{ secrets.OS_GITHUB_APP_ID }} private_key: ${{ secrets.OS_GITHUB_APP_PRIVATE_KEY }} - + - name: add issue to team dashboard uses: actions/add-to-project@v0.5.0 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1af6ad4..9d4295b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Semantic release +name: "Semantic release" on: push: @@ -7,27 +7,37 @@ on: - beta workflow_dispatch: +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: true + jobs: + test: + name: Test, lint, & build + uses: ./.github/workflows/test.yaml + release: + outputs: + release-tag: ${{ steps.semantic-release.outputs.release-tag }} name: Semantic release runs-on: ubuntu-latest timeout-minutes: 10 steps: - name: Generate token id: generate_token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.OS_GITHUB_APP_ID }} private_key: ${{ secrets.OS_GITHUB_APP_PRIVATE_KEY }} - name: "☁️ checkout repository" - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ steps.generate_token.outputs.token }} - name: "🔧 setup node" - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 @@ -36,47 +46,74 @@ jobs: - name: "🚀 release" id: semantic-release + uses: open-sauced/release@v2 env: # This ensures that publishing happens on every single trigger which then # forces the go binaries to be built in the next step and attached to the GitHub release FORCE_PUBLISH: "patch" + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_PACKAGE_ROOT: "npm" - uses: open-sauced/release@v2.2.1 - outputs: - release-tag: ${{ steps.semantic-release.outputs.release-tag }} build: + name: Build and publish artifacts needs: - release + if: needs.release.outputs.release-tag != '' runs-on: ubuntu-latest permissions: - contents: write # release changes require contents write + # release changes require contents write so that it can push Go binaries + contents: write strategy: matrix: goos: [darwin, linux, windows] goarch: [amd64, arm64] steps: - - name: Set up Go - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + - name: "☁️ checkout repository" + uses: actions/checkout@v4 + + - name: "🐹 Setup Go" + uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.22.x - - name: Check out code - uses: actions/checkout@v3 + - name: "🤲 Setup Just" + uses: extractions/setup-just@v2 - - name: Build and upload Go binaries + - name: "🔧 Build all and upload artifacts to release" env: GH_TOKEN: ${{ github.token }} run: | - CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \ - -ldflags="-s -w" \ - -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.writeOnlyPublicPosthogKey=${{ vars.POSTHOG_WRITE_PUBLIC_KEY }}'" \ - -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${{ needs.release.outputs.release-tag }}'" \ - -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ - -o build/pizza-${{ matrix.goos }}-${{ matrix.goarch }} - gh release upload ${{ needs.release.outputs.release-tag }} build/pizza-${{ matrix.goos }}-${{ matrix.goarch }} + export RELEASE_TAG_VERSION=${{ needs.release.outputs.release-tag }} + just build-${{ matrix.goos }}-${{ matrix.goarch }} + gh release upload ${{ needs.release.outputs.release-tag }} build/saucectl-${{ matrix.goos }}-${{ matrix.goarch }} + + docker: + name: Build and push container + needs: + - release + if: needs.release.outputs.release-tag != '' + runs-on: ubuntu-latest + steps: + - name: "☁️ checkout repository" + uses: actions/checkout@v4 + + - name: "🔧 setup buildx" + uses: docker/setup-buildx-action@v3 + + - name: "🐳 Login to ghcr" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "📦 docker build and push" + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.release.outputs.release-tag }} + push: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9b7fcbe..c415fa9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,6 +1,7 @@ -name: Lint, test, and build +name: "Lint, test, and build" on: + workflow_call: push: branches: - main @@ -12,6 +13,7 @@ on: - reopened permissions: + # So golangci-lint can read the contents of the lint yaml file contents: read @@ -19,34 +21,33 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: '1.22' - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.54.2 + version: v1.59.1 test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: '1.22' + - uses: extractions/setup-just@v2 - name: Test - run: make test + run: just test build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: 1.21.x - - name: Build go binary - run: make build + go-version: '1.22' + - uses: extractions/setup-just@v2 + - name: Build Go binary + run: just build diff --git a/.golangci.yaml b/.golangci.yaml index 6d09f75..560da71 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -8,8 +8,18 @@ linters: - staticcheck - unconvert - unused - - vet + - govet - gci +linters-settings: + gci: + sections: + # include the default standard section, default section, and the "local" + # section which can be configured with + # 'goimports -local github.com/open-sauced/saucectl' + - standard + - default + - localmodule + run: timeout: 5m diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8fe9450 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM --platform=$BUILDPLATFORM golang:1.22.5 AS builder + +ARG TARGETPLATFORM +ARG BUILDPLATFORM +ARG VERSION +ARG SHA + +# Get the dependencies downloaded +WORKDIR /app +ENV CGO_ENABLED=0 +COPY go.* ./ +RUN go mod download +COPY . ./ + +# Build Go CLI binary +RUN go build -ldflags="-s -w \ + -X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}' \ + -X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=${SHA}'" \ + -o pizza . + +# Runner layer +FROM --platform=$BUILDPLATFORM golang:alpine +COPY --from=builder /app/pizza /usr/bin/ +ENTRYPOINT ["/usr/bin/pizza"] diff --git a/Makefile b/Makefile deleted file mode 100644 index cb0873f..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -.PHONY: test build run - -all: lint test build - -fmt: - go fmt ./... - -lint: - docker run \ - -t \ - --rm \ - -v ./:/app \ - -w /app \ - golangci/golangci-lint:v1.54.2 \ - golangci-lint run -v - -test: - go test ./... - -build: - CGO_ENABLED=0 go build -o build/pizza main.go - -install: build - sudo mv build/pizza /usr/local/bin/ - -run: - go run main.go diff --git a/cmd/auth/auth.go b/cmd/auth/auth.go index 3c921bd..38d48a6 100644 --- a/cmd/auth/auth.go +++ b/cmd/auth/auth.go @@ -19,9 +19,10 @@ import ( "time" "github.com/cli/browser" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) //go:embed success.html @@ -48,7 +49,7 @@ func NewLoginCommand() *cobra.Command { Short: "Log into the CLI application via GitHub", Long: loginLongDesc, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { username, err := run() disableTelem, _ := cmd.Flags().GetBool(constants.FlagNameTelemetry) diff --git a/cmd/bake/bake.go b/cmd/bake/bake.go index 0cd7d99..6c219e5 100644 --- a/cmd/bake/bake.go +++ b/cmd/bake/bake.go @@ -9,10 +9,11 @@ import ( "sync" "github.com/open-sauced/go-api/client" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) // Options are the options for the pizza bake command including user @@ -55,7 +56,7 @@ func NewBakeCommand() *cobra.Command { opts.Repos = append(opts.Repos, args...) return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { endpointURL, _ := cmd.Flags().GetString(constants.FlagNameEndpoint) opts.APIClient = api.NewGoClient(endpointURL) disableTelem, _ := cmd.Flags().GetBool(constants.FlagNameTelemetry) diff --git a/cmd/insights/contributors.go b/cmd/insights/contributors.go index 28c76a6..cd320ef 100644 --- a/cmd/insights/contributors.go +++ b/cmd/insights/contributors.go @@ -12,10 +12,11 @@ import ( bubblesTable "github.com/charmbracelet/bubbles/table" "github.com/open-sauced/go-api/client" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) type contributorsOptions struct { @@ -50,7 +51,7 @@ func NewContributorsCommand() *cobra.Command { opts.Repos = append(opts.Repos, args...) return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { endpointURL, _ := cmd.Flags().GetString(constants.FlagNameEndpoint) opts.APIClient = api.NewGoClient(endpointURL) output, _ := cmd.Flags().GetString(constants.FlagNameOutput) diff --git a/cmd/insights/insights.go b/cmd/insights/insights.go index b2ff7ee..2a7b112 100644 --- a/cmd/insights/insights.go +++ b/cmd/insights/insights.go @@ -10,7 +10,7 @@ func NewInsightsCommand() *cobra.Command { Use: "insights [flags]", Short: "Gather insights about git contributors, repositories, users and pull requests", Long: "Gather insights about git contributors, repositories, user and pull requests and display the results", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Help() }, } diff --git a/cmd/insights/repositories.go b/cmd/insights/repositories.go index 1b7987b..3a55148 100644 --- a/cmd/insights/repositories.go +++ b/cmd/insights/repositories.go @@ -11,10 +11,11 @@ import ( bubblesTable "github.com/charmbracelet/bubbles/table" "github.com/open-sauced/go-api/client" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) type repositoriesOptions struct { @@ -51,7 +52,7 @@ func NewRepositoriesCommand() *cobra.Command { opts.Repos = append(opts.Repos, args...) return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { endpointURL, _ := cmd.Flags().GetString(constants.FlagNameEndpoint) opts.APIClient = api.NewGoClient(endpointURL) output, _ := cmd.Flags().GetString(constants.FlagNameOutput) diff --git a/cmd/insights/user-contributions.go b/cmd/insights/user-contributions.go index 4f6e312..eb6de93 100644 --- a/cmd/insights/user-contributions.go +++ b/cmd/insights/user-contributions.go @@ -12,10 +12,11 @@ import ( bubblesTable "github.com/charmbracelet/bubbles/table" "github.com/open-sauced/go-api/client" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) type userContributionsOptions struct { @@ -60,7 +61,7 @@ func NewUserContributionsCommand() *cobra.Command { opts.Repos = append(opts.Repos, args...) return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { endpointURL, _ := cmd.Flags().GetString(constants.FlagNameEndpoint) opts.APIClient = api.NewGoClient(endpointURL) output, _ := cmd.Flags().GetString(constants.FlagNameOutput) diff --git a/cmd/insights/utils.go b/cmd/insights/utils.go index 4978efd..a7bca74 100644 --- a/cmd/insights/utils.go +++ b/cmd/insights/utils.go @@ -6,6 +6,7 @@ import ( "net/http" "github.com/open-sauced/go-api/client" + "github.com/open-sauced/pizza-cli/pkg/utils" ) diff --git a/cmd/repo-query/repo-query.go b/cmd/repo-query/repo-query.go index ed47db2..bacdaf7 100644 --- a/cmd/repo-query/repo-query.go +++ b/cmd/repo-query/repo-query.go @@ -12,10 +12,11 @@ import ( "os/signal" "strings" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) type Options struct { @@ -42,7 +43,7 @@ func NewRepoQueryCommand() *cobra.Command { Use: "repo-query url [flags]", Short: "Ask questions about a GitHub repository", Long: repoQueryLongDesc, - Args: func(cmd *cobra.Command, args []string) error { + Args: func(_ *cobra.Command, args []string) error { if len(args) > 1 { return errors.New("only a single url can be ingested at a time") } diff --git a/cmd/root/root.go b/cmd/root/root.go index faf1ba5..401f6ac 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -4,6 +4,8 @@ package root import ( "fmt" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/cmd/auth" "github.com/open-sauced/pizza-cli/cmd/bake" "github.com/open-sauced/pizza-cli/cmd/insights" @@ -11,7 +13,6 @@ import ( "github.com/open-sauced/pizza-cli/cmd/show" "github.com/open-sauced/pizza-cli/cmd/version" "github.com/open-sauced/pizza-cli/pkg/constants" - "github.com/spf13/cobra" ) // NewRootCommand bootstraps a new root cobra command for the pizza CLI @@ -21,7 +22,7 @@ func NewRootCommand() (*cobra.Command, error) { Short: "OpenSauced CLI", Long: "A command line utility for insights, metrics, and all things OpenSauced", RunE: run, - Args: func(cmd *cobra.Command, args []string) error { + Args: func(cmd *cobra.Command, _ []string) error { betaFlag := cmd.Flags().Lookup(constants.FlagNameBeta) if betaFlag.Changed { err := cmd.Flags().Lookup(constants.FlagNameEndpoint).Value.Set(constants.EndpointBeta) diff --git a/cmd/show/show.go b/cmd/show/show.go index 9ab79e0..cff76e6 100644 --- a/cmd/show/show.go +++ b/cmd/show/show.go @@ -7,10 +7,11 @@ import ( "errors" client "github.com/open-sauced/go-api/client" + "github.com/spf13/cobra" + "github.com/open-sauced/pizza-cli/pkg/api" "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/open-sauced/pizza-cli/pkg/utils" - "github.com/spf13/cobra" ) // Options are the options for the pizza show command including user @@ -50,7 +51,7 @@ func NewShowCommand() *cobra.Command { Use: "show repository-name [flags]", Short: "Get visual metrics of a repository", Long: showLongDesc, - Args: func(cmd *cobra.Command, args []string) error { + Args: func(_ *cobra.Command, args []string) error { if len(args) != 1 { return errors.New("must specify the URL of a git repository to analyze") } @@ -64,7 +65,7 @@ func NewShowCommand() *cobra.Command { return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { var endpoint string customEndpoint, _ := cmd.Flags().GetString("endpoint") if customEndpoint != "" { diff --git a/cmd/version/version.go b/cmd/version/version.go index 87871e1..907dc85 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -3,15 +3,16 @@ package version import ( "fmt" - "github.com/open-sauced/pizza-cli/pkg/utils" "github.com/spf13/cobra" + + "github.com/open-sauced/pizza-cli/pkg/utils" ) func NewVersionCommand() *cobra.Command { return &cobra.Command{ Use: "version", Short: "Displays the build version of the CLI", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { fmt.Printf("Version: %s\nSha: %s\n", utils.Version, utils.Sha) }, } diff --git a/go.mod b/go.mod index 0445ee7..39de18d 100644 --- a/go.mod +++ b/go.mod @@ -3,35 +3,41 @@ module github.com/open-sauced/pizza-cli go 1.21 require ( - github.com/charmbracelet/bubbles v0.16.1 - github.com/charmbracelet/bubbletea v0.24.2 - github.com/charmbracelet/lipgloss v0.9.1 + github.com/charmbracelet/bubbles v0.19.0 + github.com/charmbracelet/bubbletea v0.27.1 + github.com/charmbracelet/lipgloss v0.13.0 github.com/cli/browser v1.3.0 github.com/open-sauced/go-api/client v0.0.0-20240205155059-a3159bc0517e - github.com/posthog/posthog-go v0.0.0-20230801140217-d607812dee69 - github.com/spf13/cobra v1.7.0 + github.com/posthog/posthog-go v1.2.19 + github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 - golang.org/x/term v0.13.0 + golang.org/x/term v0.23.0 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/atotto/clipboard v0.1.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/charmbracelet/x/ansi v0.2.3 // indirect + github.com/charmbracelet/x/input v0.2.0 // indirect + github.com/charmbracelet/x/term v0.2.0 // indirect + github.com/charmbracelet/x/windows v0.2.0 // indirect + github.com/containerd/console v1.0.4 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect + github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.15.2 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/sahilm/fuzzy v0.1.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/sahilm/fuzzy v0.1.1 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect ) diff --git a/go.sum b/go.sum index 628dc94..1038c4d 100644 --- a/go.sum +++ b/go.sum @@ -1,25 +1,37 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= -github.com/charmbracelet/bubbles v0.16.1 h1:6uzpAAaT9ZqKssntbvZMlksWHruQLNxg49H5WdeuYSY= -github.com/charmbracelet/bubbles v0.16.1/go.mod h1:2QCp9LFlEsBQMvIYERr7Ww2H2bA7xen1idUDIzm/+Xc= -github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY= -github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg= -github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg= -github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I= +github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= +github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= +github.com/charmbracelet/bubbles v0.19.0 h1:gKZkKXPP6GlDk6EcfujDK19PCQqRjaJZQ7QRERx1UF0= +github.com/charmbracelet/bubbles v0.19.0/go.mod h1:WILteEqZ+krG5c3ntGEMeG99nCupcuIk7V0/zOP0tOA= +github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM= +github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg= +github.com/charmbracelet/bubbletea v0.27.1 h1:/yhaJKX52pxG4jZVKCNWj/oq0QouPdXycriDRA6m6r8= +github.com/charmbracelet/bubbletea v0.27.1/go.mod h1:xc4gm5yv+7tbniEvQ0naiG9P3fzYhk16cTgDZQQW6YE= +github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= +github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= +github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= +github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= +github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= +github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/x/input v0.2.0 h1:1Sv+y/flcqUfUH2PXNIDKDIdT2G8smOnGOgawqhwy8A= +github.com/charmbracelet/x/input v0.2.0/go.mod h1:KUSFIS6uQymtnr5lHVSOK9j8RvwTD4YHnWnzJUYnd/M= +github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= +github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= +github.com/charmbracelet/x/windows v0.2.0 h1:ilXA1GJjTNkgOm94CLPeSz7rar54jtFatdmoiONPuEw= +github.com/charmbracelet/x/windows v0.2.0/go.mod h1:ZibNFR49ZFqCXgP76sYanisxRyC+EYrBE7TTknD8s1s= github.com/cli/browser v1.3.0 h1:LejqCrpWr+1pRqmEPDGnTZOjsMe7sehifLynZJuqJpo= github.com/cli/browser v1.3.0/go.mod h1:HH8s+fOAxjhQoBUAsKuPCbqUuxZDhQ2/aD+SzsEfBTk= -github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= -github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 h1:Ig+OPkE3XQrrl+SKsOqAjlkrBN/zrr+Qpw7rCuDjRCE= -github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= +github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -33,6 +45,8 @@ github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+Ei github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= @@ -41,45 +55,47 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/open-sauced/go-api/client v0.0.0-20231023202852-271ed316d5fd h1:xWarN75bBSNVdXJ9DkTRwWnmDG/uAooasLp1IOakIPI= -github.com/open-sauced/go-api/client v0.0.0-20231023202852-271ed316d5fd/go.mod h1:W/TRuLUqYpMvkmElDUQvQ07xlxhK8TOfpwRh8SCAuNA= -github.com/open-sauced/go-api/client v0.0.0-20231024233005-61e58f577005 h1:qrsKqDy8Duw/MNPoaAyD3R/kZScSYosWKBI5jIR6Iwk= -github.com/open-sauced/go-api/client v0.0.0-20231024233005-61e58f577005/go.mod h1:W/TRuLUqYpMvkmElDUQvQ07xlxhK8TOfpwRh8SCAuNA= -github.com/open-sauced/go-api/client v0.0.0-20231025234817-a8f01f3b26d8 h1:qzSaxN4BdovOr2DjXcYJz4LH7RSXEdhw98zAdnJVqJU= -github.com/open-sauced/go-api/client v0.0.0-20231025234817-a8f01f3b26d8/go.mod h1:W/TRuLUqYpMvkmElDUQvQ07xlxhK8TOfpwRh8SCAuNA= -github.com/open-sauced/go-api/client v0.0.0-20240202223515-f3f8157b083d h1:e9c07oVveXyHHhcu85hKHicl2K+ruAcAXX5BUd4StO8= -github.com/open-sauced/go-api/client v0.0.0-20240202223515-f3f8157b083d/go.mod h1:W/TRuLUqYpMvkmElDUQvQ07xlxhK8TOfpwRh8SCAuNA= github.com/open-sauced/go-api/client v0.0.0-20240205155059-a3159bc0517e h1:3j5r7ArokAO+u8vhgQPklp5qnGxA+MkXluRYt2qTnik= github.com/open-sauced/go-api/client v0.0.0-20240205155059-a3159bc0517e/go.mod h1:W/TRuLUqYpMvkmElDUQvQ07xlxhK8TOfpwRh8SCAuNA= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posthog/posthog-go v0.0.0-20230801140217-d607812dee69 h1:01dHVodha5BzrMtVmcpPeA4VYbZEsTXQ6m4123zQXJk= -github.com/posthog/posthog-go v0.0.0-20230801140217-d607812dee69/go.mod h1:migYMxlAqcnQy+3eN8mcL0b2tpKy6R+8Zc0lxwk4dKM= +github.com/posthog/posthog-go v0.0.0-20240315130956-036dfa9f3555 h1:RqJZxk2VAaZYCCk4ZVo7iLqp4a03LWitjE0tNIMyvMU= +github.com/posthog/posthog-go v0.0.0-20240315130956-036dfa9f3555/go.mod h1:QjlpryJtfYLrZF2GUkAhejH4E7WlDbdKkvOi5hLmkdg= +github.com/posthog/posthog-go v1.2.19 h1:0udGG2do4LjOzE0D/ik7S3uM2wwFKwzSqswBfdcQ1y4= +github.com/posthog/posthog-go v1.2.19/go.mod h1:uYC2l1Yktc8E+9FAHJ9QZG4vQf/NHJPD800Hsm7DzoM= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= -github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= +github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/justfile b/justfile new file mode 100644 index 0000000..93ff93c --- /dev/null +++ b/justfile @@ -0,0 +1,151 @@ +# Builds the go binary into the git ignored ./build/ dir +build: + #!/usr/bin/env sh + echo "Building for local arch" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza + +install: build + sudo cp "./build/pizza" "/usr/local/bin/" + +build-all: \ + build \ + build-darwin-amd64 build-darwin-arm64 \ + build-linux-amd64 build-linux-arm64 \ + build-windows-amd64 build-windows-arm64 + +build-darwin-amd64: + #!/usr/bin/env sh + + echo "Building darwin amd64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="darwin" + export GOARCH="amd64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +build-darwin-arm64: + #!/usr/bin/env sh + + echo "Building darwin arm64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="darwin" + export GOARCH="arm64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +build-linux-amd64: + #!/usr/bin/env sh + + echo "Building linux amd64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="linux" + export GOARCH="amd64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +build-linux-arm64: + #!/usr/bin/env sh + + echo "Building linux arm64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="linux" + export GOARCH="arm64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +build-windows-amd64: + #!/usr/bin/env sh + + echo "Building windows amd64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="windows" + export GOARCH="amd64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +build-windows-arm64: + #!/usr/bin/env sh + + echo "Building windows arm64" + + export VERSION="${RELEASE_TAG_VERSION:-dev}" + export CGO_ENABLED=0 + export GOOS="windows" + export GOARCH="arm64" + + go build \ + -ldflags="-s -w" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version=${VERSION}'" \ + -ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \ + -o build/pizza-${GOOS}-${GOARCH} + +# Builds the container and marks it tagged as "dev" locally +build-container: + docker build \ + --build-arg VERSION=$(git describe --tags --always) \ + --build-arg SHA=$(git rev-parse HEAD) \ + -t pizza:dev . + +clean: + rm -rf build/ + +# Runs all tests +test: unit-test + +# Runs all in-code, unit tests +unit-test: + go test ./... + +# Lints the Go code via golangcilint in Docker +lint: + docker run \ + -t \ + --rm \ + -v "$(pwd)/:/app" \ + -w /app \ + golangci/golangci-lint:v1.59 \ + golangci-lint run -v + +# Formats code via builtin go fmt +format: + find . -type f -name "*.go" -exec goimports -local github.com/open-sauced/pizza-cli -w {} \; + +run: + go run main.go diff --git a/pkg/utils/root.go b/pkg/utils/root.go index c0411c8..6d017d0 100644 --- a/pkg/utils/root.go +++ b/pkg/utils/root.go @@ -3,10 +3,11 @@ package utils import ( "os" - "github.com/open-sauced/pizza-cli/pkg/constants" "github.com/spf13/cobra" "github.com/spf13/pflag" "golang.org/x/term" + + "github.com/open-sauced/pizza-cli/pkg/constants" ) // SetupRootCommand is a convenience utility for applying templates and nice