Skip to content

Commit

Permalink
Don't export string constants (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-simons authored and nmiyake committed Dec 19, 2018
1 parent 31253b8 commit f026ea9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rid/resource_identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type ResourceIdentifier struct {
}

const (
RidClass = "ri"
Separator = "."
ridClass = "ri"
separator = "."
)

func MustNew(service, instance, resourceType, locator string) ResourceIdentifier {
Expand All @@ -58,7 +58,7 @@ func New(service, instance, resourceType, locator string) (ResourceIdentifier, e
}

func (rid ResourceIdentifier) String() string {
return RidClass + Separator + rid.Service + Separator + rid.Instance + Separator + rid.Type + Separator + rid.Locator
return ridClass + separator + rid.Service + separator + rid.Instance + separator + rid.Type + separator + rid.Locator
}

// MarshalText implements encoding.TextMarshaler (used by encoding/json and others).
Expand All @@ -79,8 +79,8 @@ func (rid *ResourceIdentifier) UnmarshalText(text []byte) error {

// ParseRID parses a string into a 4-part resource identifier.
func ParseRID(s string) (ResourceIdentifier, error) {
segments := strings.SplitN(s, Separator, 5)
if len(segments) != 5 || segments[0] != RidClass {
segments := strings.SplitN(s, separator, 5)
if len(segments) != 5 || segments[0] != ridClass {
return ResourceIdentifier{}, errors.New("invalid resource identifier")
}
rid := ResourceIdentifier{
Expand Down

0 comments on commit f026ea9

Please sign in to comment.