Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
HugeYuan
delve
提交
038cd99b
D
delve
项目概览
HugeYuan
/
delve
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
038cd99b
编写于
9月 25, 2021
作者:
A
Alessandro Arzilli
提交者:
GitHub
9月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tests: run staticcheck during tests (#2705)
上级
041eedd1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
96 addition
and
1 deletion
+96
-1
_scripts/staticcheck-out.txt
_scripts/staticcheck-out.txt
+62
-0
_scripts/test_linux.sh
_scripts/test_linux.sh
+1
-0
_scripts/test_windows.ps1
_scripts/test_windows.ps1
+1
-1
cmd/dlv/dlv_test.go
cmd/dlv/dlv_test.go
+32
-0
未找到文件。
_scripts/staticcheck-out.txt
0 → 100644
浏览文件 @
038cd99b
pkg/dwarf/dwarfbuilder/info.go:122:2: redundant return statement (S1023)
pkg/dwarf/dwarfbuilder/info.go:127:5: builtin function len does not return negative values (SA4024)
pkg/dwarf/line/line_parser.go:249:6: every value of type uint64 is >= 0 (SA4003)
pkg/dwarf/line/line_parser.go:286:15: should omit type int from declaration; it will be inferred from the right-hand side (ST1023)
pkg/dwarf/line/state_machine.go:151:2: redundant return statement (S1023)
pkg/dwarf/line/state_machine.go:154:5: error var NoSourceError should have name of the form ErrFoo (ST1012)
pkg/dwarf/line/state_machine.go:193:2: should merge variable declaration with assignment on next line (S1021)
pkg/dwarf/reader/reader.go:77:5: error var TypeNotFoundErr should have name of the form ErrFoo (ST1012)
pkg/goversion/compat.go:12:2: error var goTooOldErr should have name of the form errFoo (ST1012)
pkg/goversion/compat.go:12:33: error strings should not be capitalized (ST1005)
pkg/goversion/compat.go:13:2: error var dlvTooOldErr should have name of the form errFoo (ST1012)
pkg/goversion/compat.go:13:33: error strings should not be capitalized (ST1005)
pkg/locspec/locations.go:71:10: error strings should not be capitalized (ST1005)
pkg/locspec/locations.go:110:10: error strings should not be capitalized (ST1005)
pkg/locspec/locations.go:423:16: error strings should not be capitalized (ST1005)
pkg/proc/bininfo.go:249:18: unnecessary assignment to the blank identifier (S1005)
pkg/proc/bininfo.go:253:19: unnecessary assignment to the blank identifier (S1005)
pkg/proc/bininfo.go:257:19: unnecessary assignment to the blank identifier (S1005)
pkg/proc/bininfo.go:1268:2: unnecessary nil check around range (S1031)
pkg/proc/core/minidump/fileflags_string.go:62:7: every value of type uint16 is >= 0 (SA4003)
pkg/proc/core/minidump/minidump.go:424:3: should merge variable declaration with assignment on next line (S1021)
pkg/proc/eval.go:324:10: error strings should not be capitalized (ST1005)
pkg/proc/eval.go:395:10: error strings should not be capitalized (ST1005)
pkg/proc/eval.go:399:10: error strings should not be capitalized (ST1005)
pkg/proc/native/threads_linux_amd64.go:42:3: redundant return statement (S1023)
pkg/proc/stack.go:398:2: this value of err is never used (SA4006)
pkg/proc/stack.go:424:12: error strings should not be capitalized (ST1005)
pkg/proc/target_exec.go:161:6: this value of err is never used (SA4006)
pkg/proc/target_exec.go:810:3: when isexists is true, err can't be nil (S1020)
pkg/proc/variables.go:1481:21: error strings should not be capitalized (ST1005)
pkg/proc/variables.go:1569:18: error strings should not be capitalized (ST1005)
pkg/proc/variables.go:2243:44: should use !strings.Contains(typename, ".") instead (S1003)
pkg/proc/variables.go:2385:4: should replace this if statement with an unconditional strings.TrimPrefix (S1017)
pkg/proc/winutil/regs.go:167:2: should merge variable declaration with assignment on next line (S1021)
pkg/terminal/command.go:650:5: error var noCmdError should have name of the form errFoo (ST1012)
pkg/terminal/command.go:986:9: unnecessary assignment to the blank identifier (S1005)
pkg/terminal/command.go:1062:10: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:1069:10: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:1337:15: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:1521:15: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:1544:5: error var notOnFrameZeroErr should have name of the form errFoo (ST1012)
pkg/terminal/command.go:1600:10: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:1915:11: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:2420:25: error strings should not be capitalized (ST1005)
pkg/terminal/command.go:2479:5: error var disasmUsageError should have name of the form errFoo (ST1012)
pkg/terminal/starbind/conv.go:243:40: 'bitSize' argument is invalid, must be either 32 or 64 (SA1030)
pkg/terminal/starbind/conv.go:292:9: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
pkg/terminal/starbind/conv.go:352:9: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
pkg/terminal/starbind/conv.go:418:9: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
pkg/terminal/starbind/conv.go:497:9: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
pkg/terminal/terminal.go:282:14: error strings should not be capitalized (ST1005)
pkg/terminal/terminal.go:282:14: error strings should not end with punctuation or a newline (ST1005)
service/api/prettyprint.go:156:9: should omit type bool from declaration; it will be inferred from the right-hand side (ST1023)
service/api/prettyprint.go:190:9: should omit type complex128 from declaration; it will be inferred from the right-hand side (ST1023)
service/dap/server.go:1448:11: should omit type AttachConfig from declaration; it will be inferred from the right-hand side (ST1023)
service/dap/utils.go:5:6: func min is unused (U1000)
service/debugger/debugger.go:946:5: builtin function len does not return negative values (SA4024)
service/debugger/debugger_linux.go:20:12: error strings should not be capitalized (ST1005)
service/debugger/debugger_linux.go:27:12: error strings should not be capitalized (ST1005)
service/rpc1/client.go:23:5: error var unsupportedApiError should have name of the form errFoo (ST1012)
service/rpc1/client.go:78:17: error strings should not be capitalized (ST1005)
service/rpc2/client.go:111:17: error strings should not be capitalized (ST1005)
_scripts/test_linux.sh
浏览文件 @
038cd99b
...
...
@@ -42,6 +42,7 @@ GOPATH=$(pwd)/go
export
GOPATH
export
PATH
=
$PATH
:
$GOROOT
/bin:
$GOPATH
/bin
go version
go
install
honnef.co/go/tools/cmd/staticcheck@2021.1.1
||
true
uname
-a
echo
"
$PATH
"
...
...
_scripts/test_windows.ps1
浏览文件 @
038cd99b
...
...
@@ -7,7 +7,7 @@ param (
#Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install MinGW.
choco
install
-y
mingw
choco
install
-y
mingw
--version
10.2.0
# Install Procdump
if
(
-Not
(
Test-Path
"C:\procdump"
))
...
...
cmd/dlv/dlv_test.go
浏览文件 @
038cd99b
...
...
@@ -362,6 +362,7 @@ func checkAutogenDoc(t *testing.T, filename, gencommand string, generated []byte
if
checkAutogenDocLongOutput
{
t
.
Logf
(
"generated %q saved %q
\n
"
,
generated
,
saved
)
}
diffMaybe
(
t
,
filename
,
generated
)
t
.
Fatalf
(
"%s: needs to be regenerated; run %s"
,
filename
,
gencommand
)
}
...
...
@@ -370,6 +371,7 @@ func checkAutogenDoc(t *testing.T, filename, gencommand string, generated []byte
if
checkAutogenDocLongOutput
{
t
.
Logf
(
"generated %q saved %q
\n
"
,
generated
,
saved
)
}
diffMaybe
(
t
,
filename
,
generated
)
t
.
Fatalf
(
"%s: needs to be regenerated; run %s"
,
filename
,
gencommand
)
}
}
...
...
@@ -383,6 +385,22 @@ func slurpFile(t *testing.T, filename string) []byte {
return
saved
}
func
diffMaybe
(
t
*
testing
.
T
,
filename
string
,
generated
[]
byte
)
{
_
,
err
:=
exec
.
LookPath
(
"diff"
)
if
err
!=
nil
{
return
}
cmd
:=
exec
.
Command
(
"diff"
,
filename
,
"-"
)
cmd
.
Dir
=
projectRoot
()
stdin
,
_
:=
cmd
.
StdinPipe
()
go
func
()
{
stdin
.
Write
(
generated
)
stdin
.
Close
()
}()
out
,
_
:=
cmd
.
CombinedOutput
()
t
.
Logf
(
"diff:
\n
%s"
,
string
(
out
))
}
// TestGeneratedDoc tests that the autogenerated documentation has been
// updated.
func
TestGeneratedDoc
(
t
*
testing
.
T
)
{
...
...
@@ -863,3 +881,17 @@ func TestVersion(t *testing.T) {
t
.
Errorf
(
"got %s
\n
want %v and %v in the output"
,
got
,
want1
,
want2
)
}
}
func
TestStaticcheck
(
t
*
testing
.
T
)
{
_
,
err
:=
exec
.
LookPath
(
"staticcheck"
)
if
err
!=
nil
{
t
.
Skip
(
"staticcheck not installed"
)
}
// default checks minus SA1019 which complains about deprecated identifiers, which change between versions of Go.
args
:=
[]
string
{
"-tests=false"
,
"-checks=all,-SA1019,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022"
,
"github.com/go-delve/delve/..."
}
cmd
:=
exec
.
Command
(
"staticcheck"
,
args
...
)
cmd
.
Dir
=
projectRoot
()
cmd
.
Env
=
append
(
os
.
Environ
(),
"GOOS=linux"
,
"GOARCH=amd64"
)
out
,
_
:=
cmd
.
CombinedOutput
()
checkAutogenDoc
(
t
,
"_scripts/staticcheck-out.txt"
,
fmt
.
Sprintf
(
"staticcheck %s > _scripts/staticcheck-out.txt"
,
strings
.
Join
(
args
,
" "
)),
out
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录