Wednesday, 1 May 2019

Go language: Build executable


Use the command ‘go build goFilePath’, to build the executable from go program.

App.go
package main

import "fmt"

func main() {
 fmt.Println("Hello World")
}

$ go build App.go 
$ 
$ ls
App     App.go

As you see 'App' file is created after building. If you run build command in windows, it generates App.exe file.


Run the file 'App' to see the output.
$ ./App 
Hello World


Previous                                                 Next                                                 Home

No comments:

Post a Comment