Gofmt, remove commented code
This commit is contained in:
parent
2c8e60e1bb
commit
49335a290f
10
args/lang.go
10
args/lang.go
@ -10,7 +10,7 @@ type LangVar struct {
|
||||
v []lang.Language
|
||||
}
|
||||
|
||||
func(lv *LangVar) Set(s string) error {
|
||||
func (lv *LangVar) Set(s string) error {
|
||||
v, err := lang.LanguageFromCode(s)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -19,16 +19,14 @@ func(lv *LangVar) Set(s string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func(lv *LangVar) String() string {
|
||||
func (lv *LangVar) String() string {
|
||||
var s []string
|
||||
for _, v := range(lv.v) {
|
||||
for _, v := range lv.v {
|
||||
s = append(s, v.Code)
|
||||
}
|
||||
return strings.Join(s, ",")
|
||||
}
|
||||
|
||||
func(lv *LangVar) Langs() []lang.Language {
|
||||
func (lv *LangVar) Langs() []lang.Language {
|
||||
return lv.v
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,18 +12,18 @@ import (
|
||||
"syscall"
|
||||
|
||||
"git.defalsify.org/vise.git/engine"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/request"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
|
||||
at "git.grassecon.net/grassrootseconomics/visedriver-africastalking/africastalking"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/args"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
at "git.grassecon.net/grassrootseconomics/visedriver-africastalking/africastalking"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -14,12 +14,12 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/request"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/args"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/request"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -17,13 +17,13 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
httprequest "git.grassecon.net/grassrootseconomics/visedriver/request/http"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/request"
|
||||
httprequest "git.grassecon.net/grassrootseconomics/visedriver/request/http"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/args"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -10,14 +10,14 @@ import (
|
||||
"syscall"
|
||||
|
||||
"git.defalsify.org/vise.git/engine"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/args"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -1,9 +1,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
||||
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -1,11 +1,11 @@
|
||||
package debug
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
visedb "git.defalsify.org/vise.git/db"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -53,12 +53,11 @@ func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
|
||||
k = k[2:]
|
||||
}
|
||||
|
||||
|
||||
return o, nil
|
||||
}
|
||||
|
||||
func subTypToString(v storedb.DataTyp) string {
|
||||
return dbTypStr[v + visedb.DATATYPE_USERDATA + 1]
|
||||
return dbTypStr[v+visedb.DATATYPE_USERDATA+1]
|
||||
}
|
||||
|
||||
func typToString(v uint8) string {
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build debugdb
|
||||
// +build debugdb
|
||||
|
||||
package debug
|
||||
@ -11,37 +12,37 @@ import (
|
||||
func init() {
|
||||
DebugCap |= 1
|
||||
dbTypStr[db.DATATYPE_STATE] = "internal state"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TRACKING_ID] = "tracking id"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_PUBLIC_KEY] = "public key"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACCOUNT_PIN] = "account pin"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_FIRST_NAME] = "first name"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_FAMILY_NAME] = "family name"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_YOB] = "year of birth"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_LOCATION] = "location"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_GENDER] = "gender"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_OFFERINGS] = "offerings"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_RECIPIENT] = "recipient"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_AMOUNT] = "amount"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TEMPORARY_VALUE] = "temporary value"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_SYM] = "active sym"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_BAL] = "active bal"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_BLOCKED_NUMBER] = "blocked number"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_PUBLIC_KEY_REVERSE] = "public_key_reverse"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_DECIMAL] = "active decimal"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_ACTIVE_ADDRESS] = "active address"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_INCORRECT_PIN_ATTEMPTS] = "incorrect pin attempts"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_SELECTED_LANGUAGE_CODE] = "selected language"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_INITIAL_LANGUAGE_CODE] = "initial language"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_SYMBOLS] = "voucher symbols"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_BALANCES] = "voucher balances"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_DECIMALS] = "voucher decimals"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_VOUCHER_ADDRESSES] = "voucher addresses"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_SENDERS] = "tx senders"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_RECIPIENTS] = "tx recipients"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_VALUES] = "tx values"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_ADDRESSES] = "tx addresses"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_HASHES] = "tx hashes"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_DATES] = "tx dates"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_SYMBOLS] = "tx symbols"
|
||||
dbTypStr[db.DATATYPE_USERDATA + 1 + storedb.DATA_TX_DECIMALS] = "tx decimals"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TRACKING_ID] = "tracking id"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_PUBLIC_KEY] = "public key"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_ACCOUNT_PIN] = "account pin"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_FIRST_NAME] = "first name"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_FAMILY_NAME] = "family name"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_YOB] = "year of birth"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_LOCATION] = "location"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_GENDER] = "gender"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_OFFERINGS] = "offerings"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_RECIPIENT] = "recipient"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_AMOUNT] = "amount"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TEMPORARY_VALUE] = "temporary value"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_ACTIVE_SYM] = "active sym"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_ACTIVE_BAL] = "active bal"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_BLOCKED_NUMBER] = "blocked number"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_PUBLIC_KEY_REVERSE] = "public_key_reverse"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_ACTIVE_DECIMAL] = "active decimal"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_ACTIVE_ADDRESS] = "active address"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_INCORRECT_PIN_ATTEMPTS] = "incorrect pin attempts"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_SELECTED_LANGUAGE_CODE] = "selected language"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_INITIAL_LANGUAGE_CODE] = "initial language"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_VOUCHER_SYMBOLS] = "voucher symbols"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_VOUCHER_BALANCES] = "voucher balances"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_VOUCHER_DECIMALS] = "voucher decimals"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_VOUCHER_ADDRESSES] = "voucher addresses"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_SENDERS] = "tx senders"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_RECIPIENTS] = "tx recipients"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_VALUES] = "tx values"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_ADDRESSES] = "tx addresses"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_HASHES] = "tx hashes"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_DATES] = "tx dates"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_SYMBOLS] = "tx symbols"
|
||||
dbTypStr[db.DATATYPE_USERDATA+1+storedb.DATA_TX_DECIMALS] = "tx decimals"
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package debug
|
||||
import (
|
||||
"testing"
|
||||
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
visedb "git.defalsify.org/vise.git/db"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
|
||||
func TestDebugDbSubKeyInfo(t *testing.T) {
|
||||
@ -24,7 +24,7 @@ func TestDebugDbSubKeyInfo(t *testing.T) {
|
||||
if r.SubTyp != 2 {
|
||||
t.Fatalf("expected 2, got %d", r.SubTyp)
|
||||
}
|
||||
if DebugCap & 1 > 0 {
|
||||
if DebugCap&1 > 0 {
|
||||
if r.Label != "tracking id" {
|
||||
t.Fatalf("expected 'tracking id', got '%s'", r.Label)
|
||||
}
|
||||
@ -45,7 +45,7 @@ func TestDebugDbKeyInfo(t *testing.T) {
|
||||
if r.Typ != 16 {
|
||||
t.Fatalf("expected 16, got %d", r.Typ)
|
||||
}
|
||||
if DebugCap & 1 > 0 {
|
||||
if DebugCap&1 > 0 {
|
||||
if r.Label != "internal state" {
|
||||
t.Fatalf("expected 'internal_state', got '%s'", r.Label)
|
||||
}
|
||||
@ -68,7 +68,7 @@ func TestDebugDbKeyInfoRestore(t *testing.T) {
|
||||
if r.Typ != 32 {
|
||||
t.Fatalf("expected 32, got %d", r.Typ)
|
||||
}
|
||||
if DebugCap & 1 > 0 {
|
||||
if DebugCap&1 > 0 {
|
||||
if r.Label != "active sym" {
|
||||
t.Fatalf("expected 'active sym', got '%s'", r.Label)
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/internal/cmd"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/internal/cmd"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -8,13 +8,12 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
changeHeadSrc = `LOAD reset_account_authorized 0
|
||||
LOAD reset_incorrect 0
|
||||
CATCH incorrect_pin flag_incorrect_pin 1
|
||||
@ -63,7 +62,7 @@ func main() {
|
||||
}
|
||||
logg.Tracef("using languages", "lang", config.Languages)
|
||||
|
||||
for i, v := range(config.Languages) {
|
||||
for i, v := range config.Languages {
|
||||
ln, err := lang.LanguageFromCode(v)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error parsing language: %s\n", v)
|
||||
@ -76,7 +75,7 @@ func main() {
|
||||
incmps += fmt.Sprintf("INCMP %s %v\n", v, n)
|
||||
|
||||
p := path.Join(srcDir, v)
|
||||
w, err := os.OpenFile(p, os.O_WRONLY | os.O_CREATE | os.O_EXCL, 0600)
|
||||
w, err := os.OpenFile(p, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed open language set template output: %v\n", err)
|
||||
os.Exit(1)
|
||||
@ -93,7 +92,7 @@ func main() {
|
||||
src += "INCMP . *\n"
|
||||
|
||||
p := path.Join(srcDir, "select_language.vis")
|
||||
w, err := os.OpenFile(p, os.O_WRONLY | os.O_CREATE | os.O_EXCL, 0600)
|
||||
w, err := os.OpenFile(p, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed open select language vis output: %v\n", err)
|
||||
os.Exit(1)
|
||||
@ -107,7 +106,7 @@ func main() {
|
||||
|
||||
src = changeHeadSrc + src
|
||||
p = path.Join(srcDir, "change_language.vis")
|
||||
w, err = os.OpenFile(p, os.O_WRONLY | os.O_CREATE | os.O_EXCL, 0600)
|
||||
w, err = os.OpenFile(p, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed open select language vis output: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
@ -7,11 +7,11 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/debug"
|
||||
"git.defalsify.org/vise.git/db"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/debug"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -35,13 +35,6 @@ func (eu *EventsUpdater) HandleCustodialRegistration(ctx context.Context, ev *ap
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// err = pe.Load(identity.SessionId)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// st := pe.GetState()
|
||||
// st.SetFlag(accountCreatedFlag)
|
||||
// return pe.Save(identity.SessionId)
|
||||
logg.DebugCtxf(ctx, "received custodial registration event", "identity", identity)
|
||||
return nil
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.defalsify.org/vise.git/persist"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
"git.defalsify.org/vise.git/persist"
|
||||
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.defalsify.org/vise.git/db"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
"git.grassecon.net/grassrootseconomics/common/identity"
|
||||
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
|
||||
// execute all
|
||||
@ -47,7 +47,6 @@ func (eu *EventsUpdater) updateToken(ctx context.Context, identity identity.Iden
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// set default token to given symbol.
|
||||
func (eu *EventsUpdater) updateDefaultToken(ctx context.Context, identity identity.Identity, userStore *store.UserDataStore, activeSym string) error {
|
||||
pfxDb := toPrefixDb(userStore, identity.SessionId)
|
||||
@ -59,7 +58,6 @@ func (eu *EventsUpdater) updateDefaultToken(ctx context.Context, identity identi
|
||||
return store.UpdateVoucherData(ctx, userStore, identity.SessionId, tokenData)
|
||||
}
|
||||
|
||||
|
||||
// handle token transfer.
|
||||
//
|
||||
// if from and to are NOT the same, handle code will be executed once for each side of the transfer.
|
||||
@ -189,7 +187,7 @@ func (eu *EventsUpdater) updateTokenTransferList(ctx context.Context, identity i
|
||||
return err
|
||||
}
|
||||
|
||||
for i, tx := range(txs) {
|
||||
for i, tx := range txs {
|
||||
r = append(r, eu.formatFunc(apievent.EventTokenTransferTag, i, tx))
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -94,5 +94,3 @@ func (c *Cmd) Parse(args []string) error {
|
||||
|
||||
return fmt.Errorf("unknown subcommand: %s", cmd)
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/testutil/driver"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/testutil"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/testutil/driver"
|
||||
"github.com/gofrs/uuid"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -1,16 +1,17 @@
|
||||
//go:build !online
|
||||
// +build !online
|
||||
|
||||
package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
devremote "git.grassecon.net/grassrootseconomics/sarafu-api/dev"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/event"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
type localEmitter struct {
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build online
|
||||
// +build online
|
||||
|
||||
package services
|
||||
@ -5,9 +6,9 @@ package services
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
func New(ctx context.Context, storageService storage.StorageService, conn storage.ConnData) remote.AccountService {
|
||||
|
@ -29,7 +29,7 @@ func NewSshKeyStore(ctx context.Context, dbDir string) (*SshKeyStore, error) {
|
||||
return keyStore, nil
|
||||
}
|
||||
|
||||
func(s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId string) error {
|
||||
func (s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId string) error {
|
||||
_, err := os.Stat(fp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot open ssh server public key file: %v\n", err)
|
||||
@ -51,7 +51,7 @@ func(s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId strin
|
||||
return s.store.Put(ctx, k, []byte(sessionId))
|
||||
}
|
||||
|
||||
func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) {
|
||||
func (s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) {
|
||||
s.store.SetLanguage(nil)
|
||||
s.store.SetSession("")
|
||||
s.store.SetPrefix(storage.DATATYPE_EXTEND)
|
||||
@ -63,6 +63,6 @@ func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, err
|
||||
return string(v), nil
|
||||
}
|
||||
|
||||
func(s *SshKeyStore) Close(ctx context.Context) error {
|
||||
func (s *SshKeyStore) Close(ctx context.Context) error {
|
||||
return s.store.Close(ctx)
|
||||
}
|
||||
|
21
ssh/ssh.go
21
ssh/ssh.go
@ -2,8 +2,8 @@ package ssh
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -16,9 +16,9 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
"git.defalsify.org/vise.git/state"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -39,7 +39,7 @@ func NewAuther(ctx context.Context, keyStore *SshKeyStore) *auther {
|
||||
}
|
||||
}
|
||||
|
||||
func(a *auther) Check(conn ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
|
||||
func (a *auther) Check(conn ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
|
||||
logg.TraceCtxf(a.Ctx, "looking for publickey", "pubkey", fmt.Sprintf("%x", pubKey))
|
||||
va, err := a.keyStore.Get(a.Ctx, pubKey)
|
||||
if err != nil {
|
||||
@ -51,7 +51,7 @@ func(a *auther) Check(conn ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permiss
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func(a *auther) FromConn(c *ssh.ServerConn) (string, error) {
|
||||
func (a *auther) FromConn(c *ssh.ServerConn) (string, error) {
|
||||
if c == nil {
|
||||
return "", errors.New("nil server conn")
|
||||
}
|
||||
@ -61,8 +61,7 @@ func(a *auther) FromConn(c *ssh.ServerConn) (string, error) {
|
||||
return a.Get(c.Conn.SessionID())
|
||||
}
|
||||
|
||||
|
||||
func(a *auther) Get(k []byte) (string, error) {
|
||||
func (a *auther) Get(k []byte) (string, error) {
|
||||
ka := hex.EncodeToString(k)
|
||||
v, ok := a.auth[ka]
|
||||
if !ok {
|
||||
@ -84,7 +83,7 @@ type SshRunner struct {
|
||||
lst net.Listener
|
||||
}
|
||||
|
||||
func(s *SshRunner) serve(ctx context.Context, sessionId string, ch ssh.NewChannel, en engine.Engine) error {
|
||||
func (s *SshRunner) serve(ctx context.Context, sessionId string, ch ssh.NewChannel, en engine.Engine) error {
|
||||
if ch == nil {
|
||||
return errors.New("nil channel")
|
||||
}
|
||||
@ -141,11 +140,11 @@ func(s *SshRunner) serve(ctx context.Context, sessionId string, ch ssh.NewChanne
|
||||
return nil
|
||||
}
|
||||
|
||||
func(s *SshRunner) Stop() error {
|
||||
func (s *SshRunner) Stop() error {
|
||||
return s.lst.Close()
|
||||
}
|
||||
|
||||
func(s *SshRunner) GetEngine(sessionId string) (engine.Engine, func(), error) {
|
||||
func (s *SshRunner) GetEngine(sessionId string) (engine.Engine, func(), error) {
|
||||
ctx := s.Ctx
|
||||
menuStorageService := storage.NewMenuStorageService(s.Conn)
|
||||
|
||||
@ -202,7 +201,7 @@ func(s *SshRunner) GetEngine(sessionId string) (engine.Engine, func(), error) {
|
||||
}
|
||||
|
||||
// adapted example from crypto/ssh package, NewServerConn doc
|
||||
func(s *SshRunner) Run(ctx context.Context, keyStore *SshKeyStore) {
|
||||
func (s *SshRunner) Run(ctx context.Context, keyStore *SshKeyStore) {
|
||||
s.Ctx = ctx
|
||||
running := true
|
||||
|
||||
|
@ -3,8 +3,8 @@ package store
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alecthomas/assert/v2"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
"github.com/alecthomas/assert/v2"
|
||||
)
|
||||
|
||||
func TestParseAndScaleAmount(t *testing.T) {
|
||||
|
@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
|
||||
visedb "git.defalsify.org/vise.git/db"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
"git.grassecon.net/grassrootseconomics/common/hex"
|
||||
"git.grassecon.net/grassrootseconomics/common/identity"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
|
||||
// TODO: Rename interface, "datastore" is redundant naming and too general
|
||||
|
@ -9,24 +9,24 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"git.defalsify.org/vise.git/engine"
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/testutil/testservice"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/testutil/testservice"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/testutil/testtag"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
// CleanDatabase removes all test data from the database
|
||||
func CleanDatabase() {
|
||||
for _, v := range([]int8{
|
||||
for _, v := range []int8{
|
||||
storage.STORETYPE_STATE,
|
||||
storage.STORETYPE_USER,
|
||||
}) {
|
||||
} {
|
||||
conn := conns[v]
|
||||
logg.Infof("cleaning test database", "typ", v, "db", conn)
|
||||
if conn.DbType() == storage.DBTYPE_POSTGRES {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//go:build testfsdb
|
||||
// +build testfsdb
|
||||
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1,10 +1,11 @@
|
||||
//go:build testgdbmdb
|
||||
// +build testgdbmdb
|
||||
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
"path"
|
||||
|
||||
testdataloader "github.com/peteole/testdata-loader"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
fsdb "git.defalsify.org/vise.git/db/fs"
|
||||
"git.defalsify.org/vise.git/db"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
fsdb "git.defalsify.org/vise.git/db/fs"
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
testdataloader "github.com/peteole/testdata-loader"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build !online
|
||||
// +build !online
|
||||
|
||||
package testtag
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build online
|
||||
// +build online
|
||||
|
||||
package testtag
|
||||
|
Loading…
Reference in New Issue
Block a user