mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
修复gf gen在sqlserver上的异常问题: 1. https://github.com/gogf/gf/issues/1722 2. https://github.com/gogf/gf/issues/1761 ```powershell > gf gen dao fetching tables failed: SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U' AND STATUS >= 0 ORDER BY NAME: mssql: 对象名 'SYSOBJECTS' 无效。 1. SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U' AND STATUS >= 0 ORDER BY NAME 2. mssql: 对象名 'SYSOBJECTS' 无效。 ``` 在SqlServer 2022已测试通过:  --------- Co-authored-by: hailaz <739476267@qq.com>
60 lines
1.8 KiB
Bash
Executable File
60 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
coverage=$1
|
|
|
|
# find all path that contains go.mod.
|
|
for file in `find . -name go.mod`; do
|
|
dirpath=$(dirname $file)
|
|
echo $dirpath
|
|
|
|
# package kubecm was moved to sub ci procedure.
|
|
if [ "kubecm" = $(basename $dirpath) ]; then
|
|
continue 1
|
|
fi
|
|
|
|
# examples directory was moved to sub ci procedure.
|
|
if [[ $dirpath =~ "/examples/" ]]; then
|
|
continue 1
|
|
fi
|
|
|
|
if [[ $file =~ "/testdata/" ]]; then
|
|
echo "ignore testdata path $file"
|
|
continue 1
|
|
fi
|
|
|
|
# Check if it's a contrib directory
|
|
if [[ $dirpath =~ "/contrib/" ]]; then
|
|
# Check if go version meets the requirement
|
|
if ! go version | grep -qE "go${LATEST_GO_VERSION}"; then
|
|
echo "ignore path $dirpath as go version is not ${LATEST_GO_VERSION}: $(go version)"
|
|
# clean docker containers and images to free disk space
|
|
# bash .github/workflows/scripts/ci-main-clean.sh "$dirpath"
|
|
continue 1
|
|
fi
|
|
fi
|
|
|
|
# if [[ $dirpath = "." ]]; then
|
|
# # No space left on device error sometimes occurs in CI pipelines, so clean the cache before tests.
|
|
# go clean -cache
|
|
# fi
|
|
|
|
cd $dirpath
|
|
go mod tidy
|
|
go build ./...
|
|
|
|
# test with coverage
|
|
if [ "${coverage}" = "coverage" ]; then
|
|
go test ./... -count=1 -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
|
|
|
|
if grep -q "/gogf/gf/.*/v2" go.mod; then
|
|
sed -i "s/gogf\/gf\(\/.*\)\/v2/gogf\/gf\/v2\1/g" coverage.out
|
|
fi
|
|
else
|
|
go test ./... -count=1 -race || exit 1
|
|
fi
|
|
|
|
cd -
|
|
# clean docker containers and images to free disk space
|
|
# bash .github/workflows/scripts/ci-main-clean.sh "$dirpath"
|
|
done
|