mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
refactor trivial objects in favor of arguments to static functions
This commit is contained in:
+6
-1
@@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -22,6 +23,7 @@ import (
|
||||
var log = logging.MustGetLogger("figtree")
|
||||
|
||||
type FigTree struct {
|
||||
ConfigDir string
|
||||
Defaults interface{}
|
||||
EnvPrefix string
|
||||
stop bool
|
||||
@@ -44,7 +46,10 @@ func LoadConfig(configFile string, options interface{}) error {
|
||||
func (f *FigTree) LoadAllConfigs(configFile string, options interface{}) error {
|
||||
// reset from any previous config parsing runs
|
||||
f.stop = false
|
||||
// assert options is a pointer
|
||||
|
||||
if f.ConfigDir != "" {
|
||||
configFile = path.Join(f.ConfigDir, configFile)
|
||||
}
|
||||
|
||||
paths := FindParentPaths(configFile)
|
||||
paths = append([]string{fmt.Sprintf("/etc/%s", configFile)}, paths...)
|
||||
|
||||
+5
-1
@@ -322,7 +322,6 @@ func (c *Client) Do(req *http.Request) (resp *http.Response, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// log any cookies sent b/c they will not be present until
|
||||
// afater we call the `Do` func
|
||||
if log.IsEnabledFor(logging.DEBUG) && TraceRequestBody {
|
||||
@@ -335,6 +334,11 @@ func (c *Client) Do(req *http.Request) (resp *http.Response, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
if log.IsEnabledFor(logging.DEBUG) && TraceResponseBody {
|
||||
out, _ := httputil.DumpResponse(resp, true)
|
||||
log.Debugf("Response: %s", out)
|
||||
}
|
||||
|
||||
err = c.saveCookies(resp)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
|
||||
Reference in New Issue
Block a user