Add go.mod and Makefile
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
parent
9a171b1c90
commit
460554e19e
3 changed files with 68 additions and 0 deletions
39
Makefile
Normal file
39
Makefile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
ROOT_PKG ?= "github.com/vartanbeno/geddit"
|
||||||
|
LIST_PKG := $(shell go list $(ROOT_PKG)/...)
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
TEST_TIMEOUT ?= 20
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := usage
|
||||||
|
|
||||||
|
# Print colorized log
|
||||||
|
define log
|
||||||
|
echo "\n\033[1;32m--- [$(@)] $(1) ---\033[0m\n"
|
||||||
|
endef
|
||||||
|
|
||||||
|
all: lint fmt vet test test-coverage build
|
||||||
|
|
||||||
|
usage:
|
||||||
|
@echo "make [all|fmt|vet|lint|test|test-coverage]"
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
@$(call log,"Running formatter")
|
||||||
|
@go fmt $(LIST_PKG)
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@$(call log,"Running vet")
|
||||||
|
@go vet -all $(LIST_PKG)
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@$(call log,"Running linter")
|
||||||
|
@golint -set_exit_status $(LIST_PKG)
|
||||||
|
|
||||||
|
test: fmt vet lint
|
||||||
|
@$(call log,"Running tests")
|
||||||
|
@go test -v -race -short -timeout $(TEST_TIMEOUT)s $(ARGS) $(LIST_PKG)
|
||||||
|
|
||||||
|
test-coverage: fmt vet lint
|
||||||
|
@$(call log,"Running tests with coverage")
|
||||||
|
@go test -v -race -short -timeout $(TEST_TIMEOUT)s $(ARGS) -coverprofile=coverage.out $(LIST_PKG)
|
||||||
|
@go tool cover -func=coverage.out
|
||||||
|
@go tool cover -html=coverage.out -o coverage.html
|
9
go.mod
Normal file
9
go.mod
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module github.com/vartanbeno/geddit
|
||||||
|
|
||||||
|
go 1.14
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/google/go-querystring v1.0.0
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
||||||
|
)
|
20
go.sum
Normal file
20
go.sum
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||||
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U=
|
||||||
|
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
Loading…
Reference in a new issue