fix: Make a separate cmd/doggo package for main files

Closes https://github.com/mr-karan/doggo/issues/1
pull/4/head
Karan Sharma 2020-12-18 20:18:28 +05:30
parent 724114e144
commit 4d618b892b
11 changed files with 14 additions and 9 deletions

View File

@ -16,7 +16,7 @@ builds:
- 7
ldflags:
- -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})"
dir: ./cmd/
dir: ./cmd/doggo/
archives:
- format: tar.gz

View File

@ -1,24 +1,21 @@
DOGGO-BIN := doggo
BIN := ./bin/doggo
HASH := $(shell git rev-parse --short HEAD)
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH}
.PHONY: build
build: ## Build the doggo binary
mkdir -p bin/; \
cd cmd/; \
go build -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" -o ${DOGGO-BIN} ./... && \
mv ${DOGGO-BIN} ../bin/${DOGGO-BIN}
build:
go build -o ${BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" ./cmd/doggo/
.PHONY: run
run: build ## Build and Execute the binary after the build step
./bin/${DOGGO-BIN}
${BIN}
.PHONY: clean
clean:
go clean
- rm -f ./bin/${BIN}
- rm -f ${BIN}
.PHONY: lint
lint:

View File

@ -62,6 +62,14 @@ You can supply all arguments to the CLI directly to `docker run` command. Eg:
$ sudo snap install doggo
```
### From Source
You need to have `go` installed in your system.
```bash
$ go get github.com/mr-karan/doggo/cmd/doggo
```
**NOTE**: Since the [confinement](https://snapcraft.io/docs/snap-confinement) mode is strict as of now, it cannot access your host's `/etc/resolv.conf`.
I'll be making a request in the Snap forums soon so that it can be manually reviewed and allowed to use `--classic`. Until then, please specify a namesever manually
if using `snap`.