Simplify stringset function names

Now that stringset has its own module we can use more basic function
names while keeping it obvious what it does.
This commit is contained in:
morganamilo 2019-10-16 22:58:55 +01:00
parent dacd77012c
commit b60a888981
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
4 changed files with 14 additions and 14 deletions

View file

@ -89,8 +89,8 @@ func install(parser *arguments) (err error) {
return err
}
remoteNamesCache := stringset.SliceToStringSet(remoteNames)
localNamesCache := stringset.SliceToStringSet(localNames)
remoteNamesCache := stringset.FromSlice(remoteNames)
localNamesCache := stringset.FromSlice(localNames)
requestTargets := parser.copy().targets
@ -142,7 +142,7 @@ func install(parser *arguments) (err error) {
}
}
targets := stringset.SliceToStringSet(parser.targets)
targets := stringset.FromSlice(parser.targets)
dp, err := getDepPool(requestTargets, warnings)
if err != nil {
@ -987,8 +987,8 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
//cache as a stringset. maybe make it return a string set in the first
//place
remoteNamesCache := stringset.SliceToStringSet(remoteNames)
localNamesCache := stringset.SliceToStringSet(localNames)
remoteNamesCache := stringset.FromSlice(remoteNames)
localNamesCache := stringset.FromSlice(localNames)
doInstall := func() error {
if len(arguments.targets) == 0 {

View file

@ -60,8 +60,8 @@ func (set StringSet) Copy() StringSet {
return newSet
}
// SliceToStringSet creates a new StringSet from an input slice
func SliceToStringSet(in []string) StringSet {
// FromSlice creates a new StringSet from an input slice
func FromSlice(in []string) StringSet {
set := make(StringSet)
for _, v := range in {
@ -71,13 +71,13 @@ func SliceToStringSet(in []string) StringSet {
return set
}
// MakeStringSet creates a new StringSet from a set of arguments
func MakeStringSet(in ...string) StringSet {
return SliceToStringSet(in)
// Make creates a new StringSet from a set of arguments
func Make(in ...string) StringSet {
return FromSlice(in)
}
// StringSetEqual compares if two StringSets have the same values
func StringSetEqual(a, b StringSet) bool {
// Equal compares if two StringSets have the same values
func Equal(a, b StringSet) bool {
if a == nil && b == nil {
return true
}

View file

@ -392,7 +392,7 @@ func printNumberOfUpdates() error {
//TODO: Make it less hacky
func printUpdateList(parser *arguments) error {
targets := stringset.SliceToStringSet(parser.targets)
targets := stringset.FromSlice(parser.targets)
warnings := &aurWarnings{}
old := os.Stdout // keep backup of the real stdout
os.Stdout = nil

2
vcs.go
View file

@ -38,7 +38,7 @@ func createDevelDB() error {
}
bases := getBases(info)
toSkip := pkgbuildsToSkip(bases, stringset.SliceToStringSet(remoteNames))
toSkip := pkgbuildsToSkip(bases, stringset.FromSlice(remoteNames))
_, err = downloadPkgbuilds(bases, toSkip, config.BuildDir)
if err != nil {
return err