Skip to content

Commit

Permalink
issues #64 technical debt
Browse files Browse the repository at this point in the history
  • Loading branch information
e154 committed Aug 11, 2022
1 parent 5744dd8 commit 0a2ad4f
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 187 deletions.
2 changes: 1 addition & 1 deletion cmd/server/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}
21 changes: 9 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/jinzhu/gorm v1.9.16
github.com/json-iterator/go v1.1.12 // indirect
github.com/koron/netx v0.0.0-20151102071817-46fe5d298e3d
github.com/lib/pq v1.2.0
github.com/lib/pq v1.10.0
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
github.com/messagebird/go-rest-api v5.3.1-0.20190815153316-f1a991ff10ee+incompatible
Expand All @@ -39,22 +39,22 @@ require (
github.com/prometheus/client_golang v1.5.0
github.com/prometheus/common v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a
github.com/rubenv/sql-migrate v0.0.0-20210215143335-f84234893558
github.com/rubenv/sql-migrate v1.1.2
github.com/sfreiberg/gotwilio v1.0.0
github.com/smartystreets/assertions v1.0.1
github.com/smartystreets/goconvey v1.6.4
github.com/spf13/cobra v1.1.3
github.com/spf13/cobra v1.2.1
github.com/surge/glog v0.0.0-20141108051140-2578deb2b95c // indirect
github.com/t-tiger/gorm-bulk-insert v1.3.0
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5
go.uber.org/atomic v1.6.0
go.uber.org/atomic v1.7.0
go.uber.org/dig v1.10.0
go.uber.org/fx v1.13.1
go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.14.0
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
golang.org/x/text v0.3.7 // indirect
Expand All @@ -81,6 +81,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-gorp/gorp/v3 v3.0.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/protobuf v1.5.2 // indirect
Expand All @@ -91,7 +92,6 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
Expand All @@ -100,15 +100,12 @@ require (
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/procfs v0.0.8 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/tools v0.1.3 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/gorp.v1 v1.7.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
318 changes: 161 additions & 157 deletions go.sum

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions migrations/migrations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package migrations

import "embed"

//go:embed *
var F embed.FS
6 changes: 3 additions & 3 deletions plugins/cgminer/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func NewActor(entity *m.Entity,
actionPool: make(chan events.EventCallAction, 10),
}

if actor.ParentId == nil {
log.Warnf("entity %s, parent is nil", actor.Id)
}
//if actor.ParentId == nil {
// log.Warnf("entity %s, parent is nil", actor.Id)
//}

actor.Manager = entityManager

Expand Down
6 changes: 3 additions & 3 deletions plugins/modbus_rtu/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func NewActor(entity *m.Entity,
stateMu: &sync.Mutex{},
}

if actor.ParentId == nil {
log.Warnf("entity %s, parent is nil", actor.Id)
}
//if actor.ParentId == nil {
// log.Warnf("entity %s, parent is nil", actor.Id)
//}

actor.Manager = entityManager

Expand Down
6 changes: 3 additions & 3 deletions plugins/modbus_tcp/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func NewActor(entity *m.Entity,
stateMu: &sync.Mutex{},
}

if actor.ParentId == nil {
log.Warnf("entity %s, parent is nil", actor.Id)
}
//if actor.ParentId == nil {
// log.Warnf("entity %s, parent is nil", actor.Id)
//}

actor.Manager = entityManager

Expand Down
10 changes: 7 additions & 3 deletions system/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ package migrations

import (
"fmt"
"net/http"
"path"

"github.com/e154/smart-home/common/logger"
"github.com/jinzhu/gorm"
migrate "github.com/rubenv/sql-migrate"

"github.com/e154/smart-home/common/logger"
"github.com/e154/smart-home/migrations"
. "github.com/e154/smart-home/system/migrations/assets"
"github.com/e154/smart-home/system/orm"
"github.com/jinzhu/gorm"
migrate "github.com/rubenv/sql-migrate"
)

var (
Expand All @@ -51,6 +53,8 @@ func NewMigrations(cfg *orm.Config,
var source migrate.MigrationSource

switch mConf.Source {
case "embed":
source = &migrate.HttpFileSystemMigrationSource{FileSystem: http.FS(migrations.F)}
case "assets", "":
source = &migrate.AssetMigrationSource{
Asset: Asset,
Expand Down
2 changes: 1 addition & 1 deletion tests/api/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}
2 changes: 1 addition & 1 deletion tests/models/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}
2 changes: 1 addition & 1 deletion tests/plugins/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}
2 changes: 1 addition & 1 deletion tests/scripts/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}
2 changes: 1 addition & 1 deletion tests/system/container/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "github.com/e154/smart-home/system/migrations"
// NewMigrationsConfig ...
func NewMigrationsConfig() *migrations.Config {
return &migrations.Config{
Source: "assets",
Source: "embed",
Dir: "migrations",
}
}

0 comments on commit 0a2ad4f

Please sign in to comment.