Skip to content

Commit

Permalink
packp: Actions should have type Action
Browse files Browse the repository at this point in the history
Per the [Go Spec](https://go.dev/ref/spec#Constant_declarations),
the following yields the type `Action` for `Bar` and `Baz`
only if there is no `=`.

    const (
        Foo Action = ...
        Bar
        Baz
    )

The following has the type `Action` for the first item,
but not the rest. Those are untyped constants
of the corresponding type.

    const (
        Foo Action = ...
        Bar        = ...
        Baz        = ...
    )

This means that `packp.{Update, Delete, Invalid}` are currently
untyped string constants, and not `Action` constants
as was intended here.

This change fixes these.
  • Loading branch information
abhinav committed Nov 28, 2021
1 parent e4fcd07 commit fe308ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plumbing/protocol/packp/updreq.go
Expand Up @@ -87,9 +87,9 @@ type Action string

const (
Create Action = "create"
Update = "update"
Delete = "delete"
Invalid = "invalid"
Update Action = "update"
Delete Action = "delete"
Invalid Action = "invalid"
)

type Command struct {
Expand Down

0 comments on commit fe308ea

Please sign in to comment.