diff --git a/.gitignore b/.gitignore index 793b9b9bc5..ba8cde020a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,10 @@ pkg/node/apps/ pkg/node/bar/ pkg/node/foo/ + + +/manager-node +/skywire-node +/skywire-cli +/manager-node +/therealssh-cli diff --git a/Makefile b/Makefile index ecf2473bc3..757330cc9e 100644 --- a/Makefile +++ b/Makefile @@ -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