diff --git a/keys_test.go b/keys_test.go index a896e96e..f42941b3 100644 --- a/keys_test.go +++ b/keys_test.go @@ -150,7 +150,7 @@ func TestCheckPgpKeys(t *testing.T) { // 487EACC08557AD082088DABA1EB2638FF56C0C53: Dave Reisner. { pkgs: []*rpc.Pkg{newPkg("cower")}, - srcinfos: map[string]*gopkg.PKGBUILD{"cower": &gopkg.PKGBUILD{Pkgbase: "cower", Validpgpkeys: []string{"487EACC08557AD082088DABA1EB2638FF56C0C53"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"cower": {Pkgbase: "cower", Validpgpkeys: []string{"487EACC08557AD082088DABA1EB2638FF56C0C53"}}}, bases: map[string][]*rpc.Pkg{"cower": {newPkg("cower")}}, wantError: false, }, @@ -159,7 +159,7 @@ func TestCheckPgpKeys(t *testing.T) { // B6C8F98282B944E3B0D5C2530FC3042E345AD05D: Hans Wennborg. { pkgs: []*rpc.Pkg{newPkg("libc++")}, - srcinfos: map[string]*gopkg.PKGBUILD{"libc++": &gopkg.PKGBUILD{Pkgbase: "libc++", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"libc++": {Pkgbase: "libc++", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D"}}}, bases: map[string][]*rpc.Pkg{"libc++": {newPkg("libc++")}}, wantError: false, }, @@ -167,7 +167,7 @@ func TestCheckPgpKeys(t *testing.T) { // ABAF11C65A2970B130ABE3C479BE3E4300411886: Linus Torvalds. { pkgs: []*rpc.Pkg{newPkg("dummy-1"), newPkg("dummy-2")}, - srcinfos: map[string]*gopkg.PKGBUILD{"dummy-1": &gopkg.PKGBUILD{Pkgbase: "dummy-1", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}, "dummy-2": &gopkg.PKGBUILD{Pkgbase: "dummy-2", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"dummy-1": {Pkgbase: "dummy-1", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}, "dummy-2": {Pkgbase: "dummy-2", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}}, bases: map[string][]*rpc.Pkg{"dummy-1": {newPkg("dummy-1")}, "dummy-2": {newPkg("dummy-2")}}, wantError: false, }, @@ -177,21 +177,21 @@ func TestCheckPgpKeys(t *testing.T) { // C52048C0C0748FEE227D47A2702353E0F7E48EDB: Thomas Dickey. { pkgs: []*rpc.Pkg{newPkg("dummy-3")}, - srcinfos: map[string]*gopkg.PKGBUILD{"dummy-3": &gopkg.PKGBUILD{Pkgbase: "dummy-3", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"dummy-3": {Pkgbase: "dummy-3", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, bases: map[string][]*rpc.Pkg{"dummy-3": {newPkg("dummy-3")}}, wantError: false, }, // Two dummy packages with existing keys. { pkgs: []*rpc.Pkg{newPkg("dummy-4"), newPkg("dummy-5")}, - srcinfos: map[string]*gopkg.PKGBUILD{"dummy-4": &gopkg.PKGBUILD{Pkgbase: "dummy-4", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294"}}, "dummy-5": &gopkg.PKGBUILD{Pkgbase: "dummy-5", Validpgpkeys: []string{"C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"dummy-4": {Pkgbase: "dummy-4", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294"}}, "dummy-5": {Pkgbase: "dummy-5", Validpgpkeys: []string{"C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, bases: map[string][]*rpc.Pkg{"dummy-4": {newPkg("dummy-4")}, "dummy-5": {newPkg("dummy-5")}}, wantError: false, }, // Dummy package with invalid key, should fail. { pkgs: []*rpc.Pkg{newPkg("dummy-7")}, - srcinfos: map[string]*gopkg.PKGBUILD{"dummy-7": &gopkg.PKGBUILD{Pkgbase: "dummy-7", Validpgpkeys: []string{"THIS-SHOULD-FAIL"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"dummy-7": {Pkgbase: "dummy-7", Validpgpkeys: []string{"THIS-SHOULD-FAIL"}}}, bases: map[string][]*rpc.Pkg{"dummy-7": {newPkg("dummy-7")}}, wantError: true, }, @@ -199,7 +199,7 @@ func TestCheckPgpKeys(t *testing.T) { // A314827C4E4250A204CE6E13284FC34C8E4B1A25: Thomas Bächler. { pkgs: []*rpc.Pkg{newPkg("dummy-8")}, - srcinfos: map[string]*gopkg.PKGBUILD{"dummy-8": &gopkg.PKGBUILD{Pkgbase: "dummy-8", Validpgpkeys: []string{"A314827C4E4250A204CE6E13284FC34C8E4B1A25", "THIS-SHOULD-FAIL"}}}, + srcinfos: map[string]*gopkg.PKGBUILD{"dummy-8": {Pkgbase: "dummy-8", Validpgpkeys: []string{"A314827C4E4250A204CE6E13284FC34C8E4B1A25", "THIS-SHOULD-FAIL"}}}, bases: map[string][]*rpc.Pkg{"dummy-8": {newPkg("dummy-8")}}, wantError: true, }, diff --git a/upgrade.go b/upgrade.go index c75b4504..a933bb9e 100644 --- a/upgrade.go +++ b/upgrade.go @@ -117,8 +117,8 @@ func getVersionDiff(oldVersion, newversion string) (left, right string) { samePart := oldVersion[0:diffPosition] - left = samePart + red(oldVersion[diffPosition:len(oldVersion)]) - right = samePart + green(newVersion[diffPosition:len(newVersion)]) + left = samePart + red(oldVersion[diffPosition:]) + right = samePart + green(newVersion[diffPosition:]) } return