Skip to content

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

Rather than relying on the hashing package constants - it's more user friendly to expose the constants from the ids package.

How this works

Move constants.

How this was tested

N/A

@StephenButtolph StephenButtolph added the cleanup Code quality improvement label Jul 25, 2023
@StephenButtolph StephenButtolph added this to the v1.10.6 milestone Jul 25, 2023
const nullStr = "null"
const (
IDLen = 32
nullStr = "null"
Copy link
Contributor

Choose a reason for hiding this comment

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

what is nullStr for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

json decoding.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also had this question... Go uses this as a sentinel value:

// Unmarshaler is the interface implemented by types
// that can unmarshal a JSON description of themselves.
// The input can be assumed to be a valid encoding of
// a JSON value. UnmarshalJSON must copy the JSON data
// if it wishes to retain the data after returning.
//
// By convention, to approximate the behavior of Unmarshal itself,
// Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op.
type Unmarshaler interface {
	UnmarshalJSON([]byte) error
}

const NodeIDPrefix = "NodeID-"
const (
NodeIDPrefix = "NodeID-"
NodeIDLen = ShortIDLen
Copy link
Contributor

Choose a reason for hiding this comment

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

what is NodeIDPrefix for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

String()

@StephenButtolph StephenButtolph merged commit 8694274 into dev Jul 25, 2023
@StephenButtolph StephenButtolph deleted the add-id-len-consts branch July 25, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants