forked from Shiloh/githaven
go vet and fix #1890
This commit is contained in:
parent
58436b5ea5
commit
b55499d039
@ -13,7 +13,7 @@ watch_dirs = [
|
|||||||
watch_exts = [".go"]
|
watch_exts = [".go"]
|
||||||
build_delay = 1500
|
build_delay = 1500
|
||||||
cmds = [
|
cmds = [
|
||||||
["go", "install", "-tags", "sqlite"],# redis memcache cert pam tidb
|
["go", "install"], # sqlite redis memcache cert pam tidb
|
||||||
["go", "build", "-tags", "sqlite"],
|
["go", "build"],
|
||||||
["./gogs", "web"]
|
["./gogs", "web"]
|
||||||
]
|
]
|
9
Makefile
9
Makefile
@ -13,8 +13,10 @@ build:
|
|||||||
go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
||||||
go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
||||||
|
|
||||||
|
govet:
|
||||||
|
go tool vet -composites=false -methods=false -structtags=false .
|
||||||
|
|
||||||
pack:
|
pack:
|
||||||
find . -name ".DS_Store" -print0 | xargs -0 rm
|
|
||||||
rm -rf $(RELEASE_GOGS)
|
rm -rf $(RELEASE_GOGS)
|
||||||
mkdir -p $(RELEASE_GOGS)
|
mkdir -p $(RELEASE_GOGS)
|
||||||
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
|
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
|
||||||
@ -27,4 +29,7 @@ bindata:
|
|||||||
go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
|
go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
go clean -i ./...
|
go clean -i ./...
|
||||||
|
|
||||||
|
clean-mac: clean
|
||||||
|
find . -name ".DS_Store" -print0 | xargs -0 rm
|
14
cmd/serve.go
14
cmd/serve.go
@ -74,7 +74,14 @@ var (
|
|||||||
|
|
||||||
func fail(userMessage, logMessage string, args ...interface{}) {
|
func fail(userMessage, logMessage string, args ...interface{}) {
|
||||||
fmt.Fprintln(os.Stderr, "Gogs:", userMessage)
|
fmt.Fprintln(os.Stderr, "Gogs:", userMessage)
|
||||||
log.GitLogger.Fatal(3, logMessage, args...)
|
|
||||||
|
if len(logMessage) > 0 {
|
||||||
|
log.GitLogger.Fatal(3, logMessage, args...)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.GitLogger.Close()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleUpdateTask(uuid string, user *models.User, repoUserName, repoName string) {
|
func handleUpdateTask(uuid string, user *models.User, repoUserName, repoName string) {
|
||||||
@ -161,6 +168,11 @@ func runServ(c *cli.Context) {
|
|||||||
fail("Unknown git command", "Unknown git command %s", verb)
|
fail("Unknown git command", "Unknown git command %s", verb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prohibit push to mirror repositories.
|
||||||
|
if requestedMode > models.ACCESS_MODE_READ && repo.IsMirror {
|
||||||
|
fail("mirror repository is read-only", "")
|
||||||
|
}
|
||||||
|
|
||||||
// Allow anonymous clone for public repositories.
|
// Allow anonymous clone for public repositories.
|
||||||
var (
|
var (
|
||||||
keyID int64
|
keyID int64
|
||||||
|
2
gogs.go
2
gogs.go
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.7.0.1107 Beta"
|
const APP_VER = "0.7.0.1108 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
@ -147,7 +147,7 @@ func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
|
|||||||
RepoName: repo.Name,
|
RepoName: repo.Name,
|
||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("notify watchers '%d/%s': %v", u.Id, repo.ID, err)
|
return fmt.Errorf("notify watchers '%d/%d': %v", u.Id, repo.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("action.newRepoAction: %s/%s", u.Name, repo.Name)
|
log.Trace("action.newRepoAction: %s/%s", u.Name, repo.Name)
|
||||||
@ -488,7 +488,7 @@ func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repos
|
|||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
Content: path.Join(oldOwner.LowerName, repo.LowerName),
|
Content: path.Join(oldOwner.LowerName, repo.LowerName),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("notify watchers '%d/%s': %v", actUser.Id, repo.ID, err)
|
return fmt.Errorf("notify watchers '%d/%d': %v", actUser.Id, repo.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove watch for organization.
|
// Remove watch for organization.
|
||||||
|
@ -456,7 +456,7 @@ func trimCommitActionAppUrlPrefix(x *xorm.Engine) error {
|
|||||||
|
|
||||||
pushCommits = new(PushCommits)
|
pushCommits = new(PushCommits)
|
||||||
if err = json.Unmarshal(action["content"], pushCommits); err != nil {
|
if err = json.Unmarshal(action["content"], pushCommits); err != nil {
|
||||||
return fmt.Errorf("unmarshal action content[%s]: %v", actID, err)
|
return fmt.Errorf("unmarshal action content[%d]: %v", actID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
infos := strings.Split(pushCommits.CompareUrl, "/")
|
infos := strings.Split(pushCommits.CompareUrl, "/")
|
||||||
@ -467,7 +467,7 @@ func trimCommitActionAppUrlPrefix(x *xorm.Engine) error {
|
|||||||
|
|
||||||
p, err := json.Marshal(pushCommits)
|
p, err := json.Marshal(pushCommits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("marshal action content[%s]: %v", actID, err)
|
return fmt.Errorf("marshal action content[%d]: %v", actID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = sess.Id(actID).Update(&Action{
|
if _, err = sess.Id(actID).Update(&Action{
|
||||||
|
@ -111,7 +111,7 @@ func TestSpecSchedule(t *testing.T) {
|
|||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(actual, c.expected) {
|
if !reflect.DeepEqual(actual, c.expected) {
|
||||||
t.Errorf("%s => (expected) %b != %b (actual)", c.expr, c.expected, actual)
|
t.Errorf("%s => (expected) %v != %v (actual)", c.expr, c.expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
|
|||||||
newCommits := list.New()
|
newCommits := list.New()
|
||||||
for e := oldCommits.Front(); e != nil; e = e.Next() {
|
for e := oldCommits.Front(); e != nil; e = e.Next() {
|
||||||
c := e.Value.(*git.Commit)
|
c := e.Value.(*git.Commit)
|
||||||
c.CommitMessage = c.CommitMessage
|
|
||||||
newCommits.PushBack(c)
|
newCommits.PushBack(c)
|
||||||
}
|
}
|
||||||
return newCommits
|
return newCommits
|
||||||
@ -196,7 +195,6 @@ func Diff(ctx *middleware.Context) {
|
|||||||
commitID := ctx.Repo.CommitID
|
commitID := ctx.Repo.CommitID
|
||||||
|
|
||||||
commit := ctx.Repo.Commit
|
commit := ctx.Repo.Commit
|
||||||
commit.CommitMessage = commit.CommitMessage
|
|
||||||
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
|
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
|
||||||
commitID, setting.Git.MaxGitDiffLines)
|
commitID, setting.Git.MaxGitDiffLines)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -158,7 +158,7 @@ func HTTP(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !isPull && repo.IsMirror {
|
if !isPull && repo.IsMirror {
|
||||||
ctx.HandleText(401, "can't push to mirror")
|
ctx.HandleText(401, "mirror repository is read-only")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,11 +250,6 @@ func Action(ctx *middleware.Context) {
|
|||||||
redirectTo = ctx.Repo.RepoLink
|
redirectTo = ctx.Repo.RepoLink
|
||||||
}
|
}
|
||||||
ctx.Redirect(redirectTo)
|
ctx.Redirect(redirectTo)
|
||||||
|
|
||||||
return
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
|
||||||
"ok": true,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Download(ctx *middleware.Context) {
|
func Download(ctx *middleware.Context) {
|
||||||
|
@ -1 +1 @@
|
|||||||
0.7.0.1107 Beta
|
0.7.0.1108 Beta
|
Loading…
Reference in New Issue
Block a user