From 0ededef58fa2c38ff4fc959b1be830808c32472c Mon Sep 17 00:00:00 2001 From: Eitan Yarmush Date: Mon, 6 Dec 2021 10:31:39 -0500 Subject: [PATCH] fix util (#13) --- .gitignore | 3 +++ Makefile | 2 +- pkg/cli/internal/commands/run/run.go | 8 ++++---- pkg/spec/utils.go | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 07621ad..d876654 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out +# Example outputs +examples/**/*.o + # Dependency directories (remove the comment below to include it) vendor/ _output diff --git a/Makefile b/Makefile index 54440a5..d9eda39 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ build-cli: bee-linux-amd64 bee-linux-arm64 .PHONY: install-cli install-cli: - CGO_ENABLED=0 go install -ldflags=$(LDFLAGS) -gcflags=$(GCFLAGS) bee/main.go + CGO_ENABLED=0 go install -ldflags=$(LDFLAGS) -gcflags=$(GCFLAGS) ./bee ##---------------------------------------------------------------------------------- ## Release diff --git a/pkg/cli/internal/commands/run/run.go b/pkg/cli/internal/commands/run/run.go index 9e25fe0..73ed961 100644 --- a/pkg/cli/internal/commands/run/run.go +++ b/pkg/cli/internal/commands/run/run.go @@ -25,13 +25,13 @@ import ( type runOptions struct { general *options.GeneralOptions - Debug bool + debug bool } var stopper chan os.Signal func addToFlags(flags *pflag.FlagSet, opts *runOptions) { - flags.BoolVarP(&opts.Debug, "debug", "d", false, "Create a log file 'debug.log' that provides debug logs of loader and TUI execution") + flags.BoolVarP(&opts.debug, "debug", "d", false, "Create a log file 'debug.log' that provides debug logs of loader and TUI execution") } func Command(opts *options.GeneralOptions) *cobra.Command { @@ -75,7 +75,7 @@ func run(cmd *cobra.Command, args []string, opts *runOptions) error { } }() - if opts.Debug { + if opts.debug { f, err := os.OpenFile("debug.log", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) if err != nil { log.Fatalf("error opening file: %v", err) @@ -105,7 +105,7 @@ func run(cmd *cobra.Command, args []string, opts *runOptions) error { promProvider, ) - app := tui.NewApp(opts.Debug, progLocation, progLoader) + app := tui.NewApp(opts.debug, progLocation, progLoader) return app.Run(cmd.Context(), progReader) } diff --git a/pkg/spec/utils.go b/pkg/spec/utils.go index 924652d..215c276 100644 --- a/pkg/spec/utils.go +++ b/pkg/spec/utils.go @@ -35,9 +35,9 @@ func TryFromLocal( _, err = oras.Copy( ctx, - localRegistry, - ref, remoteRegistry, + ref, + localRegistry, "", oras.WithAllowedMediaTypes(AllowedMediaTypes()), )