-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some fixes in example after golang liters
- Loading branch information
Showing
2 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,52 @@ | ||
// Package someexample -. | ||
package someexample | ||
|
||
// Person -. | ||
type Person struct { | ||
Name string | ||
Age int | ||
Age int | ||
} | ||
|
||
// GetName blah | ||
// GetName blah. | ||
func (p Person) GetName() string { | ||
return p.Name | ||
} | ||
|
||
// Avatar struct -. | ||
type Avatar struct { | ||
URL string | ||
URL string | ||
Size int64 | ||
} | ||
|
||
// Client -. | ||
type Client struct { | ||
ID int64 | ||
Img Avatar | ||
ID int64 | ||
Img Avatar | ||
Name string | ||
Age int64 | ||
Age int64 | ||
} | ||
|
||
// HasAvatar === | ||
func (c Client) HasAvatar() bool { | ||
if c.Img.URL != "" { | ||
return true | ||
} | ||
return false | ||
// HasAvatar -. | ||
func (c *Client) HasAvatar() bool { | ||
return c.Img.URL != "" | ||
} | ||
|
||
// UpdateAvatar ... | ||
// UpdateAvatar -. | ||
func (c *Client) UpdateAvatar() { | ||
c.Img.URL = "new_url" | ||
} | ||
|
||
// GetName -. | ||
func (c Client) GetName() string { | ||
func (c *Client) GetName() string { | ||
return c.Name | ||
} | ||
|
||
//NewClient -. | ||
// NewClient -. | ||
func NewClient(name string, age int, img Avatar) *Client { | ||
return &Client{ | ||
ID: 7, | ||
ID: 7, | ||
Name: name, | ||
Age: int64(age), | ||
Img: img, | ||
Age: int64(age), | ||
Img: img, | ||
} | ||
} |