1
0
mirror of https://github.com/thebaer/tildes.git synced 2018-07-20 07:15:21 +00:00

Fix formatting

This commit is contained in:
Matt Baer 2015-02-23 19:06:28 -05:00
parent ff37899e2b
commit 98cfe89b05
3 changed files with 78 additions and 73 deletions

View File

@ -1,11 +1,11 @@
package store package store
import ( import (
"os"
"fmt"
"bufio" "bufio"
"strings" "fmt"
"io/ioutil" "io/ioutil"
"os"
"strings"
) )
type Row struct { type Row struct {
@ -45,6 +45,8 @@ func WriteData(path string, data []byte) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
// TODO: check for Close() errors
// https://github.com/ncw/swift/blob/master/swift.go#L170
defer f.Close() defer f.Close()
_, err = f.Write(data) _, err = f.Write(data)

View File

@ -1,17 +1,17 @@
package main package main
import ( import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"os" "os"
"os/exec" "os/exec"
"fmt"
"time"
"flag"
"sort" "sort"
"bufio"
"strconv" "strconv"
"strings" "strings"
"io/ioutil"
"text/template" "text/template"
"time"
"github.com/thebaer/tildes/store" "github.com/thebaer/tildes/store"
) )
@ -58,6 +58,7 @@ type table struct {
} }
type By func(r1, r2 *store.Row) bool type By func(r1, r2 *store.Row) bool
func (by By) Sort(rows []store.Row) { func (by By) Sort(rows []store.Row) {
rs := &rowSorter{ rs := &rowSorter{
rows: rows, rows: rows,
@ -65,10 +66,12 @@ func (by By) Sort(rows []store.Row) {
} }
sort.Sort(rs) sort.Sort(rs)
} }
type rowSorter struct { type rowSorter struct {
rows []store.Row rows []store.Row
by func(r1, r2 *store.Row) bool by func(r1, r2 *store.Row) bool
} }
func (r *rowSorter) Len() int { func (r *rowSorter) Len() int {
return len(r.rows) return len(r.rows)
} }

View File

@ -1,21 +1,21 @@
package main package main
import ( import (
"encoding/json"
"strings"
"bufio" "bufio"
"os"
"io/ioutil"
"os/exec"
"fmt"
"regexp"
"net/http"
"flag"
"time"
"text/template"
"crypto/hmac" "crypto/hmac"
"crypto/sha256" "crypto/sha256"
"encoding/base64" "encoding/base64"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"regexp"
"strings"
"text/template"
"time"
"github.com/thebaer/geo" "github.com/thebaer/geo"
"github.com/thebaer/tildes/store" "github.com/thebaer/tildes/store"