--- a/youtrack/subsystems.go Tue Dec 17 04:30:16 2019 -0600
+++ b/youtrack/subsystems.go Tue Dec 17 04:38:10 2019 -0600
@@ -24,22 +24,21 @@
- // create a map of all the subsystems
- subsystems := map[string]bool{}
- for _, subsystem := range p.Subsystems {
- subsystems[subsystem] = true
- // now remove any existing subsystems from the map
+ // create a map of the existing subsystems + existing := map[string]bool{} for _, field := range bundle.Fields {
- if _, found := subsystems[field.Value]; found {
- delete(subsystems, field.Value)
+ existing[field.Value] = true // now run through the map and add the new values
- for subsystem, _ := range subsystems {
+ for _, subsystem := range p.Subsystems { fmt.Printf("creating subsystem %q ... ", subsystem)
+ if _, found := existing[subsystem]; found { + fmt.Printf("already exists.\n") if err := c.AppendOwnedFieldBundle(bundle.Name, subsystem); err != nil {
--- a/youtrack/version.go Tue Dec 17 04:30:16 2019 -0600
+++ b/youtrack/version.go Tue Dec 17 04:38:10 2019 -0600
@@ -80,22 +80,21 @@
- // create a map of all the versions
- versions := map[string]bool{}
- for _, version := range p.Versions {
- versions[version] = true
+ // create a map of the existing versions + existing := map[string]bool{} + for _, version := range bundle.Versions { + existing[version.Name] = true - // now remove any existing versions from the map
- for _, version := range bundle.Versions {
- if _, found := versions[version.Name]; found {
- delete(versions, version.Name)
+ // now run through the version slice and add all the versions + for _, version := range p.Versions { + fmt.Printf("creating version %q ... ", version) + if _, found := existing[version]; found { + fmt.Printf("already exists.\n")
- // now run through the map and add all the missing versions
- for version, _ := range versions {
- fmt.Printf("creating version %q ... ", version)
if err := c.AppendVersionFieldBundle(bundle.Name, version); err != nil {