Skip to content

Commit f45305e

Browse files
authored
Merge pull request #16170 from owen-mc/go/add-comments-in-extractor
Go: Add comments in extractor with link to online documentation
2 parents 3db5601 + b4829ad commit f45305e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

go/extractor/extractor.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@ func extractUniverseScope() {
388388
}
389389

390390
// extractObjects extracts all objects declared in the given scope
391+
// For more information on objects, see:
392+
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
391393
func extractObjects(tw *trap.Writer, scope *types.Scope, scopeLabel trap.Label) {
392394
for _, name := range scope.Names() {
393395
obj := scope.Lookup(name)
@@ -440,6 +442,8 @@ func extractMethod(tw *trap.Writer, meth *types.Func) trap.Label {
440442
}
441443

442444
// extractObject extracts a single object and emits it to the objects table.
445+
// For more information on objects, see:
446+
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
443447
func extractObject(tw *trap.Writer, obj types.Object, lbl trap.Label) {
444448
name := obj.Name()
445449
isBuiltin := obj.Parent() == types.Universe
@@ -487,6 +491,8 @@ func extractObject(tw *trap.Writer, obj types.Object, lbl trap.Label) {
487491
}
488492

489493
// extractObjectTypes extracts type and receiver information for all objects
494+
// For more information on objects, see:
495+
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
490496
func extractObjectTypes(tw *trap.Writer) {
491497
// calling `extractType` on a named type will extract all methods defined
492498
// on it, which will add new objects. Therefore we need to do this first
@@ -497,11 +503,13 @@ func extractObjectTypes(tw *trap.Writer) {
497503
}
498504
changed = tw.ForEachObject(emitObjectType)
499505
if changed {
500-
log.Printf("Warning: more objects were labeled while emitted object types")
506+
log.Printf("Warning: more objects were labeled while emitting object types")
501507
}
502508
}
503509

504510
// extractObjectType extracts type and receiver information for a given object
511+
// For more information on objects, see:
512+
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
505513
func extractObjectType(tw *trap.Writer, obj types.Object, lbl trap.Label) {
506514
if tp := obj.Type(); tp != nil {
507515
extractType(tw, tp)

0 commit comments

Comments
 (0)