Skip to content

Conversation

@clonemycode
Copy link
Contributor

Summary

There is a new function added in the go1.21 standard library, which can make the code more concise and easy to read.

Test Plan

@CLAassistant
Copy link

CLAassistant commented Jun 3, 2025

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.46%. Comparing base (15a7913) to head (3d1ddd7).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
cmd/util/cmd.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6357      +/-   ##
==========================================
- Coverage   50.63%   50.46%   -0.17%     
==========================================
  Files         653      653              
  Lines      110343   110342       -1     
==========================================
- Hits        55872    55685     -187     
- Misses      51601    51796     +195     
+ Partials     2870     2861       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@algorandskiy algorandskiy requested a review from Copilot June 4, 2025 18:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors membership checks to use the new slices.Contains function from Go 1.21, making the code more concise and readable.

  • Replace manual for loops in phonebook_test.go with slices.Contains
  • Simplify the Set method in cmd/util/cmd.go by using slices.Contains
  • Add slices to the import blocks where needed

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
network/phonebook/phonebook_test.go Replaced nested loops with slices.Contains in tests
cmd/util/cmd.go Simplified allowed-value check in CobraStringValue.Set()
Comments suppressed due to low confidence (1)

go.mod:1

  • Since the code now imports the standard-library slices package (added in Go 1.21), please update the go directive in go.mod to 1.21 to ensure compatibility.
module github.com/algorand/go-algorand

@clonemycode
Copy link
Contributor Author

Thanks for the approved.

@jannotti jannotti merged commit 6147ebf into algorand:master Jun 10, 2025
49 of 50 checks passed
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.

4 participants