go fmt ./... the last PR

This commit is contained in:
Henry 2021-03-16 15:11:13 +01:00 committed by Henry
parent 04ba3b9477
commit d39d1ac6e9
13 changed files with 18 additions and 18 deletions

View File

@ -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() {

View File

@ -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.

View File

@ -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) {

View File

@ -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) {

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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

View File

@ -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)

View File

@ -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},

View File

@ -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)

View File

@ -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)

View File

@ -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{}
}

View File

@ -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 <input>
if e.Tag == "" {
e.Tag = "input"
}
// empty Tag defaults to <input>
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)