3
0
Wade Simmons 3 сар өмнө
parent
commit
8f0892ce4b
1 өөрчлөгдсөн 16 нэмэгдсэн , 5 устгасан
  1. 16 5
      main.go

+ 16 - 5
main.go

@@ -29,12 +29,8 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
 		}
 	}()
 
-	// Default to the module version for buildVersion
 	if buildVersion == "" {
-		info, ok := debug.ReadBuildInfo()
-		if ok {
-			buildVersion = strings.TrimPrefix(info.Main.Version, "v")
-		}
+		buildVersion = moduleVersion()
 	}
 
 	l := logger
@@ -308,3 +304,18 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
 		lightHouse.StartUpdateWorker,
 	}, nil
 }
+
+func moduleVersion() string {
+	info, ok := debug.ReadBuildInfo()
+	if !ok {
+		return ""
+	}
+
+	for _, dep := range info.Deps {
+		if dep.Path == "github.com/slackhq/nebula" {
+			return strings.TrimPrefix(dep.Version, "v")
+		}
+	}
+
+	return ""
+}