Commit b3834d82 authored by obscuren's avatar obscuren

Removed extra slash so @nicksavers gets off my back ;-)

parent a26c4791
...@@ -11,7 +11,6 @@ type ClientIdentity interface { ...@@ -11,7 +11,6 @@ type ClientIdentity interface {
} }
type SimpleClientIdentity struct { type SimpleClientIdentity struct {
clientString string
clientIdentifier string clientIdentifier string
version string version string
customIdentifier string customIdentifier string
...@@ -27,26 +26,29 @@ func NewSimpleClientIdentity(clientIdentifier string, version string, customIden ...@@ -27,26 +26,29 @@ func NewSimpleClientIdentity(clientIdentifier string, version string, customIden
os: runtime.GOOS, os: runtime.GOOS,
implementation: "Go", implementation: "Go",
} }
clientIdentity.init()
return clientIdentity return clientIdentity
} }
func (c *SimpleClientIdentity) init() { func (c *SimpleClientIdentity) init() {
c.clientString = fmt.Sprintf("%s/v%s/%s/%s/%s", }
func (c *SimpleClientIdentity) String() string {
var id string
if len(c.customIdentifier) > 0 {
id = "/" + c.customIdentifier
}
return fmt.Sprintf("%s/v%s%s/%s/%s",
c.clientIdentifier, c.clientIdentifier,
c.version, c.version,
c.customIdentifier, id,
c.os, c.os,
c.implementation) c.implementation)
} }
func (c *SimpleClientIdentity) String() string {
return c.clientString
}
func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) { func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) {
c.customIdentifier = customIdentifier c.customIdentifier = customIdentifier
c.init()
} }
func (c *SimpleClientIdentity) GetCustomIdentifier() string { func (c *SimpleClientIdentity) GetCustomIdentifier() string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment