Skip to content

Commit e84dfd6

Browse files
CodeLingoBotaalexand
authored andcommitted
Fix comments according to best practices by effective go (google#446)
Fix comments according to best practices by effective go Signed-off-by: CodeLingo Bot <[email protected]>
1 parent 985cf9b commit e84dfd6

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

internal/driver/cli.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type source struct {
3939
Comment string
4040
}
4141

42-
// Parse parses the command lines through the specified flags package
42+
// parseFlags parses the command lines through the specified flags package
4343
// and returns the source of the profile and optionally the command
4444
// for the kind of report to generate (nil for interactive use).
4545
func parseFlags(o *plugin.Options) (*source, []string, error) {

internal/driver/driver_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ func fakeDemangler(name string) string {
530530
}
531531
}
532532

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

internal/driver/interactive.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func newCompleter(fns []string) func(string) string {
407407
}
408408
}
409409

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

internal/graph/graph_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func nodeTestProfile() *profile.Profile {
393393
}
394394
}
395395

396-
// Check that nodes are properly created for a simple profile.
396+
// TestCreateNodes checks that nodes are properly created for a simple profile.
397397
func TestCreateNodes(t *testing.T) {
398398
testProfile := nodeTestProfile()
399399
wantNodeSet := NodeSet{

internal/symbolz/symbolz.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, sy
6868
return nil
6969
}
7070

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
7272
// pprof_remote_servers.html from the gperftools distribution
7373
func hasGperftoolsSuffix(path string) bool {
7474
suffixes := []string{

pprof.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func newUI() driver.UI {
5353
}
5454
}
5555

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.
5757
// prompt is printed before reading the command.
5858
func (r *readlineUI) ReadLine(prompt string) (string, error) {
5959
r.rl.SetPrompt(prompt)
@@ -70,7 +70,7 @@ func (r *readlineUI) Print(args ...interface{}) {
7070
fmt.Fprint(r.rl.Stderr(), text)
7171
}
7272

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.
7474
// It is printed over stderr as stdout is reserved for regular output.
7575
func (r *readlineUI) PrintErr(args ...interface{}) {
7676
text := fmt.Sprint(args...)
@@ -97,7 +97,7 @@ func (r *readlineUI) IsTerminal() bool {
9797
return readline.IsTerminal(int(syscall.Stdout))
9898
}
9999

100-
// Start a browser on interactive mode.
100+
// WantBrowser starts a browser on interactive mode.
101101
func (r *readlineUI) WantBrowser() bool {
102102
return r.IsTerminal()
103103
}

profile/profile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ func labelsToString(labels map[string][]string) string {
652652
return strings.Join(ls, " ")
653653
}
654654

655-
// numLablesToString returns a string representation of a map
655+
// numLabelsToString returns a string representation of a map
656656
// representing numeric labels.
657657
func numLabelsToString(numLabels map[string][]int64, numUnits map[string][]string) string {
658658
ls := []string{}

profile/profile_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func checkAggregation(prof *Profile, a *aggTest) error {
628628
return nil
629629
}
630630

631-
// Test merge leaves the main binary in place.
631+
// TestMergeMain tests merge leaves the main binary in place.
632632
func TestMergeMain(t *testing.T) {
633633
prof := testProfile1.Copy()
634634
p1, err := Merge([]*Profile{prof})

0 commit comments

Comments
 (0)