Skip to content

Commit

Permalink
SA9002: detect fs.FileMode in addition to os.FileMode
Browse files Browse the repository at this point in the history
Go 1.16 delcares os.FileMode as an alias for fs.FileMode, which broke
our check.
  • Loading branch information
dominikh committed Feb 17, 2021
1 parent fd74b4f commit 16f40c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion staticcheck/lint.go
Expand Up @@ -2926,7 +2926,8 @@ func CheckNonOctalFileMode(pass *analysis.Pass) (interface{}, error) {
if !ok {
continue
}
if !typeutil.IsType(pass.TypesInfo.TypeOf(lit), "os.FileMode") {
if !typeutil.IsType(pass.TypesInfo.TypeOf(lit), "os.FileMode") &&
!typeutil.IsType(pass.TypesInfo.TypeOf(lit), "io/fs.FileMode") {
continue
}
if len(lit.Value) == 3 &&
Expand Down

0 comments on commit 16f40c1

Please sign in to comment.