Skip to content

Commit

Permalink
Merge pull request #396 from k1LoW/fix-lint-warn
Browse files Browse the repository at this point in the history
Fix lint warn
  • Loading branch information
k1LoW authored Jul 10, 2024
2 parents 96ae31c + f6466f0 commit 552b07f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ var rootCmd = &cobra.Command{
if err != nil {
return err
}
if err := os.WriteFile(rp, r.Bytes(), os.ModePerm); err != nil {
if err := os.WriteFile(rp, r.Bytes(), os.ModePerm); err != nil { //nolint:gosec
return err
}
addPaths = append(addPaths, rp)
Expand Down
2 changes: 1 addition & 1 deletion datastore/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (l *Local) Put(ctx context.Context, path string, content []byte) error {
return err
}
}
return os.WriteFile(p, content, os.ModePerm)
return os.WriteFile(p, content, os.ModePerm) // #nosec
}

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

Check failure on line 55 in datastore/local/local.go

View workflow job for this annotation

GitHub Actions / Test

[gostyle.mixedcaps] Go source code uses MixedCaps or mixedCaps (camel case) rather than underscores (snake case) when writing multi-word names. (ref: https://google.github.io/styleguide/go/guide#mixed-caps ): FS
Expand Down
10 changes: 5 additions & 5 deletions ratio/copy_from_gocloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ var shebang2ext = map[string]string{
"escript": "erl",
}

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

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

func getFileTypeByShebang(path string) (shebangLang string, ok bool) {
func getFileTypeByShebang(path string) (shebangLang string, ok bool) { //nostyle:getters
f, err := os.Open(path)
if err != nil {
return // ignore error
Expand All @@ -68,7 +68,7 @@ func getFileTypeByShebang(path string) (shebangLang string, ok bool) {
return
}

func getFileType(path string) (ext string, ok bool) {
func getFileType(path string) (ext string, ok bool) { //nostyle:getters
ext = filepath.Ext(path)
base := filepath.Base(path)

Expand Down
2 changes: 1 addition & 1 deletion report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ func (r *Report) convertFormat(v any) string {
}
return fmt.Sprintf("%.1f", floor1(vv))
default:
panic(fmt.Errorf("convert format error .Unknown type:%v", vv))
panic(fmt.Errorf("convert format error .Unknown type:%v", vv)) //nostyle:dontpanic
}
}

Expand Down
2 changes: 1 addition & 1 deletion report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func TestCollectCustomMetrics(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(testdataDir(t), "custom_metrics", fmt.Sprintf("%s.json", m.Key)), b, os.ModePerm); err != nil {
if err := os.WriteFile(filepath.Join(testdataDir(t), "custom_metrics", fmt.Sprintf("%s.json", m.Key)), b, 0600); err != nil {
t.Fatal(err)
}
}
Expand Down

0 comments on commit 552b07f

Please sign in to comment.