Removed dead code and added new travis tool

This commit is contained in:
Eduard Urbach 2018-11-08 20:30:36 +09:00
parent 9da70decfe
commit fb881eed81
3 changed files with 14 additions and 28 deletions

View File

@ -28,6 +28,7 @@ before_script:
- go get golang.org/x/lint/golint # Linter
- go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
- go get github.com/fzipp/gocyclo # Cyclomatic complexity
- go get github.com/3rf/codecoroner # Dead code analysis
- npm install -g typescript # TypeScript
- git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn # Database
@ -43,3 +44,4 @@ script:
- megacheck ./... # "go vet on steroids" + linter
- gocyclo -over 19 $GO_FILES # forbid code with huge functions
- golint -set_exit_status $(go list ./...) # one last linter
- codecoroner -ignore components funcs ./... # dead code analysis

View File

@ -32,12 +32,7 @@ func Get(ctx *aero.Context) string {
}
_, isPostable := obj.(arn.Postable)
if !isPostable {
return false
}
return true
return isPostable
})
arn.SortEditLogEntriesLatestFirst(entries)

View File

@ -14,7 +14,6 @@ import (
var (
scriptsETag = aero.ETagString(js.Bundle())
stylesETag = aero.ETagString(css.Bundle())
streams = map[string][]*aero.EventStream{}
)
// Events streams server events to the client.
@ -31,6 +30,7 @@ func Events(ctx *aero.Context) string {
go func() {
defer fmt.Println(user.Nick, "disconnected, stop sending events")
defer user.RemoveEventStream(stream)
stream.Events <- &aero.Event{
Name: "etag",
@ -54,18 +54,7 @@ func Events(ctx *aero.Context) string {
},
}
for {
select {
case <-stream.Closed:
user.RemoveEventStream(stream)
return
// case <-time.After(10 * time.Second):
// stream.Events <- &aero.Event{
// Name: "ping",
// }
}
}
<-stream.Closed
}()
return ctx.EventStream(stream)