From dc2c74dd4b4d77fad7e35bde8644d2376df4942b Mon Sep 17 00:00:00 2001 From: abs3nt Date: Fri, 23 Feb 2024 12:48:32 -0800 Subject: [PATCH] move --- .goreleaser.yaml | 1 - Makefile | 2 +- main.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 main.go diff --git a/.goreleaser.yaml b/.goreleaser.yaml index fd61c67..7a1ec24 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -10,7 +10,6 @@ before: builds: - env: - CGO_ENABLED=0 - main: ./cmd/gspot goos: - linux - windows diff --git a/Makefile b/Makefile index c3e384b..d2140b6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ build: - go build -ldflags="-X 'git.asdf.cafe/abs3nt/gspot/src/components/cli.Version=$(shell git show -s --date=short --pretty='format:%h (%ad)' HEAD)'" -o dist/ ./cmd/gspot + go build -ldflags="-X 'git.asdf.cafe/abs3nt/gspot/src/components/cli.Version=$(shell git show -s --date=short --pretty='format:%h (%ad)' HEAD)'" -o dist/ . run: build ./dist/gspot diff --git a/main.go b/main.go new file mode 100644 index 0000000..be0a72c --- /dev/null +++ b/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "gfx.cafe/util/go/fxplus" + "go.uber.org/fx" + + "git.asdf.cafe/abs3nt/gspot/src/components/cache" + "git.asdf.cafe/abs3nt/gspot/src/components/cli" + "git.asdf.cafe/abs3nt/gspot/src/components/commands" + "git.asdf.cafe/abs3nt/gspot/src/components/logger" + "git.asdf.cafe/abs3nt/gspot/src/services" +) + +func main() { + var s fx.Shutdowner + app := fx.New( + fxplus.WithLogger, + fx.Populate(&s), + services.Config, + fx.Provide( + fxplus.Context, + cache.NewCache, + commands.NewCommander, + logger.NewLogger, + ), + fx.Invoke( + cli.Run, + ), + ) + app.Run() +}