about summary refs log tree commit diff stats
path: root/internal/importer
diff options
context:
space:
mode:
authorAlan Pearce2024-05-09 18:58:14 +0200
committerAlan Pearce2024-05-09 19:28:15 +0200
commit3b379a13710cae2adc56131af1069e6fb92976b8 (patch)
treed7801226ac84e201c6eea11a04941b1137adc78f /internal/importer
parent0986e8699e87addccbef43c0ce30a466988fed15 (diff)
downloadsearchix-3b379a13710cae2adc56131af1069e6fb92976b8.tar.lz
searchix-3b379a13710cae2adc56131af1069e6fb92976b8.tar.zst
searchix-3b379a13710cae2adc56131af1069e6fb92976b8.zip
style: reformat with golines and enforce on commit
Diffstat (limited to 'internal/importer')
-rw-r--r--internal/importer/channel.go16
-rw-r--r--internal/importer/http.go6
-rw-r--r--internal/importer/importer.go12
-rw-r--r--internal/importer/nixpkgs-channel.go5
4 files changed, 33 insertions, 6 deletions
diff --git a/internal/importer/channel.go b/internal/importer/channel.go
index 4d051cc..b75839b 100644
--- a/internal/importer/channel.go
+++ b/internal/importer/channel.go
@@ -55,10 +55,22 @@ func (i *ChannelImporter) FetchIfNeeded(parent context.Context) (bool, error) {
 	i.Logger.Debug("nix-build", "output", strings.TrimSpace(string(out)))
 
 	outPath := path.Join(dest, i.Source.OutputPath)
-	i.Logger.Debug("checking output path", "outputPath", outPath, "dest", dest, "source", i.Source.OutputPath)
+	i.Logger.Debug(
+		"checking output path",
+		"outputPath",
+		outPath,
+		"dest",
+		dest,
+		"source",
+		i.Source.OutputPath,
+	)
 	after, err := os.Readlink(dest)
 	if err := file.NeedNotExist(err); err != nil {
-		return false, errors.WithMessagef(err, "failed to stat output file from nix-build, filename: %s", outPath)
+		return false, errors.WithMessagef(
+			err,
+			"failed to stat output file from nix-build, filename: %s",
+			outPath,
+		)
 	}
 	i.Logger.Debug("stat after", "name", after)
 
diff --git a/internal/importer/http.go b/internal/importer/http.go
index 1bf2428..6d60c44 100644
--- a/internal/importer/http.go
+++ b/internal/importer/http.go
@@ -44,7 +44,11 @@ func fetchFileIfNeeded(ctx context.Context, path string, url string) (needed boo
 	case http.StatusOK:
 		newMtime, err := time.Parse(time.RFC1123, res.Header.Get("Last-Modified"))
 		if err != nil {
-			slog.Warn("could not parse Last-Modified header from response", "value", res.Header.Get("Last-Modified"))
+			slog.Warn(
+				"could not parse Last-Modified header from response",
+				"value",
+				res.Header.Get("Last-Modified"),
+			)
 		}
 		err = file.WriteToFile(path, res.Body)
 		if err != nil {
diff --git a/internal/importer/importer.go b/internal/importer/importer.go
index 2318fe4..4d563fd 100644
--- a/internal/importer/importer.go
+++ b/internal/importer/importer.go
@@ -27,7 +27,11 @@ type Importer interface {
 	Import(context.Context, *search.WriteIndex) (bool, error)
 }
 
-func NewNixpkgsChannelImporter(source Source, dataPath string, logger *slog.Logger) *NixpkgsChannelImporter {
+func NewNixpkgsChannelImporter(
+	source Source,
+	dataPath string,
+	logger *slog.Logger,
+) *NixpkgsChannelImporter {
 	indexPath := dataPath
 	fullpath := path.Join(dataPath, source.Channel)
 
@@ -58,7 +62,11 @@ type importConfig struct {
 	Logger    *slog.Logger
 }
 
-func processOptions(parent context.Context, indexer *search.WriteIndex, conf *importConfig) (bool, error) {
+func processOptions(
+	parent context.Context,
+	indexer *search.WriteIndex,
+	conf *importConfig,
+) (bool, error) {
 	ctx, cancel := context.WithTimeout(parent, conf.Source.ImportTimeout)
 	defer cancel()
 
diff --git a/internal/importer/nixpkgs-channel.go b/internal/importer/nixpkgs-channel.go
index 0e5be62..e237246 100644
--- a/internal/importer/nixpkgs-channel.go
+++ b/internal/importer/nixpkgs-channel.go
@@ -63,7 +63,10 @@ func (i *NixpkgsChannelImporter) FetchIfNeeded(parent context.Context) (bool, er
 	return true, nil
 }
 
-func (i *NixpkgsChannelImporter) Import(parent context.Context, indexer *search.WriteIndex) (bool, error) {
+func (i *NixpkgsChannelImporter) Import(
+	parent context.Context,
+	indexer *search.WriteIndex,
+) (bool, error) {
 	filename := path.Join(i.DataPath, filesToFetch["options"])
 	revFilename := path.Join(i.DataPath, filesToFetch["revision"])
 	bits, err := os.ReadFile(revFilename)