github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section2/greetingspackage/greetings.go (about)

     1  // Package greetingspackage is a demonstration package to show how to declare a package,
     2  // create exported/unexported functions in the package, and create an exported variable
     3  // from the package.
     4  package greetingspackage
     5  
     6  import "fmt"
     7  
     8  // We indicate to Go that we want to export a function by upper casing the function's
     9  // first letter.
    10  func PrintGreetings() {
    11  
    12  	fmt.Println("I'm printing a message from the PrintGreetings() function!")
    13  }
    14  
    15  // This function is unexported (since it has a lowercase first letter in the function name)
    16  // Since it's unexported it will only be visible to functions that are within the greetingspackage
    17  func printGreetingsUnexported() {
    18  
    19  	fmt.Println("I'm printing a message from the printGreetingsUnexported() function!")
    20  
    21  }