diff --git a/cmd/insert-user/main.go b/cmd/insert-user/main.go index 124abbf..73a06d1 100644 --- a/cmd/insert-user/main.go +++ b/cmd/insert-user/main.go @@ -12,8 +12,8 @@ import ( _ "github.com/mattn/go-sqlite3" "golang.org/x/crypto/ssh/terminal" - "github.com/ssb-ngi-pointer/go-ssb-room/roomdb/sqlite" "github.com/ssb-ngi-pointer/go-ssb-room/internal/repo" + "github.com/ssb-ngi-pointer/go-ssb-room/roomdb/sqlite" ) func main() { diff --git a/internal/network/new.go b/internal/network/new.go index 8b12003..3595d78 100644 --- a/internal/network/new.go +++ b/internal/network/new.go @@ -18,8 +18,8 @@ import ( "go.cryptoscope.co/netwrap" "go.cryptoscope.co/secretstream" - refs "go.mindeco.de/ssb-refs" "github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/keys" + refs "go.mindeco.de/ssb-refs" ) // DefaultPort is the default listening port for ScuttleButt. diff --git a/internal/netwraputil/spoof_test.go b/internal/netwraputil/spoof_test.go index 05dcfd0..cf19edf 100644 --- a/internal/netwraputil/spoof_test.go +++ b/internal/netwraputil/spoof_test.go @@ -6,9 +6,9 @@ import ( "net" "testing" - "github.com/stretchr/testify/require" "github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/keys" "github.com/ssb-ngi-pointer/go-ssb-room/internal/network" + "github.com/stretchr/testify/require" ) func TestSpoof(t *testing.T) { diff --git a/internal/repo/secret.go b/internal/repo/secret.go index 3a9a04d..6073b89 100644 --- a/internal/repo/secret.go +++ b/internal/repo/secret.go @@ -9,8 +9,8 @@ import ( "os" "path/filepath" - refs "go.mindeco.de/ssb-refs" "github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/keys" + refs "go.mindeco.de/ssb-refs" ) func DefaultKeyPair(r Interface) (*keys.KeyPair, error) { diff --git a/roomdb/sqlite/notices_test.go b/roomdb/sqlite/notices_test.go index 5cdc994..bb81df6 100644 --- a/roomdb/sqlite/notices_test.go +++ b/roomdb/sqlite/notices_test.go @@ -8,8 +8,8 @@ import ( "path/filepath" "testing" - "github.com/ssb-ngi-pointer/go-ssb-room/roomdb" "github.com/ssb-ngi-pointer/go-ssb-room/internal/repo" + "github.com/ssb-ngi-pointer/go-ssb-room/roomdb" "github.com/stretchr/testify/require" ) diff --git a/roomdb/sqlite/roomcfg_test.go b/roomdb/sqlite/roomcfg_test.go index f85f107..f848e92 100644 --- a/roomdb/sqlite/roomcfg_test.go +++ b/roomdb/sqlite/roomcfg_test.go @@ -9,8 +9,8 @@ import ( "github.com/ssb-ngi-pointer/go-ssb-room/roomdb" - "github.com/ssb-ngi-pointer/go-ssb-room/roomdb/sqlite/models" "github.com/ssb-ngi-pointer/go-ssb-room/internal/repo" + "github.com/ssb-ngi-pointer/go-ssb-room/roomdb/sqlite/models" "github.com/stretchr/testify/require" refs "go.mindeco.de/ssb-refs" ) diff --git a/roomsrv/options.go b/roomsrv/options.go index 063b56d..56830c7 100644 --- a/roomsrv/options.go +++ b/roomsrv/options.go @@ -9,10 +9,10 @@ import ( "strings" kitlog "github.com/go-kit/kit/log" - "go.cryptoscope.co/netwrap" "github.com/ssb-ngi-pointer/go-ssb-room/internal/maybemod/keys" "github.com/ssb-ngi-pointer/go-ssb-room/internal/network" "github.com/ssb-ngi-pointer/go-ssb-room/internal/repo" + "go.cryptoscope.co/netwrap" ) type Option func(srv *Server) error diff --git a/web/handlers/admin/notices.go b/web/handlers/admin/notices.go index 450b309..16a5d7f 100644 --- a/web/handlers/admin/notices.go +++ b/web/handlers/admin/notices.go @@ -45,7 +45,7 @@ func (h noticeHandler) addTranslation(rw http.ResponseWriter, req *http.Request) return } - // reply with 405 error: Method not allowed + // reply with 405 error: Method not allowed if req.Method != "POST" { err := weberrors.ErrBadRequest{Where: "http method type", Details: fmt.Errorf("add translation only accepts POST requests, sorry!")} h.r.Error(rw, req, http.StatusMethodNotAllowed, err) diff --git a/web/handlers/admin/notices_test.go b/web/handlers/admin/notices_test.go index 7fa3bda..c2f2583 100644 --- a/web/handlers/admin/notices_test.go +++ b/web/handlers/admin/notices_test.go @@ -114,7 +114,7 @@ func TestNoticeDraftLanguageIncludesAllFields(t *testing.T) { html, resp := ts.Client.GetHTML(u.String()) form := html.Find("form") a.Equal(http.StatusOK, resp.Code, "Wrong HTTP status code") - // FormElement defaults to input if tag omitted + // FormElement defaults to input if tag omitted webassert.ElementsInForm(t, form, []webassert.FormElement{ {Name: "title"}, {Name: "language"}, @@ -143,7 +143,7 @@ func TestNoticeEditFormIncludesAllFields(t *testing.T) { a.Equal(http.StatusOK, resp.Code, "Wrong HTTP status code") // check for all the form elements & verify their initial contents are set correctly - // FormElement defaults to input if tag omitted + // FormElement defaults to input if tag omitted webassert.ElementsInForm(t, form, []webassert.FormElement{ {Name: "title", Value: notice.Title}, {Name: "language", Value: notice.Language}, diff --git a/web/handlers/notices_test.go b/web/handlers/notices_test.go index 2cb3ffc..43892ef 100644 --- a/web/handlers/notices_test.go +++ b/web/handlers/notices_test.go @@ -82,7 +82,7 @@ func TestNoticesEditButtonVisible(t *testing.T) { // start preparing the ~login dance~ // TODO: make this code reusable and share it with the login => /dashboard http:200 test - // cookiejar: a very cheap client session + // cookiejar: a very cheap client session // TODO: refactor login dance for re-use in testing / across tests jar, err := cookiejar.New(nil) r.NoError(err) diff --git a/web/user/helper.go b/web/user/helper.go index b9e42f1..2e1cb25 100644 --- a/web/user/helper.go +++ b/web/user/helper.go @@ -13,7 +13,7 @@ type roomUserContextKeyType string var roomUserContextKey roomUserContextKeyType = "ssb:room:httpcontext:user" - // FromContext returns the user or nil if not logged in +// FromContext returns the user or nil if not logged in func FromContext(ctx context.Context) *roomdb.User { v := ctx.Value(roomUserContextKey) diff --git a/web/utils.go b/web/utils.go index b17efb0..78a9f08 100644 --- a/web/utils.go +++ b/web/utils.go @@ -40,8 +40,8 @@ func NewURLTo(appRouter *mux.Router) func(string, ...interface{}) *url.URL { return func(routeName string, ps ...interface{}) *url.URL { route := appRouter.Get(routeName) if route == nil { - // TODO: https://github.com/ssb-ngi-pointer/go-ssb-room/issues/35 for a - // for reference, see https://github.com/ssb-ngi-pointer/go-ssb-room/pull/64 + // TODO: https://github.com/ssb-ngi-pointer/go-ssb-room/issues/35 for a + // for reference, see https://github.com/ssb-ngi-pointer/go-ssb-room/pull/64 // level.Warn(l).Log("msg", "no such route", "route", routeName, "params", fmt.Sprintf("%v", ps)) return &url.URL{} } diff --git a/web/webassert/asserts.go b/web/webassert/asserts.go index c9e0b76..80026a7 100644 --- a/web/webassert/asserts.go +++ b/web/webassert/asserts.go @@ -40,10 +40,10 @@ type FormElement struct { func ElementsInForm(t *testing.T, form *goquery.Selection, elems []FormElement) { a := assert.New(t) for _, e := range elems { - // empty Tag defaults to - if e.Tag == "" { - e.Tag = "input" - } + // empty Tag defaults to + if e.Tag == "" { + e.Tag = "input" + } elementSelector := form.Find(fmt.Sprintf("%s[name=%s]", e.Tag, e.Name)) ok := a.Equal(1, elementSelector.Length(), "expected to find element with name %s", e.Name)