Skip to content

Commit

Permalink
Address go cyclo issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric BAIL committed Jan 16, 2023
1 parent 1fbea96 commit 1b21cc5
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cmd/fyne/internal/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,9 @@ func (b *Builder) build() error {
}
}

goFlags := os.Getenv("GOFLAGS")
goLdFlags, goFlags := extractLdFlags(goFlags)
if goLdFlags != "" {
b.ldFlags += " " + goLdFlags
}
if goFlags != "" {
os.Setenv("GOFLAGS", goFlags)
}
b.updateGoLdFlags()

if len(b.ldFlags) > 0 {
b.ldFlags = strings.TrimSpace(b.ldFlags)
args = append(args, "-ldflags", b.ldFlags)
}

Expand Down Expand Up @@ -306,6 +298,19 @@ func (b *Builder) build() error {
return err
}

func (b *Builder) updateGoLdFlags() {
goFlags := os.Getenv("GOFLAGS")
goLdFlags, goFlags := extractLdFlags(goFlags)
if goLdFlags != "" {
b.ldFlags += " " + goLdFlags
}
if goFlags != "" {
os.Setenv("GOFLAGS", goFlags)
}

b.ldFlags = strings.TrimSpace(b.ldFlags)
}

func (b *Builder) computeSrcDir(fyneGoModRunner runner) (string, error) {
if b.goPackage == "" || b.goPackage == "." {
return b.srcdir, nil
Expand Down

0 comments on commit 1b21cc5

Please sign in to comment.