Commits

Miki Tebeka  committed 2c1c303

gofmt

  • Participants
  • Parent commits 6084e43

Comments (0)

Files changed (2)

 package main
 
 import (
-    "flag"
-    "fmt"
-    "net"
-    "netchan"
-    "os"
-    "time"
+	"flag"
+	"fmt"
+	"net"
+	"netchan"
+	"os"
+	"time"
 )
 
 
 func server() {
-    out := make(chan int64)
+	out := make(chan int64)
 
-    exporter := netchan.NewExporter()
-    exporter.Export("seconds", out, netchan.Send)
-    exporter.ListenAndServe("tcp", ":5959")
+	exporter := netchan.NewExporter()
+	exporter.Export("seconds", out, netchan.Send)
+	exporter.ListenAndServe("tcp", ":5959")
 
-    for {
-        out <- time.Seconds()
-        time.Sleep(1e9)
-    }
+	for {
+		out <- time.Seconds()
+		time.Sleep(1e9)
+	}
 
 }
 
 func client() {
-    conn, err := net.Dial("tcp", "localhost:5959")
-    if err != nil {
-        panic(fmt.Sprintf("can't connect"))
-    }
+	conn, err := net.Dial("tcp", "localhost:5959")
+	if err != nil {
+		panic(fmt.Sprintf("can't connect"))
+	}
 
-    importer := netchan.NewImporter(conn)
-    in := make(chan int64)
-    if err := importer.Import("seconds", in, netchan.Recv, -1); err != nil {
-        panic("can't import")
-    }
+	importer := netchan.NewImporter(conn)
+	in := make(chan int64)
+	if err := importer.Import("seconds", in, netchan.Recv, -1); err != nil {
+		panic("can't import")
+	}
 
-    for {
-        value := <- in
-        fmt.Println(value)
-    }
+	for {
+		value := <-in
+		fmt.Println(value)
+	}
 }
 
 func main() {
-    defer func() {
-        if err := recover(); err != nil {
-            fmt.Fprintf(os.Stderr, "error: %s\n", err)
-            os.Exit(1)
-        }
-    }()
+	defer func() {
+		if err := recover(); err != nil {
+			fmt.Fprintf(os.Stderr, "error: %s\n", err)
+			os.Exit(1)
+		}
+	}()
 
-    flag.Parse()
-    switch flag.Arg(0) {
-    case "server":
-        server()
-    case "client":
-        client()
-    default:
-        panic(fmt.Sprintf("unknown command %s", flag.Arg(0)))
-    }
+	flag.Parse()
+	switch flag.Arg(0) {
+	case "server":
+		server()
+	case "client":
+		client()
+	default:
+		panic(fmt.Sprintf("unknown command %s", flag.Arg(0)))
+	}
 }
 package main
 
 import (
-    "bytes"
+	"bytes"
 	"container/vector"
 	"exec"
 	"fmt"
 }
 
 func main() {
-    cmd := exec.Command("/bin/ps", "-e", "-opid,ppid")
-    out, err := cmd.Output()
+	cmd := exec.Command("/bin/ps", "-e", "-opid,ppid")
+	out, err := cmd.Output()
 	if err != nil {
 		log.Fatalf("error: can't run ps - %v\n", err)
 	}