Skip to content

Instantly share code, notes, and snippets.

@sugilog
Created December 28, 2014 08:08
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 sugilog/8352e25b2b6be8b1ebbb to your computer and use it in GitHub Desktop.
Save sugilog/8352e25b2b6be8b1ebbb to your computer and use it in GitHub Desktop.
関数:引数と返り値
package main
import (
"fmt"
"time"
)
func main() {
logMessage( "STARTED" )
time.Sleep( 1000 * time.Millisecond )
logMessage( "SLEEPED" )
time.Sleep( 1000 * time.Millisecond )
logMessage( "FINISHED" )
}
func logMessage( message string ) {
fmt.Println( buildMessage( message ) )
}
func getTime() string {
return time.Now().String()
}
func getSeverity() string {
return "INFO"
}
func buildMessage( message string ) ( tm, svr, msg string ) {
tm = getTime()
svr = getSeverity()
msg = ": " + message
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment