lintcmd: don't print \' in -list-checks and -explain#1544
lintcmd: don't print \' in -list-checks and -explain#1544arp242 wants to merge 2 commits intodominikh:masterfrom
Conversation
|
FWIW, |
All the single quotes are written as `\'` in the descriptions. I assume
that's for a good reason, but -list-checks would print:
% staticcheck -list-checks | grep "'"
S1003 Replace call to \'strings.Index\' with \'strings.Contains\'
S1004 Replace call to \'bytes.Compare\' with \'bytes.Equal\'
S1011 Use a single \'append\' to concatenate two slices
S1012 Replace \'time.Now().Sub(x)\' with \'time.Since(x)\'
...
% staticcheck -explain S1003
Replace call to \'strings.Index\' with \'strings.Contains\'
So fix that:
% staticcheck -list-checks | grep "'"
S1003 Replace call to 'strings.Index' with 'strings.Contains'
S1004 Replace call to 'bytes.Compare' with 'bytes.Equal'
S1011 Use a single 'append' to concatenate two slices
S1012 Replace 'time.Now().Sub(x)' with 'time.Since(x)'
...
% staticcheck -explain S1003
Replace call to 'strings.Index' with 'strings.Contains'
I backed out this change, as per #1546. As I mentioned there, I thought all CLI flags were case-insensitive but they're not. I also added a commit to print fewer extraneous newlines in the Before/After blocks; see the commit message. |
The Before and After had extraneous newlines; before:
% staticcheck -explain S1000
Use plain channel send or receive instead of single-case select
Select statements with a single case can be replaced with a simple
send or receive.
Before (· represents blank line, git strips double blanks otherwise):
·
·
select {
case x := <-ch:
fmt.Println(x)
}
·
After:
·
·
x := <-ch
fmt.Println(x)
·
·
Available since
2017.1
And after:
% staticcheck -explain S1000
Use plain channel send or receive instead of single-case select
Select statements with a single case can be replaced with a simple
send or receive.
Before:
select {
case x := <-ch:
fmt.Println(x)
}
After:
x := <-ch
fmt.Println(x)
Available since
2017.1
|
I believe this is part of a broader regression introduced by 8643e6e where we broke the conversion of documentation to plain text and Markdown variants (cf. the use of |
|
Yeah, I also discovered that on Sunday when I wanted to build the website. Fixing the |
|
Yeah, I'll have to fix |
I actually tried older versions of Hugo too, the current release from when the website was first added, and a release from a few months before that, but all gave the same error as the latest version: That was with v0.88.1 and v0.80.0, according to my shell history. According to the Hugo docs everything looks fine too, so idk. At this point I gave up. FYI. |
|
Make sure you've cloned the repository recursively; the website theme is pulled in via a git submodule. |
|
Ah right, that furthers things! Got fresh errors though. I just wanted to look at some of the documentation issues in the weekend, and make sure whatever I wrote appears well on the website. Well, whatever 🤷 The amount of complexity involved here for rendering a few basic HTML pages is slightly ridiculous to be honest. |
All the single quotes are written as
\'in the descriptions. I assume that's for a good reason, but -list-checks would print:So fix that:
As an added bonus, make
-explain s1003(lower case) work. Seemed too small of a change to make a new PR for.