tree-wide: format the code
$ go fmt ./... Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
b60f580d92
commit
da887a43fb
5 changed files with 21 additions and 11 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
10
init/osbuild-composer-worker@.service
Normal file
10
init/osbuild-composer-worker@.service
Normal 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
|
||||
|
|
@ -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{},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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":[]}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package weldr
|
||||
|
||||
import (
|
||||
"log"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue