Skip to content
Permalink
Browse files

Various acronym lints (#112)

  • Loading branch information...
kebertxela authored and stapelberg committed May 22, 2019
1 parent 6021492 commit 3d27f575ad5faa0a823b8048d0cc355666b2a629
Showing with 15 additions and 15 deletions.
  1. +1 −1 cmd/debiman/globalview.go
  2. +1 −1 cmd/debiman/main.go
  3. +1 −1 cmd/debiman/prometheus.go
  4. +10 −10 cmd/debiman/render.go
  5. +2 −2 cmd/debiman/render_test.go
@@ -30,7 +30,7 @@ type stats struct {
PackagesDeleted uint64
ManpagesRendered uint64
ManpageBytes uint64
HtmlBytes uint64
HTMLBytes uint64
IndexBytes uint64
}

@@ -151,7 +151,7 @@ func logic() error {
fmt.Printf("packages deleted: %d\n", globalView.stats.PackagesDeleted)
fmt.Printf("manpages rendered: %d\n", globalView.stats.ManpagesRendered)
fmt.Printf("total manpage bytes: %d\n", globalView.stats.ManpageBytes)
fmt.Printf("total HTML bytes: %d\n", globalView.stats.HtmlBytes)
fmt.Printf("total HTML bytes: %d\n", globalView.stats.HTMLBytes)
fmt.Printf("auxserver index bytes: %d\n", globalView.stats.IndexBytes)
fmt.Printf("wall-clock runtime (s): %d\n", int(time.Now().Sub(start).Seconds()))

@@ -26,7 +26,7 @@ manpages_rendered {{ .Stats.ManpagesRendered }}
# HELP manpage_bytes Total number of bytes used by manpages (by format).
# TYPE manpage_bytes gauge
manpage_bytes{format="man"} {{ .Stats.ManpageBytes }}
manpage_bytes{format="html"} {{ .Stats.HtmlBytes }}
manpage_bytes{format="html"} {{ .Stats.HTMLBytes }}
# HELP index_bytes Total number of bytes used for the auxserver index.
# TYPE index_bytes gauge
@@ -55,7 +55,7 @@ type breadcrumbs []breadcrumb
func (b breadcrumbs) ToJSON() template.HTML {
type item struct {
Type string `json:"@type"`
Id string `json:"@id"`
ID string `json:"@id"`
Name string `json:"name"`
}
type listItem struct {
@@ -79,7 +79,7 @@ func (b breadcrumbs) ToJSON() template.HTML {
Position: idx + 1,
Item: item{
Type: "Thing",
Id: br.Link,
ID: br.Link,
Name: br.Text,
},
}
@@ -111,9 +111,9 @@ func listManpages(dir string) (map[string]*manpage.Meta, error) {
}
defer files.Close()

var predictedEof bool
var predictedEOF bool
for {
if predictedEof {
if predictedEOF {
break
}

@@ -135,7 +135,7 @@ func listManpages(dir string) (map[string]*manpage.Meta, error) {
// When len(names) < 2048 the next Readdirnames() call will
// result in io.EOF and can be skipped to reduce getdents(2)
// syscalls by half.
predictedEof = len(names) < 2048
predictedEOF = len(names) < 2048

for _, fn := range names {
if !strings.HasSuffix(fn, ".gz") ||
@@ -190,9 +190,9 @@ func walkManContents(ctx context.Context, renderChan chan<- renderJob, dir strin
}
defer files.Close()

var predictedEof bool
var predictedEOF bool
for {
if predictedEof {
if predictedEOF {
break
}

@@ -214,7 +214,7 @@ func walkManContents(ctx context.Context, renderChan chan<- renderJob, dir strin
// When len(names) < 2048 the next Readdirnames() call will
// result in io.EOF and can be skipped to reduce getdents(2)
// syscalls by half.
predictedEof = len(names) < 2048
predictedEOF = len(names) < 2048

for _, fn := range names {
if !strings.HasSuffix(fn, ".gz") ||
@@ -245,7 +245,7 @@ func walkManContents(ctx context.Context, renderChan chan<- renderJob, dir strin
n := strings.TrimSuffix(fn, ".gz") + ".html.gz"
htmlst, err := os.Stat(filepath.Join(dir, n))
if err == nil {
atomic.AddUint64(&gv.stats.HtmlBytes, uint64(htmlst.Size()))
atomic.AddUint64(&gv.stats.HTMLBytes, uint64(htmlst.Size()))
}
if err != nil || *forceRerender || htmlst.ModTime().Before(st.ModTime()) {
m, err := manpage.FromServingPath(*servingDir, full)
@@ -557,7 +557,7 @@ func renderAll(gv globalView) error {
return err
}

atomic.AddUint64(&gv.stats.HtmlBytes, n)
atomic.AddUint64(&gv.stats.HTMLBytes, n)
atomic.AddUint64(&gv.stats.ManpagesRendered, 1)
}
return nil
@@ -6,7 +6,7 @@ import (
)

func TestBreadcrumbsToJSON(t *testing.T) {
const breadcrumbsJson = `{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@type":"Thing","@id":"/contents-jessie.html","name":"jessie"}},{"@type":"ListItem","position":2,"item":{"@type":"Thing","@id":"/jessie/i3-wm/index.html","name":"i3-wm"}},{"@type":"ListItem","position":3,"item":{"@type":"Thing","@id":"","name":"i3(1)"}}]}`
const breadcrumbsJSON = `{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@type":"Thing","@id":"/contents-jessie.html","name":"jessie"}},{"@type":"ListItem","position":2,"item":{"@type":"Thing","@id":"/jessie/i3-wm/index.html","name":"i3-wm"}},{"@type":"ListItem","position":3,"item":{"@type":"Thing","@id":"","name":"i3(1)"}}]}`

const Suite = "jessie"
const Binarypkg = "i3-wm"
@@ -15,7 +15,7 @@ func TestBreadcrumbsToJSON(t *testing.T) {
{fmt.Sprintf("/%s/%s/index.html", Suite, Binarypkg), Binarypkg},
{"", "i3(1)"},
}
if got, want := string(b.ToJSON()), breadcrumbsJson; got != want {
if got, want := string(b.ToJSON()), breadcrumbsJSON; got != want {
fmt.Printf("%s\n", got)
t.Fatalf("unexpected breadcrumbs JSON: got %q, want %q", got, want)
}

0 comments on commit 3d27f57

Please sign in to comment.
You can’t perform that action at this time.