Browse Source

Update: gofmt all Go code

Dobrosław Żybort 12 years ago
parent
commit
9d5646277d
2 changed files with 18 additions and 18 deletions
  1. 3 3
      go/src/hello/hello.go
  2. 15 15
      webgo/src/hello/hello.go

+ 3 - 3
go/src/hello/hello.go

@@ -31,7 +31,7 @@ type Fortune struct {
 const (
 	ConnectionString   = "benchmarkdbuser:benchmarkdbpass@tcp(localhost:3306)/hello_world?charset=utf8"
 	WorldSelect        = "SELECT id, randomNumber FROM World where id = ?"
-	WorldUpdate				 = "UPDATE World SET randomNumber = ? where id = ?"
+	WorldUpdate        = "UPDATE World SET randomNumber = ? where id = ?"
 	FortuneSelect      = "SELECT id, message FROM Fortune;"
 	WorldRowCount      = 10000
 	MaxConnectionCount = 100
@@ -40,9 +40,9 @@ const (
 var (
 	tmpl = template.Must(template.ParseFiles("templates/layout.html", "templates/fortune.html"))
 
-	worldStatement    *sql.Stmt
+	worldStatement   *sql.Stmt
 	fortuneStatement *sql.Stmt
-	updateStatement		*sql.Stmt
+	updateStatement  *sql.Stmt
 )
 
 func main() {

+ 15 - 15
webgo/src/hello/hello.go

@@ -1,28 +1,28 @@
 package main
 
 import (
-    "github.com/hoisie/web";
-    "encoding/json";
-    "runtime";
-    "os";
-    "log";
+	"encoding/json"
+	"github.com/hoisie/web"
+	"log"
+	"os"
+	"runtime"
 )
 
 type MessageStruct struct {
-    Message string
+	Message string
 }
 
 func hello(val string) string {
-  m := MessageStruct{"Hello, world"}
-  j, _ := json.Marshal(m)
-  return string(j)
+	m := MessageStruct{"Hello, world"}
+	j, _ := json.Marshal(m)
+	return string(j)
 }
 
 func main() {
-    f, _ := os.Create("server.log")
-    logger := log.New(f, "", log.Ldate|log.Ltime)
-    runtime.GOMAXPROCS(runtime.NumCPU())
-    web.Get("/(.*)", hello)
-    web.SetLogger(logger)
-    web.Run("0.0.0.0:8080")
+	f, _ := os.Create("server.log")
+	logger := log.New(f, "", log.Ldate|log.Ltime)
+	runtime.GOMAXPROCS(runtime.NumCPU())
+	web.Get("/(.*)", hello)
+	web.SetLogger(logger)
+	web.Run("0.0.0.0:8080")
 }