gofmt
This commit is contained in:
parent
2bb6d24546
commit
734eab3cfd
3 changed files with 129 additions and 130 deletions
11
main.go
11
main.go
|
@ -1,13 +1,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"net/http"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"hacklab.nilfm.cc/quartzgun/renderer"
|
"hacklab.nilfm.cc/quartzgun/renderer"
|
||||||
|
@ -55,7 +54,7 @@ func runJob(secret string, next http.Handler) http.Handler {
|
||||||
|
|
||||||
// create working dir
|
// create working dir
|
||||||
workingDir := filepath.Join("working", owner, repo, obj)
|
workingDir := filepath.Join("working", owner, repo, obj)
|
||||||
if (os.MkdirAll(workingDir, 0750) != nil) {
|
if os.MkdirAll(workingDir, 0750) != nil {
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -77,7 +76,7 @@ func runJob(secret string, next http.Handler) http.Handler {
|
||||||
urlParams := req.Context().Value("params").(map[string]string)
|
urlParams := req.Context().Value("params").(map[string]string)
|
||||||
jobName := urlParams["job"]
|
jobName := urlParams["job"]
|
||||||
|
|
||||||
jobFile := filepath.Join(workingDir, repo, jobName + ".yml")
|
jobFile := filepath.Join(workingDir, repo, jobName+".yml")
|
||||||
a, err := action.Read(jobFile)
|
a, err := action.Read(jobFile)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -121,11 +120,11 @@ func run(args []string) error {
|
||||||
rtr.Get(`/status/(?P<owner>[^/]+)/(?P<repo>\S+)`, seeJobsForRepo(renderer.JSON("data")))
|
rtr.Get(`/status/(?P<owner>[^/]+)/(?P<repo>\S+)`, seeJobsForRepo(renderer.JSON("data")))
|
||||||
rtr.Get(`/status/(?P<owner>[^/]+)/(?P<repo>[^/]+)/(?P<object>\S+)`, seeJobsForObject(renderer.JSON("data")))
|
rtr.Get(`/status/(?P<owner>[^/]+)/(?P<repo>[^/]+)/(?P<object>\S+)`, seeJobsForObject(renderer.JSON("data")))
|
||||||
|
|
||||||
http.ListenAndServe(":9999", rtr);
|
http.ListenAndServe(":9999", rtr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func main () {
|
func main() {
|
||||||
err := run(os.Args)
|
err := run(os.Args)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
Loading…
Reference in a new issue