wip migrate to module

This commit is contained in:
Chakib Ben Ziane 2020-08-12 19:13:01 +01:00
parent 5898acc8f0
commit dc795166c3
19 changed files with 71 additions and 57 deletions

5
api.go
View File

@ -1,13 +1,14 @@
package main package main
import ( import (
"gomark/bookmarks"
"gomark/database"
"io" "io"
"net/http" "net/http"
"os" "os"
"strings" "strings"
"git.sp4ke.com/sp4ke/gomark/bookmarks"
"git.sp4ke.com/sp4ke/gomark/database"
"git.sp4ke.com/sp4ke/gum" "git.sp4ke.com/sp4ke/gum"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@ -10,17 +10,18 @@ package browsers
import ( import (
"fmt" "fmt"
"gomark/database"
"gomark/index"
"gomark/logging"
"gomark/parsing"
"gomark/tree"
"gomark/watch"
"io" "io"
"path" "path"
"path/filepath" "path/filepath"
"reflect" "reflect"
"git.sp4ke.com/sp4ke/gomark/database"
"git.sp4ke.com/sp4ke/gomark/index"
"git.sp4ke.com/sp4ke/gomark/logging"
"git.sp4ke.com/sp4ke/gomark/parsing"
"git.sp4ke.com/sp4ke/gomark/tree"
"git.sp4ke.com/sp4ke/gomark/watch"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/sp4ke/hashmap" "github.com/sp4ke/hashmap"
) )

View File

@ -1,17 +1,18 @@
package main package main
import ( import (
"gomark/browsers"
"gomark/chrome"
"gomark/database"
"gomark/parsing"
"gomark/tree"
"gomark/utils"
"gomark/watch"
"io/ioutil" "io/ioutil"
"path" "path"
"time" "time"
"git.sp4ke.com/sp4ke/gomark/browsers"
"git.sp4ke.com/sp4ke/gomark/chrome"
"git.sp4ke.com/sp4ke/gomark/database"
"git.sp4ke.com/sp4ke/gomark/parsing"
"git.sp4ke.com/sp4ke/gomark/tree"
"git.sp4ke.com/sp4ke/gomark/utils"
"git.sp4ke.com/sp4ke/gomark/watch"
"github.com/OneOfOne/xxhash" "github.com/OneOfOne/xxhash"
"github.com/buger/jsonparser" "github.com/buger/jsonparser"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"

View File

@ -1,11 +1,11 @@
package cmd package cmd
import ( import (
"gomark/config" "git.sp4ke.com/sp4ke/gomark/config"
"gomark/logging" "git.sp4ke.com/sp4ke/gomark/logging"
"gomark/utils" "git.sp4ke.com/sp4ke/gomark/utils"
cli "gopkg.in/urfave/cli.v1" "github.com/urfave/cli/v2"
) )
var log = logging.GetLogger("CMD") var log = logging.GetLogger("CMD")

View File

@ -7,7 +7,7 @@ import (
"gomark/mozilla" "gomark/mozilla"
"path/filepath" "path/filepath"
cli "gopkg.in/urfave/cli.v1" "github.com/urfave/cli/v2"
) )
var fflog = logging.GetLogger("FF") var fflog = logging.GetLogger("FF")

View File

@ -1,12 +1,13 @@
package cmd package cmd
import ( import (
"gomark/config"
"gomark/mozilla"
"strings" "strings"
"git.sp4ke.com/sp4ke/gomark/config"
"git.sp4ke.com/sp4ke/gomark/mozilla"
"github.com/gobuffalo/flect" "github.com/gobuffalo/flect"
cli "gopkg.in/urfave/cli.v1" "github.com/urfave/cli/v2"
) )
const ( const (
@ -14,7 +15,7 @@ const (
) )
var FirefoxGlobalFlags = []cli.Flag{ var FirefoxGlobalFlags = []cli.Flag{
cli.StringFlag{ &cli.StringFlag{
Name: FirefoxDefaultProfileFlag, Name: FirefoxDefaultProfileFlag,
Usage: "Set the default firefox `PROFILE` to use", Usage: "Set the default firefox `PROFILE` to use",
}, },

View File

@ -6,7 +6,7 @@ import (
"git.sp4ke.com/sp4ke/gum" "git.sp4ke.com/sp4ke/gum"
cli "gopkg.in/urfave/cli.v1" "github.com/urfave/cli/v2"
) )
var startServerCmd = cli.Command{ var startServerCmd = cli.Command{

View File

@ -1,8 +1,8 @@
package main package main
import ( import (
"gomark/config" "git.sp4ke.com/sp4ke/gomark/config"
"gomark/utils" "git.sp4ke.com/sp4ke/gomark/utils"
) )
func InitDefaultConfig() { func InitDefaultConfig() {

View File

@ -1,8 +1,9 @@
package database package database
import ( import (
"gomark/utils"
"path/filepath" "path/filepath"
"git.sp4ke.com/sp4ke/gomark/utils"
) )
func GetDBFullPath() string { func GetDBFullPath() string {

5
db.go
View File

@ -1,9 +1,10 @@
package main package main
import ( import (
"gomark/database"
"gomark/utils"
"path/filepath" "path/filepath"
"git.sp4ke.com/sp4ke/gomark/database"
"git.sp4ke.com/sp4ke/gomark/utils"
) )
type DB = database.DB type DB = database.DB

View File

@ -6,17 +6,18 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"gomark/browsers"
"gomark/database"
"gomark/mozilla"
"gomark/parsing"
"gomark/tree"
"gomark/utils"
"gomark/watch"
"path" "path"
"path/filepath" "path/filepath"
"time" "time"
"git.sp4ke.com/sp4ke/gomark/browsers"
"git.sp4ke.com/sp4ke/gomark/database"
"git.sp4ke.com/sp4ke/gomark/mozilla"
"git.sp4ke.com/sp4ke/gomark/parsing"
"git.sp4ke.com/sp4ke/gomark/tree"
"git.sp4ke.com/sp4ke/gomark/utils"
"git.sp4ke.com/sp4ke/gomark/watch"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
sqlite3 "github.com/mattn/go-sqlite3" sqlite3 "github.com/mattn/go-sqlite3"

2
log.go
View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"gomark/logging" "git.sp4ke.com/sp4ke/gomark/logging"
) )
var ( var (

14
main.go
View File

@ -6,12 +6,14 @@
package main package main
import ( import (
"gomark/cmd"
"gomark/config"
"os" "os"
"git.sp4ke.com/sp4ke/gomark/config"
"git.sp4ke.com/sp4ke/gomark/cmd"
"github.com/urfave/cli/altsrc" "github.com/urfave/cli/altsrc"
cli "gopkg.in/urfave/cli.v1" "github.com/urfave/cli/v2"
) )
func main() { func main() {
@ -19,12 +21,12 @@ func main() {
app.Name = "gomark" app.Name = "gomark"
app.Version = "1.0" app.Version = "1.0"
flags := []cli.Flag{ flags := []*cli.Flag{
altsrc.NewStringFlag(cli.StringFlag{ &altsrc.NewStringFlag(cli.StringFlag{
Name: "firefox.DefaultProfile", Name: "firefox.DefaultProfile",
}), }),
cli.StringFlag{ &cli.StringFlag{
Name: "config-file", Name: "config-file",
Value: config.ConfigFile, Value: config.ConfigFile,
Usage: "TOML config `FILE` path", Usage: "TOML config `FILE` path",

View File

@ -1,8 +1,8 @@
package mozilla package mozilla
import ( import (
"gomark/database" "git.sp4ke.com/sp4ke/gomark/database"
"gomark/logging" "git.sp4ke.com/sp4ke/gomark/logging"
) )
const ( const (

View File

@ -2,8 +2,9 @@ package mozilla
import ( import (
"fmt" "fmt"
"gomark/config"
"gomark/database" "git.sp4ke.com/sp4ke/gomark/config"
"git.sp4ke.com/sp4ke/gomark/database"
"github.com/fatih/structs" "github.com/fatih/structs"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"

View File

@ -3,13 +3,14 @@ package mozilla
import ( import (
"errors" "errors"
"fmt" "fmt"
"gomark/config"
"gomark/profiles"
"gomark/utils"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"git.sp4ke.com/sp4ke/gomark/config"
"git.sp4ke.com/sp4ke/gomark/profiles"
"git.sp4ke.com/sp4ke/gomark/utils"
ini "gopkg.in/ini.v1" ini "gopkg.in/ini.v1"
) )

View File

@ -3,8 +3,9 @@ package mozilla
import ( import (
"errors" "errors"
"fmt" "fmt"
"gomark/utils"
"path" "path"
"git.sp4ke.com/sp4ke/gomark/utils"
) )
const ( const (

View File

@ -2,9 +2,10 @@ package tree
import ( import (
"fmt" "fmt"
"gomark/bookmarks"
"gomark/index" "git.sp4ke.com/sp4ke/gomark/bookmarks"
"gomark/logging" "git.sp4ke.com/sp4ke/gomark/index"
"git.sp4ke.com/sp4ke/gomark/logging"
"github.com/xlab/treeprint" "github.com/xlab/treeprint"
) )

View File

@ -1,10 +1,11 @@
package utils package utils
import ( import (
"gomark/logging"
"gomark/watch"
"time" "time"
"git.sp4ke.com/sp4ke/gomark/logging"
"git.sp4ke.com/sp4ke/gomark/watch"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
) )