You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When -- is used to separate arguments from input files to go run, the -- is passed to the executed program as os.Args[1]. It should not be. To reproduce:
x.go:
package main
import (
"fmt""os"
)
funcmain() {
fmt.Println(os.Args)
}
I don't think -- is an explicitly supported feature. In fact, I think it was explicitly rejected in the past. What you're seeing is a side effect: once files no longer match *.go, they're arguments.
Yes, cmd/go/run.go's func runRun seems to confirm:
func runRun(cmd *Command, args []string) { |Warning (server): Unable to start the Emacs server.
raceInit() |There is an existing Emacs server, named "server".
var b builder |To start the server in this Emacs process, stop the existing
b.init() |server or call `M-x server-force-delete' to forcibly disconnect it.
b.print = printStderr |
i := 0 |
for i < len(args) && strings.HasSuffix(args[i], ".go") { |
i++ |
} |
files, cmdArgs := args[:i], args[i:] |
When
--
is used to separate arguments from input files togo run
, the--
is passed to the executed program asos.Args[1]
. It should not be. To reproduce:x.go:
x2.go:
package main
Execute:
Result:
Want:
The text was updated successfully, but these errors were encountered: