Skip to content

Instantly share code, notes, and snippets.

@kanapuli
Last active September 11, 2017 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanapuli/b1407bb562287ac4ef900e565da62a36 to your computer and use it in GitHub Desktop.
Save kanapuli/b1407bb562287ac4ef900e565da62a36 to your computer and use it in GitHub Desktop.
main.go for type aliases example
package circle
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))
}
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)
}
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