Permalink
Browse files

gofmt

  • Loading branch information...
1 parent 9dd136a commit 8f04589ca96b0d07e3ed90d532710d63e30557fe @cyberdelia cyberdelia committed Mar 2, 2014
Showing with 32 additions and 33 deletions.
  1. +1 −1 conn_test.go
  2. +2 −2 copy_test.go
  3. +6 −7 encode_test.go
  4. +15 −15 hstore/hstore_test.go
  5. +8 −8 listen_example/doc.go
View
@@ -1045,7 +1045,7 @@ func TestIsUTF8(t *testing.T) {
func TestQuoteIdentifier(t *testing.T) {
var cases = []struct {
input string
- want string
+ want string
}{
{`foo`, `"foo"`},
{`foo bar baz`, `"foo bar baz"`},
View
@@ -38,7 +38,7 @@ func TestCopyInSchemaStmt(t *testing.T) {
}
stmt = CopyInSchema(`schema " name """`, `table " name """`, `co"lumn""`)
- if stmt != `COPY "schema "" name """"""".` +
+ if stmt != `COPY "schema "" name """"""".`+
`"table "" name """"""" ("co""lumn""""") FROM STDIN` {
t.Fatal(stmt)
}
@@ -196,7 +196,7 @@ func TestCopyOutsideOfTxnError(t *testing.T) {
if err == nil {
t.Fatal("COPY outside of transaction did not return an error")
}
- if err != errCopyNotSupportedOutsideTxn {
+ if err != errCopyNotSupportedOutsideTxn {
t.Fatalf("expected %s, got %s", err, err.Error())
}
}
View
@@ -235,12 +235,11 @@ func TestTextToBytea(t *testing.T) {
t.Fatal(err)
}
- if !bytes.Equal(result, []byte(b)){
+ if !bytes.Equal(result, []byte(b)) {
t.Fatalf("expected %v but got %v", b, result)
}
}
-
func TestByteaOutputFormatEncoding(t *testing.T) {
input := []byte("\\x\x00\x01\x02\xFF\xFEabcdefg0123")
want := []byte("\\x5c78000102fffe6162636465666730313233")
@@ -313,15 +312,15 @@ func TestByteaOutputFormats(t *testing.T) {
func TestAppendEncodedText(t *testing.T) {
var buf []byte
- buf = appendEncodedText(&parameterStatus{serverVersion:90000}, buf, int64(10))
+ buf = appendEncodedText(&parameterStatus{serverVersion: 90000}, buf, int64(10))
buf = append(buf, '\t')
- buf = appendEncodedText(&parameterStatus{serverVersion:90000}, buf, float32(42.0000000001))
+ buf = appendEncodedText(&parameterStatus{serverVersion: 90000}, buf, float32(42.0000000001))
buf = append(buf, '\t')
- buf = appendEncodedText(&parameterStatus{serverVersion:90000}, buf, 42.0000000001)
+ buf = appendEncodedText(&parameterStatus{serverVersion: 90000}, buf, 42.0000000001)
buf = append(buf, '\t')
- buf = appendEncodedText(&parameterStatus{serverVersion:90000}, buf, "hello\tworld")
+ buf = appendEncodedText(&parameterStatus{serverVersion: 90000}, buf, "hello\tworld")
buf = append(buf, '\t')
- buf = appendEncodedText(&parameterStatus{serverVersion:90000}, buf, []byte{0, 128, 255})
+ buf = appendEncodedText(&parameterStatus{serverVersion: 90000}, buf, []byte{0, 128, 255})
if string(buf) != "10\t42\t42.0000000001\thello\\tworld\t\\\\x0080ff" {
t.Fatal(string(buf))
View
@@ -87,31 +87,31 @@ func TestHstore(t *testing.T) {
// a few example maps to test out
hsOnePair := Hstore{
Map: map[string]sql.NullString{
- "key1": sql.NullString{"value1", true},
+ "key1": {"value1", true},
},
}
hsThreePairs := Hstore{
Map: map[string]sql.NullString{
- "key1": sql.NullString{"value1", true},
- "key2": sql.NullString{"value2", true},
- "key3": sql.NullString{"value3", true},
+ "key1": {"value1", true},
+ "key2": {"value2", true},
+ "key3": {"value3", true},
},
}
hsSmorgasbord := Hstore{
Map: map[string]sql.NullString{
- "nullstring": sql.NullString{"NULL", true},
- "actuallynull": sql.NullString{"", false},
- "NULL": sql.NullString{"NULL string key", true},
- "withbracket": sql.NullString{"value>42", true},
- "withequal": sql.NullString{"value=42", true},
- `"withquotes1"`: sql.NullString{`this "should" be fine`, true},
- `"withquotes"2"`: sql.NullString{`this "should\" also be fine`, true},
- "embedded1": sql.NullString{"value1=>x1", true},
- "embedded2": sql.NullString{`"value2"=>x2`, true},
- "withnewlines": sql.NullString{"\n\nvalue\t=>2", true},
- "<<all sorts of crazy>>": sql.NullString{`this, "should,\" also, => be fine`, true},
+ "nullstring": {"NULL", true},
+ "actuallynull": {"", false},
+ "NULL": {"NULL string key", true},
+ "withbracket": {"value>42", true},
+ "withequal": {"value=42", true},
+ `"withquotes1"`: {`this "should" be fine`, true},
+ `"withquotes"2"`: {`this "should\" also be fine`, true},
+ "embedded1": {"value1=>x1", true},
+ "embedded2": {`"value2"=>x2`, true},
+ "withnewlines": {"\n\nvalue\t=>2", true},
+ "<<all sorts of crazy>>": {`this, "should,\" also, => be fine`, true},
},
}
View
@@ -16,10 +16,10 @@ mechanism to avoid polling the database while waiting for more work to arrive.
// ;
package main
-
+
import (
"github.com/lib/pq"
-
+
"database/sql"
"fmt"
"time"
@@ -28,7 +28,7 @@ mechanism to avoid polling the database while waiting for more work to arrive.
func doWork(db *sql.DB, work int64) {
// work here
}
-
+
func getWork(db *sql.DB) {
for {
// get work from the database here
@@ -44,12 +44,12 @@ mechanism to avoid polling the database while waiting for more work to arrive.
fmt.Println("ran out of work")
return
}
-
+
fmt.Println("starting work on ", work.Int64)
go doWork(db, work.Int64)
}
}
-
+
func waitForNotification(l *pq.Listener) {
for {
select {
@@ -68,15 +68,15 @@ mechanism to avoid polling the database while waiting for more work to arrive.
}
}
}
-
+
func main() {
var conninfo string = ""
-
+
db, err := sql.Open("postgres", conninfo)
if err != nil {
panic(err)
}
-
+
reportProblem := func(ev pq.ListenerEventType, err error) {
if err != nil {
fmt.Println(err.Error())

0 comments on commit 8f04589

Please sign in to comment.