Skip to content

Commit f424936

Browse files
committed
midi: fixed lint warning (cf. #1004 (comment))
1 parent 462ae15 commit f424936

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

format/midi/midi.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,15 @@ func peekEvent(d *decode.D) (uint64, uint8, uint8) {
163163
}
164164
}
165165

166+
// Big endian varint
166167
func vlq(d *decode.D) uint64 {
167168
vlq := uint64(0)
168169

169170
for {
170171
b := d.U8()
171172

172173
vlq <<= 7
173-
vlq += uint64(b & 0x7f)
174+
vlq += b & 0x7f
174175

175176
if b&0x80 == 0 {
176177
break
@@ -180,6 +181,7 @@ func vlq(d *decode.D) uint64 {
180181
return vlq
181182
}
182183

184+
// Variable length with a big endian varint length
183185
func vlf(d *decode.D) ([]uint8, error) {
184186
N := int(vlq(d))
185187

@@ -190,6 +192,7 @@ func vlf(d *decode.D) ([]uint8, error) {
190192
}
191193
}
192194

195+
// Variable length string with a big endian varint length
193196
func vlstring(d *decode.D) string {
194197
if data, err := vlf(d); err != nil {
195198
d.Errorf("%v", err)

format/midi/testdata/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ debug: build
1818
test: build
1919
go test ./format -run TestFormats/midi
2020

21+
lint: test
22+
make -f Makefile lint
23+
2124
regenerate: build
2225
go test ./format -run TestFormats/midi -update
2326

0 commit comments

Comments
 (0)