Skip to content

Commit ef3b2d1

Browse files
authored
fix: lint issues (#280)
Signed-off-by: Carlos Alexandro Becker <[email protected]>
1 parent 77f8c87 commit ef3b2d1

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

ansi/codeblock.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ const (
1616
chromaStyleTheme = "charm"
1717
)
1818

19-
var (
20-
// mutex for synchronizing access to the chroma style registry.
21-
// Related https://github.com/alecthomas/chroma/pull/650
22-
mutex = sync.Mutex{}
23-
)
19+
// mutex for synchronizing access to the chroma style registry.
20+
// Related https://github.com/alecthomas/chroma/pull/650
21+
var mutex = sync.Mutex{}
2422

2523
// A CodeBlockElement is used to render code blocks.
2624
type CodeBlockElement struct {

ansi/renderer_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ansi
33
import (
44
"bytes"
55
"encoding/json"
6-
"io/ioutil"
6+
"os"
77
"path/filepath"
88
"strings"
99
"testing"
@@ -35,11 +35,11 @@ func TestRenderer(t *testing.T) {
3535
sn := filepath.Join(examplesDir, bn+".style")
3636
tn := filepath.Join("../testdata", bn+".test")
3737

38-
in, err := ioutil.ReadFile(f)
38+
in, err := os.ReadFile(f)
3939
if err != nil {
4040
t.Fatal(err)
4141
}
42-
b, err := ioutil.ReadFile(sn)
42+
b, err := os.ReadFile(sn)
4343
if err != nil {
4444
t.Fatal(err)
4545
}
@@ -77,15 +77,15 @@ func TestRenderer(t *testing.T) {
7777

7878
// generate
7979
if generateExamples {
80-
err = ioutil.WriteFile(tn, buf.Bytes(), 0644)
80+
err = os.WriteFile(tn, buf.Bytes(), 0644)
8181
if err != nil {
8282
t.Fatal(err)
8383
}
8484
continue
8585
}
8686

8787
// verify
88-
td, err := ioutil.ReadFile(tn)
88+
td, err := os.ReadFile(tn)
8989
if err != nil {
9090
t.Fatal(err)
9191
}
@@ -108,11 +108,11 @@ func TestRendererIssues(t *testing.T) {
108108
t.Run(bn, func(t *testing.T) {
109109
tn := filepath.Join(issuesDir, bn+".test")
110110

111-
in, err := ioutil.ReadFile(f)
111+
in, err := os.ReadFile(f)
112112
if err != nil {
113113
t.Fatal(err)
114114
}
115-
b, err := ioutil.ReadFile("../styles/dark.json")
115+
b, err := os.ReadFile("../styles/dark.json")
116116
if err != nil {
117117
t.Fatal(err)
118118
}
@@ -150,15 +150,15 @@ func TestRendererIssues(t *testing.T) {
150150

151151
// generate
152152
if generateIssues {
153-
err = ioutil.WriteFile(tn, buf.Bytes(), 0644)
153+
err = os.WriteFile(tn, buf.Bytes(), 0644)
154154
if err != nil {
155155
t.Fatal(err)
156156
}
157157
return
158158
}
159159

160160
// verify
161-
td, err := ioutil.ReadFile(tn)
161+
td, err := os.ReadFile(tn)
162162
if err != nil {
163163
t.Fatal(err)
164164
}

glamour_test.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package glamour
22

33
import (
44
"bytes"
5-
"io/ioutil"
5+
"io"
6+
"os"
67
"strings"
78
"testing"
89
)
@@ -21,7 +22,7 @@ func TestTermRendererWriter(t *testing.T) {
2122
t.Fatal(err)
2223
}
2324

24-
in, err := ioutil.ReadFile(markdown)
25+
in, err := os.ReadFile(markdown)
2526
if err != nil {
2627
t.Fatal(err)
2728
}
@@ -35,22 +36,22 @@ func TestTermRendererWriter(t *testing.T) {
3536
t.Fatal(err)
3637
}
3738

38-
b, err := ioutil.ReadAll(r)
39+
b, err := io.ReadAll(r)
3940
if err != nil {
4041
t.Fatal(err)
4142
}
4243

4344
// generate
4445
if generate {
45-
err := ioutil.WriteFile(testFile, b, 0644)
46+
err := os.WriteFile(testFile, b, 0644)
4647
if err != nil {
4748
t.Fatal(err)
4849
}
4950
return
5051
}
5152

5253
// verify
53-
td, err := ioutil.ReadFile(testFile)
54+
td, err := os.ReadFile(testFile)
5455
if err != nil {
5556
t.Fatal(err)
5657
}
@@ -69,7 +70,7 @@ func TestTermRenderer(t *testing.T) {
6970
t.Fatal(err)
7071
}
7172

72-
in, err := ioutil.ReadFile(markdown)
73+
in, err := os.ReadFile(markdown)
7374
if err != nil {
7475
t.Fatal(err)
7576
}
@@ -80,7 +81,7 @@ func TestTermRenderer(t *testing.T) {
8081
}
8182

8283
// verify
83-
td, err := ioutil.ReadFile(testFile)
84+
td, err := os.ReadFile(testFile)
8485
if err != nil {
8586
t.Fatal(err)
8687
}
@@ -121,7 +122,7 @@ func TestWithPreservedNewLines(t *testing.T) {
121122
t.Fatal(err)
122123
}
123124

124-
in, err := ioutil.ReadFile("testdata/preserved_newline.in")
125+
in, err := os.ReadFile("testdata/preserved_newline.in")
125126
if err != nil {
126127
t.Fatal(err)
127128
}
@@ -132,7 +133,7 @@ func TestWithPreservedNewLines(t *testing.T) {
132133
}
133134

134135
// verify
135-
td, err := ioutil.ReadFile("testdata/preserved_newline.test")
136+
td, err := os.ReadFile("testdata/preserved_newline.test")
136137
if err != nil {
137138
t.Fatal(err)
138139
}
@@ -167,7 +168,7 @@ func TestStyles(t *testing.T) {
167168
}
168169

169170
func TestRenderHelpers(t *testing.T) {
170-
in, err := ioutil.ReadFile(markdown)
171+
in, err := os.ReadFile(markdown)
171172
if err != nil {
172173
t.Fatal(err)
173174
}
@@ -178,7 +179,7 @@ func TestRenderHelpers(t *testing.T) {
178179
}
179180

180181
// verify
181-
td, err := ioutil.ReadFile(testFile)
182+
td, err := os.ReadFile(testFile)
182183
if err != nil {
183184
t.Fatal(err)
184185
}
@@ -209,7 +210,7 @@ func TestCapitalization(t *testing.T) {
209210
}
210211

211212
// expected outcome
212-
td, err := ioutil.ReadFile("testdata/capitalization.test")
213+
td, err := os.ReadFile("testdata/capitalization.test")
213214
if err != nil {
214215
t.Fatal(err)
215216
}

0 commit comments

Comments
 (0)