tree-wide: format the code

$ go fmt ./...

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-09-24 01:03:27 +02:00
parent b60f580d92
commit da887a43fb
5 changed files with 21 additions and 11 deletions

View file

@ -90,7 +90,7 @@ func main() {
func writeFileAtomically(filename string, data []byte, mode os.FileMode) error {
dir, name := filepath.Dir(filename), filepath.Base(filename)
tmpfile, err := ioutil.TempFile(dir, name + "-*.tmp")
tmpfile, err := ioutil.TempFile(dir, name+"-*.tmp")
if err != nil {
return err
}

View file

@ -0,0 +1,10 @@
[Unit]
Description=OSBuild Composer Worker (%i)
[Service]
PrivateTmp=true
ExecStart=/usr/local/lib/osbuild-composer/osbuild-composer-worker -C /var/lib/osbuild
[Install]
DefaultInstance=1
WantedBy=default.target

View file

@ -405,8 +405,8 @@ func (api *API) blueprintsInfoHandler(writer http.ResponseWriter, request *http.
json.NewEncoder(writer).Encode(reply{
Blueprints: blueprints,
Changes: changes,
Errors: []string{},
Changes: changes,
Errors: []string{},
})
}
@ -449,7 +449,7 @@ func (api *API) blueprintsDepsolveHandler(writer http.ResponseWriter, request *h
json.NewEncoder(writer).Encode(reply{
Blueprints: blueprints,
Errors: []string{},
Errors: []string{},
})
}

View file

@ -20,9 +20,9 @@ var repo = rpmmd.RepoConfig{
BaseURL: "http://example.com/test/os",
}
var packages = rpmmd.PackageList {
{ Name: "package1" },
{ Name: "package2" },
var packages = rpmmd.PackageList{
{Name: "package1"},
{Name: "package2"},
}
func testRoute(t *testing.T, api *weldr.API, method, path, body string, expectedStatus int, expectedJSON string) {
@ -110,7 +110,7 @@ func TestBasic(t *testing.T) {
{"/api/v0/blueprints/info/example", http.StatusOK, `*`},
}
for _, c:= range cases {
for _, c := range cases {
api := weldr.New(repo, packages, nil)
testRoute(t, api, "GET", c.Path, ``, c.ExpectedStatus, c.ExpectedJSON)
}
@ -124,7 +124,7 @@ func TestBlueprints(t *testing.T) {
http.StatusOK, `{"status":true}`)
testRoute(t, api, "GET", "/api/v0/blueprints/info/test", ``,
http.StatusOK, `{"blueprints":[{"name":"test","description":"Test","modules":[],"packages":[{"name":"httpd","version":"2.4.*"}],"version":"0"}],
http.StatusOK, `{"blueprints":[{"name":"test","description":"Test","modules":[],"packages":[{"name":"httpd","version":"2.4.*"}],"version":"0"}],
"changes":[{"name":"test","changed":false}], "errors":[]}`)
testRoute(t, api, "POST", "/api/v0/blueprints/workspace",
@ -132,6 +132,6 @@ func TestBlueprints(t *testing.T) {
http.StatusOK, `{"status":true}`)
testRoute(t, api, "GET", "/api/v0/blueprints/info/test", ``,
http.StatusOK, `{"blueprints":[{"name":"test","description":"Test","modules":[],"packages":[{"name":"systemd","version":"123"}],"version":"0"}],
http.StatusOK, `{"blueprints":[{"name":"test","description":"Test","modules":[],"packages":[{"name":"systemd","version":"123"}],"version":"0"}],
"changes":[{"name":"test","changed":true}], "errors":[]}`)
}

View file

@ -1,8 +1,8 @@
package weldr
import (
"log"
"encoding/json"
"log"
"sort"
"sync"
)