S
S
svd2222016-02-23 19:17:35
go
svd222, 2016-02-23 19:17:35

The program does not work after compilation?

GOLANG is installed using the .msi installer (Win7 AMD x64) (you do not need to specify GOROOT accordingly) I specified the
GOPATH variable, I
compile it like this:
go install hello
, the hello.exe executable file appears in the bin directory Run
:
%GOPATH%\bin\hello.exe hello world
at It doesn't output anything from the console, it just blinks the cursor. The same code was compiled under Debian 8.2 Jessie - it compiles and works fine (displays the passed parameters to the console).
The code

package main

import (
    "fmt"
    "os"
    "strings"
)

func main() {
    who := "World!"
    if len(os.Args) > 1 { /* os.Args[0] is "hello" or "hello.exe" */
        who = strings.Join(os.Args[1:], " ")
    }
    fmt.Println("Hello", who)
}

What could be the reason?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question