Procházet zdrojové kódy

Fix comments according to best practices by effective go (#446)

Fix comments according to best practices by effective go

Signed-off-by: CodeLingo Bot <bot@codelingo.io>
CodeLingo Bot před 6 roky
rodič
revize
e84dfd68c1

+ 1
- 1
internal/driver/cli.go Zobrazit soubor

@@ -39,7 +39,7 @@ type source struct {
39 39
 	Comment      string
40 40
 }
41 41
 
42
-// Parse parses the command lines through the specified flags package
42
+// parseFlags parses the command lines through the specified flags package
43 43
 // and returns the source of the profile and optionally the command
44 44
 // for the kind of report to generate (nil for interactive use).
45 45
 func parseFlags(o *plugin.Options) (*source, []string, error) {

+ 1
- 1
internal/driver/driver_test.go Zobrazit soubor

@@ -530,7 +530,7 @@ func fakeDemangler(name string) string {
530 530
 	}
531 531
 }
532 532
 
533
-// Returns a profile with function names which should be shortened in
533
+// longNameFuncsProfile returns a profile with function names which should be shortened in
534 534
 // graph and flame views.
535 535
 func longNameFuncsProfile() *profile.Profile {
536 536
 	var longNameFuncsM = []*profile.Mapping{

+ 1
- 1
internal/driver/interactive.go Zobrazit soubor

@@ -407,7 +407,7 @@ func newCompleter(fns []string) func(string) string {
407 407
 	}
408 408
 }
409 409
 
410
-// matchCommand attempts to match a string token to the prefix of a Command.
410
+// matchVariableOrCommand attempts to match a string token to the prefix of a Command.
411 411
 func matchVariableOrCommand(v variables, token string) string {
412 412
 	token = strings.ToLower(token)
413 413
 	found := ""

+ 1
- 1
internal/graph/graph_test.go Zobrazit soubor

@@ -393,7 +393,7 @@ func nodeTestProfile() *profile.Profile {
393 393
 	}
394 394
 }
395 395
 
396
-// Check that nodes are properly created for a simple profile.
396
+// TestCreateNodes checks that nodes are properly created for a simple profile.
397 397
 func TestCreateNodes(t *testing.T) {
398 398
 	testProfile := nodeTestProfile()
399 399
 	wantNodeSet := NodeSet{

+ 1
- 1
internal/symbolz/symbolz.go Zobrazit soubor

@@ -68,7 +68,7 @@ func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, sy
68 68
 	return nil
69 69
 }
70 70
 
71
-// Check whether path ends with one of the suffixes listed in
71
+// hasGperftoolsSuffix checks whether path ends with one of the suffixes listed in
72 72
 // pprof_remote_servers.html from the gperftools distribution
73 73
 func hasGperftoolsSuffix(path string) bool {
74 74
 	suffixes := []string{

+ 3
- 3
pprof.go Zobrazit soubor

@@ -53,7 +53,7 @@ func newUI() driver.UI {
53 53
 	}
54 54
 }
55 55
 
56
-// Read returns a line of text (a command) read from the user.
56
+// ReadLine returns a line of text (a command) read from the user.
57 57
 // prompt is printed before reading the command.
58 58
 func (r *readlineUI) ReadLine(prompt string) (string, error) {
59 59
 	r.rl.SetPrompt(prompt)
@@ -70,7 +70,7 @@ func (r *readlineUI) Print(args ...interface{}) {
70 70
 	fmt.Fprint(r.rl.Stderr(), text)
71 71
 }
72 72
 
73
-// Print shows a message to the user, colored in red for emphasis.
73
+// PrintErr shows a message to the user, colored in red for emphasis.
74 74
 // It is printed over stderr as stdout is reserved for regular output.
75 75
 func (r *readlineUI) PrintErr(args ...interface{}) {
76 76
 	text := fmt.Sprint(args...)
@@ -97,7 +97,7 @@ func (r *readlineUI) IsTerminal() bool {
97 97
 	return readline.IsTerminal(int(syscall.Stdout))
98 98
 }
99 99
 
100
-// Start a browser on interactive mode.
100
+// WantBrowser starts a browser on interactive mode.
101 101
 func (r *readlineUI) WantBrowser() bool {
102 102
 	return r.IsTerminal()
103 103
 }

+ 1
- 1
profile/profile.go Zobrazit soubor

@@ -652,7 +652,7 @@ func labelsToString(labels map[string][]string) string {
652 652
 	return strings.Join(ls, " ")
653 653
 }
654 654
 
655
-// numLablesToString returns a string representation of a map
655
+// numLabelsToString returns a string representation of a map
656 656
 // representing numeric labels.
657 657
 func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
658 658
 	ls := []string{}

+ 1
- 1
profile/profile_test.go Zobrazit soubor

@@ -628,7 +628,7 @@ func checkAggregation(prof *Profile, a *aggTest) error {
628 628
 	return nil
629 629
 }
630 630
 
631
-// Test merge leaves the main binary in place.
631
+// TestMergeMain tests merge leaves the main binary in place.
632 632
 func TestMergeMain(t *testing.T) {
633 633
 	prof := testProfile1.Copy()
634 634
 	p1, err := Merge([]*Profile{prof})