Last active
September 11, 2017 02:27
-
-
Save kanapuli/b1407bb562287ac4ef900e565da62a36 to your computer and use it in GitHub Desktop.
main.go for type aliases example
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
package circle |
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
package main | |
import ( | |
"fmt" | |
"github.com/err/square" | |
"github.com/err/utility" | |
) | |
func main() { | |
s := square.Shape{ | |
Name: "square", | |
Height: 5, | |
} | |
fmt.Printf("%v\n", s) | |
fmt.Println(utility.IsFiveFeet(s)) | |
} |
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
package square | |
import "fmt" | |
//Shape is shape | |
type Shape struct { | |
Name string | |
Height int | |
} | |
func (s Shape) String() string { | |
return fmt.Sprintf("Square has the height %d ", s.Height) | |
} |
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
package utility | |
import ( | |
"github.com/err/square" | |
) | |
func IsFiveFeet(s square.Shape) bool { | |
return s.Height == 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment