Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.24.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these changes? Usually minimum Go version upgrades should be put in separate PRs where we also update CI configs, use new language features etc.

15 changes: 5 additions & 10 deletions assertion/function/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"go/types"
"reflect"
"runtime/debug"
"strings"
"sync"

"go.uber.org/nilaway/annotation"
Expand Down Expand Up @@ -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,
}
Comment on lines -92 to +95
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was there such that we can enable these experimental features on NilAway itself (to dogfood), but now that we have exposed these as proper flags we can do that at CLI level instead of hard coding it.

Thanks!


ctrlflowResult := pass.ResultOf[ctrlflow.Analyzer].(*ctrlflow.CFGs)
anonymousFuncResult := pass.ResultOf[anonymousfunc.Analyzer].(*analysishelper.Result[map[*ast.FuncLit]*anonymousfunc.FuncLitInfo])
Expand Down
2 changes: 1 addition & 1 deletion assertion/function/assertiontree/structinit_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module go.uber.org/nilaway

go 1.23.0

toolchain go1.23.4
go 1.24.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


require (
github.com/golangci/plugin-module-register v0.1.1
Expand Down
Loading