Go code
package greeting
func Hello() string {
return "Hello"
}Line-by-line explanation
- The file belongs to package greeting.
- Hello begins uppercase, so it is exported.
- The function returns text.
Expected output
(no output)A package definition does not print by itself.
Place this file in a greeting directory inside the module. All ordinary Go files in that directory use the same package name.