From dcfe1a17b31ecee81fe5063f95c841afa0b7b14c Mon Sep 17 00:00:00 2001 From: Tsukoyachi Date: Tue, 4 Jun 2024 19:19:18 +0700 Subject: [PATCH] bugfix: Replace the value when spacetrack give the same norad id multiple time, and warn the user #1 --- service/initlization.go | 3 ++- spacetrack/client.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/initlization.go b/service/initlization.go index 5330e79..32bf8b2 100644 --- a/service/initlization.go +++ b/service/initlization.go @@ -30,8 +30,9 @@ func NewSatelliteService() *SatelliteService { } // check if the object id is already in the map if _, ok := calculatedMap[tle.NORAD_CAT_ID]; ok { - log.Fatalf("NORAD_CAT_ID %v is already in the map", tle.OBJECT_ID) + log.Warnf("NORAD_CAT_ID %v is already in the map, latest version taken into account", tle.OBJECT_ID) } + calculatedMap[tle.NORAD_CAT_ID] = tle } diff --git a/spacetrack/client.go b/spacetrack/client.go index 0754723..2036326 100644 --- a/spacetrack/client.go +++ b/spacetrack/client.go @@ -5,10 +5,9 @@ import ( "fmt" "net/url" "os" -) -import "github.com/go-resty/resty/v2" -import ( + "github.com/go-resty/resty/v2" + log "github.com/sirupsen/logrus" )