Browse Source

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 6 years ago
parent
commit
e84dfd68c1

+ 1
- 1
internal/driver/cli.go View File

39
 	Comment      string
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
 // and returns the source of the profile and optionally the command
43
 // and returns the source of the profile and optionally the command
44
 // for the kind of report to generate (nil for interactive use).
44
 // for the kind of report to generate (nil for interactive use).
45
 func parseFlags(o *plugin.Options) (*source, []string, error) {
45
 func parseFlags(o *plugin.Options) (*source, []string, error) {

+ 1
- 1
internal/driver/driver_test.go View File

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
 // graph and flame views.
534
 // graph and flame views.
535
 func longNameFuncsProfile() *profile.Profile {
535
 func longNameFuncsProfile() *profile.Profile {
536
 	var longNameFuncsM = []*profile.Mapping{
536
 	var longNameFuncsM = []*profile.Mapping{

+ 1
- 1
internal/driver/interactive.go View File

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
 func matchVariableOrCommand(v variables, token string) string {
411
 func matchVariableOrCommand(v variables, token string) string {
412
 	token = strings.ToLower(token)
412
 	token = strings.ToLower(token)
413
 	found := ""
413
 	found := ""

+ 1
- 1
internal/graph/graph_test.go View File

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
 func TestCreateNodes(t *testing.T) {
397
 func TestCreateNodes(t *testing.T) {
398
 	testProfile := nodeTestProfile()
398
 	testProfile := nodeTestProfile()
399
 	wantNodeSet := NodeSet{
399
 	wantNodeSet := NodeSet{

+ 1
- 1
internal/symbolz/symbolz.go View File

68
 	return nil
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
 // pprof_remote_servers.html from the gperftools distribution
72
 // pprof_remote_servers.html from the gperftools distribution
73
 func hasGperftoolsSuffix(path string) bool {
73
 func hasGperftoolsSuffix(path string) bool {
74
 	suffixes := []string{
74
 	suffixes := []string{

+ 3
- 3
pprof.go View File

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
 // prompt is printed before reading the command.
57
 // prompt is printed before reading the command.
58
 func (r *readlineUI) ReadLine(prompt string) (string, error) {
58
 func (r *readlineUI) ReadLine(prompt string) (string, error) {
59
 	r.rl.SetPrompt(prompt)
59
 	r.rl.SetPrompt(prompt)
70
 	fmt.Fprint(r.rl.Stderr(), text)
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
 // It is printed over stderr as stdout is reserved for regular output.
74
 // It is printed over stderr as stdout is reserved for regular output.
75
 func (r *readlineUI) PrintErr(args ...interface{}) {
75
 func (r *readlineUI) PrintErr(args ...interface{}) {
76
 	text := fmt.Sprint(args...)
76
 	text := fmt.Sprint(args...)
97
 	return readline.IsTerminal(int(syscall.Stdout))
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
 func (r *readlineUI) WantBrowser() bool {
101
 func (r *readlineUI) WantBrowser() bool {
102
 	return r.IsTerminal()
102
 	return r.IsTerminal()
103
 }
103
 }

+ 1
- 1
profile/profile.go View File

652
 	return strings.Join(ls, " ")
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
 // representing numeric labels.
656
 // representing numeric labels.
657
 func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
657
 func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
658
 	ls := []string{}
658
 	ls := []string{}

+ 1
- 1
profile/profile_test.go View File

628
 	return nil
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
 func TestMergeMain(t *testing.T) {
632
 func TestMergeMain(t *testing.T) {
633
 	prof := testProfile1.Copy()
633
 	prof := testProfile1.Copy()
634
 	p1, err := Merge([]*Profile{prof})
634
 	p1, err := Merge([]*Profile{prof})