Skip to content

Use Go 1.20 slices package#738

Open
frebib wants to merge 1 commit intopurpleidea:masterfrom
frebib:frebib/slices
Open

Use Go 1.20 slices package#738
frebib wants to merge 1 commit intopurpleidea:masterfrom
frebib:frebib/slices

Conversation

@frebib
Copy link
Contributor

@frebib frebib commented Feb 9, 2024

This package is a drop-in replacement for a lot of the custom (duplicated) functions that perform basic slice operations via iteration.

This package is a drop-in replacement for a lot of the custom
(duplicated) functions that perform basic slice operations via
iteration.

Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
Copy link
Owner

@purpleidea purpleidea left a comment

Choose a reason for hiding this comment

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

Brilliant idea, I love it!

}
for _, v1 := range g.VerticesSorted() {
vs := []Vertex{}
var vs VertexSlice
Copy link
Owner

Choose a reason for hiding this comment

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

Please leave these alone for now. Explicitly seeing the list is more logical at least for me.

v1 := NV("v1")
v2 := NV("v2")
v3 := NV("v3")
if VertexContains(v1, []Vertex{v1, v2, v3}) != true {
Copy link
Owner

Choose a reason for hiding this comment

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

You can leave all the tests in, let's just test the new methods you're using!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there much point in testing stdlib functionality? The point of this change was to reduce the amount of code we're carrying. Less code -> easier to understand/reason about

@purpleidea
Copy link
Owner

purpleidea commented Feb 9, 2024 via email

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants