mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
fix(format): gofumt files
This commit is contained in:
parent
a0cff2b622
commit
e47c9584c1
11 changed files with 90 additions and 61 deletions
|
@ -62,7 +62,6 @@ func questionCallback(question alpm.QuestionAny) {
|
||||||
|
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
numberBuf, overflow, err := reader.ReadLine()
|
numberBuf, overflow, err := reader.ReadLine()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
text.Errorln(err)
|
text.Errorln(err)
|
||||||
break
|
break
|
||||||
|
|
|
@ -71,7 +71,7 @@ func gitHasDiff(path, name string) (bool, error) {
|
||||||
|
|
||||||
// TODO: yay-next passes args through the header, use that to unify ABS and AUR
|
// TODO: yay-next passes args through the header, use that to unify ABS and AUR
|
||||||
func gitDownloadABS(url, path, name string) (bool, error) {
|
func gitDownloadABS(url, path, name string) (bool, error) {
|
||||||
if err := os.MkdirAll(path, 0755); err != nil {
|
if err := os.MkdirAll(path, 0o755); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,6 @@ func getPkgbuilds(pkgs []string, alpmHandle *alpm.Handle, force bool) error {
|
||||||
|
|
||||||
pkgs = removeInvalidTargets(pkgs)
|
pkgs = removeInvalidTargets(pkgs)
|
||||||
aur, repo, err := packageSlices(pkgs, alpmHandle)
|
aur, repo, err := packageSlices(pkgs, alpmHandle)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -317,5 +316,6 @@ func getPkgbuildsfromABS(pkgs []string, path string, alpmHandle *alpm.Handle, fo
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
return len(missing) != 0, errs.Return()
|
return len(missing) != 0, errs.Return()
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,6 @@ nextpkg:
|
||||||
|
|
||||||
func parsePackageList(dir string) (pkgdests map[string]string, pkgVersion string, err error) {
|
func parsePackageList(dir string) (pkgdests map[string]string, pkgVersion string, err error) {
|
||||||
stdout, stderr, err := capture(passToMakepkg(dir, "--packagelist"))
|
stdout, stderr, err := capture(passToMakepkg(dir, "--packagelist"))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("%s %s", stderr, err)
|
return nil, "", fmt.Errorf("%s %s", stderr, err)
|
||||||
}
|
}
|
||||||
|
@ -772,9 +771,11 @@ func showPkgbuildDiffs(bases []Base, cloned stringset.StringSet) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{"diff",
|
args := []string{
|
||||||
|
"diff",
|
||||||
start + "..HEAD@{upstream}", "--src-prefix",
|
start + "..HEAD@{upstream}", "--src-prefix",
|
||||||
dir + "/", "--dst-prefix", dir + "/", "--", ".", ":(exclude).SRCINFO"}
|
dir + "/", "--dst-prefix", dir + "/", "--", ".", ":(exclude).SRCINFO",
|
||||||
|
}
|
||||||
if text.UseColor {
|
if text.UseColor {
|
||||||
args = append(args, "--color=always")
|
args = append(args, "--color=always")
|
||||||
} else {
|
} else {
|
||||||
|
|
1
keys.go
1
keys.go
|
@ -96,7 +96,6 @@ func importKeys(keys []string) error {
|
||||||
|
|
||||||
text.OperationInfoln(gotext.Get("Importing keys with gpg..."))
|
text.OperationInfoln(gotext.Get("Importing keys with gpg..."))
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(gotext.Get("problem importing keys"))
|
return errors.New(gotext.Get("problem importing keys"))
|
||||||
}
|
}
|
||||||
|
|
24
keys_test.go
24
keys_test.go
|
@ -100,8 +100,10 @@ func TestImportKeys(t *testing.T) {
|
||||||
// 11E521D646982372EB577A1F8F0871F202119294: Tom Stellard.
|
// 11E521D646982372EB577A1F8F0871F202119294: Tom Stellard.
|
||||||
// B6C8F98282B944E3B0D5C2530FC3042E345AD05D: Hans Wennborg.
|
// B6C8F98282B944E3B0D5C2530FC3042E345AD05D: Hans Wennborg.
|
||||||
{
|
{
|
||||||
keys: []string{"11E521D646982372EB577A1F8F0871F202119294",
|
keys: []string{
|
||||||
"B6C8F98282B944E3B0D5C2530FC3042E345AD05D"},
|
"11E521D646982372EB577A1F8F0871F202119294",
|
||||||
|
"B6C8F98282B944E3B0D5C2530FC3042E345AD05D",
|
||||||
|
},
|
||||||
wantError: false,
|
wantError: false,
|
||||||
},
|
},
|
||||||
// Single invalid key, should fail.
|
// Single invalid key, should fail.
|
||||||
|
@ -117,8 +119,10 @@ func TestImportKeys(t *testing.T) {
|
||||||
// Invalid + valid key. Should fail as well.
|
// Invalid + valid key. Should fail as well.
|
||||||
// 647F28654894E3BD457199BE38DBBDC86092693E: Greg Kroah-Hartman.
|
// 647F28654894E3BD457199BE38DBBDC86092693E: Greg Kroah-Hartman.
|
||||||
{
|
{
|
||||||
keys: []string{"THIS-SHOULD-FAIL",
|
keys: []string{
|
||||||
"647F28654894E3BD457199BE38DBBDC86092693E"},
|
"THIS-SHOULD-FAIL",
|
||||||
|
"647F28654894E3BD457199BE38DBBDC86092693E",
|
||||||
|
},
|
||||||
wantError: true,
|
wantError: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -182,7 +186,8 @@ func TestCheckPgpKeys(t *testing.T) {
|
||||||
{
|
{
|
||||||
pkgs: Base{newPkg("libc++")},
|
pkgs: Base{newPkg("libc++")},
|
||||||
srcinfos: map[string]*gosrc.Srcinfo{
|
srcinfos: map[string]*gosrc.Srcinfo{
|
||||||
"libc++": makeSrcinfo("libc++", "11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D")},
|
"libc++": makeSrcinfo("libc++", "11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D"),
|
||||||
|
},
|
||||||
wantError: false,
|
wantError: false,
|
||||||
},
|
},
|
||||||
// Two dummy packages requiring the same key.
|
// Two dummy packages requiring the same key.
|
||||||
|
@ -192,7 +197,8 @@ func TestCheckPgpKeys(t *testing.T) {
|
||||||
srcinfos: map[string]*gosrc.Srcinfo{
|
srcinfos: map[string]*gosrc.Srcinfo{
|
||||||
"dummy-1": makeSrcinfo("dummy-1",
|
"dummy-1": makeSrcinfo("dummy-1",
|
||||||
"ABAF11C65A2970B130ABE3C479BE3E4300411886"),
|
"ABAF11C65A2970B130ABE3C479BE3E4300411886"),
|
||||||
"dummy-2": makeSrcinfo("dummy-2", "ABAF11C65A2970B130ABE3C479BE3E4300411886")},
|
"dummy-2": makeSrcinfo("dummy-2", "ABAF11C65A2970B130ABE3C479BE3E4300411886"),
|
||||||
|
},
|
||||||
wantError: false,
|
wantError: false,
|
||||||
},
|
},
|
||||||
// dummy package: single package, two valid keys, one of them already
|
// dummy package: single package, two valid keys, one of them already
|
||||||
|
@ -202,7 +208,8 @@ func TestCheckPgpKeys(t *testing.T) {
|
||||||
{
|
{
|
||||||
pkgs: Base{newPkg("dummy-3")},
|
pkgs: Base{newPkg("dummy-3")},
|
||||||
srcinfos: map[string]*gosrc.Srcinfo{
|
srcinfos: map[string]*gosrc.Srcinfo{
|
||||||
"dummy-3": makeSrcinfo("dummy-3", "11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB")},
|
"dummy-3": makeSrcinfo("dummy-3", "11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"),
|
||||||
|
},
|
||||||
wantError: false,
|
wantError: false,
|
||||||
},
|
},
|
||||||
// Two dummy packages with existing keys.
|
// Two dummy packages with existing keys.
|
||||||
|
@ -210,7 +217,8 @@ func TestCheckPgpKeys(t *testing.T) {
|
||||||
pkgs: Base{newPkg("dummy-4"), newPkg("dummy-5")},
|
pkgs: Base{newPkg("dummy-4"), newPkg("dummy-5")},
|
||||||
srcinfos: map[string]*gosrc.Srcinfo{
|
srcinfos: map[string]*gosrc.Srcinfo{
|
||||||
"dummy-4": makeSrcinfo("dummy-4", "11E521D646982372EB577A1F8F0871F202119294"),
|
"dummy-4": makeSrcinfo("dummy-4", "11E521D646982372EB577A1F8F0871F202119294"),
|
||||||
"dummy-5": makeSrcinfo("dummy-5", "C52048C0C0748FEE227D47A2702353E0F7E48EDB")},
|
"dummy-5": makeSrcinfo("dummy-5", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"),
|
||||||
|
},
|
||||||
wantError: false,
|
wantError: false,
|
||||||
},
|
},
|
||||||
// Dummy package with invalid key, should fail.
|
// Dummy package with invalid key, should fail.
|
||||||
|
|
2
main.go
2
main.go
|
@ -64,7 +64,7 @@ func initVCS(vcsFilePath string) error {
|
||||||
|
|
||||||
func initBuildDir() error {
|
func initBuildDir() error {
|
||||||
if _, err := os.Stat(config.BuildDir); os.IsNotExist(err) {
|
if _, err := os.Stat(config.BuildDir); os.IsNotExist(err) {
|
||||||
if err = os.MkdirAll(config.BuildDir, 0755); err != nil {
|
if err = os.MkdirAll(config.BuildDir, 0o755); err != nil {
|
||||||
return errors.New(gotext.Get("failed to create BuildDir directory '%s': %s", config.BuildDir, err))
|
return errors.New(gotext.Get("failed to create BuildDir directory '%s': %s", config.BuildDir, err))
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|
|
@ -30,39 +30,55 @@ func TestParseNumberMenu(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expected := []result{
|
expected := []result{
|
||||||
{IntRanges{makeIntRange(1, 1),
|
{IntRanges{
|
||||||
|
makeIntRange(1, 1),
|
||||||
makeIntRange(2, 2),
|
makeIntRange(2, 2),
|
||||||
makeIntRange(3, 3),
|
makeIntRange(3, 3),
|
||||||
makeIntRange(4, 4),
|
makeIntRange(4, 4),
|
||||||
makeIntRange(5, 5)}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
makeIntRange(5, 5),
|
||||||
{IntRanges{makeIntRange(1, 10),
|
}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
makeIntRange(5, 15)}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
{IntRanges{
|
||||||
{IntRanges{makeIntRange(5, 10),
|
makeIntRange(1, 10),
|
||||||
makeIntRange(85, 90)}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
makeIntRange(5, 15),
|
||||||
{IntRanges{makeIntRange(1, 1),
|
}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
|
{IntRanges{
|
||||||
|
makeIntRange(5, 10),
|
||||||
|
makeIntRange(85, 90),
|
||||||
|
}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
|
{
|
||||||
|
IntRanges{
|
||||||
|
makeIntRange(1, 1),
|
||||||
makeIntRange(99, 99),
|
makeIntRange(99, 99),
|
||||||
makeIntRange(60, 62)},
|
makeIntRange(60, 62),
|
||||||
IntRanges{makeIntRange(2, 2),
|
},
|
||||||
|
IntRanges{
|
||||||
|
makeIntRange(2, 2),
|
||||||
makeIntRange(5, 10),
|
makeIntRange(5, 10),
|
||||||
makeIntRange(38, 40),
|
makeIntRange(38, 40),
|
||||||
makeIntRange(123, 123)},
|
makeIntRange(123, 123),
|
||||||
make(stringset.StringSet), make(stringset.StringSet)},
|
},
|
||||||
|
make(stringset.StringSet), make(stringset.StringSet),
|
||||||
|
},
|
||||||
{IntRanges{}, IntRanges{}, stringset.Make("abort", "all", "none"), make(stringset.StringSet)},
|
{IntRanges{}, IntRanges{}, stringset.Make("abort", "all", "none"), make(stringset.StringSet)},
|
||||||
{IntRanges{}, IntRanges{}, stringset.Make("a-b"), stringset.Make("abort", "a-b")},
|
{IntRanges{}, IntRanges{}, stringset.Make("a-b"), stringset.Make("abort", "a-b")},
|
||||||
{IntRanges{}, IntRanges{}, stringset.Make("-9223372036854775809-9223372036854775809"), make(stringset.StringSet)},
|
{IntRanges{}, IntRanges{}, stringset.Make("-9223372036854775809-9223372036854775809"), make(stringset.StringSet)},
|
||||||
{IntRanges{makeIntRange(1, 1),
|
{IntRanges{
|
||||||
|
makeIntRange(1, 1),
|
||||||
makeIntRange(2, 2),
|
makeIntRange(2, 2),
|
||||||
makeIntRange(3, 3),
|
makeIntRange(3, 3),
|
||||||
makeIntRange(4, 4),
|
makeIntRange(4, 4),
|
||||||
makeIntRange(5, 5)}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
makeIntRange(5, 5),
|
||||||
{IntRanges{makeIntRange(1, 1),
|
}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
|
{IntRanges{
|
||||||
|
makeIntRange(1, 1),
|
||||||
makeIntRange(2, 2),
|
makeIntRange(2, 2),
|
||||||
makeIntRange(3, 3),
|
makeIntRange(3, 3),
|
||||||
makeIntRange(4, 4),
|
makeIntRange(4, 4),
|
||||||
makeIntRange(5, 5),
|
makeIntRange(5, 5),
|
||||||
makeIntRange(6, 6),
|
makeIntRange(6, 6),
|
||||||
makeIntRange(7, 7),
|
makeIntRange(7, 7),
|
||||||
makeIntRange(8, 8)}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
makeIntRange(8, 8),
|
||||||
|
}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
{IntRanges{}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
{IntRanges{}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
{IntRanges{}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
{IntRanges{}, IntRanges{}, make(stringset.StringSet), make(stringset.StringSet)},
|
||||||
{IntRanges{}, IntRanges{}, stringset.Make("a", "b", "c", "d", "e"), make(stringset.StringSet)},
|
{IntRanges{}, IntRanges{}, stringset.Make("a", "b", "c", "d", "e"), make(stringset.StringSet)},
|
||||||
|
@ -76,7 +92,6 @@ func TestParseNumberMenu(t *testing.T) {
|
||||||
!intRangesEqual(exclude, res.Exclude) ||
|
!intRangesEqual(exclude, res.Exclude) ||
|
||||||
!stringset.Equal(otherInclude, res.OtherInclude) ||
|
!stringset.Equal(otherInclude, res.OtherInclude) ||
|
||||||
!stringset.Equal(otherExclude, res.OtherExclude) {
|
!stringset.Equal(otherExclude, res.OtherExclude) {
|
||||||
|
|
||||||
t.Fatalf("Test %d Failed: Expected: include=%+v exclude=%+v otherInclude=%+v otherExclude=%+v got include=%+v excluive=%+v otherInclude=%+v otherExclude=%+v",
|
t.Fatalf("Test %d Failed: Expected: include=%+v exclude=%+v otherInclude=%+v otherExclude=%+v got include=%+v excluive=%+v otherInclude=%+v otherExclude=%+v",
|
||||||
n+1, res.Include, res.Exclude, res.OtherInclude, res.OtherExclude, include, exclude, otherInclude, otherExclude)
|
n+1, res.Include, res.Exclude, res.OtherInclude, res.OtherExclude, include, exclude, otherInclude, otherExclude)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,14 +123,18 @@ func TestArguments_CopyGlobal(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{name: "simple", fields: fields{
|
{name: "simple", fields: fields{
|
||||||
Op: "Q",
|
Op: "Q",
|
||||||
Options: map[string]*Option{"a": {}, "arch": {Global: true,
|
Options: map[string]*Option{
|
||||||
|
"a": {}, "arch": {
|
||||||
|
Global: true,
|
||||||
Args: []string{"x86_x64"},
|
Args: []string{"x86_x64"},
|
||||||
}, "boo": {Global: true, Args: []string{"a", "b"}},
|
}, "boo": {Global: true, Args: []string{"a", "b"}},
|
||||||
},
|
},
|
||||||
Targets: []string{"a", "b"},
|
Targets: []string{"a", "b"},
|
||||||
}, want: &Arguments{
|
}, want: &Arguments{
|
||||||
Op: "",
|
Op: "",
|
||||||
Options: map[string]*Option{"arch": {Global: true,
|
Options: map[string]*Option{
|
||||||
|
"arch": {
|
||||||
|
Global: true,
|
||||||
Args: []string{"x86_x64"},
|
Args: []string{"x86_x64"},
|
||||||
}, "boo": {Global: true, Args: []string{"a", "b"}},
|
}, "boo": {Global: true, Args: []string{"a", "b"}},
|
||||||
},
|
},
|
||||||
|
@ -166,14 +170,17 @@ func TestArguments_Copy(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{name: "simple", fields: fields{
|
{name: "simple", fields: fields{
|
||||||
Op: "Q",
|
Op: "Q",
|
||||||
Options: map[string]*Option{"a": {}, "arch": {
|
Options: map[string]*Option{
|
||||||
|
"a": {}, "arch": {
|
||||||
Args: []string{"x86_x64"}, Global: true,
|
Args: []string{"x86_x64"}, Global: true,
|
||||||
}, "boo": {Args: []string{"a", "b"}, Global: true},
|
}, "boo": {Args: []string{"a", "b"}, Global: true},
|
||||||
},
|
},
|
||||||
Targets: []string{"a", "b"},
|
Targets: []string{"a", "b"},
|
||||||
}, want: &Arguments{
|
}, want: &Arguments{
|
||||||
Op: "Q",
|
Op: "Q",
|
||||||
Options: map[string]*Option{"a": {}, "arch": {Global: true,
|
Options: map[string]*Option{
|
||||||
|
"a": {}, "arch": {
|
||||||
|
Global: true,
|
||||||
Args: []string{"x86_x64"},
|
Args: []string{"x86_x64"},
|
||||||
}, "boo": {Args: []string{"a", "b"}, Global: true},
|
}, "boo": {Args: []string{"a", "b"}, Global: true},
|
||||||
},
|
},
|
||||||
|
|
11
print.go
11
print.go
|
@ -19,8 +19,10 @@ import (
|
||||||
"github.com/Jguer/yay/v10/pkg/text"
|
"github.com/Jguer/yay/v10/pkg/text"
|
||||||
)
|
)
|
||||||
|
|
||||||
const arrow = "==>"
|
const (
|
||||||
const smallArrow = " ->"
|
arrow = "==>"
|
||||||
|
smallArrow = " ->"
|
||||||
|
)
|
||||||
|
|
||||||
func (warnings *aurWarnings) print() {
|
func (warnings *aurWarnings) print() {
|
||||||
if len(warnings.Missing) > 0 {
|
if len(warnings.Missing) > 0 {
|
||||||
|
@ -353,7 +355,7 @@ func localStatistics(alpmHandle *alpm.Handle) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Make it less hacky
|
// TODO: Make it less hacky
|
||||||
func printNumberOfUpdates(alpmHandle *alpm.Handle, enableDowngrade bool) error {
|
func printNumberOfUpdates(alpmHandle *alpm.Handle, enableDowngrade bool) error {
|
||||||
warnings := makeWarnings()
|
warnings := makeWarnings()
|
||||||
old := os.Stdout // keep backup of the real stdout
|
old := os.Stdout // keep backup of the real stdout
|
||||||
|
@ -368,7 +370,7 @@ func printNumberOfUpdates(alpmHandle *alpm.Handle, enableDowngrade bool) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Make it less hacky
|
// TODO: Make it less hacky
|
||||||
func printUpdateList(cmdArgs *settings.Arguments, alpmHandle *alpm.Handle, enableDowngrade bool) error {
|
func printUpdateList(cmdArgs *settings.Arguments, alpmHandle *alpm.Handle, enableDowngrade bool) error {
|
||||||
targets := stringset.FromSlice(cmdArgs.Targets)
|
targets := stringset.FromSlice(cmdArgs.Targets)
|
||||||
warnings := makeWarnings()
|
warnings := makeWarnings()
|
||||||
|
@ -513,7 +515,6 @@ func providerMenu(dep string, providers providers) *rpc.Pkg {
|
||||||
|
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
numberBuf, overflow, err := reader.ReadLine()
|
numberBuf, overflow, err := reader.ReadLine()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
break
|
break
|
||||||
|
|
12
vcs.go
12
vcs.go
|
@ -20,13 +20,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Info contains the last commit sha of a repo
|
// Info contains the last commit sha of a repo
|
||||||
type vcsInfo map[string]shaInfos
|
type (
|
||||||
type shaInfos map[string]shaInfo
|
vcsInfo map[string]shaInfos
|
||||||
type shaInfo struct {
|
shaInfos map[string]shaInfo
|
||||||
|
shaInfo struct {
|
||||||
Protocols []string `json:"protocols"`
|
Protocols []string `json:"protocols"`
|
||||||
Branch string `json:"branch"`
|
Branch string `json:"branch"`
|
||||||
SHA string `json:"sha"`
|
SHA string `json:"sha"`
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// createDevelDB forces yay to create a DB of the existing development packages
|
// createDevelDB forces yay to create a DB of the existing development packages
|
||||||
func createDevelDB(vcsFilePath string, alpmHandle *alpm.Handle) error {
|
func createDevelDB(vcsFilePath string, alpmHandle *alpm.Handle) error {
|
||||||
|
@ -245,7 +247,7 @@ func saveVCSInfo(vcsFilePath string) error {
|
||||||
if err != nil || string(marshalledinfo) == "null" {
|
if err != nil || string(marshalledinfo) == "null" {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
in, err := os.OpenFile(vcsFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
in, err := os.OpenFile(vcsFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func isEqual(a, b []string) bool {
|
func isEqual(a, b []string) bool {
|
||||||
|
|
||||||
if a == nil && b == nil {
|
if a == nil && b == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -59,10 +58,8 @@ func TestParsing(t *testing.T) {
|
||||||
if url != compare.URL ||
|
if url != compare.URL ||
|
||||||
branch != compare.Branch ||
|
branch != compare.Branch ||
|
||||||
!isEqual(protocols, compare.Protocols) {
|
!isEqual(protocols, compare.Protocols) {
|
||||||
|
|
||||||
t.Fatalf("Test %d failed: Expected: url=%+v branch=%+v protocols=%+v\ngot url=%+v branch=%+v protocols=%+v",
|
t.Fatalf("Test %d failed: Expected: url=%+v branch=%+v protocols=%+v\ngot url=%+v branch=%+v protocols=%+v",
|
||||||
n+1, compare.URL, compare.Branch, compare.Protocols, url, branch, protocols)
|
n+1, compare.URL, compare.Branch, compare.Protocols, url, branch, protocols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue