Skip to content

Commit

Permalink
Merge pull request #15 from sjtug/go_fmt
Browse files Browse the repository at this point in the history
Formatting
  • Loading branch information
htfy96 authored Jan 30, 2018
2 parents 4ba9dbf + 48d09d1 commit 2490841
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
7 changes: 4 additions & 3 deletions license.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main
/* Generated by script scripts/gen_license.sh */
const licenseText = ` ==> ./vendor/golang.org/x/sys/LICENSE <==
package main

/* Generated by script scripts/gen_license.sh */
const licenseText = ` ==> ./vendor/golang.org/x/sys/LICENSE <==
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/bshuster-repo/logrus-logstash-hook"
"github.com/goji/httpauth"
"github.com/sjtug/lug/config"
"github.com/sjtug/lug/manager"
"github.com/goji/httpauth"
)

const (
Expand Down Expand Up @@ -114,10 +114,10 @@ func main() {
}
jsonapi := manager.NewRestfulAPI(m)
handler := jsonapi.GetAPIHandler()
if flags.apiUser != "" && flags.apiPassword !="" {
if flags.apiUser != "" && flags.apiPassword != "" {
auth := httpauth.BasicAuth(httpauth.AuthOptions{
Realm: "Require authentication",
User: flags.apiUser,
Realm: "Require authentication",
User: flags.apiUser,
Password: flags.apiPassword,
})
handler = auth(handler)
Expand Down
8 changes: 4 additions & 4 deletions worker/rsync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ func NewRsyncWorker(status Status,
// GetStatus returns a snapshot of current worker status
func (w *RsyncWorker) GetStatus() Status {
return Status{
Idle: w.idle,
Result: w.result,
Idle: w.idle,
Result: w.result,
LastFinished: w.lastFinished,
Stdout: w.stdout.GetAll(),
Stderr: w.stderr.GetAll(),
Stdout: w.stdout.GetAll(),
Stderr: w.stderr.GetAll(),
}
}

Expand Down
8 changes: 4 additions & 4 deletions worker/shell_script_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func NewShellScriptWorker(status Status,
// GetStatus returns a snapshot of current status
func (w *ShellScriptWorker) GetStatus() Status {
return Status{
Idle: w.idle,
Result: w.result,
Idle: w.idle,
Result: w.result,
LastFinished: w.lastFinished,
Stdout: w.stdout.GetAll(),
Stderr: w.stderr.GetAll(),
Stdout: w.stdout.GetAll(),
Stderr: w.stderr.GetAll(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion worker/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package worker
type utility interface {
preHook() error
postHook() error
}
}
10 changes: 5 additions & 5 deletions worker/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/sjtug/lug/config"
"github.com/stretchr/testify/assert"
"os/exec"
"io"
"os/exec"
)

var rsyncW Worker
Expand Down Expand Up @@ -56,13 +56,13 @@ func TestNewShellScriptWorker(t *testing.T) {
}

type limitReader struct {
cnt int
cnt int
limit int
}

func newLimitReader(limit int) *limitReader {
return &limitReader{
cnt: 0,
cnt: 0,
limit: limit,
}
}
Expand All @@ -71,7 +71,7 @@ func (i *limitReader) Read(p []byte) (int, error) {
return 0, io.EOF
}
i.cnt += len(p)
for i:=0; i<len(p); i++ {
for i := 0; i < len(p); i++ {
p[i] = 0
}
return len(p), nil
Expand All @@ -91,4 +91,4 @@ func TestUtilityRlimit(t *testing.T) {
err2 = cmd.Wait()
}
assert.True(err1 != nil || err2 != nil)
}
}

0 comments on commit 2490841

Please sign in to comment.