diff --git a/.tool-version b/.tool-version new file mode 100644 index 00000000..0ae8f296 --- /dev/null +++ b/.tool-version @@ -0,0 +1 @@ +golang 1.24.0 diff --git a/assertion/function/analyzer.go b/assertion/function/analyzer.go index 1aed22af..f3919ac4 100644 --- a/assertion/function/analyzer.go +++ b/assertion/function/analyzer.go @@ -23,7 +23,6 @@ import ( "go/types" "reflect" "runtime/debug" - "strings" "sync" "go.uber.org/nilaway/annotation" @@ -89,15 +88,11 @@ func run(p *analysis.Pass) ([]annotation.FullTrigger, error) { return nil, nil } - // Construct experimental features. By default, enable all features on NilAway itself. - functionConfig := assertiontree.FunctionConfig{} - if strings.HasPrefix(pass.Pkg.Path(), config.NilAwayPkgPathPrefix) { //nolint:revive - // TODO: enable struct initialization flag (tracked in Issue #23). - // TODO: enable anonymous function flag. - } else { - functionConfig.EnableStructInitCheck = conf.ExperimentalStructInitEnable - functionConfig.EnableAnonymousFunc = conf.ExperimentalAnonymousFuncEnable - } + // Respect driver flags for experimental features for all packages. + functionConfig := assertiontree.FunctionConfig{ + EnableStructInitCheck: conf.ExperimentalStructInitEnable, + EnableAnonymousFunc: conf.ExperimentalAnonymousFuncEnable, + } ctrlflowResult := pass.ResultOf[ctrlflow.Analyzer].(*ctrlflow.CFGs) anonymousFuncResult := pass.ResultOf[anonymousfunc.Analyzer].(*analysishelper.Result[map[*ast.FuncLit]*anonymousfunc.FuncLitInfo]) diff --git a/assertion/function/assertiontree/structinit_util.go b/assertion/function/assertiontree/structinit_util.go index 5304a0cd..3f211e4b 100644 --- a/assertion/function/assertiontree/structinit_util.go +++ b/assertion/function/assertiontree/structinit_util.go @@ -136,7 +136,7 @@ func (r *RootAssertionNode) getFieldProducersForFuncReturns(calledFuncDecl *type if util.TypeBarsNilness(fieldDecl.Type()) { // We do not create field triggers for types that are not nilable - return nil + continue } retKey := annotation.NewRetFldAnnKey(calledFuncDecl, retNum, fieldDecl) diff --git a/go.mod b/go.mod index bfaaafae..fce2a5ec 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module go.uber.org/nilaway -go 1.23.0 - -toolchain go1.23.4 +go 1.24.0 require ( github.com/golangci/plugin-module-register v0.1.1