-
-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: improve go code formatting and add comments
- Loading branch information
1 parent
0f11140
commit e1662f7
Showing
10 changed files
with
43 additions
and
43 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
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
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 |
---|---|---|
|
@@ -2,27 +2,26 @@ package main | |
|
||
import "fmt" | ||
|
||
|
||
type UserData struct { // struct is a collection of fields. | ||
fistName string | ||
lastName string | ||
email string | ||
type UserData struct { // struct is a collection of fields. | ||
fistName string | ||
lastName string | ||
email string | ||
numberOfTickets int | ||
} | ||
|
||
func main() { | ||
user := UserData{ // struct initialization | ||
fistName: "John", | ||
lastName: "Doe", | ||
email: "[email protected]", | ||
fistName: "John", | ||
lastName: "Doe", | ||
email: "[email protected]", | ||
numberOfTickets: 2, | ||
} | ||
|
||
fmt.Println(user) | ||
|
||
user.greetUser() // Method call | ||
user.greetUser() // Method call | ||
} | ||
|
||
func (u UserData) greetUser() { // method with receiver | ||
fmt.Println("Hello", u.fistName, u.lastName) | ||
} | ||
} |
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
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