Prevent 'make clean' from being dangerous
-
RELTMPDIR=/tmp/release.$(CO_VERSION)
RELFILE=/tmp/postgres-operator.$(CO_VERSION).tar.gz
+#======= Safety checks =======
+check-go-vars:
+ifndef GOPATH
+ $(error GOPATH is not set)
+endif
+ifndef GOBIN
+ $(error GOBIN is not set)
+endif
+
+#======= Main functions =======
run:
cd examples/operator && ./run.sh
-pgo:
+pgo: check-go-vars
cd client && go build -o $(GOBIN)/pgo pgo.go
-clean:
- rm -rf $(GOPATH)/pkg/* $(GOBIN)/*
+clean: check-go-vars
+ echo "rm -rf $(GOPATH)/pkg/* $(GOBIN)/*"
go get -u github.com/FiloSottile/gvt
gvt restore
-operatorimage:
+operatorimage: check-go-vars
cd operator && go install postgres-operator.go
cp $(GOBIN)/postgres-operator bin/postgres-operator
docker build -t postgres-operator -f $(CO_BASEOS)/Dockerfile.postgres-operator.$(CO_BASEOS) .
@@ -25,7 +34,7 @@ all:
push:
docker push crunchydata/lspvc:$(CO_IMAGE_TAG)
docker push crunchydata/postgres-operator:$(CO_IMAGE_TAG)
-release:
+release: check-go-vars
rm -rf $(RELTMPDIR) $(RELFILE)
mkdir $(RELTMPDIR)
cp $(GOBIN)/pgo $(RELTMPDIR)
