-
Install asdf
-
Adicionar plugin golang
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
- Instalar golang
asdf install
go mod init <name-module>
# Entre na pasta contendo o teste
go test
# Executando de forma recursiva, é necessário ter modulo go
# Flags
# -v: verboso
# --cover: gera porcentagem de cobertura
# --coverprofile <nome-file>.txt: gera relatório de cobertura
relatório de cobertura
go test ./...
// Adicionar no início de cado função do teste
func TestParapelo(t *testing.T) {
t.Parallel()
return "true"
}
# Informações genéricas
go tool cover --func=<nome-file>.txt
# Gerando html
go tool cover --html=<nome-file>.txt