fix golint comments warnings

This commit is contained in:
z7zmey 2018-01-12 08:23:58 +02:00
parent 8f874944e3
commit 7332ab1700
4 changed files with 10 additions and 0 deletions

View File

@ -2,12 +2,15 @@ package comment
import "github.com/z7zmey/php-parser/node" import "github.com/z7zmey/php-parser/node"
// Comment represents comment lines in the code
type Comment interface { type Comment interface {
String() string String() string
} }
// Comments a collection of comment groups assigned to nodes
type Comments map[node.Node][]Comment type Comments map[node.Node][]Comment
// AddComments add comment group to the collection
func (c Comments) AddComments(node node.Node, comments []Comment) { func (c Comments) AddComments(node node.Node, comments []Comment) {
c[node] = append(c[node], comments...) c[node] = append(c[node], comments...)
} }

View File

@ -1,9 +1,11 @@
package comment package comment
// DocComment represents comments that start /**
type DocComment struct { type DocComment struct {
value string value string
} }
// NewDocComment - DocComment constructor
func NewDocComment(value string) *DocComment { func NewDocComment(value string) *DocComment {
return &DocComment{ return &DocComment{
value, value,

View File

@ -1,9 +1,11 @@
package comment package comment
// PlainComment represents comments that dont start /**
type PlainComment struct { type PlainComment struct {
value string value string
} }
// NewPlainComment - PlainComment constructor
func NewPlainComment(value string) *PlainComment { func NewPlainComment(value string) *PlainComment {
return &PlainComment{ return &PlainComment{
value, value,

View File

@ -6,6 +6,7 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
// Position represents node position
type Position struct { type Position struct {
StartLine int StartLine int
EndLine int EndLine int
@ -17,8 +18,10 @@ func (p Position) String() string {
return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos) return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos)
} }
// Positions a collection of positions attached to nodes
type Positions map[node.Node]*Position type Positions map[node.Node]*Position
// AddPosition attaches a position to a node
func (p Positions) AddPosition(node node.Node, position *Position) { func (p Positions) AddPosition(node node.Node, position *Position) {
p[node] = position p[node] = position
} }