Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
fix-up-document-format
Browse files Browse the repository at this point in the history
Signed-off-by: chentanjun <[email protected]>
  • Loading branch information
tanjunchen committed Sep 16, 2019
1 parent 4079bf8 commit 28b9f15
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions beego
Submodule beego added at 8395a2
4 changes: 2 additions & 2 deletions pkg/dflog/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import (
// DefaultLogTimeFormat defines the timestamp format.
const DefaultLogTimeFormat = "2006-01-02 15:04:05.000"

// Option is a functional configuration for the given logrus logger
// Option is a functional configuration for the given logrus logger.
type Option func(l *logrus.Logger) error

// WithDebug sets the log level to debug
// WithDebug sets the log level to debug.
func WithDebug(debug bool) Option {
return func(l *logrus.Logger) error {
if debug {
Expand Down
4 changes: 2 additions & 2 deletions pkg/fileutils/fileutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func DeleteFiles(filePaths ...string) {
}
}

// OpenFile open a file. If the parent directory of the file isn't exist,
// OpenFile opens a file. If the parent directory of the file isn't exist,
// it will create the directory.
func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error) {
if PathExist(path) {
Expand Down Expand Up @@ -217,7 +217,7 @@ func GetSys(info os.FileInfo) (*syscall.Stat_t, bool) {
return sys, ok
}

// LoadYaml load yaml config file.
// LoadYaml loads yaml config file.
func LoadYaml(path string, out interface{}) error {
content, err := ioutil.ReadFile(path)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions pkg/httputils/http_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type defaultHTTPClient struct {

var _ SimpleHTTPClient = &defaultHTTPClient{}

// PostJSON send a POST request whose content-type is 'application/json;charset=utf-8'.
// PostJSON sends a POST request whose content-type is 'application/json;charset=utf-8'.
// When timeout <= 0, it will block until receiving response from server.
func (c *defaultHTTPClient) PostJSON(url string, body interface{}, timeout time.Duration) (
code int, resBody []byte, err error) {
Expand All @@ -99,7 +99,7 @@ func (c *defaultHTTPClient) Get(url string, timeout time.Duration) (
return fasthttp.Get(nil, url)
}

// PostJSONWithHeaders send a POST request with headers whose content-type is 'application/json;charset=utf-8'.
// PostJSONWithHeaders sends a POST request with headers whose content-type is 'application/json;charset=utf-8'.
// When timeout <= 0, it will block until receiving response from server.
func (c *defaultHTTPClient) PostJSONWithHeaders(url string, headers map[string]string, body interface{}, timeout time.Duration) (
code int, resBody []byte, err error) {
Expand Down Expand Up @@ -169,7 +169,7 @@ func do(url string, headers map[string]string, timeout time.Duration, rsf reques
// ---------------------------------------------------------------------------
// util functions

// PostJSON send a POST request whose content-type is 'application/json;charset=utf-8'.
// PostJSON sends a POST request whose content-type is 'application/json;charset=utf-8'.
func PostJSON(url string, body interface{}, timeout time.Duration) (int, []byte, error) {
return DefaultHTTPClient.PostJSON(url, body, timeout)
}
Expand All @@ -180,7 +180,7 @@ func Get(url string, timeout time.Duration) (int, []byte, error) {
return DefaultHTTPClient.Get(url, timeout)
}

// PostJSONWithHeaders send a POST request whose content-type is 'application/json;charset=utf-8'.
// PostJSONWithHeaders sends a POST request whose content-type is 'application/json;charset=utf-8'.
func PostJSONWithHeaders(url string, headers map[string]string, body interface{}, timeout time.Duration) (int, []byte, error) {
return DefaultHTTPClient.PostJSONWithHeaders(url, headers, body, timeout)
}
Expand Down Expand Up @@ -208,17 +208,17 @@ func Do(url string, headers map[string]string, timeout time.Duration) (string, e
return result, nil
}

// HTTPGet send an HTTP GET request with headers.
// HTTPGet sends an HTTP GET request with headers.
func HTTPGet(url string, headers map[string]string) (*http.Response, error) {
return HTTPWithHeaders("GET", url, headers, 0)
}

// HTTPGetTimeout send an HTTP GET request with timeout.
// HTTPGetTimeout sends an HTTP GET request with timeout.
func HTTPGetTimeout(url string, headers map[string]string, timeout time.Duration) (*http.Response, error) {
return HTTPWithHeaders("GET", url, headers, timeout)
}

// HTTPWithHeaders send an HTTP request with headers and specified method.
// HTTPWithHeaders sends an HTTP request with headers and specified method.
func HTTPWithHeaders(method, url string, headers map[string]string, timeout time.Duration) (*http.Response, error) {
req, err := http.NewRequest(method, url, nil)
if err != nil {
Expand Down

0 comments on commit 28b9f15

Please sign in to comment.