Skip to content
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

tools: Don't use strings.Title in chopper #5239

Merged

Conversation

Eric-Warehime
Copy link
Contributor

Summary

I'm running go1.18 locally and the lint check fails because strings.Title is deprecated in go1.18.

tools/debug/chopper/main.go:134:46: SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
	fmt.Printf("%s in first: %d, second: %d\n", strings.Title(rd.what), rd.size1, rd.size2)

Replaced it with cases.Title for English which looks to have the same behavior.

Test Plan

Ran a basic test and it looks correct from what I can tell.

go run ./tools/debug/chopper/main.go ./log_copy.log ~/.algorand/node.
log 
Roots in first: 45, second: 45
Matched roots: 45
Mismatched roots: 0
Other roots in first: 0, second: 0

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #5239 (cd98d3c) into master (7738691) will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5239      +/-   ##
==========================================
- Coverage   53.57%   53.52%   -0.05%     
==========================================
  Files         441      441              
  Lines       55137    55137              
==========================================
- Hits        29538    29511      -27     
- Misses      23311    23335      +24     
- Partials     2288     2291       +3     

see 12 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@bbroder-algo bbroder-algo left a comment

Choose a reason for hiding this comment

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

Title(language.English).Strings("approved")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants