Skip to content

Commit

Permalink
🔨 修改优化开发相关批处理脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
iTanken committed Aug 28, 2024
1 parent 8b0053f commit 0f509e7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
27 changes: 21 additions & 6 deletions _dev/script/go-staticcheck.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@ color 07
title 静态检查
:: file-encoding=GBK
rem by iTanken
echo 开始进行静态检查... & echo.

cd /d %~dp0/../../
echo.
if "%~dp0" equ "%CD%\" (
cd /d %~dp0/../../
)
echo 脚本所在路径:%~dp0
echo 当前工作目录:%CD%\
echo.
echo 开始进行静态检查...

echo. & echo [golangci-lint.run]
rem go1.20 latest => v1.55.2
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 run
echo. & echo [staticcheck.io]
go run honnef.co/go/tools/cmd/staticcheck@latest -f text ./...
setlocal
where golangci-lint >nul 2>&1
if "%ERRORLEVEL%" equ "0" (
echo local golangci-lint...
golangci-lint run --timeout=5m
) else (
echo "go1.20 latest => golangci-lint@v1.55.2"
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 run --timeout=5m
)
endlocal

rem echo. & echo [staticcheck.io]
rem go run honnef.co/go/tools/cmd/staticcheck@latest -f text ./...

call "%~dp0/done-time-pause.bat"
25 changes: 22 additions & 3 deletions _dev/script/go-vulncheck.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,28 @@ if %ver% leq 1.17 (
pause & exit
)

echo 开始进行漏洞检查... & echo.
if "%~dp0" equ "%CD%\" (
cd /d %~dp0/../../
)
echo 脚本所在路径:%~dp0
echo 当前工作目录:%CD%\
echo.
echo 开始进行漏洞检查...

cd /d %~dp0/../../
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
echo. & echo [govulncheck]
setlocal
where govulncheck >nul 2>&1
if "%ERRORLEVEL%" equ "0" (
echo local govulncheck...
govulncheck ./...
) else (
if %ver% leq 1.20 (
echo "go1.20 latest => govulncheck@v1.1.1"
go run golang.org/x/vuln/cmd/govulncheck@v1.1.1 ./...
) else (
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
)
)
endlocal

call "%~dp0/done-time-pause.bat"

0 comments on commit 0f509e7

Please sign in to comment.