caicloud / nirvana

Golang Restful API Framework for Productivity

Home Page:https://caicloud.github.io/nirvana/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[problem] Fail to run the test command in Makefile

gaocegege opened this issue · comments

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

When I run make, code here output an error to STDERR:

/bin/sh: 1: [[: not found

What you expected to happen:

Generate v-dirty if there are changes, generate v if there is no change.

How to reproduce it (as minimally and precisely as possible):

nirvana init ./myproject
cd ./myproject
make

Solution

COMMIT := $(COMMIT)$(shell git diff-files --quiet || echo '-dirty')

Please test it in MacOS and Linux.

I have no macOS machine now. The problem can be reproduced in Linux (4.4.0-78-generic).

I test this on Mac, CentOS and Ubuntu. Only reproduced on Ubuntu.
This is caused by difference of sh and bash.
On CentOS and Mac, /bin/sh(or /usr/bin/sh) is a symbol link to bash.
And solution by @gaocegege work fine on all these systems.

@gaocegege please file a PR to fix it.