changeset 4182:49012340336c

Made 'golint' finally happy with imports package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Aug 2019 11:13:28 +0200
parents bd97dc2dceea
children 34623265eac1
files pkg/imports/sr.go pkg/imports/ufa.go pkg/imports/ugm.go pkg/imports/wg.go pkg/imports/wp.go
diffstat 5 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/sr.go	Mon Aug 05 18:32:54 2019 +0200
+++ b/pkg/imports/sr.go	Tue Aug 06 11:13:28 2019 +0200
@@ -73,7 +73,7 @@
 	pointsPerSquareMeter = 2
 )
 
-// SRJobKind is the unique name of a SoundingResult import job.
+// SRJobKind is the unique name of this import job type.
 const SRJobKind JobKind = "sr"
 
 type srJobCreator struct{}
--- a/pkg/imports/ufa.go	Mon Aug 05 18:32:54 2019 +0200
+++ b/pkg/imports/ufa.go	Tue Aug 06 11:13:28 2019 +0200
@@ -24,10 +24,14 @@
 	"gemma.intevation.de/gemma/pkg/soap/ifaf"
 )
 
+// UploadedFairwayAvailability is Job to extract
+// fairway availability data from an XML file and stores
+// it into the database.
 type UploadedFairwayAvailability struct {
 	Dir string
 }
 
+// UFAJobKind is the unique name of this import job type.
 const UFAJobKind JobKind = "ufa"
 
 type ufaJobCreator struct{}
@@ -51,6 +55,7 @@
 	return nil
 }
 
+// CleanUp removes the temporary files from the filesystem.
 func (ufa *UploadedFairwayAvailability) CleanUp() error {
 	return os.RemoveAll(ufa.Dir)
 }
--- a/pkg/imports/ugm.go	Mon Aug 05 18:32:54 2019 +0200
+++ b/pkg/imports/ugm.go	Tue Aug 06 11:13:28 2019 +0200
@@ -24,10 +24,13 @@
 	"gemma.intevation.de/gemma/pkg/soap/nts"
 )
 
+// UploadedGaugeMeasurement is an Jon to extract gauge measurement data
+// from an uploaded XML file and stores it into the database.
 type UploadedGaugeMeasurement struct {
 	Dir string `json:"dir"`
 }
 
+// UGMJobKind is the unique name of this import job type.
 const UGMJobKind JobKind = "ugm"
 
 type ugmJobCreator struct{}
@@ -44,6 +47,7 @@
 
 func (ugmJobCreator) StageDone(context.Context, *sql.Tx, int64) error { return nil }
 
+// CleanUp removes the temporary files from the filesystem.
 func (ugm *UploadedGaugeMeasurement) CleanUp() error { return os.RemoveAll(ugm.Dir) }
 
 // Do executes the actual uploaded gauge measurement import.
--- a/pkg/imports/wg.go	Mon Aug 05 18:32:54 2019 +0200
+++ b/pkg/imports/wg.go	Tue Aug 06 11:13:28 2019 +0200
@@ -26,6 +26,8 @@
 	"gemma.intevation.de/gemma/pkg/soap/erdms"
 )
 
+// WaterwayGauge is a Job to load gauge data from
+// a specified NTS service and stores them into the database.
 type WaterwayGauge struct {
 	// URL is the URL of the SOAP service.
 	URL string `json:"url"`
@@ -38,13 +40,12 @@
 	Insecure bool `json:"insecure"`
 }
 
+// WGJobKind is the unique name of this import job type.
 const WGJobKind JobKind = "wg"
 
 type wgJobCreator struct{}
 
-func init() {
-	RegisterJobCreator(WGJobKind, wgJobCreator{})
-}
+func init() { RegisterJobCreator(WGJobKind, wgJobCreator{}) }
 
 func (wgJobCreator) Description() string { return "waterway gauges" }
 
@@ -171,6 +172,7 @@
 `
 )
 
+// Do implements the actual import.
 func (wg *WaterwayGauge) Do(
 	ctx context.Context,
 	importID int64,
--- a/pkg/imports/wp.go	Mon Aug 05 18:32:54 2019 +0200
+++ b/pkg/imports/wp.go	Tue Aug 06 11:13:28 2019 +0200
@@ -39,6 +39,9 @@
 // to match from points to lines.
 const defaultPointToLinePrecision = 10
 
+// WaterwayProfiles is a Job to import waterway profiles
+// from a given WFS service plus some uploaded CSV file
+// and stores them into the database.
 type WaterwayProfiles struct {
 	Dir string `json:"dir"`
 	// URL the GetCapabilities URL of the WFS service.
@@ -56,6 +59,7 @@
 	Password string `json:"password,omitempty"`
 }
 
+// WPJobKind is the unique name of this import job type.
 const WPJobKind JobKind = "wp"
 
 type wpJobCreator struct{}
@@ -149,10 +153,10 @@
 	return err
 }
 
-func (wp *WaterwayProfiles) CleanUp() error {
-	return os.RemoveAll(wp.Dir)
-}
+// CleanUp deletes temporary files from the filesystem.
+func (wp *WaterwayProfiles) CleanUp() error { return os.RemoveAll(wp.Dir) }
 
+// Do performs the actual import.
 func (wp *WaterwayProfiles) Do(
 	ctx context.Context,
 	importID int64,