Skip to content

cmd/gf: gf run main.go error #4125

Open
@liuzhenrain

Description

Go version

go version: 1.23.5

GoFrame version

2.7.1

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

PS F:\goprojs\gftest> gf version
v2.8.3
Welcome to GoFrame!
Env Detail:
  GF Version(go.mod): v2.7.1
CLI Detail:
  Installed At: F:\gotools\gf.exe
  Built Go Version: go1.23.4
  Built GF Version: v2.8.3
  Git Commit: 2024-12-18 15:54:27 92eab81926dea3ef090905c8f4da267c84fd11a3
  Built Time: 2024-12-18 21:00:03
Others Detail:
  Docs: https://goframe.org
  Now : 2025-01-18T23:33:15+08:00

Run the following commands in order (Windows 10 PowerShell):

  1. mkdir gftest
  2. cd gftest
  3. gf init .
  4. gf run main.go

Other than that, no further actions are taken.

Then the following error occurs:

PS F:\goprojs\gftest> gf run main.go
build: main.go
`go build -o .\main.exe main.go`
build error:
The system cannot find the path specified.
exit status 1
deleted binary file: .\main.exe

What did you see happen?

I switched to cmd and Git Bash (MINGW64) on Windows 10, but the same error occurred.

I have tried downloading an older version of gf-cli (2.8.2) and also attempted to install gf-cli using the command go install github.com/gogf/gf/cmd/gf/v2@latest, but the same error occurred in both cases.

If I directly run the command go build -o .\main.exe main.go, a .main.exe file is generated in the current directory.

Attached is the output information from running the command gf run main.go --gf.debug=true.

run_error.txt

What did you expect to see?

The command can be executed normally.

Metadata

Assignees

No one assigned

    Labels

    bugIt is confirmed a bug, but don't worry, we'll handle it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions