Gofmt, remove commented code

This commit is contained in:
lash 2025-01-21 15:43:26 +00:00
parent 2c8e60e1bb
commit 49335a290f
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
33 changed files with 181 additions and 191 deletions

View File

@ -21,7 +21,7 @@ func(lv *LangVar) Set(s string) error {
func (lv *LangVar) String() string { func (lv *LangVar) String() string {
var s []string var s []string
for _, v := range(lv.v) { for _, v := range lv.v {
s = append(s, v.Code) s = append(s, v.Code)
} }
return strings.Join(s, ",") return strings.Join(s, ",")
@ -30,5 +30,3 @@ func(lv *LangVar) String() string {
func (lv *LangVar) Langs() []lang.Language { func (lv *LangVar) Langs() []lang.Language {
return lv.v return lv.v
} }

View File

@ -12,18 +12,18 @@ import (
"syscall" "syscall"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/lang" "git.defalsify.org/vise.git/lang"
"git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config" "git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
"git.grassecon.net/grassrootseconomics/visedriver/request" "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/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
"git.grassecon.net/grassrootseconomics/sarafu-vise/services" "git.grassecon.net/grassrootseconomics/sarafu-vise/services"
at "git.grassecon.net/grassrootseconomics/visedriver-africastalking/africastalking"
) )
var ( var (

View File

@ -14,12 +14,12 @@ import (
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "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/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "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 ( var (

View File

@ -17,13 +17,13 @@ import (
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config" "git.grassecon.net/grassrootseconomics/sarafu-vise/config"
httprequest "git.grassecon.net/grassrootseconomics/visedriver/request/http"
"git.grassecon.net/grassrootseconomics/visedriver/request" "git.grassecon.net/grassrootseconomics/visedriver/request"
httprequest "git.grassecon.net/grassrootseconomics/visedriver/request/http"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "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/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
) )
var ( var (

View File

@ -10,14 +10,14 @@ import (
"syscall" "syscall"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/lang"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "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/args"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers"
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
) )
var ( var (

View File

@ -1,9 +1,9 @@
package config package config
import ( import (
"git.grassecon.net/grassrootseconomics/visedriver/env"
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config" apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
"git.grassecon.net/grassrootseconomics/visedriver/env"
) )
var ( var (

View File

@ -1,11 +1,11 @@
package debug package debug
import ( import (
"fmt"
"encoding/binary" "encoding/binary"
"fmt"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
visedb "git.defalsify.org/vise.git/db" visedb "git.defalsify.org/vise.git/db"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
) )
var ( var (
@ -53,7 +53,6 @@ func ToKeyInfo(k []byte, sessionId string) (KeyInfo, error) {
k = k[2:] k = k[2:]
} }
return o, nil return o, nil
} }

View File

@ -1,3 +1,4 @@
//go:build debugdb
// +build debugdb // +build debugdb
package debug package debug

View File

@ -3,8 +3,8 @@ package debug
import ( import (
"testing" "testing"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
visedb "git.defalsify.org/vise.git/db" visedb "git.defalsify.org/vise.git/db"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
) )
func TestDebugDbSubKeyInfo(t *testing.T) { func TestDebugDbSubKeyInfo(t *testing.T) {

View File

@ -10,9 +10,9 @@ import (
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config" "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/handlers/application"
"git.grassecon.net/grassrootseconomics/sarafu-vise/internal/cmd"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
) )
var ( var (

View File

@ -8,13 +8,12 @@ import (
"path" "path"
"strings" "strings"
"git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/lang" "git.defalsify.org/vise.git/lang"
"git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/visedriver/config" "git.grassecon.net/grassrootseconomics/visedriver/config"
) )
const ( const (
changeHeadSrc = `LOAD reset_account_authorized 0 changeHeadSrc = `LOAD reset_account_authorized 0
LOAD reset_incorrect 0 LOAD reset_incorrect 0
CATCH incorrect_pin flag_incorrect_pin 1 CATCH incorrect_pin flag_incorrect_pin 1
@ -63,7 +62,7 @@ func main() {
} }
logg.Tracef("using languages", "lang", config.Languages) logg.Tracef("using languages", "lang", config.Languages)
for i, v := range(config.Languages) { for i, v := range config.Languages {
ln, err := lang.LanguageFromCode(v) ln, err := lang.LanguageFromCode(v)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "error parsing language: %s\n", v) fmt.Fprintf(os.Stderr, "error parsing language: %s\n", v)

View File

@ -7,11 +7,11 @@ import (
"os" "os"
"path" "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/db"
"git.defalsify.org/vise.git/logging" "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 ( var (

View File

@ -35,13 +35,6 @@ func (eu *EventsUpdater) HandleCustodialRegistration(ctx context.Context, ev *ap
if err != nil { if err != nil {
return err 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) logg.DebugCtxf(ctx, "received custodial registration event", "identity", identity)
return nil return nil
} }

View File

@ -4,12 +4,12 @@ import (
"context" "context"
"fmt" "fmt"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "git.defalsify.org/vise.git/persist"
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event" 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 ( var (

View File

@ -6,10 +6,10 @@ import (
"strings" "strings"
"git.defalsify.org/vise.git/db" "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" "git.grassecon.net/grassrootseconomics/common/identity"
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event" 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 // execute all
@ -47,7 +47,6 @@ func (eu *EventsUpdater) updateToken(ctx context.Context, identity identity.Iden
return nil return nil
} }
// set default token to given symbol. // set default token to given symbol.
func (eu *EventsUpdater) updateDefaultToken(ctx context.Context, identity identity.Identity, userStore *store.UserDataStore, activeSym string) error { func (eu *EventsUpdater) updateDefaultToken(ctx context.Context, identity identity.Identity, userStore *store.UserDataStore, activeSym string) error {
pfxDb := toPrefixDb(userStore, identity.SessionId) 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) return store.UpdateVoucherData(ctx, userStore, identity.SessionId, tokenData)
} }
// handle token transfer. // handle token transfer.
// //
// if from and to are NOT the same, handle code will be executed once for each side of the 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 return err
} }
for i, tx := range(txs) { for i, tx := range txs {
r = append(r, eu.formatFunc(apievent.EventTokenTransferTag, i, tx)) r = append(r, eu.formatFunc(apievent.EventTokenTransferTag, i, tx))
} }

View File

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
) )
var ( var (
@ -94,5 +94,3 @@ func (c *Cmd) Parse(args []string) error {
return fmt.Errorf("unknown subcommand: %s", cmd) return fmt.Errorf("unknown subcommand: %s", cmd)
} }

View File

@ -9,10 +9,10 @@ import (
"regexp" "regexp"
"testing" "testing"
"github.com/gofrs/uuid"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/visedriver/testutil/driver"
"git.grassecon.net/grassrootseconomics/sarafu-vise/testutil" "git.grassecon.net/grassrootseconomics/sarafu-vise/testutil"
"git.grassecon.net/grassrootseconomics/visedriver/testutil/driver"
"github.com/gofrs/uuid"
) )
var ( var (

View File

@ -1,16 +1,17 @@
//go:build !online
// +build !online // +build !online
package services package services
import ( import (
"fmt"
"context" "context"
"fmt"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
devremote "git.grassecon.net/grassrootseconomics/sarafu-api/dev" devremote "git.grassecon.net/grassrootseconomics/sarafu-api/dev"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event" 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/sarafu-vise/handlers/event"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
) )
type localEmitter struct { type localEmitter struct {

View File

@ -1,3 +1,4 @@
//go:build online
// +build online // +build online
package services package services
@ -5,9 +6,9 @@ package services
import ( import (
"context" "context"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote" "git.grassecon.net/grassrootseconomics/sarafu-api/remote"
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" 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 { func New(ctx context.Context, storageService storage.StorageService, conn storage.ConnData) remote.AccountService {

View File

@ -2,8 +2,8 @@ package ssh
import ( import (
"context" "context"
"encoding/hex"
"encoding/base64" "encoding/base64"
"encoding/hex"
"errors" "errors"
"fmt" "fmt"
"net" "net"
@ -16,9 +16,9 @@ import (
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/state" "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/handlers"
"git.grassecon.net/grassrootseconomics/sarafu-vise/services"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
) )
var ( var (
@ -61,7 +61,6 @@ func(a *auther) FromConn(c *ssh.ServerConn) (string, error) {
return a.Get(c.Conn.SessionID()) 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) ka := hex.EncodeToString(k)
v, ok := a.auth[ka] v, ok := a.auth[ka]

View File

@ -3,8 +3,8 @@ package store
import ( import (
"testing" "testing"
"github.com/alecthomas/assert/v2"
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db" storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
"github.com/alecthomas/assert/v2"
) )
func TestParseAndScaleAmount(t *testing.T) { func TestParseAndScaleAmount(t *testing.T) {

View File

@ -4,10 +4,10 @@ import (
"context" "context"
visedb "git.defalsify.org/vise.git/db" 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/hex"
"git.grassecon.net/grassrootseconomics/common/identity" "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 // TODO: Rename interface, "datastore" is redundant naming and too general

View File

@ -9,24 +9,24 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/jackc/pgx/v5/pgxpool"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/resource" "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" "git.grassecon.net/grassrootseconomics/sarafu-api/remote"
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" 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/sarafu-vise/testutil/testtag"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
"github.com/jackc/pgx/v5/pgxpool"
) )
// CleanDatabase removes all test data from the database // CleanDatabase removes all test data from the database
func CleanDatabase() { func CleanDatabase() {
for _, v := range([]int8{ for _, v := range []int8{
storage.STORETYPE_STATE, storage.STORETYPE_STATE,
storage.STORETYPE_USER, storage.STORETYPE_USER,
}) { } {
conn := conns[v] conn := conns[v]
logg.Infof("cleaning test database", "typ", v, "db", conn) logg.Infof("cleaning test database", "typ", v, "db", conn)
if conn.DbType() == storage.DBTYPE_POSTGRES { if conn.DbType() == storage.DBTYPE_POSTGRES {

View File

@ -1,10 +1,10 @@
//go:build testfsdb
// +build testfsdb // +build testfsdb
package testutil package testutil
import ( import (
"os" "os"
) )
const ( const (

View File

@ -1,10 +1,11 @@
//go:build testgdbmdb
// +build testgdbmdb // +build testgdbmdb
package testutil package testutil
import ( import (
"os"
"net/url" "net/url"
"os"
) )
const ( const (

View File

@ -4,12 +4,12 @@ import (
"context" "context"
"path" "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.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/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
testdataloader "github.com/peteole/testdata-loader"
) )
var ( var (

View File

@ -1,3 +1,4 @@
//go:build !online
// +build !online // +build !online
package testtag package testtag

View File

@ -1,3 +1,4 @@
//go:build online
// +build online // +build online
package testtag package testtag