ls: Make recursive and non-recursive behave the same way
Outputs for recursive today ``` $ mc ls -r /tmp/value/ [2016-01-25 12:27:01 PST] 52B test.go [2016-01-26 11:36:22 PST] 4.2KiB test.txt [2016-01-26 11:45:22 PST] 102B test/ [2016-01-26 11:45:22 PST] 4.2KiB test/README.md ``` and Outputs for non recursive today differ lexically. ``` $ mc ls /tmp/value/ [2016-01-26 11:45:22 PST] 102B test/ [2016-01-25 12:27:01 PST] 52B test.go [2016-01-26 11:36:22 PST] 4.2KiB test.txt ``` To fix this issue we need to capture the ending '/' as well part of the names while sorting the output. This patch addresses this problem.
This commit is contained in:
+2
-2
@@ -96,8 +96,8 @@ func (s accessMessage) String() string {
|
||||
|
||||
// JSON jsonified access message.
|
||||
func (s accessMessage) JSON() string {
|
||||
accessJSONBytes, err := json.Marshal(s)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal into JSON.")
|
||||
accessJSONBytes, e := json.Marshal(s)
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(accessJSONBytes)
|
||||
}
|
||||
|
||||
@@ -138,14 +138,13 @@ func (h objectAPIHandler) putHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
length, err := strconv.Atoi(r.Header.Get("Content-Length"))
|
||||
if err != nil {
|
||||
length, e := strconv.Atoi(r.Header.Get("Content-Length"))
|
||||
if e != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
_, err = io.CopyN(&buffer, r.Body, int64(length))
|
||||
if err != nil {
|
||||
if _, e = io.CopyN(&buffer, r.Body, int64(length)); e != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ install:
|
||||
- go get -u golang.org/x/tools/cmd/vet
|
||||
- go get -u github.com/fzipp/gocyclo
|
||||
- go get -u github.com/remyoudompheng/go-misc/deadcode
|
||||
- go get -u github.com/alecthomas/gometalinter
|
||||
- go get -u github.com/client9/misspell
|
||||
|
||||
# to run your custom scripts instead of automatic MSBuild
|
||||
build_script:
|
||||
@@ -28,6 +30,7 @@ build_script:
|
||||
- gofmt -s -l pkg
|
||||
- golint .
|
||||
- golint github.com/minio/mc/pkg...
|
||||
- gometalinter --disable-all --linter='misspell:misspell ./*.go:PATH:LINE:COL:MESSAGE' --enable=misspell ./...
|
||||
- gocyclo -over 40 pkg
|
||||
- deadcode
|
||||
- go test -race .
|
||||
|
||||
+4
-4
@@ -98,16 +98,16 @@ func catURL(sourceURL string) *probe.Error {
|
||||
// catOut reads from reader stream and writes to stdout.
|
||||
func catOut(r io.Reader) *probe.Error {
|
||||
// Read till EOF.
|
||||
if _, err := io.Copy(os.Stdout, r); err != nil {
|
||||
switch e := err.(type) {
|
||||
if _, e := io.Copy(os.Stdout, r); e != nil {
|
||||
switch e := e.(type) {
|
||||
case *os.PathError:
|
||||
if e.Err == syscall.EPIPE {
|
||||
// stdout closed by the user. Gracefully exit.
|
||||
return nil
|
||||
}
|
||||
return probe.NewError(err)
|
||||
return probe.NewError(e)
|
||||
default:
|
||||
return probe.NewError(err)
|
||||
return probe.NewError(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -69,8 +69,8 @@ func createMcConfigDir() *probe.Error {
|
||||
if err != nil {
|
||||
return err.Trace()
|
||||
}
|
||||
if err := os.MkdirAll(p, 0700); err != nil {
|
||||
return probe.NewError(err)
|
||||
if e := os.MkdirAll(p, 0700); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -142,7 +142,7 @@ func isMcConfigExists() bool {
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if _, err := os.Stat(configFile); err != nil {
|
||||
if _, e := os.Stat(configFile); e != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
+5
-5
@@ -100,8 +100,8 @@ func (c copyMessage) String() string {
|
||||
// JSON jsonified copy message
|
||||
func (c copyMessage) JSON() string {
|
||||
c.Status = "success"
|
||||
copyMessageBytes, err := json.Marshal(c)
|
||||
fatalIf(probe.NewError(err), "Failed to marshal copy message.")
|
||||
copyMessageBytes, e := json.Marshal(c)
|
||||
fatalIf(probe.NewError(e), "Failed to marshal copy message.")
|
||||
|
||||
return string(copyMessageBytes)
|
||||
}
|
||||
@@ -226,10 +226,10 @@ func doPrepareCopyURLs(session *sessionV6, trapCh <-chan bool) {
|
||||
break
|
||||
}
|
||||
|
||||
jsonData, err := json.Marshal(cpURLs)
|
||||
if err != nil {
|
||||
jsonData, e := json.Marshal(cpURLs)
|
||||
if e != nil {
|
||||
session.Delete()
|
||||
fatalIf(probe.NewError(err), "Unable to prepare URL for copying. Error in JSON marshaling.")
|
||||
fatalIf(probe.NewError(e), "Unable to prepare URL for copying. Error in JSON marshaling.")
|
||||
}
|
||||
fmt.Fprintln(dataFP, string(jsonData))
|
||||
if !globalQuiet && !globalJSON {
|
||||
|
||||
+2
-2
@@ -99,8 +99,8 @@ func (d diffMessage) String() string {
|
||||
// JSON jsonified diff message
|
||||
func (d diffMessage) JSON() string {
|
||||
d.Status = "success"
|
||||
diffJSONBytes, err := json.Marshal(d)
|
||||
fatalIf(probe.NewError(err),
|
||||
diffJSONBytes, e := json.Marshal(d)
|
||||
fatalIf(probe.NewError(e),
|
||||
"Unable to marshal diff message ‘"+d.FirstURL+"’, ‘"+d.SecondURL+"’ and ‘"+d.Diff+"’.")
|
||||
return string(diffJSONBytes)
|
||||
}
|
||||
|
||||
@@ -57,15 +57,15 @@ func fatalIf(err *probe.Error, msg string) {
|
||||
if globalDebug {
|
||||
errorMsg.CallTrace = err.CallTrace
|
||||
}
|
||||
json, err := json.Marshal(struct {
|
||||
json, e := json.Marshal(struct {
|
||||
Status string `json:"status"`
|
||||
Error errorMessage `json:"error"`
|
||||
}{
|
||||
Status: "error",
|
||||
Error: errorMsg,
|
||||
})
|
||||
if err != nil {
|
||||
console.Fatalln(probe.NewError(err))
|
||||
if e != nil {
|
||||
console.Fatalln(probe.NewError(e))
|
||||
}
|
||||
console.Println(string(json))
|
||||
console.Fatalln()
|
||||
@@ -94,15 +94,15 @@ func errorIf(err *probe.Error, msg string) {
|
||||
if globalDebug {
|
||||
errorMsg.CallTrace = err.CallTrace
|
||||
}
|
||||
json, err := json.Marshal(struct {
|
||||
json, e := json.Marshal(struct {
|
||||
Status string `json:"status"`
|
||||
Error errorMessage `json:"error"`
|
||||
}{
|
||||
Status: "error",
|
||||
Error: errorMsg,
|
||||
})
|
||||
if err != nil {
|
||||
console.Fatalln(probe.NewError(err))
|
||||
if e != nil {
|
||||
console.Fatalln(probe.NewError(e))
|
||||
}
|
||||
console.Println(string(json))
|
||||
return
|
||||
|
||||
+2
-2
@@ -83,8 +83,8 @@ func (s makeBucketMessage) String() string {
|
||||
|
||||
// JSON jsonified make bucket message.
|
||||
func (s makeBucketMessage) JSON() string {
|
||||
makeBucketJSONBytes, err := json.Marshal(s)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal into JSON.")
|
||||
makeBucketJSONBytes, e := json.Marshal(s)
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(makeBucketJSONBytes)
|
||||
}
|
||||
|
||||
+3
-3
@@ -207,10 +207,10 @@ func doPrepareMirrorURLs(session *sessionV6, isForce bool, trapCh <-chan bool) {
|
||||
if sURLs.isEmpty() {
|
||||
break
|
||||
}
|
||||
jsonData, err := json.Marshal(sURLs)
|
||||
if err != nil {
|
||||
jsonData, e := json.Marshal(sURLs)
|
||||
if e != nil {
|
||||
session.Delete()
|
||||
fatalIf(probe.NewError(err), "Unable to marshal URLs into JSON.")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal URLs into JSON.")
|
||||
}
|
||||
fmt.Fprintln(dataFP, string(jsonData))
|
||||
if !globalQuiet && !globalJSON {
|
||||
|
||||
+3
-3
@@ -50,9 +50,9 @@ func colorizeUpdateMessage(updateString string) (string, *probe.Error) {
|
||||
line2Rest := maxContentWidth - line2Length
|
||||
|
||||
// Fetch terminal size to calculate optimal box size.
|
||||
terminal, err := ts.GetSize()
|
||||
if err != nil {
|
||||
return "", probe.NewError(err)
|
||||
terminal, e := ts.GetSize()
|
||||
if e != nil {
|
||||
return "", probe.NewError(e)
|
||||
}
|
||||
|
||||
var message string
|
||||
|
||||
+76
-37
@@ -23,12 +23,47 @@ import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// byDirName implements sort.Interface.
|
||||
type byDirName []os.FileInfo
|
||||
|
||||
func (f byDirName) Len() int { return len(f) }
|
||||
func (f byDirName) Less(i, j int) bool {
|
||||
// For directory add an ending separator fortrue lexical order.
|
||||
if f[i].Mode().IsDir() {
|
||||
return f[i].Name()+string(os.PathSeparator) < f[j].Name()
|
||||
}
|
||||
// For directory add an ending separator for true lexical order.
|
||||
if f[j].Mode().IsDir() {
|
||||
return f[i].Name() < f[j].Name()+string(os.PathSeparator)
|
||||
}
|
||||
return f[i].Name() < f[j].Name()
|
||||
}
|
||||
func (f byDirName) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
|
||||
|
||||
// readDir reads the directory named by dirname and returns
|
||||
// a list of sorted directory entries.
|
||||
func readDir(dirname string) ([]os.FileInfo, error) {
|
||||
f, e := os.Open(dirname)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
list, e := f.Readdir(-1)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
if e = f.Close(); e != nil {
|
||||
return nil, e
|
||||
}
|
||||
sort.Sort(byDirName(list))
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// readDirNames reads the directory named by dirname and returns
|
||||
// a sorted list of directory entries.
|
||||
func readDirNames(dirname string) ([]string, error) {
|
||||
names, err := readDirUnsortedNames(dirname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
names, e := readDirUnsortedNames(dirname)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
sort.Strings(names)
|
||||
return names, nil
|
||||
@@ -45,15 +80,19 @@ func getRealName(info os.FileInfo) string {
|
||||
return info.Name()
|
||||
}
|
||||
|
||||
// readDirUnsortedNames reads the directory named by dirname and
|
||||
// return a unsorted list of directory entries.
|
||||
func readDirUnsortedNames(dirname string) ([]string, error) {
|
||||
f, err := os.Open(dirname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
f, e := os.Open(dirname)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
nameInfos, err := f.Readdir(-1)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
nameInfos, e := f.Readdir(-1)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
if e = f.Close(); e != nil {
|
||||
return nil, e
|
||||
}
|
||||
var names []string
|
||||
for _, nameInfo := range nameInfos {
|
||||
@@ -62,14 +101,14 @@ func readDirUnsortedNames(dirname string) ([]string, error) {
|
||||
return names, nil
|
||||
}
|
||||
|
||||
// Walk walks the file tree rooted at root, calling walkFn for each file or
|
||||
// walk walks the file tree rooted at root, calling walkFn for each file or
|
||||
// directory in the tree, including root.
|
||||
func Walk(root string, walkFn WalkFunc) error {
|
||||
info, err := os.Lstat(root)
|
||||
if err != nil {
|
||||
return walkFn(root, nil, err)
|
||||
func walk(root string, walkFn walkFunc) error {
|
||||
info, e := os.Lstat(root)
|
||||
if e != nil {
|
||||
return walkFn(root, nil, e)
|
||||
}
|
||||
return walk(root, info, walkFn)
|
||||
return walkInternal(root, info, walkFn)
|
||||
}
|
||||
|
||||
// WalkFunc is the type of the function called for each file or directory
|
||||
@@ -77,51 +116,51 @@ func Walk(root string, walkFn WalkFunc) error {
|
||||
// prefix; that is, if Walk is called with "dir", which is a directory
|
||||
// containing the file "a", the walk function will be called with argument
|
||||
// "dir/a". The info argument is the os.FileInfo for the named path.
|
||||
type WalkFunc func(path string, info os.FileInfo, err error) error
|
||||
type walkFunc func(path string, info os.FileInfo, e error) error
|
||||
|
||||
// ErrSkipDir is used as a return value from WalkFuncs to indicate that
|
||||
// the directory named in the call is to be skipped. It is not returned
|
||||
// as an error by any function.
|
||||
var ErrSkipDir = errors.New("skip this directory")
|
||||
var errSkipDir = errors.New("skip this directory")
|
||||
|
||||
// ErrSkipFile is used as a return value from WalkFuncs to indicate that
|
||||
// the file named in the call is to be skipped. It is not returned
|
||||
// as an error by any function.
|
||||
var ErrSkipFile = errors.New("skip this file")
|
||||
var errSkipFile = errors.New("skip this file")
|
||||
|
||||
// walk recursively descends path, calling w.
|
||||
func walk(path string, info os.FileInfo, walkFn WalkFunc) error {
|
||||
err := walkFn(path, info, nil)
|
||||
if err != nil {
|
||||
if info.Mode().IsDir() && err == ErrSkipDir {
|
||||
// walkInternal recursively descends path, calling w.
|
||||
func walkInternal(path string, info os.FileInfo, walkFn walkFunc) error {
|
||||
e := walkFn(path, info, nil)
|
||||
if e != nil {
|
||||
if info.Mode().IsDir() && e == errSkipDir {
|
||||
return nil
|
||||
}
|
||||
if info.Mode().IsRegular() && err == ErrSkipFile {
|
||||
if info.Mode().IsRegular() && e == errSkipFile {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
return e
|
||||
}
|
||||
if !info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
names, err := readDirNames(path)
|
||||
if err != nil {
|
||||
return walkFn(path, info, err)
|
||||
names, e := readDirNames(path)
|
||||
if e != nil {
|
||||
return walkFn(path, info, e)
|
||||
}
|
||||
for _, name := range names {
|
||||
filename := filepath.Join(path, name)
|
||||
fileInfo, err := os.Lstat(filename)
|
||||
if err != nil {
|
||||
if err = walkFn(filename, fileInfo, err); err != nil && err != ErrSkipDir && err != ErrSkipFile {
|
||||
return err
|
||||
fileInfo, e := os.Lstat(filename)
|
||||
if e != nil {
|
||||
if e = walkFn(filename, fileInfo, e); e != nil && e != errSkipDir && e != errSkipFile {
|
||||
return e
|
||||
}
|
||||
} else {
|
||||
err = walk(filename, fileInfo, walkFn)
|
||||
if err != nil {
|
||||
if err == ErrSkipDir || err == ErrSkipFile {
|
||||
e = walkInternal(filename, fileInfo, walkFn)
|
||||
if e != nil {
|
||||
if e == errSkipDir || e == errSkipFile {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
return e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -280,7 +280,7 @@ func (f *fsClient) List(recursive, incomplete bool) <-chan *client.Content {
|
||||
// listPrefixes - list all files for any given prefix.
|
||||
func (f *fsClient) listPrefixes(prefix string, contentCh chan<- *client.Content, incomplete bool) {
|
||||
dirName := filepath.Dir(prefix)
|
||||
files, e := ioutil.ReadDir(dirName)
|
||||
files, e := readDir(dirName)
|
||||
if e != nil {
|
||||
err := f.toClientError(e, dirName)
|
||||
contentCh <- &client.Content{
|
||||
@@ -425,7 +425,7 @@ func (f *fsClient) listInRoutine(contentCh chan<- *client.Content, incomplete bo
|
||||
// If we really see the directory.
|
||||
switch fst.Mode().IsDir() {
|
||||
case true:
|
||||
files, e := ioutil.ReadDir(fpath)
|
||||
files, e := readDir(fpath)
|
||||
if err != nil {
|
||||
contentCh <- &client.Content{Err: probe.NewError(e)}
|
||||
return
|
||||
@@ -555,7 +555,7 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *client.Content, incomp
|
||||
!strings.HasPrefix(filePrefix, fp) {
|
||||
if e == nil {
|
||||
if fi.IsDir() {
|
||||
return ErrSkipDir
|
||||
return errSkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -702,8 +702,8 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *client.Content, incomp
|
||||
// filePrefix is kept for filtering incoming contents through WalkFunc.
|
||||
filePrefix = pathURL.Path
|
||||
}
|
||||
// Walks invokes our custom function.
|
||||
e := Walk(dirName, visitFS)
|
||||
// walks invokes our custom function.
|
||||
e := walk(dirName, visitFS)
|
||||
if e != nil {
|
||||
contentCh <- &client.Content{
|
||||
Err: probe.NewError(e),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||
// +build !windows
|
||||
|
||||
/*
|
||||
* Minio Client (C) 2015 Minio, Inc.
|
||||
@@ -91,14 +91,13 @@ func (h objectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
switch {
|
||||
case r.Method == "PUT":
|
||||
// Handler for PUT object request.
|
||||
length, err := strconv.Atoi(r.Header.Get("Content-Length"))
|
||||
if err != nil {
|
||||
length, e := strconv.Atoi(r.Header.Get("Content-Length"))
|
||||
if e != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
_, err = io.CopyN(&buffer, r.Body, int64(length))
|
||||
if err != nil {
|
||||
if _, e = io.CopyN(&buffer, r.Body, int64(length)); e != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
+3
-3
@@ -47,9 +47,9 @@ func scanBarFactory() scanBarFunc {
|
||||
prevLineSize := 0
|
||||
prevSource := ""
|
||||
fileCount := 0
|
||||
termSize, err := ts.GetSize()
|
||||
if err != nil {
|
||||
fatalIf(probe.NewError(err), "Unable to get terminal size. Please use --quiet option.")
|
||||
termSize, e := ts.GetSize()
|
||||
if e != nil {
|
||||
fatalIf(probe.NewError(e), "Unable to get terminal size. Please use --quiet option.")
|
||||
}
|
||||
termWidth := termSize.Col()
|
||||
cursorCh := cursorAnimate()
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ func (c clearSessionMessage) String() string {
|
||||
|
||||
// JSON jsonified clear session message.
|
||||
func (c clearSessionMessage) JSON() string {
|
||||
clearSessionJSONBytes, err := json.Marshal(c)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal into JSON.")
|
||||
clearSessionJSONBytes, e := json.Marshal(c)
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(clearSessionJSONBytes)
|
||||
}
|
||||
|
||||
+6
-7
@@ -137,8 +137,8 @@ func loadSessionV6(sid string) (*sessionV6, *probe.Error) {
|
||||
return nil, err.Trace(sid)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(sessionFile); err != nil {
|
||||
return nil, probe.NewError(err)
|
||||
if _, e := os.Stat(sessionFile); e != nil {
|
||||
return nil, probe.NewError(e)
|
||||
}
|
||||
|
||||
s := &sessionV6{}
|
||||
@@ -300,9 +300,8 @@ func (s *sessionV6) Delete() *probe.Error {
|
||||
// the file is closed already
|
||||
s.DataFP.Close()
|
||||
|
||||
err := os.Remove(name)
|
||||
if err != nil {
|
||||
return probe.NewError(err)
|
||||
if e := os.Remove(name); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +310,8 @@ func (s *sessionV6) Delete() *probe.Error {
|
||||
return err.Trace(s.SessionID)
|
||||
}
|
||||
|
||||
if err := os.Remove(sessionFile); err != nil {
|
||||
return probe.NewError(err)
|
||||
if e := os.Remove(sessionFile); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
+2
-2
@@ -37,8 +37,8 @@ func createSessionDir() *probe.Error {
|
||||
return err.Trace()
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(sessionDir, 0700); err != nil {
|
||||
return probe.NewError(err)
|
||||
if e := os.MkdirAll(sessionDir, 0700); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -89,8 +89,8 @@ func (s *shareDBV1) Load(filename string) *probe.Error {
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
// Check if the db file exist.
|
||||
if _, err := os.Stat(filename); err != nil {
|
||||
return probe.NewError(err)
|
||||
if _, e := os.Stat(filename); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
|
||||
// Initialize and load using quick package.
|
||||
|
||||
@@ -130,8 +130,8 @@ func isShareDirExists() bool {
|
||||
|
||||
// Create config share dir.
|
||||
func createShareDir() *probe.Error {
|
||||
if err := os.MkdirAll(mustGetShareDir(), 0700); err != nil {
|
||||
return probe.NewError(err)
|
||||
if e := os.MkdirAll(mustGetShareDir(), 0700); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -102,8 +102,8 @@ func (u updateMessage) String() string {
|
||||
// JSON jsonified update message.
|
||||
func (u updateMessage) JSON() string {
|
||||
u.Status = "success"
|
||||
updateMessageJSONBytes, err := json.Marshal(u)
|
||||
fatalIf(probe.NewError(err), "Unable to marshal into JSON.")
|
||||
updateMessageJSONBytes, e := json.Marshal(u)
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(updateMessageJSONBytes)
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,6 +24,6 @@ import (
|
||||
)
|
||||
|
||||
func (s *TestSuite) TestVersion(c *C) {
|
||||
_, err := time.Parse(mcVersion, http.TimeFormat)
|
||||
c.Assert(err, NotNil)
|
||||
_, e := time.Parse(mcVersion, http.TimeFormat)
|
||||
c.Assert(e, NotNil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user