@@ -138,7 +138,7 @@ pkg unicode, var <new script or property> *RangeTable
138
138
copyExported ("golang.org/x/net/idna" )
139
139
140
140
if updateCore {
141
- copyVendored ()
141
+ copyInternal ()
142
142
}
143
143
144
144
if hasErrors {
@@ -236,9 +236,9 @@ func copyExported(p string) {
236
236
p )
237
237
}
238
238
239
- // copyVendored copies packages used by Go core into the vendored directory.
240
- func copyVendored () {
241
- root := filepath .Join (build .Default .GOROOT , filepath .FromSlash ("src/vendor/golang_org /x" ))
239
+ // copyInternal copies packages used by Go core into the internal directory.
240
+ func copyInternal () {
241
+ root := filepath .Join (build .Default .GOROOT , filepath .FromSlash ("src/internal /x" ))
242
242
243
243
err := filepath .Walk (root , func (dir string , info os.FileInfo , err error ) error {
244
244
if err != nil || ! info .IsDir () || root == dir {
@@ -253,7 +253,7 @@ func copyVendored() {
253
253
// Copy the vendored package if it exists in the export directory.
254
254
src = filepath .Join ("internal" , "export" , filepath .Base (src ))
255
255
}
256
- copyPackage (src , dir , "golang.org" , "golang_org " )
256
+ copyPackage (src , dir , "golang.org" , "internal " )
257
257
return nil
258
258
})
259
259
if err != nil {
@@ -279,18 +279,22 @@ func copyPackage(dirSrc, dirDst, search, replace string) {
279
279
filepath .Dir (file ) != dirSrc {
280
280
return nil
281
281
}
282
+ if strings .HasPrefix (base , "tables" ) {
283
+ if ! strings .HasSuffix (base , gen .UnicodeVersion ()+ ".go" ) {
284
+ return nil
285
+ }
286
+ base = "tables.go"
287
+ }
282
288
b , err := ioutil .ReadFile (file )
283
289
if err != nil || bytes .Contains (b , []byte ("\n // +build ignore" )) {
284
290
return err
285
291
}
286
292
// Fix paths.
287
293
b = bytes .Replace (b , []byte (search ), []byte (replace ), - 1 )
294
+ b = bytes .Replace (b , []byte ("internal/export" ), []byte ("" ), - 1 )
288
295
// Remove go:generate lines.
289
296
b = goGenRE .ReplaceAllLiteral (b , nil )
290
297
comment := "// Code generated by running \" go generate\" in golang.org/x/text. DO NOT EDIT.\n \n "
291
- if * doCore {
292
- comment = "// Code generated by running \" go run gen.go -core\" in golang.org/x/text. DO NOT EDIT.\n \n "
293
- }
294
298
if ! bytes .HasPrefix (b , []byte (comment )) {
295
299
b = append ([]byte (comment ), b ... )
296
300
}
0 commit comments