redspread / spread

Docker to Kubernetes in one command
https://coreos.com
Apache License 2.0
1.84k stars 83 forks source link

Make Makefile if-statement dash-compatible #136

Closed zoidyzoidzoid closed 8 years ago

zoidyzoidzoid commented 8 years ago

Also miscellaneous other Makefile tidying.

Closes https://github.com/redspread/spread/issues/135

So now with make validate we get the following, though it exits with a exit code of 2 if it fails, though we're exiting with exit 1, which I think is because Makefile exits with a 2 if a job fails or errors, but I think that is okay.

# get all go files and run go fmt on them
files=$(find . -name '*.go' -not -path "./vendor/*" | xargs gofmt  -l); if [ -n "$files" ]; then \
      echo "Error: 'gofmt ' needs to be run on:"; \
      echo "${files}"; \
      exit 1; \
      fi;
Error: 'gofmt ' needs to be run on:
./cli/cluster.go
Makefile:98: recipe for target 'checkgofmt' failed
make: *** [checkgofmt] Error 1
root@a8f896da1575:/usr/src/myapp# echo $?
2

This also fixes golinting, which was using the wrong variable in the for-loop, so now it correctly prints out golint errors instead of doing:

for pkg in ./pkg/... ./cli/... ./cmd/...; do \
    echo "Running golint on $i:"; \
    golint $i; \
done;
Running golint on :
Running golint on :
Running golint on :
ethernetdan commented 8 years ago

Looks great, glad to get that one fixed - and to have linting back!

For some reason Travis doesn't seem to be building these commits, looking into what went wrong

zoidyzoidzoid commented 8 years ago

I reworded a commit and pushed again and now a build is running. Not sure what happened to Travis.

ethernetdan commented 8 years ago

yeah... that's a strange one