]> xenbits.xensource.com Git - people/gdunlap/xsatool/commitdiff
Run go fmt
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 23 Jun 2017 09:36:15 +0000 (10:36 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 23 Jun 2017 09:36:15 +0000 (10:36 +0100)
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
git.go
meta.go
recipe.go
repo.go
systemtest.go
xen.go
xsa.go

diff --git a/git.go b/git.go
index f49c5f0d740f1da7ba0e7de43de941c2c384feb8..8d5ebd32a7877ae56f2523f5681176f740f51840 100644 (file)
--- a/git.go
+++ b/git.go
@@ -65,7 +65,7 @@ func (r Repo) stgCmd(args ...string) (out []byte, err error) {
 }
 
 // Will return false if stg is not installed.
-func (r Repo) IsStg(branch string) (bool) {
+func (r Repo) IsStg(branch string) bool {
        _, err := r.stgCmd("series", "-b", branch)
        return err == nil
 }
@@ -145,8 +145,6 @@ func (r Repo) ResetBranch(branch string, ref string) (err error) {
        return r.MakeBranch(branch, ref)
 }
 
-
-
 func (r Repo) Checkout(branch string) (out []byte, err error) {
        out, err = r.gitCmd("checkout", branch)
        if err == nil {
@@ -226,7 +224,7 @@ func (r Repo) Am(amglob string) (out []byte, err error) {
 func outputToList(out []byte) (list []string) {
        if len(out) > 0 {
                list = strings.Split(string(out), "\n")
-               
+
                l := len(list)
                if l > 0 && list[l-1] == "" {
                        list = list[:l-1]
@@ -243,7 +241,7 @@ func (r Repo) Tags() (tags []string, err error) {
        }
 
        tags = outputToList(out)
-       
+
        return
 }
 
@@ -276,7 +274,6 @@ func (r Repo) Branches(pattern string) (branches []string, err error) {
        return
 }
 
-
 // Do a 'git am', and if it fails, clean up the tree
 func (r Repo) AmClean(amglob string) (out []byte, err error) {
        files, err := globToFullPath(amglob)
diff --git a/meta.go b/meta.go
index 73f585130dba69aa7a2be061e65cac3bd49228e2..54790186c4f4c1155d878868f259d68c451b35c1 100644 (file)
--- a/meta.go
+++ b/meta.go
@@ -233,7 +233,7 @@ func (m *XSAMeta) NewRecipe(v XenVersion) *Recipe {
        // Lazy version: Add it to the end then sort
        m.SupportedVersions = append(m.SupportedVersions, v)
        sort.Sort(m.SupportedVersions)
-       
+
        r.xsa = m.XSA
        r.XenVersion = v
        r.Recipes = make(map[Tree]*TreeRecipe)
index 5e615ac2dfd75e5673aa294b62dffaabaa760985..bd65540254be025a1ed512c9878141fbf4045ed8 100644 (file)
--- a/recipe.go
+++ b/recipe.go
@@ -13,8 +13,8 @@ import (
 
 type TreeRecipe struct {
        StableRef string
-       Prereqs []int
-       Patches []string
+       Prereqs   []int
+       Patches   []string
 }
 
 func (tr *TreeRecipe) HasPatches() bool {
@@ -70,7 +70,7 @@ func (r *Recipe) ForEachTree(f func(Tree) error) (err error) {
 // Return 'true' if any tree recipe has patches
 // FIXME: Should this be *all* specified tree recipes instead?
 func (r *Recipe) HasPatches() (has bool) {
-       r.ForEachTree(func (t Tree) error {
+       r.ForEachTree(func(t Tree) error {
                tr := r.Recipes[t]
                if tr.HasPatches() {
                        has = true
@@ -350,7 +350,7 @@ func (r *Recipe) ApplyPatches(prefix string) (err error) {
                        return fmt.Errorf("Making tempbranch %s for xenversion %v: %v\n",
                                branch, r.XenVersion)
                }
-               
+
                for _, glob := range tr.Patches {
                        // git am
                        _, err = xr.AmClean(G.config.Tool.GetPath(TreeXSA) + "/" + glob)
@@ -412,7 +412,7 @@ func (r *Recipe) ApplyBaselines(prefix string) (err error) {
                                fmt.Printf(" No patches for prereq xsa %d\n", xsanum)
                                continue
                        }
-                       
+
                        // git am the appropriate patches
                        for _, glob := range subtr.Patches {
                                _, err = xr.AmClean(G.config.Tool.GetPath(TreeXSA) + "/" + glob)
@@ -422,12 +422,12 @@ func (r *Recipe) ApplyBaselines(prefix string) (err error) {
                                }
                        }
                }
-               
+
                return
        }
 
        err = r.ForEachTree(apply)
-       
+
        return
 }
 
@@ -456,11 +456,10 @@ func (r *Recipe) Backport(prefix string, to XenVersion) (err error) {
 
        _, fromBase, fromBranch := BranchName(prefix, r.xsa, r.XenVersion)
        _, toBase, toBranch := BranchName(prefix, r.xsa, to)
-       
+
        backport := func(tree Tree) (err error) {
                xr := G.repos.XenRepos[tree]
 
-               
                // git checkout -b xsa/NNN/$to xsa/NNN/$from
                if err = xr.MakeBranch(toBranch, fromBranch); err != nil {
                        return fmt.Errorf("Making branch %v based on branch %v\n",
@@ -471,7 +470,7 @@ func (r *Recipe) Backport(prefix string, to XenVersion) (err error) {
                if _, err = xr.Rebase(toBranch, fromBase, toBase); err != nil {
                        return fmt.Errorf("Rebase failed.  Finish rebase for %v and continue.", to)
                }
-               
+
                return
        }
 
@@ -479,8 +478,6 @@ func (r *Recipe) Backport(prefix string, to XenVersion) (err error) {
        return
 }
 
-
-
 func (r *Recipe) Build(prefix string) (err error) {
        _, _, branch := r.branchName(prefix)
 
diff --git a/repo.go b/repo.go
index d6e7392c4ce954004eb75f5e0f2b74f5b1c505d8..820a3b123d2dcb8803b5568129b30367cc3ffbed 100644 (file)
--- a/repo.go
+++ b/repo.go
@@ -156,9 +156,9 @@ func MainRepoUpdate(unused *XSAMeta, args []string) (ret int) {
                branches, err := xr.Branches("stable-*")
 
                branches = append([]string{"master"}, branches...)
-               
+
                for _, branch := range branches {
-                       if _, err = xr.MergeDefault(branch) ; err != nil {
+                       if _, err = xr.MergeDefault(branch); err != nil {
                                err = fmt.Errorf("Merging branch %s on tree %v: %v\n",
                                        branch, tree, err)
                        }
@@ -166,12 +166,12 @@ func MainRepoUpdate(unused *XSAMeta, args []string) (ret int) {
 
                return
        }
-       
+
        if err := ForEachXenRepo(pull); err != nil {
                fmt.Printf("Trying to update trees: %v\n", err)
                return 1
        }
-       
+
        return 0
 }
 
index 906be235251e2f9dd19e86106906c006ef24677a..a0992ab44b4293877aff2ff7c8a21ae81d003f19 100644 (file)
@@ -30,26 +30,25 @@ type InitialTreeState map[Tree]*map[string]string
 // xsa           : bff3883
 
 var its = InitialTreeState{
-       "xen":   &map[string]string{
-               "master":"ac9ff74",
+       "xen": &map[string]string{
+               "master":     "ac9ff74",
                "stable-4.8": "e0354e6",
                "stable-4.7": "b5c7dea",
                "stable-4.6": "bb92bb7",
                "stable-4.5": "cde86fc",
                "stable-4.4": "89bd1cf",
        },
-       "qemuu":   &map[string]string{
-               "master":"acde9f3",
+       "qemuu": &map[string]string{
+               "master": "acde9f3",
        },
-       "qemut":   &map[string]string{
-               "master":"8b4834e",
+       "qemut": &map[string]string{
+               "master": "8b4834e",
        },
-       "xsa":   &map[string]string{
-               "master":"bff3883",
+       "xsa": &map[string]string{
+               "master": "bff3883",
        },
 }
 
-
 // Set up the repo in a known state.
 func InitRepo(st *SystemTest) bool {
        callRepoInit := true
@@ -120,8 +119,8 @@ func InitRepo(st *SystemTest) bool {
                        if fullRef, err = r.ParseRef(shortRef); err != nil {
                                return err
                        }
-                       
-                       originRef := "refs/remotes/origin/"+branch
+
+                       originRef := "refs/remotes/origin/" + branch
                        if _, err = r.SetRef(originRef, fullRef); err != nil {
                                return
                        }
@@ -323,7 +322,7 @@ func Story206Init(st *SystemTest) (pass bool) {
                                                        expectedRef, stableRef)
                                                pass = false
                                        }
-                                       
+
                                } else {
                                        if prs {
                                                st.Errorf("Unexpected tree: %v\n", tree)
@@ -477,7 +476,7 @@ func Story206(st *SystemTest) bool {
        if false && !Story206TestMaster(st) {
                return false
        }
-       
+
        // 206 Backport (should fail at 4.8. 4.7, and 4.6; NOT 4.5)
        if !Story206Backport(st) {
                return false
@@ -495,7 +494,7 @@ func MainSystemTest() (ret int) {
 
        // Fail unless we make it through the gauntlet
        ret = 1
-       
+
        // Store the toplevel directory
        topdir, err := os.Getwd()
        if err != nil {
@@ -544,6 +543,6 @@ out:
        } else {
                fmt.Print("System test: PASSED\n")
        }
-       
+
        return
 }
diff --git a/xen.go b/xen.go
index eaba4d64a4099725982ccfd9d690d1a61ef31382..19b726b49c560c335e30a9a607f07db7658f223a 100644 (file)
--- a/xen.go
+++ b/xen.go
@@ -247,7 +247,7 @@ func (xr *XenRepo) GetRefVersion(v XenVersion) (ref string, err error) {
 
 func (xr *XenRepo) MakeStableBranch(v XenVersion) (err error) {
        stableBranch := XenStableBranch(v)
-       
+
        branches, err := xr.Branches(stableBranch)
        if err != nil {
                return
@@ -258,14 +258,14 @@ func (xr *XenRepo) MakeStableBranch(v XenVersion) (err error) {
                        v, stableBranch)
                return
        }
-       
+
        // This should automatically set things up correctly from origin
        _, err = xr.Checkout(stableBranch)
 
        return
 }
 
-// Check out stable-$version (or 'master') 
+// Check out stable-$version (or 'master')
 func (xr *XenRepo) tagsToVersions(tags []string) (versions []XenVersionFull, err error) {
        re := regexp.MustCompile("^" + xr.releaseTagPrefix() + "([0-9]+.[0-9]+.[0-9]+)$")
 
diff --git a/xsa.go b/xsa.go
index c97941b09d3af20e2f7c9356aab4a7269630c7cf..552fabc1b1969e612ba91f25690e15dbf846492d 100644 (file)
--- a/xsa.go
+++ b/xsa.go
@@ -110,7 +110,7 @@ func MainInit(xsa *XSAMeta, args []string) (ret int) {
                }
                xsa.Trees = append(xsa.Trees, tree)
        }
-       
+
        xsa.Recipes = make(map[XenVersion]*Recipe)
 
        for v := range sm.Versions {
@@ -121,9 +121,9 @@ func MainInit(xsa *XSAMeta, args []string) (ret int) {
 
                for _, t := range xsa.Trees {
                        var err error
-                       
+
                        xr := G.repos.XenRepos[t]
-                       
+
                        if err = xr.MakeStableBranch(v); err != nil {
                                fmt.Printf("Checking out stable branch for version %v: %v\n",
                                        v, err)
@@ -220,7 +220,7 @@ func MainBackport(xsa *XSAMeta, args []string) (ret int) {
                // For if we ever add an "automatic build test option" instead
                // from = to
        }
-       
+
        fmt.Printf("Not implemented\n")
        return 1
 }