Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
moqsien committed Apr 12, 2024
1 parent 54400b5 commit 19bb6f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions build/gbuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"upx": true,
"build_args": [
"-ldflags",
"-X main.GitTag=$(git describe --abbrev=0 --tags) -X main.GitHash=$(git show -s --format=%H) -s -w"
"-X main.GitTag=$(git describe --abbrev=0 --tags) -X main.GitHash=$(git show -s --format=%H) -s -w",
"./cmd/gber/"
],
"work_dir": "/Volumes/data/projects/go/src/gvcgo_org/gobuilder/cmd/gber"
"work_dir": "/Volumes/data/projects/go/src/gvcgo_org/gobuilder"
}
6 changes: 2 additions & 4 deletions internal/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ func (g *GoBuilder) parseArgs() {
return
}

g.WorkDir = GetCurrentWorkingDir()

for idx, v := range args {
v = strings.ReplaceAll(v, "#", "$")
args[idx] = v
Expand Down Expand Up @@ -249,7 +247,7 @@ func (g *GoBuilder) clearArgs(args []string) {
}

func (g *GoBuilder) prepareArgs(osInfo, archInfo string) (args []string, targetDir, binName string) {
inputArgs := g.BuildArgs
inputArgs := append([]string{}, g.BuildArgs...) // deepcopy

if len(inputArgs) == 0 {
inputArgs = append(inputArgs, g.WorkDir)
Expand Down Expand Up @@ -311,7 +309,7 @@ func (g *GoBuilder) build(osInfo, archInfo string) {
args := append([]string{"go", "build"}, inputArgs...)
g.clearArgs(args)

if _, err := gutils.ExecuteSysCommand(false, "", args...); err != nil {
if _, err := gutils.ExecuteSysCommand(false, g.WorkDir, args...); err != nil {
gprint.PrintError("Failed to build binaries: %+v", err)
os.Exit(1)
}
Expand Down

0 comments on commit 19bb6f0

Please sign in to comment.