2024-05-06 20:40:05 +00:00
|
|
|
---
|
2024-10-29 18:27:12 +00:00
|
|
|
date: 2020-08-26
|
2024-05-06 20:40:05 +00:00
|
|
|
id: a8b17c59-bf17-4dc8-a0cd-5bf68b2e15c1
|
|
|
|
title: Golang tooling
|
|
|
|
---
|
|
|
|
|
|
|
|
# Documentation
|
|
|
|
|
|
|
|
Install godoc with `go get golang.org/x/tools/cmd/godoc`
|
|
|
|
|
|
|
|
Documentation can be generated with
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
godoc --http :8000
|
|
|
|
```
|
|
|
|
|
|
|
|
# Linters
|
|
|
|
|
|
|
|
- [errcheck](https://github.com/kisielk/errcheck)
|
|
|
|
|
|
|
|
# Testing
|
|
|
|
|
|
|
|
## Code coverage
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
go test -cover
|
|
|
|
```
|
|
|
|
|
|
|
|
## Race conditions
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
go test -race
|
|
|
|
```
|
|
|
|
|
|
|
|
## Vetting
|
|
|
|
|
|
|
|
Vet examines Go source code and reports suspicious constructs, such as
|
|
|
|
Printf calls whose arguments do not align with the format string. Vet
|
|
|
|
uses heuristics that do not guarantee all reports are genuine problems,
|
|
|
|
but it can find errors not caught by the compilers.
|
|
|
|
|
|
|
|
``` shell
|
|
|
|
go vet
|
|
|
|
```
|