Skip to content

Commit

Permalink
Some improvements for Makefile:
Browse files Browse the repository at this point in the history
1. make goals: build, clean, install - incorporated from README.md
2. build options: OPTS=GO111MODULE=on
  • Loading branch information
ayuryshev committed Mar 14, 2019
1 parent be0e549 commit 6f7aa96
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@
pkg/node/apps/
pkg/node/bar/
pkg/node/foo/


/manager-node
/skywire-node
/skywire-cli
/manager-node
/therealssh-cli
72 changes: 61 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,74 @@
OPTS=GO111MODULE=on

build: dep apps bin

clean:
rm -rf ./apps
rm -f ./skywire-node ./skywire-cli ./manager-node ./thereallssh-cli

install:
${OPTS} go install ./cmd/skywire-node ./cmd/skywire-cli ./cmd/manager-node ./cmd/therealssh-cli

lint: ## Run linters. Use make install-linters first.
# GO111MODULE=on vendorcheck ./... # TODO: fix vendor check
GO111MODULE=on golangci-lint run -c .golangci.yml ./...
# ${OPTS} vendorcheck ./... # TODO: fix vendor check
${OPTS} golangci-lint run -c .golangci.yml ./...
# The govet version in golangci-lint is out of date and has spurious warnings, run it separately
GO111MODULE=on go vet -all ./...
${OPTS} go vet -all ./...

install-linters: ## Install linters
GO111MODULE=off go get -u github.com/FiloSottile/vendorcheck
# For some reason this install method is not recommended, see https://github.com/golangci/golangci-lint#install
# However, they suggest `curl ... | bash` which we should not do
GO111MODULE=on go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
GO111MODULE=on go get -u golang.org/x/tools/cmd/goimports
${OPTS} go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
${OPTS} go get -u golang.org/x/tools/cmd/goimports

format: ## Formats the code. Must have goimports installed (use make install-linters).
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./pkg
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./cmd
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./internal
${OPTS} goimports -w -local github.com/skycoin/skywire ./pkg
${OPTS} goimports -w -local github.com/skycoin/skywire ./cmd
${OPTS} goimports -w -local github.com/skycoin/skywire ./internal

dep: ## sorts dependencies
GO111MODULE=on go mod vendor -v
${OPTS} go mod vendor -v

test: ## Run tests for net
GO111MODULE=on go test -race -tags no_ci -cover -timeout=5m ./internal/...
GO111MODULE=on go test -race -tags no_ci -cover -timeout=5m ./pkg/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./internal/...
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/...


build: apps bin

# Apps
apps: chat helloworld therealproxy therealproxy-client therealssh thereallssh-client

chat:
${OPTS} go build -o ./apps/chat.v1.0 ./cmd/apps/chat

helloworld:
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld

therealproxy:
${OPTS} go build -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy

therealproxy-client:
${OPTS} go build -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client

therealssh:
${OPTS} go build -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh

thereallssh-client:
${OPTS} go build -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client

# Bin
bin: skywire-node skywire-cli manager-node therealssh-cli

skywire-node:
${OPTS} go build -o ./skywire-node ./cmd/skywire-node

skywire-cli:
${OPTS} go build -o ./skywire-cli ./cmd/skywire-cli

manager-node:
${OPTS} go build -o ./manager-node ./cmd/manager-node

therealssh-cli:
${OPTS} go build -o ./therealssh-cli ./cmd/therealssh-cli

0 comments on commit 6f7aa96

Please sign in to comment.