Skip to content

Commit

Permalink
chore: remove bool
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 22, 2024
1 parent 6ad1bdc commit 440e395
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ func newParsedFile(file *ast.File, fset *token.FileSet) (*parsedFile, error) {
// with code and comment without reading the file. Function `Format`
// from "go/format" won't help here if the original file is not gofmt-ed.

var filename string
filename, _ = getFilename(fset, file)
filename := getFilename(fset, file)

if !strings.HasSuffix(filename, ".go") {
return nil, errEmptyInput
Expand Down Expand Up @@ -262,11 +261,11 @@ func matchAny(s string, rr []*regexp.Regexp) bool {
return false
}

func getFilename(fset *token.FileSet, file *ast.File) (string, bool) {
func getFilename(fset *token.FileSet, file *ast.File) string {
filename := fset.PositionFor(file.Pos(), true).Filename
if !strings.HasSuffix(filename, ".go") {
return fset.PositionFor(file.Pos(), false).Filename, false
return fset.PositionFor(file.Pos(), false).Filename
}

return filename, true
return filename
}

0 comments on commit 440e395

Please sign in to comment.