chore: fix some small issues detected by golangci-lint

But not using it as some linters are either plain incorrect (the one
suggesting to not use nil for `c.t.Context()`) or just
debatable (checking for err value is a good practice, but there are
good reasons to opt out in some cases).
This commit is contained in:
Vincent Bernat
2022-08-10 17:44:32 +02:00
parent 17eb5529cf
commit 78fb01c223
17 changed files with 36 additions and 78 deletions

View File

@@ -168,7 +168,7 @@ func (r *imageEmbedder) Transform(node *ast.Document, reader text.Reader, pc par
switch node := n.(type) {
case *ast.Image:
path := string(node.Destination)
if strings.Index(path, "/") != -1 || !strings.HasSuffix(path, ".svg") {
if strings.Contains(path, "/") || !strings.HasSuffix(path, ".svg") {
break
}
f, err := r.root.Open(path)