*: add/fix godoc comments to satisfy golint
Fixes things like: * exported type/method/function X should have comment or be unexported * comment on exported type/method/function X should be of the form "X ..." (with optional leading article) Refs. #213.
This commit is contained in:
parent
de84e074a2
commit
a9b9c9226d
47 changed files with 89 additions and 20 deletions
|
@ -17,10 +17,12 @@ const (
|
|||
breakState
|
||||
)
|
||||
|
||||
// HasFlag check for State flag presence.
|
||||
func (s State) HasFlag(f State) bool {
|
||||
return s&f != 0
|
||||
}
|
||||
|
||||
// String implements the stringer interface.
|
||||
func (s State) String() string {
|
||||
if s == noneState {
|
||||
return "NONE"
|
||||
|
@ -39,6 +41,7 @@ func (s State) String() string {
|
|||
return strings.Join(ss, ", ")
|
||||
}
|
||||
|
||||
// StateFromString converts string into the VM State.
|
||||
func StateFromString(s string) (st State, err error) {
|
||||
if s = strings.TrimSpace(s); s == "NONE" {
|
||||
return noneState, nil
|
||||
|
@ -60,10 +63,12 @@ func StateFromString(s string) (st State, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface
|
||||
func (s State) MarshalJSON() (data []byte, err error) {
|
||||
return []byte(`"` + s.String() + `"`), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Marshaler interface
|
||||
func (s *State) UnmarshalJSON(data []byte) (err error) {
|
||||
l := len(data)
|
||||
if l < 2 || data[0] != '"' || data[l-1] != '"' {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue