Skip to content

Commit

Permalink
Merge pull request #28 from ldez/fix/move-init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkohler authored Jun 13, 2023
2 parents ad2abe9 + 8792917 commit 564f756
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 7 additions & 0 deletions cmd/nakedret/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"go/build"

"golang.org/x/tools/go/analysis/singlechecker"

"github.com/alexkohler/nakedret/v2"
Expand All @@ -10,6 +12,11 @@ const (
DefaultLines = 5
)

func init() {
// TODO allow build tags
build.Default.UseAllFiles = true
}

func main() {
analyzer := nakedret.NakedReturnAnalyzer(DefaultLines)
singlechecker.Main(analyzer)
Expand Down
11 changes: 2 additions & 9 deletions nakedret.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ import (
"golang.org/x/tools/go/ast/inspector"
)

const (
pwd = "./"
)

func init() {
//TODO allow build tags
build.Default.UseAllFiles = true
}
const pwd = "./"

func NakedReturnAnalyzer(defaultLines uint) *analysis.Analyzer {
nakedRet := &NakedReturnRunner{}
Expand Down Expand Up @@ -149,7 +142,7 @@ func parseInput(args []string, fset *token.FileSet) ([]*ast.File, error) {
}
} else {

//TODO clean this up a bit
// TODO clean this up a bit
imPaths := importPaths([]string{arg})
for _, importPath := range imPaths {
pkg, err := build.Import(importPath, ".", 0)
Expand Down

0 comments on commit 564f756

Please sign in to comment.