Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Change import name aliases #1868

Merged
merged 21 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ blocks:
commands:
- cd users
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
WashingtonKK marked this conversation as resolved.
Show resolved Hide resolved
- name: Test Users
commands:
- cd users
Expand Down Expand Up @@ -135,7 +135,7 @@ blocks:
commands:
- cd things
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Things
commands:
- cd things
Expand Down Expand Up @@ -169,7 +169,7 @@ blocks:
commands:
- cd coap
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test CoAP
commands:
- cd coap
Expand Down Expand Up @@ -203,7 +203,7 @@ blocks:
commands:
- cd http
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test HTTP
commands:
- cd http
Expand Down Expand Up @@ -238,7 +238,7 @@ blocks:
commands:
- cd mqtt
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test MQTT
commands:
- cd mqtt
Expand Down Expand Up @@ -273,7 +273,7 @@ blocks:
commands:
- cd ws
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test WS
commands:
- cd ws
Expand Down Expand Up @@ -308,7 +308,7 @@ blocks:
commands:
- cd bootstrap
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Bootstrap
commands:
- cd bootstrap
Expand Down Expand Up @@ -343,7 +343,7 @@ blocks:
commands:
- cd certs
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Certs
commands:
- cd certs
Expand Down Expand Up @@ -378,7 +378,7 @@ blocks:
commands:
- cd provision
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Provision
commands:
- cd provision
Expand Down Expand Up @@ -413,7 +413,7 @@ blocks:
commands:
- cd twins
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Twins
commands:
- cd twins
Expand Down Expand Up @@ -448,7 +448,7 @@ blocks:
commands:
- cd readers
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Twins
commands:
- cd readers
Expand Down Expand Up @@ -487,7 +487,7 @@ blocks:
commands:
- cd consumers
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Consumers
commands:
- cd consumers
Expand Down Expand Up @@ -527,7 +527,7 @@ blocks:
commands:
- cd cli
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test CLI
commands:
- cd cli
Expand Down Expand Up @@ -562,7 +562,7 @@ blocks:
commands:
- cd lora
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test LoRa
commands:
- cd lora
Expand Down Expand Up @@ -597,7 +597,7 @@ blocks:
commands:
- cd opcua
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test OPC-UA
commands:
- cd opcua
Expand Down Expand Up @@ -632,7 +632,7 @@ blocks:
commands:
- cd internal
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Internal
commands:
- cd internal
Expand All @@ -652,7 +652,7 @@ blocks:
commands:
- cd logger
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Logger
commands:
- cd logger
Expand All @@ -672,7 +672,7 @@ blocks:
commands:
- cd pkg
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test PKG
commands:
- cd pkg
Expand All @@ -692,7 +692,7 @@ blocks:
commands:
- cd tools
- cache restore linter
- './bin/golangci-lint run'
- './bin/golangci-lint run
- name: Test Tools
commands:
- cd tools
Expand Down
5 changes: 3 additions & 2 deletions bootstrap/api/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func newConfig(channels []bootstrap.Channel) bootstrap.Config {

func (tr testRequest) make() (*http.Response, error) {
req, err := http.NewRequest(tr.method, tr.url, tr.body)

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -536,6 +535,7 @@ func TestUpdate(t *testing.T) {
assert.Equal(t, tc.status, res.StatusCode, fmt.Sprintf("%s: expected status code %d got %d", tc.desc, tc.status, res.StatusCode))
}
}

func TestUpdateCert(t *testing.T) {
auth := mocks.NewAuthClient(map[string]string{validToken: email})

Expand Down Expand Up @@ -1012,7 +1012,8 @@ func TestRemove(t *testing.T) {
id: saved.ThingID,
auth: invalidToken,
status: http.StatusUnauthorized,
}, {
},
{
desc: "remove with an empty token",
id: saved.ThingID,
auth: "",
Expand Down
1 change: 0 additions & 1 deletion bootstrap/mocks/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func (crm *configRepositoryMock) RetrieveByID(_ context.Context, token, id strin
}

return c, nil

}

func (crm *configRepositoryMock) RetrieveAll(_ context.Context, token string, filter bootstrap.Filter, offset, limit uint64) bootstrap.ConfigsPage {
Expand Down
1 change: 0 additions & 1 deletion bootstrap/mocks/things.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (svc *mainfluxThings) ViewClient(ctx context.Context, token, id string) (mf

if t, ok := svc.things[id]; ok && t.Owner == userID.GetId() {
return t, nil

}

return mfclients.Client{}, errors.ErrNotFound
Expand Down
11 changes: 5 additions & 6 deletions bootstrap/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"testing"

"github.com/jmoiron/sqlx"
bootstrapRepo "github.com/mainflux/mainflux/bootstrap/postgres"
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
"github.com/mainflux/mainflux/bootstrap/postgres"
pgclient "github.com/mainflux/mainflux/internal/clients/postgres"
"github.com/mainflux/mainflux/logger"

dockertest "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3"
)

var (
Expand Down Expand Up @@ -50,7 +49,7 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

dbConfig := pgClient.Config{
dbConfig := pgclient.Config{
Host: "localhost",
Port: port,
User: "test",
Expand All @@ -62,7 +61,7 @@ func TestMain(m *testing.M) {
SSLRootCert: "",
}

if db, err = pgClient.SetupDB(dbConfig, *bootstrapRepo.Migration()); err != nil {
if db, err = pgclient.SetupDB(dbConfig, *postgres.Migration()); err != nil {
testLog.Error(fmt.Sprintf("Could not setup test DB connection: %s", err))
}

Expand Down
2 changes: 1 addition & 1 deletion bootstrap/redis/producer/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"

"github.com/go-redis/redis/v8"
dockertest "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3"
)

var redisClient *redis.Client
Expand Down
5 changes: 2 additions & 3 deletions bootstrap/redis/producer/streams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ import (

"github.com/go-redis/redis/v8"
"github.com/go-zoo/bone"
"github.com/mainflux/mainflux/logger"
"github.com/mainflux/mainflux/pkg/errors"

"github.com/mainflux/mainflux/bootstrap"
"github.com/mainflux/mainflux/bootstrap/mocks"
"github.com/mainflux/mainflux/bootstrap/redis/producer"
"github.com/mainflux/mainflux/logger"
mfclients "github.com/mainflux/mainflux/pkg/clients"
"github.com/mainflux/mainflux/pkg/errors"
mfgroups "github.com/mainflux/mainflux/pkg/groups"
mfsdk "github.com/mainflux/mainflux/pkg/sdk/go"
"github.com/mainflux/mainflux/things/clients"
Expand Down
1 change: 0 additions & 1 deletion bootstrap/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"testing"

"github.com/go-zoo/bone"

"github.com/gofrs/uuid"
"github.com/mainflux/mainflux/bootstrap"
"github.com/mainflux/mainflux/bootstrap/mocks"
Expand Down
1 change: 0 additions & 1 deletion certs/mocks/things.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (svc *mainfluxThings) ViewClient(ctx context.Context, token, id string) (mf

if t, ok := svc.things[id]; ok && t.Owner == userID.GetId() {
return t, nil

}

return mfclients.Client{}, errors.ErrNotFound
Expand Down
8 changes: 4 additions & 4 deletions certs/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/jmoiron/sqlx"
"github.com/mainflux/mainflux/certs/postgres"
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
pgclient "github.com/mainflux/mainflux/internal/clients/postgres"
"github.com/mainflux/mainflux/logger"
dockertest "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3"
)

var (
Expand Down Expand Up @@ -50,7 +50,7 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

dbConfig := pgClient.Config{
dbConfig := pgclient.Config{
Host: "localhost",
Port: port,
User: "test",
Expand All @@ -62,7 +62,7 @@ func TestMain(m *testing.M) {
SSLRootCert: "",
}

if db, err = pgClient.SetupDB(dbConfig, *postgres.Migration()); err != nil {
if db, err = pgclient.SetupDB(dbConfig, *postgres.Migration()); err != nil {
testLog.Error(fmt.Sprintf("Could not setup test DB connection: %s", err))
}

Expand Down
2 changes: 0 additions & 2 deletions certs/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func TestIssueCert(t *testing.T) {
assert.True(t, strings.Contains(cert.Subject.CommonName, thingKey), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))
}
}

}

func TestRevokeCert(t *testing.T) {
Expand Down Expand Up @@ -177,7 +176,6 @@ func TestRevokeCert(t *testing.T) {
_, err := svc.RevokeCert(context.Background(), tc.token, tc.thingID)
assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))
}

}

func TestListCerts(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion cli/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ var cmdBootstrap = []cobra.Command{
return
}
logUsage(cmd.Use)

},
},
{
Expand Down
4 changes: 2 additions & 2 deletions cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type config struct {
}

// Readable by all user groups but writeable by the user only.
const filePermission = 0644
const filePermission = 0o644

var (
errReadFail = errors.New("failed to read config file")
Expand Down Expand Up @@ -189,7 +189,7 @@ func setConfigValue(key string, value string) error {
}
}

var configKeyToField = map[string]interface{}{
configKeyToField := map[string]interface{}{
"things_url": &config.Remotes.ThingsURL,
"users_url": &config.Remotes.UsersURL,
"reader_url": &config.Remotes.ReaderURL,
Expand Down
8 changes: 4 additions & 4 deletions cli/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var cmdPolicies = []cobra.Command{
return
}

var policy = mfxsdk.Policy{
policy := mfxsdk.Policy{
Subject: args[1],
Object: args[2],
Actions: actions,
Expand Down Expand Up @@ -76,7 +76,7 @@ var cmdPolicies = []cobra.Command{
return
}

var policy = mfxsdk.Policy{
policy := mfxsdk.Policy{
Subject: args[1],
Object: args[2],
Actions: actions,
Expand Down Expand Up @@ -150,7 +150,7 @@ var cmdPolicies = []cobra.Command{
return
}

var policy = mfxsdk.Policy{
policy := mfxsdk.Policy{
Subject: args[1],
Object: args[2],
}
Expand Down Expand Up @@ -183,7 +183,7 @@ var cmdPolicies = []cobra.Command{
return
}

var areq = mfxsdk.AccessRequest{
areq := mfxsdk.AccessRequest{
Subject: args[1],
Object: args[2],
Action: args[3],
Expand Down
Loading