@@ -275,7 +275,7 @@ <h4 id="list-buildid">The <code>list</code> command</h4>
275
275
When the < code > -export</ code > flag is specified, the < code > BuildID</ code >
276
276
field is now set to the build ID of the compiled package. This is equivalent
277
277
to running < code > go</ code > < code > tool</ code > < code > buildid</ code > on
278
- < code > go</ code > < code > list</ code > < code > -exported</ code > < code > -f</ code > < code > {{.Export}</ code > ,
278
+ < code > go</ code > < code > list</ code > < code > -exported</ code > < code > -f</ code > < code > {{.Export}} </ code > ,
279
279
but without the extra step.
280
280
</ p >
281
281
@@ -461,10 +461,10 @@ <h3 id="fs">File Systems</h3>
461
461
462
462
< p >
463
463
The new < a href ="/pkg/io/fs/ "> < code > io/fs</ code > </ a > package
464
- defines an abstraction for read-only trees of files ,
465
- the < a href =" /pkg/io/fs/#FS " > < code > fs.FS </ code > </ a > interface,
466
- and the standard library packages have
467
- been adapted to make use of the interface as appropriate.
464
+ defines the < a href =" /pkg/io/fs/#FS " > < code > fs.FS </ code > </ a > interface ,
465
+ an abstraction for read-only trees of files.
466
+ The standard library packages have been adapted to make use
467
+ of the interface as appropriate.
468
468
</ p >
469
469
470
470
< p >
@@ -499,6 +499,44 @@ <h3 id="fs">File Systems</h3>
499
499
implementations.
500
500
</ p >
501
501
502
+ < h3 id ="ioutil "> Deprecation of io/ioutil</ h3 >
503
+
504
+ < p >
505
+ The < a href ="/pkg/io/ioutil/ "> < code > io/ioutil</ code > </ a > package has
506
+ turned out to be a poorly defined and hard to understand collection
507
+ of things. All functionality provided by the package has been moved
508
+ to other packages. The < code > io/ioutil</ code > package remains and
509
+ will continue to work as before, but we encourage new code to use
510
+ the new definitions in the < a href ="/pkg/io/ "> < code > io</ code > </ a > and
511
+ < a href ="/pkg/os/ "> < code > os</ code > </ a > packages.
512
+
513
+ Here is a list of the new locations of the names exported
514
+ by < code > io/ioutil</ code > :
515
+ < ul >
516
+ < li > < a href ="/pkg/io/ioutil/#Discard "> < code > Discard</ code > </ a >
517
+ => < a href ="/pkg/io/#Discard "> < code > io.Discard</ code > </ a > </ li >
518
+ < li > < a href ="/pkg/io/ioutil/#NopCloser "> < code > NopCloser</ code > </ a >
519
+ => < a href ="/pkg/io/#NopCloser "> < code > io.NopCloser</ code > </ a > </ li >
520
+ < li > < a href ="/pkg/io/ioutil/#ReadAll "> < code > ReadAll</ code > </ a >
521
+ => < a href ="/pkg/io/#ReadAll "> < code > io.ReadAll</ code > </ a > </ li >
522
+ < li > < a href ="/pkg/io/ioutil/#ReadDir "> < code > ReadDir</ code > </ a >
523
+ => < a href ="/pkg/os/#ReadDir "> < code > os.ReadDir</ code > </ a >
524
+ (note: returns a slice of
525
+ < a href ="/pkg/os/#DirEntry "> < code > os.DirEntry</ code > </ a >
526
+ rather than a slice of
527
+ < a href ="/pkg/fs/#FileInfo "> < code > fs.FileInfo</ code > </ a > )
528
+ </ li >
529
+ < li > < a href ="/pkg/io/ioutil/#ReadFile "> < code > ReadFile</ code > </ a >
530
+ => < a href ="/pkg/os/#ReadFile "> < code > os.ReadFile</ code > </ a > </ li >
531
+ < li > < a href ="/pkg/io/ioutil/#TempDir "> < code > TempDir</ code > </ a >
532
+ => < a href ="/pkg/os/#MkdirTemp "> < code > os.MkdirTemp</ code > </ a > </ li >
533
+ < li > < a href ="/pkg/io/ioutil/#TempFile "> < code > TempFile</ code > </ a >
534
+ => < a href ="/pkg/os/#CreateTemp "> < code > os.CreateTemp</ code > </ a > </ li >
535
+ < li > < a href ="/pkg/io/ioutil/#WriteFile "> < code > WriteFile</ code > </ a >
536
+ => < a href ="/pkg/os/#WriteFile "> < code > os.WriteFile</ code > </ a > </ li >
537
+ </ ul >
538
+ </ p >
539
+
502
540
<!-- okay-after-beta1
503
541
TODO: decide if any additional changes are worth factoring out from
504
542
"Minor changes to the library" and highlighting in "Core library"
@@ -623,6 +661,14 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
623
661
method allows accessing the < a href ="/pkg/crypto/x509/#SystemRootsError.Err "> < code > Err</ code > </ a >
624
662
field through the < a href ="/pkg/errors "> < code > errors</ code > </ a > package functions.
625
663
</ p >
664
+
665
+ < p > <!-- CL 230025 -->
666
+ On Unix systems, the < code > crypto/x509</ code > package is now more
667
+ efficient in how it stores its copy of the system cert pool.
668
+ Programs that use only a small number of roots will use around a
669
+ half megabyte less memory.
670
+ </ p >
671
+
626
672
</ dd >
627
673
</ dl > <!-- crypto/x509 -->
628
674
@@ -685,6 +731,37 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
685
731
</ dd >
686
732
</ dl > <!-- flag -->
687
733
734
+ < dl id ="go/build "> < dt > < a href ="/pkg/go/build/ "> go/build</ a > </ dt >
735
+ < dd >
736
+ < p > <!-- CL 243941, CL 283636 -->
737
+ The < a href ="/pkg/go/build/#Package "> < code > Package</ code > </ a >
738
+ struct has new fields that report information
739
+ about < code > //go:embed</ code > directives in the package:
740
+ < a href ="/pkg/go/build/#Package.EmbedPatterns "> < code > EmbedPatterns</ code > </ a > ,
741
+ < a href ="/pkg/go/build/#Package.EmbedPatternPos "> < code > EmbedPatternPos</ code > </ a > ,
742
+ < a href ="/pkg/go/build/#Package.TestEmbedPatterns "> < code > TestEmbedPatterns</ code > </ a > ,
743
+ < a href ="/pkg/go/build/#Package.TestEmbedPatternPos "> < code > TestEmbedPatternPos</ code > </ a > ,
744
+ < a href ="/pkg/go/build/#Package.XTestEmbedPatterns "> < code > XTestEmbedPatterns</ code > </ a > ,
745
+ < a href ="/pkg/go/build/#Package.XTestEmbedPatternPos "> < code > XTestEmbedPatternPos</ code > </ a > .
746
+ </ p >
747
+
748
+ < p > <!-- CL 240551 -->
749
+ The < a href ="/pkg/go/build/#Package "> < code > Package</ code > </ a > field
750
+ < a href ="/pkg/go/build/#Package.IgnoredGoFiles "> < code > IgnoredGoFiles</ code > </ a >
751
+ will no longer include files that start with "_" or ".",
752
+ as those files are always ignored.
753
+ < code > IgnoredGoFiles</ code > is for files ignored because of
754
+ build constraints.
755
+ </ p >
756
+
757
+ < p > <!-- CL 240551 -->
758
+ The new < a href ="/pkg/go/build/#Package "> < code > Package</ code > </ a >
759
+ field < a href ="/pkg/go/build/#Package.IgnoredOtherFiles "> < code > IgnoredOtherFiles</ code > </ a >
760
+ has a list of non-Go files ignored because of build constraints.
761
+ </ p >
762
+ </ dd >
763
+ </ dl > <!-- go/build -->
764
+
688
765
< dl id ="html/template "> < dt > < a href ="/pkg/html/template/ "> html/template</ a > </ dt >
689
766
< dd >
690
767
< p > <!-- CL 243938 -->
@@ -703,6 +780,15 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
703
780
The package now defines a
704
781
< a href ="/pkg/io/#ReadSeekCloser "> < code > ReadSeekCloser</ code > </ a > interface.
705
782
</ p >
783
+
784
+ < p > <!-- CL 263141 -->
785
+ The package now defines
786
+ < a href ="/pkg/io/#Discard "> < code > Discard</ code > </ a > ,
787
+ < a href ="/pkg/io/#NopCloser "> < code > NopCloser</ code > </ a > , and
788
+ < a href ="/pkg/io/#ReadAll "> < code > ReadAll</ code > </ a > ,
789
+ to be used instead of the same names in the
790
+ < a href ="/pkg/io/ioutil/ "> < code > io/ioutil</ code > </ a > package.
791
+ </ p >
706
792
</ dd >
707
793
</ dl > <!-- io -->
708
794
@@ -857,6 +943,52 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
857
943
instead of the unexported < code > errFinished</ code > when the process has
858
944
already finished.
859
945
</ p >
946
+
947
+ < p > <!-- CL 261540 -->
948
+ The package defines a new type
949
+ < a href ="/pkg/os/#DirEntry "> < code > DirEntry</ code > </ a >
950
+ as an alias for < a href ="/pkg/io/fs/#DirEntry "> < code > fs.DirEntry</ code > </ a > .
951
+ The new < a href ="/pkg/os/#ReadDir "> < code > ReadDir</ code > </ a >
952
+ function and the new
953
+ < a href ="/pkg/os/#File.ReadDir "> < code > File.ReadDir</ code > </ a >
954
+ method can be used to read the contents of a directory into a
955
+ slice of < a href ="/pkg/os/#DirEntry "> < code > DirEntry</ code > </ a > .
956
+ The < a href ="/pkg/os/#File.Readdir "> < code > File.Readdir</ code > </ a >
957
+ method (note the lower case < code > d</ code > in < code > dir</ code > )
958
+ still exists, returning a slice of
959
+ < a href ="/pkg/os/#FileInfo "> < code > FileInfo</ code > </ a > , but for
960
+ most programs it will be more efficient to switch to
961
+ < a href ="/pkg/os/#File.ReadDir "> < code > File.ReadDir</ code > </ a > .
962
+ </ p >
963
+
964
+ < p > <!-- CL 263141 -->
965
+ The package now defines
966
+ < a href ="/pkg/os/#CreateTemp "> < code > CreateTemp</ code > </ a > ,
967
+ < a href ="/pkg/os/#MkdirTemp "> < code > MkdirTemp</ code > </ a > ,
968
+ < a href ="/pkg/os/#ReadFile "> < code > ReadFile</ code > </ a > , and
969
+ < a href ="/pkg/os/#WriteFile "> < code > WriteFile</ code > </ a > ,
970
+ to be used instead of functions defined in the
971
+ < a href ="/pkg/io/ioutil/ "> < code > io/ioutil</ code > </ a > package.
972
+ </ p >
973
+
974
+ < p > <!-- CL 243906 -->
975
+ The types < a href ="/pkg/os/#FileInfo "> < code > FileInfo</ code > </ a > ,
976
+ < a href ="/pkg/os/#FileMode "> < code > FileMode</ code > </ a > , and
977
+ < a href ="/pkg/os/#PathError "> < code > PathError</ code > </ a >
978
+ are now aliases for types of the same name in the
979
+ < a href ="/pkg/io/fs/ "> < code > io/fs</ code > </ a > package.
980
+ Function signatures in the < a href ="/pkg/os/ "> < code > os</ code > </ a >
981
+ package have been updated to refer to the names in the
982
+ < a href ="/pkg/io/fs/ "> < code > io/fs</ code > </ a > package.
983
+ This should not affect any existing code.
984
+ </ p >
985
+
986
+ < p > <!-- CL 243911 -->
987
+ The new < a href ="/pkg/os/#DirFS "> < code > DirFS</ code > </ a > function
988
+ provides an implementation of
989
+ < a href ="/pkg/io/fs/#FS "> < code > fs.FS</ code > </ a > backed by a tree
990
+ of operating system files.
991
+ </ p >
860
992
</ dd >
861
993
</ dl > <!-- os -->
862
994
@@ -887,9 +1019,9 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
887
1019
< dd >
888
1020
< p > <!-- CL 267887 -->
889
1021
The new function
890
- < a href ="/pkg/path/filepath/WalkDir "> < code > WalkDir</ code > </ a >
1022
+ < a href ="/pkg/path/filepath/# WalkDir "> < code > WalkDir</ code > </ a >
891
1023
is similar to
892
- < a href ="/pkg/path/filepath/Walk "> < code > Walk</ code > </ a > ,
1024
+ < a href ="/pkg/path/filepath/# Walk "> < code > Walk</ code > </ a > ,
893
1025
but is typically more efficient.
894
1026
The function passed to < code > WalkDir</ code > receives a
895
1027
< a href ="/pkg/io/fs/#DirEntry "> < code > fs.DirEntry</ code > </ a >
@@ -975,6 +1107,25 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
975
1107
</ dd >
976
1108
</ dl > <!-- syscall -->
977
1109
1110
+ < dl id ="testing/iotest "> < dt > < a href ="/pkg/testing/iotest/ "> testing/iotest</ a > </ dt >
1111
+ < dd >
1112
+ < p > <!-- CL 199501 -->
1113
+ The new
1114
+ < a href ="/pkg/testing/iotest/#ErrReader "> < code > ErrReader</ code > </ a >
1115
+ function returns an
1116
+ < a href ="/pkg/io/#Reader "> < code > io.Reader</ code > </ a > that always
1117
+ returns an error.
1118
+ </ p >
1119
+
1120
+ < p > <!-- CL 243909 -->
1121
+ The new
1122
+ < a href ="/pkg/testing/iotest/#TestReader "> < code > TestReader</ code > </ a >
1123
+ function tests that an < a href ="/pkg/io/#Reader "> < code > io.Reader</ code > </ a >
1124
+ behaves correctly.
1125
+ </ p >
1126
+ </ dd >
1127
+ </ dl > <!-- testing/iotest -->
1128
+
978
1129
< dl id ="text/template "> < dt > < a href ="/pkg/text/template/ "> text/template</ a > </ dt >
979
1130
< dd >
980
1131
< p > <!-- CL 254257, golang.org/issue/29770 -->
0 commit comments