@@ -79,6 +79,19 @@ func main() {
79
79
os .Exit (2 )
80
80
}
81
81
updateCore = true
82
+ goroot := os .Getenv ("GOROOT" )
83
+ appendToFile (
84
+ filepath .Join (goroot , "api" , "except.txt" ),
85
+ fmt .Sprintf ("pkg unicode, const Version = %q\n " , unicode .Version ),
86
+ )
87
+ const lines = `pkg unicode, const Version = %q
88
+ // TODO: add a new line of the following form for each new script and property.
89
+ pkg unicode, var <new script or property> *RangeTable
90
+ `
91
+ appendToFile (
92
+ filepath .Join (goroot , "api" , "next.txt" ),
93
+ fmt .Sprintf (lines , gen .UnicodeVersion ()),
94
+ )
82
95
}
83
96
84
97
var unicode = & dependency {}
@@ -131,6 +144,20 @@ func main() {
131
144
vprintf ("SUCCESS\n " )
132
145
}
133
146
147
+ func appendToFile (file , text string ) {
148
+ fmt .Println ("Augmenting" , file )
149
+ w , err := os .OpenFile (file , os .O_APPEND | os .O_WRONLY , 0600 )
150
+ if err != nil {
151
+ fmt .Println ("Failed to open file:" , err )
152
+ os .Exit (1 )
153
+ }
154
+ defer w .Close ()
155
+ if _ , err := w .WriteString (text ); err != nil {
156
+ fmt .Println ("Failed to write to file:" , err )
157
+ os .Exit (1 )
158
+ }
159
+ }
160
+
134
161
var (
135
162
all sync.WaitGroup
136
163
hasErrors bool
@@ -243,7 +270,7 @@ func copyPackage(dirSrc, dirDst, search, replace string) {
243
270
base := filepath .Base (file )
244
271
if err != nil || info .IsDir () ||
245
272
! strings .HasSuffix (base , ".go" ) ||
246
- strings .HasSuffix (base , "_test.go" ) && ! strings . HasPrefix ( base , "example" ) ||
273
+ strings .HasSuffix (base , "_test.go" ) ||
247
274
// Don't process subdirectories.
248
275
filepath .Dir (file ) != dirSrc {
249
276
return nil
0 commit comments