github / github/codeql

Tracing test code

Aberta
#9,309 0 comentários 0 reações 0 responsáveis Ver no GitHub
Go
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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#'

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.