Skip to content

Commit

Permalink
💡 chore: add package comment or exported var comment
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Dec 10, 2022
1 parent c38e08e commit 6ace647
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 9 deletions.
7 changes: 5 additions & 2 deletions cliutil/termctrl/keyboard.go
Expand Up @@ -74,5 +74,8 @@ const (
KeyAlt = ' '
)

var PasteStart = []byte{KeyEscape, '[', '2', '0', '0', '~'}
var PasteEnd = []byte{KeyEscape, '[', '2', '0', '1', '~'}
// special chars on paste start or end
var (
PasteStart = []byte{KeyEscape, '[', '2', '0', '0', '~'}
PasteEnd = []byte{KeyEscape, '[', '2', '0', '1', '~'}
)
2 changes: 2 additions & 0 deletions cliutil/termctrl/termctrl.go
@@ -0,0 +1,2 @@
// Package termctrl provide some simple term control utils
package termctrl
1 change: 1 addition & 0 deletions envutil/envutil.go
@@ -1,3 +1,4 @@
// Package envutil provide some commonly ENV util functions.
package envutil

import (
Expand Down
2 changes: 2 additions & 0 deletions errorx/errors.go
Expand Up @@ -110,6 +110,8 @@ func (e ErrMap) One() error {

// Errors multi error list
type Errors []error

// ErrList alias for Errors
type ErrList = Errors

// Error string
Expand Down
4 changes: 3 additions & 1 deletion fsutil/check.go
Expand Up @@ -6,12 +6,14 @@ import (
"path"
)

// perm for create dir or file
var (
// DefaultDirPerm perm and flags for create log file
DefaultDirPerm os.FileMode = 0775
DefaultFilePerm os.FileMode = 0665
OnlyReadFilePerm os.FileMode = 0444
)

var (
// DefaultFileFlags for create and write
DefaultFileFlags = os.O_CREATE | os.O_WRONLY | os.O_APPEND
// OnlyReadFileFlags open file for read
Expand Down
1 change: 1 addition & 0 deletions mathutil/mathutil.go
@@ -1,3 +1,4 @@
// Package mathutil provide math(int, number) util functions. eg: convert, math calc, random
package mathutil

import "math"
Expand Down
2 changes: 1 addition & 1 deletion netutil/httpctype/content_type.go
Expand Up @@ -3,7 +3,7 @@ package httpctype

const Key = "Content-Type"

// HTTP Content-Type with charset of the most common data formats.
// there are some HTTP Content-Type with charset of the most common data formats.
const (
CSS = "text/css; charset=utf-8"
HTML = "text/html; charset=utf-8"
Expand Down
2 changes: 1 addition & 1 deletion netutil/httpctype/mime_type.go
@@ -1,6 +1,6 @@
package httpctype

// Content-Type MIME of the most common data formats.
// there are some Content-Type MIME of the most common data formats.
const (
MIMEHTML = "text/html"
MIMEText = "text/plain" // equals MIMEPlain
Expand Down
8 changes: 4 additions & 4 deletions netutil/httpreq/response.go
Expand Up @@ -77,10 +77,10 @@ func (r *Resp) BodyBuffer() *bytes.Buffer {
return buf
}

// BindJsonOnOk body data on status is 200
// BindJSONOnOk body data on status is 200
//
// NOTICE: must close resp body.
func (r *Resp) BindJsonOnOk(ptr any) error {
func (r *Resp) BindJSONOnOk(ptr any) error {
// NOTICE: must close resp body.
defer r.QuiteCloseBody()

Expand All @@ -96,10 +96,10 @@ func (r *Resp) BindJsonOnOk(ptr any) error {
return json.NewDecoder(r.Body).Decode(ptr)
}

// BindJson body data to a ptr
// BindJSON body data to a ptr
//
// NOTICE: must close resp body.
func (r *Resp) BindJson(ptr any) error {
func (r *Resp) BindJSON(ptr any) error {
// NOTICE: must close resp body.
defer r.QuiteCloseBody()

Expand Down
1 change: 1 addition & 0 deletions sysutil/cmdr/runner.go
Expand Up @@ -24,6 +24,7 @@ type Task struct {
PrevCond func(prev *Task) bool
}

// NewTask instance
func NewTask(cmd *Cmd) *Task {
return &Task{
Cmd: cmd,
Expand Down

0 comments on commit 6ace647

Please sign in to comment.