github / github/codeql

Tracing test code

オープン
#9,309 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Go
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

For some use-cases (probably not security), it would be useful to instrument test code. This involves some correctness properties, and in my case a custom query to check proper use of the GORM database interface (checking the `Error` code after a SQL query).

I tried commands such as:

codeql database create ../ -l go -c "go test ./foo -c -count 1"

However, the tracer log indicates that we do not consider `go test` suitable for tracing.

Renaming all the `_test.go` files and then building them normally runs into problems with the implicit package structure around tests, e.g:

find . -name '*_test.go' | perl -p -e 's#(.*)_test.go#\1#' | xargs -I {} mv {}_test.go {}_tmp.go
rg 'package .*_test' -l | xargs perl -p -i -e 's#package (.*)_test#package \1#'

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。