diff --git a/go.mod b/go.mod index cdd2aee..4a9cac4 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,12 @@ module github.com/gtramontina/ooze go 1.20 +retract ( + // This version contains an issue that prevents Ooze from running on + // internal packages. See https://github.com/gtramontina/ooze/issues/9. + v0.3.0 +) + require ( github.com/fatih/color v1.15.0 github.com/hexops/gotextdiff v1.0.3 diff --git a/internal/gosourcefile/gosourcefile.go b/internal/gosourcefile/gosourcefile.go index 33aef18..54b8156 100644 --- a/internal/gosourcefile/gosourcefile.go +++ b/internal/gosourcefile/gosourcefile.go @@ -3,10 +3,8 @@ package gosourcefile import ( "fmt" "go/ast" - "go/importer" "go/parser" "go/token" - "go/types" "github.com/gtramontina/ooze/internal/goinfectedfile" "github.com/gtramontina/ooze/viruses" @@ -32,24 +30,10 @@ func (f *GoSourceFile) Incubate(virus viruses.Virus) []*goinfectedfile.GoInfecte panic(fmt.Errorf("failed parsing file '%s': %w", f.relativePath, err)) } - cfg := types.Config{ //nolint:exhaustruct // default values for missing fields are okay - Importer: importer.Default(), - } - - info := types.Info{ //nolint:exhaustruct // Info.TypeOf needs Defs, Uses, and Types populated, we don't need the rest - Defs: map[*ast.Ident]types.Object{}, - Uses: map[*ast.Ident]types.Object{}, - Types: map[ast.Expr]types.TypeAndValue{}, - } - - if _, err := cfg.Check(f.relativePath, fileSet, []*ast.File{fileTree}, &info); err != nil { - panic(fmt.Errorf("failed type checking for file '%s': %w", f.relativePath, err)) - } - var infectedFiles []*goinfectedfile.GoInfectedFile ast.Inspect(fileTree, func(node ast.Node) bool { - for _, infection := range virus.Incubate(node, &info) { + for _, infection := range virus.Incubate(node, nil) { infectedFiles = append(infectedFiles, goinfectedfile.New(f.relativePath, f.rawContent, infection, fileSet, fileTree)) } diff --git a/release.go b/release.go index 01936a7..f90669b 100644 --- a/release.go +++ b/release.go @@ -28,7 +28,6 @@ import ( "github.com/gtramontina/ooze/viruses/arithmeticassignment" "github.com/gtramontina/ooze/viruses/arithmeticassignmentinvert" "github.com/gtramontina/ooze/viruses/bitwise" - "github.com/gtramontina/ooze/viruses/cancelnil" "github.com/gtramontina/ooze/viruses/comparison" "github.com/gtramontina/ooze/viruses/comparisoninvert" "github.com/gtramontina/ooze/viruses/comparisonreplace" @@ -59,7 +58,6 @@ var defaultOptions = Options{ //nolint:gochecknoglobals arithmeticassignment.New(), arithmeticassignmentinvert.New(), bitwise.New(), - cancelnil.New(), comparison.New(), comparisoninvert.New(), comparisonreplace.New(), diff --git a/viruses/cancelnil/cancelnil_test.go b/viruses/cancelnil/cancelnil_test.go index d0f6972..92e2587 100644 --- a/viruses/cancelnil/cancelnil_test.go +++ b/viruses/cancelnil/cancelnil_test.go @@ -8,6 +8,7 @@ import ( ) func TestCancelNil(t *testing.T) { + t.Skip("temporarily: https://github.com/gtramontina/ooze/pull/10") oozetesting.Run(t, oozetesting.NewScenarios( "Call cancel(nil)", cancelnil.New(),