Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit b746b36

Browse files
Bugfix: Resolve source line link offset
`godoc` always subtracted 10 from the the line number which results in the wrong line being linked to. Copies the code from `godoc` to remove the single line to fix the formatting issue. Enables the source link hash to be configurable to support source control platforms other than Github. The default value remains the same as before but is now configurable for other platforms. Regenerate examples to verify the only changes are due to fix applied as part of this commit.
1 parent 543cd3c commit b746b36

File tree

5 files changed

+120
-83
lines changed

5 files changed

+120
-83
lines changed

examples/build/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ ToolDir is the directory containing build tools.
216216

217217

218218

219-
## <a name="ArchChar">func</a> [ArchChar](/src/target/build.go?s=45435:45479#L1553)
219+
## <a name="ArchChar">func</a> [ArchChar](/src/target/build.go?s=45435:45479#L1563)
220220
``` go
221221
func ArchChar(goarch string) (string, error)
222222
```
@@ -228,7 +228,7 @@ no longer vary by architecture; they are compile, link, .o, and a.out, respectiv
228228

229229

230230

231-
## <a name="IsLocalImport">func</a> [IsLocalImport](/src/target/build.go?s=44955:44991#L1543)
231+
## <a name="IsLocalImport">func</a> [IsLocalImport](/src/target/build.go?s=44955:44991#L1553)
232232
``` go
233233
func IsLocalImport(path string) bool
234234
```
@@ -238,7 +238,7 @@ a local import path, like ".", "..", "./foo", or "../foo".
238238

239239

240240

