-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
base: master
Are you sure you want to change the base?
Conversation
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>
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
Let's it at least prove it does the same thing at least once.
…On Fri, Feb 9, 2024, 11:13 Joe Groocock ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pgraph/pgraph_test.go
<#738 (comment)>:
> @@ -323,34 +323,6 @@ func TestDeleteVertex2(t *testing.T) {
}
}
-func TestVertexContains1(t *testing.T) {
- v1 := NV("v1")
- v2 := NV("v2")
- v3 := NV("v3")
- if VertexContains(v1, []Vertex{v1, v2, v3}) != true {
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
—
Reply to this email directly, view it on GitHub
<#738 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABA7MYUN65TYJJF6VZM67TYSXZEDAVCNFSM6AAAAABDBER2Z2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNZSGA2TAMBUGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This package is a drop-in replacement for a lot of the custom (duplicated) functions that perform basic slice operations via iteration.