* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w`

* added goimports lint check to .golangci.yml

* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` for a corner case

* make app-layers, *-mocks and store-layers for ci check

Co-authored-by: Mahmudul Haque <mahmudulhaque@protonmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2021-01-07 22:42:43 +05:30
коммит произвёл GitHub
родитель 0c2c31bb0a
Коммит e89b26e8f3
337 изменённых файлов: 728 добавлений и 508 удалений

Просмотреть файл

@@ -8,11 +8,6 @@ import (
"os"
"time"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/store"
"github.com/pkg/errors"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
@@ -20,6 +15,11 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/marketplacemetering"
"github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface"
"github.com/pkg/errors"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/store"
)
type AwsMeter struct {

Просмотреть файл

@@ -8,14 +8,14 @@ import (
"testing"
"time"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock"
"github.com/mattermost/mattermost-server/v5/store/storetest/mocks"
"github.com/aws/aws-sdk-go/service/marketplacemetering"
"github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/aws/aws-sdk-go/service/marketplacemetering"
"github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock"
"github.com/mattermost/mattermost-server/v5/store/storetest/mocks"
)
type mockMarketplaceMeteringClient struct {

4
services/cache/lru.go поставляемый
Просмотреть файл

@@ -8,10 +8,10 @@ import (
"sync"
"time"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/tinylib/msgp/msgp"
"github.com/vmihailenco/msgpack/v5"
"github.com/mattermost/mattermost-server/v5/model"
)
// LRU is a thread-safe fixed size LRU cache.

4
services/cache/lru_striped_bench_test.go поставляемый
Просмотреть файл

@@ -9,9 +9,9 @@ import (
"sync"
"testing"
"github.com/mattermost/mattermost-server/v5/services/cache"
"github.com/cespare/xxhash/v2"
"github.com/mattermost/mattermost-server/v5/services/cache"
)
const (

4
services/cache/lru_striped_test.go поставляемый
Просмотреть файл

@@ -8,11 +8,11 @@ import (
"hash/maphash"
"testing"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/cespare/xxhash/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
)
func makeLRUPredictibleTestData(num int) [][2]string {

3
services/cache/lru_test.go поставляемый
Просмотреть файл

@@ -9,9 +9,10 @@ import (
"testing"
"time"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
)
func TestLRU(t *testing.T) {

3
services/cache/mocks/Provider.go поставляемый
Просмотреть файл

@@ -3,8 +3,9 @@
package mocks
import (
cache "github.com/mattermost/mattermost-server/v5/services/cache"
mock "github.com/stretchr/testify/mock"
cache "github.com/mattermost/mattermost-server/v5/services/cache"
)
// Provider is an autogenerated mock type for the Provider type

4
services/cache/provider.go поставляемый
Просмотреть файл

@@ -3,7 +3,9 @@
package cache
import "time"
import (
"time"
)
// CacheOptions contains options for initializaing a cache
type CacheOptions struct {

Просмотреть файл

@@ -6,8 +6,9 @@ package filesstore
import (
"testing"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
)
func TestCheckMandatoryS3Fields(t *testing.T) {

Просмотреть файл

@@ -10,11 +10,12 @@ import (
"net/url"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"github.com/mattermost/mattermost-server/v5/utils/testutils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func makeTestAtmosCamoProxy() *ImageProxy {

Просмотреть файл

@@ -14,9 +14,10 @@ import (
"net/url"
"path/filepath"
"willnorris.com/go/imageproxy"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"willnorris.com/go/imageproxy"
)
var imageContentTypes = []string{

Просмотреть файл

@@ -10,11 +10,12 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"github.com/mattermost/mattermost-server/v5/utils/testutils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func makeTestLocalProxy() *ImageProxy {

Просмотреть файл

@@ -10,15 +10,14 @@ import (
"io"
"mime"
"net"
"net/http"
"net/mail"
"net/smtp"
"time"
"github.com/jaytaylor/html2text"
gomail "gopkg.in/mail.v2"
"net/http"
"github.com/jaytaylor/html2text"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/filesstore"

Просмотреть файл

@@ -10,20 +10,20 @@ import (
"io"
"io/ioutil"
"net"
"net/mail"
"net/smtp"
"os"
"strings"
"testing"
"time"
"net/mail"
"net/smtp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/config"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/filesstore"
"github.com/mattermost/mattermost-server/v5/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestMailConnectionFromConfig(t *testing.T) {

Просмотреть файл

@@ -11,9 +11,10 @@ import (
"net/url"
"strings"
"github.com/pkg/errors"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"github.com/pkg/errors"
)
// Client is the programmatic interface to the marketplace server API.

Просмотреть файл

@@ -10,10 +10,11 @@ import (
"strings"
"github.com/dgryski/dgoogauth"
"github.com/mattermost/rsc/qr"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/configservice"
"github.com/mattermost/mattermost-server/v5/store"
"github.com/mattermost/rsc/qr"
)
const (

Просмотреть файл

@@ -11,13 +11,13 @@ import (
"time"
"github.com/dgryski/dgoogauth"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock"
"github.com/mattermost/mattermost-server/v5/store/storetest/mocks"
"github.com/mattermost/mattermost-server/v5/utils/testutils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGenerateSecret(t *testing.T) {

Просмотреть файл

@@ -11,14 +11,14 @@ import (
"sync/atomic"
"time"
"github.com/mattermost/mattermost-server/v5/jobs"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/analysis/analyzer/keyword"
"github.com/blevesearch/bleve/analysis/analyzer/standard"
"github.com/blevesearch/bleve/mapping"
"github.com/mattermost/mattermost-server/v5/jobs"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
)
const (

Просмотреть файл

@@ -7,11 +7,11 @@ import (
"net/http"
"strings"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/search/query"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
)
const DeletePostsBatchSize = 500

Просмотреть файл

@@ -10,6 +10,8 @@ import (
"strings"
"time"
rudder "github.com/rudderlabs/analytics-go"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin"
@@ -18,8 +20,6 @@ import (
"github.com/mattermost/mattermost-server/v5/services/searchengine"
"github.com/mattermost/mattermost-server/v5/store"
"github.com/mattermost/mattermost-server/v5/utils"
rudder "github.com/rudderlabs/analytics-go"
)
const (

Просмотреть файл

@@ -4,18 +4,17 @@
package tracing
import (
"context"
"io"
"time"
"github.com/mattermost/mattermost-server/v5/mlog"
opentracing "github.com/opentracing/opentracing-go"
"github.com/uber/jaeger-lib/metrics"
"context"
"github.com/uber/jaeger-client-go"
jaegercfg "github.com/uber/jaeger-client-go/config"
"github.com/uber/jaeger-client-go/zipkin"
"github.com/uber/jaeger-lib/metrics"
"github.com/mattermost/mattermost-server/v5/mlog"
)
// Tracer is a wrapper around Jaeger OpenTracing client, used to properly de-initialize jaeger on exit

Просмотреть файл

@@ -3,7 +3,9 @@
package upgrader
import "fmt"
import (
"fmt"
)
// InvalidArch indicates that the current operating system or cpu architecture doesn't support upgrades
type InvalidArch struct{}

Просмотреть файл

@@ -10,8 +10,9 @@ import (
"os"
"testing"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v5/model"
)
func TestCanIUpgradeToE0(t *testing.T) {