-
Couldn't load subscription status.
- Fork 79
fix: early nil return #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // 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, | ||
| } |
There was a problem hiding this comment.
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!
| @@ -0,0 +1 @@ | |||
| golang 1.24.0 | |||
There was a problem hiding this comment.
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.
| go 1.23.0 | ||
|
|
||
| toolchain go1.23.4 | ||
| go 1.24.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
@BhautikChudasama Thanks for the contributions! I have left some comments here :) Also, please run |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #360 +/- ##
==========================================
+ Coverage 87.59% 87.63% +0.04%
==========================================
Files 73 73
Lines 10848 10844 -4
==========================================
+ Hits 9502 9503 +1
+ Misses 1156 1153 -3
+ Partials 190 188 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey @yuxincs sorry for late reply, I will update my PR. Thanks :) |
|
hey @yuxincs i was experimenting with some files but it is still flaky. I tried to put my head but i couldn’t really get into. If you can help here. here is the example // a.go
package a
import (
"fmt"
"go.uber.org/nilaway/database"
"go.uber.org/nilaway/models"
)
func main() {
db, err := database.GetPostgresqlConnection("your_connection_string_here")
if err != nil {
fmt.Println("Error connecting to database:", err)
return
}
deploymentItem, err := models.GetDeploymentItem(db, "aa")
fmt.Println(deploymentItem.Id)
fmt.Println(*deploymentItem.Col1)
fmt.Println(string(*deploymentItem.Col2))
fmt.Println(string(*deploymentItem.Col3))
fmt.Println(string(*deploymentItem.Col4))
fmt.Println(deploymentItem.Col5)
fmt.Println(*deploymentItem.Col6)
fmt.Println(string(*deploymentItem.Col7))
}When i am trying to run this Expected it should return Col2 as well. |
Issue
getFieldProducersForFuncReturnsfn would exit too early if it encountered even a single non-nilable field.1.24.0.if strings.HasPrefix(pass.Pkg.Path(), config.NilAwayPkgPathPrefix) {I tried with below code
It works well.
Issue: #359