<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 2.1 從`go`命令談起 Go 程序的生命周期要從執行`go`命令開始談起。 ## 2.1.1 Go Run 與 Go Build 命令 * 設置具體的指令 * go run –> run.CmdRun * go build –> work.CmdBuild ``` // src/cmd/go/main.go func init() { base.Go.Commands = []*base.Command{ work.CmdBuild, run.CmdRun, ... } } func main() { flag.Usage = base.Usage flag.Parse() log.SetFlags(0) args := flag.Args() if len(args) &lt; 1 { base.Usage() } ... // 從左至右依次解析 go 指令 BigCmdLoop: for bigCmd := base.Go; ; { for _, cmd := range bigCmd.Commands { // 匹配具體的指令,args[0] 是 go 指令后緊跟的第一個參數,如 run、build。 if cmd.Name() != args[0] { continue } ... // 根據指令和參數執行編譯或運行 cmd.Run(cmd, args) base.Exit() return } ... } } TODO: ``` ``` // src/cmd/go/internal/work/build.go var CmdBuild = &amp;base.Command{ UsageLine: "go build [-o output] [-i] [build flags] [packages]", Short: "compile packages and dependencies", Long: `...`, } func init() { CmdBuild.Run = runBuild // -o 參數解析 CmdBuild.Flag.StringVar(&amp;cfg.BuildO, "o", "", "output file or directory") ... switch build.Default.Compiler { case "gc", "gccgo": buildCompiler{}.Set(build.Default.Compiler) // gc } } type buildCompiler struct{} func (c buildCompiler) Set(value string) error { switch value { case "gc": BuildToolchain = gcToolchain{} ... } ... return nil } func runBuild(cmd *base.Command, args []string) { BuildInit() var b Builder b.Init() pkgs := load.PackagesForBuild(args) ... depMode := ModeBuild if cfg.BuildI { depMode = ModeInstall } ... a := &amp;Action{Mode: "go build"} for _, p := range pkgs { a.Deps = append(a.Deps, b.AutoAction(ModeBuild, depMode, p)) } ... b.Do(a) } ``` ``` type Builder struct { WorkDir string // the temporary work directory (ends in filepath.Separator) actionCache map[cacheKey]*Action // a cache of already-constructed actions mkdirCache map[string]bool // a cache of created directories flagCache map[[2]string]bool // a cache of supported compiler flags Print func(args ...interface{}) (int, error) IsCmdList bool // running as part of go list; set p.Stale and additional fields below NeedError bool // list needs p.Error NeedExport bool // list needs p.Export NeedCompiledGoFiles bool // list needs p.CompiledGoFIles objdirSeq int // counter for NewObjdir pkgSeq int output sync.Mutex scriptDir string // current directory in printed script exec sync.Mutex readySema chan bool ready actionQueue id sync.Mutex toolIDCache map[string]string // tool name -&gt; tool ID buildIDCache map[string]string // file name -&gt; build ID } // AutoAction returns the "right" action for go build or go install of p. func (b *Builder) AutoAction(mode, depMode BuildMode, p *load.Package) *Action { if p.Name == "main" { return b.LinkAction(mode, depMode, p) } return b.CompileAction(mode, depMode, p) } ``` TODO: 未完成,當前內容來源于`src/cmd/compile/README`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看