goimports automating imports for me now
This commit is contained in:
parent
68d0851552
commit
6df7c52e9e
4 changed files with 6 additions and 11 deletions
|
|
@ -2,14 +2,11 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
|
|
|
||||||
5
fakes.go
5
fakes.go
|
|
@ -5,8 +5,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type fakeST struct {
|
type fakeST struct {
|
||||||
dept string
|
dept string
|
||||||
err error
|
err error
|
||||||
chapterID int64
|
chapterID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16,4 +16,3 @@ func (f *fakeST) GetUser(ctx context.Context, id int64) (*User, error) {
|
||||||
}
|
}
|
||||||
return &User{ID: id, ChapterID: f.chapterID, Department: f.dept}, nil
|
return &User{ID: id, ChapterID: f.chapterID, Department: f.dept}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// User is the subset of an ST user record this worker cares about.
|
// User is the subset of an ST user record this worker cares about.
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int64
|
ID int64
|
||||||
Email string
|
Email string
|
||||||
ChapterID int64
|
ChapterID int64
|
||||||
Department string
|
Department string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
store.go
7
store.go
|
|
@ -4,8 +4,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"modernc.org/sqlite"
|
sqlite3 "modernc.org/sqlite/lib"
|
||||||
sqlite3 "modernc.org/sqlite/lib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const schema = `
|
const schema = `
|
||||||
|
|
@ -45,8 +44,8 @@ func (s *SQLStore) AcquireLock(chapterID int64, dept string, repID int64) (int64
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var serr *sqLite.Error
|
var serr *sqLite.Error
|
||||||
if errors.As(err, &serr) && serr.Code() == sqlite3.SQLITE_CONSTRAINT_UNIQUE {
|
if errors.As(err, &serr) && serr.Code() == sqlite3.SQLITE_CONSTRAINT_UNIQUE {
|
||||||
return 0, ErrLocked
|
return 0, ErrLocked
|
||||||
}
|
}
|
||||||
return 0, ErrLocked
|
return 0, ErrLocked
|
||||||
}
|
}
|
||||||
return res.LastInsertId()
|
return res.LastInsertId()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue