Skip to content

CI: upgrade mo dep golang version fix sca error - #18273

Merged
mergify[bot] merged 16 commits into
matrixorigin:mainfrom
guguducken:upgrade-go-version
Aug 24, 2024
Merged

mergify[bot] merged 16 commits into
matrixorigin:mainfrom
guguducken:upgrade-go-version

Conversation

@guguducken

@guguducken guguducken commented Aug 21, 2024 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue # https://github.com/matrixorigin/MO-Cloud/issues/3922

What this PR does / why we need it:

  1. 将go版本从1.22.3升级到1.23.0
  2. 升级golangci-lint版本以支持go 1.23.0,并更新其配置文件
  3. 修复sca中printf相关问题。
    3.1. 修复某些错误的调用,例如:logutil.Infof --> logutil.Info
    3.2. 防止在生成error是错误的将message作为fmt.Sprintf函数的format,从而导致生成不可预期的字符串,具体如下
    • 将moerr包中NewXxxx(ctx context.Context, msg string, args ...any)的相关函数修改为NewXxxxf(ctx context.Context, msg string, args ...any)以及NewXxxx(ctx context.Context, msg string)
    • 将moerr包中NewXxxxNoCtx(msg string, args ...any)的相关函数修改为NewXxxxNoCtxf(msg string, args ...any)以及NewXxxxNoCtx(msg string)
  4. go在1.22之后修复了forrange中loopvar的问题,现已不需要在循环中覆盖,故删除相关的代码8bc380f
  5. 删除了某些重复的判断8bc380f
  6. 修复了nilness相关的问题,具体可参考ref
  7. 修复了部分shadow的问题,但是有一些无法确定,故没有修改,且在sca中暂时disable
  8. 修复了一些因为错误使用fmt.Sprintf导致的错误的bvt result a8ad671 76c748b
  9. 目前govet中disable的检查项有fieldalignment,shadow,unusedwrite

Ref:

  1. https://go.dev/blog/loopvar-preview
  2. https://staticcheck.dev/docs/checks#S1009
  3. https://staticcheck.dev/docs/checks#S1008
  4. https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/nilness

@guguducken
guguducken marked this pull request as draft August 21, 2024 15:00
@mergify mergify Bot added the kind/test-ci label Aug 21, 2024
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Aug 21, 2024
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Aug 22, 2024
@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Aug 23, 2024
@guguducken

Copy link
Copy Markdown
Contributor Author

SCA CI失败应该是因为环境中的go版本还没有升级到1.23.0,还维持在1.22.3版本。从而导致molint对其也进行了检查。这个在本地测试通过
image

等PR matrixorigin/CI#102 合并之后,环境中Go版本就会升级到1.23.0,预期此问题就会解决

@guguducken guguducken changed the title CI: upgrade mo dep golang version CI: upgrade mo dep golang version fix printf error Aug 23, 2024
@guguducken guguducken changed the title CI: upgrade mo dep golang version fix printf error CI: upgrade mo dep golang version fix sca error Aug 23, 2024
@guguducken
guguducken marked this pull request as ready for review August 23, 2024 09:43
@guguducken

Copy link
Copy Markdown
Contributor Author

@mergify
mergify Bot merged commit 5b70d65 into matrixorigin:main Aug 24, 2024
@guguducken
guguducken deleted the upgrade-go-version branch August 26, 2024 06:06
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
1. 将go版本从1.22.3升级到1.23.0
2. 升级golangci-lint版本以支持go 1.23.0,并更新其配置文件
3. 修复sca中printf相关问题。
3.1. 修复某些错误的调用,例如:`logutil.Infof` --> `logutil.Info`
3.2. 防止在生成error是错误的将message作为`fmt.Sprintf`函数的format,从而导致生成不可预期的字符串,具体如下
-  将moerr包中`NewXxxx(ctx context.Context, msg string, args ...any)`的相关函数修改为`NewXxxxf(ctx context.Context, msg string, args ...any)`以及`NewXxxx(ctx context.Context, msg string)`
-   将moerr包中`NewXxxxNoCtx(msg string, args ...any)`的相关函数修改为`NewXxxxNoCtxf(msg string, args ...any)`以及`NewXxxxNoCtx(msg string)`
5. go在1.22之后修复了forrange中loopvar的问题,现已不需要在循环中覆盖,故删除相关的代码matrixorigin@8bc380f
6. 删除了某些重复的判断matrixorigin@8bc380f
7. 修复了nilness相关的问题,具体可参考ref
8. 修复了部分shadow的问题,但是有一些无法确定,故没有修改,且在sca中暂时disable
9. 修复了一些因为错误使用`fmt.Sprintf`导致的错误的bvt result matrixorigin@a8ad671 matrixorigin@76c748b
10. 目前govet中disable的检查项有`fieldalignment`,`shadow`,`unusedwrite`

Ref:
1. https://go.dev/blog/loopvar-preview
2. https://staticcheck.dev/docs/checks#S1009
3. https://staticcheck.dev/docs/checks#S1008
5. https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/nilness

Approved by: @daviszhen, @reusee, @zhangxu19830126, @badboynt1, @triump2020, @xzxiong, @m-schen, @jiangxinmeng1, @aptend, @qingxinhome, @fengttt, @aressu1985, @XuPeng-SH, @w-zr, @ouyuanning, @volgariver6, @LeftHandCold, @sukki37, @iamlinjunhong, @aunjgr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.