about summary refs log tree commit diff stats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-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
-rw-r--r--internal/search/search.go13
-rw-r--r--internal/server/server.go5
6 files changed, 48 insertions, 9 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)
diff --git a/internal/search/search.go b/internal/search/search.go
index 9766294..bc77cea 100644
--- a/internal/search/search.go
+++ b/internal/search/search.go
@@ -50,14 +50,23 @@ func (index *ReadIndex) GetSource(ctx context.Context, name string) (*bleve.Sear
 		return nil, ctx.Err()
 	default:
 		if err != nil {
-			return nil, errors.WithMessagef(err, "failed to execute search to find source %s in index", name)
+			return nil, errors.WithMessagef(
+				err,
+				"failed to execute search to find source %s in index",
+				name,
+			)
 		}
 	}
 
 	return result, nil
 }
 
-func (index *ReadIndex) Search(ctx context.Context, source string, keyword string, from uint64) (*Result, error) {
+func (index *ReadIndex) Search(
+	ctx context.Context,
+	source string,
+	keyword string,
+	from uint64,
+) (*Result, error) {
 	sourceQuery := bleve.NewTermQuery(source)
 	userQuery := bleve.NewMatchQuery(keyword)
 	userQuery.Analyzer = "option_name"
diff --git a/internal/server/server.go b/internal/server/server.go
index 8252b8e..7ff174a 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -245,7 +245,10 @@ func New(runtimeConfig *Config) (*Server, error) {
 		}
 	})
 
-	mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("frontend/static"))))
+	mux.Handle(
+		"/static/",
+		http.StripPrefix("/static/", http.FileServer(http.Dir("frontend/static"))),
+	)
 
 	if runtimeConfig.LiveReload {
 		applyDevModeOverrides(config)