If you try to get a release from GitHub using curl:

$ curl -O $FLAT_TAR

You need to add the -L flag follow the redirect, otherwise things don't work as expected...

Working example:

FLATG_RELEASE=v0.0.0
FLAT_TAR="https://github.com/goliatone/flatg-core/archive/${FLATG_RELEASE}.tar.gz"
curl -L -O $FLAT_TAR
TARDIR=$(tar -ztf "${FLATG_RELEASE}.tar.gz" | head -n 1)
tar -zxvf "${FLATG_RELEASE}.tar.gz" -C  flatg