mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 18:15:51 +00:00
40 lines
985 B
Bash
Executable File
40 lines
985 B
Bash
Executable File
#!/bin/bash
|
|
CurrentPath=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
|
|
gofmtFile=gofmt_results.diff
|
|
pushd ${CurrentPath}/../../
|
|
echo "Run: gofumpt -l -d"
|
|
find . -type f -name "*.go" | \
|
|
grep -v -E '^./vendor/' | \
|
|
grep -v -E '^./depends/' | \
|
|
grep -v -E '^./sdk/graphql/client/' | \
|
|
grep -v -E '\.pb\.go$' | \
|
|
xargs gofumpt -l -d > ${gofmtFile}
|
|
cat ${gofmtFile}
|
|
if [ "$(cat ${gofmtFile}|wc -l)" -gt 0 ]; then
|
|
popd
|
|
exit 1;
|
|
fi
|
|
rm -f ${gofmtFile}
|
|
popd
|
|
|
|
export PATH=$PATH:/go/bin
|
|
|
|
golintFile=golint.diff
|
|
pushd ${CurrentPath}/../..
|
|
oldldflags="$(go env CGO_LDFLAGS)"
|
|
lpath=$(echo -n ${oldldflags} | awk '{print $1}')
|
|
go env -w CGO_LDFLAGS="${lpath} -ldl -ltcmalloc -lm -lrocksdb -lz -lbz2 -lsnappy -llz4 -lzstd -lstdc++"
|
|
echo "Run: go generate ."
|
|
go generate . > ${golintFile}
|
|
go env -w CGO_LDFLAGS="${oldldflags}"
|
|
cat ${golintFile}
|
|
if [[ $? -ne 0 ]]; then
|
|
exit 1
|
|
fi
|
|
if [ "$(cat ${golintFile}|wc -l)" -gt 0 ]; then
|
|
popd
|
|
exit 1
|
|
fi
|
|
rm -f ${golintFile}
|
|
popd
|