check intra dependencies

This commit is contained in:
Mahdi Abu Yasmine 2023-11-03 00:36:07 +01:00
parent b7cc2aa66b
commit 76ec47c9d5
16 changed files with 17 additions and 20 deletions

3
go.mod
View File

@ -1,3 +0,0 @@
module gitea.meta-tech.academy/go/core
go 1.20

0
go.sum
View File

View File

@ -1,9 +1,8 @@
go 1.20
use (
.
./src/config
./src/style
./src/sys
./src/util
./config
./style
./sys
./util
)

View File

@ -1,2 +1,3 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=

View File

@ -3,7 +3,7 @@ module gitea.meta-tech.academy/go/core/style
go 1.20
require (
gitea.meta-tech.academy/go/core/util v0.0.0-20231102220428-c719e245b956
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134
github.com/gookit/color v1.5.4
)

View File

@ -1,5 +1,5 @@
gitea.meta-tech.academy/go/core/util v0.0.0-20231102220428-c719e245b956 h1:XxyPD/jBTPqrf2o1N3QRmw8fPgvP7G9Z9Ba3DgH/Uz0=
gitea.meta-tech.academy/go/core/util v0.0.0-20231102220428-c719e245b956/go.mod h1:q+p8vM+aQ36GVspuTTupRBNDUKrsXCccx4k3f7IKfx8=
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134 h1:DTCBfyJ1HRBThmlYwFU6bLA2JV70inG1Yp/gug/pirk=
gitea.meta-tech.academy/go/core/util v0.0.0-20231103003446-3792c0f48134/go.mod h1:q+p8vM+aQ36GVspuTTupRBNDUKrsXCccx4k3f7IKfx8=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=

View File

@ -62,7 +62,7 @@ func NewStyleByDef(def string) *Style {
if len(d) > KEY_STYLE_OPTION {
o = strings.Split(d[KEY_STYLE_OPTION], ",")
}
util.prependToSliceStr(&c, "#")
util.PrependToSliceStr(&c, "#")
var s *color.RGBStyle
switch len(c) {
case 1:
@ -72,7 +72,7 @@ func NewStyleByDef(def string) *Style {
}
for _, elm := range o {
s.AddOpts(color.Color(util.str2int(elm, 10, 0)))
s.AddOpts(color.Color(util.Str2int(elm, 10, 0)))
}
// s.Printf(" %-20s\n", d[KEY_STYLE_NAME])
return &Style{s, d[KEY_STYLE_NAME]}

View File

@ -5,19 +5,19 @@ import (
"strings"
)
func prependToSliceStr(strs *[]string, prefix string) {
func PrependToSliceStr(strs *[]string, prefix string) {
for i, elm := range *strs {
(*strs)[i] = prefix + elm
}
}
func appendToSliceStr(strs *[]string, suffix string) {
func AppendToSliceStr(strs *[]string, suffix string) {
for i, elm := range *strs {
(*strs)[i] = elm + suffix
}
}
func str2int64(str string, base int, fallback int64) int64 {
func Str2int64(str string, base int, fallback int64) int64 {
str = strings.TrimSuffix(str, "\n")
num, err := strconv.ParseInt(str, base, 64)
if err != nil {
@ -26,14 +26,14 @@ func str2int64(str string, base int, fallback int64) int64 {
return num
}
func str2int(str string, base int, fallback int) int {
return int(str2int64(str, base, int64(fallback)))
func Str2int(str string, base int, fallback int) int {
return int(Str2int64(str, base, int64(fallback)))
}
func castStrings2ints(strs *[]string) []int {
func CastStrings2ints(strs *[]string) []int {
a := make([]int, len(*strs))
for i, elm := range *strs {
var f int = str2int(elm, 10, 0)
var f int = Str2int(elm, 10, 0)
a[i] = f
}
return a