Go Build Produces ‘ar archive’ Instead of executable

  Kiến thức lập trình

I have a very simple program:

package kioskify

import (
    "net/http"

    "github.com/labstack/echo/v4"
)

func main() {
    e := echo.New()
    e.GET("/", func(c echo.Context) error {
        return c.String(http.StatusOK, "Hello, World!")
    })
    e.Logger.Fatal(e.Start(":8000"))
}

I am using Go 1.22 and compiling it this way:

$ go build -ldflags="-s -w" -trimpath -o app

When I try to run it, I get this error:

$ ./app
zsh: permission denied: ./app

If I query its properties, I get:

$ file app
app: current ar archive

What am I doing wrong? This always worked a few months ago.

LEAVE A COMMENT