Skip to content

Commit f6466f0

Browse files
committed
Fix lint warn
1 parent 96ae31c commit f6466f0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ var rootCmd = &cobra.Command{
451451
if err != nil {
452452
return err
453453
}
454-
if err := os.WriteFile(rp, r.Bytes(), os.ModePerm); err != nil {
454+
if err := os.WriteFile(rp, r.Bytes(), os.ModePerm); err != nil { //nolint:gosec
455455
return err
456456
}
457457
addPaths = append(addPaths, rp)

datastore/local/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (l *Local) Put(ctx context.Context, path string, content []byte) error {
4949
return err
5050
}
5151
}
52-
return os.WriteFile(p, content, os.ModePerm)
52+
return os.WriteFile(p, content, os.ModePerm) // #nosec
5353
}
5454

5555
func (l *Local) FS() (fs.FS, error) {

ratio/copy_from_gocloc.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ var shebang2ext = map[string]string{
2626
"escript": "erl",
2727
}
2828

29-
func getShebang(line string) (shebangLang string, ok bool) {
29+
func getShebang(line string) (shebangLang string, ok bool) { //nostyle:getters
3030
ret := reShebangEnv.FindAllStringSubmatch(line, -1)
31-
if ret != nil && len(ret[0]) == 3 {
31+
if ret != nil && len(ret[0]) == 3 { //nostyle:nilslices
3232
shebangLang = ret[0][2]
3333
if sl, ok := shebang2ext[shebangLang]; ok {
3434
return sl, ok
@@ -37,7 +37,7 @@ func getShebang(line string) (shebangLang string, ok bool) {
3737
}
3838

3939
ret = reShebangLang.FindAllStringSubmatch(line, -1)
40-
if ret != nil && len(ret[0]) >= 2 {
40+
if ret != nil && len(ret[0]) >= 2 { //nostyle:nilslices
4141
shebangLang = ret[0][1]
4242
if sl, ok := shebang2ext[shebangLang]; ok {
4343
return sl, ok
@@ -48,7 +48,7 @@ func getShebang(line string) (shebangLang string, ok bool) {
4848
return "", false
4949
}
5050

51-
func getFileTypeByShebang(path string) (shebangLang string, ok bool) {
51+
func getFileTypeByShebang(path string) (shebangLang string, ok bool) { //nostyle:getters
5252
f, err := os.Open(path)
5353
if err != nil {
5454
return // ignore error
@@ -68,7 +68,7 @@ func getFileTypeByShebang(path string) (shebangLang string, ok bool) {
6868
return
6969
}
7070

71-
func getFileType(path string) (ext string, ok bool) {
71+
func getFileType(path string) (ext string, ok bool) { //nostyle:getters
7272
ext = filepath.Ext(path)
7373
base := filepath.Base(path)
7474

report/report.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func (r *Report) convertFormat(v any) string {
583583
}
584584
return fmt.Sprintf("%.1f", floor1(vv))
585585
default:
586-
panic(fmt.Errorf("convert format error .Unknown type:%v", vv))
586+
panic(fmt.Errorf("convert format error .Unknown type:%v", vv)) //nostyle:dontpanic
587587
}
588588
}
589589

report/report_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func TestCollectCustomMetrics(t *testing.T) {
249249
if err != nil {
250250
t.Fatal(err)
251251
}
252-
if err := os.WriteFile(filepath.Join(testdataDir(t), "custom_metrics", fmt.Sprintf("%s.json", m.Key)), b, os.ModePerm); err != nil {
252+
if err := os.WriteFile(filepath.Join(testdataDir(t), "custom_metrics", fmt.Sprintf("%s.json", m.Key)), b, 0600); err != nil {
253253
t.Fatal(err)
254254
}
255255
}

0 commit comments

Comments
 (0)