1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-16 14:27:01 +00:00

Fix misc. linter issues (comments, variable naming, etc.)

We've accumulated a few linter issues around comments and a couple of
variable names.

While none of them is major, this patch cleans them up so it's easier to
go through the linter output, and we can start being more strict about
it.
This commit is contained in:
Alberto Bertogli
2022-08-27 23:16:01 +01:00
parent 6dfff9a790
commit e85c31782b
11 changed files with 30 additions and 13 deletions

View File

@@ -4,6 +4,7 @@
// Note that chasquid does NOT support this, we do it before starting up the
// daemon for testing purposes only.
//
//go:build ignore
// +build ignore
package main

View File

@@ -31,7 +31,6 @@ var (
var (
host string
exit bool
)
func main() {
@@ -73,8 +72,13 @@ func main() {
time.Sleep(24 * time.Hour)
}
}
for _, c := range conns {
c.close()
}
}
// C represents a single connection.
type C struct {
tr trace.Trace
n net.Conn

View File

@@ -90,6 +90,7 @@ func main() {
fmt.Printf("Total: %.1f\n", totals.TotalPercent())
}
// Totals is used to keep track of total counters.
type Totals struct {
// Total statements.
total int
@@ -104,6 +105,7 @@ type Totals struct {
coveredF map[string]int
}
// Add the given profile to the total counters.
func (t *Totals) Add(p *cover.Profile) {
for _, b := range p.Blocks {
t.total += b.NumStmt
@@ -115,10 +117,12 @@ func (t *Totals) Add(p *cover.Profile) {
}
}
// Percent covered for the given file.
func (t *Totals) Percent(f string) float32 {
return float32(t.coveredF[f]) / float32(t.totalF[f]) * 100
}
// TotalPercent covered, across all files.
func (t *Totals) TotalPercent() float32 {
return float32(t.covered) / float32(t.total) * 100
}

View File

@@ -126,7 +126,7 @@ func serial(id int) {
var count int64
start := time.Now()
for {
count += 1
count++
err := one()
if err != nil {
log.Fatalf("%v", err)

View File

@@ -119,7 +119,11 @@ func (m *miniDNS) listenAndServeUDP(addr string) {
log.Fatalf("error packing reply: %v", err)
}
conn.WriteTo(rbuf, addr)
_, err = conn.WriteTo(rbuf, addr)
if err != nil {
log.Infof("%v/%-5d error writing: %v",
addr, msg.ID, err)
}
}
}
@@ -245,7 +249,7 @@ func (m *miniDNS) loadZones(f *os.File) {
continue
}
vs := regexp.MustCompile("\\s+").Split(line, 3)
vs := regexp.MustCompile(`\s+`).Split(line, 3)
if len(vs) != 3 {
log.Fatalf("line %d: invalid format", lineno)
}