]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/dist/buildruntime.go
cmd/ld: make cmd/ld a real library
[gostls13.git] / src / cmd / dist / buildruntime.go
1 // Copyright 2012 The Go Authors.  All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 import (
8         "fmt"
9         "os"
10 )
11
12 /*
13  * Helpers for building runtime.
14  */
15
16 // mkzversion writes zversion.go:
17 //
18 //      package runtime
19 //      const defaultGoroot = <goroot>
20 //      const theVersion = <version>
21 //
22 func mkzversion(dir, file string) {
23         out := fmt.Sprintf(
24                 "// auto generated by go tool dist\n"+
25                         "\n"+
26                         "package runtime\n"+
27                         "\n"+
28                         "const defaultGoroot = `%s`\n"+
29                         "const theVersion = `%s`\n"+
30                         "const goexperiment = `%s`\n"+
31                         "var buildVersion = theVersion\n", goroot_final, findgoversion(), os.Getenv("GOEXPERIMENT"))
32
33         writefile(out, file, 0)
34 }