Skip to content

Conversation

@mikeproeng37
Copy link
Contributor

Summary

  • Adds makefile to simplify test commands
  • Can move more things in here later on

Copy link
Contributor

@mikecdavis mikecdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor clean-up needed, but other than that this is a big improvement to the overall dev experience :)

# The name of the executable (default is current directory name)
TARGET := $(shell basename "$(PWD)")
VERSION ?= $(shell git describe --tags)
.DEFAULT_GOAL := help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently missing a help target but can define as:

help: ## help
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

Makefile Outdated
@@ -0,0 +1,31 @@
# The name of the executable (default is current directory name)
TARGET := $(shell basename "$(PWD)")
VERSION ?= $(shell git describe --tags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Makefile Outdated
GO111MODULE=$(GO111MODULE) $(GOTEST) ./pkg/...

test-ci: ## run unit tests in CI mode
GO111MODULE=$(GO111MODULE) $(GOTEST) -v -race ./pkg/... -coverprofile=profile.cov No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-v is not needed and can make for noisy logs. If there's a failure then adequate logs are still exposed. Consider naming this target cover as it's not doing anything particularly really CI related that you wouldn't want to run locally. It was also confusing in the .travis.yml file that some tasks used test and just one was test-ci.

.travis.yml Outdated
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.19.0
script:
- $GOPATH/bin/golangci-lint run --out-format=tab --tests=false pkg/...
- make -e install lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: -e isn't needed given your current Makefile

Makefile Outdated
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOLINT=golangci-lint
BINARY_UNIX=$(TARGET)_unix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

GOBIN=bin
GOPATH=$(shell $(GOCMD) env GOPATH)
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to enable a clean target.

@mikeproeng37 mikeproeng37 removed their assignment Nov 14, 2019
Copy link
Contributor

@mikecdavis mikecdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but can also get rid of references to GOBIN since you're not using a build target, etc.

@mikeproeng37 mikeproeng37 merged commit 4a36a9d into master Nov 15, 2019
@mikeproeng37 mikeproeng37 deleted the mng/add-makefile branch November 15, 2019 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants