加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vet.sh 929 Bytes
一键复制 编辑 原始数据 按行查看 历史
Denys Smirnov 提交于 2023-07-24 14:51 . ci: Fix vet.
#!/bin/bash
# Vet all the files using go vet excluding errors which are currently explicitly ignore
# This script is intended to be used in the continuous integration process
# When editing, it is highly recommended to use ShellCheck (https://www.shellcheck.net/) to avoid common pitfalls
# Patterns to be ignored from the go lint output
IGNORED_PATTERNS=(
"^# "
# Field order is well-defined
"/quad\.Quad composite literal uses unkeyed fields" # 1.19
"/quad\.Quad struct literal uses unkeyed fields" # 1.20
# Code imported from b
" method Seek\(k int64\) .* should have signature "
)
# Patterns joined into a regular expression
REGEX=$(printf "|(%s)" "${IGNORED_PATTERNS[@]}")
REGEX=${REGEX:1}
# Execute go vet on all the files and filter output by the regualr expression
output=$( (go vet ./... 2>&1 | grep -Ev "$REGEX") | tee /dev/fd/2);
if [ -z "$output" ]
then
exit 0
else
exit 1
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化