# HG changeset patch # User Sascha L. Teichmann # Date 1550074151 -3600 # Node ID cfc523c70e90c91f96cb4777f6a366f1f802fc2c # Parent f8f2c4d88939e16f971ed2eb4fd3baa00073cb75 Uploaded imports: Small code clean-ups. diff -r f8f2c4d88939 -r cfc523c70e90 pkg/imports/bn.go --- a/pkg/imports/bn.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/bn.go Wed Feb 13 17:09:11 2019 +0100 @@ -144,7 +144,7 @@ feedback Feedback, ) (interface{}, error) { - fetch := func(feedback Feedback) ([]*ifbn.BottleNeckType, error) { + fetch := func() ([]*ifbn.BottleNeckType, error) { client := ifbn.NewIBottleneckService(bn.URL, bn.Insecure, nil) req := &ifbn.Export_bn_by_isrs{} @@ -166,14 +166,14 @@ func storeBottlenecks( ctx context.Context, - fetch func(Feedback) ([]*ifbn.BottleNeckType, error), + fetch func() ([]*ifbn.BottleNeckType, error), importID int64, conn *sql.Conn, feedback Feedback, ) (interface{}, error) { start := time.Now() - bns, err := fetch(feedback) + bns, err := fetch() if err != nil { return nil, err } diff -r f8f2c4d88939 -r cfc523c70e90 pkg/imports/fa.go --- a/pkg/imports/fa.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/fa.go Wed Feb 13 17:09:11 2019 +0100 @@ -485,9 +485,10 @@ client := ifaf.NewFairwayAvailabilityService(fa.URL, fa.Insecure, nil) - var period ifaf.RequestedPeriod - period.Date_start = latest.Time - period.Date_end = time.Now() + period := ifaf.RequestedPeriod{ + Date_start: latest.Time, + Date_end: time.Now(), + } ids := ifaf.ArrayOfString{String: bns} diff -r f8f2c4d88939 -r cfc523c70e90 pkg/imports/ubn.go --- a/pkg/imports/ubn.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/ubn.go Wed Feb 13 17:09:11 2019 +0100 @@ -33,9 +33,7 @@ type ubnJobCreator struct{} -func init() { - RegisterJobCreator(UBNJobKind, ubnJobCreator{}) -} +func init() { RegisterJobCreator(UBNJobKind, ubnJobCreator{}) } func (ubnJobCreator) Description() string { return "uploaded bottlenecks" } @@ -59,9 +57,7 @@ } // CleanUp of a uploaded bottleneck import removes the temp dir. -func (ubn *UploadedBottleneck) CleanUp() error { - return os.RemoveAll(ubn.Dir) -} +func (ubn *UploadedBottleneck) CleanUp() error { return os.RemoveAll(ubn.Dir) } // Do executes the actual uploaded bottleneck import. func (ubn *UploadedBottleneck) Do( @@ -71,7 +67,7 @@ feedback Feedback, ) (interface{}, error) { - fetch := func(feedback Feedback) ([]*ifbn.BottleNeckType, error) { + fetch := func() ([]*ifbn.BottleNeckType, error) { var dst ifbn.Export_bn_by_isrsResponse if err := soap.ValidateFile( filepath.Join(ubn.Dir, "data.xml"),