Skip to content

Commit 17882de

Browse files
committed
website: add staticcheck.io website
This adds a new website for Staticcheck. It uses Hugo[1] and the Docsy[2] theme and is fully open source, unlike the old website. The only files omitted from this commit are the list of sponsors and sponsor logos. These are kept out of tree, to keep the repository small and to avoid unnecessary commits as sponsors come and go. The website still builds fine without those files, it will only be missing the sponsors bar at the bottom, as well as the list of sponsors on the Sponsors page. To make generating the check documentation easier, lint.Documentation has gained two new fields, "Before" and "After". These contain before and after code samples, which were previously part of the "Text" field. The website is its own Go module, to prevent its inclusion in the honnef.co/go/tools module's ZIP. It's part of this repository, however, so that changes to Staticcheck and its documentation stay in sync. [1]: https://gohugo.io/ [2]: https://www.docsy.dev/
1 parent 8b9edfd commit 17882de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4792
-2633
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.golden -text
2+
*.svg binary

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/cmd/keyify/keyify
2+
/cmd/staticcheck/staticcheck
3+
/cmd/structlayout-optimize/structlayout-optimize
4+
/cmd/structlayout-pretty/structlayout-pretty
5+
/cmd/structlayout/structlayout
6+
/dist/20??.?.?/
7+
/dist/20??.?/
8+
/internal/cmd/irdump/irdump
9+
/website/public
10+
/website/resources
11+
/website/assets/img/sponsors
12+
/website/data/sponsors.toml

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "website/themes/docsy"]
2+
path = website/themes/docsy
3+
url = https://github.com/google/docsy

analysis/lint/lint.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ const (
5858
type Documentation struct {
5959
Title string
6060
Text string
61+
Before string
62+
After string
6163
Since string
6264
NonDefault bool
6365
Options []string
@@ -66,8 +68,10 @@ type Documentation struct {
6668

6769
func Markdownify(m map[string]*Documentation) map[string]*Documentation {
6870
for _, v := range m {
69-
v.Title = toMarkdown(v.Title)
70-
v.Text = toMarkdown(v.Text)
71+
v.Title = strings.TrimSpace(toMarkdown(v.Title))
72+
v.Text = strings.TrimSpace(toMarkdown(v.Text))
73+
v.Before = strings.TrimSpace(v.Before)
74+
v.After = strings.TrimSpace(v.After)
7175
}
7276
return m
7377
}
@@ -86,6 +90,22 @@ func (doc *Documentation) String() string {
8690
if doc.Text != "" {
8791
fmt.Fprintf(b, "%s\n\n", doc.Text)
8892
}
93+
94+
if doc.Before != "" {
95+
fmt.Fprintln(b, "Before:")
96+
fmt.Fprintln(b, "")
97+
for _, line := range strings.Split(doc.Before, "\n") {
98+
fmt.Fprint(b, " ", line, "\n")
99+
}
100+
fmt.Fprintln(b, "")
101+
fmt.Fprintln(b, "After:")
102+
fmt.Fprintln(b, "")
103+
for _, line := range strings.Split(doc.After, "\n") {
104+
fmt.Fprint(b, " ", line, "\n")
105+
}
106+
fmt.Fprintln(b, "")
107+
}
108+
89109
fmt.Fprint(b, "Available since\n ")
90110
if doc.Since == "" {
91111
fmt.Fprint(b, "unreleased")

doc/2017.2.html

Lines changed: 0 additions & 182 deletions
This file was deleted.

0 commit comments

Comments
 (0)