1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-02-13 16:31:59 +02:00

updated linter

This commit is contained in:
Gani Georgiev 2022-12-16 17:06:03 +02:00
parent 738f71f244
commit 687a79b450
7 changed files with 14 additions and 12 deletions

View File

@ -1,9 +1,10 @@
package apis_test package apis_test
import ( import (
"github.com/pocketbase/pocketbase/tests"
"net/http" "net/http"
"testing" "testing"
"github.com/pocketbase/pocketbase/tests"
) )
func TestHealthAPI(t *testing.T) { func TestHealthAPI(t *testing.T) {

View File

@ -93,9 +93,9 @@ func (dao *Dao) NonconcurrentDB() dbx.Builder {
// } // }
// defer app.Dao().Continue() // defer app.Dao().Continue()
// //
// return app.Dao().RunInTransaction(func (txDao *daos.Dao) error { // return app.Dao().RunInTransaction(func (txDao *daos.Dao) error {
// // some long running read&write transaction... // // some long running read&write transaction...
// }) // })
// } // }
func (dao *Dao) Block(ctx context.Context) error { func (dao *Dao) Block(ctx context.Context) error {
if dao.sem == nil { if dao.sem == nil {

View File

@ -7,10 +7,8 @@ linters:
disable-all: true disable-all: true
enable: enable:
- asciicheck - asciicheck
- deadcode
- depguard - depguard
- exportloopref - exportloopref
- gocritic
- gofmt - gofmt
- goimports - goimports
- gomodguard - gomodguard
@ -26,5 +24,4 @@ linters:
- typecheck - typecheck
- unconvert - unconvert
- unused - unused
- varcheck
- whitespace - whitespace

View File

@ -3,7 +3,7 @@ package auth
import ( import (
"context" "context"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"golang.org/x/oauth2" "golang.org/x/oauth2"
@ -125,7 +125,7 @@ func (p *baseProvider) sendRawUserDataRequest(req *http.Request, token *oauth2.T
} }
defer response.Body.Close() defer response.Body.Close()
result, err := ioutil.ReadAll(response.Body) result, err := io.ReadAll(response.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -2,7 +2,7 @@ package auth
import ( import (
"encoding/json" "encoding/json"
"io/ioutil" "io"
"strconv" "strconv"
"golang.org/x/oauth2" "golang.org/x/oauth2"
@ -75,7 +75,7 @@ func (p *Github) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
} }
defer response.Body.Close() defer response.Body.Close()
content, err := ioutil.ReadAll(response.Body) content, err := io.ReadAll(response.Body)
if err != nil { if err != nil {
return user, err return user, err
} }

View File

@ -45,6 +45,10 @@ func TestNewFileFromFromPath(t *testing.T) {
func TestNewFileFromMultipart(t *testing.T) { func TestNewFileFromMultipart(t *testing.T) {
formData, mp, err := tests.MockMultipartData(nil, "test") formData, mp, err := tests.MockMultipartData(nil, "test")
if err != nil {
t.Fatal(err)
}
req := httptest.NewRequest("", "/", formData) req := httptest.NewRequest("", "/", formData)
req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType())
req.ParseMultipartForm(32 << 20) req.ParseMultipartForm(32 << 20)

View File

@ -68,7 +68,7 @@ func TestLoginAuthStart(t *testing.T) {
} }
if len(resp) != 0 { if len(resp) != 0 {
t.Fatalf("[%s] Expected emtpy data response, got %v", s.name, resp) t.Fatalf("[%s] Expected empty data response, got %v", s.name, resp)
} }
if method != "LOGIN" { if method != "LOGIN" {