diff --git a/Makefile b/Makefile index 4bba597..6f1fe93 100644 --- a/Makefile +++ b/Makefile @@ -5,18 +5,6 @@ CONFIG_FILE=$(ROOT_DIR)/config.yml BIN=$(ROOT_DIR)/bin/transport REVISION=$(shell git describe --tags 2>/dev/null || git log --format="v0.0-%h" -n 1 || echo "v0.0-unknown") -build: deps fmt - @echo "==> Building" - @cd $(SRC_DIR) && CGO_ENABLED=0 go build -o $(BIN) -ldflags "-X common.build=${REVISION}" . - @echo $(BIN) - -run: migrate - @echo "==> Running" - @${BIN} --config $(CONFIG_FILE) run - -test: deps fmt - @echo "==> Running tests" - @cd $(ROOT_DIR) && go test ./... -v -cpu 2 fmt: @echo "==> Running gofmt" @gofmt -l -s -w $(ROOT_DIR) @@ -25,8 +13,22 @@ deps: @echo "==> Installing dependencies" @go mod tidy +build: deps fmt + @echo "==> Building" + @cd $(SRC_DIR) && CGO_ENABLED=0 go build -o $(BIN) -ldflags "-X common.build=${REVISION}" . + @echo $(BIN) + migrate: build ${BIN} --config $(CONFIG_FILE) migrate -p $(MIGRATIONS_DIR) migrate_down: build @${BIN} --config $(CONFIG_FILE) migrate -v down + +run: migrate + @echo "==> Running" + @${BIN} --config $(CONFIG_FILE) run + +test: migrate + @echo "==> Running tests" + @cd $(ROOT_DIR) && go test ./... -v -cpu 2 + diff --git a/src/routing.go b/src/routing.go index 342c0b9..019f55d 100644 --- a/src/routing.go +++ b/src/routing.go @@ -119,7 +119,7 @@ func deleteBotHandler(c *gin.Context) { logger.Error(b.ID, status, err.Error(), data) return } - + err = b.deleteBot() if err != nil { c.Error(err) diff --git a/src/routing_test.go b/src/routing_test.go index 79b5aa7..4538bdc 100644 --- a/src/routing_test.go +++ b/src/routing_test.go @@ -22,7 +22,7 @@ var ch = getChannelSettings() func init() { os.Chdir("../") - config = LoadConfig("config_test.yml") + config = LoadConfig("config.yml") orm = NewDb(config) logger = newLogger() router = setup()