forked from ardanlabs/gotraining
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template1.go
32 lines (24 loc) · 1.03 KB
/
template1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// http://play.golang.org/p/p0vlsW5sVL
// Declare a struct type to maintain information about a user. Declare a function
// that creates value of and returns pointers of this type and an error value. Call
// this function from main and display the value.
//
// Make a second call to your function but this time ignore the value and just test
// the error value.
package main
// Add imports.
// Declare a type named user.
// Declare a function that creates user type values and returns a pointer
// to that value and an error value of nil.
func funcName() /* (pointer return arg, error return arg) */ {
// Create a value of type user and return the proper values.
}
// main is the entry point for the application.
func main() {
// Use the function to create a value of type user. Check
// the error being returned.
// Display the value that the pointer points to.
// Call the function again and just check the error.
}