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

Use Go 1.20 slices package #738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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!

@@ -387,11 +388,11 @@ func (g *Graph) Sprint() string {
str += fmt.Sprintf("Vertex: %s\n", v)
}
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