You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently use this as golangci-lint run my vs-code go linter.
I have used it for about a year on a WebRTC SFU: deadsfu
(see the image at the end for vscode setup)
I do not find it overly verbose, and I find it does a near perfect identification (separation) of issues I would want fix vs ignore.
(the main issue with many linters)
I noticed about 20-30 issues with gostatic, that seem like the project would benefit from if fixed.
@piranha Do you think these should be cleaned up? (ignoring who/when etc right now)
c@macmini ~/D/gostatic (master)> golangci-lint run
hotreload/core.go:109:5: `htmlRe` is unused (deadcode)
var htmlRe = regexp.MustCompile("\btext/html\b")
^
lib/utils.go:44:6: `drainchannel` is unused (deadcode)
func drainchannel(out chan string) {
^
gostatic.go:21:2: `ExitCodeOk` is unused (deadcode)
ExitCodeOk = 0
^
gostatic.go:25:2: `ExitCodeInvalidConfig` is unused (deadcode)
ExitCodeInvalidConfig = 2
^
utils.go:21:6: `errexit` is unused (deadcode)
func errexit(err error) {
^
utils.go:33:6: `debug` is unused (deadcode)
func debug(format string, args ...interface{}) {
^
hotreload/core.go:150:10: Error return value of `w.Write` is not checked (errcheck)
w.Write(Morphdom)
^
hotreload/core.go:151:10: Error return value of `w.Write` is not checked (errcheck)
w.Write(Script)
^
hotreload/watch.go:21:14: Error return value of `watcher.Add` is not checked (errcheck)
watcher.Add(fn)
^
hotreload/watch.go:43:17: Error return value of `watcher.Add` is not checked (errcheck)
watcher.Add(ev.Name)
^
hotreload/watch.go:45:20: Error return value of `watcher.Remove` is not checked (errcheck)
watcher.Remove(ev.Name)
^
hotreload/watch.go:56:16: Error return value of `filepath.Walk` is not checked (errcheck)
filepath.Walk(path, watchAll(watcher))
^
hotreload/watch.go:59:14: Error return value of `watcher.Add` is not checked (errcheck)
watcher.Add(path)
^
lib/example.go:172:11: Error return value is not checked (errcheck)
WriteFile(dir, "config", ExampleConfig)
^
lib/example.go:173:11: Error return value is not checked (errcheck)
WriteFile(dir, "Makefile", ExampleMakefile)
^
lib/example.go:174:11: Error return value is not checked (errcheck)
WriteFile(dir, "site.tmpl", ExampleTemplate)
^
lib/header.go:141:16: Error return value of `yaml.Unmarshal` is not checked (errcheck)
yaml.Unmarshal([]byte(source), &m)
^
lib/page.go:74:12: Error return value of `page.Peek` is not checked (errcheck)
page.Peek()
^
lib/page.go:256:15: Error return value of `page.Process` is not checked (errcheck)
page.Process()
^
lib/site.go:86:15: Error return value of `filepath.Walk` is not checked (errcheck)
filepath.Walk(site.Source, site.collectFunc(errors))
^
lib/template_funcs.go:55:16: Error return value of `io.WriteString` is not checked (errcheck)
io.WriteString(h, value)
^
lib/template_funcs.go:199:17: Error return value of `io.WriteString` is not checked (errcheck)
io.WriteString(stdin, text)
^
processors/pagination.go:143:15: Error return value of `listpage.Peek` is not checked (errcheck)
listpage.Peek()
^
processors/tags.go:68:16: Error return value of `tagpage.Peek` is not checked (errcheck)
tagpage.Peek()
^
gostatic.go:92:24: Error return value of `gostatic.WriteExample` is not checked (errcheck)
gostatic.WriteExample(target)
^
hotreload/core.go:30:2: `dirs` is unused (structcheck)
dirs []string
^
hotreload/core.go:31:2: `files` is unused (structcheck)
files []string
^
lib/site.go:25:2: `mx` is unused (structcheck)
mx sync.Mutex
^
lib/config.go:160:5: S1011: should replace loop with `cfg.Templates = append(cfg.Templates, files...)` (gosimple)
for _, fn := range files {
^
lib/config.go:96:20: S1003: should use strings.Contains(line, "=") instead (gosimple)
if level == 0 && strings.Index(line, "=") != -1 {
^
lib/header.go:145:10: S1034: assigning the result of this type assertion to a variable (switch value := value.(type)) could eliminate type assertions in switch cases (gosimple)
switch value.(type) {
^
lib/header.go:149:31: S1034(related information): could eliminate this type assertion (gosimple)
temp := make([]string, len(value.([]interface{})))
^
lib/header.go:150:22: S1034(related information): could eliminate this type assertion (gosimple)
for i, v := range value.([]interface{}) {
^
lib/header.go:155:41: S1034(related information): could eliminate this type assertion (gosimple)
cfg.SetValue(key, strconv.FormatBool(value.(bool)), &s)
^
processors/template.go:53:10: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (gosimple)
return errors.New(fmt.Sprintf("%s: %s", page.Source, err))
^
lib/page.go:293:24: S1002: should omit comparison to bool constant, can be simplified to `page.Hide` (gosimple)
case "Hide": return ((page.Hide == true && value == "true") ||
^
lib/page.go:294:4: S1002: should omit comparison to bool constant, can be simplified to `!page.Hide` (gosimple)
(page.Hide == false && value == "false"))
^
hotreload/core.go:78:2: unreachable: unreachable code (govet)
s.Lock()
^
hotreload/core.go:71:15: unusedresult: result of fmt.Errorf call not used (govet)
fmt.Errorf("error: %s", err)
^
hotreload/core.go:95:13: unusedresult: result of fmt.Errorf call not used (govet)
fmt.Errorf("can't establish WebSocket connection: %s", err)
^
processors/template.go:45:3: SA9003: empty branch (staticcheck)
if err := recover(); err != nil {
^
lib/page.go:126:30: SA5011: possible nil pointer dereference (staticcheck)
url := strings.Replace(page.Path, string(filepath.Separator), "/", -1)
^
lib/page.go:123:5: SA5011(related information): this check suggests that the pointer can be nil (staticcheck)
if page == nil {
^
my vscode setup:
The text was updated successfully, but these errors were encountered:
I currently use this as
golangci-lint run
my vs-code go linter.I have used it for about a year on a WebRTC SFU: deadsfu
(see the image at the end for vscode setup)
I do not find it overly verbose, and I find it does a near perfect identification (separation) of issues I would want fix vs ignore.
(the main issue with many linters)
I noticed about 20-30 issues with gostatic, that seem like the project would benefit from if fixed.
@piranha Do you think these should be cleaned up? (ignoring who/when etc right now)
c@macmini ~/D/gostatic (master)> golangci-lint run
my vscode setup:
The text was updated successfully, but these errors were encountered: