如何为“发行”创建go文件?

I want to make a Golang File For "Release".

This is my command:

go build -o testi.exe -ldflags "-H windowsgui"

What is the correct way? My code:

package main
import (
    "fmt"
    "os"
    //"github.com/chai2010/qml"
    "github.com/go-qml/qml"
)
func main() {
    if err := qml.Run(run); err != nil {
        fmt.Fprintf(os.Stderr, "error: %v
", err)
        os.Exit(1)
    }
}
func run() error {
    engine := qml.NewEngine()
    engine.On("quit", func() { os.Exit(0) })

    component, err := engine.LoadString("hello.qml", qmlHello)
    if err != nil {
        return err
    }
    window := component.CreateWindow(nil)
    window.Show()
    window.Wait()
    return nil
}

const qmlHello = `
import QtQuick 2.2
import QtQuick.Controls 1.1
Rectangle {
    id: page
    width: 320; height: 240
    color: "lightgray"
    Text {
        id: helloText
        text: "Hello world!"
        y: 30
        anchors.horizontalCenter: page.horizontalCenter
        font.pointSize: 24; font.bold: true
    }
}
`

I installed : go1.5.windows-386.

As explained by JimB, Dave Cheney, and others:

  • There is no "RELEASE" for Golang
  • Golang executables are large, that is normal
  • Yes, you have to provide to DLL files if you force linking shared libraries
  • Yes, those libraries might be large.
  • There is nothing wrong, just let go use the defaults