241-
## <a name="Context">type</a> [Context](/src/target/build.go?s=450:3568#L20)
241+
## <a name="Context">type</a> [Context](/src/target/build.go?s=450:3568#L30)
242242
``` go
243243
type Context struct {
244244
GOARCH string // target architecture
@@ -321,7 +321,7 @@ if set, or else the compiled code's GOARCH, GOOS, and GOROOT.
321321

322322

323323

324-
### <a name="Context.Import">func</a> (\*Context) [Import](/src/target/build.go?s=16697:16787#L476)
324+
### <a name="Context.Import">func</a> (\*Context) [Import](/src/target/build.go?s=16697:16787#L486)
325325
``` go
326326
func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Package, error)
327327
```
@@ -345,7 +345,7 @@ If an error occurs, Import returns a non-nil error and a non-nil
345345

346346

347347

348-
### <a name="Context.ImportDir">func</a> (\*Context) [ImportDir](/src/target/build.go?s=14860:14937#L424)
348+
### <a name="Context.ImportDir">func</a> (\*Context) [ImportDir](/src/target/build.go?s=14860:14937#L434)
349349
``` go
350350
func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error)
351351
```
@@ -355,7 +355,7 @@ the named directory.
355355

356356

357357

358-
### <a name="Context.MatchFile">func</a> (\*Context) [MatchFile](/src/target/build.go?s=30989:31061#L1022)
358+
### <a name="Context.MatchFile">func</a> (\*Context) [MatchFile](/src/target/build.go?s=30989:31061#L1032)
359359
``` go
360360
func (ctxt *Context) MatchFile(dir, name string) (match bool, err error)
361361
```
@@ -369,7 +369,7 @@ read some or all of the file's content.
369369

370370

371371

372-
### <a name="Context.SrcDirs">func</a> (\*Context) [SrcDirs](/src/target/build.go?s=7522:7561#L228)
372+
### <a name="Context.SrcDirs">func</a> (\*Context) [SrcDirs](/src/target/build.go?s=7522:7561#L238)
373373
``` go
374374
func (ctxt *Context) SrcDirs() []string
375375
```
@@ -380,7 +380,7 @@ that do not exist.
380380

381381

382382

383-
## <a name="ImportMode">type</a> [ImportMode](/src/target/build.go?s=9780:9800#L315)
383+
## <a name="ImportMode">type</a> [ImportMode](/src/target/build.go?s=9780:9800#L325)
384384
``` go
385385
type ImportMode uint
386386
```
@@ -441,7 +441,7 @@ const (
441441

442442

443443

444-
## <a name="MultiplePackageError">type</a> [MultiplePackageError](/src/target/build.go?s=15413:15621#L441)
444+
## <a name="MultiplePackageError">type</a> [MultiplePackageError](/src/target/build.go?s=15413:15621#L451)
445445
``` go
446446
type MultiplePackageError struct {
447447
Dir string // directory containing files
@@ -461,14 +461,14 @@ multiple buildable Go source files for multiple packages.
461461

462462

463463

464-
### <a name="MultiplePackageError.Error">func</a> (\*MultiplePackageError) [Error](/src/target/build.go?s=15623:15668#L447)
464+
### <a name="MultiplePackageError.Error">func</a> (\*MultiplePackageError) [Error](/src/target/build.go?s=15623:15668#L457)
465465
``` go
466466
func (e *MultiplePackageError) Error() string
467467
```
468468

469469

470470

471-
## <a name="NoGoError">type</a> [NoGoError](/src/target/build.go?s=15165:15202#L431)
471+
## <a name="NoGoError">type</a> [NoGoError](/src/target/build.go?s=15165:15202#L441)
472472
``` go
473473
type NoGoError struct {
474474
Dir string
@@ -487,14 +487,14 @@ test files, files hidden by build tags, and so on.)
487487

488488

489489

490-
### <a name="NoGoError.Error">func</a> (\*NoGoError) [Error](/src/target/build.go?s=15204:15238#L435)
490+
### <a name="NoGoError.Error">func</a> (\*NoGoError) [Error](/src/target/build.go?s=15204:15238#L445)
491491
``` go
492492
func (e *NoGoError) Error() string
493493
```
494494

495495

496496

497-
## <a name="Package">type</a> [Package](/src/target/build.go?s=11686:14547#L362)
497+
## <a name="Package">type</a> [Package](/src/target/build.go?s=11686:14547#L372)
498498
``` go
499499
type Package struct {
500500
Dir string // directory containing package sources
@@ -557,14 +557,14 @@ A Package describes the Go package found in a directory.
557557

558558

559559

560-
### <a name="Import">func</a> [Import](/src/target/build.go?s=33366:33433#L1107)
560+
### <a name="Import">func</a> [Import](/src/target/build.go?s=33366:33433#L1117)
561561
``` go
562562
func Import(path, srcDir string, mode ImportMode) (*Package, error)
563563
```
564564
Import is shorthand for Default.Import.
565565

566566

567-
### <a name="ImportDir">func</a> [ImportDir](/src/target/build.go?s=33531:33592#L1112)
567+
### <a name="ImportDir">func</a> [ImportDir](/src/target/build.go?s=33531:33592#L1122)
568568
``` go
569569
func ImportDir(dir string, mode ImportMode) (*Package, error)
570570
```
@@ -574,7 +574,7 @@ ImportDir is shorthand for Default.ImportDir.
574574

575575

576576

577-
### <a name="Package.IsCommand">func</a> (\*Package) [IsCommand](/src/target/build.go?s=14705:14739#L418)
577+
### <a name="Package.IsCommand">func</a> (\*Package) [IsCommand](/src/target/build.go?s=14705:14739#L428)
578578
``` go
579579
func (p *Package) IsCommand() bool
580580
```

examples/fs/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Package fs provides filesystem-related functions.
3535

3636

3737

38-
## <a name="FileSystem">type</a> [FileSystem](/src/target/filesystem.go?s=121:774#L1)
38+
## <a name="FileSystem">type</a> [FileSystem](/src/target/filesystem.go?s=121:774#L10)
3939
``` go
4040
type FileSystem interface {
4141

@@ -67,7 +67,7 @@ FileSystem defines the methods of an abstract filesystem.
6767

6868

6969

70-
## <a name="Walker">type</a> [Walker](/src/target/walk.go?s=494:580#L5)
70+
## <a name="Walker">type</a> [Walker](/src/target/walk.go?s=494:580#L15)
7171
``` go
7272
type Walker struct {
7373
// contains filtered or unexported fields
@@ -87,14 +87,14 @@ Walker does not follow symbolic links.
8787

8888

8989

90-
### <a name="Walk">func</a> [Walk](/src/target/walk.go?s=692:722#L19)
90+
### <a name="Walk">func</a> [Walk](/src/target/walk.go?s=692:722#L29)
9191
``` go
9292
func Walk(root string) *Walker
9393
```
9494
Walk returns a new Walker rooted at root.
9595

9696

97-
### <a name="WalkFS">func</a> [WalkFS](/src/target/walk.go?s=826:873#L24)
97+
### <a name="WalkFS">func</a> [WalkFS](/src/target/walk.go?s=826:873#L34)
9898
``` go
9999
func WalkFS(root string, fs FileSystem) *Walker
100100
```
@@ -104,7 +104,7 @@ WalkFS returns a new Walker rooted at root on the FileSystem fs.
104104

105105

106106

107-
### <a name="Walker.Err">func</a> (\*Walker) [Err](/src/target/walk.go?s=2325:2353#L77)
107+
### <a name="Walker.Err">func</a> (\*Walker) [Err](/src/target/walk.go?s=2325:2353#L87)
108108
``` go
109109
func (w *Walker) Err() error
110110
```
@@ -115,7 +115,7 @@ an error, w will not descend into that directory.
115115

116116

117117

118-
### <a name="Walker.Path">func</a> (\*Walker) [Path](/src/target/walk.go?s=1946:1976#L64)
118+
### <a name="Walker.Path">func</a> (\*Walker) [Path](/src/target/walk.go?s=1946:1976#L74)
119119
``` go
120120
func (w *Walker) Path() string
121121
```
@@ -127,7 +127,7 @@ a directory containing the file "a", Path will return "dir/a".
127127

128128

129129

130-
### <a name="Walker.SkipDir">func</a> (\*Walker) [SkipDir](/src/target/walk.go?s=2496:2522#L83)
130+
### <a name="Walker.SkipDir">func</a> (\*Walker) [SkipDir](/src/target/walk.go?s=2496:2522#L93)
131131
``` go
132132
func (w *Walker) SkipDir()
133133
```
@@ -137,7 +137,7 @@ If w is not on a directory, SkipDir has no effect.
137137

138138

139139

140-
### <a name="Walker.Stat">func</a> (\*Walker) [Stat](/src/target/walk.go?s=2090:2125#L70)
140+
### <a name="Walker.Stat">func</a> (\*Walker) [Stat](/src/target/walk.go?s=2090:2125#L80)
141141
``` go
142142
func (w *Walker) Stat() os.FileInfo
143143
```
@@ -147,7 +147,7 @@ visited by a call to Step.
147147

148148

149149

150-
### <a name="Walker.Step">func</a> (\*Walker) [Step](/src/target/walk.go?s=1176:1204#L36)
150+
### <a name="Walker.Step">func</a> (\*Walker) [Step](/src/target/walk.go?s=1176:1204#L46)
151151
``` go
152152
func (w *Walker) Step() bool
153153
```

0 commit comments

Comments
 (0)