aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-06-30 14:18:02 -0400
committerGopher Robot <gobot@golang.org>2022-06-30 19:32:09 +0000
commit4914e4e334b33cd823a770bd5860f525aad44c61 (patch)
treee4b2715b128d1b0989a84fd12a4cdaebe2550935
parent981d5947aff1551a1c0787664b77c4ac1e8f6c6a (diff)
downloadgo-4914e4e334b33cd823a770bd5860f525aad44c61.tar.gz
go-4914e4e334b33cd823a770bd5860f525aad44c61.zip
cmd/go/internal/modindex: remove spurious field from index_format documentation
The 'path' field was removed in an earlier revision to the format. While auditing the format, I also cleaned up a couple of minor typographical issues. For #53586. Change-Id: I4cd1ce9e970023441c11244428ed2971be1d8138 Reviewed-on: https://go-review.googlesource.com/c/go/+/415514 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--src/cmd/go/internal/modindex/index_format.txt7
-rw-r--r--src/cmd/go/internal/modindex/read.go6
-rw-r--r--src/cmd/go/internal/modindex/scan.go2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/cmd/go/internal/modindex/index_format.txt b/src/cmd/go/internal/modindex/index_format.txt
index c74b1d458b..a593391f7e 100644
--- a/src/cmd/go/internal/modindex/index_format.txt
+++ b/src/cmd/go/internal/modindex/index_format.txt
@@ -16,15 +16,14 @@ dirnames [n]uint32 - offsets to package names in string table; names sorted by r
packages [n]uint32 - offset where package begins
for each RawPackage:
error uint32 - string offset // error is produced by fsys.ReadDir or fmt.Errorf
- path uint32 - string offset
dir uint32 - string offset (directory path relative to module root)
len(sourceFiles) uint32
sourceFiles [n]uint32 - offset to source file (relative to start of index file)
for each sourceFile:
error - string offset // error is either produced by fmt.Errorf,errors.New or is io.EOF
parseError - string offset // if non-empty, a json-encoded parseError struct (see below). Is either produced by io.ReadAll,os.ReadFile,errors.New or is scanner.Error,scanner.ErrorList
- name - string offset
synopsis - string offset
+ name - string offset
pkgName - string offset
ignoreFile - int32 bool // report the file in Ignored(Go|Other)Files because there was an error reading it or parsing its build constraints.
binaryOnly uint32 bool
@@ -47,7 +46,7 @@ The following is the format for a single indexed package:
“go index v0\n”
str uint32 - offset of string table
for the single RawPackage:
- [same RawPackage format as above]
+ [same RawPackage format as above]
[string table]
The following is the definition of the json-serialized parseError struct:
@@ -55,4 +54,4 @@ The following is the definition of the json-serialized parseError struct:
type parseError struct {
ErrorList *scanner.ErrorList // non-nil if the error was an ErrorList, nil otherwise
ErrorString string // non-empty for all other cases
-} \ No newline at end of file
+}
diff --git a/src/cmd/go/internal/modindex/read.go b/src/cmd/go/internal/modindex/read.go
index 2603ade0fb..7ee4669e67 100644
--- a/src/cmd/go/internal/modindex/read.go
+++ b/src/cmd/go/internal/modindex/read.go
@@ -856,12 +856,12 @@ func (sf *sourceFile) error() string {
func (sf *sourceFile) parseError() string {
return sf.od.stringAt(sourceFileParseError)
}
-func (sf *sourceFile) name() string {
- return sf.od.stringAt(sourceFileName)
-}
func (sf *sourceFile) synopsis() string {
return sf.od.stringAt(sourceFileSynopsis)
}
+func (sf *sourceFile) name() string {
+ return sf.od.stringAt(sourceFileName)
+}
func (sf *sourceFile) pkgName() string {
return sf.od.stringAt(sourceFilePkgName)
}
diff --git a/src/cmd/go/internal/modindex/scan.go b/src/cmd/go/internal/modindex/scan.go
index eb84bf8d89..1ba7c0cad1 100644
--- a/src/cmd/go/internal/modindex/scan.go
+++ b/src/cmd/go/internal/modindex/scan.go
@@ -56,7 +56,7 @@ func indexModule(modroot string) ([]byte, error) {
return nil
}
if !str.HasFilePathPrefix(path, modroot) {
- panic(fmt.Errorf("path %v in walk doesn't have modroot %v as prefix:", path, modroot))
+ panic(fmt.Errorf("path %v in walk doesn't have modroot %v as prefix", path, modroot))
}
rel := str.TrimFilePathPrefix(path, modroot)
packages = append(packages, importRaw(modroot, rel))