1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-27 17:58:29 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-03-15 00:07:19 +08:00
parent bf91715f8f
commit faa4dfb3cc

View File

@ -47,9 +47,12 @@ func _autogen_import(m *ice.Message, main string, ctx string, mod string) {
_autogen_defs(m, ice.README_MD, ice.MAKEFILE, ice.LICENSE) _autogen_defs(m, ice.README_MD, ice.MAKEFILE, ice.LICENSE)
_autogen_defs(m, ice.SRC_MAIN_GO, ice.ETC_MISS_SH, ice.README_MD, ice.MAKEFILE, ice.LICENSE) _autogen_defs(m, ice.SRC_MAIN_GO, ice.ETC_MISS_SH, ice.README_MD, ice.MAKEFILE, ice.LICENSE)
begin, done, list := false, false, []string{} begin, done, list := false, false, []string{}
imports := kit.Format(`_ "%s/src/%s"`, mod, ctx)
m.Cmd(nfs.CAT, main, func(line string, index int) { m.Cmd(nfs.CAT, main, func(line string, index int) {
if begin && !done && strings.HasPrefix(line, ")") { if strings.HasSuffix(line, imports) {
done, list = true, append(list, "", kit.Format(` _ "%s/src/%s"`, mod, ctx)) done = true
} else if begin && !done && strings.HasPrefix(line, ")") {
done, list = true, append(list, "", kit.Format(` %s`, imports))
} }
if list = append(list, line); done { if list = append(list, line); done {
return return
@ -57,7 +60,7 @@ func _autogen_import(m *ice.Message, main string, ctx string, mod string) {
if strings.HasPrefix(line, "import (") { if strings.HasPrefix(line, "import (") {
begin = true begin = true
} else if strings.HasPrefix(line, IMPORT) { } else if strings.HasPrefix(line, IMPORT) {
done, list = true, append(list, kit.Format(`import _ "%s/src/%s"`, mod, ctx)) done, list = true, append(list, kit.Format(`import %s`, imports))
} }
}) })
m.Cmd(nfs.SAVE, main, kit.Join(list, lex.NL)) m.Cmd(nfs.SAVE, main, kit.Join(list, lex.NL))
@ -106,11 +109,11 @@ func _autogen_mod(m *ice.Message, file string) (mod string) {
} else { } else {
host = strings.Split(host, "://")[1] host = strings.Split(host, "://")[1]
host = path.Join(host, "x", path.Base(kit.Path(""))) host = path.Join(host, "x", path.Base(kit.Path("")))
kit.If(strings.Contains(host, ":"), func() { host = path.Base(host) })
} }
} else { } else {
host = strings.Split(host, "://")[1] host = strings.Split(host, "://")[1]
} }
kit.If(strings.Contains(host, ":"), func() { host = path.Base(host) })
m.Cmd(nfs.DEFS, file, kit.Format(nfs.Template(m, ice.GO_MOD), host)) m.Cmd(nfs.DEFS, file, kit.Format(nfs.Template(m, ice.GO_MOD), host))
// ReposAddFile(m, "", ice.GO_MOD) // ReposAddFile(m, "", ice.GO_MOD)
m.Cmd(nfs.CAT, file, func(line string) { m.Cmd(nfs.CAT, file, func(line string) {