diff --git a/.dlv-init b/.dlv-init new file mode 100644 index 00000000..6c74c82f --- /dev/null +++ b/.dlv-init @@ -0,0 +1,3 @@ +config prompt-color "\033[32m" +config disassemble-flavor "intel" +config substitute-path "github.com/ozontech/seq-db" "" diff --git a/Makefile b/Makefile index 2be4af79..5366df76 100644 --- a/Makefile +++ b/Makefile @@ -12,14 +12,6 @@ VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags) TIME := $(shell date '+%Y-%m-%d_%H:%M:%S') LOCAL_BIN:=$(CURDIR)/bin -.PHONY: build-binaries -build-binaries: - CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build \ - -trimpath \ - -ldflags "-X github.com/ozontech/seq-db/buildinfo.Version=${VERSION} \ - -X github.com/ozontech/seq-db/buildinfo.BuildTime=${TIME}" \ - -o ./bin/${OS}-${ARCH}/ \ - ./cmd/... .PHONY: build-image build-image: @@ -30,13 +22,30 @@ build-image: -t ${IMAGE}:${VERSION} \ . +.PHONY: build-debug +build-debug: + CGO_ENABLED=0 \ + go build -gcflags="all=-N -l" \ + -o ${LOCAL_BIN}/${OS}-${ARCH}/ \ + ./cmd/... + .PHONY: run -run: build-binaries +run: build-debug SEQDB_STORAGE_DATA_DIR=$(shell mktemp -d) \ ${LOCAL_BIN}/${OS}-${ARCH}/seq-db \ --mode=single \ --config=config.example.yaml +.PHONY: debug +debug: build-debug + SEQDB_STORAGE_DATA_DIR=$(shell mktemp -d) \ + ${LOCAL_BIN}/${OS}-${ARCH}/seq-db \ + --mode=single \ + --config=config.example.yaml & \ + DLV_PID=$$!; \ + sleep 1; \ + dlv attach $$DLV_PID --init=.dlv-init + .PHONY: push-image push-image: build-image docker push ${IMAGE}:${VERSION}