Created
August 4, 2015 20:49
-
-
Save iamralch/4b95e8d1631fd0a93dfe to your computer and use it in GitHub Desktop.
Sample application used to demonstrates LLDB and DELVE debuggers
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
// main.go | |
package main | |
import "fmt" | |
type User struct { | |
FirstName string | |
LastName string | |
} | |
func (user User) String() string { | |
return fmt.Sprintf("%s %s", user.FirstName, user.LastName) | |
} | |
func main() { | |
user := User{ | |
FirstName: "John", | |
LastName: "Smith", | |
} | |
message := FormatMessage(user, "Golang Weekly Newsletter #756") | |
for index := 0; index < 3; index++ { | |
fmt.Printf("Sending #%d message with %s\n", index, message) | |
} | |
} | |
func FormatMessage(user User, message string) string { | |
return fmt.Sprintf("body: %s by %s", message, user.String()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment