Skip to content

Commit 1dbed8f

Browse files
committed
Deleted path from project.json
1 parent 50b961a commit 1dbed8f

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

controllers/pv.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ func deploy(oso string, archL string, hOS string) {
1616
var arch string
1717
pr := prepareProject.LoadProjectInfo()
1818
name := pr.Name
19-
err := os.Chdir(pr.Path)
20-
errors.ErrorHandle(err)
2119
if oso != "" && archL == "" {
2220
goos = "GOOS=" + oso
2321
arch = "GOARCH=" + archL
@@ -31,7 +29,7 @@ func deploy(oso string, archL string, hOS string) {
3129
cmd := exec.Command("env", goos, arch, "go", "build", "-o", name)
3230
cmd.Stdout = os.Stdout
3331
cmd.Stderr = os.Stderr
34-
err = cmd.Run()
32+
err := cmd.Run()
3533
errors.ErrorHandle(err)
3634
os.Exit(1)
3735
}
@@ -42,15 +40,12 @@ func initialize(name string, arch string, oso string) {
4240
err = os.Chdir(name)
4341
errors.ErrorHandle(err)
4442
var project models.Project
45-
path, _ := os.Getwd()
46-
project.Path = path
4743
project.Name = name
4844
project.Arch = arch
4945
project.OS = oso
5046
project.Vars = append(project.Vars, models.Var{"", ""})
5147
var command models.Command
5248
command.Name = "run"
53-
command.Path = path
5449
command.Option = "mod"
5550
project.Commands = append(project.Commands, command)
5651
file, err := json.MarshalIndent(project, "", " ")
@@ -66,10 +61,12 @@ func initialize(name string, arch string, oso string) {
6661
}
6762

6863
func cnfFunc(command string, filepath string, modOrFile string) (string, string) {
64+
var err error
6965
project := prepareProject.LoadProjectInfo()
7066
for i := 0; i < len(project.Commands); i++ {
7167
if command == project.Commands[i].Name {
72-
filepath = project.Commands[i].Path
68+
filepath, err = os.Getwd()
69+
errors.ErrorHandle(err)
7370
modOrFile = project.Commands[i].Option
7471
}
7572
}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
func main() {
1919
hostInfo := [2]string{build.Default.GOOS, build.Default.GOARCH}
2020
color.Cyan("Godemon starting...")
21-
version := "2.5.7"
21+
version := "2.6.0"
2222
doneChan := make(chan bool)
2323
filepath, modOrFile, cnf, command, help, init, name, oso, arch := cliTools.LoadCMD("", "")
2424
filepath, modOrFile = controllers.ProgramStarting(&cnf, filepath, modOrFile, command, help, version, init, name, oso, arch, hostInfo[0])

models/cnf.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type Project struct {
1515
Name string `json:"name"`
1616
Arch string `json:"arch"`
1717
OS string `json:"os"`
18-
Path string `json:"path"`
1918
Vars []Var `json:"dev-vars"`
2019
Commands []Command `json:"commands"`
2120
}

prepareProject/jsonLoading.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ func LoadProjectInfo() models.Project {
1919
var project models.Project
2020
err = json.Unmarshal(byteValue, &project)
2121
errors.ErrorHandle(err)
22-
if project.Name == "" || project.Path == "" {
23-
fmt.Println("Project name or path is empty")
22+
if project.Name == "" {
23+
fmt.Println("Project name is empty")
2424
os.Exit(1)
2525
}
2626
if project.OS == "" && project.Arch == "" {

0 commit comments

Comments
 (0)